@leuduan/lagent 0.0.0-stage → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +144 -2
  3. package/dist/chunks/2O7ZGEIT.js +1 -0
  4. package/dist/chunks/2OSESBIL.js +1 -0
  5. package/dist/chunks/34KW6VNQ.js +1 -0
  6. package/dist/chunks/37YOGDGY.js +1 -0
  7. package/dist/chunks/3LQHQRIU.js +6 -0
  8. package/dist/chunks/3QCW4WDJ.js +1 -0
  9. package/dist/chunks/4XVRUSCQ.js +1 -0
  10. package/dist/chunks/6ECI2GGV.js +1 -0
  11. package/dist/chunks/74HKUGRR.js +1 -0
  12. package/dist/chunks/ADHERZLW.js +2 -0
  13. package/dist/chunks/AP6Q4EPT.js +36 -0
  14. package/dist/chunks/BM3S37EZ.js +1 -0
  15. package/dist/chunks/C5LYCXJG.js +1 -0
  16. package/dist/chunks/CDQG7RKA.js +1 -0
  17. package/dist/chunks/D7E6EWIE.js +3 -0
  18. package/dist/chunks/DDANMY45.js +3 -0
  19. package/dist/chunks/DRYAN665.js +1 -0
  20. package/dist/chunks/DXFXAYDN.js +17 -0
  21. package/dist/chunks/EGZI4XQX.js +24 -0
  22. package/dist/chunks/ENWFSU27.js +41 -0
  23. package/dist/chunks/G6RXC3AL.js +1 -0
  24. package/dist/chunks/G74AGRAJ.js +15 -0
  25. package/dist/chunks/GQGNVSKB.js +1 -0
  26. package/dist/chunks/IJ2WNMD5.js +7 -0
  27. package/dist/chunks/J5S4URAW.js +1 -0
  28. package/dist/chunks/JPZFKSWT.js +1 -0
  29. package/dist/chunks/KESCTXGO.js +5 -0
  30. package/dist/chunks/L3N4FIEN.js +1 -0
  31. package/dist/chunks/NAOUTU7A.js +4 -0
  32. package/dist/chunks/NDIM7MEW.js +1 -0
  33. package/dist/chunks/O4PPOM5Z.js +2 -0
  34. package/dist/chunks/OVZFGILJ.js +1 -0
  35. package/dist/chunks/P5ZHHOOM.js +6 -0
  36. package/dist/chunks/PUSUPTAT.js +1 -0
  37. package/dist/chunks/QMMLQJBS.js +1 -0
  38. package/dist/chunks/RK3VP2Q4.js +3 -0
  39. package/dist/chunks/SGGMBSBA.js +1 -0
  40. package/dist/chunks/SL2YLB2F.js +1 -0
  41. package/dist/chunks/TOOIB6J2.js +1 -0
  42. package/dist/chunks/TYTQRLTX.js +1 -0
  43. package/dist/chunks/UC3FVVJ2.js +5 -0
  44. package/dist/chunks/UCTEU62F.js +1 -0
  45. package/dist/chunks/UD3VJER6.js +1 -0
  46. package/dist/chunks/UKXMCHHT.js +1 -0
  47. package/dist/chunks/WUUKTSRT.js +7 -0
  48. package/dist/chunks/X65X4KP5.js +7 -0
  49. package/dist/chunks/YIR5MYGU.js +1 -0
  50. package/dist/chunks/YLNJXQ3Z.js +1 -0
  51. package/dist/context.d.ts +101 -0
  52. package/dist/index.d.ts +47 -0
  53. package/dist/index.js +77 -0
  54. package/dist/journal/catalog.d.ts +112 -0
  55. package/dist/journal/forkChain.d.ts +16 -0
  56. package/dist/journal/index.d.ts +15 -0
  57. package/dist/journal/journal.d.ts +475 -0
  58. package/dist/journal/projection.d.ts +87 -0
  59. package/dist/journal/store.d.ts +181 -0
  60. package/dist/kit/claim.d.ts +13 -0
  61. package/dist/kit/drain.d.ts +10 -0
  62. package/dist/kit/extension.d.ts +180 -0
  63. package/dist/kit/grants.d.ts +9 -0
  64. package/dist/kit/modes.d.ts +65 -0
  65. package/dist/kit/retries.d.ts +25 -0
  66. package/dist/kit/scope.d.ts +32 -0
  67. package/dist/kit/service.d.ts +7 -0
  68. package/dist/kit/strategy.d.ts +10 -0
  69. package/dist/kit/timers.d.ts +43 -0
  70. package/dist/kit/tool.d.ts +72 -0
  71. package/dist/llm/client.d.ts +135 -0
  72. package/dist/llm/content.d.ts +52 -0
  73. package/dist/llm/door.d.ts +21 -0
  74. package/dist/llm/door.js +1 -0
  75. package/dist/llm/failure.d.ts +82 -0
  76. package/dist/llm/index.d.ts +16 -0
  77. package/dist/llm/primitives.d.ts +286 -0
  78. package/dist/llm/prompt.d.ts +21 -0
  79. package/dist/llm/provider.d.ts +63 -0
  80. package/dist/llm/readLedger.d.ts +24 -0
  81. package/dist/llm/request.d.ts +58 -0
  82. package/dist/loop/agent.d.ts +134 -0
  83. package/dist/loop/auxiliary.d.ts +54 -0
  84. package/dist/loop/chain.d.ts +46 -0
  85. package/dist/loop/chunks.d.ts +27 -0
  86. package/dist/loop/continuation.d.ts +166 -0
  87. package/dist/loop/decide.d.ts +64 -0
  88. package/dist/loop/errors.d.ts +162 -0
  89. package/dist/loop/forks.d.ts +61 -0
  90. package/dist/loop/holds.d.ts +104 -0
  91. package/dist/loop/hooks.d.ts +241 -0
  92. package/dist/loop/inbox.d.ts +188 -0
  93. package/dist/loop/index.d.ts +37 -0
  94. package/dist/loop/limits.d.ts +14 -0
  95. package/dist/loop/opening.d.ts +42 -0
  96. package/dist/loop/prepare.d.ts +30 -0
  97. package/dist/loop/projections.d.ts +307 -0
  98. package/dist/loop/replace.d.ts +33 -0
  99. package/dist/loop/requests.d.ts +129 -0
  100. package/dist/loop/route.d.ts +53 -0
  101. package/dist/loop/runtime.d.ts +85 -0
  102. package/dist/loop/state.d.ts +70 -0
  103. package/dist/loop/strategy.d.ts +71 -0
  104. package/dist/loop/summary.d.ts +3 -0
  105. package/dist/loop/surface.d.ts +153 -0
  106. package/dist/loop/threadState.d.ts +72 -0
  107. package/dist/loop/tool.d.ts +101 -0
  108. package/dist/loop/toolCalls.d.ts +42 -0
  109. package/dist/loop/wake.d.ts +32 -0
  110. package/dist/models/config/agent.d.ts +18 -0
  111. package/dist/models/config/prompt.d.ts +18 -0
  112. package/dist/models/door.d.ts +12 -0
  113. package/dist/models/door.js +1 -0
  114. package/dist/models/index.d.ts +7 -0
  115. package/dist/models/jsonSchema.d.ts +7 -0
  116. package/dist/models/wire/journal.d.ts +2772 -0
  117. package/dist/models/wire/primitives.d.ts +65 -0
  118. package/dist/plugin.d.ts +53 -0
  119. package/dist/plugin.js +1 -0
  120. package/dist/plugins/agentsMd.d.ts +76 -0
  121. package/dist/plugins/agentsMd.js +1 -0
  122. package/dist/plugins/ask/askQuestion.d.ts +9 -0
  123. package/dist/plugins/ask/index.d.ts +26 -0
  124. package/dist/plugins/ask/index.js +1 -0
  125. package/dist/plugins/ask/service.d.ts +125 -0
  126. package/dist/plugins/commands/background.d.ts +8 -0
  127. package/dist/plugins/commands/foreground.d.ts +4 -0
  128. package/dist/plugins/commands/index.d.ts +40 -0
  129. package/dist/plugins/commands/index.js +1 -0
  130. package/dist/plugins/commands/output.d.ts +115 -0
  131. package/dist/plugins/commands/record.d.ts +549 -0
  132. package/dist/plugins/commands/service.d.ts +314 -0
  133. package/dist/plugins/commands/shell.d.ts +25 -0
  134. package/dist/plugins/compaction/checkpoint.d.ts +91 -0
  135. package/dist/plugins/compaction/config.d.ts +133 -0
  136. package/dist/plugins/compaction/estimate.d.ts +29 -0
  137. package/dist/plugins/compaction/index.d.ts +2 -0
  138. package/dist/plugins/compaction/index.js +7 -0
  139. package/dist/plugins/compaction/log.d.ts +61 -0
  140. package/dist/plugins/compaction/planner.d.ts +207 -0
  141. package/dist/plugins/compaction/preset.d.ts +86 -0
  142. package/dist/plugins/compaction/prune.d.ts +9 -0
  143. package/dist/plugins/compaction/records.d.ts +227 -0
  144. package/dist/plugins/compaction/segments.d.ts +23 -0
  145. package/dist/plugins/compaction/shared.d.ts +14 -0
  146. package/dist/plugins/compaction/summarize.d.ts +13 -0
  147. package/dist/plugins/dateAndBranch.d.ts +47 -0
  148. package/dist/plugins/dateAndBranch.js +1 -0
  149. package/dist/plugins/delegations/answers.d.ts +39 -0
  150. package/dist/plugins/delegations/assignmentKey.d.ts +22 -0
  151. package/dist/plugins/delegations/cleanup.d.ts +161 -0
  152. package/dist/plugins/delegations/constraint.d.ts +76 -0
  153. package/dist/plugins/delegations/index.d.ts +39 -0
  154. package/dist/plugins/delegations/index.js +1 -0
  155. package/dist/plugins/delegations/notices.d.ts +261 -0
  156. package/dist/plugins/delegations/obligations.d.ts +210 -0
  157. package/dist/plugins/delegations/record.d.ts +632 -0
  158. package/dist/plugins/delegations/request.d.ts +381 -0
  159. package/dist/plugins/delegations/role.d.ts +30 -0
  160. package/dist/plugins/delegations/service.d.ts +562 -0
  161. package/dist/plugins/delegations/standing.d.ts +19 -0
  162. package/dist/plugins/delegations/stopCheck.d.ts +21 -0
  163. package/dist/plugins/delegations/testing.d.ts +16 -0
  164. package/dist/plugins/delegations/tools.d.ts +71 -0
  165. package/dist/plugins/delegations/waitBook.d.ts +116 -0
  166. package/dist/plugins/delegations/waits.d.ts +118 -0
  167. package/dist/plugins/diagnostics/digest.d.ts +14 -0
  168. package/dist/plugins/diagnostics/index.d.ts +68 -0
  169. package/dist/plugins/diagnostics/index.js +1 -0
  170. package/dist/plugins/historyRecall/history.d.ts +9 -0
  171. package/dist/plugins/historyRecall/index.d.ts +31 -0
  172. package/dist/plugins/historyRecall/index.js +1 -0
  173. package/dist/plugins/historyRecall/render.d.ts +34 -0
  174. package/dist/plugins/historyRecall/tools.d.ts +4 -0
  175. package/dist/plugins/mcp/catalog.d.ts +36 -0
  176. package/dist/plugins/mcp/config.d.ts +63 -0
  177. package/dist/plugins/mcp/connection.d.ts +53 -0
  178. package/dist/plugins/mcp/errors.d.ts +32 -0
  179. package/dist/plugins/mcp/index.d.ts +33 -0
  180. package/dist/plugins/mcp/index.js +5 -0
  181. package/dist/plugins/mcp/mount.d.ts +98 -0
  182. package/dist/plugins/mcp/names.d.ts +25 -0
  183. package/dist/plugins/mcp/render.d.ts +29 -0
  184. package/dist/plugins/mcp/slots.d.ts +15 -0
  185. package/dist/plugins/mcp/stdio.d.ts +49 -0
  186. package/dist/plugins/mcp/tool.d.ts +41 -0
  187. package/dist/plugins/providers/anthropic.d.ts +175 -0
  188. package/dist/plugins/providers/anthropicMessages.d.ts +65 -0
  189. package/dist/plugins/providers/codex.d.ts +60 -0
  190. package/dist/plugins/providers/codexAuth.d.ts +116 -0
  191. package/dist/plugins/providers/deepseek.d.ts +55 -0
  192. package/dist/plugins/providers/door.d.ts +61 -0
  193. package/dist/plugins/providers/door.js +1 -0
  194. package/dist/plugins/providers/failure.d.ts +23 -0
  195. package/dist/plugins/providers/gateway.d.ts +23 -0
  196. package/dist/plugins/providers/index.d.ts +6 -0
  197. package/dist/plugins/providers/openaiChat.d.ts +62 -0
  198. package/dist/plugins/providers/openaiResponses.d.ts +100 -0
  199. package/dist/plugins/providers/opencodeCopilot.d.ts +23 -0
  200. package/dist/plugins/providers/opencodeGo.d.ts +98 -0
  201. package/dist/plugins/providers/shared.d.ts +104 -0
  202. package/dist/plugins/providers/stream.d.ts +154 -0
  203. package/dist/plugins/routeContext.d.ts +22 -0
  204. package/dist/plugins/routeContext.js +1 -0
  205. package/dist/plugins/schedules/index.d.ts +21 -0
  206. package/dist/plugins/schedules/index.js +5 -0
  207. package/dist/plugins/schedules/record.d.ts +396 -0
  208. package/dist/plugins/schedules/service.d.ts +120 -0
  209. package/dist/plugins/schedules/time.d.ts +26 -0
  210. package/dist/plugins/schedules/tools.d.ts +6 -0
  211. package/dist/plugins/skills/discovery.d.ts +54 -0
  212. package/dist/plugins/skills/index.d.ts +31 -0
  213. package/dist/plugins/skills/index.js +1 -0
  214. package/dist/plugins/skills/tool.d.ts +11 -0
  215. package/dist/plugins/store/durableObject.d.ts +23 -0
  216. package/dist/plugins/store/durableObject.js +1 -0
  217. package/dist/plugins/store/durableObjectConnection.d.ts +27 -0
  218. package/dist/plugins/store/memory.d.ts +29 -0
  219. package/dist/plugins/store/sql.d.ts +59 -0
  220. package/dist/plugins/store/sqlite.d.ts +31 -0
  221. package/dist/plugins/store/sqlite.js +1 -0
  222. package/dist/plugins/subAgents/availableRoutes.d.ts +53 -0
  223. package/dist/plugins/subAgents/fork.d.ts +32 -0
  224. package/dist/plugins/subAgents/index.d.ts +67 -0
  225. package/dist/plugins/subAgents/index.js +1 -0
  226. package/dist/plugins/subAgents/tool.d.ts +38 -0
  227. package/dist/plugins/toolPolicy/index.d.ts +61 -0
  228. package/dist/plugins/toolPolicy/index.js +1 -0
  229. package/dist/plugins/tools/editFiles.d.ts +128 -0
  230. package/dist/plugins/tools/fsRead.d.ts +17 -0
  231. package/dist/plugins/tools/html.d.ts +23 -0
  232. package/dist/plugins/tools/index.d.ts +59 -0
  233. package/dist/plugins/tools/index.js +1 -0
  234. package/dist/plugins/tools/network.d.ts +23 -0
  235. package/dist/plugins/tools/ripgrep.d.ts +20 -0
  236. package/dist/plugins/tools/textEdit.d.ts +67 -0
  237. package/dist/plugins/tools/web.d.ts +32 -0
  238. package/dist/plugins/truncateToolOutput.d.ts +26 -0
  239. package/dist/plugins/truncateToolOutput.js +1 -0
  240. package/dist/plugins/usage/index.d.ts +24 -0
  241. package/dist/plugins/usage/index.js +1 -0
  242. package/dist/plugins/usage/tracker.d.ts +34 -0
  243. package/dist/plugins/verify/facts.d.ts +356 -0
  244. package/dist/plugins/verify/index.d.ts +75 -0
  245. package/dist/plugins/verify/index.js +1 -0
  246. package/dist/plugins/verify/service.d.ts +90 -0
  247. package/dist/plugins/workflows/assignment.d.ts +16 -0
  248. package/dist/plugins/workflows/bindings.d.ts +95 -0
  249. package/dist/plugins/workflows/cleanup.d.ts +38 -0
  250. package/dist/plugins/workflows/definition.d.ts +184 -0
  251. package/dist/plugins/workflows/fold.d.ts +373 -0
  252. package/dist/plugins/workflows/index.d.ts +28 -0
  253. package/dist/plugins/workflows/index.js +6 -0
  254. package/dist/plugins/workflows/observations.d.ts +81 -0
  255. package/dist/plugins/workflows/participants.d.ts +143 -0
  256. package/dist/plugins/workflows/policy.d.ts +112 -0
  257. package/dist/plugins/workflows/providers.d.ts +146 -0
  258. package/dist/plugins/workflows/record.d.ts +2863 -0
  259. package/dist/plugins/workflows/routing.d.ts +116 -0
  260. package/dist/plugins/workflows/schema.d.ts +26 -0
  261. package/dist/plugins/workflows/service.d.ts +477 -0
  262. package/dist/plugins/workflows/submit.d.ts +8 -0
  263. package/dist/plugins/workflows/view.d.ts +103 -0
  264. package/dist/plugins/workflows/work.d.ts +21 -0
  265. package/dist/plugins/workspaceContext.d.ts +38 -0
  266. package/dist/plugins/workspaceContext.js +1 -0
  267. package/dist/presets/agents.d.ts +7 -0
  268. package/dist/presets/base.d.ts +10 -0
  269. package/dist/presets/codex.d.ts +60 -0
  270. package/dist/presets/index.d.ts +4 -0
  271. package/dist/presets/prompts.d.ts +56 -0
  272. package/dist/sandbox/absent.d.ts +32 -0
  273. package/dist/sandbox/client.d.ts +39 -0
  274. package/dist/sandbox/files.d.ts +28 -0
  275. package/dist/sandbox/index.d.ts +49 -0
  276. package/dist/sandbox/index.js +4 -0
  277. package/dist/sandbox/mode.d.ts +57 -0
  278. package/dist/sandbox/policy.d.ts +86 -0
  279. package/dist/sandbox/protocol.d.ts +107 -0
  280. package/dist/sandbox/service.d.ts +143 -0
  281. package/dist/sandbox/worker.d.ts +12 -0
  282. package/dist/sandbox/worker.js +1 -0
  283. package/dist/services/admission.d.ts +174 -0
  284. package/dist/services/agents.d.ts +37 -0
  285. package/dist/services/birth.d.ts +220 -0
  286. package/dist/services/contributions.d.ts +73 -0
  287. package/dist/services/core.d.ts +34 -0
  288. package/dist/services/journal.d.ts +26 -0
  289. package/dist/services/launches.d.ts +104 -0
  290. package/dist/services/llm.d.ts +80 -0
  291. package/dist/services/owner.d.ts +367 -0
  292. package/dist/services/preset.d.ts +154 -0
  293. package/dist/services/presets.d.ts +139 -0
  294. package/dist/services/prompts.d.ts +67 -0
  295. package/dist/services/runEvents.d.ts +79 -0
  296. package/dist/services/thread.d.ts +267 -0
  297. package/dist/services/threadActivation.d.ts +100 -0
  298. package/dist/services/threadDirs.d.ts +38 -0
  299. package/dist/services/threadView.d.ts +92 -0
  300. package/dist/services/threads.d.ts +449 -0
  301. package/dist/services/tools.d.ts +41 -0
  302. package/dist/sys/environment.d.ts +47 -0
  303. package/dist/sys/git.d.ts +60 -0
  304. package/dist/sys/paths.d.ts +56 -0
  305. package/dist/sys/spawn.d.ts +176 -0
  306. package/dist/testing/clock.d.ts +17 -0
  307. package/dist/testing/fakeLlm.d.ts +74 -0
  308. package/dist/testing/fedLlm.d.ts +32 -0
  309. package/dist/testing/helpers.d.ts +344 -0
  310. package/dist/testing/index.d.ts +13 -0
  311. package/dist/testing/index.js +1 -0
  312. package/dist/testing/processes.d.ts +13 -0
  313. package/dist/testing/sandbox.d.ts +71 -0
  314. package/dist/testing/settlement.d.ts +6 -0
  315. package/dist/testing/tmpDirs.d.ts +17 -0
  316. package/dist/util/async.d.ts +8 -0
  317. package/dist/util/diff.d.ts +25 -0
  318. package/dist/util/dispatch.d.ts +8 -0
  319. package/dist/util/errors.d.ts +28 -0
  320. package/dist/util/foldState.d.ts +17 -0
  321. package/dist/util/freeze.d.ts +2 -0
  322. package/dist/util/ids.d.ts +2 -0
  323. package/dist/util/json.d.ts +37 -0
  324. package/dist/util/log.d.ts +6 -0
  325. package/dist/util/text.d.ts +21 -0
  326. package/dist/util/version.d.ts +2 -0
  327. package/package.json +175 -3
@@ -0,0 +1,2772 @@
1
+ import { z } from 'zod';
2
+ import { type ContentPartInput } from '../../llm/index.js';
3
+ import type { DeepReadonly } from '../../util/json.js';
4
+ declare const seq: z.ZodNumber;
5
+ /** Monotonic position in the journal. Assigned by `append`, never by a caller. */
6
+ export type Seq = z.infer<typeof seq>;
7
+ /** Opaque to the engine. The named plugin owns payload validation and version upgrades. */
8
+ export declare const ExtensionRecordSchema: z.ZodObject<{
9
+ plugin: z.ZodString;
10
+ instance_id: z.ZodDefault<z.ZodString>;
11
+ kind: z.ZodString;
12
+ version: z.ZodNumber;
13
+ data: z.ZodJSONSchema;
14
+ }, z.core.$strip>;
15
+ export type ExtensionRecord = z.infer<typeof ExtensionRecordSchema>;
16
+ /**
17
+ * One preset installation as a thread records it: its id, the preset's id, and the configuration
18
+ * the preset's schema produced, which is what `setup` receives on every activation.
19
+ */
20
+ export declare const InstallationSchema: z.ZodObject<{
21
+ installation_id: z.ZodString;
22
+ preset_id: z.ZodString;
23
+ config: z.ZodJSONSchema;
24
+ }, z.core.$strict>;
25
+ export type Installation = z.infer<typeof InstallationSchema>;
26
+ /**
27
+ * How long an installation a thread is created with lasts: `defining`, for as long as the thread,
28
+ * never removed; `configurable`, until a configuration change removes it, as one applied later.
29
+ */
30
+ export declare const InstallationLifetimeSchema: z.ZodEnum<{
31
+ defining: "defining";
32
+ configurable: "configurable";
33
+ }>;
34
+ export type InstallationLifetime = z.infer<typeof InstallationLifetimeSchema>;
35
+ /** An installation a thread is created with, recorded in its spawn row with its lifetime. */
36
+ export declare const InitialInstallationSchema: z.ZodObject<{
37
+ installation_id: z.ZodString;
38
+ preset_id: z.ZodString;
39
+ config: z.ZodJSONSchema;
40
+ lifetime: z.ZodEnum<{
41
+ defining: "defining";
42
+ configurable: "configurable";
43
+ }>;
44
+ }, z.core.$strict>;
45
+ export type InitialInstallation = z.infer<typeof InitialInstallationSchema>;
46
+ /** One stop check's refusal of an answer, and the plugin that gave it. */
47
+ export declare const TurnRejectionSchema: z.ZodObject<{
48
+ reason: z.ZodString;
49
+ source: z.ZodObject<{
50
+ plugin: z.ZodString;
51
+ instance_id: z.ZodDefault<z.ZodString>;
52
+ kind: z.ZodString;
53
+ version: z.ZodNumber;
54
+ data: z.ZodJSONSchema;
55
+ }, z.core.$strip>;
56
+ }, z.core.$strip>;
57
+ export type TurnRejection = z.infer<typeof TurnRejectionSchema>;
58
+ /**
59
+ * Why a turn was interrupted. `abandoned`: the process died inside it, and recovery closed it the
60
+ * next time the thread ran. `activation-changed`: the activation's plugins changed under it; it
61
+ * takes precedence when the judgment was also invalidated. `judgment-invalidated`: the registrations
62
+ * its stop checks were fenced on, or the facts they declared they observed, no longer match.
63
+ */
64
+ export declare const InterruptionCauseSchema: z.ZodEnum<{
65
+ abandoned: "abandoned";
66
+ "activation-changed": "activation-changed";
67
+ "judgment-invalidated": "judgment-invalidated";
68
+ }>;
69
+ export type InterruptionCause = z.infer<typeof InterruptionCauseSchema>;
70
+ export declare const TurnEndReasonSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
71
+ kind: z.ZodLiteral<"completed">;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ kind: z.ZodLiteral<"blocked">;
74
+ }, z.core.$strip>, z.ZodObject<{
75
+ kind: z.ZodLiteral<"max-steps">;
76
+ limit: z.ZodNumber;
77
+ }, z.core.$strip>, z.ZodObject<{
78
+ kind: z.ZodLiteral<"interrupted">;
79
+ cause: z.ZodEnum<{
80
+ abandoned: "abandoned";
81
+ "activation-changed": "activation-changed";
82
+ "judgment-invalidated": "judgment-invalidated";
83
+ }>;
84
+ }, z.core.$strip>, z.ZodObject<{
85
+ kind: z.ZodLiteral<"aborted">;
86
+ reason: z.ZodString;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ kind: z.ZodLiteral<"error">;
89
+ error_text: z.ZodString;
90
+ failure_kind: z.ZodEnum<{
91
+ length: "length";
92
+ other: "other";
93
+ transport: "transport";
94
+ empty: "empty";
95
+ invalid: "invalid";
96
+ rate_limit: "rate_limit";
97
+ overloaded: "overloaded";
98
+ timeout: "timeout";
99
+ auth: "auth";
100
+ quota: "quota";
101
+ overflow: "overflow";
102
+ }>;
103
+ retry_after_ms: z.ZodNullable<z.ZodNumber>;
104
+ }, z.core.$strip>, z.ZodObject<{
105
+ kind: z.ZodLiteral<"rejected">;
106
+ rejections: z.ZodArray<z.ZodObject<{
107
+ reason: z.ZodString;
108
+ source: z.ZodObject<{
109
+ plugin: z.ZodString;
110
+ instance_id: z.ZodDefault<z.ZodString>;
111
+ kind: z.ZodString;
112
+ version: z.ZodNumber;
113
+ data: z.ZodJSONSchema;
114
+ }, z.core.$strip>;
115
+ }, z.core.$strip>>;
116
+ }, z.core.$strip>], "kind">;
117
+ export type TurnEndReason = z.infer<typeof TurnEndReasonSchema>;
118
+ /**
119
+ * What a re-dispatch may do with a call whose attempt was interrupted — the process stopped between
120
+ * the attempt's authorization and its result, so the tool may have begun and its outcome is unknown.
121
+ * `rerun`: the tool is read-only, or idempotent under its effect identity (the thread and the
122
+ * `tool/call` row), and runs again. `report`: the call is answered with an error saying it was
123
+ * interrupted and its outcome is unknown, and the model decides what to check before repeating it.
124
+ */
125
+ export declare const InterruptionPolicySchema: z.ZodEnum<{
126
+ rerun: "rerun";
127
+ report: "report";
128
+ }>;
129
+ export type InterruptionPolicy = z.infer<typeof InterruptionPolicySchema>;
130
+ /** Where queued input waits: `next-turn` opens a turn, `next-step` joins the one in flight. */
131
+ export declare const InboxTargetSchema: z.ZodEnum<{
132
+ "next-turn": "next-turn";
133
+ "next-step": "next-step";
134
+ }>;
135
+ export type InboxTarget = z.infer<typeof InboxTargetSchema>;
136
+ /**
137
+ * Roles an application or a plugin may put into a thread's input.
138
+ *
139
+ * Deliberately not `assistant` or `tool`: those are the model's and the loop's to write, and a
140
+ * queued one would invent a tool call or answer one. Not `system` either — the prompt travels
141
+ * beside the conversation, recorded once on `thread/prompt`.
142
+ */
143
+ export declare const INPUT_ROLES: readonly ["user", "developer"];
144
+ export type InputRole = (typeof INPUT_ROLES)[number];
145
+ /** Input as it waits in the inbox: a message the model has not seen yet, and the id that claims it. */
146
+ export declare const QueuedInputSchema: z.ZodObject<{
147
+ id: z.ZodString;
148
+ role: z.ZodDefault<z.ZodEnum<{
149
+ developer: "developer";
150
+ user: "user";
151
+ }>>;
152
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
153
+ type: z.ZodLiteral<"text">;
154
+ text: z.ZodString;
155
+ }, z.core.$strip>, z.ZodObject<{
156
+ type: z.ZodLiteral<"image">;
157
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
158
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
159
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
160
+ detail: z.ZodDefault<z.ZodEnum<{
161
+ auto: "auto";
162
+ low: "low";
163
+ high: "high";
164
+ }>>;
165
+ }, z.core.$strip>, z.ZodObject<{
166
+ type: z.ZodLiteral<"file">;
167
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
168
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
169
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
170
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
171
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
172
+ }, z.core.$strip>], "type">>>, unknown>;
173
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
174
+ plugin: z.ZodString;
175
+ instance_id: z.ZodDefault<z.ZodString>;
176
+ kind: z.ZodString;
177
+ version: z.ZodNumber;
178
+ data: z.ZodJSONSchema;
179
+ }, z.core.$strip>>>;
180
+ }, z.core.$strip>;
181
+ export type QueuedInput = z.infer<typeof QueuedInputSchema>;
182
+ /** What a caller may queue: text, or a message with a role and content parts. */
183
+ export type ThreadInput = string | {
184
+ role?: InputRole;
185
+ content: string | readonly ContentPartInput[];
186
+ };
187
+ /** Normalizes what a caller wrote into the queued form. Empty input is a caller bug, not a no-op. */
188
+ export declare function queuedInput(input: ThreadInput, id: string, source?: ExtensionRecord | null): QueuedInput;
189
+ /**
190
+ * A message a plugin adds to a model step that is already due. It is recorded as an `input/message`
191
+ * carrying `source`, so the plugin — and a frontend — can tell it from what the person typed.
192
+ */
193
+ export declare const StepContributionSchema: z.ZodObject<{
194
+ role: z.ZodDefault<z.ZodEnum<{
195
+ developer: "developer";
196
+ user: "user";
197
+ }>>;
198
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
199
+ type: z.ZodLiteral<"text">;
200
+ text: z.ZodString;
201
+ }, z.core.$strip>, z.ZodObject<{
202
+ type: z.ZodLiteral<"image">;
203
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
204
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
205
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
206
+ detail: z.ZodDefault<z.ZodEnum<{
207
+ auto: "auto";
208
+ low: "low";
209
+ high: "high";
210
+ }>>;
211
+ }, z.core.$strip>, z.ZodObject<{
212
+ type: z.ZodLiteral<"file">;
213
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
214
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
215
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
216
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
217
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
218
+ }, z.core.$strip>], "type">>>, unknown>;
219
+ source: z.ZodObject<{
220
+ plugin: z.ZodString;
221
+ instance_id: z.ZodDefault<z.ZodString>;
222
+ kind: z.ZodString;
223
+ version: z.ZodNumber;
224
+ data: z.ZodJSONSchema;
225
+ }, z.core.$strip>;
226
+ source_seqs: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
227
+ }, z.core.$strip>;
228
+ export type StepContribution = z.infer<typeof StepContributionSchema>;
229
+ export type StepContributionInput = z.input<typeof StepContributionSchema>;
230
+ export declare function stepContribution(input: StepContributionInput): StepContribution;
231
+ /**
232
+ * What made a strategy replace part of a surface: a model step it measured (`pressure`), a request
233
+ * the provider refused as too long (`overflow`), or someone asking (`request`).
234
+ */
235
+ export declare const ReplacementTriggerSchema: z.ZodEnum<{
236
+ overflow: "overflow";
237
+ pressure: "pressure";
238
+ request: "request";
239
+ }>;
240
+ export type ReplacementTrigger = z.infer<typeof ReplacementTriggerSchema>;
241
+ /**
242
+ * A replacement of part of what the model sees; the rows it replaces, cited in `source_seqs` in
243
+ * surface order, stay in the journal.
244
+ *
245
+ * The stand-in is stored as only what a replacement may change, and the fold builds the message: a
246
+ * `span`'s role and content, a `rewrite`'s content, which keeps the role and tool call id of the
247
+ * message it rewrites. So no stand-in can carry provider state, reasoning, provider calls, tool calls
248
+ * or usage — the Responses adapters replay a message's provider state in place of its content, and
249
+ * a stand-in that could carry one could replay the answer it stands for. The stand-ins are strict
250
+ * objects so a caller handing over a whole message is refused, not silently trimmed.
251
+ *
252
+ * A `span` stand-in speaks as `user` or `assistant`, never as the harness: it is a plugin's text
253
+ * standing for what the model and its tools said. The rules a replacement must meet against the
254
+ * surface it lands on are the surface's, in `loop/`, judged where the row is written.
255
+ */
256
+ declare const SurfaceReplacedSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
257
+ source: z.ZodObject<{
258
+ plugin: z.ZodString;
259
+ instance_id: z.ZodDefault<z.ZodString>;
260
+ kind: z.ZodString;
261
+ version: z.ZodNumber;
262
+ data: z.ZodJSONSchema;
263
+ }, z.core.$strip>;
264
+ trigger: z.ZodEnum<{
265
+ overflow: "overflow";
266
+ pressure: "pressure";
267
+ request: "request";
268
+ }>;
269
+ auxiliary_request_seq: z.ZodNullable<z.ZodNumber>;
270
+ turn: z.ZodNullable<z.ZodNumber>;
271
+ step: z.ZodNullable<z.ZodNumber>;
272
+ kind: z.ZodLiteral<"span">;
273
+ stand_in: z.ZodObject<{
274
+ role: z.ZodEnum<{
275
+ user: "user";
276
+ assistant: "assistant";
277
+ }>;
278
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
279
+ type: z.ZodLiteral<"text">;
280
+ text: z.ZodString;
281
+ }, z.core.$strip>, z.ZodObject<{
282
+ type: z.ZodLiteral<"image">;
283
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
284
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
285
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
286
+ detail: z.ZodDefault<z.ZodEnum<{
287
+ auto: "auto";
288
+ low: "low";
289
+ high: "high";
290
+ }>>;
291
+ }, z.core.$strip>, z.ZodObject<{
292
+ type: z.ZodLiteral<"file">;
293
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
294
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
295
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
296
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
297
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
298
+ }, z.core.$strip>], "type">>>, unknown>;
299
+ }, z.core.$strict>;
300
+ }, z.core.$strip>, z.ZodObject<{
301
+ source: z.ZodObject<{
302
+ plugin: z.ZodString;
303
+ instance_id: z.ZodDefault<z.ZodString>;
304
+ kind: z.ZodString;
305
+ version: z.ZodNumber;
306
+ data: z.ZodJSONSchema;
307
+ }, z.core.$strip>;
308
+ trigger: z.ZodEnum<{
309
+ overflow: "overflow";
310
+ pressure: "pressure";
311
+ request: "request";
312
+ }>;
313
+ auxiliary_request_seq: z.ZodNullable<z.ZodNumber>;
314
+ turn: z.ZodNullable<z.ZodNumber>;
315
+ step: z.ZodNullable<z.ZodNumber>;
316
+ kind: z.ZodLiteral<"rewrite">;
317
+ stand_in: z.ZodObject<{
318
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
319
+ type: z.ZodLiteral<"text">;
320
+ text: z.ZodString;
321
+ }, z.core.$strip>, z.ZodObject<{
322
+ type: z.ZodLiteral<"image">;
323
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
324
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
325
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
326
+ detail: z.ZodDefault<z.ZodEnum<{
327
+ auto: "auto";
328
+ low: "low";
329
+ high: "high";
330
+ }>>;
331
+ }, z.core.$strip>, z.ZodObject<{
332
+ type: z.ZodLiteral<"file">;
333
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
334
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
335
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
336
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
337
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
338
+ }, z.core.$strip>], "type">>>, unknown>;
339
+ }, z.core.$strict>;
340
+ }, z.core.$strip>], "kind">;
341
+ export type ReplacementKind = z.infer<typeof SurfaceReplacedSchema>['kind'];
342
+ /**
343
+ * What on the caller made a thread or a task: a `call`, the caller's `tool/call` row; or an
344
+ * `assignment` a registered owner made. An assignment's `key` is the owner's own record of it, which
345
+ * only the owner's codec reads; core never interprets it.
346
+ */
347
+ export declare const OriginCauseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
348
+ kind: z.ZodLiteral<"call">;
349
+ }, z.core.$strip>, z.ZodObject<{
350
+ kind: z.ZodLiteral<"assignment">;
351
+ owner: z.ZodString;
352
+ key: z.ZodJSONSchema;
353
+ }, z.core.$strip>], "kind">;
354
+ export type OriginCause = DeepReadonly<z.infer<typeof OriginCauseSchema>>;
355
+ /**
356
+ * Where a thread came from: the caller thread it sits under, the one link every walk of a tree
357
+ * follows whatever the cause, the caller's row that caused it, and the cause. `source_seq` is the
358
+ * caller's `tool/call` row for a `call`, and the row that granted an assignment for an
359
+ * `assignment`, so stop ordering and descendant authority read it without decoding the owner's key.
360
+ * Immutable once recorded; the journal checks that the row is on the caller's lineage, and a `call`'s
361
+ * is a `tool/call` (`origins.validate`).
362
+ */
363
+ export declare const ThreadOriginSchema: z.ZodObject<{
364
+ caller_thread_id: z.ZodString;
365
+ source_seq: z.ZodNumber;
366
+ cause: z.ZodDiscriminatedUnion<[z.ZodObject<{
367
+ kind: z.ZodLiteral<"call">;
368
+ }, z.core.$strip>, z.ZodObject<{
369
+ kind: z.ZodLiteral<"assignment">;
370
+ owner: z.ZodString;
371
+ key: z.ZodJSONSchema;
372
+ }, z.core.$strip>], "kind">;
373
+ }, z.core.$strip>;
374
+ export type ThreadOrigin = DeepReadonly<z.infer<typeof ThreadOriginSchema>>;
375
+ /**
376
+ * Where a forked thread continues from: the source thread and the row it was cut at. The child's
377
+ * thread-scoped state starts as the source's state at that row — the conversation, the prompt, the
378
+ * route, plugin state — without any of it being copied.
379
+ */
380
+ export declare const ThreadForkSchema: z.ZodObject<{
381
+ thread_id: z.ZodString;
382
+ seq: z.ZodNumber;
383
+ }, z.core.$strip>;
384
+ export type ThreadFork = z.infer<typeof ThreadForkSchema>;
385
+ /** Where a thread's work happens. Engine-read and typed, unlike `metadata`. */
386
+ export declare const ThreadEnvironmentSchema: z.ZodObject<{
387
+ cwd: z.ZodString;
388
+ read_roots: z.ZodArray<z.ZodString>;
389
+ }, z.core.$strip>;
390
+ export type ThreadEnvironment = z.infer<typeof ThreadEnvironmentSchema>;
391
+ /**
392
+ * How a turn a cause opens counts toward the bound on unattended work: a `person` asked for it,
393
+ * `fresh` authority from an assignment or a schedule gave it, or it is a `reactive` reply to work
394
+ * the thread itself set going.
395
+ */
396
+ export declare const RunChainSchema: z.ZodEnum<{
397
+ person: "person";
398
+ fresh: "fresh";
399
+ reactive: "reactive";
400
+ }>;
401
+ export type RunChain = z.infer<typeof RunChainSchema>;
402
+ /** How a run request ended. */
403
+ export declare const RunOutcomeKindSchema: z.ZodEnum<{
404
+ completed: "completed";
405
+ failed: "failed";
406
+ cancelled: "cancelled";
407
+ superseded: "superseded";
408
+ }>;
409
+ export type RunOutcomeKind = z.infer<typeof RunOutcomeKindSchema>;
410
+ /**
411
+ * Why a run request settled as it did: `answered`, its last turn completed with nothing left;
412
+ * `nothing`, it found nothing to do; `turn`, a turn ended in a failure; `setup`, it failed before
413
+ * any turn opened; `cancel`, a cancel captured it; `obsolete`, a constraint said its authority is
414
+ * gone for good.
415
+ */
416
+ export declare const RunSettledReasonSchema: z.ZodEnum<{
417
+ turn: "turn";
418
+ answered: "answered";
419
+ nothing: "nothing";
420
+ setup: "setup";
421
+ cancel: "cancel";
422
+ obsolete: "obsolete";
423
+ }>;
424
+ export type RunSettledReason = z.infer<typeof RunSettledReasonSchema>;
425
+ /** Who cancelled: a person (`user`), which holds the thread, or a feature's `cleanup`, which does not. */
426
+ export declare const CancelIntentSchema: z.ZodEnum<{
427
+ user: "user";
428
+ cleanup: "cleanup";
429
+ }>;
430
+ export type CancelIntent = z.infer<typeof CancelIntentSchema>;
431
+ export declare const JOURNAL_EVENT_DATA: {
432
+ /** Plugin state; never automatically part of the conversation or a frontend update. */
433
+ readonly ext: z.ZodObject<{
434
+ plugin: z.ZodString;
435
+ instance_id: z.ZodDefault<z.ZodString>;
436
+ kind: z.ZodString;
437
+ version: z.ZodNumber;
438
+ data: z.ZodJSONSchema;
439
+ }, z.core.$strip>;
440
+ readonly 'turn/start': z.ZodObject<{
441
+ turn: z.ZodNumber;
442
+ route: z.ZodObject<{
443
+ provider: z.ZodString;
444
+ model: z.ZodString;
445
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
446
+ low: "low";
447
+ high: "high";
448
+ none: "none";
449
+ medium: "medium";
450
+ max: "max";
451
+ }>>;
452
+ }, z.core.$strip>;
453
+ run_id: z.ZodString;
454
+ attempt_cutoff: z.ZodNumber;
455
+ }, z.core.$strip>;
456
+ readonly 'turn/end': z.ZodObject<{
457
+ turn: z.ZodNumber;
458
+ reason: z.ZodDiscriminatedUnion<[z.ZodObject<{
459
+ kind: z.ZodLiteral<"completed">;
460
+ }, z.core.$strip>, z.ZodObject<{
461
+ kind: z.ZodLiteral<"blocked">;
462
+ }, z.core.$strip>, z.ZodObject<{
463
+ kind: z.ZodLiteral<"max-steps">;
464
+ limit: z.ZodNumber;
465
+ }, z.core.$strip>, z.ZodObject<{
466
+ kind: z.ZodLiteral<"interrupted">;
467
+ cause: z.ZodEnum<{
468
+ abandoned: "abandoned";
469
+ "activation-changed": "activation-changed";
470
+ "judgment-invalidated": "judgment-invalidated";
471
+ }>;
472
+ }, z.core.$strip>, z.ZodObject<{
473
+ kind: z.ZodLiteral<"aborted">;
474
+ reason: z.ZodString;
475
+ }, z.core.$strip>, z.ZodObject<{
476
+ kind: z.ZodLiteral<"error">;
477
+ error_text: z.ZodString;
478
+ failure_kind: z.ZodEnum<{
479
+ length: "length";
480
+ other: "other";
481
+ transport: "transport";
482
+ empty: "empty";
483
+ invalid: "invalid";
484
+ rate_limit: "rate_limit";
485
+ overloaded: "overloaded";
486
+ timeout: "timeout";
487
+ auth: "auth";
488
+ quota: "quota";
489
+ overflow: "overflow";
490
+ }>;
491
+ retry_after_ms: z.ZodNullable<z.ZodNumber>;
492
+ }, z.core.$strip>, z.ZodObject<{
493
+ kind: z.ZodLiteral<"rejected">;
494
+ rejections: z.ZodArray<z.ZodObject<{
495
+ reason: z.ZodString;
496
+ source: z.ZodObject<{
497
+ plugin: z.ZodString;
498
+ instance_id: z.ZodDefault<z.ZodString>;
499
+ kind: z.ZodString;
500
+ version: z.ZodNumber;
501
+ data: z.ZodJSONSchema;
502
+ }, z.core.$strip>;
503
+ }, z.core.$strip>>;
504
+ }, z.core.$strip>], "kind">;
505
+ }, z.core.$strip>;
506
+ readonly 'step/start': z.ZodObject<{
507
+ turn: z.ZodNumber;
508
+ step: z.ZodNumber;
509
+ }, z.core.$strip>;
510
+ readonly 'step/end': z.ZodObject<{
511
+ turn: z.ZodNumber;
512
+ step: z.ZodNumber;
513
+ }, z.core.$strip>;
514
+ /** Input claimed by a step, in the role it speaks as — the user, or the harness around them. */
515
+ readonly 'input/message': z.ZodObject<{
516
+ turn: z.ZodNumber;
517
+ role: z.ZodDefault<z.ZodEnum<{
518
+ developer: "developer";
519
+ user: "user";
520
+ }>>;
521
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
522
+ type: z.ZodLiteral<"text">;
523
+ text: z.ZodString;
524
+ }, z.core.$strip>, z.ZodObject<{
525
+ type: z.ZodLiteral<"image">;
526
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
527
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
528
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
529
+ detail: z.ZodDefault<z.ZodEnum<{
530
+ auto: "auto";
531
+ low: "low";
532
+ high: "high";
533
+ }>>;
534
+ }, z.core.$strip>, z.ZodObject<{
535
+ type: z.ZodLiteral<"file">;
536
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
537
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
538
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
539
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
540
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
541
+ }, z.core.$strip>], "type">>>, unknown>;
542
+ input_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
543
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
544
+ plugin: z.ZodString;
545
+ instance_id: z.ZodDefault<z.ZodString>;
546
+ kind: z.ZodString;
547
+ version: z.ZodNumber;
548
+ data: z.ZodJSONSchema;
549
+ }, z.core.$strip>>>;
550
+ }, z.core.$strip>;
551
+ /**
552
+ * A request as it was actually sent — appended after `lagent/llm/request` listeners have had
553
+ * their say, not before. The prompt and the tools it sent are recorded on the thread
554
+ * (`thread/prompt`, `thread/tools`), as they stood at this row; what a request measures, sizes and
555
+ * digests, is the `diagnostics` plugin's, not the row's.
556
+ */
557
+ readonly 'llm/request': z.ZodObject<{
558
+ llm_call_id: z.ZodString;
559
+ model: z.ZodString;
560
+ route: z.ZodObject<{
561
+ provider: z.ZodString;
562
+ model: z.ZodString;
563
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
564
+ low: "low";
565
+ high: "high";
566
+ none: "none";
567
+ medium: "medium";
568
+ max: "max";
569
+ }>>;
570
+ }, z.core.$strip>;
571
+ message_count: z.ZodDefault<z.ZodNumber>;
572
+ turn: z.ZodNumber;
573
+ step: z.ZodNumber;
574
+ }, z.core.$strip>;
575
+ readonly 'assistant/message': z.ZodObject<{
576
+ llm_call_id: z.ZodString;
577
+ response: z.ZodObject<{
578
+ message: z.ZodObject<{
579
+ role: z.ZodEnum<{
580
+ system: "system";
581
+ developer: "developer";
582
+ user: "user";
583
+ assistant: "assistant";
584
+ tool: "tool";
585
+ }>;
586
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
587
+ type: z.ZodLiteral<"text">;
588
+ text: z.ZodString;
589
+ }, z.core.$strip>, z.ZodObject<{
590
+ type: z.ZodLiteral<"image">;
591
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
592
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
593
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
594
+ detail: z.ZodDefault<z.ZodEnum<{
595
+ auto: "auto";
596
+ low: "low";
597
+ high: "high";
598
+ }>>;
599
+ }, z.core.$strip>, z.ZodObject<{
600
+ type: z.ZodLiteral<"file">;
601
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
602
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
603
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
604
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
605
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
606
+ }, z.core.$strip>], "type">>>, unknown>;
607
+ reasoning_content: z.ZodDefault<z.ZodNullable<z.ZodString>>;
608
+ tool_calls: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
609
+ call_id: z.ZodString;
610
+ name: z.ZodString;
611
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
612
+ }, z.core.$loose>, z.ZodObject<{
613
+ call_id: z.ZodString;
614
+ name: z.ZodString;
615
+ arguments: z.ZodNull;
616
+ malformed: z.ZodObject<{
617
+ raw: z.ZodString;
618
+ error: z.ZodString;
619
+ }, z.core.$strict>;
620
+ }, z.core.$loose>]>>>;
621
+ provider_calls: z.ZodDefault<z.ZodArray<z.ZodObject<{
622
+ id: z.ZodString;
623
+ type: z.ZodString;
624
+ name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
625
+ status: z.ZodDefault<z.ZodEnum<{
626
+ in_progress: "in_progress";
627
+ completed: "completed";
628
+ failed: "failed";
629
+ }>>;
630
+ summary: z.ZodDefault<z.ZodNullable<z.ZodString>>;
631
+ }, z.core.$loose>>>;
632
+ tool_call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
633
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
634
+ input_tokens: z.ZodDefault<z.ZodNumber>;
635
+ output_tokens: z.ZodDefault<z.ZodNumber>;
636
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
637
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
638
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
639
+ }, z.core.$strip>>>;
640
+ provider_state: z.ZodDefault<z.ZodNullable<z.ZodObject<{
641
+ provider: z.ZodString;
642
+ data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
643
+ }, z.core.$strip>>>;
644
+ }, z.core.$strip>;
645
+ finish: z.ZodEnum<{
646
+ length: "length";
647
+ completed: "completed";
648
+ other: "other";
649
+ }>;
650
+ provider_metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
651
+ }, z.core.$strip>;
652
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
653
+ input_tokens: z.ZodDefault<z.ZodNumber>;
654
+ output_tokens: z.ZodDefault<z.ZodNumber>;
655
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
656
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
657
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
658
+ }, z.core.$strip>>>;
659
+ interrupted: z.ZodDefault<z.ZodBoolean>;
660
+ attempts: z.ZodNumber;
661
+ turn: z.ZodNumber;
662
+ step: z.ZodNumber;
663
+ }, z.core.$strip>;
664
+ /**
665
+ * A model call that failed: never on the surface. `failure_kind` says how; an `overflow` is the
666
+ * record a strategy reads an overflow from, after a crash or on a later run, and nothing more: no
667
+ * provider states a count it can be trusted with, so none is recorded.
668
+ */
669
+ readonly 'assistant/attempt': z.ZodObject<{
670
+ llm_call_id: z.ZodString;
671
+ error_text: z.ZodString;
672
+ failure_kind: z.ZodEnum<{
673
+ length: "length";
674
+ other: "other";
675
+ transport: "transport";
676
+ empty: "empty";
677
+ invalid: "invalid";
678
+ rate_limit: "rate_limit";
679
+ overloaded: "overloaded";
680
+ timeout: "timeout";
681
+ auth: "auth";
682
+ quota: "quota";
683
+ overflow: "overflow";
684
+ }>;
685
+ attempts: z.ZodNumber;
686
+ retry_after_ms: z.ZodNullable<z.ZodNumber>;
687
+ turn: z.ZodNumber;
688
+ step: z.ZodNumber;
689
+ }, z.core.$strip>;
690
+ /**
691
+ * An auxiliary model call about to be sent: one a plugin makes beside the conversation, through
692
+ * the same request middleware and terminal as a step, whose reply is never the thread's and never
693
+ * on the surface. Recorded before the request is sent, so a crash mid-call leaves a request with
694
+ * no result. What `llm/request` records, plus what makes the canonical request reproducible from
695
+ * this row alone: it is the surface as it stood at this row (`stateAt`), cut after
696
+ * `surface_message_count` messages, followed by `instructions`, each a `user` message.
697
+ */
698
+ readonly 'auxiliary/request': z.ZodObject<{
699
+ turn: z.ZodNullable<z.ZodNumber>;
700
+ step: z.ZodNullable<z.ZodNumber>;
701
+ llm_call_id: z.ZodString;
702
+ model: z.ZodString;
703
+ route: z.ZodObject<{
704
+ provider: z.ZodString;
705
+ model: z.ZodString;
706
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
707
+ low: "low";
708
+ high: "high";
709
+ none: "none";
710
+ medium: "medium";
711
+ max: "max";
712
+ }>>;
713
+ }, z.core.$strip>;
714
+ message_count: z.ZodNumber;
715
+ surface_message_count: z.ZodNumber;
716
+ instructions: z.ZodArray<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
717
+ type: z.ZodLiteral<"text">;
718
+ text: z.ZodString;
719
+ }, z.core.$strip>, z.ZodObject<{
720
+ type: z.ZodLiteral<"image">;
721
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
722
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
723
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
724
+ detail: z.ZodDefault<z.ZodEnum<{
725
+ auto: "auto";
726
+ low: "low";
727
+ high: "high";
728
+ }>>;
729
+ }, z.core.$strip>, z.ZodObject<{
730
+ type: z.ZodLiteral<"file">;
731
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
732
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
733
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
734
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
735
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
736
+ }, z.core.$strip>], "type">>>, unknown>>;
737
+ }, z.core.$strip>;
738
+ /**
739
+ * How an auxiliary call ended: its text and finish, or the error that ended it. Cites its
740
+ * `auxiliary/request` row. Never an assistant message, so no fold that reads the conversation
741
+ * sees it.
742
+ */
743
+ readonly 'auxiliary/result': z.ZodObject<{
744
+ turn: z.ZodNullable<z.ZodNumber>;
745
+ step: z.ZodNullable<z.ZodNumber>;
746
+ llm_call_id: z.ZodString;
747
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
748
+ input_tokens: z.ZodDefault<z.ZodNumber>;
749
+ output_tokens: z.ZodDefault<z.ZodNumber>;
750
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
751
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
752
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
753
+ }, z.core.$strip>>>;
754
+ text: z.ZodNullable<z.ZodString>;
755
+ finish: z.ZodNullable<z.ZodEnum<{
756
+ length: "length";
757
+ completed: "completed";
758
+ other: "other";
759
+ }>>;
760
+ tool_calls: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
761
+ call_id: z.ZodString;
762
+ name: z.ZodString;
763
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
764
+ }, z.core.$loose>, z.ZodObject<{
765
+ call_id: z.ZodString;
766
+ name: z.ZodString;
767
+ arguments: z.ZodNull;
768
+ malformed: z.ZodObject<{
769
+ raw: z.ZodString;
770
+ error: z.ZodString;
771
+ }, z.core.$strict>;
772
+ }, z.core.$loose>]>>>;
773
+ provider_calls: z.ZodDefault<z.ZodArray<z.ZodObject<{
774
+ id: z.ZodString;
775
+ type: z.ZodString;
776
+ name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
777
+ status: z.ZodDefault<z.ZodEnum<{
778
+ in_progress: "in_progress";
779
+ completed: "completed";
780
+ failed: "failed";
781
+ }>>;
782
+ summary: z.ZodDefault<z.ZodNullable<z.ZodString>>;
783
+ }, z.core.$loose>>>;
784
+ error_text: z.ZodNullable<z.ZodString>;
785
+ error_kind: z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
786
+ length: "length";
787
+ other: "other";
788
+ transport: "transport";
789
+ empty: "empty";
790
+ invalid: "invalid";
791
+ rate_limit: "rate_limit";
792
+ overloaded: "overloaded";
793
+ timeout: "timeout";
794
+ auth: "auth";
795
+ quota: "quota";
796
+ overflow: "overflow";
797
+ }>, z.ZodLiteral<"aborted">]>>;
798
+ attempts: z.ZodNumber;
799
+ }, z.core.$strip>;
800
+ /**
801
+ * A call was dispatched. The arguments are on the assistant message that asked for it; repeating
802
+ * them here would be a second copy that a crash could leave disagreeing with the first. Its one
803
+ * source seq is that message, on a fork's source when the fork inherited it.
804
+ */
805
+ readonly 'tool/call': z.ZodObject<{
806
+ call_id: z.ZodString;
807
+ name: z.ZodString;
808
+ turn: z.ZodNumber;
809
+ step: z.ZodNumber;
810
+ }, z.core.$strip>;
811
+ /**
812
+ * One dispatch attempt of a call: written immediately before the tool is invoked, so an `allow`
813
+ * with no result after it is the mark that the call may have begun. A call has one per dispatch;
814
+ * the provider's `call_id` may be reused by a later turn, so `call_seq` names the `tool/call` row
815
+ * this attempt belongs to.
816
+ */
817
+ readonly 'tool/authorization': z.ZodObject<{
818
+ call_id: z.ZodString;
819
+ call_seq: z.ZodNumber;
820
+ decision: z.ZodEnum<{
821
+ allow: "allow";
822
+ confirm: "confirm";
823
+ deny: "deny";
824
+ }>;
825
+ confirmed_by: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
826
+ user: "user";
827
+ policy: "policy";
828
+ }>>>;
829
+ policy: z.ZodEnum<{
830
+ rerun: "rerun";
831
+ report: "report";
832
+ }>;
833
+ turn: z.ZodNumber;
834
+ step: z.ZodNumber;
835
+ }, z.core.$strip>;
836
+ readonly 'tool/result': z.ZodObject<{
837
+ result: z.ZodObject<{
838
+ output: z.ZodString;
839
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
840
+ type: z.ZodLiteral<"text">;
841
+ text: z.ZodString;
842
+ }, z.core.$strip>, z.ZodObject<{
843
+ type: z.ZodLiteral<"image">;
844
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
845
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
846
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
847
+ detail: z.ZodDefault<z.ZodEnum<{
848
+ auto: "auto";
849
+ low: "low";
850
+ high: "high";
851
+ }>>;
852
+ }, z.core.$strip>, z.ZodObject<{
853
+ type: z.ZodLiteral<"file">;
854
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
855
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
856
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
857
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
858
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
859
+ }, z.core.$strip>], "type">>>;
860
+ is_error: z.ZodDefault<z.ZodBoolean>;
861
+ notes: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
862
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
863
+ concludes_turn: z.ZodOptional<z.ZodLiteral<true>>;
864
+ call_id: z.ZodString;
865
+ name: z.ZodString;
866
+ }, z.core.$strip>;
867
+ turn: z.ZodNumber;
868
+ step: z.ZodNumber;
869
+ }, z.core.$strip>;
870
+ /**
871
+ * A dispatched call suspended: its tool waits on a dependency `owner`, a registered constraint
872
+ * owner, alone interprets and resolves. The call stays unanswered and is not dispatched again until
873
+ * a `wait/resolved` records its value; a cancel answers it instead. One per call, keyed by
874
+ * `call_seq`. Cites the `tool/call` row and the dispatch attempt's `tool/authorization` row.
875
+ */
876
+ readonly 'wait/declared': z.ZodObject<{
877
+ call_id: z.ZodString;
878
+ call_seq: z.ZodNumber;
879
+ owner: z.ZodString;
880
+ dependency: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
881
+ deadline_at: z.ZodNullable<z.ZodNumber>;
882
+ reason: z.ZodString;
883
+ turn: z.ZodNumber;
884
+ step: z.ZodNumber;
885
+ }, z.core.$strip>;
886
+ /**
887
+ * The value a suspended call resolved with, versioned by its wait's owner: what the tool reads
888
+ * when the call is dispatched again. Cites the declaration, then any evidence the owner names.
889
+ */
890
+ readonly 'wait/resolved': z.ZodObject<{
891
+ call_seq: z.ZodNumber;
892
+ value: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
893
+ }, z.core.$strip>;
894
+ readonly 'confirm/requested': z.ZodObject<{
895
+ request_id: z.ZodString;
896
+ tool_call: z.ZodObject<{
897
+ call_id: z.ZodString;
898
+ name: z.ZodString;
899
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
900
+ }, z.core.$loose>;
901
+ reason: z.ZodString;
902
+ turn: z.ZodNumber;
903
+ step: z.ZodNumber;
904
+ }, z.core.$strip>;
905
+ readonly 'confirm/resolved': z.ZodObject<{
906
+ request_id: z.ZodString;
907
+ approved: z.ZodBoolean;
908
+ rejection_message: z.ZodDefault<z.ZodNullable<z.ZodString>>;
909
+ }, z.core.$strip>;
910
+ /**
911
+ * A conversation's identity, lineage and environment. The row where a fork's inherited state
912
+ * ends: every thread-scoped fold sees it right after the rows the fork inherits, and resets there
913
+ * whatever described the source's execution rather than its conversation.
914
+ */
915
+ readonly 'thread/spawned': z.ZodObject<{
916
+ agent_name: z.ZodString;
917
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
918
+ fork: z.ZodDefault<z.ZodNullable<z.ZodObject<{
919
+ thread_id: z.ZodString;
920
+ seq: z.ZodNumber;
921
+ }, z.core.$strip>>>;
922
+ origin: z.ZodDefault<z.ZodNullable<z.ZodObject<{
923
+ caller_thread_id: z.ZodString;
924
+ source_seq: z.ZodNumber;
925
+ cause: z.ZodDiscriminatedUnion<[z.ZodObject<{
926
+ kind: z.ZodLiteral<"call">;
927
+ }, z.core.$strip>, z.ZodObject<{
928
+ kind: z.ZodLiteral<"assignment">;
929
+ owner: z.ZodString;
930
+ key: z.ZodJSONSchema;
931
+ }, z.core.$strip>], "kind">;
932
+ }, z.core.$strip>>>;
933
+ environment: z.ZodObject<{
934
+ cwd: z.ZodString;
935
+ read_roots: z.ZodArray<z.ZodString>;
936
+ }, z.core.$strip>;
937
+ installations: z.ZodDefault<z.ZodArray<z.ZodObject<{
938
+ installation_id: z.ZodString;
939
+ preset_id: z.ZodString;
940
+ config: z.ZodJSONSchema;
941
+ lifetime: z.ZodEnum<{
942
+ defining: "defining";
943
+ configurable: "configurable";
944
+ }>;
945
+ }, z.core.$strict>>>;
946
+ requires: z.ZodArray<z.ZodString>;
947
+ route: z.ZodNullable<z.ZodObject<{
948
+ provider: z.ZodString;
949
+ model: z.ZodString;
950
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
951
+ low: "low";
952
+ high: "high";
953
+ none: "none";
954
+ medium: "medium";
955
+ max: "max";
956
+ }>>;
957
+ }, z.core.$strip>>;
958
+ }, z.core.$strip>;
959
+ /** A preset installed on the thread after its creation; see `Thread.configure`. */
960
+ readonly 'installation/applied': z.ZodObject<{
961
+ installation_id: z.ZodString;
962
+ preset_id: z.ZodString;
963
+ config: z.ZodJSONSchema;
964
+ }, z.core.$strict>;
965
+ /** An installation taken off the thread. Its id stays reserved. */
966
+ readonly 'installation/removed': z.ZodObject<{
967
+ installation_id: z.ZodString;
968
+ }, z.core.$strict>;
969
+ /** The rendered system prompt this thread sends. The latest row wins; see `rebuildPrompt`. */
970
+ readonly 'thread/prompt': z.ZodObject<{
971
+ blocks: z.ZodArray<z.ZodObject<{
972
+ kind: z.ZodEnum<{
973
+ base: "base";
974
+ instruction: "instruction";
975
+ context: "context";
976
+ }>;
977
+ tag: z.ZodNullable<z.ZodString>;
978
+ text: z.ZodString;
979
+ }, z.core.$strip>>;
980
+ }, z.core.$strip>;
981
+ /**
982
+ * The tool specifications this thread's requests send from here on, as sent: after request
983
+ * middleware, independent of live registrations. Written in a request's own group, before its
984
+ * request row, only when they differ from the latest; so a request sent the latest row at its seq.
985
+ */
986
+ readonly 'thread/tools': z.ZodObject<{
987
+ tools: z.ZodArray<z.ZodObject<{
988
+ name: z.ZodString;
989
+ description: z.ZodString;
990
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
991
+ }, z.core.$strip>>;
992
+ }, z.core.$strip>;
993
+ /**
994
+ * A run request opened on the thread: from here it is authorized to run until a `run/settled`
995
+ * names it. Written once per request, in the write of the cause that opened it, or of the
996
+ * settlement whose residual causes carry over.
997
+ */
998
+ readonly 'run/requested': z.ZodObject<{
999
+ run_id: z.ZodString;
1000
+ }, z.core.$strict>;
1001
+ /**
1002
+ * One reason for the pending request to run, written in the same write as whatever brought it.
1003
+ * Its seq identifies it and its timestamp gives its age. `input_id` is the input it brought, if
1004
+ * any; `releases` says it releases the failure, cancellation and startup holds (a person's or a
1005
+ * host's authority). `route` is the thread's route from this cause on, complete, when the cause
1006
+ * changed it: a route change reauthorizes every unfinished piece of work on the thread on it.
1007
+ */
1008
+ readonly 'run/cause': z.ZodObject<{
1009
+ run_id: z.ZodString;
1010
+ input_id: z.ZodNullable<z.ZodString>;
1011
+ releases: z.ZodBoolean;
1012
+ chain: z.ZodEnum<{
1013
+ person: "person";
1014
+ fresh: "fresh";
1015
+ reactive: "reactive";
1016
+ }>;
1017
+ route: z.ZodNullable<z.ZodObject<{
1018
+ provider: z.ZodString;
1019
+ model: z.ZodString;
1020
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
1021
+ low: "low";
1022
+ high: "high";
1023
+ none: "none";
1024
+ medium: "medium";
1025
+ max: "max";
1026
+ }>>;
1027
+ }, z.core.$strip>>;
1028
+ }, z.core.$strict>;
1029
+ /**
1030
+ * A run request ended, once, decided at `through`. `residual` names the causes, by seq, that carry
1031
+ * over to the request a successor `run/requested` in the same write opens. `error_text` says why a
1032
+ * request failed in setup, before any turn: such a failure has no `turn/end` to say it.
1033
+ */
1034
+ readonly 'run/settled': z.ZodObject<{
1035
+ run_id: z.ZodString;
1036
+ outcome: z.ZodEnum<{
1037
+ completed: "completed";
1038
+ failed: "failed";
1039
+ cancelled: "cancelled";
1040
+ superseded: "superseded";
1041
+ }>;
1042
+ reason: z.ZodEnum<{
1043
+ turn: "turn";
1044
+ answered: "answered";
1045
+ nothing: "nothing";
1046
+ setup: "setup";
1047
+ cancel: "cancel";
1048
+ obsolete: "obsolete";
1049
+ }>;
1050
+ error_text: z.ZodNullable<z.ZodString>;
1051
+ through: z.ZodNumber;
1052
+ residual: z.ZodArray<z.ZodNumber>;
1053
+ }, z.core.$strict>;
1054
+ /**
1055
+ * A cancel of the thread, written by every `cancel()` whatever the thread's state, with its inbox
1056
+ * clear and any feature rows. `run_id` is the run of the execution the cancel captured, if any.
1057
+ * A `user` cancel holds the thread until a releasing cause; a `cleanup` one holds nothing.
1058
+ */
1059
+ readonly 'thread/cancel': z.ZodObject<{
1060
+ cancel_id: z.ZodString;
1061
+ intent: z.ZodEnum<{
1062
+ user: "user";
1063
+ cleanup: "cleanup";
1064
+ }>;
1065
+ run_id: z.ZodNullable<z.ZodString>;
1066
+ reason: z.ZodString;
1067
+ }, z.core.$strict>;
1068
+ readonly 'inbox/spliced': z.ZodObject<{
1069
+ target: z.ZodEnum<{
1070
+ "next-turn": "next-turn";
1071
+ "next-step": "next-step";
1072
+ }>;
1073
+ start: z.ZodNumber;
1074
+ removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
1075
+ inserted: z.ZodDefault<z.ZodArray<z.ZodObject<{
1076
+ id: z.ZodString;
1077
+ role: z.ZodDefault<z.ZodEnum<{
1078
+ developer: "developer";
1079
+ user: "user";
1080
+ }>>;
1081
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1082
+ type: z.ZodLiteral<"text">;
1083
+ text: z.ZodString;
1084
+ }, z.core.$strip>, z.ZodObject<{
1085
+ type: z.ZodLiteral<"image">;
1086
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1087
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1088
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1089
+ detail: z.ZodDefault<z.ZodEnum<{
1090
+ auto: "auto";
1091
+ low: "low";
1092
+ high: "high";
1093
+ }>>;
1094
+ }, z.core.$strip>, z.ZodObject<{
1095
+ type: z.ZodLiteral<"file">;
1096
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1097
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1098
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1099
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1100
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1101
+ }, z.core.$strip>], "type">>>, unknown>;
1102
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1103
+ plugin: z.ZodString;
1104
+ instance_id: z.ZodDefault<z.ZodString>;
1105
+ kind: z.ZodString;
1106
+ version: z.ZodNumber;
1107
+ data: z.ZodJSONSchema;
1108
+ }, z.core.$strip>>>;
1109
+ }, z.core.$strip>>>;
1110
+ }, z.core.$strip>;
1111
+ /**
1112
+ * Part of the surface replaced: a contiguous `span` by one stand-in, or one message rewritten in
1113
+ * place. Written only by `replaceSurface`, which judges it against the surface it lands on.
1114
+ */
1115
+ readonly 'surface/replaced': z.ZodDiscriminatedUnion<[z.ZodObject<{
1116
+ source: z.ZodObject<{
1117
+ plugin: z.ZodString;
1118
+ instance_id: z.ZodDefault<z.ZodString>;
1119
+ kind: z.ZodString;
1120
+ version: z.ZodNumber;
1121
+ data: z.ZodJSONSchema;
1122
+ }, z.core.$strip>;
1123
+ trigger: z.ZodEnum<{
1124
+ overflow: "overflow";
1125
+ pressure: "pressure";
1126
+ request: "request";
1127
+ }>;
1128
+ auxiliary_request_seq: z.ZodNullable<z.ZodNumber>;
1129
+ turn: z.ZodNullable<z.ZodNumber>;
1130
+ step: z.ZodNullable<z.ZodNumber>;
1131
+ kind: z.ZodLiteral<"span">;
1132
+ stand_in: z.ZodObject<{
1133
+ role: z.ZodEnum<{
1134
+ user: "user";
1135
+ assistant: "assistant";
1136
+ }>;
1137
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1138
+ type: z.ZodLiteral<"text">;
1139
+ text: z.ZodString;
1140
+ }, z.core.$strip>, z.ZodObject<{
1141
+ type: z.ZodLiteral<"image">;
1142
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1143
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1144
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1145
+ detail: z.ZodDefault<z.ZodEnum<{
1146
+ auto: "auto";
1147
+ low: "low";
1148
+ high: "high";
1149
+ }>>;
1150
+ }, z.core.$strip>, z.ZodObject<{
1151
+ type: z.ZodLiteral<"file">;
1152
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1153
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1154
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1155
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1156
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1157
+ }, z.core.$strip>], "type">>>, unknown>;
1158
+ }, z.core.$strict>;
1159
+ }, z.core.$strip>, z.ZodObject<{
1160
+ source: z.ZodObject<{
1161
+ plugin: z.ZodString;
1162
+ instance_id: z.ZodDefault<z.ZodString>;
1163
+ kind: z.ZodString;
1164
+ version: z.ZodNumber;
1165
+ data: z.ZodJSONSchema;
1166
+ }, z.core.$strip>;
1167
+ trigger: z.ZodEnum<{
1168
+ overflow: "overflow";
1169
+ pressure: "pressure";
1170
+ request: "request";
1171
+ }>;
1172
+ auxiliary_request_seq: z.ZodNullable<z.ZodNumber>;
1173
+ turn: z.ZodNullable<z.ZodNumber>;
1174
+ step: z.ZodNullable<z.ZodNumber>;
1175
+ kind: z.ZodLiteral<"rewrite">;
1176
+ stand_in: z.ZodObject<{
1177
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1178
+ type: z.ZodLiteral<"text">;
1179
+ text: z.ZodString;
1180
+ }, z.core.$strip>, z.ZodObject<{
1181
+ type: z.ZodLiteral<"image">;
1182
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1183
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1184
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1185
+ detail: z.ZodDefault<z.ZodEnum<{
1186
+ auto: "auto";
1187
+ low: "low";
1188
+ high: "high";
1189
+ }>>;
1190
+ }, z.core.$strip>, z.ZodObject<{
1191
+ type: z.ZodLiteral<"file">;
1192
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1193
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1194
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1195
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1196
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1197
+ }, z.core.$strip>], "type">>>, unknown>;
1198
+ }, z.core.$strict>;
1199
+ }, z.core.$strip>], "kind">;
1200
+ readonly error: z.ZodObject<{
1201
+ turn: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1202
+ step: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1203
+ llm_call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1204
+ error_text: z.ZodString;
1205
+ failure_kind: z.ZodEnum<{
1206
+ length: "length";
1207
+ other: "other";
1208
+ transport: "transport";
1209
+ empty: "empty";
1210
+ invalid: "invalid";
1211
+ rate_limit: "rate_limit";
1212
+ overloaded: "overloaded";
1213
+ timeout: "timeout";
1214
+ auth: "auth";
1215
+ quota: "quota";
1216
+ overflow: "overflow";
1217
+ }>;
1218
+ }, z.core.$strip>;
1219
+ };
1220
+ export type JournalEventType = keyof typeof JOURNAL_EVENT_DATA;
1221
+ /** A journal event's payload, defaults applied — what a reader sees. */
1222
+ export type JournalEventData = {
1223
+ [K in JournalEventType]: z.infer<(typeof JOURNAL_EVENT_DATA)[K]>;
1224
+ };
1225
+ /** What `append` accepts: the same payload with defaulted fields optional. */
1226
+ export type JournalEventInput = {
1227
+ [K in JournalEventType]: DeepReadonly<z.input<(typeof JOURNAL_EVENT_DATA)[K]>>;
1228
+ };
1229
+ /**
1230
+ * The events that put a message of their own on what the model sees. A `surface/replaced` row
1231
+ * replaces messages there rather than adding one after them, so it is not among them.
1232
+ */
1233
+ export declare const SURFACE_EVENT_TYPES: readonly ["input/message", "assistant/message", "tool/result"];
1234
+ export type SurfaceEventType = (typeof SURFACE_EVENT_TYPES)[number];
1235
+ /**
1236
+ * One journal event: the envelope every row shares, plus the `data` its `type` selects.
1237
+ *
1238
+ * Written by hand rather than inferred from the schema below. Building the zod union by mapping
1239
+ * over `JOURNAL_EVENT_DATA` loses the correlation between `type` and `data`, which is the one thing
1240
+ * every reader of this type relies on; `data` still comes from `JOURNAL_EVENT_DATA`, so it cannot drift.
1241
+ */
1242
+ export type JournalEvent<K extends JournalEventType = JournalEventType> = {
1243
+ [T in K]: {
1244
+ readonly seq: Seq;
1245
+ readonly type: T;
1246
+ readonly timestamp: string;
1247
+ /** The thread this belongs to. Every row has one: there are no rows about the journal as a whole. */
1248
+ readonly thread_id: string;
1249
+ readonly data: JournalEventData[T];
1250
+ /** Causally linked earlier events — a `tool/result` cites the `tool/call` it answers. */
1251
+ readonly source_seqs: readonly Seq[];
1252
+ };
1253
+ }[K];
1254
+ /** Runtime validation for a stored row. Narrow with {@link JournalEvent}, not with `z.infer`. */
1255
+ export declare const JournalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1256
+ seq: z.ZodNumber;
1257
+ type: z.ZodLiteral<"error" | "ext" | "turn/start" | "turn/end" | "step/start" | "step/end" | "input/message" | "llm/request" | "assistant/message" | "assistant/attempt" | "auxiliary/request" | "auxiliary/result" | "tool/call" | "tool/authorization" | "tool/result" | "wait/declared" | "wait/resolved" | "confirm/requested" | "confirm/resolved" | "thread/spawned" | "installation/applied" | "installation/removed" | "thread/prompt" | "thread/tools" | "run/requested" | "run/cause" | "run/settled" | "thread/cancel" | "inbox/spliced" | "surface/replaced">;
1258
+ timestamp: z.ZodDefault<z.ZodISODateTime>;
1259
+ thread_id: z.ZodString;
1260
+ data: z.ZodObject<{
1261
+ plugin: z.ZodString;
1262
+ instance_id: z.ZodDefault<z.ZodString>;
1263
+ kind: z.ZodString;
1264
+ version: z.ZodNumber;
1265
+ data: z.ZodJSONSchema;
1266
+ }, z.core.$strip> | z.ZodObject<{
1267
+ installation_id: z.ZodString;
1268
+ preset_id: z.ZodString;
1269
+ config: z.ZodJSONSchema;
1270
+ }, z.core.$strict> | z.ZodDiscriminatedUnion<[z.ZodObject<{
1271
+ source: z.ZodObject<{
1272
+ plugin: z.ZodString;
1273
+ instance_id: z.ZodDefault<z.ZodString>;
1274
+ kind: z.ZodString;
1275
+ version: z.ZodNumber;
1276
+ data: z.ZodJSONSchema;
1277
+ }, z.core.$strip>;
1278
+ trigger: z.ZodEnum<{
1279
+ overflow: "overflow";
1280
+ pressure: "pressure";
1281
+ request: "request";
1282
+ }>;
1283
+ auxiliary_request_seq: z.ZodNullable<z.ZodNumber>;
1284
+ turn: z.ZodNullable<z.ZodNumber>;
1285
+ step: z.ZodNullable<z.ZodNumber>;
1286
+ kind: z.ZodLiteral<"span">;
1287
+ stand_in: z.ZodObject<{
1288
+ role: z.ZodEnum<{
1289
+ user: "user";
1290
+ assistant: "assistant";
1291
+ }>;
1292
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1293
+ type: z.ZodLiteral<"text">;
1294
+ text: z.ZodString;
1295
+ }, z.core.$strip>, z.ZodObject<{
1296
+ type: z.ZodLiteral<"image">;
1297
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1298
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1299
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1300
+ detail: z.ZodDefault<z.ZodEnum<{
1301
+ auto: "auto";
1302
+ low: "low";
1303
+ high: "high";
1304
+ }>>;
1305
+ }, z.core.$strip>, z.ZodObject<{
1306
+ type: z.ZodLiteral<"file">;
1307
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1308
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1309
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1310
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1311
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1312
+ }, z.core.$strip>], "type">>>, unknown>;
1313
+ }, z.core.$strict>;
1314
+ }, z.core.$strip>, z.ZodObject<{
1315
+ source: z.ZodObject<{
1316
+ plugin: z.ZodString;
1317
+ instance_id: z.ZodDefault<z.ZodString>;
1318
+ kind: z.ZodString;
1319
+ version: z.ZodNumber;
1320
+ data: z.ZodJSONSchema;
1321
+ }, z.core.$strip>;
1322
+ trigger: z.ZodEnum<{
1323
+ overflow: "overflow";
1324
+ pressure: "pressure";
1325
+ request: "request";
1326
+ }>;
1327
+ auxiliary_request_seq: z.ZodNullable<z.ZodNumber>;
1328
+ turn: z.ZodNullable<z.ZodNumber>;
1329
+ step: z.ZodNullable<z.ZodNumber>;
1330
+ kind: z.ZodLiteral<"rewrite">;
1331
+ stand_in: z.ZodObject<{
1332
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1333
+ type: z.ZodLiteral<"text">;
1334
+ text: z.ZodString;
1335
+ }, z.core.$strip>, z.ZodObject<{
1336
+ type: z.ZodLiteral<"image">;
1337
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1338
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1339
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1340
+ detail: z.ZodDefault<z.ZodEnum<{
1341
+ auto: "auto";
1342
+ low: "low";
1343
+ high: "high";
1344
+ }>>;
1345
+ }, z.core.$strip>, z.ZodObject<{
1346
+ type: z.ZodLiteral<"file">;
1347
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1348
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1349
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1350
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1351
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1352
+ }, z.core.$strip>], "type">>>, unknown>;
1353
+ }, z.core.$strict>;
1354
+ }, z.core.$strip>], "kind"> | z.ZodObject<{
1355
+ turn: z.ZodNumber;
1356
+ route: z.ZodObject<{
1357
+ provider: z.ZodString;
1358
+ model: z.ZodString;
1359
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
1360
+ low: "low";
1361
+ high: "high";
1362
+ none: "none";
1363
+ medium: "medium";
1364
+ max: "max";
1365
+ }>>;
1366
+ }, z.core.$strip>;
1367
+ run_id: z.ZodString;
1368
+ attempt_cutoff: z.ZodNumber;
1369
+ }, z.core.$strip> | z.ZodObject<{
1370
+ turn: z.ZodNumber;
1371
+ reason: z.ZodDiscriminatedUnion<[z.ZodObject<{
1372
+ kind: z.ZodLiteral<"completed">;
1373
+ }, z.core.$strip>, z.ZodObject<{
1374
+ kind: z.ZodLiteral<"blocked">;
1375
+ }, z.core.$strip>, z.ZodObject<{
1376
+ kind: z.ZodLiteral<"max-steps">;
1377
+ limit: z.ZodNumber;
1378
+ }, z.core.$strip>, z.ZodObject<{
1379
+ kind: z.ZodLiteral<"interrupted">;
1380
+ cause: z.ZodEnum<{
1381
+ abandoned: "abandoned";
1382
+ "activation-changed": "activation-changed";
1383
+ "judgment-invalidated": "judgment-invalidated";
1384
+ }>;
1385
+ }, z.core.$strip>, z.ZodObject<{
1386
+ kind: z.ZodLiteral<"aborted">;
1387
+ reason: z.ZodString;
1388
+ }, z.core.$strip>, z.ZodObject<{
1389
+ kind: z.ZodLiteral<"error">;
1390
+ error_text: z.ZodString;
1391
+ failure_kind: z.ZodEnum<{
1392
+ length: "length";
1393
+ other: "other";
1394
+ transport: "transport";
1395
+ empty: "empty";
1396
+ invalid: "invalid";
1397
+ rate_limit: "rate_limit";
1398
+ overloaded: "overloaded";
1399
+ timeout: "timeout";
1400
+ auth: "auth";
1401
+ quota: "quota";
1402
+ overflow: "overflow";
1403
+ }>;
1404
+ retry_after_ms: z.ZodNullable<z.ZodNumber>;
1405
+ }, z.core.$strip>, z.ZodObject<{
1406
+ kind: z.ZodLiteral<"rejected">;
1407
+ rejections: z.ZodArray<z.ZodObject<{
1408
+ reason: z.ZodString;
1409
+ source: z.ZodObject<{
1410
+ plugin: z.ZodString;
1411
+ instance_id: z.ZodDefault<z.ZodString>;
1412
+ kind: z.ZodString;
1413
+ version: z.ZodNumber;
1414
+ data: z.ZodJSONSchema;
1415
+ }, z.core.$strip>;
1416
+ }, z.core.$strip>>;
1417
+ }, z.core.$strip>], "kind">;
1418
+ }, z.core.$strip> | z.ZodObject<{
1419
+ turn: z.ZodNumber;
1420
+ step: z.ZodNumber;
1421
+ }, z.core.$strip> | z.ZodObject<{
1422
+ turn: z.ZodNumber;
1423
+ role: z.ZodDefault<z.ZodEnum<{
1424
+ developer: "developer";
1425
+ user: "user";
1426
+ }>>;
1427
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1428
+ type: z.ZodLiteral<"text">;
1429
+ text: z.ZodString;
1430
+ }, z.core.$strip>, z.ZodObject<{
1431
+ type: z.ZodLiteral<"image">;
1432
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1433
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1434
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1435
+ detail: z.ZodDefault<z.ZodEnum<{
1436
+ auto: "auto";
1437
+ low: "low";
1438
+ high: "high";
1439
+ }>>;
1440
+ }, z.core.$strip>, z.ZodObject<{
1441
+ type: z.ZodLiteral<"file">;
1442
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1443
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1444
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1445
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1446
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1447
+ }, z.core.$strip>], "type">>>, unknown>;
1448
+ input_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1449
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1450
+ plugin: z.ZodString;
1451
+ instance_id: z.ZodDefault<z.ZodString>;
1452
+ kind: z.ZodString;
1453
+ version: z.ZodNumber;
1454
+ data: z.ZodJSONSchema;
1455
+ }, z.core.$strip>>>;
1456
+ }, z.core.$strip> | z.ZodObject<{
1457
+ llm_call_id: z.ZodString;
1458
+ model: z.ZodString;
1459
+ route: z.ZodObject<{
1460
+ provider: z.ZodString;
1461
+ model: z.ZodString;
1462
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
1463
+ low: "low";
1464
+ high: "high";
1465
+ none: "none";
1466
+ medium: "medium";
1467
+ max: "max";
1468
+ }>>;
1469
+ }, z.core.$strip>;
1470
+ message_count: z.ZodDefault<z.ZodNumber>;
1471
+ turn: z.ZodNumber;
1472
+ step: z.ZodNumber;
1473
+ }, z.core.$strip> | z.ZodObject<{
1474
+ llm_call_id: z.ZodString;
1475
+ response: z.ZodObject<{
1476
+ message: z.ZodObject<{
1477
+ role: z.ZodEnum<{
1478
+ system: "system";
1479
+ developer: "developer";
1480
+ user: "user";
1481
+ assistant: "assistant";
1482
+ tool: "tool";
1483
+ }>;
1484
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1485
+ type: z.ZodLiteral<"text">;
1486
+ text: z.ZodString;
1487
+ }, z.core.$strip>, z.ZodObject<{
1488
+ type: z.ZodLiteral<"image">;
1489
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1490
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1491
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1492
+ detail: z.ZodDefault<z.ZodEnum<{
1493
+ auto: "auto";
1494
+ low: "low";
1495
+ high: "high";
1496
+ }>>;
1497
+ }, z.core.$strip>, z.ZodObject<{
1498
+ type: z.ZodLiteral<"file">;
1499
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1500
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1501
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1502
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1503
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1504
+ }, z.core.$strip>], "type">>>, unknown>;
1505
+ reasoning_content: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1506
+ tool_calls: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1507
+ call_id: z.ZodString;
1508
+ name: z.ZodString;
1509
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1510
+ }, z.core.$loose>, z.ZodObject<{
1511
+ call_id: z.ZodString;
1512
+ name: z.ZodString;
1513
+ arguments: z.ZodNull;
1514
+ malformed: z.ZodObject<{
1515
+ raw: z.ZodString;
1516
+ error: z.ZodString;
1517
+ }, z.core.$strict>;
1518
+ }, z.core.$loose>]>>>;
1519
+ provider_calls: z.ZodDefault<z.ZodArray<z.ZodObject<{
1520
+ id: z.ZodString;
1521
+ type: z.ZodString;
1522
+ name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1523
+ status: z.ZodDefault<z.ZodEnum<{
1524
+ in_progress: "in_progress";
1525
+ completed: "completed";
1526
+ failed: "failed";
1527
+ }>>;
1528
+ summary: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1529
+ }, z.core.$loose>>>;
1530
+ tool_call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1531
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1532
+ input_tokens: z.ZodDefault<z.ZodNumber>;
1533
+ output_tokens: z.ZodDefault<z.ZodNumber>;
1534
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
1535
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
1536
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
1537
+ }, z.core.$strip>>>;
1538
+ provider_state: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1539
+ provider: z.ZodString;
1540
+ data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1541
+ }, z.core.$strip>>>;
1542
+ }, z.core.$strip>;
1543
+ finish: z.ZodEnum<{
1544
+ length: "length";
1545
+ completed: "completed";
1546
+ other: "other";
1547
+ }>;
1548
+ provider_metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1549
+ }, z.core.$strip>;
1550
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1551
+ input_tokens: z.ZodDefault<z.ZodNumber>;
1552
+ output_tokens: z.ZodDefault<z.ZodNumber>;
1553
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
1554
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
1555
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
1556
+ }, z.core.$strip>>>;
1557
+ interrupted: z.ZodDefault<z.ZodBoolean>;
1558
+ attempts: z.ZodNumber;
1559
+ turn: z.ZodNumber;
1560
+ step: z.ZodNumber;
1561
+ }, z.core.$strip> | z.ZodObject<{
1562
+ llm_call_id: z.ZodString;
1563
+ error_text: z.ZodString;
1564
+ failure_kind: z.ZodEnum<{
1565
+ length: "length";
1566
+ other: "other";
1567
+ transport: "transport";
1568
+ empty: "empty";
1569
+ invalid: "invalid";
1570
+ rate_limit: "rate_limit";
1571
+ overloaded: "overloaded";
1572
+ timeout: "timeout";
1573
+ auth: "auth";
1574
+ quota: "quota";
1575
+ overflow: "overflow";
1576
+ }>;
1577
+ attempts: z.ZodNumber;
1578
+ retry_after_ms: z.ZodNullable<z.ZodNumber>;
1579
+ turn: z.ZodNumber;
1580
+ step: z.ZodNumber;
1581
+ }, z.core.$strip> | z.ZodObject<{
1582
+ turn: z.ZodNullable<z.ZodNumber>;
1583
+ step: z.ZodNullable<z.ZodNumber>;
1584
+ llm_call_id: z.ZodString;
1585
+ model: z.ZodString;
1586
+ route: z.ZodObject<{
1587
+ provider: z.ZodString;
1588
+ model: z.ZodString;
1589
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
1590
+ low: "low";
1591
+ high: "high";
1592
+ none: "none";
1593
+ medium: "medium";
1594
+ max: "max";
1595
+ }>>;
1596
+ }, z.core.$strip>;
1597
+ message_count: z.ZodNumber;
1598
+ surface_message_count: z.ZodNumber;
1599
+ instructions: z.ZodArray<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1600
+ type: z.ZodLiteral<"text">;
1601
+ text: z.ZodString;
1602
+ }, z.core.$strip>, z.ZodObject<{
1603
+ type: z.ZodLiteral<"image">;
1604
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1605
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1606
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1607
+ detail: z.ZodDefault<z.ZodEnum<{
1608
+ auto: "auto";
1609
+ low: "low";
1610
+ high: "high";
1611
+ }>>;
1612
+ }, z.core.$strip>, z.ZodObject<{
1613
+ type: z.ZodLiteral<"file">;
1614
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1615
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1616
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1617
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1618
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1619
+ }, z.core.$strip>], "type">>>, unknown>>;
1620
+ }, z.core.$strip> | z.ZodObject<{
1621
+ turn: z.ZodNullable<z.ZodNumber>;
1622
+ step: z.ZodNullable<z.ZodNumber>;
1623
+ llm_call_id: z.ZodString;
1624
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1625
+ input_tokens: z.ZodDefault<z.ZodNumber>;
1626
+ output_tokens: z.ZodDefault<z.ZodNumber>;
1627
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
1628
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
1629
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
1630
+ }, z.core.$strip>>>;
1631
+ text: z.ZodNullable<z.ZodString>;
1632
+ finish: z.ZodNullable<z.ZodEnum<{
1633
+ length: "length";
1634
+ completed: "completed";
1635
+ other: "other";
1636
+ }>>;
1637
+ tool_calls: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1638
+ call_id: z.ZodString;
1639
+ name: z.ZodString;
1640
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1641
+ }, z.core.$loose>, z.ZodObject<{
1642
+ call_id: z.ZodString;
1643
+ name: z.ZodString;
1644
+ arguments: z.ZodNull;
1645
+ malformed: z.ZodObject<{
1646
+ raw: z.ZodString;
1647
+ error: z.ZodString;
1648
+ }, z.core.$strict>;
1649
+ }, z.core.$loose>]>>>;
1650
+ provider_calls: z.ZodDefault<z.ZodArray<z.ZodObject<{
1651
+ id: z.ZodString;
1652
+ type: z.ZodString;
1653
+ name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1654
+ status: z.ZodDefault<z.ZodEnum<{
1655
+ in_progress: "in_progress";
1656
+ completed: "completed";
1657
+ failed: "failed";
1658
+ }>>;
1659
+ summary: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1660
+ }, z.core.$loose>>>;
1661
+ error_text: z.ZodNullable<z.ZodString>;
1662
+ error_kind: z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
1663
+ length: "length";
1664
+ other: "other";
1665
+ transport: "transport";
1666
+ empty: "empty";
1667
+ invalid: "invalid";
1668
+ rate_limit: "rate_limit";
1669
+ overloaded: "overloaded";
1670
+ timeout: "timeout";
1671
+ auth: "auth";
1672
+ quota: "quota";
1673
+ overflow: "overflow";
1674
+ }>, z.ZodLiteral<"aborted">]>>;
1675
+ attempts: z.ZodNumber;
1676
+ }, z.core.$strip> | z.ZodObject<{
1677
+ call_id: z.ZodString;
1678
+ name: z.ZodString;
1679
+ turn: z.ZodNumber;
1680
+ step: z.ZodNumber;
1681
+ }, z.core.$strip> | z.ZodObject<{
1682
+ call_id: z.ZodString;
1683
+ call_seq: z.ZodNumber;
1684
+ decision: z.ZodEnum<{
1685
+ allow: "allow";
1686
+ confirm: "confirm";
1687
+ deny: "deny";
1688
+ }>;
1689
+ confirmed_by: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
1690
+ user: "user";
1691
+ policy: "policy";
1692
+ }>>>;
1693
+ policy: z.ZodEnum<{
1694
+ rerun: "rerun";
1695
+ report: "report";
1696
+ }>;
1697
+ turn: z.ZodNumber;
1698
+ step: z.ZodNumber;
1699
+ }, z.core.$strip> | z.ZodObject<{
1700
+ result: z.ZodObject<{
1701
+ output: z.ZodString;
1702
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1703
+ type: z.ZodLiteral<"text">;
1704
+ text: z.ZodString;
1705
+ }, z.core.$strip>, z.ZodObject<{
1706
+ type: z.ZodLiteral<"image">;
1707
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1708
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1709
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1710
+ detail: z.ZodDefault<z.ZodEnum<{
1711
+ auto: "auto";
1712
+ low: "low";
1713
+ high: "high";
1714
+ }>>;
1715
+ }, z.core.$strip>, z.ZodObject<{
1716
+ type: z.ZodLiteral<"file">;
1717
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1718
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1719
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1720
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1721
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1722
+ }, z.core.$strip>], "type">>>;
1723
+ is_error: z.ZodDefault<z.ZodBoolean>;
1724
+ notes: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1725
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1726
+ concludes_turn: z.ZodOptional<z.ZodLiteral<true>>;
1727
+ call_id: z.ZodString;
1728
+ name: z.ZodString;
1729
+ }, z.core.$strip>;
1730
+ turn: z.ZodNumber;
1731
+ step: z.ZodNumber;
1732
+ }, z.core.$strip> | z.ZodObject<{
1733
+ call_id: z.ZodString;
1734
+ call_seq: z.ZodNumber;
1735
+ owner: z.ZodString;
1736
+ dependency: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1737
+ deadline_at: z.ZodNullable<z.ZodNumber>;
1738
+ reason: z.ZodString;
1739
+ turn: z.ZodNumber;
1740
+ step: z.ZodNumber;
1741
+ }, z.core.$strip> | z.ZodObject<{
1742
+ call_seq: z.ZodNumber;
1743
+ value: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1744
+ }, z.core.$strip> | z.ZodObject<{
1745
+ request_id: z.ZodString;
1746
+ tool_call: z.ZodObject<{
1747
+ call_id: z.ZodString;
1748
+ name: z.ZodString;
1749
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1750
+ }, z.core.$loose>;
1751
+ reason: z.ZodString;
1752
+ turn: z.ZodNumber;
1753
+ step: z.ZodNumber;
1754
+ }, z.core.$strip> | z.ZodObject<{
1755
+ request_id: z.ZodString;
1756
+ approved: z.ZodBoolean;
1757
+ rejection_message: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1758
+ }, z.core.$strip> | z.ZodObject<{
1759
+ agent_name: z.ZodString;
1760
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
1761
+ fork: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1762
+ thread_id: z.ZodString;
1763
+ seq: z.ZodNumber;
1764
+ }, z.core.$strip>>>;
1765
+ origin: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1766
+ caller_thread_id: z.ZodString;
1767
+ source_seq: z.ZodNumber;
1768
+ cause: z.ZodDiscriminatedUnion<[z.ZodObject<{
1769
+ kind: z.ZodLiteral<"call">;
1770
+ }, z.core.$strip>, z.ZodObject<{
1771
+ kind: z.ZodLiteral<"assignment">;
1772
+ owner: z.ZodString;
1773
+ key: z.ZodJSONSchema;
1774
+ }, z.core.$strip>], "kind">;
1775
+ }, z.core.$strip>>>;
1776
+ environment: z.ZodObject<{
1777
+ cwd: z.ZodString;
1778
+ read_roots: z.ZodArray<z.ZodString>;
1779
+ }, z.core.$strip>;
1780
+ installations: z.ZodDefault<z.ZodArray<z.ZodObject<{
1781
+ installation_id: z.ZodString;
1782
+ preset_id: z.ZodString;
1783
+ config: z.ZodJSONSchema;
1784
+ lifetime: z.ZodEnum<{
1785
+ defining: "defining";
1786
+ configurable: "configurable";
1787
+ }>;
1788
+ }, z.core.$strict>>>;
1789
+ requires: z.ZodArray<z.ZodString>;
1790
+ route: z.ZodNullable<z.ZodObject<{
1791
+ provider: z.ZodString;
1792
+ model: z.ZodString;
1793
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
1794
+ low: "low";
1795
+ high: "high";
1796
+ none: "none";
1797
+ medium: "medium";
1798
+ max: "max";
1799
+ }>>;
1800
+ }, z.core.$strip>>;
1801
+ }, z.core.$strip> | z.ZodObject<{
1802
+ installation_id: z.ZodString;
1803
+ }, z.core.$strict> | z.ZodObject<{
1804
+ blocks: z.ZodArray<z.ZodObject<{
1805
+ kind: z.ZodEnum<{
1806
+ base: "base";
1807
+ instruction: "instruction";
1808
+ context: "context";
1809
+ }>;
1810
+ tag: z.ZodNullable<z.ZodString>;
1811
+ text: z.ZodString;
1812
+ }, z.core.$strip>>;
1813
+ }, z.core.$strip> | z.ZodObject<{
1814
+ tools: z.ZodArray<z.ZodObject<{
1815
+ name: z.ZodString;
1816
+ description: z.ZodString;
1817
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1818
+ }, z.core.$strip>>;
1819
+ }, z.core.$strip> | z.ZodObject<{
1820
+ run_id: z.ZodString;
1821
+ }, z.core.$strict> | z.ZodObject<{
1822
+ run_id: z.ZodString;
1823
+ input_id: z.ZodNullable<z.ZodString>;
1824
+ releases: z.ZodBoolean;
1825
+ chain: z.ZodEnum<{
1826
+ person: "person";
1827
+ fresh: "fresh";
1828
+ reactive: "reactive";
1829
+ }>;
1830
+ route: z.ZodNullable<z.ZodObject<{
1831
+ provider: z.ZodString;
1832
+ model: z.ZodString;
1833
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
1834
+ low: "low";
1835
+ high: "high";
1836
+ none: "none";
1837
+ medium: "medium";
1838
+ max: "max";
1839
+ }>>;
1840
+ }, z.core.$strip>>;
1841
+ }, z.core.$strict> | z.ZodObject<{
1842
+ run_id: z.ZodString;
1843
+ outcome: z.ZodEnum<{
1844
+ completed: "completed";
1845
+ failed: "failed";
1846
+ cancelled: "cancelled";
1847
+ superseded: "superseded";
1848
+ }>;
1849
+ reason: z.ZodEnum<{
1850
+ turn: "turn";
1851
+ answered: "answered";
1852
+ nothing: "nothing";
1853
+ setup: "setup";
1854
+ cancel: "cancel";
1855
+ obsolete: "obsolete";
1856
+ }>;
1857
+ error_text: z.ZodNullable<z.ZodString>;
1858
+ through: z.ZodNumber;
1859
+ residual: z.ZodArray<z.ZodNumber>;
1860
+ }, z.core.$strict> | z.ZodObject<{
1861
+ cancel_id: z.ZodString;
1862
+ intent: z.ZodEnum<{
1863
+ user: "user";
1864
+ cleanup: "cleanup";
1865
+ }>;
1866
+ run_id: z.ZodNullable<z.ZodString>;
1867
+ reason: z.ZodString;
1868
+ }, z.core.$strict> | z.ZodObject<{
1869
+ target: z.ZodEnum<{
1870
+ "next-turn": "next-turn";
1871
+ "next-step": "next-step";
1872
+ }>;
1873
+ start: z.ZodNumber;
1874
+ removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
1875
+ inserted: z.ZodDefault<z.ZodArray<z.ZodObject<{
1876
+ id: z.ZodString;
1877
+ role: z.ZodDefault<z.ZodEnum<{
1878
+ developer: "developer";
1879
+ user: "user";
1880
+ }>>;
1881
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1882
+ type: z.ZodLiteral<"text">;
1883
+ text: z.ZodString;
1884
+ }, z.core.$strip>, z.ZodObject<{
1885
+ type: z.ZodLiteral<"image">;
1886
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1887
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1888
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1889
+ detail: z.ZodDefault<z.ZodEnum<{
1890
+ auto: "auto";
1891
+ low: "low";
1892
+ high: "high";
1893
+ }>>;
1894
+ }, z.core.$strip>, z.ZodObject<{
1895
+ type: z.ZodLiteral<"file">;
1896
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1897
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1898
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1899
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1900
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1901
+ }, z.core.$strip>], "type">>>, unknown>;
1902
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1903
+ plugin: z.ZodString;
1904
+ instance_id: z.ZodDefault<z.ZodString>;
1905
+ kind: z.ZodString;
1906
+ version: z.ZodNumber;
1907
+ data: z.ZodJSONSchema;
1908
+ }, z.core.$strip>>>;
1909
+ }, z.core.$strip>>>;
1910
+ }, z.core.$strip> | z.ZodObject<{
1911
+ turn: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1912
+ step: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1913
+ llm_call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1914
+ error_text: z.ZodString;
1915
+ failure_kind: z.ZodEnum<{
1916
+ length: "length";
1917
+ other: "other";
1918
+ transport: "transport";
1919
+ empty: "empty";
1920
+ invalid: "invalid";
1921
+ rate_limit: "rate_limit";
1922
+ overloaded: "overloaded";
1923
+ timeout: "timeout";
1924
+ auth: "auth";
1925
+ quota: "quota";
1926
+ overflow: "overflow";
1927
+ }>;
1928
+ }, z.core.$strip>;
1929
+ source_seqs: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
1930
+ }, z.core.$strip>, ...z.ZodObject<{
1931
+ seq: z.ZodNumber;
1932
+ type: z.ZodLiteral<"error" | "ext" | "turn/start" | "turn/end" | "step/start" | "step/end" | "input/message" | "llm/request" | "assistant/message" | "assistant/attempt" | "auxiliary/request" | "auxiliary/result" | "tool/call" | "tool/authorization" | "tool/result" | "wait/declared" | "wait/resolved" | "confirm/requested" | "confirm/resolved" | "thread/spawned" | "installation/applied" | "installation/removed" | "thread/prompt" | "thread/tools" | "run/requested" | "run/cause" | "run/settled" | "thread/cancel" | "inbox/spliced" | "surface/replaced">;
1933
+ timestamp: z.ZodDefault<z.ZodISODateTime>;
1934
+ thread_id: z.ZodString;
1935
+ data: z.ZodObject<{
1936
+ plugin: z.ZodString;
1937
+ instance_id: z.ZodDefault<z.ZodString>;
1938
+ kind: z.ZodString;
1939
+ version: z.ZodNumber;
1940
+ data: z.ZodJSONSchema;
1941
+ }, z.core.$strip> | z.ZodObject<{
1942
+ installation_id: z.ZodString;
1943
+ preset_id: z.ZodString;
1944
+ config: z.ZodJSONSchema;
1945
+ }, z.core.$strict> | z.ZodDiscriminatedUnion<[z.ZodObject<{
1946
+ source: z.ZodObject<{
1947
+ plugin: z.ZodString;
1948
+ instance_id: z.ZodDefault<z.ZodString>;
1949
+ kind: z.ZodString;
1950
+ version: z.ZodNumber;
1951
+ data: z.ZodJSONSchema;
1952
+ }, z.core.$strip>;
1953
+ trigger: z.ZodEnum<{
1954
+ overflow: "overflow";
1955
+ pressure: "pressure";
1956
+ request: "request";
1957
+ }>;
1958
+ auxiliary_request_seq: z.ZodNullable<z.ZodNumber>;
1959
+ turn: z.ZodNullable<z.ZodNumber>;
1960
+ step: z.ZodNullable<z.ZodNumber>;
1961
+ kind: z.ZodLiteral<"span">;
1962
+ stand_in: z.ZodObject<{
1963
+ role: z.ZodEnum<{
1964
+ user: "user";
1965
+ assistant: "assistant";
1966
+ }>;
1967
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1968
+ type: z.ZodLiteral<"text">;
1969
+ text: z.ZodString;
1970
+ }, z.core.$strip>, z.ZodObject<{
1971
+ type: z.ZodLiteral<"image">;
1972
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1973
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1974
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1975
+ detail: z.ZodDefault<z.ZodEnum<{
1976
+ auto: "auto";
1977
+ low: "low";
1978
+ high: "high";
1979
+ }>>;
1980
+ }, z.core.$strip>, z.ZodObject<{
1981
+ type: z.ZodLiteral<"file">;
1982
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1983
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1984
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1985
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1986
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1987
+ }, z.core.$strip>], "type">>>, unknown>;
1988
+ }, z.core.$strict>;
1989
+ }, z.core.$strip>, z.ZodObject<{
1990
+ source: z.ZodObject<{
1991
+ plugin: z.ZodString;
1992
+ instance_id: z.ZodDefault<z.ZodString>;
1993
+ kind: z.ZodString;
1994
+ version: z.ZodNumber;
1995
+ data: z.ZodJSONSchema;
1996
+ }, z.core.$strip>;
1997
+ trigger: z.ZodEnum<{
1998
+ overflow: "overflow";
1999
+ pressure: "pressure";
2000
+ request: "request";
2001
+ }>;
2002
+ auxiliary_request_seq: z.ZodNullable<z.ZodNumber>;
2003
+ turn: z.ZodNullable<z.ZodNumber>;
2004
+ step: z.ZodNullable<z.ZodNumber>;
2005
+ kind: z.ZodLiteral<"rewrite">;
2006
+ stand_in: z.ZodObject<{
2007
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2008
+ type: z.ZodLiteral<"text">;
2009
+ text: z.ZodString;
2010
+ }, z.core.$strip>, z.ZodObject<{
2011
+ type: z.ZodLiteral<"image">;
2012
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2013
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2014
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2015
+ detail: z.ZodDefault<z.ZodEnum<{
2016
+ auto: "auto";
2017
+ low: "low";
2018
+ high: "high";
2019
+ }>>;
2020
+ }, z.core.$strip>, z.ZodObject<{
2021
+ type: z.ZodLiteral<"file">;
2022
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2023
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2024
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2025
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2026
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2027
+ }, z.core.$strip>], "type">>>, unknown>;
2028
+ }, z.core.$strict>;
2029
+ }, z.core.$strip>], "kind"> | z.ZodObject<{
2030
+ turn: z.ZodNumber;
2031
+ route: z.ZodObject<{
2032
+ provider: z.ZodString;
2033
+ model: z.ZodString;
2034
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
2035
+ low: "low";
2036
+ high: "high";
2037
+ none: "none";
2038
+ medium: "medium";
2039
+ max: "max";
2040
+ }>>;
2041
+ }, z.core.$strip>;
2042
+ run_id: z.ZodString;
2043
+ attempt_cutoff: z.ZodNumber;
2044
+ }, z.core.$strip> | z.ZodObject<{
2045
+ turn: z.ZodNumber;
2046
+ reason: z.ZodDiscriminatedUnion<[z.ZodObject<{
2047
+ kind: z.ZodLiteral<"completed">;
2048
+ }, z.core.$strip>, z.ZodObject<{
2049
+ kind: z.ZodLiteral<"blocked">;
2050
+ }, z.core.$strip>, z.ZodObject<{
2051
+ kind: z.ZodLiteral<"max-steps">;
2052
+ limit: z.ZodNumber;
2053
+ }, z.core.$strip>, z.ZodObject<{
2054
+ kind: z.ZodLiteral<"interrupted">;
2055
+ cause: z.ZodEnum<{
2056
+ abandoned: "abandoned";
2057
+ "activation-changed": "activation-changed";
2058
+ "judgment-invalidated": "judgment-invalidated";
2059
+ }>;
2060
+ }, z.core.$strip>, z.ZodObject<{
2061
+ kind: z.ZodLiteral<"aborted">;
2062
+ reason: z.ZodString;
2063
+ }, z.core.$strip>, z.ZodObject<{
2064
+ kind: z.ZodLiteral<"error">;
2065
+ error_text: z.ZodString;
2066
+ failure_kind: z.ZodEnum<{
2067
+ length: "length";
2068
+ other: "other";
2069
+ transport: "transport";
2070
+ empty: "empty";
2071
+ invalid: "invalid";
2072
+ rate_limit: "rate_limit";
2073
+ overloaded: "overloaded";
2074
+ timeout: "timeout";
2075
+ auth: "auth";
2076
+ quota: "quota";
2077
+ overflow: "overflow";
2078
+ }>;
2079
+ retry_after_ms: z.ZodNullable<z.ZodNumber>;
2080
+ }, z.core.$strip>, z.ZodObject<{
2081
+ kind: z.ZodLiteral<"rejected">;
2082
+ rejections: z.ZodArray<z.ZodObject<{
2083
+ reason: z.ZodString;
2084
+ source: z.ZodObject<{
2085
+ plugin: z.ZodString;
2086
+ instance_id: z.ZodDefault<z.ZodString>;
2087
+ kind: z.ZodString;
2088
+ version: z.ZodNumber;
2089
+ data: z.ZodJSONSchema;
2090
+ }, z.core.$strip>;
2091
+ }, z.core.$strip>>;
2092
+ }, z.core.$strip>], "kind">;
2093
+ }, z.core.$strip> | z.ZodObject<{
2094
+ turn: z.ZodNumber;
2095
+ step: z.ZodNumber;
2096
+ }, z.core.$strip> | z.ZodObject<{
2097
+ turn: z.ZodNumber;
2098
+ role: z.ZodDefault<z.ZodEnum<{
2099
+ developer: "developer";
2100
+ user: "user";
2101
+ }>>;
2102
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2103
+ type: z.ZodLiteral<"text">;
2104
+ text: z.ZodString;
2105
+ }, z.core.$strip>, z.ZodObject<{
2106
+ type: z.ZodLiteral<"image">;
2107
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2108
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2109
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2110
+ detail: z.ZodDefault<z.ZodEnum<{
2111
+ auto: "auto";
2112
+ low: "low";
2113
+ high: "high";
2114
+ }>>;
2115
+ }, z.core.$strip>, z.ZodObject<{
2116
+ type: z.ZodLiteral<"file">;
2117
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2118
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2119
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2120
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2121
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2122
+ }, z.core.$strip>], "type">>>, unknown>;
2123
+ input_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2124
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2125
+ plugin: z.ZodString;
2126
+ instance_id: z.ZodDefault<z.ZodString>;
2127
+ kind: z.ZodString;
2128
+ version: z.ZodNumber;
2129
+ data: z.ZodJSONSchema;
2130
+ }, z.core.$strip>>>;
2131
+ }, z.core.$strip> | z.ZodObject<{
2132
+ llm_call_id: z.ZodString;
2133
+ model: z.ZodString;
2134
+ route: z.ZodObject<{
2135
+ provider: z.ZodString;
2136
+ model: z.ZodString;
2137
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
2138
+ low: "low";
2139
+ high: "high";
2140
+ none: "none";
2141
+ medium: "medium";
2142
+ max: "max";
2143
+ }>>;
2144
+ }, z.core.$strip>;
2145
+ message_count: z.ZodDefault<z.ZodNumber>;
2146
+ turn: z.ZodNumber;
2147
+ step: z.ZodNumber;
2148
+ }, z.core.$strip> | z.ZodObject<{
2149
+ llm_call_id: z.ZodString;
2150
+ response: z.ZodObject<{
2151
+ message: z.ZodObject<{
2152
+ role: z.ZodEnum<{
2153
+ system: "system";
2154
+ developer: "developer";
2155
+ user: "user";
2156
+ assistant: "assistant";
2157
+ tool: "tool";
2158
+ }>;
2159
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2160
+ type: z.ZodLiteral<"text">;
2161
+ text: z.ZodString;
2162
+ }, z.core.$strip>, z.ZodObject<{
2163
+ type: z.ZodLiteral<"image">;
2164
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2165
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2166
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2167
+ detail: z.ZodDefault<z.ZodEnum<{
2168
+ auto: "auto";
2169
+ low: "low";
2170
+ high: "high";
2171
+ }>>;
2172
+ }, z.core.$strip>, z.ZodObject<{
2173
+ type: z.ZodLiteral<"file">;
2174
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2175
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2176
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2177
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2178
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2179
+ }, z.core.$strip>], "type">>>, unknown>;
2180
+ reasoning_content: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2181
+ tool_calls: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2182
+ call_id: z.ZodString;
2183
+ name: z.ZodString;
2184
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2185
+ }, z.core.$loose>, z.ZodObject<{
2186
+ call_id: z.ZodString;
2187
+ name: z.ZodString;
2188
+ arguments: z.ZodNull;
2189
+ malformed: z.ZodObject<{
2190
+ raw: z.ZodString;
2191
+ error: z.ZodString;
2192
+ }, z.core.$strict>;
2193
+ }, z.core.$loose>]>>>;
2194
+ provider_calls: z.ZodDefault<z.ZodArray<z.ZodObject<{
2195
+ id: z.ZodString;
2196
+ type: z.ZodString;
2197
+ name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2198
+ status: z.ZodDefault<z.ZodEnum<{
2199
+ in_progress: "in_progress";
2200
+ completed: "completed";
2201
+ failed: "failed";
2202
+ }>>;
2203
+ summary: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2204
+ }, z.core.$loose>>>;
2205
+ tool_call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2206
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2207
+ input_tokens: z.ZodDefault<z.ZodNumber>;
2208
+ output_tokens: z.ZodDefault<z.ZodNumber>;
2209
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
2210
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
2211
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
2212
+ }, z.core.$strip>>>;
2213
+ provider_state: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2214
+ provider: z.ZodString;
2215
+ data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2216
+ }, z.core.$strip>>>;
2217
+ }, z.core.$strip>;
2218
+ finish: z.ZodEnum<{
2219
+ length: "length";
2220
+ completed: "completed";
2221
+ other: "other";
2222
+ }>;
2223
+ provider_metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2224
+ }, z.core.$strip>;
2225
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2226
+ input_tokens: z.ZodDefault<z.ZodNumber>;
2227
+ output_tokens: z.ZodDefault<z.ZodNumber>;
2228
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
2229
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
2230
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
2231
+ }, z.core.$strip>>>;
2232
+ interrupted: z.ZodDefault<z.ZodBoolean>;
2233
+ attempts: z.ZodNumber;
2234
+ turn: z.ZodNumber;
2235
+ step: z.ZodNumber;
2236
+ }, z.core.$strip> | z.ZodObject<{
2237
+ llm_call_id: z.ZodString;
2238
+ error_text: z.ZodString;
2239
+ failure_kind: z.ZodEnum<{
2240
+ length: "length";
2241
+ other: "other";
2242
+ transport: "transport";
2243
+ empty: "empty";
2244
+ invalid: "invalid";
2245
+ rate_limit: "rate_limit";
2246
+ overloaded: "overloaded";
2247
+ timeout: "timeout";
2248
+ auth: "auth";
2249
+ quota: "quota";
2250
+ overflow: "overflow";
2251
+ }>;
2252
+ attempts: z.ZodNumber;
2253
+ retry_after_ms: z.ZodNullable<z.ZodNumber>;
2254
+ turn: z.ZodNumber;
2255
+ step: z.ZodNumber;
2256
+ }, z.core.$strip> | z.ZodObject<{
2257
+ turn: z.ZodNullable<z.ZodNumber>;
2258
+ step: z.ZodNullable<z.ZodNumber>;
2259
+ llm_call_id: z.ZodString;
2260
+ model: z.ZodString;
2261
+ route: z.ZodObject<{
2262
+ provider: z.ZodString;
2263
+ model: z.ZodString;
2264
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
2265
+ low: "low";
2266
+ high: "high";
2267
+ none: "none";
2268
+ medium: "medium";
2269
+ max: "max";
2270
+ }>>;
2271
+ }, z.core.$strip>;
2272
+ message_count: z.ZodNumber;
2273
+ surface_message_count: z.ZodNumber;
2274
+ instructions: z.ZodArray<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2275
+ type: z.ZodLiteral<"text">;
2276
+ text: z.ZodString;
2277
+ }, z.core.$strip>, z.ZodObject<{
2278
+ type: z.ZodLiteral<"image">;
2279
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2280
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2281
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2282
+ detail: z.ZodDefault<z.ZodEnum<{
2283
+ auto: "auto";
2284
+ low: "low";
2285
+ high: "high";
2286
+ }>>;
2287
+ }, z.core.$strip>, z.ZodObject<{
2288
+ type: z.ZodLiteral<"file">;
2289
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2290
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2291
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2292
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2293
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2294
+ }, z.core.$strip>], "type">>>, unknown>>;
2295
+ }, z.core.$strip> | z.ZodObject<{
2296
+ turn: z.ZodNullable<z.ZodNumber>;
2297
+ step: z.ZodNullable<z.ZodNumber>;
2298
+ llm_call_id: z.ZodString;
2299
+ usage: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2300
+ input_tokens: z.ZodDefault<z.ZodNumber>;
2301
+ output_tokens: z.ZodDefault<z.ZodNumber>;
2302
+ cache_read_input_tokens: z.ZodDefault<z.ZodNumber>;
2303
+ cache_write_input_tokens: z.ZodDefault<z.ZodNumber>;
2304
+ reasoning_output_tokens: z.ZodDefault<z.ZodNumber>;
2305
+ }, z.core.$strip>>>;
2306
+ text: z.ZodNullable<z.ZodString>;
2307
+ finish: z.ZodNullable<z.ZodEnum<{
2308
+ length: "length";
2309
+ completed: "completed";
2310
+ other: "other";
2311
+ }>>;
2312
+ tool_calls: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2313
+ call_id: z.ZodString;
2314
+ name: z.ZodString;
2315
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2316
+ }, z.core.$loose>, z.ZodObject<{
2317
+ call_id: z.ZodString;
2318
+ name: z.ZodString;
2319
+ arguments: z.ZodNull;
2320
+ malformed: z.ZodObject<{
2321
+ raw: z.ZodString;
2322
+ error: z.ZodString;
2323
+ }, z.core.$strict>;
2324
+ }, z.core.$loose>]>>>;
2325
+ provider_calls: z.ZodDefault<z.ZodArray<z.ZodObject<{
2326
+ id: z.ZodString;
2327
+ type: z.ZodString;
2328
+ name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2329
+ status: z.ZodDefault<z.ZodEnum<{
2330
+ in_progress: "in_progress";
2331
+ completed: "completed";
2332
+ failed: "failed";
2333
+ }>>;
2334
+ summary: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2335
+ }, z.core.$loose>>>;
2336
+ error_text: z.ZodNullable<z.ZodString>;
2337
+ error_kind: z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
2338
+ length: "length";
2339
+ other: "other";
2340
+ transport: "transport";
2341
+ empty: "empty";
2342
+ invalid: "invalid";
2343
+ rate_limit: "rate_limit";
2344
+ overloaded: "overloaded";
2345
+ timeout: "timeout";
2346
+ auth: "auth";
2347
+ quota: "quota";
2348
+ overflow: "overflow";
2349
+ }>, z.ZodLiteral<"aborted">]>>;
2350
+ attempts: z.ZodNumber;
2351
+ }, z.core.$strip> | z.ZodObject<{
2352
+ call_id: z.ZodString;
2353
+ name: z.ZodString;
2354
+ turn: z.ZodNumber;
2355
+ step: z.ZodNumber;
2356
+ }, z.core.$strip> | z.ZodObject<{
2357
+ call_id: z.ZodString;
2358
+ call_seq: z.ZodNumber;
2359
+ decision: z.ZodEnum<{
2360
+ allow: "allow";
2361
+ confirm: "confirm";
2362
+ deny: "deny";
2363
+ }>;
2364
+ confirmed_by: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
2365
+ user: "user";
2366
+ policy: "policy";
2367
+ }>>>;
2368
+ policy: z.ZodEnum<{
2369
+ rerun: "rerun";
2370
+ report: "report";
2371
+ }>;
2372
+ turn: z.ZodNumber;
2373
+ step: z.ZodNumber;
2374
+ }, z.core.$strip> | z.ZodObject<{
2375
+ result: z.ZodObject<{
2376
+ output: z.ZodString;
2377
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2378
+ type: z.ZodLiteral<"text">;
2379
+ text: z.ZodString;
2380
+ }, z.core.$strip>, z.ZodObject<{
2381
+ type: z.ZodLiteral<"image">;
2382
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2383
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2384
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2385
+ detail: z.ZodDefault<z.ZodEnum<{
2386
+ auto: "auto";
2387
+ low: "low";
2388
+ high: "high";
2389
+ }>>;
2390
+ }, z.core.$strip>, z.ZodObject<{
2391
+ type: z.ZodLiteral<"file">;
2392
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2393
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2394
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2395
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2396
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2397
+ }, z.core.$strip>], "type">>>;
2398
+ is_error: z.ZodDefault<z.ZodBoolean>;
2399
+ notes: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2400
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2401
+ concludes_turn: z.ZodOptional<z.ZodLiteral<true>>;
2402
+ call_id: z.ZodString;
2403
+ name: z.ZodString;
2404
+ }, z.core.$strip>;
2405
+ turn: z.ZodNumber;
2406
+ step: z.ZodNumber;
2407
+ }, z.core.$strip> | z.ZodObject<{
2408
+ call_id: z.ZodString;
2409
+ call_seq: z.ZodNumber;
2410
+ owner: z.ZodString;
2411
+ dependency: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2412
+ deadline_at: z.ZodNullable<z.ZodNumber>;
2413
+ reason: z.ZodString;
2414
+ turn: z.ZodNumber;
2415
+ step: z.ZodNumber;
2416
+ }, z.core.$strip> | z.ZodObject<{
2417
+ call_seq: z.ZodNumber;
2418
+ value: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2419
+ }, z.core.$strip> | z.ZodObject<{
2420
+ request_id: z.ZodString;
2421
+ tool_call: z.ZodObject<{
2422
+ call_id: z.ZodString;
2423
+ name: z.ZodString;
2424
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2425
+ }, z.core.$loose>;
2426
+ reason: z.ZodString;
2427
+ turn: z.ZodNumber;
2428
+ step: z.ZodNumber;
2429
+ }, z.core.$strip> | z.ZodObject<{
2430
+ request_id: z.ZodString;
2431
+ approved: z.ZodBoolean;
2432
+ rejection_message: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2433
+ }, z.core.$strip> | z.ZodObject<{
2434
+ agent_name: z.ZodString;
2435
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
2436
+ fork: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2437
+ thread_id: z.ZodString;
2438
+ seq: z.ZodNumber;
2439
+ }, z.core.$strip>>>;
2440
+ origin: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2441
+ caller_thread_id: z.ZodString;
2442
+ source_seq: z.ZodNumber;
2443
+ cause: z.ZodDiscriminatedUnion<[z.ZodObject<{
2444
+ kind: z.ZodLiteral<"call">;
2445
+ }, z.core.$strip>, z.ZodObject<{
2446
+ kind: z.ZodLiteral<"assignment">;
2447
+ owner: z.ZodString;
2448
+ key: z.ZodJSONSchema;
2449
+ }, z.core.$strip>], "kind">;
2450
+ }, z.core.$strip>>>;
2451
+ environment: z.ZodObject<{
2452
+ cwd: z.ZodString;
2453
+ read_roots: z.ZodArray<z.ZodString>;
2454
+ }, z.core.$strip>;
2455
+ installations: z.ZodDefault<z.ZodArray<z.ZodObject<{
2456
+ installation_id: z.ZodString;
2457
+ preset_id: z.ZodString;
2458
+ config: z.ZodJSONSchema;
2459
+ lifetime: z.ZodEnum<{
2460
+ defining: "defining";
2461
+ configurable: "configurable";
2462
+ }>;
2463
+ }, z.core.$strict>>>;
2464
+ requires: z.ZodArray<z.ZodString>;
2465
+ route: z.ZodNullable<z.ZodObject<{
2466
+ provider: z.ZodString;
2467
+ model: z.ZodString;
2468
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
2469
+ low: "low";
2470
+ high: "high";
2471
+ none: "none";
2472
+ medium: "medium";
2473
+ max: "max";
2474
+ }>>;
2475
+ }, z.core.$strip>>;
2476
+ }, z.core.$strip> | z.ZodObject<{
2477
+ installation_id: z.ZodString;
2478
+ }, z.core.$strict> | z.ZodObject<{
2479
+ blocks: z.ZodArray<z.ZodObject<{
2480
+ kind: z.ZodEnum<{
2481
+ base: "base";
2482
+ instruction: "instruction";
2483
+ context: "context";
2484
+ }>;
2485
+ tag: z.ZodNullable<z.ZodString>;
2486
+ text: z.ZodString;
2487
+ }, z.core.$strip>>;
2488
+ }, z.core.$strip> | z.ZodObject<{
2489
+ tools: z.ZodArray<z.ZodObject<{
2490
+ name: z.ZodString;
2491
+ description: z.ZodString;
2492
+ input_schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2493
+ }, z.core.$strip>>;
2494
+ }, z.core.$strip> | z.ZodObject<{
2495
+ run_id: z.ZodString;
2496
+ }, z.core.$strict> | z.ZodObject<{
2497
+ run_id: z.ZodString;
2498
+ input_id: z.ZodNullable<z.ZodString>;
2499
+ releases: z.ZodBoolean;
2500
+ chain: z.ZodEnum<{
2501
+ person: "person";
2502
+ fresh: "fresh";
2503
+ reactive: "reactive";
2504
+ }>;
2505
+ route: z.ZodNullable<z.ZodObject<{
2506
+ provider: z.ZodString;
2507
+ model: z.ZodString;
2508
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
2509
+ low: "low";
2510
+ high: "high";
2511
+ none: "none";
2512
+ medium: "medium";
2513
+ max: "max";
2514
+ }>>;
2515
+ }, z.core.$strip>>;
2516
+ }, z.core.$strict> | z.ZodObject<{
2517
+ run_id: z.ZodString;
2518
+ outcome: z.ZodEnum<{
2519
+ completed: "completed";
2520
+ failed: "failed";
2521
+ cancelled: "cancelled";
2522
+ superseded: "superseded";
2523
+ }>;
2524
+ reason: z.ZodEnum<{
2525
+ turn: "turn";
2526
+ answered: "answered";
2527
+ nothing: "nothing";
2528
+ setup: "setup";
2529
+ cancel: "cancel";
2530
+ obsolete: "obsolete";
2531
+ }>;
2532
+ error_text: z.ZodNullable<z.ZodString>;
2533
+ through: z.ZodNumber;
2534
+ residual: z.ZodArray<z.ZodNumber>;
2535
+ }, z.core.$strict> | z.ZodObject<{
2536
+ cancel_id: z.ZodString;
2537
+ intent: z.ZodEnum<{
2538
+ user: "user";
2539
+ cleanup: "cleanup";
2540
+ }>;
2541
+ run_id: z.ZodNullable<z.ZodString>;
2542
+ reason: z.ZodString;
2543
+ }, z.core.$strict> | z.ZodObject<{
2544
+ target: z.ZodEnum<{
2545
+ "next-turn": "next-turn";
2546
+ "next-step": "next-step";
2547
+ }>;
2548
+ start: z.ZodNumber;
2549
+ removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
2550
+ inserted: z.ZodDefault<z.ZodArray<z.ZodObject<{
2551
+ id: z.ZodString;
2552
+ role: z.ZodDefault<z.ZodEnum<{
2553
+ developer: "developer";
2554
+ user: "user";
2555
+ }>>;
2556
+ content: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2557
+ type: z.ZodLiteral<"text">;
2558
+ text: z.ZodString;
2559
+ }, z.core.$strip>, z.ZodObject<{
2560
+ type: z.ZodLiteral<"image">;
2561
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2562
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2563
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2564
+ detail: z.ZodDefault<z.ZodEnum<{
2565
+ auto: "auto";
2566
+ low: "low";
2567
+ high: "high";
2568
+ }>>;
2569
+ }, z.core.$strip>, z.ZodObject<{
2570
+ type: z.ZodLiteral<"file">;
2571
+ file_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2572
+ url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2573
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2574
+ filename: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2575
+ media_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2576
+ }, z.core.$strip>], "type">>>, unknown>;
2577
+ source: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2578
+ plugin: z.ZodString;
2579
+ instance_id: z.ZodDefault<z.ZodString>;
2580
+ kind: z.ZodString;
2581
+ version: z.ZodNumber;
2582
+ data: z.ZodJSONSchema;
2583
+ }, z.core.$strip>>>;
2584
+ }, z.core.$strip>>>;
2585
+ }, z.core.$strip> | z.ZodObject<{
2586
+ turn: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
2587
+ step: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
2588
+ llm_call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2589
+ error_text: z.ZodString;
2590
+ failure_kind: z.ZodEnum<{
2591
+ length: "length";
2592
+ other: "other";
2593
+ transport: "transport";
2594
+ empty: "empty";
2595
+ invalid: "invalid";
2596
+ rate_limit: "rate_limit";
2597
+ overloaded: "overloaded";
2598
+ timeout: "timeout";
2599
+ auth: "auth";
2600
+ quota: "quota";
2601
+ overflow: "overflow";
2602
+ }>;
2603
+ }, z.core.$strip>;
2604
+ source_seqs: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
2605
+ }, z.core.$strip>[]], "type">;
2606
+ export declare const parseJournalEvent: (value: unknown) => JournalEvent;
2607
+ /** Whether this is a forked thread's spawn row: where a fold resets what a fork does not inherit. */
2608
+ export declare const isForkSpawn: (event: JournalEvent) => event is JournalEvent<"thread/spawned">;
2609
+ /** Whether an event appends to the model-visible message surface. */
2610
+ export declare const isSurfaceEvent: (event: JournalEvent) => event is JournalEvent<SurfaceEventType>;
2611
+ /** One confirmation a thread still waits on, as its summary lists it: enough to find it, not to show it. */
2612
+ export declare const ConfirmationDescriptorSchema: z.ZodObject<{
2613
+ request_id: z.ZodString;
2614
+ call_seq: z.ZodNullable<z.ZodNumber>;
2615
+ tool_name: z.ZodString;
2616
+ reason: z.ZodString;
2617
+ }, z.core.$strip>;
2618
+ export type ConfirmationDescriptor = z.infer<typeof ConfirmationDescriptorSchema>;
2619
+ /**
2620
+ * One call a thread has suspended, as its summary lists it: declared and unanswered, `resolved` once
2621
+ * its value is recorded while the call waits to be dispatched again.
2622
+ */
2623
+ export declare const WaitDescriptorSchema: z.ZodObject<{
2624
+ call_seq: z.ZodNumber;
2625
+ owner: z.ZodString;
2626
+ deadline_at: z.ZodNullable<z.ZodNumber>;
2627
+ reason: z.ZodString;
2628
+ resolved: z.ZodBoolean;
2629
+ }, z.core.$strip>;
2630
+ export type WaitDescriptor = z.infer<typeof WaitDescriptorSchema>;
2631
+ /**
2632
+ * A thread's catalog entry: what the journal keeps of a thread so that listing it, finding it and
2633
+ * deciding whether a restart should run it need none of its rows in memory. Derived from the
2634
+ * thread's own rows by core, written in the same transaction as the rows that change it, and
2635
+ * rebuildable from them. Core's fields are a hint for finding and a record for listing, never an
2636
+ * authority for acting. `contributions` is what plugins and hosts registered, keyed by contributor:
2637
+ * a listing hint for most, and for a plugin whose contribution is total and fails closed when
2638
+ * unavailable, what it decides from.
2639
+ */
2640
+ export declare const ThreadSummarySchema: z.ZodObject<{
2641
+ thread_id: z.ZodString;
2642
+ spawn_seq: z.ZodNumber;
2643
+ through_seq: z.ZodNumber;
2644
+ agent_name: z.ZodString;
2645
+ metadata: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2646
+ fork: z.ZodNullable<z.ZodObject<{
2647
+ thread_id: z.ZodString;
2648
+ seq: z.ZodNumber;
2649
+ }, z.core.$strip>>;
2650
+ origin: z.ZodNullable<z.ZodObject<{
2651
+ caller_thread_id: z.ZodString;
2652
+ source_seq: z.ZodNumber;
2653
+ cause: z.ZodDiscriminatedUnion<[z.ZodObject<{
2654
+ kind: z.ZodLiteral<"call">;
2655
+ }, z.core.$strip>, z.ZodObject<{
2656
+ kind: z.ZodLiteral<"assignment">;
2657
+ owner: z.ZodString;
2658
+ key: z.ZodJSONSchema;
2659
+ }, z.core.$strip>], "kind">;
2660
+ }, z.core.$strip>>;
2661
+ environment: z.ZodObject<{
2662
+ cwd: z.ZodString;
2663
+ read_roots: z.ZodArray<z.ZodString>;
2664
+ }, z.core.$strip>;
2665
+ has_work: z.ZodBoolean;
2666
+ turn_open: z.ZodBoolean;
2667
+ last_reason: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
2668
+ kind: z.ZodLiteral<"completed">;
2669
+ }, z.core.$strip>, z.ZodObject<{
2670
+ kind: z.ZodLiteral<"blocked">;
2671
+ }, z.core.$strip>, z.ZodObject<{
2672
+ kind: z.ZodLiteral<"max-steps">;
2673
+ limit: z.ZodNumber;
2674
+ }, z.core.$strip>, z.ZodObject<{
2675
+ kind: z.ZodLiteral<"interrupted">;
2676
+ cause: z.ZodEnum<{
2677
+ abandoned: "abandoned";
2678
+ "activation-changed": "activation-changed";
2679
+ "judgment-invalidated": "judgment-invalidated";
2680
+ }>;
2681
+ }, z.core.$strip>, z.ZodObject<{
2682
+ kind: z.ZodLiteral<"aborted">;
2683
+ reason: z.ZodString;
2684
+ }, z.core.$strip>, z.ZodObject<{
2685
+ kind: z.ZodLiteral<"error">;
2686
+ error_text: z.ZodString;
2687
+ failure_kind: z.ZodEnum<{
2688
+ length: "length";
2689
+ other: "other";
2690
+ transport: "transport";
2691
+ empty: "empty";
2692
+ invalid: "invalid";
2693
+ rate_limit: "rate_limit";
2694
+ overloaded: "overloaded";
2695
+ timeout: "timeout";
2696
+ auth: "auth";
2697
+ quota: "quota";
2698
+ overflow: "overflow";
2699
+ }>;
2700
+ retry_after_ms: z.ZodNullable<z.ZodNumber>;
2701
+ }, z.core.$strip>, z.ZodObject<{
2702
+ kind: z.ZodLiteral<"rejected">;
2703
+ rejections: z.ZodArray<z.ZodObject<{
2704
+ reason: z.ZodString;
2705
+ source: z.ZodObject<{
2706
+ plugin: z.ZodString;
2707
+ instance_id: z.ZodDefault<z.ZodString>;
2708
+ kind: z.ZodString;
2709
+ version: z.ZodNumber;
2710
+ data: z.ZodJSONSchema;
2711
+ }, z.core.$strip>;
2712
+ }, z.core.$strip>>;
2713
+ }, z.core.$strip>], "kind">>;
2714
+ route: z.ZodObject<{
2715
+ provider: z.ZodString;
2716
+ model: z.ZodString;
2717
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
2718
+ low: "low";
2719
+ high: "high";
2720
+ none: "none";
2721
+ medium: "medium";
2722
+ max: "max";
2723
+ }>>;
2724
+ }, z.core.$strip>;
2725
+ queued_input: z.ZodNumber;
2726
+ unanswered_confirmations: z.ZodArray<z.ZodObject<{
2727
+ request_id: z.ZodString;
2728
+ call_seq: z.ZodNullable<z.ZodNumber>;
2729
+ tool_name: z.ZodString;
2730
+ reason: z.ZodString;
2731
+ }, z.core.$strip>>;
2732
+ waits: z.ZodArray<z.ZodObject<{
2733
+ call_seq: z.ZodNumber;
2734
+ owner: z.ZodString;
2735
+ deadline_at: z.ZodNullable<z.ZodNumber>;
2736
+ reason: z.ZodString;
2737
+ resolved: z.ZodBoolean;
2738
+ }, z.core.$strip>>;
2739
+ pending_run: z.ZodNullable<z.ZodObject<{
2740
+ run_id: z.ZodString;
2741
+ newest_cause_at: z.ZodNullable<z.ZodString>;
2742
+ releasing: z.ZodBoolean;
2743
+ cancelled: z.ZodBoolean;
2744
+ }, z.core.$strip>>;
2745
+ latest_settlement: z.ZodNullable<z.ZodObject<{
2746
+ run_id: z.ZodString;
2747
+ outcome: z.ZodEnum<{
2748
+ completed: "completed";
2749
+ failed: "failed";
2750
+ cancelled: "cancelled";
2751
+ superseded: "superseded";
2752
+ }>;
2753
+ reason: z.ZodEnum<{
2754
+ turn: "turn";
2755
+ answered: "answered";
2756
+ nothing: "nothing";
2757
+ setup: "setup";
2758
+ cancel: "cancel";
2759
+ obsolete: "obsolete";
2760
+ }>;
2761
+ error_text: z.ZodNullable<z.ZodString>;
2762
+ }, z.core.$strip>>;
2763
+ latest_user_cancel: z.ZodNullable<z.ZodObject<{
2764
+ seq: z.ZodNumber;
2765
+ released: z.ZodBoolean;
2766
+ }, z.core.$strip>>;
2767
+ requires: z.ZodArray<z.ZodString>;
2768
+ answered_at: z.ZodNullable<z.ZodNumber>;
2769
+ contributions: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2770
+ }, z.core.$strip>;
2771
+ export type ThreadSummary = DeepReadonly<z.infer<typeof ThreadSummarySchema>>;
2772
+ export {};