@plurnk/plurnk-service 1.26.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/.env.defaults +16 -25
  2. package/SPEC.md +338 -263
  3. package/dist/build-info.json +1 -1
  4. package/dist/content/body-preview.d.ts +1 -0
  5. package/dist/content/body-preview.d.ts.map +1 -1
  6. package/dist/content/body-preview.js +7 -0
  7. package/dist/content/body-preview.js.map +1 -1
  8. package/dist/content/byte-view.d.ts +19 -2
  9. package/dist/content/byte-view.d.ts.map +1 -1
  10. package/dist/content/byte-view.js +67 -14
  11. package/dist/content/byte-view.js.map +1 -1
  12. package/dist/content/edit-receipt.js +1 -1
  13. package/dist/content/edit-receipt.js.map +1 -1
  14. package/dist/content/line-marker.d.ts +1 -0
  15. package/dist/content/line-marker.d.ts.map +1 -1
  16. package/dist/content/line-marker.js +6 -1
  17. package/dist/content/line-marker.js.map +1 -1
  18. package/dist/content/line-selection.d.ts +3 -1
  19. package/dist/content/line-selection.d.ts.map +1 -1
  20. package/dist/content/line-selection.js +27 -3
  21. package/dist/content/line-selection.js.map +1 -1
  22. package/dist/content/matcher.d.ts +9 -14
  23. package/dist/content/matcher.d.ts.map +1 -1
  24. package/dist/content/matcher.js +51 -45
  25. package/dist/content/matcher.js.map +1 -1
  26. package/dist/content/pattern-edits.d.ts +7 -26
  27. package/dist/content/pattern-edits.d.ts.map +1 -1
  28. package/dist/content/pattern-edits.js +54 -91
  29. package/dist/content/pattern-edits.js.map +1 -1
  30. package/dist/content/read-projector.d.ts +2 -1
  31. package/dist/content/read-projector.d.ts.map +1 -1
  32. package/dist/content/read-projector.js +42 -10
  33. package/dist/content/read-projector.js.map +1 -1
  34. package/dist/content/read-resolve.d.ts.map +1 -1
  35. package/dist/content/read-resolve.js +7 -4
  36. package/dist/content/read-resolve.js.map +1 -1
  37. package/dist/core/AdmittedTurnExecutor.d.ts +3 -1
  38. package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -1
  39. package/dist/core/AdmittedTurnExecutor.js +22 -7
  40. package/dist/core/AdmittedTurnExecutor.js.map +1 -1
  41. package/dist/core/BudgetReadout.d.ts +4 -4
  42. package/dist/core/BudgetReadout.d.ts.map +1 -1
  43. package/dist/core/BudgetReadout.js +26 -41
  44. package/dist/core/BudgetReadout.js.map +1 -1
  45. package/dist/core/ChannelWrite.d.ts +2 -3
  46. package/dist/core/ChannelWrite.d.ts.map +1 -1
  47. package/dist/core/ChannelWrite.js +21 -22
  48. package/dist/core/ChannelWrite.js.map +1 -1
  49. package/dist/core/ChannelWrite.sql +26 -0
  50. package/dist/core/ContextFit.d.ts +26 -0
  51. package/dist/core/ContextFit.d.ts.map +1 -0
  52. package/dist/core/ContextFit.js +56 -0
  53. package/dist/core/ContextFit.js.map +1 -0
  54. package/dist/core/DataStatementRunner.d.ts.map +1 -1
  55. package/dist/core/DataStatementRunner.js +1 -0
  56. package/dist/core/DataStatementRunner.js.map +1 -1
  57. package/dist/core/Dispatcher.d.ts +15 -2
  58. package/dist/core/Dispatcher.d.ts.map +1 -1
  59. package/dist/core/Dispatcher.js +148 -16
  60. package/dist/core/Dispatcher.js.map +1 -1
  61. package/dist/core/EditMutations.d.ts +5 -5
  62. package/dist/core/EditMutations.d.ts.map +1 -1
  63. package/dist/core/EditMutations.js +44 -50
  64. package/dist/core/EditMutations.js.map +1 -1
  65. package/dist/core/EditSequence.js +2 -2
  66. package/dist/core/EditSequence.js.map +1 -1
  67. package/dist/core/EmissionHead.d.ts +8 -0
  68. package/dist/core/EmissionHead.d.ts.map +1 -0
  69. package/dist/core/EmissionHead.js +29 -0
  70. package/dist/core/EmissionHead.js.map +1 -0
  71. package/dist/core/Engine.d.ts +1 -0
  72. package/dist/core/Engine.d.ts.map +1 -1
  73. package/dist/core/Engine.js +3 -0
  74. package/dist/core/Engine.js.map +1 -1
  75. package/dist/core/InferenceCall.js +2 -2
  76. package/dist/core/InferenceCall.js.map +1 -1
  77. package/dist/core/InferenceCall.sql +1 -0
  78. package/dist/core/LiveSubscription.d.ts +20 -0
  79. package/dist/core/LiveSubscription.d.ts.map +1 -0
  80. package/dist/core/LiveSubscription.js +68 -0
  81. package/dist/core/LiveSubscription.js.map +1 -0
  82. package/dist/core/LiveSubscriptions.d.ts +1 -0
  83. package/dist/core/LiveSubscriptions.d.ts.map +1 -1
  84. package/dist/core/LiveSubscriptions.js +8 -0
  85. package/dist/core/LiveSubscriptions.js.map +1 -1
  86. package/dist/core/LogBody.js +1 -1
  87. package/dist/core/LogBody.js.map +1 -1
  88. package/dist/core/LogEntryProjection.d.ts +1 -0
  89. package/dist/core/LogEntryProjection.d.ts.map +1 -1
  90. package/dist/core/LogEntryProjection.js +9 -0
  91. package/dist/core/LogEntryProjection.js.map +1 -1
  92. package/dist/core/LogWriter.d.ts +42 -0
  93. package/dist/core/LogWriter.d.ts.map +1 -1
  94. package/dist/core/LogWriter.js +11 -5
  95. package/dist/core/LogWriter.js.map +1 -1
  96. package/dist/core/LoopDriver.js +2 -1
  97. package/dist/core/LoopDriver.js.map +1 -1
  98. package/dist/core/LoopLifecycle.d.ts +2 -2
  99. package/dist/core/LoopLifecycle.d.ts.map +1 -1
  100. package/dist/core/LoopLifecycle.js +2 -4
  101. package/dist/core/LoopLifecycle.js.map +1 -1
  102. package/dist/core/LoopLifecycle.sql +1 -6
  103. package/dist/core/MutationEffects.d.ts +1 -3
  104. package/dist/core/MutationEffects.d.ts.map +1 -1
  105. package/dist/core/MutationEffects.js +2 -1
  106. package/dist/core/MutationEffects.js.map +1 -1
  107. package/dist/core/PacketBuilder.d.ts +17 -4
  108. package/dist/core/PacketBuilder.d.ts.map +1 -1
  109. package/dist/core/PacketBuilder.js +80 -120
  110. package/dist/core/PacketBuilder.js.map +1 -1
  111. package/dist/core/PacketBuilder.sql +4 -12
  112. package/dist/core/PatternSelection.d.ts +5 -10
  113. package/dist/core/PatternSelection.d.ts.map +1 -1
  114. package/dist/core/PatternSelection.js +9 -16
  115. package/dist/core/PatternSelection.js.map +1 -1
  116. package/dist/core/ResourceMutations.d.ts +2 -4
  117. package/dist/core/ResourceMutations.d.ts.map +1 -1
  118. package/dist/core/ResourceMutations.js +2 -5
  119. package/dist/core/ResourceMutations.js.map +1 -1
  120. package/dist/core/ResourceSelector.d.ts +2 -2
  121. package/dist/core/ResourceSelector.d.ts.map +1 -1
  122. package/dist/core/ResourceSelector.js +64 -33
  123. package/dist/core/ResourceSelector.js.map +1 -1
  124. package/dist/core/ResourceTransfers.d.ts +2 -4
  125. package/dist/core/ResourceTransfers.d.ts.map +1 -1
  126. package/dist/core/ResourceTransfers.js +74 -50
  127. package/dist/core/ResourceTransfers.js.map +1 -1
  128. package/dist/core/SchemeRegistry.d.ts +1 -0
  129. package/dist/core/SchemeRegistry.d.ts.map +1 -1
  130. package/dist/core/SchemeRegistry.js +11 -9
  131. package/dist/core/SchemeRegistry.js.map +1 -1
  132. package/dist/core/ServiceTeardown.d.ts +3 -2
  133. package/dist/core/ServiceTeardown.d.ts.map +1 -1
  134. package/dist/core/ServiceTeardown.js +17 -8
  135. package/dist/core/ServiceTeardown.js.map +1 -1
  136. package/dist/core/StopDeadline.d.ts +5 -0
  137. package/dist/core/StopDeadline.d.ts.map +1 -0
  138. package/dist/core/StopDeadline.js +20 -0
  139. package/dist/core/StopDeadline.js.map +1 -0
  140. package/dist/core/StrikeRail.d.ts.map +1 -1
  141. package/dist/core/StrikeRail.js +5 -1
  142. package/dist/core/StrikeRail.js.map +1 -1
  143. package/dist/core/ToolResources.d.ts.map +1 -1
  144. package/dist/core/ToolResources.js +11 -2
  145. package/dist/core/ToolResources.js.map +1 -1
  146. package/dist/core/TurnDispositionHandler.d.ts +4 -2
  147. package/dist/core/TurnDispositionHandler.d.ts.map +1 -1
  148. package/dist/core/TurnDispositionHandler.js +24 -6
  149. package/dist/core/TurnDispositionHandler.js.map +1 -1
  150. package/dist/core/TurnMaterialization.d.ts +6 -2
  151. package/dist/core/TurnMaterialization.d.ts.map +1 -1
  152. package/dist/core/TurnMaterialization.js +64 -16
  153. package/dist/core/TurnMaterialization.js.map +1 -1
  154. package/dist/core/TurnOps.js +7 -7
  155. package/dist/core/TurnOps.js.map +1 -1
  156. package/dist/core/TurnRunner.d.ts +1 -0
  157. package/dist/core/TurnRunner.d.ts.map +1 -1
  158. package/dist/core/TurnRunner.js +155 -160
  159. package/dist/core/TurnRunner.js.map +1 -1
  160. package/dist/core/TurnRunner.sql +2 -2
  161. package/dist/core/caps/DbSubscriptionCaps.d.ts.map +1 -1
  162. package/dist/core/caps/DbSubscriptionCaps.js +13 -19
  163. package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
  164. package/dist/core/content-hash.d.ts +1 -1
  165. package/dist/core/content-hash.d.ts.map +1 -1
  166. package/dist/core/content-hash.js.map +1 -1
  167. package/dist/core/env-catalog.js +2 -2
  168. package/dist/core/env-catalog.js.map +1 -1
  169. package/dist/core/fork.sql +4 -10
  170. package/dist/core/git-env.d.ts +1 -1
  171. package/dist/core/git-env.d.ts.map +1 -1
  172. package/dist/core/git-env.js +19 -12
  173. package/dist/core/git-env.js.map +1 -1
  174. package/dist/core/git-membership.d.ts.map +1 -1
  175. package/dist/core/git-membership.js +11 -5
  176. package/dist/core/git-membership.js.map +1 -1
  177. package/dist/core/git-state.js +1 -1
  178. package/dist/core/git-state.js.map +1 -1
  179. package/dist/core/mutation-types.d.ts +6 -4
  180. package/dist/core/mutation-types.d.ts.map +1 -1
  181. package/dist/core/operation-target-groups.d.ts +1 -1
  182. package/dist/core/operation-target-groups.d.ts.map +1 -1
  183. package/dist/core/operation-target-groups.js +27 -5
  184. package/dist/core/operation-target-groups.js.map +1 -1
  185. package/dist/core/packet-wire.d.ts +80 -10
  186. package/dist/core/packet-wire.d.ts.map +1 -1
  187. package/dist/core/packet-wire.js +211 -227
  188. package/dist/core/packet-wire.js.map +1 -1
  189. package/dist/core/provider-accounting.d.ts +1 -1
  190. package/dist/core/provider-accounting.d.ts.map +1 -1
  191. package/dist/core/provider-accounting.js +2 -1
  192. package/dist/core/provider-accounting.js.map +1 -1
  193. package/dist/digest/Digest.d.ts.map +1 -1
  194. package/dist/digest/Digest.js +3 -2
  195. package/dist/digest/Digest.js.map +1 -1
  196. package/dist/digest/DigestEvidence.d.ts +1 -0
  197. package/dist/digest/DigestEvidence.d.ts.map +1 -1
  198. package/dist/digest/DigestEvidence.js +6 -0
  199. package/dist/digest/DigestEvidence.js.map +1 -1
  200. package/dist/digest/DigestRender.d.ts +1 -0
  201. package/dist/digest/DigestRender.d.ts.map +1 -1
  202. package/dist/digest/DigestRender.js +107 -48
  203. package/dist/digest/DigestRender.js.map +1 -1
  204. package/dist/digest/DigestRequiem.js +4 -4
  205. package/dist/digest/DigestRequiem.js.map +1 -1
  206. package/dist/digest/digest-rows.d.ts +8 -0
  207. package/dist/digest/digest-rows.d.ts.map +1 -1
  208. package/dist/digest/digest-rows.js.map +1 -1
  209. package/dist/digest/digest.sql +20 -2
  210. package/dist/schemes/Exec.d.ts.map +1 -1
  211. package/dist/schemes/Exec.js +28 -27
  212. package/dist/schemes/Exec.js.map +1 -1
  213. package/dist/schemes/File.d.ts.map +1 -1
  214. package/dist/schemes/File.js +1 -2
  215. package/dist/schemes/File.js.map +1 -1
  216. package/dist/schemes/Log.d.ts.map +1 -1
  217. package/dist/schemes/Log.js +4 -17
  218. package/dist/schemes/Log.js.map +1 -1
  219. package/dist/schemes/TurnSource.js +2 -2
  220. package/dist/schemes/TurnSource.js.map +1 -1
  221. package/dist/schemes/_derivation-use.d.ts +7 -0
  222. package/dist/schemes/_derivation-use.d.ts.map +1 -0
  223. package/dist/schemes/_derivation-use.js +40 -0
  224. package/dist/schemes/_derivation-use.js.map +1 -0
  225. package/dist/schemes/_entry-crud.d.ts +6 -1
  226. package/dist/schemes/_entry-crud.d.ts.map +1 -1
  227. package/dist/schemes/_entry-crud.js.map +1 -1
  228. package/dist/schemes/_entry-find.d.ts.map +1 -1
  229. package/dist/schemes/_entry-find.js +15 -49
  230. package/dist/schemes/_entry-find.js.map +1 -1
  231. package/dist/schemes/_entry-find.sql +0 -11
  232. package/dist/schemes/_entry-fts.d.ts.map +1 -1
  233. package/dist/schemes/_entry-fts.js +9 -3
  234. package/dist/schemes/_entry-fts.js.map +1 -1
  235. package/dist/schemes/_entry-fts.sql +14 -8
  236. package/dist/schemes/_entry-graph.d.ts +5 -8
  237. package/dist/schemes/_entry-graph.d.ts.map +1 -1
  238. package/dist/schemes/_entry-graph.js +33 -72
  239. package/dist/schemes/_entry-graph.js.map +1 -1
  240. package/dist/schemes/_entry-graph.sql +30 -48
  241. package/dist/schemes/_entry-manifest.d.ts +5 -0
  242. package/dist/schemes/_entry-manifest.d.ts.map +1 -1
  243. package/dist/schemes/_entry-manifest.js +5 -0
  244. package/dist/schemes/_entry-manifest.js.map +1 -1
  245. package/dist/schemes/_entry-ops.d.ts +1 -1
  246. package/dist/schemes/_entry-ops.d.ts.map +1 -1
  247. package/dist/schemes/_entry-ops.js +4 -11
  248. package/dist/schemes/_entry-ops.js.map +1 -1
  249. package/dist/schemes/_search-index.d.ts +10 -0
  250. package/dist/schemes/_search-index.d.ts.map +1 -1
  251. package/dist/schemes/_search-index.js +33 -1
  252. package/dist/schemes/_search-index.js.map +1 -1
  253. package/dist/schemes/exec-lifetime.d.ts.map +1 -1
  254. package/dist/schemes/exec-lifetime.js +1 -2
  255. package/dist/schemes/exec-lifetime.js.map +1 -1
  256. package/dist/server/Daemon.d.ts +2 -1
  257. package/dist/server/Daemon.d.ts.map +1 -1
  258. package/dist/server/Daemon.js +31 -35
  259. package/dist/server/Daemon.js.map +1 -1
  260. package/dist/server/DrainSupervisor.d.ts +2 -1
  261. package/dist/server/DrainSupervisor.d.ts.map +1 -1
  262. package/dist/server/DrainSupervisor.js +37 -56
  263. package/dist/server/DrainSupervisor.js.map +1 -1
  264. package/dist/server/Functionality.d.ts +1 -1
  265. package/dist/server/Functionality.d.ts.map +1 -1
  266. package/dist/server/Functionality.js +24 -11
  267. package/dist/server/Functionality.js.map +1 -1
  268. package/dist/server/FunctionalityManager.js +2 -2
  269. package/dist/server/FunctionalityManager.js.map +1 -1
  270. package/dist/server/Retention.d.ts.map +1 -1
  271. package/dist/server/Retention.js +7 -3
  272. package/dist/server/Retention.js.map +1 -1
  273. package/dist/server/drain.sql +0 -6
  274. package/dist/server/seam-loop.sql +1 -1
  275. package/dist/service.js +1 -1
  276. package/dist/service.js.map +1 -1
  277. package/docs/env.md +4 -3
  278. package/migrations/013_graph_regions.sql +32 -0
  279. package/migrations/014_stream_timing.sql +4 -0
  280. package/migrations/015_request_evidence.sql +4 -0
  281. package/package.json +34 -34
  282. package/dist/core/KnownToxins.d.ts +0 -4
  283. package/dist/core/KnownToxins.d.ts.map +0 -1
  284. package/dist/core/KnownToxins.js +0 -22
  285. package/dist/core/KnownToxins.js.map +0 -1
  286. package/dist/core/ReasoningView.d.ts +0 -12
  287. package/dist/core/ReasoningView.d.ts.map +0 -1
  288. package/dist/core/ReasoningView.js +0 -40
  289. package/dist/core/ReasoningView.js.map +0 -1
  290. package/dist/server/exec-poll-backoff.d.ts +0 -2
  291. package/dist/server/exec-poll-backoff.d.ts.map +0 -1
  292. package/dist/server/exec-poll-backoff.js +0 -6
  293. package/dist/server/exec-poll-backoff.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TurnOps.js","sourceRoot":"","sources":["../../src/core/TurnOps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAIrD,uFAAuF;AACvF,MAAM,CAAC,OAAO,OAAO,OAAO;IACxB,oGAAoG;IACpG,sFAAsF;IACtF,MAAM,CAAC,cAAc,CAAC,UAAsC,EAAE,MAAc;QACxE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YAChC,MAAM,OAAO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@ export type AdmittedEmission = {
9
9
  readonly workerName: string;
10
10
  readonly loopSeq: number;
11
11
  readonly turnSeq: number;
12
+ readonly reasoning: string | null;
12
13
  };
13
14
  import type SchemeRegistry from "./SchemeRegistry.ts";
14
15
  import { Mimetypes } from "@plurnk/plurnk-mimetypes";
@@ -1 +1 @@
1
- {"version":3,"file":"TurnRunner.d.ts","sourceRoot":"","sources":["../../src/core/TurnRunner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,gBAAgB,EAAqC,MAAM,0BAA0B,CAAC;AAM3G,OAAO,KAAK,EAAE,aAAa,EAAyE,MAAM,0BAA0B,CAAC;AAKrI,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3H,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAK7I,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAoB,MAAM,0BAA0B,CAAC;AAGvE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAKlC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAOvD,eAAO,MAAM,0BAA0B,UAAW,MAAM,KAAG,MAI1D,CAAC;AAMF,OAAgB,EAAyB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CAAC;QAExB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QACtD,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;QAC1C,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAGzD,UAAU,CAAC,EAAE,MAAM,CAAC;QAGpB,8BAA8B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAClD,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8C5B;IA2wCK,mBAAmB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,CAEnJ;CACJ"}
@@ -31,10 +31,11 @@ export const resolveOperatorGrammarPath = (value) => {
31
31
  // projection and digest projection are structurally one function — no
32
32
  // drift between wire and digest possible.
33
33
  import PacketWire from "./packet-wire.js";
34
- import ReasoningView from "./ReasoningView.js";
34
+ import { RECEIPT_RESERVE, reserved } from "./ContextFit.js";
35
35
  import Results, { OperationFailureError } from "./results.js";
36
36
  import Turn from "./Turn.js";
37
37
  import ProviderRecovery from "./ProviderRecovery.js";
38
+ import PacketBuilder from "./PacketBuilder.js";
38
39
  import StoredPacket from "./StoredPacket.js";
39
40
  import { observed, observedSync } from "../observe/spans.js";
40
41
  import { genAiRequestName, genAiRequestOptions, settleGenAiResponse } from "../observe/genai.js";
@@ -93,15 +94,16 @@ import { ProviderError, scopeEnvToAlias } from "@plurnk/plurnk-providers";
93
94
  import ProviderInstantiate from "./ProviderInstantiate.js";
94
95
  import TurnMaterialization from "./TurnMaterialization.js";
95
96
  import BareBatchRunner from "./BareBatchRunner.js";
96
- import KnownToxins from "./KnownToxins.js";
97
97
  import { TURN_STATUS_IMPLICIT_CONTINUE } from "./turn-signals.js";
98
98
  import AdmittedTurnExecutor from "./AdmittedTurnExecutor.js";
99
- const TOKEN_BUDGET_OVERFLOW_HARD_DETAIL = "Context Token Budget Overflow: logTokensTotal exceeds logTokensMax; retained context cannot fit.";
100
- const curationOverflowFailure = (pressure) => Results.failure("engine:context", "token-budget-overflow", 413, TOKEN_BUDGET_OVERFLOW_HARD_DETAIL, {}, {
101
- usage: pressure.weight,
102
- ceiling: pressure.budget,
103
- deficit: pressure.excess,
104
- });
99
+ // {§context-wall} — the window's one terminal: the packet cannot fit the model's window even as receipts.
100
+ const WINDOW_OVERFLOW_DETAIL = "Context window overflow: the packet cannot fit the model's window even as receipts.";
101
+ const windowOverflowFailure = (overflow) => Results.failure("engine:context", "window-overflow", 413, WINDOW_OVERFLOW_DETAIL, {}, { tokens: overflow.tokens, budget: overflow.budget, wall: overflow.wall, excess: overflow.excess });
102
+ // {§context-over-budget-row} — over budget is a row and a request: the row is how the model hears it.
103
+ // {§context-over-budget-row} — the row is the mandate; the gauge is the one home for the numbers
104
+ // ({§context-gauge}), which the row's own charge would otherwise put out of agreement.
105
+ const OVER_BUDGET_DETAIL = "Context exceeds budget. YOU MUST ONLY KILL, MOVE or NOTE this turn.";
106
+ const overBudgetFailure = () => Results.failure("engine:context", "packet-exceeds-budget", 413, OVER_BUDGET_DETAIL);
105
107
  const INVALID_EMISSION_RECOVERY_MESSAGE = "Response rejected before dispatch; no operations were performed.";
106
108
  // {§output-allowance-notice} — THE single derivation of a ceiling cut: a
107
109
  // `length` finish is the engine's own allowance ending the emission, and it
@@ -298,14 +300,18 @@ class TurnRunner {
298
300
  const createdTurnIds = [];
299
301
  const turnSignal = this.#loopSignal(loopId) ?? signal;
300
302
  try {
303
+ // {§configuration-repair-path} — a retired packet knob refuses inference before any turn opens.
304
+ PacketBuilder.assertConfiguration();
301
305
  const container = await this.#openTurnContainer(args, createdTurnIds);
302
306
  const gitStatus = await this.#deriveWorkspace(args, container.systemCtx);
303
307
  if (container.initializationTurn !== null)
304
- await this.#runInitializationTurn(args, container, container.initializationTurn);
305
- const request = await this.#composeRequest(args, container, gitStatus);
306
- const overflow = this.#packets.curationOverflow(request.packet);
307
- if (overflow !== null)
308
- return await this.#failCuration(request, overflow);
308
+ await this.#runInitializationTurn(args, container, container.initializationTurn, gitStatus);
309
+ const composed = await this.#composeRequest(args, container, gitStatus);
310
+ const admitted = await this.#admitPacket(args, composed);
311
+ // {§context-wall} — only the window ends a loop.
312
+ if (admitted.overflow !== null)
313
+ return await this.#failCuration(admitted.request, admitted.overflow);
314
+ const request = admitted.request;
309
315
  const attempts = await this.#prepareProviderAttempts(args, request);
310
316
  let emission;
311
317
  try {
@@ -386,16 +392,12 @@ class TurnRunner {
386
392
  const systemCtx = this.#schemeContext(args, initializationTurn?.id ?? modelTurn.id);
387
393
  const initializationStatements = [];
388
394
  // {§worker-initialization-entry} — the worker's first turn is the worked
389
- // example itself: the actual orienting operations and ordinary NOTEs.
395
+ // example itself: the actual orienting operations.
390
396
  // {§turn0-agents-stunt} — the project AGENTS.md (materialized by LoopDocs as
391
397
  // worker:///_plurnk/AGENTS.md) gets one foisted READ on the worker's first
392
398
  // loop, so local repo guidance is visible turn-0 content. Global policy
393
399
  // stays in the system prompt; nothing else is force-read.
394
400
  if (initializationTurn !== null) {
395
- initializationStatements.push({
396
- op: "NOTE", aside: null, metadata: null, target: null, lineMarker: null,
397
- body: `This turn surveys tooling and environment. The log records results; reasoning://${workerName}/${loopSequence}/${initializationTurn.sequence} contains the submitted OPs.`, position: UNKNOWN_POSITION,
398
- });
399
401
  const agentsEntry = await this.#db.crud_find_workspace_entry.get({
400
402
  workspace_id: workspaceId,
401
403
  scheme: "worker",
@@ -474,13 +476,13 @@ class TurnRunner {
474
476
  // {§worker-initialization-entry} — the worker's first turn is the worked example
475
477
  // itself: the actual orienting operations and ordinary NOTEs, executed as a
476
478
  // complete turn before the model boundary.
477
- async #runInitializationTurn(args, container, initializationTurn) {
478
- const { provider, workspaceId, workerId, loopId, onDispatch, onSettled } = args;
479
- const { workerName, loopSequence, initializationStatements, initializationPolicies } = container;
479
+ async #runInitializationTurn(args, container, initializationTurn, gitStatus) {
480
+ const { workspaceId, workerId, loopId, onDispatch, onSettled } = args;
481
+ const { initializationStatements, initializationPolicies } = container;
480
482
  // Turn-0 catalog preview (PLURNK_SERVICE_FILES_ITEMS, {§actor-boundary-catalog-preview}):
481
- // Eight bodyless FIND surveys in the worker's packetless initialization turn establish the Agent
483
+ // Nine bodyless FIND surveys in the worker's packetless initialization turn establish the Agent
482
484
  // Skills, the plurnk references, the enabled tools, agents, and members, then the project, commons,
483
- // and named scratch, in that order.
485
+ // named scratch, and the worker's own reasoning, in that order.
484
486
  // Their `init` classification lets the model curate this opening survey as one log set.
485
487
  // {§operator-config-workspace-files-items} — workspace filesItems replaces the env default.
486
488
  const { filesItems: workspaceMI } = await WorkspaceSettings.read(this.#db, workspaceId);
@@ -488,20 +490,23 @@ class TurnRunner {
488
490
  if (filesItems !== null) { // {§actor-boundary-catalog-preview} — once per worker
489
491
  initializationStatements.push(...await this.#catalogSurveys(args, container, filesItems));
490
492
  }
491
- const reasoningRead = ReasoningView.initialRead(provider, workerName, loopSequence, initializationTurn.sequence);
492
- if (reasoningRead !== null)
493
- initializationStatements.push(reasoningRead);
494
- // {§worker-initialization-entry} — publish the complete source before its own READ executes.
495
- // {§emission-row} — reasoning-only work has receipts, never a fabricated content emission.
493
+ // {§worker-initialization-entry} — the survey is an ordinary operation program: recorded as the
494
+ // turn's ops source and executed through the same path as a model's program; it authors no reasoning.
495
+ // {§emission-row} — a `_plurnk` turn has receipts, never a fabricated assistant emission.
496
496
  // {§message-arrival} — the message reaches the model as an inbound SEND in the first
497
497
  // model turn; initialization does not READ it a second time.
498
498
  const admittedInitializationStatements = initializationStatements.filter((statement) => this.#capabilities.allowsAcross(statement, workspaceId, initializationPolicies));
499
- const reasoning = ReasoningView.initialSource(TurnOps.renderInternal(admittedInitializationStatements));
500
- const admitted = PlurnkParser.parseReasoningOperations(reasoning);
499
+ if (admittedInitializationStatements.length === 0) {
500
+ // Nothing to survey (the preview off, no project guidance): the turn opens and completes empty.
501
+ await Turn.complete(this.#db, initializationTurn.id, 200);
502
+ return;
503
+ }
504
+ const program = TurnOps.renderInternal(admittedInitializationStatements);
505
+ const admitted = PlurnkParser.parseStatements(program).items.flatMap((item) => item.kind === "statement" ? [item.statement] : []);
501
506
  if (admitted.length !== admittedInitializationStatements.length) {
502
- throw new Error("initialization reasoning did not preserve every authored operation");
507
+ throw new Error("initialization program did not preserve every authored operation");
503
508
  }
504
- await Turn.recordSource(this.#db, initializationTurn.id, "reasoning", reasoning);
509
+ await Turn.recordSource(this.#db, initializationTurn.id, "ops", program);
505
510
  const result = await this.executeAdmittedTurn({
506
511
  statements: admitted,
507
512
  source: null,
@@ -513,6 +518,7 @@ class TurnRunner {
513
518
  turnId: initializationTurn.id,
514
519
  fromSequence: 1,
515
520
  failOnOperationError: true,
521
+ fit: this.#fitFor(args, { turnId: initializationTurn.id, seq: initializationTurn.sequence, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId, bodiless: new Set() }),
516
522
  signal: this.#loopSignal(loopId),
517
523
  onDispatch,
518
524
  onSettled,
@@ -592,6 +598,14 @@ class TurnRunner {
592
598
  metadata: null,
593
599
  matcher: null, body: null, lineMarker: null, position: UNKNOWN_POSITION,
594
600
  },
601
+ {
602
+ // {§worker-initialization-entry} — the worker's own reasoning is an addressable, searchable
603
+ // space from the first packet: surveyed by name, never read back.
604
+ op: "FIND", aside: "this worker's reasoning, by loop and turn",
605
+ target: { kind: "url", raw: `reasoning://${workerName}/**`, scheme: "reasoning", username: null, password: null, hostname: workerName, port: null, pathname: "/**", query: null, fragment: null },
606
+ metadata: null,
607
+ matcher: null, body: null, lineMarker: null, position: UNKNOWN_POSITION,
608
+ },
595
609
  ];
596
610
  return surveys.filter(({ target }) => this.#schemes.get(target?.kind === "url" ? target.scheme : "file", workspaceId) !== undefined);
597
611
  }
@@ -636,8 +650,12 @@ class TurnRunner {
636
650
  container.createdTurnIds.push(modelTurn.id);
637
651
  const { id: turnId, sequence: seq } = modelTurn;
638
652
  const systemCtx = this.#schemeContext(args, turnId);
639
- const messages = await this.#publishMessages(args, turnId);
640
- let nextActionIndex = await this.#readOpenPaths(args, turnId, messages.openPaths, messages.nextActionIndex);
653
+ // {§context-fit} — one measure for everything this turn lands: the budget less the packet as it
654
+ // would render now. The drained notices join the same facts below.
655
+ const facts = { turnId, seq, gitStatus, notices: [], transientOpenLogEntryId: container.transientOpenLogEntryId, bodiless: new Set() };
656
+ const fit = this.#fitFor(args, facts);
657
+ const messages = await this.#publishMessages(args, turnId, fit);
658
+ let nextActionIndex = await this.#readOpenPaths(args, turnId, messages.openPaths, messages.nextActionIndex, fit);
641
659
  // {§env-delta-log-pull} — materialize ambient observations before packet
642
660
  // composition and reserve their action indices. {§exec-stream} owns the
643
661
  // distinct byte-cursor path for this worker's streams.
@@ -647,7 +665,7 @@ class TurnRunner {
647
665
  await this.#reapTurnScopedStreams(workerId);
648
666
  const ambientEntries = await this.#materialization.materializeEnvironmentDeltas({ workspaceId, workerId, loopId, turnId, fromSequence: nextActionIndex });
649
667
  nextActionIndex += ambientEntries.length;
650
- const streamEntries = await this.#materialization.materializeStreamDeltas({ workspaceId, workerId, loopId, turnId, fromSequence: nextActionIndex });
668
+ const streamEntries = await this.#materialization.materializeStreamDeltas({ workspaceId, workerId, loopId, turnId, fromSequence: nextActionIndex, fit });
651
669
  nextActionIndex += streamEntries.length;
652
670
  await Turn.observeCompletions(this.#db, turnId);
653
671
  // {§notifications-log-entry-notify}: materialized observations are
@@ -660,18 +678,13 @@ class TurnRunner {
660
678
  // and every budget rebuild; overflow never shells again.
661
679
  // Notices are non-terminal observations, never operation-failure truth.
662
680
  // Drain once and thread the same set through every overflow rebuild.
663
- const notices = this.#notices.drain(loopId)
664
- .filter((event) => event.level !== "info");
681
+ facts.notices.push(...this.#notices.drain(loopId)
682
+ .filter((event) => event.level !== "info"));
665
683
  // Build the model request packet ({§packet-stored-shape}). The log build
666
684
  // queries log_entries scoped to the worker, including this turn's newly
667
685
  // published message arrivals.
668
- const facts = { turnId, seq, gitStatus, notices, transientOpenLogEntryId: container.transientOpenLogEntryId, promptProjection: "automatic" };
669
- let packet = await this.#buildPacket(args, facts);
670
- // {§context-output-admission} — output admission changes no operation
671
- // outcome, authored memory, or turn identity.
672
- if (await this.#packets.admitOutput(packet, turnId))
673
- packet = await this.#buildPacket(args, facts);
674
- return { ...facts, createdTurnIds: container.createdTurnIds, workerName: container.workerName, loopSeq: container.loopSequence, systemCtx, nextActionIndex, packet };
686
+ const packet = await this.#buildPacket(args, facts);
687
+ return { ...facts, fit, createdTurnIds: container.createdTurnIds, workerName: container.workerName, loopSeq: container.loopSequence, systemCtx, nextActionIndex, packet };
675
688
  }
676
689
  // Pre-model writes. Each message the model has not seen yet becomes an inbound `SEND`
677
690
  // row; model operations continue the same turn sequence after these rows. Returns the
@@ -679,15 +692,18 @@ class TurnRunner {
679
692
  // {§message-loop-containment}: the loop contains every message that arrived before this
680
693
  // boundary. Publish each unpublished inbox row oldest-first, exactly once, as an inbound
681
694
  // SEND row ({§message-arrival}); its selected paths ride along for the READs that follow.
682
- async #publishMessages({ workerId, loopId, onDispatch, onSettled }, turnId) {
695
+ async #publishMessages({ workspaceId, workerId, loopId, onDispatch, onSettled }, turnId, fit) {
683
696
  let nextActionIndex = 1;
684
697
  const openPaths = [];
685
698
  const unpublished = await this.#db.drain_unpublished_messages_for_loop.all({ loop_id: loopId });
686
- for (const message of unpublished) {
687
- openPaths.push(...assertOpenPaths(JSON.parse(message.open_paths), `Message ${message.id} open_paths`));
699
+ const selected = unpublished.map((message) => assertOpenPaths(JSON.parse(message.open_paths), `Message ${message.id} open_paths`));
700
+ const pendingPaths = selected.reduce((count, paths) => count + paths.length, 0);
701
+ for (const [index, message] of unpublished.entries()) {
702
+ openPaths.push(...selected[index]);
688
703
  const logEntryId = await this.#materialization.writeArrivalLog({
689
- workerId, loopId, turnId, sequence: nextActionIndex++, body: message.body, source: message.source, resource: message.path,
704
+ workspaceId, workerId, loopId, turnId, sequence: nextActionIndex++, body: message.body, source: message.source, resource: message.path,
690
705
  selfAddressed: message.source !== null && message.source === message.durable_path,
706
+ fit: reserved(fit, unpublished.length - index - 1 + pendingPaths),
691
707
  });
692
708
  const published = await this.#db.drain_publish_message.get({ id: message.id, log_entry_id: logEntryId });
693
709
  if (published === undefined)
@@ -700,9 +716,9 @@ class TurnRunner {
700
716
  // {§methods-loop-run-open-paths}: selected workspace paths belong to the message.
701
717
  // Publish it, then dispatch ordinary core READs in that same turn;
702
718
  // missing/non-member paths retain their normal 4xx. Returns the next action index.
703
- async #readOpenPaths({ workspaceId, workerId, loopId, onDispatch, onSettled }, turnId, openPaths, fromSequence) {
719
+ async #readOpenPaths({ workspaceId, workerId, loopId, onDispatch, onSettled }, turnId, openPaths, fromSequence, fit) {
704
720
  let nextActionIndex = fromSequence;
705
- for (const raw of openPaths) {
721
+ for (const [index, raw] of openPaths.entries()) {
706
722
  const fileRead = {
707
723
  op: "READ", aside: null, lineMarker: null, matcher: null,
708
724
  target: { kind: "local", raw },
@@ -712,6 +728,7 @@ class TurnRunner {
712
728
  await this.#dispatch({
713
729
  statement: fileRead, workspaceId, workerId, loopId, turnId,
714
730
  sequence: nextActionIndex, origin: "_plurnk", onDispatch, onSettled,
731
+ fit: reserved(fit, openPaths.length - index - 1),
715
732
  });
716
733
  nextActionIndex++;
717
734
  }
@@ -729,14 +746,74 @@ class TurnRunner {
729
746
  gitStatus: facts.gitStatus,
730
747
  notices: facts.notices,
731
748
  transientOpenLogEntryId: facts.transientOpenLogEntryId,
732
- promptProjection: facts.promptProjection,
733
749
  turnId: facts.turnId,
750
+ bodiless: facts.bodiless,
734
751
  });
735
752
  }
736
- // Retained context cannot fit: the turn completes on the curation failure and
737
- // the loop rules the terminal.
753
+ // {§context-fit} — the budget left for one more row, measured by building the packet as it would
754
+ // render now: every row landed so far, every KILL already honoured. Null without a budget.
755
+ #fitFor(args, facts) {
756
+ return {
757
+ remaining: async () => {
758
+ const packet = await this.#buildPacket(args, facts);
759
+ const budget = this.#packets.curationBudgetFor(packet);
760
+ return budget === null ? null : Math.max(0, budget - packet.weight - RECEIPT_RESERVE);
761
+ },
762
+ };
763
+ }
764
+ // {§context-over-budget-row} — one `_plurnk` error row at the head of the turn's own rows, then the
765
+ // packet as it renders with it; the row recurs on every packet that is over.
766
+ async #noteOverBudget(args, request) {
767
+ const { workerId, loopId, onDispatch, onSettled } = args;
768
+ const minted = await this.#problems.record({
769
+ workerId, loopId, turnId: request.turnId, sequence: request.nextActionIndex, origin: "_plurnk", source: "context",
770
+ result: overBudgetFailure(),
771
+ });
772
+ onDispatch?.(minted.id);
773
+ await onSettled?.(minted.id);
774
+ const packet = await this.#buildPacket(args, request);
775
+ return { ...request, nextActionIndex: request.nextActionIndex + 1, packet };
776
+ }
777
+ // The packet against the wall and the budget: the newest rows go bodiless until it fits the window
778
+ // ({§context-own-rows-fit}); a packet still over budget then says so in a row ({§context-over-budget-row}),
779
+ // whose own weight takes the same wall. The overflow is returned only when the packet cannot fit even
780
+ // as receipts.
781
+ async #admitPacket(args, request) {
782
+ const fitted = await this.#fitOwnRows(args, request);
783
+ if (fitted.overflow !== null)
784
+ return fitted;
785
+ if (this.#packets.curationOverflow(fitted.request.packet) === null)
786
+ return fitted;
787
+ return await this.#fitOwnRows(args, await this.#noteOverBudget(args, fitted.request));
788
+ }
789
+ // {§context-own-rows-fit} — while the packet is over the wall ({§context-wall}), the newest rows still
790
+ // carrying a body are taken, enough of them by their rendered tokens to shed the excess, and the packet
791
+ // is rebuilt with them bodiless; every body stays stored. The rebuilt packet is measured again until
792
+ // it fits, or until no row is left to take.
793
+ async #fitOwnRows(args, request) {
794
+ let current = request;
795
+ for (;;) {
796
+ const overflow = this.#packets.windowOverflow(current.packet, args.provider);
797
+ if (overflow === null)
798
+ return { request: current, overflow: null };
799
+ let shed = 0;
800
+ let taken = 0;
801
+ for (const { id, tokens } of this.#packets.bodiedRowsOf(current.packet).toReversed()) {
802
+ if (shed >= overflow.excessWeight)
803
+ break;
804
+ current.bodiless.add(id);
805
+ shed += tokens;
806
+ taken += 1;
807
+ }
808
+ if (taken === 0)
809
+ return { request: current, overflow };
810
+ current = { ...current, packet: await this.#buildPacket(args, current) };
811
+ }
812
+ }
813
+ // {§context-wall} — the packet cannot fit the window even as receipts: the turn completes on the
814
+ // overflow and the loop rules the terminal; no provider I/O.
738
815
  async #failCuration(request, overflow) {
739
- const curationFailure = curationOverflowFailure(overflow);
816
+ const curationFailure = windowOverflowFailure(overflow);
740
817
  await Turn.complete(this.#db, request.turnId, curationFailure.status);
741
818
  return turnResult(request, curationFailure.status, { curationFailure });
742
819
  }
@@ -806,10 +883,15 @@ class TurnRunner {
806
883
  accounting: {
807
884
  requests: attempts.turnWireAccounting.length,
808
885
  costUsd: wire.costUsd,
886
+ knownCostUsd: wire.knownCostUsd,
809
887
  inputTokens: wire.usage?.inputTokens ?? null,
888
+ knownInputTokens: wire.knownUsage?.inputTokens ?? null,
810
889
  outputTokens: wire.usage?.outputTokens ?? null,
890
+ knownOutputTokens: wire.knownUsage?.outputTokens ?? null,
811
891
  reasoningTokens: wire.usage?.outputTokenDetails?.reasoningTokens ?? null,
892
+ knownReasoningTokens: wire.knownUsage?.outputTokenDetails?.reasoningTokens ?? null,
812
893
  cacheReadTokens: wire.usage?.inputTokenDetails?.cacheReadTokens ?? null,
894
+ knownCacheReadTokens: wire.knownUsage?.inputTokenDetails?.cacheReadTokens ?? null,
813
895
  },
814
896
  });
815
897
  }
@@ -871,24 +953,15 @@ class TurnRunner {
871
953
  completedResponse = await this.#generate(args, request, attempts, modelCall, reasoning, strikeStreak);
872
954
  }
873
955
  catch (error) {
874
- if (error instanceof ProviderError && error.kind === "repetition" && error.attempt !== undefined) {
875
- await this.#rejectRepetition(args, attempts, modelCall, attemptRow.id, error, error.attempt);
876
- return "rejected";
877
- }
878
956
  if (error instanceof ProviderError
879
957
  && ProviderRecovery.RECOVERABLE.has(error.kind)
880
958
  && attempts.signal?.aborted !== true) {
881
959
  await this.#recoverProviderFailure(args, request, attempts, modelCall, attemptRow.id, error);
882
960
  return "reissued";
883
961
  }
884
- if (!(error instanceof ProviderError)
885
- || error.kind !== "capacity_exceeded"
886
- || attempts.signal?.aborted === true
887
- || !await this.#recoverCapacityPacket(args, request, attempts)) {
888
- throw error;
889
- }
890
- await this.#resendForCapacity(args, request, attempts, modelCall, error);
891
- return "reissued";
962
+ // {§context-wall} — a provider capacity rejection after the provider's own retries is this
963
+ // turn's failure; nothing is withheld to make the request smaller.
964
+ throw error;
892
965
  }
893
966
  finally {
894
967
  reasoning.end();
@@ -1004,22 +1077,6 @@ class TurnRunner {
1004
1077
  }
1005
1078
  }, genAiRequestOptions(ProviderInstantiate.providerIdOf(provider) ?? "other", provider.model));
1006
1079
  }
1007
- // {§repetition-stop} — a response stopped at a repeated line is an invalid emission, not a provider failure:
1008
- // the partial attempt is durable evidence, the provider's sentence is its diagnostic, and the same packet is
1009
- // resampled under {§invalid-emission-attempts}. No recovery wait, no provider notice, no problem row.
1010
- async #rejectRepetition({ workspaceId }, attempts, modelCall, attemptId, error, attempt) {
1011
- await modelCall.observeResponse(attempt, _a.#providerFailure(error, attempts.signal), attempts.wire.nativeInputs);
1012
- attempts.callInFlight = false;
1013
- const split = this.#splitResponse(attempt, this.#executors()?.availableRuntimes(workspaceId) ?? [], attempts.wellFormed, this.#executors()?.jsonBodyRuntimes(workspaceId) ?? []);
1014
- attempts.response = attempt;
1015
- attempts.split = {
1016
- ...split,
1017
- emissionValid: false,
1018
- recoverableParseErrors: [],
1019
- parseErrors: [{ message: error.message, line: 1, column: 1, source: "provider" }, ...split.parseErrors],
1020
- };
1021
- await this.#classifyProviderAttempt(attempts, attemptId, attempts.split, attempts.currentEmissionAttempt, false);
1022
- }
1023
1080
  // {§provider-recovery} — a transient provider failure never ends the loop: record
1024
1081
  // it, wait, and re-issue the same turn; once the budget is spent the failure
1025
1082
  // handler parks the loop instead of failing it.
@@ -1064,42 +1121,6 @@ class TurnRunner {
1064
1121
  // durable, but recursively materializing them would mutate and cache-bust
1065
1122
  // the request being recovered. {§provider-recovery}
1066
1123
  }
1067
- // The first capacity rejection withholds the automatic prompt projection; the
1068
- // rebuilt request is resent only when it actually changed the wire messages.
1069
- async #recoverCapacityPacket(args, request, attempts) {
1070
- if (request.promptProjection !== "automatic")
1071
- return false;
1072
- request.promptProjection = "withheld";
1073
- const candidate = await this.#buildPacket(args, request);
1074
- const candidateRequest = await this.#wireMessages(candidate, request.systemCtx, args.provider);
1075
- if (JSON.stringify(candidateRequest.messages) === JSON.stringify(attempts.wire.messages))
1076
- return false;
1077
- request.packet = candidate;
1078
- attempts.wire = candidateRequest;
1079
- return true;
1080
- }
1081
- // The capacity rejection is durable as a failed call and a problem row; the
1082
- // replacement request is rebuilt to include that recovery signal while keeping
1083
- // the selected projection.
1084
- async #resendForCapacity(args, request, attempts, modelCall, error) {
1085
- const { workerId, loopId, provider } = args;
1086
- const failure = _a.#providerFailure(error, attempts.signal);
1087
- await modelCall.fail(failure, error.capacity ?? null);
1088
- attempts.callInFlight = false;
1089
- await this.#problems.record({
1090
- workerId,
1091
- loopId,
1092
- turnId: request.turnId,
1093
- sequence: request.nextActionIndex++,
1094
- origin: "_plurnk",
1095
- source: "provider",
1096
- result: failure,
1097
- });
1098
- // Include the durable recovery signal in the replacement
1099
- // request while preserving the selected recovery posture.
1100
- request.packet = await this.#buildPacket(args, request);
1101
- attempts.wire = await this.#wireMessages(request.packet, request.systemCtx, provider);
1102
- }
1103
1124
  // The attempt row's verdict: accepted, or rejected with the parser's errors. The
1104
1125
  // classified emission attempt is the turn's spent count.
1105
1126
  async #classifyProviderAttempt(attempts, id, split, emissionAttempt, accepted) {
@@ -1366,6 +1387,7 @@ class TurnRunner {
1366
1387
  emission: split.emissionStatements === null ? null : {
1367
1388
  content: TurnOps.renderEmission(split.emissionStatements, `ops://${request.workerName}/${request.loopSeq}/${request.seq}`),
1368
1389
  workerName: request.workerName, loopSeq: request.loopSeq, turnSeq: request.seq,
1390
+ reasoning: split.packetAssistant.reasoning ?? null, // {§reasoning-row}
1369
1391
  },
1370
1392
  sourceModelCallId: emission.modelCallId,
1371
1393
  origin: "model",
@@ -1375,6 +1397,7 @@ class TurnRunner {
1375
1397
  turnId: request.turnId,
1376
1398
  fromSequence: request.nextActionIndex,
1377
1399
  maxCommands,
1400
+ fit: request.fit,
1378
1401
  recoverableParseErrors: split.recoverableParseErrors,
1379
1402
  emptyTurn: split.emptyTurn,
1380
1403
  finalResponse: split.finalResponse,
@@ -1388,8 +1411,6 @@ class TurnRunner {
1388
1411
  onDispatch,
1389
1412
  onSettled,
1390
1413
  });
1391
- if (executed.emptyTurn)
1392
- await this.#readEmptyTurnReasoning(args, request, split.packetAssistant);
1393
1414
  return turnResult(request, executed.status, {
1394
1415
  outcomes: executed.outcomes,
1395
1416
  progressed: executed.progressed,
@@ -1398,40 +1419,6 @@ class TurnRunner {
1398
1419
  emissionAttempts: emission.emissionAttempts,
1399
1420
  });
1400
1421
  }
1401
- // {§reasoning-empty-turn-read} — after a turn with no operation, one runtime turn READs that
1402
- // turn's reasoning back to the model. A trace or emission carrying a foreign tool-call grammar
1403
- // is not echoed (`KnownToxins`); a turn without reasoning has nothing to read.
1404
- async #readEmptyTurnReasoning(args, request, { content, reasoning, ops }) {
1405
- const { provider, workspaceId, workerId, loopId, onDispatch, onSettled } = args;
1406
- if (ops.length > 0 || !reasoning?.length || KnownToxins.match(content) !== null || KnownToxins.match(reasoning) !== null)
1407
- return;
1408
- const statement = ReasoningView.emptyTurnRead(provider, request.workerName, request.loopSeq, request.seq);
1409
- if (statement === null)
1410
- return;
1411
- const policies = (await CapabilityPolicies.layers(this.#db, workspaceId, loopId)).map((layer) => layer.policy);
1412
- if (!this.#capabilities.allowsAcross(statement, workspaceId, policies))
1413
- return;
1414
- const turn = await Turn.open(this.#db, { loopId, producer: "_plurnk", kind: "operation" });
1415
- request.createdTurnIds.push(turn.id);
1416
- const source = TurnOps.renderInternal([statement]);
1417
- const result = await this.executeAdmittedTurn({
1418
- statements: TurnOps.parseInternal(source),
1419
- source,
1420
- emission: null,
1421
- origin: "_plurnk",
1422
- workspaceId,
1423
- workerId,
1424
- loopId,
1425
- turnId: turn.id,
1426
- fromSequence: 1,
1427
- failOnOperationError: true,
1428
- signal: this.#loopSignal(loopId),
1429
- onDispatch,
1430
- onSettled,
1431
- });
1432
- if (result.status !== 200)
1433
- throw new Error(`empty-turn reasoning read returned ${result.status}; expected 200`);
1434
- }
1435
1422
  // Split the wire-level ProviderResponse into the two destinations:
1436
1423
  // packet.assistant gets the model's emission (content, ops, reasoning);
1437
1424
  // Turn columns get accepted-call metadata (finishReason, model). Physical
@@ -1559,11 +1546,19 @@ class TurnRunner {
1559
1546
  }
1560
1547
  }
1561
1548
  const reasoning = assistant.reasoning ?? null;
1562
- const reasoningOps = reasoning === null ? [] : PlurnkParser.parseReasoningOperations(reasoning);
1563
- const reasoningWork = reasoningOps.filter(({ op }) => op !== "NOTE");
1564
- const operationCount = contentStatementCount + reasoningWork.length;
1565
- // {§reasoning-operations}: fact-finding is real work, even without a content program.
1566
- if (reasoningWork.length > 0) {
1549
+ const reasoningOps = reasoning === null ? [] : PlurnkParser.parseReasoningOperations(reasoning, (warning) => {
1550
+ parseNotices.push({
1551
+ source: "grammar:reasoning",
1552
+ kind: "parse_advisory",
1553
+ level: "warn",
1554
+ message: warning.message,
1555
+ parserSource: warning.source,
1556
+ });
1557
+ });
1558
+ const operationCount = contentStatementCount + reasoningOps.length;
1559
+ // {§reasoning-operations}: an admitted reasoning operation is the turn's work, a NOTE as much as a
1560
+ // FIND or READ, with or without a content program.
1561
+ if (reasoningOps.length > 0) {
1567
1562
  for (let i = parseErrors.length - 1; i >= 0; i--) {
1568
1563
  if (parseErrors[i].message === PlurnkParser.NO_VALID_OPERATION)
1569
1564
  parseErrors.splice(i, 1);
@@ -1576,7 +1571,7 @@ class TurnRunner {
1576
1571
  && !hasUnparsedTail && parseErrors.length === 0
1577
1572
  && assistant.finishReason !== "length";
1578
1573
  const emptyTurn = preParsedOps === undefined && operationCount === 0 && !hasUnparsedTail;
1579
- // {§unparsed-tail-boundary}: outside text and reasoning NOTEs are not operational work.
1574
+ // {§unparsed-tail-boundary}: outside text is not operational work.
1580
1575
  const emissionValid = fabrications.length === 0 && (preParsedOps !== undefined
1581
1576
  || emptyTurn
1582
1577
  || operationCount > 0);