@smthrs/gateway 0.35.0 → 1.0.0-rc.4

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 (605) hide show
  1. package/CHANGELOG.md +198 -0
  2. package/LICENSE +1 -1
  3. package/README.md +92 -0
  4. package/dist/cjs/Diagnosis.d.ts +275 -0
  5. package/dist/cjs/Diagnosis.d.ts.map +1 -0
  6. package/dist/cjs/Diagnosis.js +476 -0
  7. package/dist/cjs/Diagnosis.js.map +7 -0
  8. package/dist/cjs/EngineTrace.d.ts +76 -0
  9. package/dist/cjs/EngineTrace.d.ts.map +1 -0
  10. package/dist/cjs/EngineTrace.js +509 -0
  11. package/dist/cjs/EngineTrace.js.map +7 -0
  12. package/dist/cjs/GatewayError.d.ts +54 -0
  13. package/dist/cjs/GatewayError.d.ts.map +1 -0
  14. package/dist/cjs/GatewayError.js +51 -0
  15. package/dist/cjs/GatewayError.js.map +7 -0
  16. package/dist/cjs/GatewayProjection.d.ts +480 -0
  17. package/dist/cjs/GatewayProjection.d.ts.map +1 -0
  18. package/dist/cjs/GatewayProjection.js +471 -0
  19. package/dist/cjs/GatewayProjection.js.map +7 -0
  20. package/dist/cjs/GatewayRpcs.d.ts +1886 -0
  21. package/dist/cjs/GatewayRpcs.d.ts.map +1 -0
  22. package/dist/cjs/GatewayRpcs.js +121 -0
  23. package/dist/cjs/GatewayRpcs.js.map +7 -0
  24. package/dist/cjs/GatewaySchema.d.ts +3274 -0
  25. package/dist/cjs/GatewaySchema.d.ts.map +1 -0
  26. package/dist/cjs/GatewaySchema.js +141 -0
  27. package/dist/cjs/GatewaySchema.js.map +7 -0
  28. package/dist/cjs/GatewayServer.d.ts +427 -0
  29. package/dist/cjs/GatewayServer.d.ts.map +1 -0
  30. package/dist/cjs/GatewayServer.js +428 -0
  31. package/dist/cjs/GatewayServer.js.map +7 -0
  32. package/dist/cjs/HostBranchPresence.d.ts +19 -0
  33. package/dist/cjs/HostBranchPresence.d.ts.map +1 -0
  34. package/dist/cjs/HostBranchPresence.js +82 -0
  35. package/dist/cjs/HostBranchPresence.js.map +7 -0
  36. package/dist/cjs/Projections.d.ts +209 -0
  37. package/dist/cjs/Projections.d.ts.map +1 -0
  38. package/dist/cjs/Projections.js +906 -0
  39. package/dist/cjs/Projections.js.map +7 -0
  40. package/dist/cjs/RunDevTools.d.ts +181 -0
  41. package/dist/cjs/RunDevTools.d.ts.map +1 -0
  42. package/dist/cjs/RunDevTools.js +195 -0
  43. package/dist/cjs/RunDevTools.js.map +7 -0
  44. package/dist/cjs/RunHistory.d.ts +185 -0
  45. package/dist/cjs/RunHistory.d.ts.map +1 -0
  46. package/dist/cjs/RunHistory.js +68 -0
  47. package/dist/cjs/RunHistory.js.map +7 -0
  48. package/dist/cjs/RunTrace.d.ts +753 -0
  49. package/dist/cjs/RunTrace.d.ts.map +1 -0
  50. package/dist/cjs/RunTrace.js +1595 -0
  51. package/dist/cjs/RunTrace.js.map +7 -0
  52. package/dist/cjs/RuntimeBridge.d.ts +1386 -0
  53. package/dist/cjs/RuntimeBridge.d.ts.map +1 -0
  54. package/dist/cjs/RuntimeBridge.js +598 -0
  55. package/dist/cjs/RuntimeBridge.js.map +7 -0
  56. package/dist/cjs/bun/BunGateway.d.ts +20 -0
  57. package/dist/cjs/bun/BunGateway.d.ts.map +1 -0
  58. package/dist/cjs/bun/BunGateway.js +62 -0
  59. package/dist/cjs/bun/BunGateway.js.map +7 -0
  60. package/dist/cjs/index.d.ts +65 -0
  61. package/dist/cjs/index.d.ts.map +1 -0
  62. package/dist/cjs/index.js +59 -0
  63. package/dist/cjs/index.js.map +7 -0
  64. package/dist/cjs/internal/NativeGateway.d.ts +176 -0
  65. package/dist/cjs/internal/NativeGateway.d.ts.map +1 -0
  66. package/dist/cjs/internal/NativeGateway.js +187 -0
  67. package/dist/cjs/internal/NativeGateway.js.map +7 -0
  68. package/dist/cjs/internal/actionRenderings.d.ts +12 -0
  69. package/dist/cjs/internal/actionRenderings.d.ts.map +1 -0
  70. package/dist/cjs/internal/actionRenderings.js +224 -0
  71. package/dist/cjs/internal/actionRenderings.js.map +7 -0
  72. package/dist/cjs/internal/callEvents.d.ts +97 -0
  73. package/dist/cjs/internal/callEvents.d.ts.map +1 -0
  74. package/dist/cjs/internal/callEvents.js +169 -0
  75. package/dist/cjs/internal/callEvents.js.map +7 -0
  76. package/dist/cjs/internal/digestIndex.d.ts +31 -0
  77. package/dist/cjs/internal/digestIndex.d.ts.map +1 -0
  78. package/dist/cjs/internal/digestIndex.js +105 -0
  79. package/dist/cjs/internal/digestIndex.js.map +7 -0
  80. package/dist/cjs/internal/digestMemory.d.ts +19 -0
  81. package/dist/cjs/internal/digestMemory.d.ts.map +1 -0
  82. package/dist/cjs/internal/digestMemory.js +33 -0
  83. package/dist/cjs/internal/digestMemory.js.map +7 -0
  84. package/dist/cjs/internal/inspectLabels.d.ts +13 -0
  85. package/dist/cjs/internal/inspectLabels.d.ts.map +1 -0
  86. package/dist/cjs/internal/inspectLabels.js +29 -0
  87. package/dist/cjs/internal/inspectLabels.js.map +7 -0
  88. package/dist/cjs/internal/nativeResolution.d.ts +41 -0
  89. package/dist/cjs/internal/nativeResolution.d.ts.map +1 -0
  90. package/dist/cjs/internal/nativeResolution.js +62 -0
  91. package/dist/cjs/internal/nativeResolution.js.map +7 -0
  92. package/dist/cjs/internal/nodeEvents.d.ts +47 -0
  93. package/dist/cjs/internal/nodeEvents.d.ts.map +1 -0
  94. package/dist/cjs/internal/nodeEvents.js +60 -0
  95. package/dist/cjs/internal/nodeEvents.js.map +7 -0
  96. package/dist/cjs/node/NodeGateway.d.ts +16 -0
  97. package/dist/cjs/node/NodeGateway.d.ts.map +1 -0
  98. package/dist/cjs/node/NodeGateway.js +48 -0
  99. package/dist/cjs/node/NodeGateway.js.map +7 -0
  100. package/dist/cjs/package.json +1 -0
  101. package/dist/esm/Diagnosis.d.ts +275 -0
  102. package/dist/esm/Diagnosis.d.ts.map +1 -0
  103. package/dist/esm/Diagnosis.js +697 -0
  104. package/dist/esm/Diagnosis.js.map +1 -0
  105. package/dist/esm/EngineTrace.d.ts +76 -0
  106. package/dist/esm/EngineTrace.d.ts.map +1 -0
  107. package/dist/esm/EngineTrace.js +557 -0
  108. package/dist/esm/EngineTrace.js.map +1 -0
  109. package/dist/esm/GatewayError.d.ts +54 -0
  110. package/dist/esm/GatewayError.d.ts.map +1 -0
  111. package/dist/esm/GatewayError.js +60 -0
  112. package/dist/esm/GatewayError.js.map +1 -0
  113. package/dist/esm/GatewayProjection.d.ts +480 -0
  114. package/dist/esm/GatewayProjection.d.ts.map +1 -0
  115. package/dist/esm/GatewayProjection.js +799 -0
  116. package/dist/esm/GatewayProjection.js.map +1 -0
  117. package/dist/esm/GatewayRpcs.d.ts +1886 -0
  118. package/dist/esm/GatewayRpcs.d.ts.map +1 -0
  119. package/dist/esm/GatewayRpcs.js +145 -0
  120. package/dist/esm/GatewayRpcs.js.map +1 -0
  121. package/dist/esm/GatewaySchema.d.ts +3274 -0
  122. package/dist/esm/GatewaySchema.d.ts.map +1 -0
  123. package/dist/esm/GatewaySchema.js +244 -0
  124. package/dist/esm/GatewaySchema.js.map +1 -0
  125. package/dist/esm/GatewayServer.d.ts +427 -0
  126. package/dist/esm/GatewayServer.d.ts.map +1 -0
  127. package/dist/esm/GatewayServer.js +725 -0
  128. package/dist/esm/GatewayServer.js.map +1 -0
  129. package/dist/esm/HostBranchPresence.d.ts +19 -0
  130. package/dist/esm/HostBranchPresence.d.ts.map +1 -0
  131. package/dist/esm/HostBranchPresence.js +57 -0
  132. package/dist/esm/HostBranchPresence.js.map +1 -0
  133. package/dist/esm/Projections.d.ts +209 -0
  134. package/dist/esm/Projections.d.ts.map +1 -0
  135. package/dist/esm/Projections.js +1254 -0
  136. package/dist/esm/Projections.js.map +1 -0
  137. package/dist/esm/RunDevTools.d.ts +181 -0
  138. package/dist/esm/RunDevTools.d.ts.map +1 -0
  139. package/dist/esm/RunDevTools.js +281 -0
  140. package/dist/esm/RunDevTools.js.map +1 -0
  141. package/dist/esm/RunHistory.d.ts +185 -0
  142. package/dist/esm/RunHistory.d.ts.map +1 -0
  143. package/dist/esm/RunHistory.js +109 -0
  144. package/dist/esm/RunHistory.js.map +1 -0
  145. package/dist/esm/RunTrace.d.ts +753 -0
  146. package/dist/esm/RunTrace.d.ts.map +1 -0
  147. package/dist/esm/RunTrace.js +2106 -0
  148. package/dist/esm/RunTrace.js.map +1 -0
  149. package/dist/esm/RuntimeBridge.d.ts +1386 -0
  150. package/dist/esm/RuntimeBridge.d.ts.map +1 -0
  151. package/dist/esm/RuntimeBridge.js +659 -0
  152. package/dist/esm/RuntimeBridge.js.map +1 -0
  153. package/dist/esm/bun/BunGateway.d.ts +20 -0
  154. package/dist/esm/bun/BunGateway.d.ts.map +1 -0
  155. package/dist/esm/bun/BunGateway.js +32 -0
  156. package/dist/esm/bun/BunGateway.js.map +1 -0
  157. package/dist/esm/index.d.ts +65 -0
  158. package/dist/esm/index.d.ts.map +1 -0
  159. package/dist/esm/index.js +65 -0
  160. package/dist/esm/index.js.map +1 -0
  161. package/dist/esm/internal/NativeGateway.d.ts +176 -0
  162. package/dist/esm/internal/NativeGateway.d.ts.map +1 -0
  163. package/dist/esm/internal/NativeGateway.js +268 -0
  164. package/dist/esm/internal/NativeGateway.js.map +1 -0
  165. package/dist/esm/internal/actionRenderings.d.ts +12 -0
  166. package/dist/esm/internal/actionRenderings.d.ts.map +1 -0
  167. package/dist/esm/internal/actionRenderings.js +212 -0
  168. package/dist/esm/internal/actionRenderings.js.map +1 -0
  169. package/dist/esm/internal/callEvents.d.ts +97 -0
  170. package/dist/esm/internal/callEvents.d.ts.map +1 -0
  171. package/dist/esm/internal/callEvents.js +206 -0
  172. package/dist/esm/internal/callEvents.js.map +1 -0
  173. package/dist/esm/internal/digestIndex.d.ts +31 -0
  174. package/dist/esm/internal/digestIndex.d.ts.map +1 -0
  175. package/dist/esm/internal/digestIndex.js +87 -0
  176. package/dist/esm/internal/digestIndex.js.map +1 -0
  177. package/dist/esm/internal/digestMemory.d.ts +19 -0
  178. package/dist/esm/internal/digestMemory.d.ts.map +1 -0
  179. package/dist/esm/internal/digestMemory.js +23 -0
  180. package/dist/esm/internal/digestMemory.js.map +1 -0
  181. package/dist/esm/internal/inspectLabels.d.ts +13 -0
  182. package/dist/esm/internal/inspectLabels.d.ts.map +1 -0
  183. package/dist/esm/internal/inspectLabels.js +17 -0
  184. package/dist/esm/internal/inspectLabels.js.map +1 -0
  185. package/dist/esm/internal/nativeResolution.d.ts +41 -0
  186. package/dist/esm/internal/nativeResolution.d.ts.map +1 -0
  187. package/dist/esm/internal/nativeResolution.js +78 -0
  188. package/dist/esm/internal/nativeResolution.js.map +1 -0
  189. package/dist/esm/internal/nodeEvents.d.ts +47 -0
  190. package/dist/esm/internal/nodeEvents.d.ts.map +1 -0
  191. package/dist/esm/internal/nodeEvents.js +60 -0
  192. package/dist/esm/internal/nodeEvents.js.map +1 -0
  193. package/dist/esm/node/NodeGateway.d.ts +16 -0
  194. package/dist/esm/node/NodeGateway.d.ts.map +1 -0
  195. package/dist/esm/node/NodeGateway.js +13 -0
  196. package/dist/esm/node/NodeGateway.js.map +1 -0
  197. package/dist/vendor/adapters.json +2707 -0
  198. package/dist/vendor/bun/BunChildProcessSpawner.d.ts +7 -0
  199. package/dist/vendor/bun/BunChildProcessSpawner.js +14 -0
  200. package/dist/vendor/bun/BunClusterHttp.d.ts +83 -0
  201. package/dist/vendor/bun/BunClusterHttp.js +39 -0
  202. package/dist/vendor/bun/BunClusterSocket.d.ts +65 -0
  203. package/dist/vendor/bun/BunClusterSocket.js +22 -0
  204. package/dist/vendor/bun/BunCrypto.d.ts +10 -0
  205. package/dist/vendor/bun/BunCrypto.js +8 -0
  206. package/dist/vendor/bun/BunFileSystem.d.ts +10 -0
  207. package/dist/vendor/bun/BunFileSystem.js +9 -0
  208. package/dist/vendor/bun/BunHttpClient.d.ts +9 -0
  209. package/dist/vendor/bun/BunHttpClient.js +1 -0
  210. package/dist/vendor/bun/BunHttpPlatform.d.ts +10 -0
  211. package/dist/vendor/bun/BunHttpPlatform.js +11 -0
  212. package/dist/vendor/bun/BunHttpServer.d.ts +142 -0
  213. package/dist/vendor/bun/BunHttpServer.js +38 -0
  214. package/dist/vendor/bun/BunHttpServerRequest.d.ts +18 -0
  215. package/dist/vendor/bun/BunHttpServerRequest.js +7 -0
  216. package/dist/vendor/bun/BunMultipart.d.ts +31 -0
  217. package/dist/vendor/bun/BunMultipart.js +12 -0
  218. package/dist/vendor/bun/BunPath.d.ts +24 -0
  219. package/dist/vendor/bun/BunPath.js +12 -0
  220. package/dist/vendor/bun/BunRedis.d.ts +49 -0
  221. package/dist/vendor/bun/BunRedis.js +11 -0
  222. package/dist/vendor/bun/BunRuntime.d.ts +85 -0
  223. package/dist/vendor/bun/BunRuntime.js +8 -0
  224. package/dist/vendor/bun/BunServices.d.ts +34 -0
  225. package/dist/vendor/bun/BunServices.js +23 -0
  226. package/dist/vendor/bun/BunSink.d.ts +8 -0
  227. package/dist/vendor/bun/BunSink.js +12 -0
  228. package/dist/vendor/bun/BunSocket.d.ts +40 -0
  229. package/dist/vendor/bun/BunSocket.js +29 -0
  230. package/dist/vendor/bun/BunSocketServer.d.ts +8 -0
  231. package/dist/vendor/bun/BunSocketServer.js +21 -0
  232. package/dist/vendor/bun/BunStdio.d.ts +11 -0
  233. package/dist/vendor/bun/BunStdio.js +10 -0
  234. package/dist/vendor/bun/BunStream.d.ts +19 -0
  235. package/dist/vendor/bun/BunStream.js +30 -0
  236. package/dist/vendor/bun/BunTerminal.d.ts +21 -0
  237. package/dist/vendor/bun/BunTerminal.js +10 -0
  238. package/dist/vendor/bun/BunWorker.d.ts +20 -0
  239. package/dist/vendor/bun/BunWorker.js +9 -0
  240. package/dist/vendor/bun/BunWorkerRunner.d.ts +12 -0
  241. package/dist/vendor/bun/BunWorkerRunner.js +7 -0
  242. package/dist/vendor/bun/LICENSE +21 -0
  243. package/dist/vendor/bun/index.d.ts +92 -0
  244. package/dist/vendor/bun/index.js +107 -0
  245. package/dist/vendor/chunk-2GCOZTTW.js +48 -0
  246. package/dist/vendor/chunk-37CUR3PO.js +81 -0
  247. package/dist/vendor/chunk-3ARKKENZ.js +45 -0
  248. package/dist/vendor/chunk-3NV2UDBI.js +7 -0
  249. package/dist/vendor/chunk-3OSW7CT7.js +143 -0
  250. package/dist/vendor/chunk-62R63L74.js +62 -0
  251. package/dist/vendor/chunk-6AQLBC2I.js +118 -0
  252. package/dist/vendor/chunk-6C5H7S6B.js +18 -0
  253. package/dist/vendor/chunk-6DY5RBZD.js +85 -0
  254. package/dist/vendor/chunk-6UPBD47P.js +53 -0
  255. package/dist/vendor/chunk-AVVVN75Z.js +96 -0
  256. package/dist/vendor/chunk-B4DHEMBB.js +14 -0
  257. package/dist/vendor/chunk-BCK3NJOX.js +15 -0
  258. package/dist/vendor/chunk-BFBIHJ6X.js +0 -0
  259. package/dist/vendor/chunk-CES4OUM4.js +63 -0
  260. package/dist/vendor/chunk-D64L6YND.js +59 -0
  261. package/dist/vendor/chunk-DS2R6WOM.js +18 -0
  262. package/dist/vendor/chunk-DX4Z23DM.js +65 -0
  263. package/dist/vendor/chunk-DZ2VOUDP.js +564 -0
  264. package/dist/vendor/chunk-FOXN6JPJ.js +61 -0
  265. package/dist/vendor/chunk-FPQF7CR5.js +55 -0
  266. package/dist/vendor/chunk-FUTCTCEG.js +20 -0
  267. package/dist/vendor/chunk-GUPAV2YZ.js +18 -0
  268. package/dist/vendor/chunk-H2Z2Y4QH.js +70 -0
  269. package/dist/vendor/chunk-HAEDVSSM.js +129 -0
  270. package/dist/vendor/chunk-HY7BBL3K.js +93 -0
  271. package/dist/vendor/chunk-IFTTT6D5.js +31 -0
  272. package/dist/vendor/chunk-KQDSNB7M.js +26 -0
  273. package/dist/vendor/chunk-LIHLXXGQ.js +26 -0
  274. package/dist/vendor/chunk-LKCGQEE5.js +28 -0
  275. package/dist/vendor/chunk-MH2J3BYB.js +0 -0
  276. package/dist/vendor/chunk-ML2NAFH2.js +131 -0
  277. package/dist/vendor/chunk-MLFIZ5O2.js +0 -0
  278. package/dist/vendor/chunk-MLKGABMK.js +9 -0
  279. package/dist/vendor/chunk-MSCLEMYX.js +71 -0
  280. package/dist/vendor/chunk-OBWXQKVP.js +57 -0
  281. package/dist/vendor/chunk-QR557K66.js +20 -0
  282. package/dist/vendor/chunk-R4QUY7DH.js +18 -0
  283. package/dist/vendor/chunk-RGECXXJS.js +18 -0
  284. package/dist/vendor/chunk-TFY7W6D4.js +36 -0
  285. package/dist/vendor/chunk-TGPIVY4A.js +104 -0
  286. package/dist/vendor/chunk-TGXCX6W3.js +398 -0
  287. package/dist/vendor/chunk-TOHSFXMV.js +437 -0
  288. package/dist/vendor/chunk-UHIDPUFF.js +34 -0
  289. package/dist/vendor/chunk-ULT6CWUI.js +109 -0
  290. package/dist/vendor/chunk-UXBGYQR3.js +18 -0
  291. package/dist/vendor/chunk-V6LUGQ7O.js +21 -0
  292. package/dist/vendor/chunk-W4OASVX6.js +92 -0
  293. package/dist/vendor/chunk-WAII54GA.js +18 -0
  294. package/dist/vendor/chunk-WECQDT36.js +426 -0
  295. package/dist/vendor/chunk-WHKMOC7Z.js +28 -0
  296. package/dist/vendor/chunk-WVFOZ2UL.js +40 -0
  297. package/dist/vendor/chunk-X73E2UPI.js +18 -0
  298. package/dist/vendor/chunk-XCYARUII.js +63 -0
  299. package/dist/vendor/chunk-XFEVTDVD.js +34 -0
  300. package/dist/vendor/chunk-XFZZYSJ4.js +22 -0
  301. package/dist/vendor/chunk-XJWJXLXJ.js +18 -0
  302. package/dist/vendor/chunk-XY3Q62EO.js +18 -0
  303. package/dist/vendor/chunk-YDASSC75.js +394 -0
  304. package/dist/vendor/chunk-Z6C7SO5Z.js +507 -0
  305. package/dist/vendor/chunk-Z7QNPJEB.js +229 -0
  306. package/dist/vendor/chunk-Z7QPP4YH.js +249 -0
  307. package/dist/vendor/chunk-ZCHYLHJH.js +86 -0
  308. package/dist/vendor/chunk-ZIQVYVMA.js +22 -0
  309. package/dist/vendor/chunk-ZPIG2CUA.js +34 -0
  310. package/dist/vendor/cjs/bun/BunChildProcessSpawner.d.ts +7 -0
  311. package/dist/vendor/cjs/bun/BunChildProcessSpawner.js +1 -0
  312. package/dist/vendor/cjs/bun/BunClusterHttp.d.ts +83 -0
  313. package/dist/vendor/cjs/bun/BunClusterHttp.js +1 -0
  314. package/dist/vendor/cjs/bun/BunClusterSocket.d.ts +65 -0
  315. package/dist/vendor/cjs/bun/BunClusterSocket.js +1 -0
  316. package/dist/vendor/cjs/bun/BunCrypto.d.ts +10 -0
  317. package/dist/vendor/cjs/bun/BunCrypto.js +1 -0
  318. package/dist/vendor/cjs/bun/BunFileSystem.d.ts +10 -0
  319. package/dist/vendor/cjs/bun/BunFileSystem.js +1 -0
  320. package/dist/vendor/cjs/bun/BunHttpClient.d.ts +9 -0
  321. package/dist/vendor/cjs/bun/BunHttpClient.js +1 -0
  322. package/dist/vendor/cjs/bun/BunHttpPlatform.d.ts +10 -0
  323. package/dist/vendor/cjs/bun/BunHttpPlatform.js +1 -0
  324. package/dist/vendor/cjs/bun/BunHttpServer.d.ts +142 -0
  325. package/dist/vendor/cjs/bun/BunHttpServer.js +1 -0
  326. package/dist/vendor/cjs/bun/BunHttpServerRequest.d.ts +18 -0
  327. package/dist/vendor/cjs/bun/BunHttpServerRequest.js +1 -0
  328. package/dist/vendor/cjs/bun/BunMultipart.d.ts +31 -0
  329. package/dist/vendor/cjs/bun/BunMultipart.js +1 -0
  330. package/dist/vendor/cjs/bun/BunPath.d.ts +24 -0
  331. package/dist/vendor/cjs/bun/BunPath.js +1 -0
  332. package/dist/vendor/cjs/bun/BunRedis.d.ts +49 -0
  333. package/dist/vendor/cjs/bun/BunRedis.js +1 -0
  334. package/dist/vendor/cjs/bun/BunRuntime.d.ts +85 -0
  335. package/dist/vendor/cjs/bun/BunRuntime.js +1 -0
  336. package/dist/vendor/cjs/bun/BunServices.d.ts +34 -0
  337. package/dist/vendor/cjs/bun/BunServices.js +1 -0
  338. package/dist/vendor/cjs/bun/BunSink.d.ts +8 -0
  339. package/dist/vendor/cjs/bun/BunSink.js +1 -0
  340. package/dist/vendor/cjs/bun/BunSocket.d.ts +40 -0
  341. package/dist/vendor/cjs/bun/BunSocket.js +1 -0
  342. package/dist/vendor/cjs/bun/BunSocketServer.d.ts +8 -0
  343. package/dist/vendor/cjs/bun/BunSocketServer.js +1 -0
  344. package/dist/vendor/cjs/bun/BunStdio.d.ts +11 -0
  345. package/dist/vendor/cjs/bun/BunStdio.js +1 -0
  346. package/dist/vendor/cjs/bun/BunStream.d.ts +19 -0
  347. package/dist/vendor/cjs/bun/BunStream.js +1 -0
  348. package/dist/vendor/cjs/bun/BunTerminal.d.ts +21 -0
  349. package/dist/vendor/cjs/bun/BunTerminal.js +1 -0
  350. package/dist/vendor/cjs/bun/BunWorker.d.ts +20 -0
  351. package/dist/vendor/cjs/bun/BunWorker.js +1 -0
  352. package/dist/vendor/cjs/bun/BunWorkerRunner.d.ts +12 -0
  353. package/dist/vendor/cjs/bun/BunWorkerRunner.js +1 -0
  354. package/dist/vendor/cjs/bun/index.d.ts +92 -0
  355. package/dist/vendor/cjs/bun/index.js +1 -0
  356. package/dist/vendor/cjs/node/NodeChildProcessSpawner.d.ts +7 -0
  357. package/dist/vendor/cjs/node/NodeChildProcessSpawner.js +1 -0
  358. package/dist/vendor/cjs/node/NodeClusterHttp.d.ts +63 -0
  359. package/dist/vendor/cjs/node/NodeClusterHttp.js +1 -0
  360. package/dist/vendor/cjs/node/NodeClusterSocket.d.ts +79 -0
  361. package/dist/vendor/cjs/node/NodeClusterSocket.js +1 -0
  362. package/dist/vendor/cjs/node/NodeCrypto.d.ts +10 -0
  363. package/dist/vendor/cjs/node/NodeCrypto.js +1 -0
  364. package/dist/vendor/cjs/node/NodeFileSystem.d.ts +10 -0
  365. package/dist/vendor/cjs/node/NodeFileSystem.js +1 -0
  366. package/dist/vendor/cjs/node/NodeHttpClient.d.ts +179 -0
  367. package/dist/vendor/cjs/node/NodeHttpClient.js +1 -0
  368. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.d.ts +62 -0
  369. package/dist/vendor/cjs/node/NodeHttpIncomingMessage.js +1 -0
  370. package/dist/vendor/cjs/node/NodeHttpPlatform.d.ts +36 -0
  371. package/dist/vendor/cjs/node/NodeHttpPlatform.js +1 -0
  372. package/dist/vendor/cjs/node/NodeHttpServer.d.ts +120 -0
  373. package/dist/vendor/cjs/node/NodeHttpServer.js +1 -0
  374. package/dist/vendor/cjs/node/NodeHttpServerRequest.d.ts +29 -0
  375. package/dist/vendor/cjs/node/NodeHttpServerRequest.js +1 -0
  376. package/dist/vendor/cjs/node/NodeMultipart.d.ts +46 -0
  377. package/dist/vendor/cjs/node/NodeMultipart.js +1 -0
  378. package/dist/vendor/cjs/node/NodeMultipartParser.d.ts +97 -0
  379. package/dist/vendor/cjs/node/NodeMultipartParser.js +1 -0
  380. package/dist/vendor/cjs/node/NodePath.d.ts +27 -0
  381. package/dist/vendor/cjs/node/NodePath.js +1 -0
  382. package/dist/vendor/cjs/node/NodeRedis.d.ts +74 -0
  383. package/dist/vendor/cjs/node/NodeRedis.js +1 -0
  384. package/dist/vendor/cjs/node/NodeRuntime.d.ts +85 -0
  385. package/dist/vendor/cjs/node/NodeRuntime.js +1 -0
  386. package/dist/vendor/cjs/node/NodeServices.d.ts +34 -0
  387. package/dist/vendor/cjs/node/NodeServices.js +1 -0
  388. package/dist/vendor/cjs/node/NodeSink.d.ts +8 -0
  389. package/dist/vendor/cjs/node/NodeSink.js +1 -0
  390. package/dist/vendor/cjs/node/NodeSocket.d.ts +38 -0
  391. package/dist/vendor/cjs/node/NodeSocket.js +1 -0
  392. package/dist/vendor/cjs/node/NodeSocketServer.d.ts +8 -0
  393. package/dist/vendor/cjs/node/NodeSocketServer.js +1 -0
  394. package/dist/vendor/cjs/node/NodeStdio.d.ts +11 -0
  395. package/dist/vendor/cjs/node/NodeStdio.js +1 -0
  396. package/dist/vendor/cjs/node/NodeStream.d.ts +8 -0
  397. package/dist/vendor/cjs/node/NodeStream.js +1 -0
  398. package/dist/vendor/cjs/node/NodeTerminal.d.ts +21 -0
  399. package/dist/vendor/cjs/node/NodeTerminal.js +1 -0
  400. package/dist/vendor/cjs/node/NodeWorker.d.ts +22 -0
  401. package/dist/vendor/cjs/node/NodeWorker.js +1 -0
  402. package/dist/vendor/cjs/node/NodeWorkerRunner.d.ts +12 -0
  403. package/dist/vendor/cjs/node/NodeWorkerRunner.js +1 -0
  404. package/dist/vendor/cjs/node/Undici.d.ts +28 -0
  405. package/dist/vendor/cjs/node/Undici.js +1 -0
  406. package/dist/vendor/cjs/node/index.d.ts +100 -0
  407. package/dist/vendor/cjs/node/index.js +1 -0
  408. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.d.ts +57 -0
  409. package/dist/vendor/cjs/node-shared/NodeChildProcessSpawner.js +1 -0
  410. package/dist/vendor/cjs/node-shared/NodeClusterSocket.d.ts +22 -0
  411. package/dist/vendor/cjs/node-shared/NodeClusterSocket.js +1 -0
  412. package/dist/vendor/cjs/node-shared/NodeCrypto.d.ts +27 -0
  413. package/dist/vendor/cjs/node-shared/NodeCrypto.js +1 -0
  414. package/dist/vendor/cjs/node-shared/NodeFileSystem.d.ts +11 -0
  415. package/dist/vendor/cjs/node-shared/NodeFileSystem.js +1 -0
  416. package/dist/vendor/cjs/node-shared/NodeHttpCompression.d.ts +36 -0
  417. package/dist/vendor/cjs/node-shared/NodeHttpCompression.js +1 -0
  418. package/dist/vendor/cjs/node-shared/NodePath.d.ts +27 -0
  419. package/dist/vendor/cjs/node-shared/NodePath.js +1 -0
  420. package/dist/vendor/cjs/node-shared/NodeRuntime.d.ts +47 -0
  421. package/dist/vendor/cjs/node-shared/NodeRuntime.js +1 -0
  422. package/dist/vendor/cjs/node-shared/NodeSink.d.ts +69 -0
  423. package/dist/vendor/cjs/node-shared/NodeSink.js +1 -0
  424. package/dist/vendor/cjs/node-shared/NodeSocket.d.ts +134 -0
  425. package/dist/vendor/cjs/node-shared/NodeSocket.js +1 -0
  426. package/dist/vendor/cjs/node-shared/NodeSocketServer.d.ts +80 -0
  427. package/dist/vendor/cjs/node-shared/NodeSocketServer.js +1 -0
  428. package/dist/vendor/cjs/node-shared/NodeStdio.d.ts +12 -0
  429. package/dist/vendor/cjs/node-shared/NodeStdio.js +1 -0
  430. package/dist/vendor/cjs/node-shared/NodeStream.d.ts +179 -0
  431. package/dist/vendor/cjs/node-shared/NodeStream.js +1 -0
  432. package/dist/vendor/cjs/node-shared/NodeTerminal.d.ts +22 -0
  433. package/dist/vendor/cjs/node-shared/NodeTerminal.js +1 -0
  434. package/dist/vendor/cjs/node-shared/index.d.ts +56 -0
  435. package/dist/vendor/cjs/node-shared/index.js +1 -0
  436. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
  437. package/dist/vendor/cjs/node-shared/internal/nodeChildProcessSpawner.js +1 -0
  438. package/dist/vendor/cjs/node-shared/internal/utils.d.ts +2 -0
  439. package/dist/vendor/cjs/node-shared/internal/utils.js +1 -0
  440. package/dist/vendor/cjs/package.json +1 -0
  441. package/dist/vendor/cjs/platform-bun.d.ts +92 -0
  442. package/dist/vendor/cjs/platform-bun.js +1 -0
  443. package/dist/vendor/cjs/platform-node-shared.d.ts +56 -0
  444. package/dist/vendor/cjs/platform-node-shared.js +1 -0
  445. package/dist/vendor/cjs/platform-node.d.ts +100 -0
  446. package/dist/vendor/cjs/platform-node.js +1 -0
  447. package/dist/vendor/node/LICENSE +21 -0
  448. package/dist/vendor/node/NodeChildProcessSpawner.d.ts +7 -0
  449. package/dist/vendor/node/NodeChildProcessSpawner.js +14 -0
  450. package/dist/vendor/node/NodeClusterHttp.d.ts +63 -0
  451. package/dist/vendor/node/NodeClusterHttp.js +43 -0
  452. package/dist/vendor/node/NodeClusterSocket.d.ts +79 -0
  453. package/dist/vendor/node/NodeClusterSocket.js +30 -0
  454. package/dist/vendor/node/NodeCrypto.d.ts +10 -0
  455. package/dist/vendor/node/NodeCrypto.js +8 -0
  456. package/dist/vendor/node/NodeFileSystem.d.ts +10 -0
  457. package/dist/vendor/node/NodeFileSystem.js +9 -0
  458. package/dist/vendor/node/NodeHttpClient.d.ts +179 -0
  459. package/dist/vendor/node/NodeHttpClient.js +46 -0
  460. package/dist/vendor/node/NodeHttpIncomingMessage.d.ts +62 -0
  461. package/dist/vendor/node/NodeHttpIncomingMessage.js +10 -0
  462. package/dist/vendor/node/NodeHttpPlatform.d.ts +36 -0
  463. package/dist/vendor/node/NodeHttpPlatform.js +16 -0
  464. package/dist/vendor/node/NodeHttpServer.d.ts +120 -0
  465. package/dist/vendor/node/NodeHttpServer.js +46 -0
  466. package/dist/vendor/node/NodeHttpServerRequest.d.ts +29 -0
  467. package/dist/vendor/node/NodeHttpServerRequest.js +9 -0
  468. package/dist/vendor/node/NodeMultipart.d.ts +46 -0
  469. package/dist/vendor/node/NodeMultipart.js +15 -0
  470. package/dist/vendor/node/NodeMultipartParser.d.ts +97 -0
  471. package/dist/vendor/node/NodeMultipartParser.js +11 -0
  472. package/dist/vendor/node/NodePath.d.ts +27 -0
  473. package/dist/vendor/node/NodePath.js +12 -0
  474. package/dist/vendor/node/NodeRedis.d.ts +74 -0
  475. package/dist/vendor/node/NodeRedis.js +11 -0
  476. package/dist/vendor/node/NodeRuntime.d.ts +85 -0
  477. package/dist/vendor/node/NodeRuntime.js +8 -0
  478. package/dist/vendor/node/NodeServices.d.ts +34 -0
  479. package/dist/vendor/node/NodeServices.js +23 -0
  480. package/dist/vendor/node/NodeSink.d.ts +8 -0
  481. package/dist/vendor/node/NodeSink.js +12 -0
  482. package/dist/vendor/node/NodeSocket.d.ts +38 -0
  483. package/dist/vendor/node/NodeSocket.js +31 -0
  484. package/dist/vendor/node/NodeSocketServer.d.ts +8 -0
  485. package/dist/vendor/node/NodeSocketServer.js +21 -0
  486. package/dist/vendor/node/NodeStdio.d.ts +11 -0
  487. package/dist/vendor/node/NodeStdio.js +10 -0
  488. package/dist/vendor/node/NodeStream.d.ts +8 -0
  489. package/dist/vendor/node/NodeStream.js +27 -0
  490. package/dist/vendor/node/NodeTerminal.d.ts +21 -0
  491. package/dist/vendor/node/NodeTerminal.js +10 -0
  492. package/dist/vendor/node/NodeWorker.d.ts +22 -0
  493. package/dist/vendor/node/NodeWorker.js +9 -0
  494. package/dist/vendor/node/NodeWorkerRunner.d.ts +12 -0
  495. package/dist/vendor/node/NodeWorkerRunner.js +7 -0
  496. package/dist/vendor/node/Undici.d.ts +28 -0
  497. package/dist/vendor/node/Undici.js +9 -0
  498. package/dist/vendor/node/index.d.ts +100 -0
  499. package/dist/vendor/node/index.js +115 -0
  500. package/dist/vendor/node-shared/LICENSE +21 -0
  501. package/dist/vendor/node-shared/NodeChildProcessSpawner.d.ts +57 -0
  502. package/dist/vendor/node-shared/NodeChildProcessSpawner.js +13 -0
  503. package/dist/vendor/node-shared/NodeClusterSocket.d.ts +22 -0
  504. package/dist/vendor/node-shared/NodeClusterSocket.js +11 -0
  505. package/dist/vendor/node-shared/NodeCrypto.d.ts +27 -0
  506. package/dist/vendor/node-shared/NodeCrypto.js +9 -0
  507. package/dist/vendor/node-shared/NodeFileSystem.d.ts +11 -0
  508. package/dist/vendor/node-shared/NodeFileSystem.js +8 -0
  509. package/dist/vendor/node-shared/NodeHttpCompression.d.ts +36 -0
  510. package/dist/vendor/node-shared/NodeHttpCompression.js +13 -0
  511. package/dist/vendor/node-shared/NodePath.d.ts +27 -0
  512. package/dist/vendor/node-shared/NodePath.js +11 -0
  513. package/dist/vendor/node-shared/NodeRuntime.d.ts +47 -0
  514. package/dist/vendor/node-shared/NodeRuntime.js +7 -0
  515. package/dist/vendor/node-shared/NodeSink.d.ts +69 -0
  516. package/dist/vendor/node-shared/NodeSink.js +11 -0
  517. package/dist/vendor/node-shared/NodeSocket.d.ts +134 -0
  518. package/dist/vendor/node-shared/NodeSocket.js +23 -0
  519. package/dist/vendor/node-shared/NodeSocketServer.d.ts +80 -0
  520. package/dist/vendor/node-shared/NodeSocketServer.js +20 -0
  521. package/dist/vendor/node-shared/NodeStdio.d.ts +12 -0
  522. package/dist/vendor/node-shared/NodeStdio.js +9 -0
  523. package/dist/vendor/node-shared/NodeStream.d.ts +179 -0
  524. package/dist/vendor/node-shared/NodeStream.js +26 -0
  525. package/dist/vendor/node-shared/NodeTerminal.d.ts +22 -0
  526. package/dist/vendor/node-shared/NodeTerminal.js +9 -0
  527. package/dist/vendor/node-shared/index.d.ts +56 -0
  528. package/dist/vendor/node-shared/index.js +58 -0
  529. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.d.ts +4 -0
  530. package/dist/vendor/node-shared/internal/nodeChildProcessSpawner.js +7 -0
  531. package/dist/vendor/node-shared/internal/utils.d.ts +2 -0
  532. package/dist/vendor/node-shared/internal/utils.js +7 -0
  533. package/dist/vendor/platform-bun.d.ts +92 -0
  534. package/dist/vendor/platform-bun.js +107 -0
  535. package/dist/vendor/platform-node-shared.d.ts +56 -0
  536. package/dist/vendor/platform-node-shared.js +58 -0
  537. package/dist/vendor/platform-node.d.ts +100 -0
  538. package/dist/vendor/platform-node.js +115 -0
  539. package/docs/README.md +158 -0
  540. package/docs/api.md +601 -0
  541. package/docs/concepts/projections.md +250 -0
  542. package/docs/concepts/subscriptions.md +204 -0
  543. package/docs/concepts/trust-boundary.md +256 -0
  544. package/docs/guides/diagnose-a-run.md +115 -0
  545. package/docs/guides/follow-a-run.md +150 -0
  546. package/docs/guides/host-the-gateway.md +153 -0
  547. package/docs/guides/read-a-projection.md +138 -0
  548. package/docs/guides/serve-beyond-loopback.md +166 -0
  549. package/docs/guides/submit-an-approval.md +187 -0
  550. package/docs/guides/testing.md +148 -0
  551. package/docs/installation.md +89 -0
  552. package/docs/quickstart.md +200 -0
  553. package/docs/troubleshooting.md +355 -0
  554. package/package.json +264 -32
  555. package/src/Diagnosis.ts +892 -0
  556. package/src/EngineTrace.ts +627 -0
  557. package/src/GatewayError.ts +71 -0
  558. package/src/GatewayProjection.ts +959 -0
  559. package/src/GatewayRpcs.ts +179 -0
  560. package/src/GatewaySchema.ts +516 -0
  561. package/src/GatewayServer.ts +932 -0
  562. package/src/HostBranchPresence.ts +76 -0
  563. package/src/Projections.ts +1735 -0
  564. package/src/RunDevTools.ts +394 -0
  565. package/src/RunHistory.ts +174 -0
  566. package/src/RunTrace.ts +2796 -0
  567. package/src/RuntimeBridge.ts +835 -0
  568. package/src/bun/BunGateway.ts +52 -0
  569. package/src/index.ts +77 -0
  570. package/src/internal/NativeGateway.ts +360 -0
  571. package/src/internal/actionRenderings.ts +212 -0
  572. package/src/internal/callEvents.ts +257 -0
  573. package/src/internal/digestIndex.ts +134 -0
  574. package/src/internal/digestMemory.ts +27 -0
  575. package/src/internal/inspectLabels.ts +18 -0
  576. package/src/internal/nativeResolution.ts +103 -0
  577. package/src/internal/nodeEvents.ts +100 -0
  578. package/src/node/NodeGateway.ts +30 -0
  579. package/openapi.yaml +0 -29945
  580. package/src/README.md +0 -39
  581. package/src/api/README.md +0 -23
  582. package/src/api/apiCollectionNames.js +0 -10
  583. package/src/api/index.d.ts +0 -126
  584. package/src/api/index.js +0 -14
  585. package/src/api/normalizeApiRow.js +0 -36
  586. package/src/api/serializeAccountRow.js +0 -10
  587. package/src/api/serializeApprovalRow.js +0 -53
  588. package/src/api/serializeComparisonScoreRow.js +0 -18
  589. package/src/api/serializeCronRow.js +0 -30
  590. package/src/api/serializeDocRow.js +0 -20
  591. package/src/api/serializeMemoryFactRow.js +0 -21
  592. package/src/api/serializePromptRow.js +0 -10
  593. package/src/api/serializeRunEventRow.js +0 -28
  594. package/src/api/serializeRunRow.js +0 -93
  595. package/src/api/serializeScoreDetailRow.js +0 -25
  596. package/src/api/serializeScoreRow.js +0 -26
  597. package/src/api/serializeTicketRow.js +0 -20
  598. package/src/api/serializeWorkflowRow.js +0 -10
  599. package/src/auth/scopes.d.ts +0 -19
  600. package/src/auth/scopes.js +0 -164
  601. package/src/index.d.ts +0 -316
  602. package/src/index.js +0 -108
  603. package/src/rpc/gatewayRpcTypes.ts +0 -186
  604. package/src/rpc/index.d.ts +0 -223
  605. package/src/rpc/index.js +0 -2527
package/docs/api.md ADDED
@@ -0,0 +1,601 @@
1
+ ---
2
+ title: "API reference"
3
+ description: "Every public export of @smthrs/gateway: the assembled server and its Node host, the served read path, the wire schemas and folds, the RPC group, the diagnosis renderer, and the failure vocabulary."
4
+ ---
5
+
6
+ The gateway requires `effect` at `4.0.0-rc.115` as its only peer. Node and Bun adapters are bundled privately at the same version; hosts need no separate adapter install.
7
+
8
+ The root entry point exports one namespace per module, and every local module is
9
+ also importable from `@smthrs/gateway/<Module>`.
10
+
11
+ A UI depends on this package and on [`@smthrs/control`](/api/control). It never
12
+ depends on [`@smthrs/engine-store`](/api/engine-store), and it never reads a
13
+ store table: a projection is the contract, and a store row is an implementation
14
+ detail. [`smthrs serve`](/cli/serve) composes the assembly with
15
+ `@smthrs/control` and [`@smthrs/sync`](/api/smithers-sync) to host it.
16
+
17
+ The model behind these signatures is in [Projections](./concepts/projections.md),
18
+ [Subscriptions and cursors](./concepts/subscriptions.md), and
19
+ [The trust boundary](./concepts/trust-boundary.md).
20
+
21
+ ## Example
22
+
23
+ ```ts
24
+ import * as NodeGateway from "@smthrs/gateway/node/NodeGateway"
25
+ import * as Projections from "@smthrs/gateway/Projections"
26
+ import { Layer } from "effect"
27
+
28
+ const health = { workspaceHash: "8f4b2c1d", gatewayId: "host-1", protocolVersion: "1", version: "1.0.0-rc.0" }
29
+ const gateway = NodeGateway.layer(health, NodeGateway.defaultServerOptions).pipe(Layer.provide(Projections.layer))
30
+ ```
31
+
32
+ ## `GatewayServer`
33
+
34
+ The whole HTTP surface as one application layer a host serves.
35
+
36
+ ### Mounts
37
+
38
+ `GatewayServer.layer` mounts seven base routes, and `NodeGateway.layer` binds
39
+ them to a socket. A host that supplies `runtimeBridge` adds three authenticated
40
+ JSON routes.
41
+
42
+ | Path | Protocol | Serves |
43
+ | -------------------------- | ------------------ | ----------------------------------------------------- |
44
+ | `POST /rpc` | RPC over HTTP | `@smthrs/control` `ControlRpcs` |
45
+ | `/rpc/ws` | RPC over WebSocket | `ControlRpcs`, including a kept-alive `Watch` |
46
+ | `POST /projections` | RPC over HTTP | `GatewayRpcs` |
47
+ | `/projections/ws` | RPC over WebSocket | `GatewayRpcs`, including `Projection.Subscribe` |
48
+ | `POST /sync` | RPC over HTTP | `@smthrs/sync` `SyncRpcs` |
49
+ | `/sync/ws` | RPC over WebSocket | `SyncRpcs` |
50
+ | `GET /health` | JSON | `GatewayServer.Health` |
51
+ | `POST /runtime/v1/command` | JSON | Versioned launch and Control mutations (optional) |
52
+ | `POST /runtime/v1/observe` | JSON | Bounded journal replay and run projection (optional) |
53
+ | `POST /runtime/v1/monitor` | JSON | Read-only existing-run monitor and journal (optional) |
54
+
55
+ ### Scoped tokens
56
+
57
+ A credentialed gateway also accepts a token minted under its credential with
58
+ `@smthrs/control` `ScopedToken` (`smthrs token mint`). The edge admits it on
59
+ its signature and expiry alone, and only toward `NodeGateway.scopedTokenPaths`
60
+ (`/rpc`, `/projections`, their sockets, and `/auth/ticket`); every RPC frame is
61
+ then judged in band against the procedures, run, or flow it names, and it
62
+ stamps `NodeGateway.scopedPrincipal` (`gateway/scoped`), which no delegation to
63
+ `gateway/bearer` covers. Journal sync and the runtime bridge accept the bearer
64
+ alone, and a ticket issued against a scoped token opens only what the token
65
+ could open.
66
+
67
+ ### Runtime completion
68
+
69
+ `RuntimeBridge.LifecycleCommand.operation` also accepts `complete` (since
70
+ 1.0.0). `RuntimeBridge.Config.requestComplete?:
71
+ ControlExecutor.Service["requestComplete"]` (since 1.0.0) supplies the host port;
72
+ when absent, the bridge uses the installed executor's port. A host without
73
+ either refuses completion as unavailable.
74
+
75
+ ### Runtime observation cursors
76
+
77
+ `POST /runtime/v1/observe` returns `nextCursor`; pass it back unchanged as
78
+ `afterCursor` with the same `runId`. An empty cursor consumes no events. A
79
+ decimal cursor, such as `"42"`, consumes the whole journal entry. A versioned
80
+ cursor, such as `"v1:42:0"`, consumes only members through that zero-based
81
+ expansion offset. Both numeric components are canonical nonnegative integers
82
+ below `Number.MAX_SAFE_INTEGER`. Existing decimal cursors remain accepted.
83
+
84
+ `hasMore` indicates another event page; `terminal` independently reports the
85
+ run's current lifecycle. Backend failures retain their stable Control code and
86
+ retryability without exposing backend message text.
87
+
88
+ ### Runtime monitor
89
+
90
+ `RuntimeBridge.monitor(control, runId, at?)` reads an existing run through
91
+ `Control.list` and its committed journal through `Control.watch` with
92
+ `follow: false`. It never launches, resumes, signals, or evaluates a flow.
93
+ The authenticated `POST /runtime/v1/monitor` door accepts
94
+ `{ protocol: "smithers.flow-runtime/v1", runId, at? }`; `at` is a nonnegative
95
+ journal sequence. Its response is `{ protocol, ok: true, value }`, or the
96
+ bridge's typed error envelope. Unknown runs return `run_not_found`; bounded
97
+ journal and projection overflow return `resource_limit`.
98
+
99
+ Spend is priced where model calls are metered. A run with journaled model
100
+ tokens returns no `cost_usd`; its steps carry `meter`, the
101
+ `<execution id>:<step key digest>` dispatches each settled node drove, and the
102
+ install prices them from its metered proxy rows. A returned `cost_usd` of zero
103
+ therefore only ever means a run with no model tokens.
104
+
105
+ The current monitor omits the raw journal, which its reader pages from the
106
+ `run-events` projection when the journal tab opens, and carries the run's
107
+ `extent: { start, end }`. A replay frame (`at`) carries its own journal prefix.
108
+
109
+ ### Types and constants
110
+
111
+ | Export | Signature | Meaning |
112
+ | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
113
+ | `Health` | `Schema.Struct` and its type | What `GET /health` answers: gateway identity, package version, and optional non-secret runtime bridge identity. |
114
+ | `LayerOptions` | `{ heartbeatMillis?; ingress?; runtimeBridge? }` | How an assembled gateway is configured. `runtimeBridge` opts into the versioned Go adapter. |
115
+ | `IngressOptions` | `{ maxRequestBodyBytes?: number; loopbackOnly?: boolean; authorize?: (headers, path) => Effect<boolean>; ticketMillis?: number }` | The ingress policy the RPC mounts run behind. |
116
+ | `Ticket` | `Schema.Struct` and its type | What `POST /auth/ticket` answers: `{ ticket, expiresInMs }`, a single-use key that opens one protected socket. |
117
+ | `ticketPath` | `"/auth/ticket"` | Exchanges an accepted bearer for a `Ticket`. Served only when `authorize` is set. |
118
+ | `ticketPaths` | `ReadonlyArray<string>` | `["/rpc/ws", "/projections/ws", "/sync/ws"]`: the sockets a ticket opens as `<mount>?ticket=<ticket>`. |
119
+ | `defaultTicketMillis` | `number` | 30,000. How long an unredeemed ticket stays valid. |
120
+ | `rpcPaths` | `ReadonlyArray<string>` | `["/rpc", "/projections", "/sync"]`: the `POST` mounts that carry RPC request messages. |
121
+ | `boundedPostPaths` | `ReadonlyArray<string>` | RPC mounts plus both runtime bridge routes; every body is bounded before a handler reads it. |
122
+ | `protectedPaths` | `ReadonlyArray<string>` | Projection, sync, WebSocket, and runtime bridge paths that pass edge authentication. |
123
+ | `defaultMaxRequestBodyBytes` | `number` | 1,048,576. The default maximum request body accepted by an RPC mount. |
124
+ | `loopbackHostNames` | `ReadonlyArray<string>` | `["127.0.0.1", "localhost", "::1"]`: the names that mean this machine only, as a bind address is spelled. |
125
+ | `loopbackHostHeaderNames` | `ReadonlyArray<string>` | `["127.0.0.1", "localhost", "[::1]"]`: the same names as a Host header spells them; the default `allowedHosts`. |
126
+ | `watchHeartbeatKind` | `"control.gateway.heartbeat"` | The `ControlEvent` kind a `Watch` keepalive carries. |
127
+
128
+ `POST /rpc` is deliberately not in `protectedPaths`, and `GET /health` is
129
+ deliberately unauthenticated. Both decisions, and the alias handling behind
130
+ `routedPath`, are explained in
131
+ [the trust boundary](./concepts/trust-boundary.md).
132
+
133
+ ### Layers
134
+
135
+ | Export | Signature | Provides |
136
+ | --------------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
137
+ | `layer` | `(health: Health, options?: LayerOptions) => Layer<..., GatewayError, ...>` | The whole surface. Fails with `bind_failed` for a non-positive cadence or body limit. |
138
+ | `layerHealth` | `(health: Health) => Layer<never, never, HttpRouter>` | The unauthenticated `GET /health` probe. |
139
+ | `layerHandlers` | `Layer<Handler<...>, never, Control \| Projections>` | The gateway's own RPC handlers over the read path and the approval mutation. |
140
+ | `layerControlHttp` | `(millis?: number) => Layer<RpcServer.Protocol, never, ...>` | `/rpc` and `/rpc/ws`, with the keepalive merged into `watch`. |
141
+ | `layerProjectionsHttp` | `Layer<RpcServer.Protocol, never, ...>` | `/projections` and `/projections/ws`. Both protocols mount together so they cannot disagree. |
142
+ | `layerSyncHttp` | `Layer<RpcServer.Protocol, never, ...>` | `/sync` and `/sync/ws`. |
143
+ | `layerIngress` | `(options?: IngressOptions) => Layer<...>` | The global middleware: local Host/Origin policy, edge authentication, body limit, and RPC-message check. |
144
+ | `layerKeepAlive` | `(millis?: number) => Layer<Control, never, Control>` | Wraps the ambient `Control` so `watch` emits a keepalive when idle. |
145
+ | `layerProjectionsKeepAlive` | `(millis: number) => Layer<Projections, never, Projections>` | Wraps the ambient `Projections` so a followed subscription beats at the bind's cadence. |
146
+
147
+ `layerKeepAlive` wraps the service rather than re-declaring handlers, which
148
+ keeps `@smthrs/control` `ControlServer` the single definition of what every
149
+ procedure does, including the principal it stamps on mutations.
150
+
151
+ ### Functions
152
+
153
+ | Export | Signature | Answers |
154
+ | ------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
155
+ | `routedPath` | `(url: string) => string` | The mount a request target reaches, spelled the way `rpcPaths` and `protectedPaths` spell it. |
156
+ | `exceededBodyLimit` | `(error: unknown) => boolean` | Whether a failed body read hit the configured size limit rather than failing for another reason. |
157
+ | `bodyRefusal` | `(path: string, maxBytes: number, error: unknown) => { error: GatewayError; status: number }` | 413 `request_too_large` for an overflow, 400 `malformed_request` for every other read failure. |
158
+ | `carriesRpcRequest` | `(serialization: RpcSerialization["Service"], body: string) => boolean` | Whether a body carries at least one RPC message the server can act on. A binary framing is always yes. |
159
+
160
+ ## `node/NodeGateway`
161
+
162
+ The Node host: bind policy, credential policy, and the socket.
163
+
164
+ | Export | Signature | Meaning |
165
+ | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
166
+ | `ServerOptions` | `ListenOptions & { allowedHosts?: readonly string[]; listen?: boolean; credential?: string; heartbeatMillis?: number; maxRequestBodyBytes?: number }` | Bind address, explicitly admitted Host names, authentication, and request limits. |
167
+ | `defaultServerOptions` | `ServerOptions` | `{ host: "127.0.0.1", port: 7331 }`: loopback, no credential. |
168
+ | `isLoopbackHost` | `(host: string) => boolean` | True for `127.0.0.1`, `::1`, and `localhost`, and nothing else. |
169
+ | `bindRefusal` | `(options: ServerOptions) => GatewayError \| undefined` | The typed `bind_failed` refusal a requested bind earns, or `undefined` when it is allowed. |
170
+ | `listenOptions` | `(options: ServerOptions) => Effect<ListenOptions, GatewayError>` | The admitted `node:net` options, with this module's own fields removed, or that refusal in the error channel. |
171
+ | `ingressOptions` | `(options: ServerOptions) => GatewayServer.IngressOptions` | The Host policy for a bind: the loopback names, `allowedHosts`, and the concrete bind host; a wildcard bind adds nothing. |
172
+ | `layerAuth` | `(options: ServerOptions) => Layer<ControlRpcs.ControlAuth>` | The bearer or a scoped token minted under it when a credential is configured; the loopback-only local operator otherwise. |
173
+ | `bearerPrincipal` | `Readonly<{ id: string; kind: string }>` | The frozen `{ id: "gateway", kind: "bearer" }` identity stamped by shared-bearer authentication. |
174
+ | `scopedPrincipal` | `Readonly<{ id: string; kind: string }>` | The frozen `{ id: "gateway", kind: "scoped" }` identity a verified scoped token stamps. |
175
+ | `scopedTokenPaths` | `ReadonlyArray<string>` | The protected mounts a scoped token may reach at the edge: `/rpc`, `/projections`, their sockets, and `/auth/ticket`. |
176
+ | `layer` | `(health: GatewayServer.Health, options?: ServerOptions) => Layer<..., GatewayError, Control \| SyncAuth \| SyncServer \| Projections>` | The assembled gateway on a Node HTTP server. |
177
+
178
+ `layer` supplies the bind policy, the shared-credential authentication both RPC
179
+ mounts run under, and newline-delimited JSON as the wire serialization. The
180
+ caller supplies `Control`, `Projections`, `SyncServer`, and `SyncAuth`. The
181
+ returned layer retains the concrete `HttpServer` service, so a caller that
182
+ bound port 0 can read the ephemeral address it got. Policy refusals and
183
+ operating-system listen failures both fail the layer as sanitized `bind_failed`
184
+ values.
185
+
186
+ ### Bind and credential policy
187
+
188
+ Two rules decide whether a bind is allowed, and both fail closed.
189
+
190
+ 1. A non-loopback host requires an explicit `listen` opt-in.
191
+ 2. A non-loopback bind requires a bearer credential.
192
+
193
+ A loopback bind with no credential is allowed and is the local default. One
194
+ shared bearer authenticates every mount as `bearerPrincipal`. This does not
195
+ grant approval authority. The owning Control runtime must explicitly delegate
196
+ the allowed approval target kinds and scopes through `ApprovalAuthority`;
197
+ without that delegation, bearer approve and deny requests are unauthorized.
198
+ Every holder of the shared credential has the same delegated authority. See
199
+ [Serve beyond loopback](./guides/serve-beyond-loopback.md).
200
+
201
+ Without that bearer, `NodeGateway.layer` enables `loopbackOnly`: every request
202
+ must carry a loopback `Host`. With or without a bearer, a supplied browser
203
+ `Origin` must be a canonical HTTP(S) origin whose host and port equal the
204
+ request's `Host`; serve a browser client from the gateway's origin or through a
205
+ same-origin proxy. An Origin-less CLI request remains accepted. The same guard runs on HTTP and WebSocket
206
+ upgrades before any mount handles them.
207
+
208
+ ## `Projections`
209
+
210
+ The read path, served as bounded snapshots and followed deltas.
211
+
212
+ | Export | Signature | Meaning |
213
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
214
+ | `Projections` | `Context.Service` tagged `@smthrs/gateway/Projections` | The service tag the mounts read through. |
215
+ | `Service` | `{ snapshot; subscribe }` | Read-path operations served by the gateway. |
216
+ | `Service.snapshot` | `<S extends ProjectionSelector>(selector: S, after?: ProjectionCursor) => Effect<SnapshotOf<S>, GatewayError>` | Current rows, or the run-events suffix after `after`, with the current cursor. |
217
+ | `Service.subscribe` | `<S extends ProjectionSelector>(selector: S, after?: ProjectionCursor) => Stream<FrameOf<S>, GatewayError>` | A snapshot followed by deltas and keepalives, or, with `after`, the deltas after that cursor alone. |
218
+ | `make` | `(control: ControlService, options?: { heartbeatMillis?: number }) => Effect<Service, GatewayError>` | Builds the read path over a control plane. Invalid settings are `bind_failed` failures; construction never throws. |
219
+ | `layer` | `Layer<Projections, GatewayError, Control>` | The read path over the ambient control plane, at the default cadence. |
220
+ | `layerWith` | `(options: { heartbeatMillis?: number }) => Layer<Projections, GatewayError, Control>` | The same under an explicit keepalive cadence. |
221
+ | `heartbeatIntervalMillis` | `30_000` | How often an idle subscription emits a keepalive frame. |
222
+ | `maxWorkspaceRuns` | `500` | The most runs one workspace projection folds, newest first. Equals `ControlSchema.maxPageSize`. |
223
+ | `maxEventsPerRun` | `10_000` | The most journal events retained per run; older events enter the carried digest. |
224
+ | `maxEventsPerPage` | `1_000` | The most events one `run-events` page returns. |
225
+ | `maxEventBytes` | `16 * 1024` | Retained event size before clipping. Native engine events on `run-events` pages are exempt. |
226
+ | `maxProjectionBytes` | `4 * 1024 * 1024` | The encoded byte budget for retained events plus digest identity state, an event page, or a projected row set. |
227
+
228
+ `ControlService` is `@smthrs/control` `Control`'s service interface, the shape
229
+ the tag carries.
230
+
231
+ `run-events` pages return complete `control.engine.event` payloads so clients
232
+ can decode native result contracts. Other oversized events are clipped. A
233
+ single encoded event plus its array brackets exceeding `maxProjectionBytes`
234
+ fails with `GatewayError` code `resource_limit`; a full page ends at its cursor.
235
+
236
+ ## `GatewaySchema`
237
+
238
+ The wire schemas the read path and its subscriptions speak. Every entry is an
239
+ `effect` `Schema` with a same-named type. Every schema here is served: the
240
+ gateway mints, reads, or answers with each one.
241
+
242
+ ### Identity
243
+
244
+ | Export | Fields |
245
+ | --------------- | ----------------------------------------------- |
246
+ | `GatewayHealth` | `workspaceHash`, `gatewayId`, `protocolVersion` |
247
+
248
+ ### Selectors
249
+
250
+ | Export | Shape |
251
+ | ----------------------- | ---------------------------------------- |
252
+ | `ProjectionName` | the eight served projection names |
253
+ | `WorkspaceRunsSelector` | `{ _tag: "workspace-runs" }` |
254
+ | `RunSummarySelector` | `{ _tag: "run-summary", runId }` |
255
+ | `RunEventsSelector` | `{ _tag: "run-events", runId }` |
256
+ | `TranscriptSelector` | `{ _tag: "transcript", runId }` |
257
+ | `RunTreeSelector` | `{ _tag: "run-tree", runId }` |
258
+ | `ApprovalsSelector` | `{ _tag: "approvals", runId? }` |
259
+ | `NodeOutputSelector` | `{ _tag: "node-output", runId, nodeId }` |
260
+ | `FlowDurationsSelector` | `{ _tag: "flow-durations", flowId }` |
261
+ | `ProjectionSelector` | the union of the eight |
262
+
263
+ `ApprovalsSelector` without `runId` lists the workspace's pending gates, which
264
+ is the approvals inbox. With one it lists that run's gates including the decided
265
+ ones, which is what a run card renders.
266
+
267
+ `FlowDurationsSelector` is the one selector scoped to a flow rather than to a
268
+ run. It ranks the durations the flow's newest finished runs measured, so a
269
+ client reads it once when it opens a card and again when a run finishes, never
270
+ inside a poll loop.
271
+
272
+ `rowSchemaFor<S extends ProjectionSelector>(selector: S)` answers the schema of
273
+ the rows that selector projects, so a client decodes a snapshot instead of
274
+ casting it. A literal selector keeps its own row: `rowSchemaFor({ _tag:
275
+ "approvals" })` is `ApprovalRow`, not the union of every row. `RowOf<S>` is that
276
+ row's type.
277
+
278
+ ### Cursors, snapshots, and frames
279
+
280
+ `Projection.Snapshot` accepts optional `after: ProjectionCursor` for
281
+ `run-events` only. It returns rows strictly after that sequence and offset,
282
+ with the cursor the read reached. An unchanged journal returns no rows, and so
283
+ does a cursor at or past the journal's head. The cursor must belong to the same
284
+ selector and run; other selectors with `after` return `malformed_request`.
285
+ Omit `after` for the first page: the empty cursor `0:0` also names the first
286
+ sequence-zero event.
287
+
288
+ A `run-events` snapshot is a PAGE, not the whole journal. It carries at most
289
+ `maxEventsPerPage` events and `maxProjectionBytes`, whichever binds first, and
290
+ the cursor it answers with names the last event it carried. A reader pages by
291
+ passing that cursor back until a page comes back empty. Every other selector
292
+ answers rows whose size the selector bounds, so it reads the reconciled source
293
+ and needs no paging.
294
+
295
+ | Export | Shape |
296
+ | -------------------- | -------------------------------------------------------------------------- |
297
+ | `ProjectionCursor` | `{ selector, projection, runId: string \| null, value: int, offset: int }` |
298
+ | `ProjectionSnapshot` | `{ selector, cursor, rows }`, correlated on the selector |
299
+ | `SnapshotStartFrame` | `{ _tag: "snapshot-start", selector, cursor }` |
300
+ | `RowFrame` | `{ _tag: "row", selector, cursor, row }` |
301
+ | `SnapshotEndFrame` | `{ _tag: "snapshot-end", selector, cursor }` |
302
+ | `DeltaFrame` | `{ _tag: "delta", selector, cursor, delta }` |
303
+ | `HeartbeatFrame` | `{ _tag: "heartbeat", atMs }` |
304
+ | `GatewayFrame` | the union of all five frame kinds |
305
+
306
+ `ProjectionSnapshot`, `RowFrame`, and `DeltaFrame` are unions correlated on the
307
+ selector, so a payload whose rows do not belong to its selector does not decode.
308
+ One table in `GatewaySchema` pairs each selector with its row, and those three
309
+ unions, `ProjectionName`, and `rowSchemaFor` all derive from it.
310
+ `runId` is `null` for a workspace cursor, whose `value` is always 0, because
311
+ control journal sequences belong to per-run partitions and no workspace-wide
312
+ sequence exists.
313
+
314
+ `SnapshotOf<S>` is the snapshot one selector answers with and `FrameOf<S>` the
315
+ frames its subscription emits, so a literal selector keeps its own rows. A
316
+ selector chosen at runtime maps to the full `ProjectionSnapshot` and
317
+ `GatewayFrame` unions, which is what it can be answered with.
318
+
319
+ ## `GatewayProjection`
320
+
321
+ The stable wire rows and the pure folds that compute them. Nothing here exposes
322
+ a store row, a database column, or an engine type.
323
+
324
+ ### Rows
325
+
326
+ | Export | Carries |
327
+ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
328
+ | `RunSummaryRow` | `runId`, `flowId`, `status`, `statusRollup` (the `@smthrs/control` `Health.StatusRollup` a status surface renders; optional on the wire, folded on every row the gateway serves), `createdAt`, `updatedAt`, the optional plan, lineage, waiting, steering, cancellation, and seat fields, the activity and token counters, `verdict`, `diagnosis`, and `finalOutput`. |
329
+ | `RunTreeRow` | `runId`, `nodeId`, `label`, `status` (`running`, `completed`, `failed`), `seat?`, `startedAt`, `endedAt?`, `parentRunId?`. |
330
+ | `ApprovalRow` | `runId`, `requestId`, `title`, `request`, `payload` (the `ControlSchema.ApprovalPayload` a client submits back), `requestedAt`, `status`. |
331
+ | `NodeOutputRow` | `runId`, `nodeId`, `outcome` (`success` or `failure`), `output`, `settledAt`. |
332
+ | `TranscriptRow` | `runId`, `sequence`, `turn`, `at`, `kind`, `text`. Each `text` is one display line. |
333
+
334
+ ### Folds
335
+
336
+ | Export | Signature | Notes |
337
+ | -------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
338
+ | `runSummary` | `(run: ControlSchema.RunSummary, events, now?) => RunSummaryRow` | Status comes from the run row, everything else from the events. `now` expires the health reading; it defaults to the later of the row's `updatedAt` and the last event. |
339
+ | `statusRollup` | `(run: ControlSchema.RunSummary, events, now) => Health.StatusRollup` | Lifecycle from the run row; activity and observed health from the current incarnation's highest evidence sequence, with durable sequence breaking ties. Freshness also requires a successful reading whose evidence covers later progress and whose lifetime includes `now`. Stale readings retain provenance but cannot establish activity. A malformed observation or one from a former owner colors nothing. |
340
+ | `runTree` | `(run: ControlSchema.RunSummary, events) => ReadonlyArray<RunTreeRow>` | Keys each call by the ordinal it opened on; pairs a settlement with the oldest open call of that flow name. |
341
+ | `approvals` | `(events) => ReadonlyArray<ApprovalRow>` | A decision closes the gate its `tokenId` names; one naming neither field closes the oldest pending gate. |
342
+ | `nodeOutput` | `(events) => ReadonlyArray<NodeOutputRow>` | Keyed the way `runTree` keys its rows, so both agree on a node id. |
343
+ | `transcript` | `(events) => ReadonlyArray<TranscriptRow>` | One row per `control.run.*`, `control.agent.*`, and approval-request event, numbered by turn. |
344
+
345
+ `statusRollup` is an additive optional wire field. Existing Effect decoders
346
+ strip unknown properties by default, and current clients still decode older
347
+ rows without it. The app validates the subject and lifecycle, expires stale
348
+ activity, and falls back to the existing status when the field is absent.
349
+ Clients configured to reject unknown properties must admit this field before
350
+ reading the newer wire shape.
351
+
352
+ Every fold takes `ReadonlyArray<ControlSchema.ControlEvent>` in run order and is
353
+ total: an unknown kind contributes nothing.
354
+
355
+ ## `GatewayRpcs`
356
+
357
+ The gateway's own remote procedures. Control mutations are not re-declared here:
358
+ `@smthrs/control` `ControlRpcs` is the mutation contract, and the gateway mounts
359
+ it unchanged on `/rpc`. The group shares `ControlRpcs.ControlAuth`, so one
360
+ bearer credential authenticates both mounts.
361
+
362
+ | Procedure | Payload | Success | Error |
363
+ | ---------------------- | --------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
364
+ | `Projection.Snapshot` | `{ selector }` | `ProjectionSnapshot` | `GatewayError` |
365
+ | `Projection.Subscribe` | `{ selector, after? }`, streaming | `GatewayFrame` | `GatewayError` |
366
+ | `Approval.Submit` | `SubmitApprovalInput` | `SubmitApprovalOutput` | `PlanDigestMismatch`, `EnvelopeMismatch`, `AlreadyResolved`, `PlanNotFound`, `RunNotFound`, `InvalidInput`, `Unauthorized`, `PersistenceError`, `Unavailable`, `TransportError` |
367
+ | `Run.Fork` | `RunHistory.ForkInput` | `RunHistory.ForkOutput` | `HistoryRefused`, `Unauthorized`, `Unavailable` |
368
+ | `Run.Verify` | `RunHistory.VerifyInput` | `RunHistory.VerifyReport` | `HistoryRefused`, `Unauthorized`, `Unavailable` |
369
+
370
+ | Export | Shape |
371
+ | ---------------------- | --------------------------------------------------------- |
372
+ | `Decision` | `"approve" \| "deny"` |
373
+ | `SubmitApprovalInput` | `ControlSchema.ApprovalPayload` fields plus `decision` |
374
+ | `SubmitApprovalOutput` | `{ decision: ControlSchema.Receipt }` |
375
+ | `GatewayRpcs` | the `RpcGroup`, with `ControlRpcs.ControlAuth` middleware |
376
+
377
+ `Approval.Submit` is the transport form of Control's single decision command.
378
+ Control records the decision and its durable resume delegation as one domain
379
+ command; the gateway never composes a second mutation, and its error union is
380
+ exactly the one `Control.approve` and `Control.deny` declare. See
381
+ [Submit an approval from a client](./guides/submit-an-approval.md).
382
+
383
+ `Run.Fork` and `Run.Verify` are served by the host that owns the project's
384
+ stores, through `RunHistory`; see below.
385
+
386
+ ## `RunHistory`
387
+
388
+ A run's recorded history as the gateway serves it. `Run.Fork` branches a run at
389
+ the exact journal sequence `at` into a parked child, optionally with one step's
390
+ recorded result replaced; `Run.Verify` reports what resuming a run under the
391
+ current flow code would replay and what it would execute again. They answer
392
+ exactly what `smthrs runs fork` and `smthrs runs verify` print, because
393
+ `smthrs serve` implements the service over the same history library. A gateway
394
+ composed without the service answers both `Unavailable`. Both procedures are
395
+ in the `write:runs` token scope, and an anonymous loopback caller is
396
+ `Unauthorized`: a fork writes a durable run and a verification drives the
397
+ project's flow code.
398
+
399
+ | Export | Shape |
400
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
401
+ | `Step` | `{ stepKeyDigest, action?, node? }` |
402
+ | `VerifyInput` | `{ runId }` |
403
+ | `VerifyReport` | `{ runId, verdict: "consistent" \| "divergent", replayed, resumes?, executes?, notReplayed }` |
404
+ | `StepEdit` | `{ stepKeyDigest, result }` |
405
+ | `ForkInput` | `{ runId, at, lineage?, step?: StepEdit }` |
406
+ | `ForkOutput` | `{ runId, parentRunId, status: "parked" }` |
407
+ | `HistoryRefused` | the host's refusal: the CLI's stable `code` and sentence (`history_missing`, `history_frame_missing`, `run_active`, ...) |
408
+ | `Service` | `{ fork(input), verify(input) }` |
409
+ | `RunHistory` | the service tag a host provides |
410
+
411
+ A divergent report is an answer, not a failure: the CLI exits 1 with
412
+ `run_divergent` for it, while `Run.Verify` returns the report so a client can
413
+ show which recorded steps would not replay.
414
+
415
+ ## `Diagnosis`
416
+
417
+ What happened to a run, computed from that run's own control events. This is
418
+ the one fold both surfaces read: `@smthrs/cli` `Forensics` calls `digest` and
419
+ adds what a terminal card needs on top of it, so the served row and
420
+ [`smthrs runs show`](/cli/runs) cannot disagree about a run's counts, refusals,
421
+ or clipping.
422
+
423
+ | Export | Signature | Answers |
424
+ | ---------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
425
+ | `Digest` | interface | Status, cause, seat, turn and call counts, edits, refusals, tokens, final output, pending question, and the span the events cover. |
426
+ | `Refusal` | `{ message: string; count: number }` | One refused flow call, aggregated by its message. |
427
+ | `Subject` | `{ runId: string; flowId?: string }` | The identity a diagnosis is rendered for. |
428
+ | `RunStatus` | `ControlSchema.RunStatus` | The run statuses a digest may report. |
429
+ | `digest` | `(events, runId?) => Digest` | The facts. Total: an unknown kind contributes nothing, including its timestamp. With `runId`, a `control.run.*` verdict stamped with another run's id is skipped. |
430
+ | `resolvedOutput` | `(value: Pick<Digest, "finalOutput" \| "nativeResolution">) => string \| undefined` | Assistant output first, otherwise a committed native result matching the host's root binding. |
431
+ | `verdict` | `(value: Digest) => string` | One line: the status plus the reason that most explains it. |
432
+ | `duration` | `(span: Pick<Digest, "startedAt" \| "endedAt">) => string` | The wall-clock span the handled events cover, as `12s` or `3m 04s`. |
433
+ | `usd` | `(value: number) => string` | A USD amount: `$12.34` from one dollar, `$0.0042` below it. |
434
+ | `render` | `(subject: Subject, value: Digest) => string` | The whole card: verdict, activity evidence, tokens, cost, refusals, cause, and output. |
435
+ | `asRecord` | `(value: unknown) => Record<string, unknown>` | A wire payload as a record, or an empty record when it is not one. |
436
+ | `asString` | `(value: unknown) => string \| undefined` | A payload field as a string, or nothing. |
437
+ | `asNumber` | `(value: unknown) => number \| undefined` | A payload field as a number, or nothing. |
438
+ | `timeOf` | `(event) => number` | When an event occurred: its payload's own stamp, else journal admission time. |
439
+ | `firstLine` | `(text: string) => string` | The first line, whichever line ending produced it, so a CRLF cause loses its carriage return. |
440
+ | `clip` | `(text: string, width: number) => string` | Truncation on code points, never on UTF-16 code units, marking the cut with an ellipsis. |
441
+
442
+ `RunSummaryRow.verdict` and `RunSummaryRow.diagnosis` are `verdict` and `render`
443
+ already applied, so a client rendering a run card calls neither. See
444
+ [Diagnose what happened to a run](./guides/diagnose-a-run.md).
445
+
446
+ `emptyDigest()` is the identity for `combine(earlier, later)`. Digests retain
447
+ private in-memory scalar identity contributions so adjacent ranges deduplicate
448
+ replayed calls and checkpoints and prefer native facts over telemetry. Keep the
449
+ returned digest objects when combining ranges; serialized or spread copies
450
+ retain only aggregate facts, not this reconciliation state. Gateway projection
451
+ retention charges this state to the existing byte budget and returns
452
+ `resource_limit` if exact state cannot fit.
453
+
454
+ `Digest.nativeResolution` optionally retains `binding: { runId, executionId }`,
455
+ `result: { runId, executionId, text }`, and `conflict: true` across bounded
456
+ journal windows. `combine` preserves this evidence. `resolvedOutput` accepts
457
+ only an unambiguous committed success for the bound `agent/run` root, ignoring
458
+ child results and telemetry. String results remain strings; other JSON values
459
+ are serialized. `RunSummaryRow.finalOutput`, `verdict`, and `diagnosis` use
460
+ this resolved output.
461
+
462
+ ## `GatewayError`
463
+
464
+ | Export | Signature | Meaning |
465
+ | ------------------ | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
466
+ | `GatewayErrorCode` | nine literals | The whole failure vocabulary. |
467
+ | `GatewayError` | `Schema.TaggedError` tagged `@smthrs/gateway/GatewayError` | `{ code, message, cause? }`, where `cause` is a `{ _tag, code? }` summary and nothing more. |
468
+ | `settingRefusal` | `(name: string, value: number \| undefined) => GatewayError \| undefined` | The refusal a numeric setting earns when it is not a positive safe integer. |
469
+
470
+ Every code is constructed by a real path, and the declared vocabulary is exactly
471
+ the set those paths produce.
472
+
473
+ | Code | Status | Produced by |
474
+ | ------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
475
+ | `bind_failed` | none | `NodeGateway.bindRefusal`, `NodeGateway.listenOptions`, `GatewayServer.layer`, `GatewayServer.layerIngress`, and `Projections.make`, at composition time |
476
+ | `invalid_host` | 421 | the ingress guard, when `Host` is not in `allowedHosts`, or under `loopbackOnly` does not name `localhost`, `127.0.0.1`, or `[::1]` |
477
+ | `invalid_origin` | 403 | the ingress guard, when a supplied browser `Origin` is not a canonical HTTP(S) origin whose host and port equal the request's `Host` |
478
+ | `unauthorized` | 401 | the ingress guard, on any protected path without the configured credential |
479
+ | `malformed_request` | 400 | the ingress guard, for a `POST` body carrying no RPC request message or a body it could not read, and the read path, for an invalid resume cursor |
480
+ | `request_too_large` | 413 | the ingress guard, for a body over the configured limit |
481
+ | `resource_limit` | none | the read path, when one run or projected row set exceeds its event or encoded-byte allowance |
482
+ | `run_unavailable` | none | the read path, when listing runs, reading a run's events, or following a run or the workspace failed |
483
+ | `run_not_found` | none | the read path, for a run the control plane does not have, identically for every run-scoped selector |
484
+
485
+ `GatewayError.cause` carries only a redacted summary of an internal failure: its
486
+ tag and its stable code. Projection warnings log an allowlisted operation
487
+ identifier and known control error tag/code pairs. Backend messages, nested
488
+ causes, SQL, and file paths are omitted from projection logs.
489
+
490
+ ## `Sync`
491
+
492
+ The root entry re-exports [`@smthrs/sync`](/api/smithers-sync) whole, so a gateway host
493
+ gets the read-only journal replication protocol from the same import:
494
+ `SyncClient`, `SyncServer`, `SyncProtocol`, `SyncRpcs`, `SyncError`,
495
+ `RunCatalog`, and the rest of that package's namespaces.
496
+
497
+ Sync is read-only in both senses: a follower cannot mutate a run, and it cannot
498
+ resume one. See [Sync and read-only followers](/docs/concepts/sync/).
499
+
500
+ ## `RunTrace`
501
+
502
+ The pure journal projection shared by the app and terminal monitors. Import
503
+ `@smthrs/gateway/RunTrace`; it requires no server or filesystem. Records without
504
+ evidence do not acquire invented phases, successful checks, or file changes.
505
+
506
+ - `traceFromJournal(run, records, options?)` builds a `TraceModel`: nested
507
+ spans, frame summaries, phase bands, milestone pins, and discipline notes.
508
+ - `monitorFromJournal(run, records, at?)` adapts that same fold to the install
509
+ monitor: recorded step instances, deterministic phases, approval, sleep and deferred signal waits,
510
+ bookkeeping and the raw journal. Steps are the nodes that dispatched an
511
+ action; plan structure (`AndThen`, `Branch`, `Map` and the rest) and
512
+ child-flow calls, whose own nodes are the steps, are not steps. A phase's
513
+ title is its label plus the failures its recorded check receipts report
514
+ ("Ran checks · 1 failed"). Bookkeeping nodes appear only in the Engine row;
515
+ graph edges through them retain the visible dependency order. Declared native graph pages retain
516
+ unreached nodes and dependency edges; recorded node instances supply their
517
+ live states. Rescheduled native nodes retain separate instance keys. A replay
518
+ folds only records through `at`, derives terminal
519
+ state from that prefix, and returns `replay: { at, last }`. It does not fetch
520
+ a registry or execute presentation code. Each settled native step lists the
521
+ dispatches it drove (`meter`), its journaled model calls and tokens, and its
522
+ agent transcript as phase cells: model replies, cells with what they printed,
523
+ and tool calls labelled by their recorded presentation ("Read t5.md"). The
524
+ current adapter does not yet reconstruct all native wait kinds;
525
+ Clock and deferred waits use typed native lifecycle observations, clock
526
+ registrations and explicit deferred settlements. Deferred identities have no
527
+ recorded question, pause or external-job classification and remain signals.
528
+ Running or completed execution status alone never settles a wait. Repeated registrations retain the opening timestamp, generations
529
+ have separate identities, and replay hides settlements beyond its cursor;
530
+ callers price `meter` dispatches as described above.
531
+ - `inspectLabel(tag)` reads the build-generated Appendix C Inspect rendering.
532
+ Coding call and native execution spans use the same labels. Dynamic
533
+ `<cell-call:flow>` wrappers use the wrapped action's rendering; unknown
534
+ historical tags keep their recorded id. Inspection and replay read data only.
535
+ - `traceFold(run, records?)` holds the same fold open. `traceFoldStep(fold,
536
+ record)` adds one record at the cost of that record; `traceFoldSync(fold, run,
537
+ records)` steps only what a grown journal appended; `traceFoldModel(fold,
538
+ status)` returns the model `traceFromJournal` would build for the same records.
539
+ A record out of sequence order, or a native fact that supersedes earlier
540
+ telemetry, refolds the journal. `TraceFold` types the handle.
541
+ - `runMemoryOf(records)` folds the `relevance-settled` rows into the memory a
542
+ run was brought and the memory Jev withheld, by id and relevance, most
543
+ relevant first; undefined when Jev never read. `RunMemory` and `MemoryItem`
544
+ type it. `smthrs status` prints the same fold.
545
+ - `turnNarratives(model)` derives concise recorded turn text. `spanPath(model,
546
+ id)` finds recorded ancestry. `durationWords(ms)` formats elapsed time.
547
+ - `waterfallGeometry`, `phaseExtent`, and `phaseBandGeometry` calculate layout
548
+ from recorded time. Historical inspection folds a journal prefix while the
549
+ full trace supplies stable geometry.
550
+ - `callSubject` and `callSemantics` interpret captured flow descriptors, with
551
+ compatibility for older records. `CallMetadata` names their descriptor fields.
552
+ - `spanMatches`, `traceFiltersFor`, `isTraceFilter`, and `TRACE_FILTER_IDS` own
553
+ the shared filter vocabulary (`all`, `running`, `failed`, `model`, `flow`,
554
+ `messages`). Historical fork spans remain readable without a fork filter. `TraceFilter` and `TraceView` type that state.
555
+ - `JournalRecord`, `TraceRun`, `TraceOptions`, `TraceSpan`, `TranscriptCell`, `SpanKind`,
556
+ `SpanStatus`, `SpanDetail`, `TraceExtent`, `PhaseId`, `PhaseBand`, `Milestone`,
557
+ `TraceOwner`, `FrameLine`, `TraceNote`, and `TurnNarrative` describe the
558
+ projection. `TranscriptCell` records one agent action inside a native step:
559
+ its kind, label, optional code or output, model tokens, duration, and tone.
560
+ `TraceBuilder` is the mutable draft used while folding, never a
561
+ persisted graph or a second execution model.
562
+
563
+ The install monitor folds `flows.run.presentation` records from the machine's
564
+ native journal. A machine declares its custom view with `{ "kind": "text", "text":
565
+ "Hello, Ada" }` (at most 65,536 characters). The shipped Run Container renders
566
+ that text as an escaped custom slot beside the graph. Unsupported kinds and
567
+ extra fields are refused; repository modules and HTML are never loaded. Replay
568
+ uses the last declaration in its selected journal prefix, and a run without a
569
+ declaration has no custom slot. Host-priced `steps[].usage` supplies dollar
570
+ costs; repeated instances of a step are summed, while unpriced steps omit cost.
571
+
572
+ ## `RunDevTools`
573
+
574
+ `@smthrs/gateway/RunDevTools` is the DevTools projection: a run inspected
575
+ like a component tree, as a view over the `RunTrace` model the run card, the
576
+ terminal and `smthrs runs devtools` already fold. `devTools(model)` is the tree
577
+ (`DevToolsModel`: one `DevToolsNode` per span with its measured timing, the
578
+ run's counts and wall time); `inspect(model, id?, options?)` is one node's
579
+ `DevToolsInspection` (recorded input, output, script, printed text, failure,
580
+ seat, tokens, child run, opening event, remaining fields, and the newest
581
+ `DevToolsFrame` records written while it was open, bounded by
582
+ `DevToolsOptions.frames`, `defaultFrameLimit` by default); `framesOf(model,
583
+ span)` is that frame rule alone; `lines(model, selected?, options?)` renders
584
+ the tree and the inspection as text for a terminal. Pure: no server, no
585
+ filesystem, no clock.
586
+
587
+ ## `EngineTrace`
588
+
589
+ `@smthrs/gateway/EngineTrace` decodes native journal envelopes through the
590
+ contracts that wrote them. `engineTraceFromJournal(records)` produces spans;
591
+ `engineExecutionEvidence(records)` returns typed `EngineExecutionEvidence` for
592
+ result projections. `engineRunEvidence(records, rootId, cursorSeq?)` limits
593
+ facts to recorded ancestry and the inspection cursor. `engineProjectionPending`
594
+ reports unfinished observation independently of the run's terminal verdict.
595
+
596
+ ## Host branch presence
597
+
598
+ `HostBranchPresence.layer(config)` composes the authenticated native host's
599
+ `/branch` presence RPCs and lease roster. It requires `RuntimeBridge.Config`
600
+ authentication on every RPC and refuses non-presence operations as `unsupported`.
601
+ This is a host adapter used by `GatewayServer`, rather than a package export path.