stitchkit 0.100.2 → 0.101.0

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 (242) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +2 -1
  3. package/dist/entrypoints/agent-runtime/browser.js +119 -119
  4. package/dist/entrypoints/agent-runtime/coding-tools.js +15 -20
  5. package/dist/entrypoints/agent-runtime/harness.js +55 -63
  6. package/dist/entrypoints/agent-runtime/openrouter.js +6 -6
  7. package/dist/entrypoints/agent-runtime/sandbox.js +20 -25
  8. package/dist/entrypoints/agent-runtime/sqlite/bun.js +11 -13
  9. package/dist/entrypoints/agent-runtime/sqlite/node.js +11 -13
  10. package/dist/entrypoints/agent-runtime/testing.js +32 -34
  11. package/dist/entrypoints/agent-runtime.js +395 -402
  12. package/dist/entrypoints/application/diagnostic-journal.js +26 -27
  13. package/dist/entrypoints/application/directory-inbox.js +16 -17
  14. package/dist/entrypoints/application/grammy.js +13 -13
  15. package/dist/entrypoints/application/opentelemetry.js +13 -13
  16. package/dist/entrypoints/application/schemas.js +24 -24
  17. package/dist/entrypoints/application.js +209 -210
  18. package/dist/entrypoints/bin/upgrade-cli.js +2 -2
  19. package/dist/entrypoints/cli.js +81 -84
  20. package/dist/entrypoints/contract.js +54 -57
  21. package/dist/entrypoints/declaration.js +22 -22
  22. package/dist/entrypoints/files.js +18 -21
  23. package/dist/entrypoints/geo.js +7 -8
  24. package/dist/entrypoints/google.js +2 -2
  25. package/dist/entrypoints/index.js +150 -154
  26. package/dist/entrypoints/live.js +45 -47
  27. package/dist/entrypoints/node.js +68 -74
  28. package/dist/entrypoints/oauth.js +6 -6
  29. package/dist/entrypoints/observability.d.ts +1 -0
  30. package/dist/entrypoints/observability.d.ts.map +1 -1
  31. package/dist/entrypoints/observability.js +116 -87
  32. package/dist/entrypoints/primitives.js +35 -35
  33. package/dist/entrypoints/react/keyboard.d.ts +4 -0
  34. package/dist/entrypoints/react/keyboard.d.ts.map +1 -0
  35. package/dist/entrypoints/react/keyboard.js +397 -0
  36. package/dist/entrypoints/react.js +10 -10
  37. package/dist/entrypoints/release.js +7 -7
  38. package/dist/entrypoints/remote.js +15 -17
  39. package/dist/entrypoints/server.js +198 -200
  40. package/dist/entrypoints/telegram/html.d.ts +5 -0
  41. package/dist/entrypoints/telegram/html.d.ts.map +1 -0
  42. package/dist/entrypoints/telegram/html.js +26 -0
  43. package/dist/entrypoints/telegram/screens.d.ts +14 -0
  44. package/dist/entrypoints/telegram/screens.d.ts.map +1 -0
  45. package/dist/entrypoints/telegram/screens.js +2028 -0
  46. package/dist/entrypoints/telegram.d.ts +11 -3
  47. package/dist/entrypoints/telegram.d.ts.map +1 -1
  48. package/dist/entrypoints/telegram.js +779 -159
  49. package/dist/entrypoints/testing.js +75 -79
  50. package/dist/entrypoints/tools/connections.js +30 -32
  51. package/dist/entrypoints/tools/contract.js +18 -20
  52. package/dist/entrypoints/tools/invoker.js +12 -17
  53. package/dist/entrypoints/tools.js +224 -229
  54. package/dist/entrypoints/tracking/server.js +6 -6
  55. package/dist/entrypoints/tracking.js +40 -42
  56. package/dist/entrypoints/voice.js +3 -3
  57. package/dist/{index-eaysmdtq.js → index-0ndk4555.js} +56 -56
  58. package/dist/{index-2bxbyab0.js → index-1bx1xv1k.js} +1 -1
  59. package/dist/{index-p5r7qpdd.js → index-1eeqpadm.js} +4 -4
  60. package/dist/{index-hadmp193.js → index-3ct7hhq6.js} +210 -210
  61. package/dist/{index-e01r054k.js → index-45tdvqa3.js} +26 -26
  62. package/dist/{index-dce5wxcq.js → index-4s0fep5q.js} +8 -8
  63. package/dist/index-50ejfz75.js +9 -0
  64. package/dist/{index-m9zn6cpq.js → index-5107q189.js} +12 -12
  65. package/dist/{index-sbdmyz75.js → index-5cc6r990.js} +3 -3
  66. package/dist/{index-c6bxbsnc.js → index-7kxw1awn.js} +2 -2
  67. package/dist/{index-0r0fbk7z.js → index-7z9ym7t8.js} +28 -28
  68. package/dist/{index-p7hgdyhb.js → index-814xpr6d.js} +2 -2
  69. package/dist/{index-gtj3zc53.js → index-8kzct1d6.js} +99 -99
  70. package/dist/{index-1zbbzgfh.js → index-9pw0a51a.js} +4 -4
  71. package/dist/{index-79z7m7dt.js → index-a9pd417t.js} +35 -35
  72. package/dist/{index-ham5sz8m.js → index-aaj97r4y.js} +45 -45
  73. package/dist/{index-s812ycat.js → index-aan6hqb9.js} +3 -3
  74. package/dist/{index-10x2hbx0.js → index-adhgd4pe.js} +44 -44
  75. package/dist/{index-2gxzjvyr.js → index-afjvjyck.js} +23 -23
  76. package/dist/{index-qmy6zq75.js → index-ahvsksw5.js} +16 -16
  77. package/dist/{index-hr4tzbwq.js → index-ap3gqe56.js} +3 -3
  78. package/dist/{index-znfs20ss.js → index-b2bz0kdm.js} +16 -16
  79. package/dist/{index-r066jx76.js → index-c6aagrbd.js} +148 -120
  80. package/dist/{index-k30h66yd.js → index-ck71tbcf.js} +9 -9
  81. package/dist/{index-eqqvgdb3.js → index-ct75c3at.js} +2 -2
  82. package/dist/{index-gw8bmyaj.js → index-djjhhgjk.js} +41 -41
  83. package/dist/{index-8qt2m66q.js → index-dvwj1f43.js} +43 -43
  84. package/dist/index-e05cjgtf.js +144 -0
  85. package/dist/{index-yw4fzmdz.js → index-e6c2spsd.js} +79 -30
  86. package/dist/{index-fhwqwxe0.js → index-ej331hah.js} +1 -1
  87. package/dist/{index-9t3dffv2.js → index-ewbaywk5.js} +5 -5
  88. package/dist/{index-7p1f0vp2.js → index-fyphpknh.js} +25 -25
  89. package/dist/{index-83bdg97s.js → index-g149e9pk.js} +1 -1
  90. package/dist/{index-ngfhvfpd.js → index-g6a3na27.js} +4 -4
  91. package/dist/{index-qwhynv6x.js → index-h124epcf.js} +20 -20
  92. package/dist/{index-h6eeys1v.js → index-h97tqqp1.js} +9 -9
  93. package/dist/{index-zcgf3gqf.js → index-hby4qhax.js} +10 -10
  94. package/dist/{index-5jrd0yng.js → index-j8aw2c0e.js} +4 -4
  95. package/dist/{index-d8m8zpd8.js → index-jzczzcsb.js} +14 -14
  96. package/dist/index-kqnd6a85.js +26 -0
  97. package/dist/{index-35mh5bhj.js → index-kw1ws0cs.js} +12 -12
  98. package/dist/{index-4gcnakhx.js → index-m38ej7e5.js} +2 -2
  99. package/dist/{index-ndddxtyx.js → index-m79yr938.js} +19 -19
  100. package/dist/{index-5p2m7we1.js → index-m9fndta6.js} +11 -11
  101. package/dist/index-mnkk1ffz.js +150 -0
  102. package/dist/index-n15jny5b.js +4 -0
  103. package/dist/{index-2vtcmrj9.js → index-n53mswt3.js} +20 -20
  104. package/dist/{index-bt14acb5.js → index-n5yqxd3d.js} +21 -21
  105. package/dist/{index-bm5rx7n6.js → index-n9tyz8z3.js} +12 -12
  106. package/dist/index-nmaqxdx7.js +463 -0
  107. package/dist/{index-mqv3b5rh.js → index-nx6eazt0.js} +30 -30
  108. package/dist/{index-3z73fh2c.js → index-q0th8q0z.js} +9 -9
  109. package/dist/{index-v260df89.js → index-qjeggp8w.js} +20 -20
  110. package/dist/{index-zfrhfn82.js → index-r1z0rd9c.js} +20 -20
  111. package/dist/{index-wqgjfstn.js → index-r5c4fedv.js} +3 -3
  112. package/dist/{index-cyktc4bp.js → index-r5hsgkz5.js} +118 -118
  113. package/dist/{index-0b1ess5e.js → index-r7a7r7ha.js} +1 -1
  114. package/dist/{index-1j8pm5t0.js → index-rfkh44ss.js} +15 -15
  115. package/dist/index-rz3z13e9.js +47 -0
  116. package/dist/{index-k6gpggb9.js → index-s80awwsw.js} +35 -35
  117. package/dist/{index-vqr7f7v8.js → index-ssmd41kh.js} +124 -124
  118. package/dist/index-sznqf8fx.js +20 -0
  119. package/dist/{index-ensd0r74.js → index-v14qqmys.js} +41 -41
  120. package/dist/{index-paz6sgdp.js → index-v4a2fjtk.js} +36 -36
  121. package/dist/{index-d9pk3td4.js → index-w0eqdhyd.js} +14 -14
  122. package/dist/{index-5qn1kx34.js → index-w575evhq.js} +29 -29
  123. package/dist/{index-3gye9wzb.js → index-w5s3xftz.js} +26 -26
  124. package/dist/{index-tm88avnj.js → index-wykebpn9.js} +3 -3
  125. package/dist/{index-sh3s86na.js → index-xkhk5d6g.js} +17 -17
  126. package/dist/{index-6k1937bx.js → index-xqhede6x.js} +4 -4
  127. package/dist/{index-f4fx2tza.js → index-zs4ms3th.js} +181 -181
  128. package/dist/{index-k5hsfc3j.js → index-zsvzhjtk.js} +1 -1
  129. package/dist/internal/secret-shapes.d.ts +21 -0
  130. package/dist/internal/secret-shapes.d.ts.map +1 -0
  131. package/dist/observability/bounded-logger.d.ts +2 -0
  132. package/dist/observability/bounded-logger.d.ts.map +1 -1
  133. package/dist/observability/sanitize.d.ts +6 -0
  134. package/dist/observability/sanitize.d.ts.map +1 -1
  135. package/dist/observability/secret-values.d.ts +25 -0
  136. package/dist/observability/secret-values.d.ts.map +1 -0
  137. package/dist/react/keyboard/hooks.d.ts +71 -0
  138. package/dist/react/keyboard/hooks.d.ts.map +1 -0
  139. package/dist/react/keyboard/layers.d.ts +98 -0
  140. package/dist/react/keyboard/layers.d.ts.map +1 -0
  141. package/dist/react/keyboard/zone.d.ts +139 -0
  142. package/dist/react/keyboard/zone.d.ts.map +1 -0
  143. package/dist/telegram/bot-api.d.ts +7 -4
  144. package/dist/telegram/bot-api.d.ts.map +1 -1
  145. package/dist/telegram/crypto.d.ts +16 -0
  146. package/dist/telegram/crypto.d.ts.map +1 -0
  147. package/dist/telegram/html/check.d.ts +26 -0
  148. package/dist/telegram/html/check.d.ts.map +1 -0
  149. package/dist/telegram/html/nodes.d.ts +70 -0
  150. package/dist/telegram/html/nodes.d.ts.map +1 -0
  151. package/dist/telegram/html/parse.d.ts +35 -0
  152. package/dist/telegram/html/parse.d.ts.map +1 -0
  153. package/dist/telegram/html/render.d.ts +39 -0
  154. package/dist/telegram/html/render.d.ts.map +1 -0
  155. package/dist/telegram/init-data.d.ts +3 -44
  156. package/dist/telegram/init-data.d.ts.map +1 -1
  157. package/dist/telegram/operator-channel.d.ts +19 -3
  158. package/dist/telegram/operator-channel.d.ts.map +1 -1
  159. package/dist/telegram/operator-dedupe.d.ts +44 -0
  160. package/dist/telegram/operator-dedupe.d.ts.map +1 -0
  161. package/dist/telegram/screens/callback-codec.d.ts +34 -0
  162. package/dist/telegram/screens/callback-codec.d.ts.map +1 -0
  163. package/dist/telegram/screens/dispatch.d.ts +22 -0
  164. package/dist/telegram/screens/dispatch.d.ts.map +1 -0
  165. package/dist/telegram/screens/display.d.ts +70 -0
  166. package/dist/telegram/screens/display.d.ts.map +1 -0
  167. package/dist/telegram/screens/execute.d.ts +57 -0
  168. package/dist/telegram/screens/execute.d.ts.map +1 -0
  169. package/dist/telegram/screens/html.d.ts +36 -0
  170. package/dist/telegram/screens/html.d.ts.map +1 -0
  171. package/dist/telegram/screens/outcome.d.ts +74 -0
  172. package/dist/telegram/screens/outcome.d.ts.map +1 -0
  173. package/dist/telegram/screens/path.d.ts +29 -0
  174. package/dist/telegram/screens/path.d.ts.map +1 -0
  175. package/dist/telegram/screens/reconcile.d.ts +67 -0
  176. package/dist/telegram/screens/reconcile.d.ts.map +1 -0
  177. package/dist/telegram/screens/registry.d.ts +23 -0
  178. package/dist/telegram/screens/registry.d.ts.map +1 -0
  179. package/dist/telegram/screens/render.d.ts +70 -0
  180. package/dist/telegram/screens/render.d.ts.map +1 -0
  181. package/dist/telegram/screens/runtime.d.ts +133 -0
  182. package/dist/telegram/screens/runtime.d.ts.map +1 -0
  183. package/dist/telegram/screens/screen-types.d.ts +130 -0
  184. package/dist/telegram/screens/screen-types.d.ts.map +1 -0
  185. package/dist/telegram/screens/screen.d.ts +138 -0
  186. package/dist/telegram/screens/screen.d.ts.map +1 -0
  187. package/dist/telegram/screens/state.d.ts +115 -0
  188. package/dist/telegram/screens/state.d.ts.map +1 -0
  189. package/dist/telegram/screens/telegram-screens.d.ts +18 -0
  190. package/dist/telegram/screens/telegram-screens.d.ts.map +1 -0
  191. package/dist/telegram/screens/test-chat-telegram.d.ts +47 -0
  192. package/dist/telegram/screens/test-chat-telegram.d.ts.map +1 -0
  193. package/dist/telegram/screens/test-chat.d.ts +66 -0
  194. package/dist/telegram/screens/test-chat.d.ts.map +1 -0
  195. package/dist/telegram/screens/view.d.ts +89 -0
  196. package/dist/telegram/screens/view.d.ts.map +1 -0
  197. package/dist/telegram/send-failure.d.ts +25 -0
  198. package/dist/telegram/send-failure.d.ts.map +1 -1
  199. package/dist/telegram/update-intake.d.ts +82 -0
  200. package/dist/telegram/update-intake.d.ts.map +1 -0
  201. package/dist/telegram/update-store-check.d.ts +22 -0
  202. package/dist/telegram/update-store-check.d.ts.map +1 -0
  203. package/dist/telegram/update-store-postgres.d.ts +33 -0
  204. package/dist/telegram/update-store-postgres.d.ts.map +1 -0
  205. package/dist/telegram/update-store-sqlite.d.ts +26 -0
  206. package/dist/telegram/update-store-sqlite.d.ts.map +1 -0
  207. package/dist/telegram/update-store.d.ts +67 -0
  208. package/dist/telegram/update-store.d.ts.map +1 -0
  209. package/dist/telegram/user.d.ts +51 -0
  210. package/dist/telegram/user.d.ts.map +1 -0
  211. package/dist/telegram/webhook.d.ts +105 -0
  212. package/dist/telegram/webhook.d.ts.map +1 -0
  213. package/dist/tools/cli/args-fields.d.ts +8 -0
  214. package/dist/tools/cli/args-fields.d.ts.map +1 -1
  215. package/dist/tools/cli/args-route.d.ts.map +1 -1
  216. package/dist/tools/cli/args.d.ts.map +1 -1
  217. package/dist/tools/cli/help.d.ts.map +1 -1
  218. package/llms/cli.txt +8 -2
  219. package/llms/observability.txt +15 -2
  220. package/llms/react-keyboard.txt +193 -0
  221. package/llms/server.4.txt +16 -0
  222. package/llms/stitchkit.txt +10 -4
  223. package/llms/telegram-html.txt +35 -0
  224. package/llms/telegram-screens.txt +365 -0
  225. package/llms/telegram.txt +245 -11
  226. package/llms/{upgrading-0.74.0-0.100.0.txt → upgrading-0.74.0-0.101.0.txt} +39 -3
  227. package/llms/upgrading.txt +1 -1
  228. package/llms-full.txt +889 -19
  229. package/llms.txt +12 -7
  230. package/package.json +17 -2
  231. package/dist/index-2k4yrqkc.js +0 -9
  232. package/dist/index-crykmqkr.js +0 -26
  233. package/dist/index-y64k3s0h.js +0 -150
  234. package/dist/index-y91ry9h2.js +0 -4
  235. /package/dist/{index-hffjpmq9.js → index-9jfdm5tg.js} +0 -0
  236. /package/dist/{index-zjjyynm3.js → index-d4pa2bgs.js} +0 -0
  237. /package/dist/{index-rxfy4cq7.js → index-dwfv9a85.js} +0 -0
  238. /package/dist/{index-5jm36zv1.js → index-gfk7nrht.js} +0 -0
  239. /package/dist/{index-b9aefrqd.js → index-n1dqr7gf.js} +0 -0
  240. /package/dist/{index-q3pyb9n0.js → index-sykb5ag7.js} +0 -0
  241. /package/dist/{index-48ffdxgk.js → index-xhzq2qvj.js} +0 -0
  242. /package/dist/{index-kzfs85xp.js → index-zsarb5xp.js} +0 -0
@@ -1,94 +1,94 @@
1
1
  // src/agent-runtime/schemas.ts
2
2
  import { z } from "zod";
3
- var AgentRecordIdSchema = z.string().min(1);
4
- var AgentRecordVersionSchema = z.int().nonnegative();
5
- var AgentTimestampSchema = z.iso.datetime({ offset: true });
6
- var AgentJsonObjectSchema = z.record(z.string(), z.json());
7
- var AgentProviderEnvelopeSchema = z.object({
3
+ var AgentRecordIdSchema2 = z.string().min(1);
4
+ var AgentRecordVersionSchema2 = z.int().nonnegative();
5
+ var AgentTimestampSchema2 = z.iso.datetime({ offset: true });
6
+ var AgentJsonObjectSchema2 = z.record(z.string(), z.json());
7
+ var AgentProviderEnvelopeSchema2 = z.object({
8
8
  schemaVersion: z.int().positive(),
9
9
  provider: z.string().min(1),
10
- data: AgentJsonObjectSchema
10
+ data: AgentJsonObjectSchema2
11
11
  });
12
- var AgentProviderResponseSchema = z.object({
12
+ var AgentProviderResponseSchema2 = z.object({
13
13
  id: z.string().min(1),
14
14
  provider: z.string().min(1).optional()
15
15
  }).strict();
16
- var AgentTextPartSchema = z.object({
16
+ var AgentTextPartSchema2 = z.object({
17
17
  type: z.literal("text"),
18
18
  text: z.string()
19
19
  });
20
- var AgentReasoningPartSchema = z.object({
20
+ var AgentReasoningPartSchema2 = z.object({
21
21
  type: z.literal("reasoning"),
22
22
  text: z.string(),
23
- provider: AgentProviderEnvelopeSchema.optional()
23
+ provider: AgentProviderEnvelopeSchema2.optional()
24
24
  });
25
- var AgentFilePartSchema = z.object({
25
+ var AgentFilePartSchema2 = z.object({
26
26
  type: z.literal("file"),
27
27
  mediaType: z.string().min(1),
28
28
  reference: z.string().min(1),
29
29
  filename: z.string().min(1).optional()
30
30
  });
31
- var AgentSourcePartSchema = z.object({
31
+ var AgentSourcePartSchema2 = z.object({
32
32
  type: z.literal("source"),
33
33
  sourceId: z.string().min(1),
34
34
  url: z.url().optional(),
35
35
  title: z.string().optional()
36
36
  });
37
- var AgentToolCallPartSchema = z.object({
37
+ var AgentToolCallPartSchema2 = z.object({
38
38
  type: z.literal("tool-call"),
39
39
  callId: z.string().min(1),
40
40
  toolName: z.string().min(1),
41
41
  input: z.json(),
42
- provider: AgentProviderEnvelopeSchema.optional()
42
+ provider: AgentProviderEnvelopeSchema2.optional()
43
43
  });
44
- var AgentToolResultPartSchema = z.object({
44
+ var AgentToolResultPartSchema2 = z.object({
45
45
  type: z.literal("tool-result"),
46
46
  callId: z.string().min(1),
47
47
  toolName: z.string().min(1),
48
48
  outcome: z.enum(["success", "error", "interrupted"]),
49
49
  output: z.json().optional()
50
50
  });
51
- var AgentToolApprovalRequestPartSchema = z.object({
51
+ var AgentToolApprovalRequestPartSchema2 = z.object({
52
52
  type: z.literal("tool-approval-request"),
53
53
  approvalId: z.string().min(1),
54
54
  callId: z.string().min(1),
55
55
  isAutomatic: z.boolean().optional(),
56
56
  signature: z.string().min(1).optional()
57
57
  });
58
- var AgentToolApprovalResponsePartSchema = z.object({
58
+ var AgentToolApprovalResponsePartSchema2 = z.object({
59
59
  type: z.literal("tool-approval-response"),
60
60
  approvalId: z.string().min(1),
61
61
  approved: z.boolean(),
62
62
  reason: z.string().min(1).optional()
63
63
  });
64
- var AgentOpaquePartSchema = z.object({
64
+ var AgentOpaquePartSchema2 = z.object({
65
65
  type: z.literal("provider"),
66
- envelope: AgentProviderEnvelopeSchema
66
+ envelope: AgentProviderEnvelopeSchema2
67
67
  });
68
- var AgentControlPartSchema = z.object({
68
+ var AgentControlPartSchema2 = z.object({
69
69
  type: z.literal("control"),
70
70
  reason: z.enum(["run-interrupted", "stale-run"])
71
71
  });
72
- var AgentMessagePartSchema = z.discriminatedUnion("type", [
73
- AgentTextPartSchema,
74
- AgentReasoningPartSchema,
75
- AgentFilePartSchema,
76
- AgentSourcePartSchema,
77
- AgentToolCallPartSchema,
78
- AgentToolResultPartSchema,
79
- AgentToolApprovalRequestPartSchema,
80
- AgentToolApprovalResponsePartSchema,
81
- AgentOpaquePartSchema,
82
- AgentControlPartSchema
72
+ var AgentMessagePartSchema2 = z.discriminatedUnion("type", [
73
+ AgentTextPartSchema2,
74
+ AgentReasoningPartSchema2,
75
+ AgentFilePartSchema2,
76
+ AgentSourcePartSchema2,
77
+ AgentToolCallPartSchema2,
78
+ AgentToolResultPartSchema2,
79
+ AgentToolApprovalRequestPartSchema2,
80
+ AgentToolApprovalResponsePartSchema2,
81
+ AgentOpaquePartSchema2,
82
+ AgentControlPartSchema2
83
83
  ]);
84
- var AgentMessageRoleSchema = z.enum([
84
+ var AgentMessageRoleSchema2 = z.enum([
85
85
  "user",
86
86
  "assistant",
87
87
  "tool",
88
88
  "system",
89
89
  "summary"
90
90
  ]);
91
- var AgentMessageStatusSchema = z.enum([
91
+ var AgentMessageStatusSchema2 = z.enum([
92
92
  "committed",
93
93
  "streaming",
94
94
  "completed",
@@ -96,28 +96,28 @@ var AgentMessageStatusSchema = z.enum([
96
96
  "superseded",
97
97
  "failed"
98
98
  ]);
99
- var AgentMessageSchema = z.object({
99
+ var AgentMessageSchema2 = z.object({
100
100
  schemaVersion: z.literal(1),
101
- id: AgentRecordIdSchema,
102
- conversationId: AgentRecordIdSchema,
103
- runId: AgentRecordIdSchema.optional(),
104
- role: AgentMessageRoleSchema,
105
- status: AgentMessageStatusSchema,
106
- parts: z.array(AgentMessagePartSchema),
107
- metadata: AgentJsonObjectSchema.optional(),
108
- createdAt: AgentTimestampSchema,
109
- updatedAt: AgentTimestampSchema
101
+ id: AgentRecordIdSchema2,
102
+ conversationId: AgentRecordIdSchema2,
103
+ runId: AgentRecordIdSchema2.optional(),
104
+ role: AgentMessageRoleSchema2,
105
+ status: AgentMessageStatusSchema2,
106
+ parts: z.array(AgentMessagePartSchema2),
107
+ metadata: AgentJsonObjectSchema2.optional(),
108
+ createdAt: AgentTimestampSchema2,
109
+ updatedAt: AgentTimestampSchema2
110
110
  });
111
- var AgentAssistantPlaceholderSchema = z.object({
111
+ var AgentAssistantPlaceholderSchema2 = z.object({
112
112
  schemaVersion: z.literal(1),
113
- id: AgentRecordIdSchema,
114
- conversationId: AgentRecordIdSchema,
115
- runId: AgentRecordIdSchema,
113
+ id: AgentRecordIdSchema2,
114
+ conversationId: AgentRecordIdSchema2,
115
+ runId: AgentRecordIdSchema2,
116
116
  status: z.literal("pending"),
117
- createdAt: AgentTimestampSchema,
118
- updatedAt: AgentTimestampSchema
117
+ createdAt: AgentTimestampSchema2,
118
+ updatedAt: AgentTimestampSchema2
119
119
  });
120
- var AgentRunStateSchema = z.enum([
120
+ var AgentRunStateSchema2 = z.enum([
121
121
  "queued",
122
122
  "running",
123
123
  "interrupt_requested",
@@ -128,9 +128,9 @@ var AgentRunStateSchema = z.enum([
128
128
  "cancelled",
129
129
  "abandoned"
130
130
  ]);
131
- var AgentRunQueuePrioritySchema = z.enum(["interrupt-next"]);
132
- var AgentRunOperationKindSchema = z.enum(["model-request", "compaction"]);
133
- var AgentRunOperationPhaseSchema = z.enum([
131
+ var AgentRunQueuePrioritySchema2 = z.enum(["interrupt-next"]);
132
+ var AgentRunOperationKindSchema2 = z.enum(["model-request", "compaction"]);
133
+ var AgentRunOperationPhaseSchema2 = z.enum([
134
134
  "started",
135
135
  "first-output",
136
136
  "completed",
@@ -138,15 +138,15 @@ var AgentRunOperationPhaseSchema = z.enum([
138
138
  "cancelled"
139
139
  ]);
140
140
  var AgentRunOperationFieldsSchema = z.object({
141
- operationId: AgentRecordIdSchema,
142
- kind: AgentRunOperationKindSchema,
143
- phase: AgentRunOperationPhaseSchema,
141
+ operationId: AgentRecordIdSchema2,
142
+ kind: AgentRunOperationKindSchema2,
143
+ phase: AgentRunOperationPhaseSchema2,
144
144
  step: z.int().nonnegative().optional(),
145
- startedAt: AgentTimestampSchema,
146
- firstOutputAt: AgentTimestampSchema.optional(),
147
- finishedAt: AgentTimestampSchema.optional()
145
+ startedAt: AgentTimestampSchema2,
146
+ firstOutputAt: AgentTimestampSchema2.optional(),
147
+ finishedAt: AgentTimestampSchema2.optional()
148
148
  });
149
- var AgentRunOperationSchema = AgentRunOperationFieldsSchema.superRefine((operation, ctx) => {
149
+ var AgentRunOperationSchema2 = AgentRunOperationFieldsSchema.superRefine((operation, ctx) => {
150
150
  if (operation.kind === "model-request" !== (operation.step !== undefined)) {
151
151
  ctx.addIssue({
152
152
  code: "custom",
@@ -177,7 +177,7 @@ var AgentRunOperationSchema = AgentRunOperationFieldsSchema.superRefine((operati
177
177
  });
178
178
  }
179
179
  });
180
- var AgentTerminalReasonSchema = z.enum([
180
+ var AgentTerminalReasonSchema2 = z.enum([
181
181
  "success",
182
182
  "policy_stop",
183
183
  "provider_stop",
@@ -194,7 +194,7 @@ var AgentTerminalReasonSchema = z.enum([
194
194
  "absorbed",
195
195
  "abandoned"
196
196
  ]);
197
- function runStateForTerminalReason(reason) {
197
+ function runStateForTerminalReason2(reason) {
198
198
  if (reason === "success" || reason === "policy_stop" || reason === "provider_stop") {
199
199
  return "completed";
200
200
  }
@@ -209,61 +209,61 @@ function runStateForTerminalReason(reason) {
209
209
  return "abandoned";
210
210
  return "failed";
211
211
  }
212
- var AgentProvenanceSchema = z.enum([
212
+ var AgentProvenanceSchema2 = z.enum([
213
213
  "provider-reported",
214
214
  "measured",
215
215
  "computed",
216
216
  "estimated",
217
217
  "unavailable"
218
218
  ]);
219
- var AgentUsageValueSchema = z.object({
219
+ var AgentUsageValueSchema2 = z.object({
220
220
  value: z.int().nonnegative().optional(),
221
- provenance: AgentProvenanceSchema.extract([
221
+ provenance: AgentProvenanceSchema2.extract([
222
222
  "provider-reported",
223
223
  "computed",
224
224
  "estimated",
225
225
  "unavailable"
226
226
  ])
227
227
  });
228
- var AgentCostValueSchema = z.object({
228
+ var AgentCostValueSchema2 = z.object({
229
229
  value: z.number().nonnegative().optional(),
230
230
  currency: z.string().length(3).optional(),
231
- provenance: AgentProvenanceSchema.extract([
231
+ provenance: AgentProvenanceSchema2.extract([
232
232
  "provider-reported",
233
233
  "computed",
234
234
  "estimated",
235
235
  "unavailable"
236
236
  ])
237
237
  });
238
- var AgentUsageSchema = z.object({
239
- inputTokens: AgentUsageValueSchema,
240
- outputTokens: AgentUsageValueSchema,
241
- reasoningTokens: AgentUsageValueSchema.optional(),
242
- cacheReadTokens: AgentUsageValueSchema.optional(),
243
- cacheWriteTokens: AgentUsageValueSchema.optional(),
244
- cost: AgentCostValueSchema.optional()
238
+ var AgentUsageSchema2 = z.object({
239
+ inputTokens: AgentUsageValueSchema2,
240
+ outputTokens: AgentUsageValueSchema2,
241
+ reasoningTokens: AgentUsageValueSchema2.optional(),
242
+ cacheReadTokens: AgentUsageValueSchema2.optional(),
243
+ cacheWriteTokens: AgentUsageValueSchema2.optional(),
244
+ cost: AgentCostValueSchema2.optional()
245
245
  });
246
246
  var AgentRunFieldsSchema = z.object({
247
247
  schemaVersion: z.literal(1),
248
- id: AgentRecordIdSchema,
249
- conversationId: AgentRecordIdSchema,
250
- inputMessageIds: z.array(AgentRecordIdSchema).min(1),
251
- assistantMessageId: AgentRecordIdSchema,
252
- state: AgentRunStateSchema,
253
- revision: AgentRecordVersionSchema,
254
- queuePriority: AgentRunQueuePrioritySchema.optional(),
255
- executionSequence: AgentRecordVersionSchema.optional(),
248
+ id: AgentRecordIdSchema2,
249
+ conversationId: AgentRecordIdSchema2,
250
+ inputMessageIds: z.array(AgentRecordIdSchema2).min(1),
251
+ assistantMessageId: AgentRecordIdSchema2,
252
+ state: AgentRunStateSchema2,
253
+ revision: AgentRecordVersionSchema2,
254
+ queuePriority: AgentRunQueuePrioritySchema2.optional(),
255
+ executionSequence: AgentRecordVersionSchema2.optional(),
256
256
  ownerId: z.string().min(1).optional(),
257
- fencingToken: AgentRecordVersionSchema.optional(),
258
- terminalReason: AgentTerminalReasonSchema.optional(),
257
+ fencingToken: AgentRecordVersionSchema2.optional(),
258
+ terminalReason: AgentTerminalReasonSchema2.optional(),
259
259
  terminalPolicyName: z.string().min(1).optional(),
260
- absorbedIntoRunId: AgentRecordIdSchema.optional(),
261
- usage: AgentUsageSchema.optional(),
262
- lastOperation: AgentRunOperationSchema.optional(),
263
- createdAt: AgentTimestampSchema,
264
- updatedAt: AgentTimestampSchema
260
+ absorbedIntoRunId: AgentRecordIdSchema2.optional(),
261
+ usage: AgentUsageSchema2.optional(),
262
+ lastOperation: AgentRunOperationSchema2.optional(),
263
+ createdAt: AgentTimestampSchema2,
264
+ updatedAt: AgentTimestampSchema2
265
265
  });
266
- var AgentRunSchema = AgentRunFieldsSchema.superRefine((run, ctx) => {
266
+ var AgentRunSchema2 = AgentRunFieldsSchema.superRefine((run, ctx) => {
267
267
  if (run.terminalReason !== "absorbed" && run.absorbedIntoRunId !== undefined) {
268
268
  ctx.addIssue({
269
269
  code: "custom",
@@ -281,7 +281,7 @@ var AgentRunSchema = AgentRunFieldsSchema.superRefine((run, ctx) => {
281
281
  }
282
282
  return;
283
283
  }
284
- const expected = runStateForTerminalReason(run.terminalReason);
284
+ const expected = runStateForTerminalReason2(run.terminalReason);
285
285
  if (run.state !== expected) {
286
286
  ctx.addIssue({
287
287
  code: "custom",
@@ -319,18 +319,18 @@ var TERMINAL_RUN_STATES = new Set([
319
319
  "abandoned",
320
320
  "failed"
321
321
  ]);
322
- var AgentSnapshotSchema = z.object({
322
+ var AgentSnapshotSchema2 = z.object({
323
323
  schemaVersion: z.literal(1),
324
- conversationId: AgentRecordIdSchema,
325
- version: AgentRecordVersionSchema,
326
- messages: z.array(AgentMessageSchema),
327
- runs: z.array(AgentRunSchema)
324
+ conversationId: AgentRecordIdSchema2,
325
+ version: AgentRecordVersionSchema2,
326
+ messages: z.array(AgentMessageSchema2),
327
+ runs: z.array(AgentRunSchema2)
328
328
  });
329
- var AgentRunMetricsSchema = z.object({
329
+ var AgentRunMetricsSchema2 = z.object({
330
330
  partial: z.boolean(),
331
- usage: AgentUsageSchema,
331
+ usage: AgentUsageSchema2,
332
332
  durationMs: z.number().nonnegative().optional(),
333
333
  ttftMs: z.number().nonnegative().optional()
334
334
  });
335
335
 
336
- export { AgentRecordIdSchema, AgentRecordVersionSchema, AgentTimestampSchema, AgentJsonObjectSchema, AgentProviderEnvelopeSchema, AgentProviderResponseSchema, AgentTextPartSchema, AgentReasoningPartSchema, AgentFilePartSchema, AgentSourcePartSchema, AgentToolCallPartSchema, AgentToolResultPartSchema, AgentToolApprovalRequestPartSchema, AgentToolApprovalResponsePartSchema, AgentOpaquePartSchema, AgentControlPartSchema, AgentMessagePartSchema, AgentMessageRoleSchema, AgentMessageStatusSchema, AgentMessageSchema, AgentAssistantPlaceholderSchema, AgentRunStateSchema, AgentRunQueuePrioritySchema, AgentRunOperationKindSchema, AgentRunOperationPhaseSchema, AgentRunOperationSchema, AgentTerminalReasonSchema, runStateForTerminalReason, AgentProvenanceSchema, AgentUsageValueSchema, AgentCostValueSchema, AgentUsageSchema, AgentRunSchema, AgentSnapshotSchema, AgentRunMetricsSchema };
336
+ export { AgentRecordIdSchema2, AgentRecordVersionSchema2, AgentTimestampSchema2, AgentJsonObjectSchema2, AgentProviderEnvelopeSchema2, AgentProviderResponseSchema2, AgentTextPartSchema2, AgentReasoningPartSchema2, AgentFilePartSchema2, AgentSourcePartSchema2, AgentToolCallPartSchema2, AgentToolResultPartSchema2, AgentToolApprovalRequestPartSchema2, AgentToolApprovalResponsePartSchema2, AgentOpaquePartSchema2, AgentControlPartSchema2, AgentMessagePartSchema2, AgentMessageRoleSchema2, AgentMessageStatusSchema2, AgentMessageSchema2, AgentAssistantPlaceholderSchema2, AgentRunStateSchema2, AgentRunQueuePrioritySchema2, AgentRunOperationKindSchema2, AgentRunOperationPhaseSchema2, AgentRunOperationSchema2, AgentTerminalReasonSchema2, runStateForTerminalReason2, AgentProvenanceSchema2, AgentUsageValueSchema2, AgentCostValueSchema2, AgentUsageSchema2, AgentRunSchema2, AgentSnapshotSchema2, AgentRunMetricsSchema2 };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  safeJsonParse
3
- } from "./index-kzfs85xp.js";
3
+ } from "./index-zsarb5xp.js";
4
4
  import {
5
5
  isRecord
6
- } from "./index-hffjpmq9.js";
6
+ } from "./index-9jfdm5tg.js";
7
7
 
8
8
  // src/tools/schema/coerce.ts
9
9
  import { z } from "zod";
@@ -81,9 +81,9 @@ function coerceValue(value, schema) {
81
81
  }
82
82
  return current;
83
83
  }
84
- function coerceJsonArgs(args, schema) {
84
+ function coerceJsonArgs2(args, schema) {
85
85
  const coerced = coerceValue(args, schema);
86
86
  return isRecord(coerced) ? coerced : args;
87
87
  }
88
88
 
89
- export { coerceJsonArgs };
89
+ export { coerceJsonArgs2 };
@@ -1,6 +1,6 @@
1
1
  // src/durability/contract.ts
2
2
  import { z } from "zod";
3
- var DURABILITY_STEP_EVENT_KIND = "durability/step";
3
+ var DURABILITY_STEP_EVENT_KIND2 = "durability/step";
4
4
  var DURABILITY_PARK_EVENT_KIND = "durability/park";
5
5
  var DURABILITY_EVENT_EVENT_KIND = "durability/event";
6
6
  var DURABILITY_EFFECT_EVENT_KIND = "durability/effect";
@@ -43,14 +43,14 @@ var EffectEventPayloadSchema = z.discriminatedUnion("phase", [
43
43
  z.object({ ...EffectIdentity, phase: z.literal("uncertain") })
44
44
  ]);
45
45
 
46
- class StepResultDecodeError extends Error {
46
+ class StepResultDecodeError2 extends Error {
47
47
  constructor(message, options) {
48
48
  super(message, options);
49
49
  this.name = "StepResultDecodeError";
50
50
  }
51
51
  }
52
52
 
53
- class StepResultNotSerializableError extends Error {
53
+ class StepResultNotSerializableError2 extends Error {
54
54
  constructor(stepName, cause) {
55
55
  super(`Step "${stepName}" returned a value that is not JSON-serializable`, {
56
56
  cause
@@ -59,14 +59,14 @@ class StepResultNotSerializableError extends Error {
59
59
  }
60
60
  }
61
61
 
62
- class StepAbortedError extends Error {
62
+ class StepAbortedError2 extends Error {
63
63
  constructor(stepName) {
64
64
  super(`Step "${stepName}" was aborted before it started`);
65
65
  this.name = "StepAbortedError";
66
66
  }
67
67
  }
68
68
 
69
- class EffectUnresolvedError extends Error {
69
+ class EffectUnresolvedError2 extends Error {
70
70
  effectName;
71
71
  reason;
72
72
  constructor(effectName, reason, options) {
@@ -77,14 +77,14 @@ class EffectUnresolvedError extends Error {
77
77
  }
78
78
  }
79
79
 
80
- class ParkRecordDecodeError extends Error {
80
+ class ParkRecordDecodeError2 extends Error {
81
81
  constructor(message, options) {
82
82
  super(message, options);
83
83
  this.name = "ParkRecordDecodeError";
84
84
  }
85
85
  }
86
86
 
87
- class ParkAbortedError extends Error {
87
+ class ParkAbortedError2 extends Error {
88
88
  constructor(park) {
89
89
  super(`Park "${park}" was aborted before it was satisfied`);
90
90
  this.name = "ParkAbortedError";
@@ -153,10 +153,10 @@ function encodeStepResult(stepName, value) {
153
153
  try {
154
154
  encoded = JSON.stringify(DurableJsonSchema.parse(value));
155
155
  } catch (cause) {
156
- throw new StepResultNotSerializableError(stepName, cause);
156
+ throw new StepResultNotSerializableError2(stepName, cause);
157
157
  }
158
158
  if (encoded === undefined) {
159
- throw new StepResultNotSerializableError(stepName, value);
159
+ throw new StepResultNotSerializableError2(stepName, value);
160
160
  }
161
161
  return encoded;
162
162
  }
@@ -177,7 +177,7 @@ function encodeDeliveredPayload(event, id, payload) {
177
177
  function decodeStepPayload(event) {
178
178
  const parsed = StepEventPayloadSchema.safeParse(event.payload);
179
179
  if (!parsed.success) {
180
- throw new StepResultDecodeError(`Recorded step event ${event.eventId} in conversation ${event.conversationId} is malformed`, { cause: parsed.error });
180
+ throw new StepResultDecodeError2(`Recorded step event ${event.eventId} in conversation ${event.conversationId} is malformed`, { cause: parsed.error });
181
181
  }
182
182
  return parsed.data;
183
183
  }
@@ -185,20 +185,20 @@ function decodeRecordedResult(payload, event) {
185
185
  try {
186
186
  return DurableJsonSchema.parse(JSON.parse(payload.encoded));
187
187
  } catch (cause) {
188
- throw new StepResultDecodeError(`Recorded result for step "${payload.stepName}" (run ${payload.runId}, ` + `event ${event.eventId}) is not decodable JSON`, { cause });
188
+ throw new StepResultDecodeError2(`Recorded result for step "${payload.stepName}" (run ${payload.runId}, ` + `event ${event.eventId}) is not decodable JSON`, { cause });
189
189
  }
190
190
  }
191
191
  function decodeParkPayload(event) {
192
192
  const parsed = ParkEventPayloadSchema.safeParse(event.payload);
193
193
  if (!parsed.success) {
194
- throw new ParkRecordDecodeError(`Recorded park event ${event.eventId} in conversation ${event.conversationId} is malformed`, { cause: parsed.error });
194
+ throw new ParkRecordDecodeError2(`Recorded park event ${event.eventId} in conversation ${event.conversationId} is malformed`, { cause: parsed.error });
195
195
  }
196
196
  return parsed.data;
197
197
  }
198
198
  function decodeDeliveredPayload(event) {
199
199
  const parsed = DeliveredEventPayloadSchema.safeParse(event.payload);
200
200
  if (!parsed.success) {
201
- throw new ParkRecordDecodeError(`Delivered event ${event.eventId} in conversation ${event.conversationId} is malformed`, { cause: parsed.error });
201
+ throw new ParkRecordDecodeError2(`Delivered event ${event.eventId} in conversation ${event.conversationId} is malformed`, { cause: parsed.error });
202
202
  }
203
203
  return parsed.data;
204
204
  }
@@ -206,13 +206,13 @@ function decodeDeliveredResult(payload, event) {
206
206
  try {
207
207
  return JSON.parse(payload.encoded);
208
208
  } catch (cause) {
209
- throw new ParkRecordDecodeError(`Delivered payload for "${payload.event}#${payload.id}" (run ${payload.runId}, ` + `event ${event.eventId}) is not decodable JSON`, { cause });
209
+ throw new ParkRecordDecodeError2(`Delivered payload for "${payload.event}#${payload.id}" (run ${payload.runId}, ` + `event ${event.eventId}) is not decodable JSON`, { cause });
210
210
  }
211
211
  }
212
212
  function decodeEffect(event) {
213
213
  const parsed = EffectEventPayloadSchema.safeParse(event.payload);
214
214
  if (!parsed.success) {
215
- throw new StepResultDecodeError(`Recorded effect event ${event.eventId} in conversation ${event.conversationId} is malformed`, { cause: parsed.error });
215
+ throw new StepResultDecodeError2(`Recorded effect event ${event.eventId} in conversation ${event.conversationId} is malformed`, { cause: parsed.error });
216
216
  }
217
217
  const payload = parsed.data;
218
218
  if (payload.phase === "intent")
@@ -223,7 +223,7 @@ function decodeEffect(event) {
223
223
  const proof = DurableJsonSchema.parse(JSON.parse(payload.encoded));
224
224
  return { payload, record: { outcome: "accepted", proof } };
225
225
  } catch (cause) {
226
- throw new StepResultDecodeError(`Recorded proof for effect "${payload.effectName}" (run ${payload.runId}, ` + `event ${event.eventId}) is not decodable JSON`, { cause });
226
+ throw new StepResultDecodeError2(`Recorded proof for effect "${payload.effectName}" (run ${payload.runId}, ` + `event ${event.eventId}) is not decodable JSON`, { cause });
227
227
  }
228
228
  }
229
229
  async function readDurabilityLedger(store, conversationId, view) {
@@ -236,7 +236,7 @@ async function readDurabilityLedger(store, conversationId, view) {
236
236
  limit: 1e4
237
237
  });
238
238
  for (const event of page.items) {
239
- if (event.kind === DURABILITY_STEP_EVENT_KIND) {
239
+ if (event.kind === DURABILITY_STEP_EVENT_KIND2) {
240
240
  const payload = decodeStepPayload(event);
241
241
  steps.set(stepKey(event.conversationId, payload.runId, payload.stepName), decodeRecordedResult(payload, event));
242
242
  } else if (event.kind === DURABILITY_PARK_EVENT_KIND) {
@@ -272,11 +272,11 @@ function encodeProof(name, proof) {
272
272
  try {
273
273
  encoded = encodeStepResult(name, proof);
274
274
  } catch (cause) {
275
- throw new EffectUnresolvedError(name, "proof-rejected", { cause });
275
+ throw new EffectUnresolvedError2(name, "proof-rejected", { cause });
276
276
  }
277
277
  const bytes = new TextEncoder().encode(encoded).byteLength;
278
278
  if (bytes > MAX_PROOF_BYTES) {
279
- throw new EffectUnresolvedError(name, "proof-rejected", {
279
+ throw new EffectUnresolvedError2(name, "proof-rejected", {
280
280
  cause: new RangeError(`the proof is ${bytes} bytes; at most ${MAX_PROOF_BYTES} are kept`)
281
281
  });
282
282
  }
@@ -308,12 +308,12 @@ async function reconcile(context, name, handlers, timeoutMs) {
308
308
  deadline
309
309
  ]);
310
310
  } catch (cause) {
311
- throw new EffectUnresolvedError(name, "reconcile-failed", { cause });
311
+ throw new EffectUnresolvedError2(name, "reconcile-failed", { cause });
312
312
  } finally {
313
313
  clearTimeout(timer);
314
314
  }
315
315
  if (found === "timeout") {
316
- throw new EffectUnresolvedError(name, "reconcile-timeout", {
316
+ throw new EffectUnresolvedError2(name, "reconcile-timeout", {
317
317
  cause: controller.signal.reason
318
318
  });
319
319
  }
@@ -338,7 +338,7 @@ async function executeEffect(context, name, handlers, options) {
338
338
  return outcomeOf(JSON.stringify(recorded.proof));
339
339
  }
340
340
  if (options?.signal?.aborted || context.signal?.aborted)
341
- throw new StepAbortedError(name);
341
+ throw new StepAbortedError2(name);
342
342
  if (recorded)
343
343
  return reconcile(context, name, handlers, timeoutMs);
344
344
  await append(context, { phase: "intent" }, name);
@@ -346,7 +346,7 @@ async function executeEffect(context, name, handlers, options) {
346
346
  try {
347
347
  proof = await handlers.run();
348
348
  } catch (cause) {
349
- throw new EffectUnresolvedError(name, "run-failed", { cause });
349
+ throw new EffectUnresolvedError2(name, "run-failed", { cause });
350
350
  }
351
351
  const encoded = encodeProof(name, proof);
352
352
  await append(context, { phase: "accepted", encoded, via: "run" }, name);
@@ -395,13 +395,13 @@ function waitForTimer(clock, delayMs, signal) {
395
395
  async function waitForDeadline(clock, deadline, park, signal) {
396
396
  for (;; ) {
397
397
  if (signal?.aborted)
398
- throw new ParkAbortedError(park);
398
+ throw new ParkAbortedError2(park);
399
399
  const remaining = deadline - clock.now();
400
400
  if (remaining <= 0)
401
401
  return;
402
402
  const outcome = await waitForTimer(clock, remaining, signal);
403
403
  if (outcome === "aborted")
404
- throw new ParkAbortedError(park);
404
+ throw new ParkAbortedError2(park);
405
405
  }
406
406
  }
407
407
  function createParkWaiter(parkWaiters, key, signal) {
@@ -446,7 +446,7 @@ async function executeSleep(park, name, seconds, runOptions) {
446
446
  let deadline;
447
447
  if (existing) {
448
448
  if (existing.kind !== "sleep") {
449
- throw new ParkRecordDecodeError(`Recorded park "${name}" is not a sleep record`);
449
+ throw new ParkRecordDecodeError2(`Recorded park "${name}" is not a sleep record`);
450
450
  }
451
451
  deadline = existing.deadline;
452
452
  } else {
@@ -460,7 +460,7 @@ async function executeSleep(park, name, seconds, runOptions) {
460
460
  });
461
461
  }
462
462
  if (signal?.aborted)
463
- throw new ParkAbortedError(name);
463
+ throw new ParkAbortedError2(name);
464
464
  await waitForDeadline(park.clock, deadline, name, signal);
465
465
  }
466
466
  async function executeWait(park, eventName, id, runOptions) {
@@ -469,7 +469,7 @@ async function executeWait(park, eventName, id, runOptions) {
469
469
  const signal = park.signal && runOptions?.signal ? AbortSignal.any([park.signal, runOptions.signal]) : runOptions?.signal ?? park.signal;
470
470
  for (;; ) {
471
471
  if (signal?.aborted)
472
- throw new ParkAbortedError(label);
472
+ throw new ParkAbortedError2(label);
473
473
  const waiter = createParkWaiter(park.waiters, key, signal);
474
474
  let unsubscribe;
475
475
  try {
@@ -487,7 +487,7 @@ async function executeWait(park, eventName, id, runOptions) {
487
487
  }
488
488
  const outcome = await waiter.outcome;
489
489
  if (outcome === "aborted")
490
- throw new ParkAbortedError(label);
490
+ throw new ParkAbortedError2(label);
491
491
  } finally {
492
492
  waiter.cancel();
493
493
  unsubscribe?.();
@@ -506,7 +506,7 @@ function releaseSettled(registry, key, pending) {
506
506
  function detachedResult(pending) {
507
507
  return pending.then((value) => JSON.parse(JSON.stringify(value)));
508
508
  }
509
- function createLocalStepDurability(options) {
509
+ function createLocalStepDurability2(options) {
510
510
  const { store, conversationId, runId } = options;
511
511
  const inFlight = stores.get(store) ?? {
512
512
  steps: new Map,
@@ -556,12 +556,12 @@ function createLocalStepDurability(options) {
556
556
  return recorded;
557
557
  }
558
558
  if (runOptions?.signal?.aborted || options.signal?.aborted)
559
- throw new StepAbortedError(name);
559
+ throw new StepAbortedError2(name);
560
560
  const value = await body();
561
561
  const encoded = encodeStepResult(name, value);
562
562
  await store.appendEvent({
563
563
  conversationId,
564
- kind: DURABILITY_STEP_EVENT_KIND,
564
+ kind: DURABILITY_STEP_EVENT_KIND2,
565
565
  payload: { runId, stepName: name, encoded }
566
566
  });
567
567
  return JSON.parse(encoded);
@@ -642,7 +642,7 @@ function createLocalStepDurability(options) {
642
642
  // src/tools/agent-tool-error.ts
643
643
  var AGENT_TOOL_ERROR_BRAND = Symbol.for("stitchkit.AgentToolError");
644
644
 
645
- class AgentToolError extends Error {
645
+ class AgentToolError2 extends Error {
646
646
  output;
647
647
  constructor(output, cause) {
648
648
  let message = "Tool execution failed";
@@ -655,7 +655,7 @@ class AgentToolError extends Error {
655
655
  Object.defineProperty(this, AGENT_TOOL_ERROR_BRAND, { value: true });
656
656
  }
657
657
  }
658
- function isAgentToolError(value) {
658
+ function isAgentToolError2(value) {
659
659
  return typeof value === "object" && value !== null && AGENT_TOOL_ERROR_BRAND in value;
660
660
  }
661
661
 
@@ -672,4 +672,4 @@ function resolveToolDurability(context, callId, signal) {
672
672
  return contexts.get(context)?.(callId, signal);
673
673
  }
674
674
 
675
- export { DURABILITY_STEP_EVENT_KIND, StepResultDecodeError, StepResultNotSerializableError, StepAbortedError, EffectUnresolvedError, ParkRecordDecodeError, ParkAbortedError, createLocalStepDurability, AgentToolError, isAgentToolError, createToolDurabilityContext, resolveToolDurability };
675
+ export { DURABILITY_STEP_EVENT_KIND2, StepResultDecodeError2, StepResultNotSerializableError2, StepAbortedError2, EffectUnresolvedError2, ParkRecordDecodeError2, ParkAbortedError2, createLocalStepDurability2, AgentToolError2, isAgentToolError2, createToolDurabilityContext, resolveToolDurability };