@yielded/agent 0.1.0-beta.173 → 0.1.0-beta.175

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 (266) hide show
  1. package/dist/{Admin-BX9ns28E.d.mts → Admin-Qa3I1oA5.d.mts} +61 -21
  2. package/dist/{Agent-9aBoIi74.d.mts → Agent-B39jRnFv.d.mts} +2 -2
  3. package/dist/{Agent-0WvBWWbM.mjs → Agent-BiRbr73L.mjs} +7 -6
  4. package/dist/Agent-BiRbr73L.mjs.map +1 -0
  5. package/dist/{AgentRuntime-BfP14534.d.mts → AgentRuntime-CHDyRbSf.d.mts} +12 -12
  6. package/dist/{AgentRuntime-CQ-qcETl.mjs → AgentRuntime-DaDKMasp.mjs} +290 -273
  7. package/dist/AgentRuntime-DaDKMasp.mjs.map +1 -0
  8. package/dist/{Digest-DCuPlhNk.mjs → Digest-C3EODOee.mjs} +42 -15
  9. package/dist/Digest-C3EODOee.mjs.map +1 -0
  10. package/dist/{DurableAgentRuntime-BAmSkWYr.mjs → DurableAgentRuntime-CPlw5_7e.mjs} +1557 -1458
  11. package/dist/DurableAgentRuntime-CPlw5_7e.mjs.map +1 -0
  12. package/dist/{EventSource-BwliwQz9.d.mts → EventSource-BTu68yDW.d.mts} +2 -2
  13. package/dist/InMemory.d.mts +2 -2
  14. package/dist/{MessageDelivery-B943ebI_.d.mts → MessageDelivery-DjAZJ4Fd.d.mts} +42 -42
  15. package/dist/{Messaging-C_6OOg_s.d.mts → Messaging-SVu6rWV8.d.mts} +12 -6
  16. package/dist/{MessagingHost-B8oKM7AC.d.mts → MessagingHost-C6SOAcoG.d.mts} +2 -2
  17. package/dist/{MessagingHost-CRUK4JBi.mjs → MessagingHost-CZCyrnvJ.mjs} +27 -26
  18. package/dist/MessagingHost-CZCyrnvJ.mjs.map +1 -0
  19. package/dist/{Output-Dsx6k52t.d.mts → Output-CRamN1Fy.d.mts} +2 -2
  20. package/dist/{PreparedInputAdmission-CxSJSiTl.d.mts → PreparedInputAdmission-wgY4JMZY.d.mts} +3 -3
  21. package/dist/{Records-BiuJDWNe.mjs → Records-DzL4Kbtw.mjs} +2 -2
  22. package/dist/{Records-BiuJDWNe.mjs.map → Records-DzL4Kbtw.mjs.map} +1 -1
  23. package/dist/{RunContinuation-FHM7XPjq.d.mts → RunContinuation-3jB5pULC.d.mts} +13 -7
  24. package/dist/{RunContinuation-DHYNAQFi.mjs → RunContinuation-BiyKJK32.mjs} +173 -82
  25. package/dist/RunContinuation-BiyKJK32.mjs.map +1 -0
  26. package/dist/{RunJournal-kfKVxJj7.mjs → RunJournal-CPMKcfd0.mjs} +106 -73
  27. package/dist/RunJournal-CPMKcfd0.mjs.map +1 -0
  28. package/dist/{RunOptions-D8zxFIrZ.d.mts → RunOptions-Be77lKVZ.d.mts} +2 -2
  29. package/dist/{RunStorage-uqPxps09.mjs → RunStorage-CzutHJBE.mjs} +10 -6
  30. package/dist/RunStorage-CzutHJBE.mjs.map +1 -0
  31. package/dist/{Scheduling-CVyfXlBR.mjs → Scheduling-07_dsGED.mjs} +12 -12
  32. package/dist/Scheduling-07_dsGED.mjs.map +1 -0
  33. package/dist/{Subagent-vpffemql.mjs → Subagent-CexndZSp.mjs} +53 -40
  34. package/dist/Subagent-CexndZSp.mjs.map +1 -0
  35. package/dist/{Subagent-E6tvd7-k.d.mts → Subagent-xhN_aD1r.d.mts} +20 -9
  36. package/dist/{SubagentHost-B6w2m-SI.d.mts → SubagentHost-D1xBgn9g.d.mts} +2 -2
  37. package/dist/{Subscription-DONig54Q.d.mts → Subscription-DmIHlOJK.d.mts} +2 -2
  38. package/dist/{SubscriptionInput-mJIRxWJM.d.mts → SubscriptionInput-DgcQhvbe.d.mts} +2 -2
  39. package/dist/{Thread-dk-QiNml.d.mts → Thread-DzdJAY4J.d.mts} +4 -3
  40. package/dist/{ThreadHistory-ByxS8HU1.d.mts → ThreadHistory-KPPBJLJb.d.mts} +12 -2
  41. package/dist/{ThreadImport-DckUMEqJ.mjs → ThreadImport-CjlG57vH.mjs} +9 -9
  42. package/dist/ThreadImport-CjlG57vH.mjs.map +1 -0
  43. package/dist/{ThreadImport-DpHxjBrA.d.mts → ThreadImport-DP-vOk2F.d.mts} +5 -5
  44. package/dist/{ThreadStore-CEekRa80.mjs → ThreadStore-EuUilthA.mjs} +162 -85
  45. package/dist/ThreadStore-EuUilthA.mjs.map +1 -0
  46. package/dist/{ThreadTransfer-B4gTQLIl.mjs → ThreadTransfer-DB_zsrtJ.mjs} +4 -4
  47. package/dist/{ThreadTransfer-B4gTQLIl.mjs.map → ThreadTransfer-DB_zsrtJ.mjs.map} +1 -1
  48. package/dist/{WorkerAdmission-DFVbbVh2.mjs → WorkerAdmission-eBeXt_mu.mjs} +5 -5
  49. package/dist/{WorkerAdmission-DFVbbVh2.mjs.map → WorkerAdmission-eBeXt_mu.mjs.map} +1 -1
  50. package/dist/{agent-registration-ByMZ_cK5.mjs → agent-registration-a6QYaG3h.mjs} +70 -57
  51. package/dist/agent-registration-a6QYaG3h.mjs.map +1 -0
  52. package/dist/capabilities/Approval.mjs +2 -2
  53. package/dist/capabilities/Approval.mjs.map +1 -1
  54. package/dist/capabilities/BrowserUse.d.mts +102 -1867
  55. package/dist/capabilities/BrowserUse.mjs +74 -798
  56. package/dist/capabilities/BrowserUse.mjs.map +1 -1
  57. package/dist/capabilities/Budget.mjs +3 -1
  58. package/dist/capabilities/Budget.mjs.map +1 -1
  59. package/dist/capabilities/CodeMode.d.mts +1 -1
  60. package/dist/capabilities/CodeMode.mjs +16 -9
  61. package/dist/capabilities/CodeMode.mjs.map +1 -1
  62. package/dist/capabilities/Commands.d.mts +1 -1
  63. package/dist/capabilities/McpClient.mjs +1 -1
  64. package/dist/capabilities/McpClient.mjs.map +1 -1
  65. package/dist/capabilities/Messaging.d.mts +1 -1
  66. package/dist/capabilities/Messaging.mjs +5 -5
  67. package/dist/capabilities/Messaging.mjs.map +1 -1
  68. package/dist/capabilities/ModelContext.d.mts +1 -1
  69. package/dist/capabilities/ModelContext.mjs +7 -5
  70. package/dist/capabilities/ModelContext.mjs.map +1 -1
  71. package/dist/capabilities/Redaction.mjs +49 -19
  72. package/dist/capabilities/Redaction.mjs.map +1 -1
  73. package/dist/capabilities/RunHooks.d.mts +2 -2
  74. package/dist/capabilities/RunHooks.mjs +1 -1
  75. package/dist/capabilities/RunHooks.mjs.map +1 -1
  76. package/dist/capabilities/Subagent.d.mts +1 -1
  77. package/dist/capabilities/Subagent.mjs +1 -1
  78. package/dist/capabilities/SubagentReservations.mjs +3 -1
  79. package/dist/capabilities/SubagentReservations.mjs.map +1 -1
  80. package/dist/capabilities/WebCapture.mjs.map +1 -1
  81. package/dist/capabilities/WebSearch.mjs +7 -7
  82. package/dist/capabilities/WebSearch.mjs.map +1 -1
  83. package/dist/core/Agent.d.mts +1 -1
  84. package/dist/core/Agent.mjs +1 -1
  85. package/dist/core/AgentUpdates.mjs +8 -8
  86. package/dist/core/AgentUpdates.mjs.map +1 -1
  87. package/dist/core/Thread.d.mts +2 -2
  88. package/dist/core/Thread.mjs +6 -4
  89. package/dist/core/Thread.mjs.map +1 -1
  90. package/dist/core/Usage.mjs +2 -2
  91. package/dist/core/Usage.mjs.map +1 -1
  92. package/dist/durable/ActivityStore.mjs +1 -1
  93. package/dist/durable/Admin.d.mts +1 -1
  94. package/dist/durable/Admin.mjs +1 -1
  95. package/dist/durable/AgentRegistration.d.mts +1 -1
  96. package/dist/durable/AgentRegistration.mjs +1 -1
  97. package/dist/durable/Certification.d.mts +1 -1
  98. package/dist/durable/CommittedActivity.d.mts +1 -1
  99. package/dist/durable/CommittedActivity.mjs +3 -3
  100. package/dist/durable/Digest.mjs +1 -1
  101. package/dist/durable/DurableAgentRuntime.d.mts +1 -1
  102. package/dist/durable/DurableAgentRuntime.mjs +2 -2
  103. package/dist/durable/EventSource.d.mts +1 -1
  104. package/dist/durable/EventSource.mjs +7 -7
  105. package/dist/durable/EventSource.mjs.map +1 -1
  106. package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
  107. package/dist/durable/LifecyclePublication.d.mts +1 -1
  108. package/dist/durable/LifecyclePublication.mjs +2 -2
  109. package/dist/durable/MessageDelivery.d.mts +1 -1
  110. package/dist/durable/MessageDelivery.mjs +2 -2
  111. package/dist/durable/MessageDeliveryStoreConformance.d.mts +40 -40
  112. package/dist/durable/MessageDeliveryStoreConformance.mjs +2 -2
  113. package/dist/durable/PersistentHistory.d.mts +2 -2
  114. package/dist/durable/PersistentHistory.mjs +4 -4
  115. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  116. package/dist/durable/RecordFormat.mjs +3 -3
  117. package/dist/durable/RecordFormat.mjs.map +1 -1
  118. package/dist/durable/Records.mjs +1 -1
  119. package/dist/durable/Recovery.d.mts +1 -1
  120. package/dist/durable/Recovery.mjs +1 -1
  121. package/dist/durable/RunContinuation.d.mts +2 -2
  122. package/dist/durable/RunContinuation.mjs +3 -3
  123. package/dist/durable/RunJournal.d.mts +2 -2
  124. package/dist/durable/RunJournal.mjs +2 -2
  125. package/dist/durable/RunStorage.d.mts +1 -1
  126. package/dist/durable/RunStorage.mjs +1 -1
  127. package/dist/durable/Schedule.mjs +1 -1
  128. package/dist/durable/ScheduleStoreConformance.mjs +1 -1
  129. package/dist/durable/ScheduleTransition.mjs +1 -1
  130. package/dist/durable/Scheduling.d.mts +1 -1
  131. package/dist/durable/Scheduling.mjs +1 -1
  132. package/dist/durable/SettlementPublisher.d.mts +1 -1
  133. package/dist/durable/SettlementPublisher.mjs +3 -3
  134. package/dist/durable/SqlMemoryStore.mjs +5 -3
  135. package/dist/durable/SqlMemoryStore.mjs.map +1 -1
  136. package/dist/durable/SubmissionLedger.d.mts +1 -1
  137. package/dist/durable/SubmissionLedger.mjs +11 -3
  138. package/dist/durable/SubmissionLedger.mjs.map +1 -1
  139. package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
  140. package/dist/durable/SubmissionLedgerConformance.mjs +6 -6
  141. package/dist/durable/SubmissionStatus.d.mts +1 -1
  142. package/dist/durable/Subscription.d.mts +1 -1
  143. package/dist/durable/Subscription.mjs +2 -2
  144. package/dist/durable/SubscriptionInput.d.mts +1 -1
  145. package/dist/durable/SubscriptionInput.mjs +4 -4
  146. package/dist/durable/SubscriptionInput.mjs.map +1 -1
  147. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  148. package/dist/durable/SubscriptionStoreConformance.mjs +3 -3
  149. package/dist/durable/SubscriptionStoreConformance.mjs.map +1 -1
  150. package/dist/durable/SubscriptionTools.d.mts +2 -2
  151. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  152. package/dist/durable/SubscriptionTransition.mjs +1 -1
  153. package/dist/durable/Subscriptions.d.mts +5 -5
  154. package/dist/durable/Subscriptions.mjs +3 -3
  155. package/dist/durable/Subscriptions.mjs.map +1 -1
  156. package/dist/durable/ThreadArchiveRange.d.mts +1 -1
  157. package/dist/durable/ThreadArchiveRange.mjs +1 -1
  158. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  159. package/dist/durable/ThreadContextHistory.mjs +2 -2
  160. package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
  161. package/dist/durable/ThreadImport.d.mts +1 -1
  162. package/dist/durable/ThreadImport.mjs +1 -1
  163. package/dist/durable/ThreadInvariants.d.mts +3 -3
  164. package/dist/durable/ThreadInvariants.mjs +5 -5
  165. package/dist/durable/ThreadInvariants.mjs.map +1 -1
  166. package/dist/durable/ThreadProjection.mjs +1 -1
  167. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  168. package/dist/durable/ThreadReader.d.mts +1 -1
  169. package/dist/durable/ThreadReader.mjs +1 -1
  170. package/dist/durable/ThreadStore.d.mts +1 -1
  171. package/dist/durable/ThreadStore.mjs +2 -2
  172. package/dist/durable/ThreadStoreConformance.d.mts +1 -1
  173. package/dist/durable/ThreadStoreConformance.mjs +4 -4
  174. package/dist/durable/ThreadTransfer.d.mts +1 -1
  175. package/dist/durable/ThreadTransfer.mjs +1 -1
  176. package/dist/durable/ThreadWork.d.mts +2 -2
  177. package/dist/durable/ThreadWork.mjs +12 -6
  178. package/dist/durable/ThreadWork.mjs.map +1 -1
  179. package/dist/durable/ToolReconciler.mjs +1 -1
  180. package/dist/durable/WakeScheduler.mjs +23 -39
  181. package/dist/durable/WakeScheduler.mjs.map +1 -1
  182. package/dist/durable/WorkerAdmission.d.mts +1 -1
  183. package/dist/durable/WorkerAdmission.mjs +1 -1
  184. package/dist/durable/WorkerHost.d.mts +2 -2
  185. package/dist/engine/AgentRuntime.d.mts +1 -1
  186. package/dist/engine/AgentRuntime.mjs +1 -1
  187. package/dist/engine/MessagingHost.d.mts +1 -1
  188. package/dist/engine/MessagingHost.mjs +1 -1
  189. package/dist/engine/Output.d.mts +1 -1
  190. package/dist/engine/Output.mjs +1 -1
  191. package/dist/engine/RunOptions.d.mts +1 -1
  192. package/dist/engine/SubagentHost.d.mts +1 -1
  193. package/dist/engine/ThreadHistory.d.mts +1 -1
  194. package/dist/engine/ThreadHistory.mjs +3 -2
  195. package/dist/engine/ThreadHistory.mjs.map +1 -1
  196. package/dist/index.d.mts +21 -21
  197. package/dist/index.mjs +16 -16
  198. package/dist/{output-contract-CMIhu4Cw.mjs → output-contract-DCnLYCdp.mjs} +12 -15
  199. package/dist/{output-contract-CMIhu4Cw.mjs.map → output-contract-DCnLYCdp.mjs.map} +1 -1
  200. package/dist/{run-context-reader-OcsZr4bk.d.mts → run-context-reader-DVhJZ1Qe.d.mts} +2 -2
  201. package/package.json +1 -1
  202. package/src/capabilities/Approval.ts +58 -60
  203. package/src/capabilities/BrowserUse.ts +89 -944
  204. package/src/capabilities/Budget.ts +8 -1
  205. package/src/capabilities/CodeMode.ts +57 -33
  206. package/src/capabilities/McpClient.ts +2 -2
  207. package/src/capabilities/Messaging.ts +51 -55
  208. package/src/capabilities/ModelContext.ts +5 -2
  209. package/src/capabilities/Redaction.ts +64 -34
  210. package/src/capabilities/RunHooks.ts +52 -55
  211. package/src/capabilities/Subagent.ts +33 -33
  212. package/src/capabilities/SubagentReservations.ts +9 -1
  213. package/src/capabilities/WebCapture.ts +6 -0
  214. package/src/capabilities/WebSearch.ts +10 -7
  215. package/src/capabilities/internal/subagent-background.ts +202 -158
  216. package/src/core/Agent.ts +11 -6
  217. package/src/core/AgentUpdates.ts +8 -8
  218. package/src/core/Thread.ts +142 -146
  219. package/src/core/Usage.ts +7 -8
  220. package/src/core/internal/agent-updates.ts +1 -0
  221. package/src/durable/DurableAgentRuntime.ts +1024 -829
  222. package/src/durable/EventSource.ts +15 -9
  223. package/src/durable/RecordFormat.ts +5 -3
  224. package/src/durable/RunContinuation.ts +316 -113
  225. package/src/durable/RunJournal.ts +106 -114
  226. package/src/durable/RunStorage.ts +129 -124
  227. package/src/durable/Scheduling.ts +639 -651
  228. package/src/durable/SqlMemoryStore.ts +8 -6
  229. package/src/durable/SubmissionLedger.ts +11 -0
  230. package/src/durable/SubscriptionInput.ts +5 -3
  231. package/src/durable/SubscriptionStoreConformance.ts +23 -23
  232. package/src/durable/Subscriptions.ts +18 -19
  233. package/src/durable/ThreadImport.ts +18 -19
  234. package/src/durable/ThreadInvariants.ts +2 -1
  235. package/src/durable/ThreadStore.ts +217 -111
  236. package/src/durable/ThreadWork.ts +11 -2
  237. package/src/durable/WakeScheduler.ts +34 -66
  238. package/src/durable/internal/StorageOwner.ts +10 -4
  239. package/src/durable/internal/agent-registration.ts +96 -89
  240. package/src/durable/internal/canonical-json.ts +61 -20
  241. package/src/durable/internal/prompt-history-cache.ts +13 -4
  242. package/src/durable/internal/record-encoding.ts +120 -64
  243. package/src/durable/internal/schedule-time.ts +6 -6
  244. package/src/durable/internal/usage-totals.ts +35 -0
  245. package/src/durable/internal/worker-host.ts +69 -74
  246. package/src/engine/MessagingHost.ts +4 -2
  247. package/src/engine/ThreadHistory.ts +47 -48
  248. package/src/engine/internal/agent-runtime.ts +1298 -1217
  249. package/src/engine/internal/output-contract.ts +15 -15
  250. package/src/engine/internal/primitive-delta.ts +2 -3
  251. package/src/engine/internal/provisional-text.ts +12 -10
  252. package/src/engine/internal/tool-exposure.ts +22 -18
  253. package/src/engine/internal/tool-telemetry.ts +15 -12
  254. package/dist/Agent-0WvBWWbM.mjs.map +0 -1
  255. package/dist/AgentRuntime-CQ-qcETl.mjs.map +0 -1
  256. package/dist/Digest-DCuPlhNk.mjs.map +0 -1
  257. package/dist/DurableAgentRuntime-BAmSkWYr.mjs.map +0 -1
  258. package/dist/MessagingHost-CRUK4JBi.mjs.map +0 -1
  259. package/dist/RunContinuation-DHYNAQFi.mjs.map +0 -1
  260. package/dist/RunJournal-kfKVxJj7.mjs.map +0 -1
  261. package/dist/RunStorage-uqPxps09.mjs.map +0 -1
  262. package/dist/Scheduling-CVyfXlBR.mjs.map +0 -1
  263. package/dist/Subagent-vpffemql.mjs.map +0 -1
  264. package/dist/ThreadImport-DckUMEqJ.mjs.map +0 -1
  265. package/dist/ThreadStore-CEekRa80.mjs.map +0 -1
  266. package/dist/agent-registration-ByMZ_cK5.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Brand, type Crypto, Effect, Predicate, Schema, Stream, type DateTime } from "effect";
1
+ import { Brand, Effect, Predicate, Schema, Stream, type DateTime } from "effect";
2
2
  import { Prompt } from "effect/ai";
3
3
 
4
4
  import {
@@ -13,7 +13,7 @@ import { type ExhaustedLimit } from "../core/RunEvent.ts";
13
13
  import { RunPolicyUsage } from "../core/RunPolicyUsage.ts";
14
14
  import { type Selection, type Snapshot } from "../core/ToolExposure.ts";
15
15
  import type { ToolParameterRejection } from "../core/ToolResult.ts";
16
- import { ModelCallUsage, summarizeModelUsage, type RunUsageSummary } from "../core/Usage.ts";
16
+ import { type ModelCallUsage, summarizeModelUsage, type RunUsageSummary } from "../core/Usage.ts";
17
17
  import type { WorkerRef } from "../core/Worker.ts";
18
18
  import {
19
19
  CLEARED_TOOL_RESULT,
@@ -22,13 +22,14 @@ import {
22
22
  contextWindowMessage,
23
23
  } from "../engine/Compaction.ts";
24
24
  import type { RunTurnToolResult } from "../engine/RunOptions.ts";
25
- import { digestJson, type DigestError } from "./Digest.ts";
25
+ import { digestJson } from "./Digest.ts";
26
26
  import {
27
27
  makeJournalMetadata,
28
28
  toolCallSettledRecordId,
29
29
  type JournalMetadata,
30
30
  type JournalRecordEnvelope,
31
31
  } from "./internal/journal-metadata.ts";
32
+ import { continuationUsage } from "./internal/usage-totals.ts";
32
33
  import {
33
34
  type BatchId,
34
35
  type RecordId,
@@ -435,6 +436,36 @@ export interface RunJournalProjection {
435
436
  readonly pendingContextToolCallId?: string | undefined;
436
437
  }
437
438
 
439
+ const initialPolicyUsage = () => ({
440
+ committedTurns: 0,
441
+ toolCalls: 0,
442
+ programmaticToolCalls: 0,
443
+ consecutiveToolFailures: 0,
444
+ finalizationUsed: false,
445
+ modelRestarts: 0,
446
+ });
447
+
448
+ const initialUsage = (modelUsage: Array<ModelCallUsage>) => ({
449
+ modelCalls: 0,
450
+ inputTokens: 0,
451
+ outputTokens: 0,
452
+ lastInputTokens: 0,
453
+ lastOutputTokens: 0,
454
+ costMicrousd: 0,
455
+ modelUsage,
456
+ });
457
+
458
+ /** Internal first-Run projection after exact input/checkpoint-absence verification. The
459
+ * new UserInputRecorded contributes no model message; the engine evaluates it later. */
460
+ export const initialRunJournal = (history: Prompt.Prompt): RunJournalProjection => ({
461
+ policyUsage: RunPolicyUsage.make(initialPolicyUsage()),
462
+ usage: initialUsage([]),
463
+ prompt: history,
464
+ historyBefore: history,
465
+ historyFrom: CanonicalSequence.make(1),
466
+ committedTurns: 0,
467
+ });
468
+
438
469
  interface ProjectedResponseUsage {
439
470
  readonly modelCalls: number;
440
471
  readonly inputTokens: number;
@@ -1049,15 +1080,7 @@ export const projectRunJournalStream = Effect.fnUntraced(function* <
1049
1080
  const modelUsage: Array<ModelCallUsage> = [];
1050
1081
  let unobservedModelCalls = 0;
1051
1082
 
1052
- const usage = {
1053
- modelCalls: 0,
1054
- inputTokens: 0,
1055
- outputTokens: 0,
1056
- lastInputTokens: 0,
1057
- lastOutputTokens: 0,
1058
- costMicrousd: 0,
1059
- modelUsage,
1060
- };
1083
+ const usage = initialUsage(modelUsage);
1061
1084
 
1062
1085
  let toolSelection: Selection | undefined;
1063
1086
  let usageTurn = 0;
@@ -1079,14 +1102,7 @@ export const projectRunJournalStream = Effect.fnUntraced(function* <
1079
1102
  let pendingContextToolCallId: string | undefined;
1080
1103
  let ownerTerminated = false;
1081
1104
 
1082
- const policyUsage = {
1083
- committedTurns: 0,
1084
- toolCalls: 0,
1085
- programmaticToolCalls: 0,
1086
- consecutiveToolFailures: 0,
1087
- finalizationUsed: false,
1088
- modelRestarts: 0,
1089
- };
1105
+ const policyUsage = initialPolicyUsage();
1090
1106
 
1091
1107
  const accountResponse = Effect.fnUntraced(function* (
1092
1108
  envelope: JournalRecordEnvelope,
@@ -1638,18 +1654,6 @@ export const promptFromCanonicalRecords = (
1638
1654
  );
1639
1655
 
1640
1656
  /** Everything one committed Turn contributes to its canonical batch. */
1641
- /**
1642
- * Staged usage is validated, never repaired: clamping negatives or truncating
1643
- * fractions would under-record canonical usage, and NaN/Infinity must fail
1644
- * typed instead of escaping as a record-construction defect (RUN-023).
1645
- */
1646
- const validStagedUsage = (label: string, value: number): Effect.Effect<number, RunJournalError> =>
1647
- Number.isSafeInteger(value) && value >= 0
1648
- ? Effect.succeed(value)
1649
- : Effect.fail(
1650
- journalError(`Staged ${label} must be a non-negative safe integer, got ${String(value)}`),
1651
- );
1652
-
1653
1657
  export interface TurnCommitInput {
1654
1658
  readonly toolResultMaxBytes?: number | undefined;
1655
1659
  readonly toolSelectionMaxBytes?: number | undefined;
@@ -1694,8 +1698,9 @@ export interface TurnCommitInput {
1694
1698
  }
1695
1699
 
1696
1700
  const decodePersistedJson = Schema.decodeUnknownEffect(PersistedJson);
1701
+ const decodeModelResponse = Schema.decodeUnknownEffect(ModelResponseRecorded);
1702
+ const decodeToolSettled = Schema.decodeUnknownEffect(ToolCallSettled);
1697
1703
  const encodePrompt = Schema.encodeEffect(Prompt.Prompt);
1698
- const decodeModelUsage = Schema.decodeUnknownEffect(Schema.Array(ModelCallUsage));
1699
1704
 
1700
1705
  const requireCanonicalTurn = (turn: number): Effect.Effect<void, RunJournalError> =>
1701
1706
  !Number.isInteger(turn) || turn <= 0
@@ -1704,7 +1709,7 @@ const requireCanonicalTurn = (turn: number): Effect.Effect<void, RunJournalError
1704
1709
 
1705
1710
  const modelResponseRecord = Effect.fnUntraced(function* (
1706
1711
  input: TurnCommitInput,
1707
- ): Effect.fn.Return<RecordEnvelope, RunJournalError | DigestError, Crypto.Crypto> {
1712
+ ): Effect.fn.Return<RecordEnvelope, RunJournalError> {
1708
1713
  const promptMessages = input.responseMessages;
1709
1714
 
1710
1715
  if (promptMessages.length === 0) {
@@ -1741,30 +1746,60 @@ const modelResponseRecord = Effect.fnUntraced(function* (
1741
1746
  ),
1742
1747
  );
1743
1748
 
1744
- const modelUsage =
1745
- input.usage?.modelUsage === undefined
1746
- ? undefined
1747
- : yield* decodeModelUsage(input.usage.modelUsage).pipe(
1748
- Effect.mapError((cause) => journalError("Turn model usage failed to decode", cause)),
1749
- );
1749
+ // Validate the detached messages and usage together; no mutable caller data is trusted.
1750
+ const modelUsage = input.usage?.modelUsage;
1750
1751
 
1751
- if (modelUsage !== undefined) {
1752
- if (modelUsage.length === 0) {
1752
+ const payload = yield* decodeModelResponse({
1753
+ _tag: "ModelResponseRecorded",
1754
+ toolResultMaxBytes: input.toolResultMaxBytes ?? MAX_PERSISTED_JSON_BYTES,
1755
+ toolSelectionMaxBytes: input.toolSelectionMaxBytes ?? 0,
1756
+ toolOperations: input.toolOperations ?? [],
1757
+ ...(input.toolParameterRejections === undefined || input.toolParameterRejections.length === 0
1758
+ ? {}
1759
+ : { toolParameterRejections: input.toolParameterRejections }),
1760
+ ...(input.toolExposure === undefined ? {} : { toolExposure: input.toolExposure }),
1761
+ runId: input.runId,
1762
+ turnId: input.turnId,
1763
+ turn: input.turn,
1764
+ messages,
1765
+ ...(runScopedPrefixLength === undefined ? {} : { runScopedPrefixLength }),
1766
+ ...(modelUsage === undefined ? {} : { modelUsage }),
1767
+ ...(input.unobservedModelCalls === undefined || input.unobservedModelCalls === 0
1768
+ ? {}
1769
+ : {
1770
+ unobservedModelCalls: input.unobservedModelCalls,
1771
+ }),
1772
+ ...(input.usage === undefined
1773
+ ? {}
1774
+ : {
1775
+ inputTokens: input.usage.inputTokens,
1776
+ outputTokens: input.usage.outputTokens,
1777
+ // Written only when non-zero: absent re-seeds as zero, so the
1778
+ // no-estimator case stays byte-identical to pre-cost histories.
1779
+ ...(input.usage.costMicrousd === undefined || input.usage.costMicrousd === 0
1780
+ ? {}
1781
+ : {
1782
+ costMicrousd: input.usage.costMicrousd,
1783
+ }),
1784
+ }),
1785
+ }).pipe(
1786
+ Effect.mapError((cause) => journalError("Invalid model response operation evidence", cause)),
1787
+ );
1788
+
1789
+ if (payload.modelUsage !== undefined) {
1790
+ if (payload.modelUsage.length === 0)
1753
1791
  return yield* journalError("Turn model usage must contain at least one completed call");
1754
- }
1755
1792
 
1756
- const summary = yield* summarizeModelUsage(modelUsage).pipe(
1793
+ const summary = yield* continuationUsage(payload.modelUsage).pipe(
1757
1794
  Effect.mapError((cause) => journalError("Turn model usage exceeds accounting bounds", cause)),
1758
1795
  );
1759
1796
 
1760
1797
  if (
1761
- input.usage === undefined ||
1762
- input.usage.inputTokens !== summary.inputTokens.total ||
1763
- input.usage.outputTokens !== summary.outputTokens.total ||
1764
- (input.usage.costMicrousd ?? 0) !== summary.costMicrousd
1765
- ) {
1798
+ payload.inputTokens !== summary.inputTokens ||
1799
+ payload.outputTokens !== summary.outputTokens ||
1800
+ (payload.costMicrousd ?? 0) !== summary.costMicrousd
1801
+ )
1766
1802
  return yield* journalError("Turn detailed and aggregate model usage disagree");
1767
- }
1768
1803
  }
1769
1804
 
1770
1805
  return RecordEnvelope.make({
@@ -1773,44 +1808,7 @@ const modelResponseRecord = Effect.fnUntraced(function* (
1773
1808
  schemaVersion: 1,
1774
1809
  createdAt: input.createdAt,
1775
1810
  deploymentId: input.deploymentId,
1776
- payload: yield* ModelResponseRecorded.makeEffect({
1777
- toolResultMaxBytes: input.toolResultMaxBytes ?? MAX_PERSISTED_JSON_BYTES,
1778
- toolSelectionMaxBytes: input.toolSelectionMaxBytes ?? 0,
1779
- toolOperations: input.toolOperations ?? [],
1780
- ...(input.toolParameterRejections === undefined || input.toolParameterRejections.length === 0
1781
- ? {}
1782
- : { toolParameterRejections: input.toolParameterRejections }),
1783
- ...(input.toolExposure === undefined ? {} : { toolExposure: input.toolExposure }),
1784
- runId: input.runId,
1785
- turnId: input.turnId,
1786
- turn: input.turn,
1787
- messages,
1788
- ...(runScopedPrefixLength === undefined ? {} : { runScopedPrefixLength }),
1789
- ...(modelUsage === undefined ? {} : { modelUsage }),
1790
- ...(input.unobservedModelCalls === undefined || input.unobservedModelCalls === 0
1791
- ? {}
1792
- : {
1793
- unobservedModelCalls: yield* validStagedUsage(
1794
- "unobservedModelCalls",
1795
- input.unobservedModelCalls,
1796
- ),
1797
- }),
1798
- ...(input.usage === undefined
1799
- ? {}
1800
- : {
1801
- inputTokens: yield* validStagedUsage("inputTokens", input.usage.inputTokens),
1802
- outputTokens: yield* validStagedUsage("outputTokens", input.usage.outputTokens),
1803
- // Written only when non-zero: absent re-seeds as zero, so the
1804
- // no-estimator case stays byte-identical to pre-cost histories.
1805
- ...(input.usage.costMicrousd === undefined || input.usage.costMicrousd === 0
1806
- ? {}
1807
- : {
1808
- costMicrousd: yield* validStagedUsage("costMicrousd", input.usage.costMicrousd),
1809
- }),
1810
- }),
1811
- }).pipe(
1812
- Effect.mapError((cause) => journalError("Invalid model response operation evidence", cause)),
1813
- ),
1811
+ payload,
1814
1812
  });
1815
1813
  });
1816
1814
 
@@ -1820,33 +1818,27 @@ const toolSettledRecords = Effect.fnUntraced(function* (
1820
1818
  const toolRecords: Array<RecordEnvelope> = [];
1821
1819
 
1822
1820
  for (const part of input.toolResults) {
1823
- const result = yield* decodePersistedJson(part.result).pipe(
1824
- Effect.mapError((cause) =>
1825
- journalError(`Tool result ${part.toolCallId} exceeds canonical persistence bounds`, cause),
1826
- ),
1821
+ const payload = yield* decodeToolSettled({
1822
+ _tag: "ToolCallSettled",
1823
+ ...(part.toolSelection === undefined ? {} : { toolSelection: part.toolSelection }),
1824
+ runId: input.runId,
1825
+ toolCallId: part.toolCallId,
1826
+ toolName: part.toolName,
1827
+ result: part.result,
1828
+ isFailure: part.isFailure,
1829
+ ...(part.budgetRejected === true ? { budgetRejected: true } : {}),
1830
+ }).pipe(
1831
+ Effect.mapError((cause) => journalError(`Invalid Tool result ${part.toolCallId}`, cause)),
1827
1832
  );
1828
1833
 
1829
- const toolCallId = yield* Effect.try({
1830
- try: () => decodeToolCallId(part.toolCallId),
1831
- catch: (cause) => journalError(`Invalid Tool Call ID ${part.toolCallId}`, cause),
1832
- });
1833
-
1834
1834
  toolRecords.push(
1835
1835
  RecordEnvelope.make({
1836
- recordId: toolCallSettledRecordId(input.runId, input.turn, toolCallId),
1836
+ recordId: toolCallSettledRecordId(input.runId, input.turn, payload.toolCallId),
1837
1837
  family: "thread",
1838
1838
  schemaVersion: 1,
1839
1839
  createdAt: input.createdAt,
1840
1840
  deploymentId: input.deploymentId,
1841
- payload: ToolCallSettled.make({
1842
- ...(part.toolSelection === undefined ? {} : { toolSelection: part.toolSelection }),
1843
- runId: input.runId,
1844
- toolCallId,
1845
- toolName: part.toolName,
1846
- result,
1847
- isFailure: part.isFailure,
1848
- ...(part.budgetRejected === true ? { budgetRejected: true } : {}),
1849
- }),
1841
+ payload,
1850
1842
  }),
1851
1843
  );
1852
1844
  }
@@ -1854,7 +1846,7 @@ const toolSettledRecords = Effect.fnUntraced(function* (
1854
1846
  return toolRecords;
1855
1847
  });
1856
1848
 
1857
- const runCompletionRecord = Effect.fnUntraced(function* (input: TurnCommitInput) {
1849
+ const runCompletionRecord = (input: TurnCommitInput) => {
1858
1850
  if (input.runCompletion === undefined) return undefined;
1859
1851
  const completion = { runId: input.runId, ...input.runCompletion };
1860
1852
 
@@ -1868,7 +1860,7 @@ const runCompletionRecord = Effect.fnUntraced(function* (input: TurnCommitInput)
1868
1860
  ...completion,
1869
1861
  }),
1870
1862
  });
1871
- });
1863
+ };
1872
1864
 
1873
1865
  /**
1874
1866
  * Build a canonical batch from interpreter-validated Turn facts: one
@@ -1882,11 +1874,11 @@ const runCompletionRecord = Effect.fnUntraced(function* (input: TurnCommitInput)
1882
1874
  */
1883
1875
  export const turnCanonicalBatch = Effect.fnUntraced(function* (
1884
1876
  input: TurnCommitInput,
1885
- ): Effect.fn.Return<CanonicalBatch, RunJournalError | DigestError, Crypto.Crypto> {
1877
+ ): Effect.fn.Return<CanonicalBatch, RunJournalError> {
1886
1878
  yield* requireCanonicalTurn(input.turn);
1887
1879
  const modelResponse = yield* modelResponseRecord(input);
1888
1880
  const toolRecords = yield* toolSettledRecords(input);
1889
- const completionRecord = yield* runCompletionRecord(input);
1881
+ const completionRecord = runCompletionRecord(input);
1890
1882
 
1891
1883
  return CanonicalBatch.make({
1892
1884
  batchId: turnBatchId(input.runId, input.turn),
@@ -1907,7 +1899,7 @@ export const turnCanonicalBatch = Effect.fnUntraced(function* (
1907
1899
  */
1908
1900
  export const turnResponseBatch = Effect.fnUntraced(function* (
1909
1901
  input: TurnCommitInput,
1910
- ): Effect.fn.Return<CanonicalBatch, RunJournalError | DigestError, Crypto.Crypto> {
1902
+ ): Effect.fn.Return<CanonicalBatch, RunJournalError> {
1911
1903
  yield* requireCanonicalTurn(input.turn);
1912
1904
  const modelResponse = yield* modelResponseRecord(input);
1913
1905
 
@@ -1926,11 +1918,11 @@ export const turnResponseBatch = Effect.fnUntraced(function* (
1926
1918
  */
1927
1919
  export const turnResultsBatch = Effect.fnUntraced(function* (
1928
1920
  input: TurnCommitInput,
1929
- ): Effect.fn.Return<CanonicalBatch, RunJournalError | DigestError, Crypto.Crypto> {
1921
+ ): Effect.fn.Return<CanonicalBatch, RunJournalError> {
1930
1922
  yield* requireCanonicalTurn(input.turn);
1931
1923
  const toolRecords = yield* toolSettledRecords(input);
1932
1924
  const first = toolRecords[0];
1933
- const completionRecord = yield* runCompletionRecord(input);
1925
+ const completionRecord = runCompletionRecord(input);
1934
1926
 
1935
1927
  if (first === undefined) {
1936
1928
  if (completionRecord === undefined) {
@@ -113,6 +113,11 @@ export interface RunWriter {
113
113
 
114
114
  export interface RunStorageSession extends RunWriter, RunOwnership {
115
115
  readonly claim: Claim;
116
+ /** Library-only initialization, before application/model IO. Hold progress before mutation
117
+ * so the captured controls and this owner's acknowledged input remain one read view. */
118
+ readonly withInitialization?: <A, E, R>(
119
+ effect: Effect.Effect<A, E, R>,
120
+ ) => Effect.Effect<A, E | OwnershipLost, R>;
116
121
  readonly refresh: Effect.Effect<void, ThreadStoreFailure>;
117
122
  readonly publishSettlement: (
118
123
  batch: CanonicalBatch,
@@ -171,71 +176,70 @@ const makeWriter = Effect.fnUntraced(function* (threadId: ThreadId) {
171
176
  }),
172
177
  );
173
178
 
174
- const append: RunWriter["append"] = (batch, executions) =>
175
- Effect.gen(function* () {
176
- const captured = yield* PreparedAppend.capture(
177
- AppendRequest.make({
178
- threadId,
179
- expectedTailSequence: tail.sequence,
180
- batch,
181
- ...(executions === undefined ? {} : { executions }),
182
- }),
183
- ).pipe(
184
- Effect.mapError((cause) =>
185
- ThreadStoreError.make({
186
- operation: "capture append",
187
- message: cause.message,
188
- cause,
189
- }),
190
- ),
191
- );
192
-
193
- return yield* owner.withProgress(
179
+ const append: RunWriter["append"] = Effect.fnUntraced(function* (batch, executions) {
180
+ const captured = yield* PreparedAppend.capture(
181
+ AppendRequest.make({
194
182
  threadId,
195
- owner.withMutation(
196
- Effect.gen(function* () {
197
- yield* checkActive;
198
- for (let retries = 0; ; retries++) {
199
- const result = yield* store
200
- .append(
201
- captured.expectedTailSequence === tail.sequence
202
- ? captured
203
- : AppendRequest.make({
204
- ...captured,
205
- expectedTailSequence: tail.sequence,
206
- }),
207
- )
208
- .pipe(
209
- Effect.catchTag("AppendConflict", (conflict) => {
210
- if (
211
- conflict.reason !== "tail" ||
212
- conflict.actualTailSequence === undefined ||
213
- retries >= 8
214
- )
215
- return Effect.fail(conflict);
216
- tail = { sequence: conflict.actualTailSequence };
217
- if (captured.executions !== undefined) return Effect.fail(conflict);
218
-
219
- return Effect.succeed(undefined);
220
- }),
221
- );
183
+ expectedTailSequence: tail.sequence,
184
+ batch,
185
+ ...(executions === undefined ? {} : { executions }),
186
+ }),
187
+ ).pipe(
188
+ Effect.mapError((cause) =>
189
+ ThreadStoreError.make({
190
+ operation: "capture append",
191
+ message: cause.message,
192
+ cause,
193
+ }),
194
+ ),
195
+ );
222
196
 
223
- if (result === undefined) continue;
224
- // A historical replay returns its original coordinates, not today's canonical tail.
225
- if (result.replayed) yield* refresh;
226
- else tail = { sequence: result.lastSequence };
227
-
228
- return result;
229
- }
230
- }).pipe(
231
- // Revoke uncertain writes before releasing the writer's mutation gate.
232
- Effect.onError((cause) =>
233
- isDefiniteWriteFailure(cause) ? Effect.void : ownership.release,
234
- ),
197
+ return yield* owner.withProgress(
198
+ threadId,
199
+ owner.withMutation(
200
+ Effect.gen(function* () {
201
+ yield* checkActive;
202
+ for (let retries = 0; ; retries++) {
203
+ const result = yield* store
204
+ .append(
205
+ captured.expectedTailSequence === tail.sequence
206
+ ? captured
207
+ : AppendRequest.make({
208
+ ...captured,
209
+ expectedTailSequence: tail.sequence,
210
+ }),
211
+ )
212
+ .pipe(
213
+ Effect.catchTag("AppendConflict", (conflict) => {
214
+ if (
215
+ conflict.reason !== "tail" ||
216
+ conflict.actualTailSequence === undefined ||
217
+ retries >= 8
218
+ )
219
+ return Effect.fail(conflict);
220
+ tail = { sequence: conflict.actualTailSequence };
221
+ if (captured.executions !== undefined) return Effect.fail(conflict);
222
+
223
+ return Effect.succeed(undefined);
224
+ }),
225
+ );
226
+
227
+ if (result === undefined) continue;
228
+ // A historical replay returns its original coordinates, not today's canonical tail.
229
+ if (result.replayed) yield* refresh;
230
+ else tail = { sequence: result.lastSequence };
231
+
232
+ return result;
233
+ }
234
+ }).pipe(
235
+ // Revoke uncertain writes before releasing the writer's mutation gate.
236
+ Effect.onError((cause) =>
237
+ isDefiniteWriteFailure(cause) ? Effect.void : ownership.release,
235
238
  ),
236
239
  ),
237
- );
238
- });
240
+ ),
241
+ );
242
+ });
239
243
 
240
244
  const writer = {
241
245
  threadId,
@@ -317,6 +321,8 @@ export const make = Effect.gen(function* () {
317
321
  const session: RunStorageSession = {
318
322
  ...writer,
319
323
  claim: claimed,
324
+ withInitialization: (effect) =>
325
+ owner.withProgress(request.threadId, generation.use(effect)),
320
326
  release: generation.release,
321
327
  refresh: writer.refresh,
322
328
  markInputApplied: (marker) =>
@@ -371,73 +377,72 @@ export const make = Effect.gen(function* () {
371
377
  ),
372
378
  ),
373
379
  ),
374
- publishSettlement: (batch, executions) =>
375
- Effect.gen(function* () {
376
- const captured = yield* PreparedAppend.capture(
377
- AppendRequest.make({
378
- threadId: request.threadId,
379
- expectedTailSequence: (yield* writer.tail).sequence,
380
- batch,
381
- ...(executions === undefined ? {} : { executions }),
380
+ publishSettlement: Effect.fnUntraced(function* (batch, executions) {
381
+ const captured = yield* PreparedAppend.capture(
382
+ AppendRequest.make({
383
+ threadId: request.threadId,
384
+ expectedTailSequence: (yield* writer.tail).sequence,
385
+ batch,
386
+ ...(executions === undefined ? {} : { executions }),
387
+ }),
388
+ ).pipe(
389
+ Effect.mapError((cause) =>
390
+ LedgerError.make({
391
+ operation: "capture settlement",
392
+ message: cause.message,
393
+ cause,
382
394
  }),
383
- ).pipe(
384
- Effect.mapError((cause) =>
385
- LedgerError.make({
386
- operation: "capture settlement",
387
- message: cause.message,
388
- cause,
389
- }),
390
- ),
391
- );
392
-
393
- return yield* owner.withProgress(
394
- request.threadId,
395
- owned(
396
- Effect.gen(function* () {
397
- for (let retries = 0; ; retries++) {
398
- const result = yield* publisher
399
- .publish(
400
- SettlementPublication.make({
401
- submissionId: claimed.submissionId,
402
- authority: { _tag: "Owned" },
403
- append: AppendRequest.make({
404
- ...captured,
405
- expectedTailSequence: (yield* writer.tail).sequence,
406
- }),
407
- }),
408
- )
409
- .pipe(
410
- Effect.catchTag("AppendConflict", (conflict) => {
411
- if (
412
- conflict.reason !== "tail" ||
413
- conflict.actualTailSequence === undefined ||
414
- retries >= 8
415
- )
416
- return Effect.fail(conflict);
417
-
418
- return writer.refresh.pipe(
419
- Effect.andThen(
420
- captured.executions === undefined
421
- ? Effect.succeed(undefined)
422
- : Effect.fail(conflict),
423
- ),
424
- );
425
- }),
426
- );
427
-
428
- if (result === undefined) continue;
429
- adoptTail(result.tailSequence);
395
+ ),
396
+ );
430
397
 
431
- return result;
432
- }
433
- }).pipe(
434
- Effect.onError((cause) =>
435
- isDefiniteWriteFailure(cause) ? Effect.void : generation.release,
436
- ),
398
+ return yield* owner.withProgress(
399
+ request.threadId,
400
+ owned(
401
+ Effect.gen(function* () {
402
+ for (let retries = 0; ; retries++) {
403
+ const result = yield* publisher
404
+ .publish(
405
+ SettlementPublication.make({
406
+ submissionId: claimed.submissionId,
407
+ authority: { _tag: "Owned" },
408
+ append: AppendRequest.make({
409
+ ...captured,
410
+ expectedTailSequence: (yield* writer.tail).sequence,
411
+ }),
412
+ }),
413
+ )
414
+ .pipe(
415
+ Effect.catchTag("AppendConflict", (conflict) => {
416
+ if (
417
+ conflict.reason !== "tail" ||
418
+ conflict.actualTailSequence === undefined ||
419
+ retries >= 8
420
+ )
421
+ return Effect.fail(conflict);
422
+
423
+ return writer.refresh.pipe(
424
+ Effect.andThen(
425
+ captured.executions === undefined
426
+ ? Effect.succeed(undefined)
427
+ : Effect.fail(conflict),
428
+ ),
429
+ );
430
+ }),
431
+ );
432
+
433
+ if (result === undefined) continue;
434
+ adoptTail(result.tailSequence);
435
+
436
+ return result;
437
+ }
438
+ }).pipe(
439
+ Effect.onError((cause) =>
440
+ isDefiniteWriteFailure(cause) ? Effect.void : generation.release,
437
441
  ),
438
442
  ),
439
- );
440
- }),
443
+ ),
444
+ );
445
+ }),
441
446
  reserveChildBudget: (value) =>
442
447
  owned(
443
448
  ledger.reserveChildBudget(