@plurnk/plurnk-service 4.2.1 → 4.3.1

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 (448) hide show
  1. package/INSTALL.md +7 -2
  2. package/README.md +3 -1
  3. package/SPEC.md +1988 -1408
  4. package/dist/build-info.d.ts.map +1 -1
  5. package/dist/build-info.js +25 -3
  6. package/dist/build-info.js.map +1 -1
  7. package/dist/build-info.json +1 -1
  8. package/dist/completions/_plurnk-service +1 -1
  9. package/dist/completions/plurnk-service.bash +1 -1
  10. package/dist/completions/plurnk-service.fish +1 -0
  11. package/dist/content/body-preview.js.map +1 -1
  12. package/dist/content/byte-view.d.ts.map +1 -1
  13. package/dist/content/byte-view.js +3 -2
  14. package/dist/content/byte-view.js.map +1 -1
  15. package/dist/content/edit-collision.d.ts +2 -1
  16. package/dist/content/edit-collision.d.ts.map +1 -1
  17. package/dist/content/edit-collision.js.map +1 -1
  18. package/dist/content/edit-receipt.d.ts.map +1 -1
  19. package/dist/content/edit-receipt.js +28 -23
  20. package/dist/content/edit-receipt.js.map +1 -1
  21. package/dist/content/edited-span.js +1 -1
  22. package/dist/content/edited-span.js.map +1 -1
  23. package/dist/content/line-anchors.d.ts +3 -2
  24. package/dist/content/line-anchors.d.ts.map +1 -1
  25. package/dist/content/line-anchors.js +33 -19
  26. package/dist/content/line-anchors.js.map +1 -1
  27. package/dist/content/line-selection.js.map +1 -1
  28. package/dist/content/pattern-edits.js +1 -1
  29. package/dist/content/pattern-edits.js.map +1 -1
  30. package/dist/content/read-projector.d.ts +1 -1
  31. package/dist/content/read-projector.d.ts.map +1 -1
  32. package/dist/content/read-projector.js +10 -8
  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 +6 -5
  36. package/dist/content/read-resolve.js.map +1 -1
  37. package/dist/core/AdmittedTurnExecutor.d.ts +4 -4
  38. package/dist/core/AdmittedTurnExecutor.d.ts.map +1 -1
  39. package/dist/core/AdmittedTurnExecutor.js +20 -18
  40. package/dist/core/AdmittedTurnExecutor.js.map +1 -1
  41. package/dist/core/AmbientMembers.d.ts +1 -1
  42. package/dist/core/AmbientMembers.d.ts.map +1 -1
  43. package/dist/core/AmbientMembers.js +5 -2
  44. package/dist/core/AmbientMembers.js.map +1 -1
  45. package/dist/core/BareBatchRunner.d.ts +1 -1
  46. package/dist/core/BareBatchRunner.d.ts.map +1 -1
  47. package/dist/core/BareBatchRunner.js +2 -2
  48. package/dist/core/BareBatchRunner.js.map +1 -1
  49. package/dist/core/CapabilityPolicies.js.map +1 -1
  50. package/dist/core/CapabilityResolver.d.ts +1 -2
  51. package/dist/core/CapabilityResolver.d.ts.map +1 -1
  52. package/dist/core/CapabilityResolver.js +11 -7
  53. package/dist/core/CapabilityResolver.js.map +1 -1
  54. package/dist/core/ChannelWrite.d.ts +2 -2
  55. package/dist/core/ChannelWrite.d.ts.map +1 -1
  56. package/dist/core/ChannelWrite.js.map +1 -1
  57. package/dist/core/ChannelWrite.sql +27 -0
  58. package/dist/core/ClientInteractions.js.map +1 -1
  59. package/dist/core/ContextFit.js +1 -1
  60. package/dist/core/ContextFit.js.map +1 -1
  61. package/dist/core/CoreSchemeServices.d.ts.map +1 -1
  62. package/dist/core/CoreSchemeServices.js +4 -4
  63. package/dist/core/CoreSchemeServices.js.map +1 -1
  64. package/dist/core/DataStatementRunner.d.ts.map +1 -1
  65. package/dist/core/DataStatementRunner.js +15 -15
  66. package/dist/core/DataStatementRunner.js.map +1 -1
  67. package/dist/core/Dispatcher.d.ts +29 -5
  68. package/dist/core/Dispatcher.d.ts.map +1 -1
  69. package/dist/core/Dispatcher.js +210 -130
  70. package/dist/core/Dispatcher.js.map +1 -1
  71. package/dist/core/EditMutations.d.ts.map +1 -1
  72. package/dist/core/EditMutations.js +12 -6
  73. package/dist/core/EditMutations.js.map +1 -1
  74. package/dist/core/EditSequence.js.map +1 -1
  75. package/dist/core/Engine.d.ts +15 -7
  76. package/dist/core/Engine.d.ts.map +1 -1
  77. package/dist/core/Engine.js +32 -7
  78. package/dist/core/Engine.js.map +1 -1
  79. package/dist/core/ExecutionOutputs.js.map +1 -1
  80. package/dist/core/ExecutorRegistry.d.ts +1 -2
  81. package/dist/core/ExecutorRegistry.d.ts.map +1 -1
  82. package/dist/core/ExecutorRegistry.js +2 -2
  83. package/dist/core/ExecutorRegistry.js.map +1 -1
  84. package/dist/core/FileAddress.js.map +1 -1
  85. package/dist/core/FilePublication.d.ts.map +1 -1
  86. package/dist/core/FilePublication.js +6 -3
  87. package/dist/core/FilePublication.js.map +1 -1
  88. package/dist/core/FileSnapshot.d.ts.map +1 -1
  89. package/dist/core/FileSnapshot.js +8 -5
  90. package/dist/core/FileSnapshot.js.map +1 -1
  91. package/dist/core/KillHandler.d.ts.map +1 -1
  92. package/dist/core/KillHandler.js +7 -0
  93. package/dist/core/KillHandler.js.map +1 -1
  94. package/dist/core/LiveSubscription.d.ts +1 -0
  95. package/dist/core/LiveSubscription.d.ts.map +1 -1
  96. package/dist/core/LiveSubscription.js +3 -2
  97. package/dist/core/LiveSubscription.js.map +1 -1
  98. package/dist/core/LiveSubscriptions.d.ts +4 -1
  99. package/dist/core/LiveSubscriptions.d.ts.map +1 -1
  100. package/dist/core/LiveSubscriptions.js +42 -1
  101. package/dist/core/LiveSubscriptions.js.map +1 -1
  102. package/dist/core/LogBody.d.ts.map +1 -1
  103. package/dist/core/LogBody.js +22 -19
  104. package/dist/core/LogBody.js.map +1 -1
  105. package/dist/core/LogVisibility.d.ts +1 -1
  106. package/dist/core/LogVisibility.d.ts.map +1 -1
  107. package/dist/core/LogVisibility.js +4 -6
  108. package/dist/core/LogVisibility.js.map +1 -1
  109. package/dist/core/LogWriter.d.ts.map +1 -1
  110. package/dist/core/LogWriter.js +6 -9
  111. package/dist/core/LogWriter.js.map +1 -1
  112. package/dist/core/LoopDriver.d.ts +4 -4
  113. package/dist/core/LoopDriver.d.ts.map +1 -1
  114. package/dist/core/LoopDriver.js +4 -5
  115. package/dist/core/LoopDriver.js.map +1 -1
  116. package/dist/core/LoopLifecycle.d.ts +2 -0
  117. package/dist/core/LoopLifecycle.d.ts.map +1 -1
  118. package/dist/core/LoopLifecycle.js +13 -3
  119. package/dist/core/LoopLifecycle.js.map +1 -1
  120. package/dist/core/LoopLifecycle.sql +4 -4
  121. package/dist/core/LoopOutcome.d.ts.map +1 -1
  122. package/dist/core/LoopOutcome.js +2 -2
  123. package/dist/core/LoopOutcome.js.map +1 -1
  124. package/dist/core/MembershipMaterialization.d.ts.map +1 -1
  125. package/dist/core/MembershipMaterialization.js +29 -29
  126. package/dist/core/MembershipMaterialization.js.map +1 -1
  127. package/dist/core/MessageResources.d.ts +5 -1
  128. package/dist/core/MessageResources.d.ts.map +1 -1
  129. package/dist/core/MessageResources.js +12 -0
  130. package/dist/core/MessageResources.js.map +1 -1
  131. package/dist/core/MessageResources.sql +26 -0
  132. package/dist/core/MutationEffects.d.ts +1 -0
  133. package/dist/core/MutationEffects.d.ts.map +1 -1
  134. package/dist/core/MutationEffects.js +14 -10
  135. package/dist/core/MutationEffects.js.map +1 -1
  136. package/dist/core/OperationHistory.d.ts.map +1 -1
  137. package/dist/core/OperationHistory.js +4 -3
  138. package/dist/core/OperationHistory.js.map +1 -1
  139. package/dist/core/OperatorConfig.d.ts.map +1 -1
  140. package/dist/core/OperatorConfig.js +3 -2
  141. package/dist/core/OperatorConfig.js.map +1 -1
  142. package/dist/core/PacketBuilder.d.ts +3 -7
  143. package/dist/core/PacketBuilder.d.ts.map +1 -1
  144. package/dist/core/PacketBuilder.js +40 -31
  145. package/dist/core/PacketBuilder.js.map +1 -1
  146. package/dist/core/PacketBuilder.sql +11 -0
  147. package/dist/core/ProblemLog.d.ts +2 -5
  148. package/dist/core/ProblemLog.d.ts.map +1 -1
  149. package/dist/core/ProblemLog.js +2 -3
  150. package/dist/core/ProblemLog.js.map +1 -1
  151. package/dist/core/ProposalLifecycle.d.ts +12 -11
  152. package/dist/core/ProposalLifecycle.d.ts.map +1 -1
  153. package/dist/core/ProposalLifecycle.js +92 -84
  154. package/dist/core/ProposalLifecycle.js.map +1 -1
  155. package/dist/core/ReasoningEvent.d.ts +2 -0
  156. package/dist/core/ReasoningEvent.d.ts.map +1 -1
  157. package/dist/core/ReplyMetadata.d.ts.map +1 -1
  158. package/dist/core/ReplyMetadata.js +4 -3
  159. package/dist/core/ReplyMetadata.js.map +1 -1
  160. package/dist/core/ResourceBindings.d.ts +2 -2
  161. package/dist/core/ResourceBindings.d.ts.map +1 -1
  162. package/dist/core/ResourceBindings.js.map +1 -1
  163. package/dist/core/ResourceMutations.d.ts +1 -1
  164. package/dist/core/ResourceMutations.d.ts.map +1 -1
  165. package/dist/core/ResourceMutations.js +1 -2
  166. package/dist/core/ResourceMutations.js.map +1 -1
  167. package/dist/core/ResourceSelector.js +2 -2
  168. package/dist/core/ResourceSelector.js.map +1 -1
  169. package/dist/core/ResourceTransfers.d.ts.map +1 -1
  170. package/dist/core/ResourceTransfers.js +162 -120
  171. package/dist/core/ResourceTransfers.js.map +1 -1
  172. package/dist/core/SchemeRegistry.d.ts +6 -5
  173. package/dist/core/SchemeRegistry.d.ts.map +1 -1
  174. package/dist/core/SchemeRegistry.js +32 -26
  175. package/dist/core/SchemeRegistry.js.map +1 -1
  176. package/dist/core/ServiceHelp.d.ts.map +1 -1
  177. package/dist/core/ServiceHelp.js +2 -1
  178. package/dist/core/ServiceHelp.js.map +1 -1
  179. package/dist/core/StoredPacket.d.ts.map +1 -1
  180. package/dist/core/StoredPacket.js +26 -19
  181. package/dist/core/StoredPacket.js.map +1 -1
  182. package/dist/core/StrikeRail.d.ts +1 -2
  183. package/dist/core/StrikeRail.d.ts.map +1 -1
  184. package/dist/core/StrikeRail.js +4 -4
  185. package/dist/core/StrikeRail.js.map +1 -1
  186. package/dist/core/TerminalResult.d.ts +0 -2
  187. package/dist/core/TerminalResult.d.ts.map +1 -1
  188. package/dist/core/TerminalResult.js +0 -18
  189. package/dist/core/TerminalResult.js.map +1 -1
  190. package/dist/core/TokenCalibration.d.ts +4 -2
  191. package/dist/core/TokenCalibration.d.ts.map +1 -1
  192. package/dist/core/TokenCalibration.js +30 -13
  193. package/dist/core/TokenCalibration.js.map +1 -1
  194. package/dist/core/TokenCalibration.sql +7 -17
  195. package/dist/core/ToolResources.d.ts +2 -1
  196. package/dist/core/ToolResources.d.ts.map +1 -1
  197. package/dist/core/ToolResources.js +10 -34
  198. package/dist/core/ToolResources.js.map +1 -1
  199. package/dist/core/TurnDispositionHandler.d.ts +1 -1
  200. package/dist/core/TurnDispositionHandler.d.ts.map +1 -1
  201. package/dist/core/TurnDispositionHandler.js +7 -3
  202. package/dist/core/TurnDispositionHandler.js.map +1 -1
  203. package/dist/core/TurnMaterialization.d.ts.map +1 -1
  204. package/dist/core/TurnMaterialization.js +3 -2
  205. package/dist/core/TurnMaterialization.js.map +1 -1
  206. package/dist/core/TurnRunner.d.ts +13 -12
  207. package/dist/core/TurnRunner.d.ts.map +1 -1
  208. package/dist/core/TurnRunner.js +198 -230
  209. package/dist/core/TurnRunner.js.map +1 -1
  210. package/dist/core/TurnRunner.sql +3 -3
  211. package/dist/core/WorkerOwners.js.map +1 -1
  212. package/dist/core/caps/DbEntryCaps.js.map +1 -1
  213. package/dist/core/caps/DbMessageCaps.d.ts +3 -3
  214. package/dist/core/caps/DbMessageCaps.d.ts.map +1 -1
  215. package/dist/core/caps/DbProjectionCaps.js +1 -1
  216. package/dist/core/caps/DbProjectionCaps.js.map +1 -1
  217. package/dist/core/caps/DbSubscriptionCaps.d.ts.map +1 -1
  218. package/dist/core/caps/DbSubscriptionCaps.js +1 -0
  219. package/dist/core/caps/DbSubscriptionCaps.js.map +1 -1
  220. package/dist/core/caps/SchemeCtxImpl.d.ts.map +1 -1
  221. package/dist/core/caps/SchemeCtxImpl.js +4 -1
  222. package/dist/core/caps/SchemeCtxImpl.js.map +1 -1
  223. package/dist/core/env-catalog.js.map +1 -1
  224. package/dist/core/env-defaults.d.ts.map +1 -1
  225. package/dist/core/env-defaults.js +5 -3
  226. package/dist/core/env-defaults.js.map +1 -1
  227. package/dist/core/file-creation-policy.d.ts.map +1 -1
  228. package/dist/core/file-creation-policy.js +2 -1
  229. package/dist/core/file-creation-policy.js.map +1 -1
  230. package/dist/core/file-materialization.d.ts.map +1 -1
  231. package/dist/core/file-materialization.js +9 -11
  232. package/dist/core/file-materialization.js.map +1 -1
  233. package/dist/core/git-env.d.ts +1 -0
  234. package/dist/core/git-env.d.ts.map +1 -1
  235. package/dist/core/git-env.js +34 -3
  236. package/dist/core/git-env.js.map +1 -1
  237. package/dist/core/git-membership.d.ts +5 -0
  238. package/dist/core/git-membership.d.ts.map +1 -1
  239. package/dist/core/git-membership.js +55 -21
  240. package/dist/core/git-membership.js.map +1 -1
  241. package/dist/core/git-state.d.ts.map +1 -1
  242. package/dist/core/git-state.js +1 -0
  243. package/dist/core/git-state.js.map +1 -1
  244. package/dist/core/packet-wire.d.ts +26 -27
  245. package/dist/core/packet-wire.d.ts.map +1 -1
  246. package/dist/core/packet-wire.js +154 -132
  247. package/dist/core/packet-wire.js.map +1 -1
  248. package/dist/core/results.d.ts +9 -4
  249. package/dist/core/results.d.ts.map +1 -1
  250. package/dist/core/results.js +14 -1
  251. package/dist/core/results.js.map +1 -1
  252. package/dist/core/runtime-floor.d.ts +8 -0
  253. package/dist/core/runtime-floor.d.ts.map +1 -0
  254. package/dist/core/runtime-floor.js +40 -0
  255. package/dist/core/runtime-floor.js.map +1 -0
  256. package/dist/core/runtime-guard.d.ts +2 -0
  257. package/dist/core/runtime-guard.d.ts.map +1 -0
  258. package/dist/core/runtime-guard.js +5 -0
  259. package/dist/core/runtime-guard.js.map +1 -0
  260. package/dist/core/sqlite-synchronous.d.ts +1 -1
  261. package/dist/core/sqlite-synchronous.d.ts.map +1 -1
  262. package/dist/core/sqlite-synchronous.js.map +1 -1
  263. package/dist/core/statement-primary.d.ts +2 -2
  264. package/dist/core/statement-primary.d.ts.map +1 -1
  265. package/dist/core/statement-primary.js.map +1 -1
  266. package/dist/core/workspace-settings.js +1 -1
  267. package/dist/core/workspace-settings.js.map +1 -1
  268. package/dist/evidence/EvidenceReader.d.ts.map +1 -1
  269. package/dist/evidence/EvidenceReader.js +20 -6
  270. package/dist/evidence/EvidenceReader.js.map +1 -1
  271. package/dist/launch/Launch.d.ts +1 -0
  272. package/dist/launch/Launch.d.ts.map +1 -1
  273. package/dist/launch/Launch.js +28 -12
  274. package/dist/launch/Launch.js.map +1 -1
  275. package/dist/man/plurnk-service.1 +6 -2
  276. package/dist/schemes/EffectPolicy.js +1 -1
  277. package/dist/schemes/EffectPolicy.js.map +1 -1
  278. package/dist/schemes/Env.d.ts +1 -1
  279. package/dist/schemes/Env.d.ts.map +1 -1
  280. package/dist/schemes/Env.js +7 -1
  281. package/dist/schemes/Env.js.map +1 -1
  282. package/dist/schemes/Exec.d.ts +10 -12
  283. package/dist/schemes/Exec.d.ts.map +1 -1
  284. package/dist/schemes/Exec.js +337 -437
  285. package/dist/schemes/Exec.js.map +1 -1
  286. package/dist/schemes/ExecOutputScheme.d.ts +4 -6
  287. package/dist/schemes/ExecOutputScheme.d.ts.map +1 -1
  288. package/dist/schemes/ExecOutputScheme.js +17 -17
  289. package/dist/schemes/ExecOutputScheme.js.map +1 -1
  290. package/dist/schemes/ExecScheduler.d.ts.map +1 -1
  291. package/dist/schemes/ExecScheduler.js +1 -2
  292. package/dist/schemes/ExecScheduler.js.map +1 -1
  293. package/dist/schemes/ExecutionInput.js +3 -3
  294. package/dist/schemes/ExecutionInput.js.map +1 -1
  295. package/dist/schemes/File.d.ts +3 -18
  296. package/dist/schemes/File.d.ts.map +1 -1
  297. package/dist/schemes/File.js +136 -79
  298. package/dist/schemes/File.js.map +1 -1
  299. package/dist/schemes/Log.d.ts.map +1 -1
  300. package/dist/schemes/Log.js +193 -161
  301. package/dist/schemes/Log.js.map +1 -1
  302. package/dist/schemes/QuestionTool.d.ts.map +1 -1
  303. package/dist/schemes/QuestionTool.js +6 -8
  304. package/dist/schemes/QuestionTool.js.map +1 -1
  305. package/dist/schemes/ResourceTreeScheme.d.ts.map +1 -1
  306. package/dist/schemes/ResourceTreeScheme.js +2 -2
  307. package/dist/schemes/ResourceTreeScheme.js.map +1 -1
  308. package/dist/schemes/TurnSource.js +3 -3
  309. package/dist/schemes/TurnSource.js.map +1 -1
  310. package/dist/schemes/Worker.js.map +1 -1
  311. package/dist/schemes/_entry-crud.d.ts.map +1 -1
  312. package/dist/schemes/_entry-crud.js +4 -2
  313. package/dist/schemes/_entry-crud.js.map +1 -1
  314. package/dist/schemes/_entry-find.d.ts.map +1 -1
  315. package/dist/schemes/_entry-find.js +187 -139
  316. package/dist/schemes/_entry-find.js.map +1 -1
  317. package/dist/schemes/_entry-manifest.js +1 -1
  318. package/dist/schemes/_entry-manifest.js.map +1 -1
  319. package/dist/schemes/_entry-ops.js.map +1 -1
  320. package/dist/schemes/_search-index.js.map +1 -1
  321. package/dist/schemes/exec-entry-sink.d.ts +30 -0
  322. package/dist/schemes/exec-entry-sink.d.ts.map +1 -0
  323. package/dist/schemes/exec-entry-sink.js +238 -0
  324. package/dist/schemes/exec-entry-sink.js.map +1 -0
  325. package/dist/schemes/exec-lifetime.d.ts.map +1 -1
  326. package/dist/schemes/exec-lifetime.js +5 -2
  327. package/dist/schemes/exec-lifetime.js.map +1 -1
  328. package/dist/server/ClientOperations.d.ts +45 -0
  329. package/dist/server/ClientOperations.d.ts.map +1 -0
  330. package/dist/server/ClientOperations.js +192 -0
  331. package/dist/server/ClientOperations.js.map +1 -0
  332. package/dist/server/ClientReads.d.ts +13 -5
  333. package/dist/server/ClientReads.d.ts.map +1 -1
  334. package/dist/server/ClientReads.js +108 -21
  335. package/dist/server/ClientReads.js.map +1 -1
  336. package/dist/server/Credentials.js +2 -2
  337. package/dist/server/Credentials.js.map +1 -1
  338. package/dist/server/Daemon.d.ts +40 -28
  339. package/dist/server/Daemon.d.ts.map +1 -1
  340. package/dist/server/Daemon.js +255 -839
  341. package/dist/server/Daemon.js.map +1 -1
  342. package/dist/server/DaemonLock.d.ts +2 -0
  343. package/dist/server/DaemonLock.d.ts.map +1 -1
  344. package/dist/server/DaemonLock.js +10 -1
  345. package/dist/server/DaemonLock.js.map +1 -1
  346. package/dist/server/DaemonModules.d.ts +39 -0
  347. package/dist/server/DaemonModules.d.ts.map +1 -0
  348. package/dist/server/DaemonModules.js +219 -0
  349. package/dist/server/DaemonModules.js.map +1 -0
  350. package/dist/server/DrainSupervisor.d.ts +4 -2
  351. package/dist/server/DrainSupervisor.d.ts.map +1 -1
  352. package/dist/server/DrainSupervisor.js +318 -290
  353. package/dist/server/DrainSupervisor.js.map +1 -1
  354. package/dist/server/EnvFunctionality.d.ts +10 -7
  355. package/dist/server/EnvFunctionality.d.ts.map +1 -1
  356. package/dist/server/EnvFunctionality.js +6 -5
  357. package/dist/server/EnvFunctionality.js.map +1 -1
  358. package/dist/server/Functionality.d.ts +8 -6
  359. package/dist/server/Functionality.d.ts.map +1 -1
  360. package/dist/server/Functionality.js +110 -32
  361. package/dist/server/Functionality.js.map +1 -1
  362. package/dist/server/FunctionalityManager.d.ts.map +1 -1
  363. package/dist/server/FunctionalityManager.js +16 -2
  364. package/dist/server/FunctionalityManager.js.map +1 -1
  365. package/dist/server/HttpListener.d.ts.map +1 -1
  366. package/dist/server/HttpListener.js +28 -8
  367. package/dist/server/HttpListener.js.map +1 -1
  368. package/dist/server/MembersFunctionality.d.ts +19 -7
  369. package/dist/server/MembersFunctionality.d.ts.map +1 -1
  370. package/dist/server/MembersFunctionality.js +30 -16
  371. package/dist/server/MembersFunctionality.js.map +1 -1
  372. package/dist/server/MessageDelivery.d.ts +43 -0
  373. package/dist/server/MessageDelivery.d.ts.map +1 -0
  374. package/dist/server/MessageDelivery.js +186 -0
  375. package/dist/server/MessageDelivery.js.map +1 -0
  376. package/dist/server/ModuleHost.d.ts +3 -3
  377. package/dist/server/ModuleHost.d.ts.map +1 -1
  378. package/dist/server/Places.d.ts +19 -0
  379. package/dist/server/Places.d.ts.map +1 -0
  380. package/dist/server/Places.js +76 -0
  381. package/dist/server/Places.js.map +1 -0
  382. package/dist/server/PluginSources.d.ts.map +1 -1
  383. package/dist/server/PluginSources.js +2 -1
  384. package/dist/server/PluginSources.js.map +1 -1
  385. package/dist/server/PlurnkSkill.d.ts.map +1 -1
  386. package/dist/server/PlurnkSkill.js +5 -4
  387. package/dist/server/PlurnkSkill.js.map +1 -1
  388. package/dist/server/Rollback.d.ts.map +1 -1
  389. package/dist/server/Rollback.js +2 -1
  390. package/dist/server/Rollback.js.map +1 -1
  391. package/dist/server/WorkerModels.d.ts +87 -0
  392. package/dist/server/WorkerModels.d.ts.map +1 -0
  393. package/dist/server/WorkerModels.js +540 -0
  394. package/dist/server/WorkerModels.js.map +1 -0
  395. package/dist/server/WorkerOverview.d.ts +22 -0
  396. package/dist/server/WorkerOverview.d.ts.map +1 -0
  397. package/dist/server/WorkerOverview.js +42 -0
  398. package/dist/server/WorkerOverview.js.map +1 -0
  399. package/dist/server/WorkspacePlugins.d.ts +1 -1
  400. package/dist/server/WorkspacePlugins.d.ts.map +1 -1
  401. package/dist/server/WorkspacePlugins.js +0 -1
  402. package/dist/server/WorkspacePlugins.js.map +1 -1
  403. package/dist/server/WorkspaceResidency.d.ts +3 -3
  404. package/dist/server/WorkspaceResidency.d.ts.map +1 -1
  405. package/dist/server/WorkspaceResidency.js.map +1 -1
  406. package/dist/server/client-input.d.ts +2 -2
  407. package/dist/server/client-input.d.ts.map +1 -1
  408. package/dist/server/client-input.js +19 -12
  409. package/dist/server/client-input.js.map +1 -1
  410. package/dist/server/envelope.d.ts +4 -1
  411. package/dist/server/envelope.d.ts.map +1 -1
  412. package/dist/server/envelope.js +7 -3
  413. package/dist/server/envelope.js.map +1 -1
  414. package/dist/server/envelope.sql +10 -6
  415. package/dist/server/logEntry.d.ts +38 -1
  416. package/dist/server/logEntry.d.ts.map +1 -1
  417. package/dist/server/logEntry.js +9 -9
  418. package/dist/server/logEntry.js.map +1 -1
  419. package/dist/server/logEntry.sql +4 -2
  420. package/dist/server/loopDocs.d.ts.map +1 -1
  421. package/dist/server/loopDocs.js +11 -2
  422. package/dist/server/loopDocs.js.map +1 -1
  423. package/dist/server/module-discovery.d.ts +2 -3
  424. package/dist/server/module-discovery.d.ts.map +1 -1
  425. package/dist/server/module-discovery.js +6 -6
  426. package/dist/server/module-discovery.js.map +1 -1
  427. package/dist/server/places.sql +83 -0
  428. package/dist/server/seam-loop.sql +8 -0
  429. package/dist/server/worker-overview.sql +57 -0
  430. package/dist/service.d.ts +1 -0
  431. package/dist/service.d.ts.map +1 -1
  432. package/dist/service.js +35 -9
  433. package/dist/service.js.map +1 -1
  434. package/docs/members.md +11 -21
  435. package/migrations/033_hidden_places.sql +10 -0
  436. package/package.json +52 -61
  437. package/dist/core/ToolInputSchema.d.ts +0 -7
  438. package/dist/core/ToolInputSchema.d.ts.map +0 -1
  439. package/dist/core/ToolInputSchema.js +0 -65
  440. package/dist/core/ToolInputSchema.js.map +0 -1
  441. package/dist/observe/init.d.ts +0 -8
  442. package/dist/observe/init.d.ts.map +0 -1
  443. package/dist/observe/init.js +0 -163
  444. package/dist/observe/init.js.map +0 -1
  445. package/dist/server/WorkerModelResolver.d.ts +0 -20
  446. package/dist/server/WorkerModelResolver.d.ts.map +0 -1
  447. package/dist/server/WorkerModelResolver.js +0 -200
  448. package/dist/server/WorkerModelResolver.js.map +0 -1
@@ -7,7 +7,7 @@
7
7
  // Format and omission rules are owned by {§packet-markdown}. Section producers
8
8
  // supply names and typed content; this projection preserves their ordered evidence.
9
9
  import { relative, sep } from "node:path";
10
- import { Problems, Validator } from "@plurnk/plurnk-contracts";
10
+ import { Problems, Validator, isRecord, isSafeInteger, isExecutionOp } from "@plurnk/plurnk-contracts";
11
11
  import { TextCoordinates } from "@plurnk/plurnk-mimetypes";
12
12
  import BodyPreview from "../content/body-preview.js";
13
13
  import { renderAuthoredTarget, renderTarget } from "./plurnk-uri.js";
@@ -21,7 +21,6 @@ import { Results as SchemeResults } from "@plurnk/plurnk-schemes";
21
21
  import { assertEditReceipt, assertResourceEffects, LineAnchors, } from "../content/index.js";
22
22
  // {§packet-attachment-parts} — the attachment kinds and their readout weights live in one table.
23
23
  import { audioWeight, imageWeight, pdfWeight } from "./attachments.js";
24
- import { isExecutionOp } from "@plurnk/plurnk-contracts";
25
24
  export default class PacketWire {
26
25
  // {§packet-markdown} Render the sections in `slot` to one ChatMessage.content
27
26
  // string. Sections render in list order; empties are omitted (no empty headers on the wire);
@@ -47,17 +46,13 @@ export default class PacketWire {
47
46
  // Durable operation failures render as `{status, path}` JSON pointers to the log rows that
48
47
  // own their exact RFC 9457 results.
49
48
  static renderFailurePointers(failures) {
50
- const rows = Array.isArray(failures) ? failures : [];
51
- const pointers = rows
52
- .filter((row) => typeof row.status === "number" && typeof row.coordinate === "string")
53
- .map((row) => JSON.stringify({ status: row.status, path: `log:///${row.coordinate}` }));
49
+ const pointers = failures.map((row) => JSON.stringify({ status: row.status, path: `log:///${row.coordinate}` }));
54
50
  return pointers.length === 0 ? "" : `[${pointers.join(",\n")}]`;
55
51
  }
56
52
  // {§notice-callout} — non-terminal observations, deliberately separate from operation failures, in the
57
53
  // card's own callout form: the level picks the callout, the directive leads, the fact follows, the kind closes.
58
54
  static renderNotices(notices) {
59
- const observations = Array.isArray(notices) ? notices : [];
60
- return observations.map((notice) => {
55
+ return notices.map((notice) => {
61
56
  const kind = typeof notice.kind === "string" ? notice.kind : "notice";
62
57
  const callout = notice.level === "error" ? "CAUTION" : notice.level === "warn" ? "WARNING" : "NOTE";
63
58
  const text = [notice.directive, notice.message]
@@ -82,8 +77,7 @@ export default class PacketWire {
82
77
  return `{"workers":${PacketWire.#pointers(workers)},\n"streams":${PacketWire.#pointers(streams)},\n"messages":${PacketWire.#pointers(messages)}}`;
83
78
  }
84
79
  static #pointers(rows) {
85
- const items = Array.isArray(rows) ? rows : [];
86
- const pointers = items.map((r) => JSON.stringify({
80
+ const pointers = rows.map((r) => JSON.stringify({
87
81
  status: r.status,
88
82
  path: r.path,
89
83
  ...(typeof r.detail === "string" && r.detail.length > 0 ? { detail: r.detail } : {}),
@@ -97,7 +91,7 @@ export default class PacketWire {
97
91
  }
98
92
  // The git section content: the working-tree summary. "" when absent.
99
93
  static renderGit(git) {
100
- const status = git === null || git === undefined ? "" : PacketWire.#renderGitState(git);
94
+ const status = git === null ? "" : PacketWire.#renderGitState(git);
101
95
  return status.length === 0 ? "" : `> [!NOTE]\n${status.split("\n").map((line) => `> ${line}`).join("\n")}`;
102
96
  }
103
97
  // The log section's content: the model's curated rows as Markdown-framed records ({§log-wire-format}).
@@ -109,17 +103,15 @@ export default class PacketWire {
109
103
  // {§context-gauge} — the wire row and its reclaimable-body accounting come from one render
110
104
  // pass; packet assembly never re-parses its text.
111
105
  static renderLogWithAccounting(entries, weighContent, options = {}) {
112
- const log = Array.isArray(entries) ? entries : [];
113
- if (log.length === 0)
114
- return { content: "", records: [], curationTargets: [], attachments: [], bodied: [] };
115
- const rows = PacketWire.#renderLogEntries(log, weighContent, options);
106
+ if (entries.length === 0)
107
+ return { content: "", records: [], curationTargets: [], attachments: [] };
108
+ const rows = PacketWire.#renderLogEntries(entries, weighContent, options);
116
109
  const records = rows.map(({ content }) => content);
117
110
  return {
118
111
  content: records.join("\n\n"),
119
112
  records,
120
113
  curationTargets: rows.flatMap(({ curationTarget }) => curationTarget === null ? [] : [curationTarget]),
121
114
  attachments: rows.flatMap(({ attachment }) => attachment === null ? [] : [attachment]),
122
- bodied: rows.flatMap(({ bodied }) => bodied === null ? [] : [bodied]),
123
115
  };
124
116
  }
125
117
  // Read one section's content by name off a packet (Engine's or re-parsed).
@@ -236,7 +228,7 @@ export default class PacketWire {
236
228
  }
237
229
  // {§log-wire-format} Orientation precedes telemetry on every receipt.
238
230
  static #canonicalJson(obj) {
239
- return JSON.stringify(Object.fromEntries(Object.keys(obj).sort().map((key) => [key, obj[key]])));
231
+ return JSON.stringify(Object.fromEntries(Object.keys(obj).toSorted().map((key) => [key, obj[key]])));
240
232
  }
241
233
  static #receiptMeta(value) {
242
234
  const receipt = assertEditReceipt(value);
@@ -317,7 +309,7 @@ export default class PacketWire {
317
309
  if (e.op !== "SEND" || e.origin !== "_plurnk")
318
310
  return false;
319
311
  const attrs = typeof e.attrs === "string" ? JSON.parse(e.attrs) : e.attrs;
320
- return attrs !== null && typeof attrs === "object" && attrs.kind === "message";
312
+ return isRecord(attrs) && attrs.kind === "message";
321
313
  }
322
314
  // {§markerless-first-page} — a body the model did not author or ask for exactly takes its first page in
323
315
  // the packet: not the model's own row, not a retrieval (paged at its source), not an emission row,
@@ -412,7 +404,8 @@ export default class PacketWire {
412
404
  return entries.map((e, index) => {
413
405
  const identity = PacketWire.#rowIdentity(e, options);
414
406
  // Parse rx once — reused for the matcher/items enrichment and the body.
415
- const rx = (typeof e.rx === "string" ? PacketWire.#safeParse(e.rx) : e.rx);
407
+ const parsedRx = typeof e.rx === "string" ? PacketWire.#safeParse(e.rx) : e.rx;
408
+ const rx = isRecord(parsedRx) ? parsedRx : null;
416
409
  const facts = PacketWire.#rowResultFacts(identity, e, rx, bodies[index]);
417
410
  const paired = options.paired?.has(String(e.coordinate)) ?? false;
418
411
  const projected = paired && bodies[index].provenance === "authored"
@@ -423,22 +416,23 @@ export default class PacketWire {
423
416
  }
424
417
  static #attrsOf(e) {
425
418
  const attrs = typeof e.attrs === "string" ? PacketWire.#safeParse(e.attrs) : e.attrs;
426
- return attrs !== null && typeof attrs === "object" && !Array.isArray(attrs) ? attrs : {};
419
+ return isRecord(attrs) ? attrs : {};
427
420
  }
428
421
  // One stored log row as the renderer sees it: the durable columns decoded once, a transient
429
422
  // open row rendered open ({§invalid-emission-attempts}).
430
423
  static entryView(r, transientOpenLogEntryId = null) {
431
- const tx = (r.mimetype_tx === "application/json" ? JSON.parse(r.tx) : r.tx);
424
+ const parsedTx = r.mimetype_tx === "application/json" ? JSON.parse(r.tx) : r.tx;
425
+ const tx = isRecord(parsedTx) ? parsedTx : typeof parsedTx === "string" ? parsedTx : null;
432
426
  const rx = r.mimetype_rx === "application/json" ? JSON.parse(r.rx) : r.rx;
433
427
  // {§context-fit} — a READ row's anchors ride with its lines whatever its status: a receipt that
434
428
  // carries a prefix carries the prefix's anchors.
435
- const readResult = LogEntryProjection.op(r) === "READ" && rx !== null && typeof rx === "object" && typeof rx.content === "string";
436
- const rawLineAnchors = readResult && Object.hasOwn(rx, "lineAnchors") ? rx.lineAnchors : undefined;
437
- if (rawLineAnchors !== undefined && !Array.isArray(rawLineAnchors)) {
438
- throw new TypeError("A READ result's lineAnchors field must be an array.");
429
+ const readResult = LogEntryProjection.op(r) === "READ" && isRecord(rx) && typeof rx.content === "string" ? rx : null;
430
+ const rawLineAnchors = readResult !== null && Object.hasOwn(readResult, "lineAnchors") ? readResult.lineAnchors : undefined;
431
+ if (rawLineAnchors !== undefined && !(Array.isArray(rawLineAnchors) && rawLineAnchors.every((anchor) => typeof anchor === "string"))) {
432
+ throw new TypeError("A READ result's lineAnchors field must be an array of strings.");
439
433
  }
440
434
  const lineAnchors = rawLineAnchors;
441
- const rawLineNumberWidth = readResult && Object.hasOwn(rx, "lineNumberWidth") ? rx.lineNumberWidth : undefined;
435
+ const rawLineNumberWidth = readResult !== null && Object.hasOwn(readResult, "lineNumberWidth") ? readResult.lineNumberWidth : undefined;
442
436
  if (rawLineNumberWidth !== undefined && !LineAnchors.isLineNumberWidth(rawLineNumberWidth)) {
443
437
  throw new TypeError("A READ result's lineNumberWidth field must be a valid decimal line width.");
444
438
  }
@@ -502,16 +496,16 @@ export default class PacketWire {
502
496
  // subsystem token when present; absence means the owning worker.
503
497
  // {§message-short-identity} an arrival whose source is the transport's own name for it adds
504
498
  // nothing to its address; a peer's or an agent's source still shows.
505
- const arrivalAttrs = typeof e.attrs === "string" ? PacketWire.#safeParse(e.attrs) : e.attrs;
506
- const selfAddressed = arrivalAttrs !== null && typeof arrivalAttrs === "object" && arrivalAttrs.selfAddressed === true;
499
+ const attrs = PacketWire.#attrsOf(e);
500
+ const selfAddressed = attrs.selfAddressed === true;
507
501
  if (typeof e.source === "string" && e.source.length > 0 && !selfAddressed)
508
502
  meta.source = e.source;
509
503
  // {§message-causal-source}: every other sender has an address; the operator's message is named
510
504
  // for the model, or it reads as the model's own SEND.
511
505
  if (PacketWire.isArrival(e) && meta.source === undefined)
512
506
  meta.origin = "user";
513
- if (e.source === "file" && e.attrs !== null && typeof e.attrs === "object" && "git" in e.attrs) {
514
- const git = e.attrs.git;
507
+ if (e.source === "file" && Object.hasOwn(attrs, "git")) {
508
+ const git = attrs.git;
515
509
  if (typeof git !== "string" || git.length !== 2) {
516
510
  throw new TypeError("A source=file log row carries malformed Git XY metadata.");
517
511
  }
@@ -520,19 +514,20 @@ export default class PacketWire {
520
514
  // {§log-wire-format}: routine success is implicit, independently of the operation.
521
515
  if (typeof e.status === "number" && e.status !== 200)
522
516
  meta.status = e.status;
523
- const tx = (typeof e.tx === "string" ? PacketWire.#safeParse(e.tx) : e.tx);
517
+ const parsedTx = typeof e.tx === "string" ? PacketWire.#safeParse(e.tx) : e.tx;
518
+ const tx = isRecord(parsedTx) ? parsedTx : null;
524
519
  const replay = options.paired?.get(String(e.coordinate));
525
520
  const paired = replay !== undefined;
526
521
  if (!paired && typeof tx?.aside === "string")
527
522
  meta.aside = tx.aside;
528
- const authored = tx?.target;
529
- const target = PacketWire.#operandPath(e.target ?? authored, options.projectRoot ?? null, authored ?? null);
523
+ const authored = PacketWire.#authoredPath(tx?.target);
524
+ const target = PacketWire.#operandPath(e.target ?? PacketWire.#actionTarget(tx?.target), options.projectRoot ?? null, authored);
530
525
  const pair = op === "COPY" || op === "MOVE";
531
526
  const selections = pair
532
- ? [tx?.source, tx?.destination]
527
+ ? [PacketWire.#selection(tx?.source), PacketWire.#selection(tx?.destination)]
533
528
  : [{ ...tx, target: e.target ?? tx?.target }];
534
- const paths = selections.map((selection) => PacketWire.#operandPath(selection?.target, options.projectRoot ?? null, authored ?? null));
535
- if (pair && typeof e.status === "number" && e.status < 400 && paths.some((path) => path === null)) {
529
+ const paths = selections.map((selection) => PacketWire.#operandPath(PacketWire.#actionTarget(selection?.target), options.projectRoot ?? null, authored));
530
+ if (pair && typeof e.status === "number" && e.status < 400 && paths.some((candidate) => candidate === null)) {
536
531
  throw new Error(`A successful ${op} log row must retain both operand selections.`);
537
532
  }
538
533
  for (const field of ["scope", "metadata"]) {
@@ -540,45 +535,39 @@ export default class PacketWire {
540
535
  continue;
541
536
  const values = selections.map((selection) => field === "scope"
542
537
  ? PacketWire.#requestScope(selection?.lineMarker)
543
- : selection?.metadata?.length ? selection.metadata : null);
538
+ : PacketWire.#metadata(selection?.metadata));
544
539
  if (pair) {
545
- const paired = Object.fromEntries(values.flatMap((value, index) => value === null ? [] : [[index === 0 ? "from" : "to", value]]));
546
- if (Object.keys(paired).length > 0)
547
- meta[field] = paired;
540
+ const pairedValues = Object.fromEntries(values.flatMap((value, index) => value === null ? [] : [[index === 0 ? "from" : "to", value]]));
541
+ if (Object.keys(pairedValues).length > 0)
542
+ meta[field] = pairedValues;
548
543
  }
549
544
  else if (values[0] !== null)
550
545
  meta[field] = values[0];
551
546
  }
552
547
  // {§log-wire-format}: describe resources and patterns directly; never serialize an OP.
553
548
  const parts = selections.flatMap((selection, index) => {
554
- const pattern = selection?.matcher?.raw;
549
+ const matcher = selection?.matcher;
550
+ const pattern = isRecord(matcher) ? matcher.raw : undefined;
555
551
  return [
556
552
  ...(paths[index] === null ? [] : [`→ ${paths[index]}`]),
557
553
  ...(typeof pattern !== "string" || pattern.length === 0 ? []
558
554
  : [/[\r\n]/u.test(pattern) ? JSON.stringify(pattern) : pattern]),
559
555
  ];
560
556
  });
561
- const request = replay?.statement;
562
- const requestedSelections = request === undefined ? [] : request.op === "COPY" || request.op === "MOVE"
563
- ? [request.source, request.destination] : [request];
564
- const resolved = paired && paths.some((path, index) => {
565
- const selection = requestedSelections[index];
566
- const requested = selection !== undefined && "target" in selection ? selection.target : null;
567
- return path !== PacketWire.#operandPath(requested, options.projectRoot ?? null, requested);
568
- });
557
+ // {§paired-receipt}: every receipt names its operand; a paired one leaves its pattern to the replayed operation.
558
+ const operands = paths.filter((candidate) => candidate !== null).map((candidate) => `→ ${candidate}`).join(" ");
569
559
  const description = op === "error" || op === "extension" || parts.length === 0 ? null
570
- : !paired ? parts.join(" ") : resolved ? paths.filter((path) => path !== null).map((path) => `→ ${path}`).join(" ") : null;
560
+ : !paired ? parts.join(" ") : operands.length > 0 ? operands : null;
571
561
  // {§worker-auto-name} The created identity is an outcome, not an authored target.
572
- if ((op === "WORK" || op === "FORK") && e.attrs !== null && typeof e.attrs === "object"
573
- && typeof e.attrs.worker === "string") {
574
- meta.worker = e.attrs.worker;
562
+ if ((op === "WORK" || op === "FORK") && typeof attrs.worker === "string") {
563
+ meta.worker = attrs.worker;
575
564
  // {§worker-scheme-spawn} — a WORK that reached a worker the name already held says so.
576
- if (e.attrs.delivered === "message")
565
+ if (attrs.delivered === "message")
577
566
  meta.delivered = "message";
578
567
  }
579
568
  // {§worker-wait-timing} — the accepted bound, not elapsed time or the current configuration.
580
- if (op === "WAIT" && e.attrs !== null && typeof e.attrs === "object" && "waiting" in e.attrs) {
581
- const seconds = e.attrs.waiting;
569
+ if (op === "WAIT" && Object.hasOwn(attrs, "waiting")) {
570
+ const seconds = attrs.waiting;
582
571
  if (typeof seconds !== "number" || !Number.isFinite(seconds) || seconds < 0) {
583
572
  throw new TypeError("A WAIT receipt carries a malformed waiting bound.");
584
573
  }
@@ -588,21 +577,21 @@ export default class PacketWire {
588
577
  // `stream` link, distinct from the runtime-owned invocation target.
589
578
  // {§exec-target-routing} {§fs-namespace} — the receipt names the working directory only
590
579
  // when it is not the project root, and then in project-relative form.
591
- if (isExecutionOp(op) && e.attrs !== null && typeof e.attrs === "object" && typeof e.attrs.cwd === "string") {
592
- const cwd = PacketWire.#projectRelativeCwd(e.attrs.cwd, options.projectRoot ?? null);
580
+ if (isExecutionOp(op) && typeof attrs.cwd === "string") {
581
+ const cwd = PacketWire.#projectRelativeCwd(attrs.cwd, options.projectRoot ?? null);
593
582
  if (cwd !== null)
594
583
  meta.cwd = cwd;
595
584
  }
596
- if (isExecutionOp(op) && e.attrs !== null && typeof e.attrs === "object" && typeof e.attrs.stream === "string") {
597
- meta.stream = e.attrs.stream;
585
+ if (isExecutionOp(op) && typeof attrs.stream === "string") {
586
+ meta.stream = attrs.stream;
598
587
  }
599
588
  return { meta, op, tx, coordinate, path, renderedLeaf, target, description };
600
589
  }
601
- // The row's result facts from its rx: the terminal stream's exit, the Problem or detail, the
602
- // matcher, the retrieval extents, and the structured mutation receipts. Returns what the body
603
- // projection needs to know about the result.
590
+ // The row's result facts from its rx, added to the metadata line stage by stage: the attachments and the
591
+ // returned address, the terminal stream's exit, the Problem or detail, the retrieval extents, and the
592
+ // structured mutation receipts. Returns what the body projection needs to know about the result.
604
593
  static #rowResultFacts(identity, e, rx, fullBody) {
605
- const { meta, op, tx } = identity;
594
+ const { meta, op } = identity;
606
595
  if (op === "SEND" && rx !== null && typeof rx === "object" && Array.isArray(rx.attachments) && rx.attachments.length > 0) {
607
596
  meta.attachments = rx.attachments.map(({ name, mediaType, target }) => ({ name, mediaType, path: target }));
608
597
  }
@@ -611,8 +600,19 @@ export default class PacketWire {
611
600
  && rx.resource.length > 0 && rx.resource !== identity.target && rx.resource !== meta.stream) {
612
601
  meta.resource = rx.resource;
613
602
  }
614
- // {§exec-stream}: explicit and automatic READs preserve the same
615
- // durable liveness facts, including an empty active channel.
603
+ PacketWire.#streamReadFacts(meta, op, rx);
604
+ PacketWire.#problemFacts(identity, e, rx);
605
+ const { findItems, range } = PacketWire.#retrievalFacts(identity, e, rx, fullBody);
606
+ const structuredMutationReceipt = PacketWire.#mutationReceiptFacts(meta, op, rx);
607
+ return {
608
+ findItems, range, structuredMutationReceipt,
609
+ ...(op === "READ" && rx?.matches !== undefined
610
+ ? { matches: SchemeResults.assertMatchEvidenceList(rx.matches) } : {}),
611
+ };
612
+ }
613
+ // {§exec-stream}: explicit and automatic READs preserve the same
614
+ // durable liveness facts, including an empty active channel.
615
+ static #streamReadFacts(meta, op, rx) {
616
616
  if (op === "READ" && rx !== null && typeof rx === "object" && Object.hasOwn(rx, "terminal")) {
617
617
  if (typeof rx.terminal !== "boolean") {
618
618
  throw new TypeError("A stream READ result carries a malformed terminal flag.");
@@ -627,36 +627,39 @@ export default class PacketWire {
627
627
  // {§executor-page-receipt} — a producer's full-page fact survives projection as written.
628
628
  if (Object.hasOwn(rx, "page")) {
629
629
  const page = rx.page;
630
- if (page === null || typeof page !== "object" || !Number.isSafeInteger(page.size) || !Number.isSafeInteger(page.returned)) {
630
+ if (!isRecord(page) || !isSafeInteger(page.size) || !isSafeInteger(page.returned)) {
631
631
  throw new TypeError("A stream READ result carries a malformed page.");
632
632
  }
633
633
  meta.page = { size: page.size, returned: page.returned };
634
634
  }
635
635
  }
636
- // {§problem-projection} — the exact durable Problem remains the
637
- // failure authority; the packet carries only facts not already
638
- // owned by its enclosing row. Errors remains only an index.
636
+ }
637
+ // {§problem-projection} — the exact durable Problem remains the
638
+ // failure authority; the packet carries only facts not already
639
+ // owned by its enclosing row. Errors remains only an index.
640
+ // The success-side sibling (#342): a sub-problem receipt may carry one
641
+ // terse `detail` (e.g. the EDIT 304) so situational teaching is paid
642
+ // only when the situation occurs, never in the hot path.
643
+ static #problemFacts(identity, e, rx) {
644
+ const { meta } = identity;
639
645
  if (typeof e.status === "number" && e.status >= 400 && rx !== null && typeof rx === "object") {
640
- const problem = rx.problem;
641
- Validator.assertProblemDetails(problem);
646
+ const problem = Validator.assertProblemDetails(rx.problem);
642
647
  meta.problem = Problems.project(problem, {
643
648
  status: e.status,
644
649
  row: { ...meta, target: identity.target },
645
650
  });
646
651
  }
647
- // The success-side sibling (#342): a sub-problem receipt may carry one
648
- // terse `detail` (e.g. the EDIT 304) so situational teaching is paid
649
- // only when the situation occurs, never in the hot path.
650
- if (!Object.hasOwn(meta, "problem") && rx !== null && typeof rx === "object"
651
- && typeof rx.detail === "string"
652
- && rx.detail.length > 0) {
652
+ if (!Object.hasOwn(meta, "problem") && rx !== null && typeof rx.detail === "string" && rx.detail.length > 0) {
653
653
  meta.detail = rx.detail;
654
654
  }
655
- // {§retrieval-packet-metadata}: one extent/coordinate owner plus
656
- // only FIND aggregates that add information beyond that extent.
655
+ }
656
+ // {§retrieval-packet-metadata}: one extent/coordinate owner plus
657
+ // only FIND aggregates that add information beyond that extent.
658
+ static #retrievalFacts(identity, e, rx, fullBody) {
659
+ const { meta, op, tx } = identity;
657
660
  let findItems = null;
658
661
  let range = null;
659
- const patterned = tx !== null && tx !== undefined && typeof tx === "object" && tx.matcher !== null && typeof tx.matcher === "object" && typeof tx.matcher.raw === "string";
662
+ const patterned = tx !== null && tx !== undefined && typeof tx === "object" && isRecord(tx.matcher) && typeof tx.matcher.raw === "string";
660
663
  if (patterned && op !== "FIND" && rx !== null && typeof rx === "object" && typeof rx.matched === "number")
661
664
  meta.matched = rx.matched;
662
665
  // {§channel-selection-visibility} — a READ names the resource's other channels with their
@@ -677,13 +680,10 @@ export default class PacketWire {
677
680
  range = rx !== null && typeof rx === "object" && rx.range !== undefined
678
681
  ? Validator.assertRangeExtent(rx.range)
679
682
  : null;
680
- const problemOwnsRange = typeof e.status === "number"
681
- && e.status >= 400
682
- && meta.problem !== null
683
- && typeof meta.problem === "object"
684
- && Object.hasOwn(meta.problem, "range");
683
+ const problem = isRecord(meta.problem) ? meta.problem : null;
684
+ const problemOwnsRange = typeof e.status === "number" && e.status >= 400 && problem !== null && Object.hasOwn(problem, "range");
685
685
  if (problemOwnsRange) {
686
- Validator.assertRangeExtent(meta.problem.range);
686
+ Validator.assertRangeExtent(problem?.range);
687
687
  delete meta.scope;
688
688
  }
689
689
  if (range !== null && !problemOwnsRange) {
@@ -722,9 +722,12 @@ export default class PacketWire {
722
722
  meta.matchLocationCount = rx.matchLocationCount;
723
723
  }
724
724
  }
725
- // {§edit-result-receipt-projection} {§edit-result-copy-move-effects}
726
- // EDIT/scoped entry KILL own one receipt; COPY/MOVE own resource effects whose
727
- // optional receipts describe scoped textual materializations.
725
+ return { findItems, range };
726
+ }
727
+ // {§edit-result-receipt-projection} {§edit-result-copy-move-effects}
728
+ // EDIT/scoped entry KILL own one receipt; COPY/MOVE own resource effects whose
729
+ // optional receipts describe scoped textual materializations.
730
+ static #mutationReceiptFacts(meta, op, rx) {
728
731
  let structuredMutationReceipt = false;
729
732
  if ((op === "EDIT" || op === "KILL") && rx !== null && typeof rx === "object" && Object.hasOwn(rx, "receipt")) {
730
733
  Object.assign(meta, PacketWire.#receiptMeta(rx.receipt));
@@ -744,11 +747,7 @@ export default class PacketWire {
744
747
  }));
745
748
  structuredMutationReceipt = effects.some((effect) => effect.receipt !== undefined);
746
749
  }
747
- return {
748
- findItems, range, structuredMutationReceipt,
749
- ...(op === "READ" && rx?.matches !== undefined
750
- ? { matches: SchemeResults.assertMatchEvidenceList(rx.matches) } : {}),
751
- };
750
+ return structuredMutationReceipt;
752
751
  }
753
752
  // The body the row shows: the canonical full body, shared with log READ, log FIND and search
754
753
  // derivation, whole. Whether a result fit was decided where it landed ({§context-fit}).
@@ -791,8 +790,9 @@ export default class PacketWire {
791
790
  ...(enclosingRegion === undefined ? {} : { enclosingRegion: ScopeFormat.region(enclosingRegion) }),
792
791
  }));
793
792
  if (evidence.length > 0) {
794
- meta.matches = BodyPreview.items(evidence, JSON.stringify);
795
- if (meta.matches.length !== evidence.length)
793
+ const shown = BodyPreview.items(evidence, JSON.stringify);
794
+ meta.matches = shown;
795
+ if (shown.length !== evidence.length)
796
796
  meta.matchLocationCount = evidence.length;
797
797
  }
798
798
  }
@@ -823,7 +823,7 @@ export default class PacketWire {
823
823
  meta.preview = projectedChunk;
824
824
  delete meta.lines;
825
825
  }
826
- return { body, projectedLineCount, display };
826
+ return { body, display };
827
827
  }
828
828
  // The row's native attachment, a landed-unfit arrival's size, and the accounting field that
829
829
  // participates in the row it measures: iterate until its decimal width and therefore the
@@ -867,52 +867,35 @@ export default class PacketWire {
867
867
  }
868
868
  throw new Error("packet log row accounting did not converge");
869
869
  };
870
- const row = (rendered, part, bodied) => ({ content: rendered.content, curationTarget: { path, tokens: rendered.tokens }, attachment: part, bodied });
871
- const whole = converge(display === "open", attachment);
872
- // {§context-own-rows-fit} — a row the wall may take carries a body or a native part and is not an
873
- // emission row, whose folded record carries no body.
874
- if (typeof e.id !== "number" || LogEntryProjection.isEmission(e) || (display !== "open" && attachment === null))
875
- return row(whole, attachment, null);
876
- if (!(options.bodiless?.has(e.id) ?? false))
877
- return row(whole, attachment, { id: e.id, tokens: whole.tokens });
878
- // Taken: the fit rule's receipt shape — its size and address, no body, no native part.
879
- meta.size = { lines: projected.projectedLineCount, tokens: whole.tokens };
880
- const receipt = converge(false, null);
881
- if (receipt.tokens < whole.tokens)
882
- return row(receipt, null, null);
883
- // A receipt that weighs no less than the body it stands for sheds nothing: the row stays whole and
884
- // is spent.
885
- delete meta.size;
886
- return row(converge(display === "open", attachment), attachment, null);
870
+ const rendered = converge(display === "open", attachment);
871
+ return { content: rendered.content, curationTarget: { path, tokens: rendered.tokens }, attachment };
887
872
  }
888
873
  static #attachmentOf(rx, target, coordinate, path) {
889
- const view = rx;
890
- const contentHash = rx?.nativeContentHash;
891
- if (typeof contentHash !== "string")
874
+ if (!isRecord(rx) || typeof rx.nativeContentHash !== "string")
892
875
  return null;
876
+ const contentHash = rx.nativeContentHash;
893
877
  const pathname = typeof target?.pathname === "string" && target.pathname.length > 0
894
878
  ? target.pathname
895
879
  : typeof target?.raw === "string" ? target.raw : null;
896
880
  if (pathname === null || coordinate === null || path === null)
897
881
  return null;
898
882
  const scheme = target?.scheme ?? "file";
899
- const image = view?.image;
900
- if (image !== undefined && typeof image.mimetype === "string" && Number.isSafeInteger(image.width) && Number.isSafeInteger(image.height)) {
901
- const width = image.width;
902
- const height = image.height;
883
+ const image = rx.image;
884
+ if (isRecord(image) && typeof image.mimetype === "string" && isSafeInteger(image.width) && isSafeInteger(image.height)) {
885
+ const { width, height } = image;
903
886
  return { contentHash, coordinate, path, scheme, pathname, mimetype: image.mimetype, kind: "image", width, height, weight: imageWeight(width, height) };
904
887
  }
905
- const document = view?.document;
906
- if (document !== undefined && typeof document.mimetype === "string" && Number.isSafeInteger(document.bytes)) {
907
- const pages = Number.isSafeInteger(document.pages) ? document.pages : null;
888
+ const document = rx.document;
889
+ if (isRecord(document) && typeof document.mimetype === "string" && isSafeInteger(document.bytes)) {
890
+ const pages = isSafeInteger(document.pages) ? document.pages : null;
908
891
  return {
909
892
  contentHash, coordinate, path, scheme, pathname, mimetype: document.mimetype, kind: "pdf",
910
893
  ...(pages === null ? {} : { pages }),
911
894
  weight: pdfWeight(pages, document.bytes),
912
895
  };
913
896
  }
914
- const audio = view?.audio;
915
- if (audio !== undefined && typeof audio.mimetype === "string" && Number.isSafeInteger(audio.bytes)) {
897
+ const audio = rx.audio;
898
+ if (isRecord(audio) && typeof audio.mimetype === "string" && isSafeInteger(audio.bytes)) {
916
899
  const duration = typeof audio.duration === "number" && Number.isFinite(audio.duration) && audio.duration >= 0 ? audio.duration : null;
917
900
  return {
918
901
  contentHash, coordinate, path, scheme, pathname, mimetype: audio.mimetype, kind: "audio",
@@ -943,7 +926,7 @@ export default class PacketWire {
943
926
  const parts = [];
944
927
  for (const [at, section] of sections.entries()) {
945
928
  parts.push({ type: "text", text: `${at === 0 ? "" : "\n\n"}${PacketWire.renderSection(section)}` });
946
- for (const attachment of attachments.filter((attachment) => attachment.section === section.name)) {
929
+ for (const attachment of attachments.filter((candidate) => candidate.section === section.name)) {
947
930
  parts.push({ type: "text", text: `\n\n${PacketWire.attachmentCaption(attachment)}` });
948
931
  parts.push({ type: "file", data: await bytesOf(attachment), mediaType: attachment.mimetype });
949
932
  }
@@ -1011,15 +994,54 @@ export default class PacketWire {
1011
994
  static #requestScope(marker) {
1012
995
  if (marker === null || marker === undefined)
1013
996
  return null;
1014
- const marks = marker.marks;
1015
- if (!Array.isArray(marks) || marks.some((mark) => typeof mark !== "string" && typeof mark !== "number")) {
997
+ const marks = isRecord(marker) ? marker.marks : undefined;
998
+ const isMark = (mark) => typeof mark === "string" || typeof mark === "number";
999
+ if (!Array.isArray(marks) || !marks.every(isMark)) {
1016
1000
  throw new TypeError("An operation scope must retain its authored marks.");
1017
1001
  }
1002
+ const [first, ...rest] = marks;
1003
+ if (first === undefined)
1004
+ throw new TypeError("An operation scope must retain its authored marks.");
1018
1005
  // Failed selections still describe what was attempted; the operation owns validity.
1019
- return ScopeFormat.marker(marker);
1006
+ return ScopeFormat.marker({ marks: [first, ...rest] });
1007
+ }
1008
+ // {§packet-stored-shape} A stored operand target: the address columns as nullable strings, the port a number, the
1009
+ // authored `kind` and `raw` read where used. A field of another type is a malformed row.
1010
+ static #actionTarget(value) {
1011
+ if (value === null || value === undefined)
1012
+ return null;
1013
+ if (!isRecord(value))
1014
+ throw new TypeError("A stored operand target must be an object.");
1015
+ const text = (name) => {
1016
+ const field = value[name];
1017
+ if (field === undefined || field === null || typeof field === "string")
1018
+ return field;
1019
+ throw new TypeError(`A stored operand target carries a malformed ${name}.`);
1020
+ };
1021
+ const port = value.port;
1022
+ if (port !== undefined && port !== null && typeof port !== "number") {
1023
+ throw new TypeError("A stored operand target carries a malformed port.");
1024
+ }
1025
+ return {
1026
+ kind: value.kind, raw: value.raw, scheme: text("scheme"), hostname: text("hostname"), port, pathname: text("pathname"),
1027
+ query: text("query"), fragment: text("fragment"), username: text("username"), password: text("password"),
1028
+ };
1029
+ }
1030
+ // The target as the model authored it, when the stored statement's target is a path the grammar names; a row
1031
+ // whose stored target is not renders without its authored spelling.
1032
+ static #authoredPath(value) {
1033
+ if (value === null || value === undefined)
1034
+ return null;
1035
+ return Validator.validateParsedPath(value).valid ? Validator.assertParsedPath(value) : null;
1036
+ }
1037
+ static #selection(value) {
1038
+ return isRecord(value) ? value : null;
1039
+ }
1040
+ static #metadata(value) {
1041
+ return Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string") ? value : null;
1020
1042
  }
1021
1043
  // {§packet-git-status}: the count line, then one bounded line per non-empty class. Untracked paths are
1022
- // named because they are NOT members ({§membership-baseline}) — a human `git add`s or picks them.
1044
+ // named because they are NOT members ({§membership-baseline}) — the user admits them.
1023
1045
  static #renderGitState(git) {
1024
1046
  const sync = git.ahead > 0 || git.behind > 0 ? ` (↑${git.ahead} ↓${git.behind})` : "";
1025
1047
  const position = git.branch === null ? "detached HEAD" : `branch \`${git.branch}\`${git.unborn ? " (no commits)" : ""}`;