@moltzap/client 2026.1002.0 → 2026.1004.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (492) hide show
  1. package/README.md +2 -2
  2. package/bin/moltzapd +2 -2
  3. package/dist/{harness-mcp-contract.d.ts → delivery/history-export.d.ts} +94 -133
  4. package/dist/delivery/history-export.d.ts.map +1 -0
  5. package/dist/{daemon/runtime → delivery}/history-export.js +36 -3
  6. package/dist/delivery/history-export.js.map +1 -0
  7. package/dist/delivery/host-delivery.d.ts +51 -0
  8. package/dist/delivery/host-delivery.d.ts.map +1 -0
  9. package/dist/delivery/host-delivery.js +109 -0
  10. package/dist/delivery/host-delivery.js.map +1 -0
  11. package/dist/delivery/inbox.d.ts +141 -0
  12. package/dist/delivery/inbox.d.ts.map +1 -0
  13. package/dist/delivery/inbox.js +129 -0
  14. package/dist/delivery/inbox.js.map +1 -0
  15. package/dist/delivery/index.d.ts +4 -0
  16. package/dist/delivery/index.d.ts.map +1 -0
  17. package/dist/delivery/index.js +4 -0
  18. package/dist/delivery/index.js.map +1 -0
  19. package/dist/delivery/operations.d.ts +789 -0
  20. package/dist/delivery/operations.d.ts.map +1 -0
  21. package/dist/delivery/operations.js +162 -0
  22. package/dist/delivery/operations.js.map +1 -0
  23. package/dist/delivery/pass.d.ts +91 -0
  24. package/dist/delivery/pass.d.ts.map +1 -0
  25. package/dist/{daemon/runtime/pending-delivery.js → delivery/pass.js} +61 -34
  26. package/dist/delivery/pass.js.map +1 -0
  27. package/dist/delivery/send-invocations.d.ts +106 -0
  28. package/dist/delivery/send-invocations.d.ts.map +1 -0
  29. package/dist/delivery/send-invocations.js +109 -0
  30. package/dist/delivery/send-invocations.js.map +1 -0
  31. package/dist/endpoint/harness-endpoint/capability.d.ts +39 -0
  32. package/dist/endpoint/harness-endpoint/capability.d.ts.map +1 -0
  33. package/dist/endpoint/harness-endpoint/capability.js +9 -0
  34. package/dist/endpoint/harness-endpoint/capability.js.map +1 -0
  35. package/dist/endpoint/harness-endpoint/events.d.ts +12 -0
  36. package/dist/endpoint/harness-endpoint/events.d.ts.map +1 -0
  37. package/dist/endpoint/harness-endpoint/events.js +199 -0
  38. package/dist/endpoint/harness-endpoint/events.js.map +1 -0
  39. package/dist/{client-runtime.d.ts → endpoint/harness-endpoint/index.d.ts} +4 -2
  40. package/dist/endpoint/harness-endpoint/index.d.ts.map +1 -0
  41. package/dist/{client-runtime.js → endpoint/harness-endpoint/index.js} +115 -115
  42. package/dist/endpoint/harness-endpoint/index.js.map +1 -0
  43. package/dist/endpoint/implementation.d.ts +4 -0
  44. package/dist/endpoint/implementation.d.ts.map +1 -0
  45. package/dist/endpoint/implementation.js +5 -0
  46. package/dist/endpoint/implementation.js.map +1 -0
  47. package/dist/endpoint/mcp/auth.d.ts +31 -0
  48. package/dist/endpoint/mcp/auth.d.ts.map +1 -0
  49. package/dist/endpoint/mcp/auth.js +42 -0
  50. package/dist/endpoint/mcp/auth.js.map +1 -0
  51. package/dist/endpoint/mcp/event-schemas.d.ts +151 -0
  52. package/dist/endpoint/mcp/event-schemas.d.ts.map +1 -0
  53. package/dist/endpoint/mcp/event-schemas.js +72 -0
  54. package/dist/endpoint/mcp/event-schemas.js.map +1 -0
  55. package/dist/endpoint/mcp/event-signing.d.ts +62 -0
  56. package/dist/endpoint/mcp/event-signing.d.ts.map +1 -0
  57. package/dist/endpoint/mcp/event-signing.js +185 -0
  58. package/dist/endpoint/mcp/event-signing.js.map +1 -0
  59. package/dist/endpoint/mcp/events.d.ts +45 -0
  60. package/dist/endpoint/mcp/events.d.ts.map +1 -0
  61. package/dist/endpoint/mcp/events.js +296 -0
  62. package/dist/endpoint/mcp/events.js.map +1 -0
  63. package/dist/{harness-mcp-http.d.ts → endpoint/mcp/http.d.ts} +1 -1
  64. package/dist/endpoint/mcp/http.d.ts.map +1 -0
  65. package/dist/{harness-mcp-http.js → endpoint/mcp/http.js} +1 -1
  66. package/dist/endpoint/mcp/http.js.map +1 -0
  67. package/dist/endpoint/mcp/index.d.ts +10 -0
  68. package/dist/endpoint/mcp/index.d.ts.map +1 -0
  69. package/dist/endpoint/mcp/index.js +8 -0
  70. package/dist/endpoint/mcp/index.js.map +1 -0
  71. package/dist/{management-runtime.d.ts → endpoint/mcp/owner-tools.d.ts} +7 -7
  72. package/dist/endpoint/mcp/owner-tools.d.ts.map +1 -0
  73. package/dist/{management-runtime.js → endpoint/mcp/owner-tools.js} +3 -4
  74. package/dist/endpoint/mcp/owner-tools.js.map +1 -0
  75. package/dist/endpoint/mcp/schemas.d.ts +60 -0
  76. package/dist/endpoint/mcp/schemas.d.ts.map +1 -0
  77. package/dist/endpoint/mcp/schemas.js +116 -0
  78. package/dist/endpoint/mcp/schemas.js.map +1 -0
  79. package/dist/{harness-mcp-wire.d.ts → endpoint/mcp/tools.d.ts} +17 -14
  80. package/dist/endpoint/mcp/tools.d.ts.map +1 -0
  81. package/dist/{harness-mcp-wire.js → endpoint/mcp/tools.js} +229 -110
  82. package/dist/endpoint/mcp/tools.js.map +1 -0
  83. package/dist/endpoint/mcp/webhook.d.ts +15 -0
  84. package/dist/endpoint/mcp/webhook.d.ts.map +1 -0
  85. package/dist/endpoint/mcp/webhook.js +359 -0
  86. package/dist/endpoint/mcp/webhook.js.map +1 -0
  87. package/dist/identity/credentials.d.ts +46 -0
  88. package/dist/identity/credentials.d.ts.map +1 -0
  89. package/dist/identity/credentials.js +55 -0
  90. package/dist/identity/credentials.js.map +1 -0
  91. package/dist/identity/index.d.ts +4 -0
  92. package/dist/identity/index.d.ts.map +1 -0
  93. package/dist/identity/index.js +4 -0
  94. package/dist/identity/index.js.map +1 -0
  95. package/dist/index.d.ts +19 -4
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +21 -5
  98. package/dist/index.js.map +1 -1
  99. package/dist/{contract.types-check.d.ts → index.types-check.d.ts} +8 -4
  100. package/dist/index.types-check.d.ts.map +1 -0
  101. package/dist/{contract.types-check.js → index.types-check.js} +4 -3
  102. package/dist/index.types-check.js.map +1 -0
  103. package/dist/{daemon/runtime → service}/activation.d.ts +9 -12
  104. package/dist/service/activation.d.ts.map +1 -0
  105. package/dist/{daemon/runtime → service}/activation.js +3 -3
  106. package/dist/service/activation.js.map +1 -0
  107. package/dist/{daemon → service}/configuration.d.ts +8 -7
  108. package/dist/service/configuration.d.ts.map +1 -0
  109. package/dist/{daemon → service}/configuration.js +30 -28
  110. package/dist/service/configuration.js.map +1 -0
  111. package/dist/{daemon/runtime → service}/controller.d.ts +8 -6
  112. package/dist/service/controller.d.ts.map +1 -0
  113. package/dist/service/controller.js +106 -0
  114. package/dist/service/controller.js.map +1 -0
  115. package/dist/{server.d.ts → service/index.d.ts} +7 -4
  116. package/dist/service/index.d.ts.map +1 -0
  117. package/dist/{server.js → service/index.js} +17 -15
  118. package/dist/service/index.js.map +1 -0
  119. package/dist/{server.types-check.d.ts → service/index.types-check.d.ts} +7 -7
  120. package/dist/service/index.types-check.d.ts.map +1 -0
  121. package/dist/{server.types-check.js → service/index.types-check.js} +1 -1
  122. package/dist/service/index.types-check.js.map +1 -0
  123. package/dist/{daemon/runtime/index.d.ts → service/lifecycle.d.ts} +3 -3
  124. package/dist/service/lifecycle.d.ts.map +1 -0
  125. package/dist/{daemon/runtime/index.js → service/lifecycle.js} +28 -25
  126. package/dist/service/lifecycle.js.map +1 -0
  127. package/dist/{daemon → service}/management.d.ts +2 -2
  128. package/dist/service/management.d.ts.map +1 -0
  129. package/dist/{daemon → service}/management.js +2 -13
  130. package/dist/service/management.js.map +1 -0
  131. package/dist/{daemon → service}/registration.d.ts +1 -1
  132. package/dist/service/registration.d.ts.map +1 -0
  133. package/dist/{daemon → service}/registration.js +1 -2
  134. package/dist/service/registration.js.map +1 -0
  135. package/dist/{daemon/runtime/protocol.d.ts → service/supervision.d.ts} +16 -24
  136. package/dist/service/supervision.d.ts.map +1 -0
  137. package/dist/{daemon/runtime/protocol.js → service/supervision.js} +33 -36
  138. package/dist/service/supervision.js.map +1 -0
  139. package/dist/store/anchors.d.ts.map +1 -0
  140. package/dist/store/anchors.js.map +1 -0
  141. package/dist/store/database/index.d.ts.map +1 -0
  142. package/dist/store/database/index.js.map +1 -0
  143. package/dist/store/database/schema.d.ts.map +1 -0
  144. package/dist/{endpoint/store → store}/database/schema.js +42 -6
  145. package/dist/store/database/schema.js.map +1 -0
  146. package/dist/store/database/values.d.ts.map +1 -0
  147. package/dist/store/database/values.js.map +1 -0
  148. package/dist/{endpoint/store → store}/deliveries.d.ts +8 -0
  149. package/dist/store/deliveries.d.ts.map +1 -0
  150. package/dist/{endpoint/store → store}/deliveries.js +16 -0
  151. package/dist/store/deliveries.js.map +1 -0
  152. package/dist/store/dissemination.d.ts.map +1 -0
  153. package/dist/store/dissemination.js.map +1 -0
  154. package/dist/store/inbox.d.ts +86 -0
  155. package/dist/store/inbox.d.ts.map +1 -0
  156. package/dist/store/inbox.js +269 -0
  157. package/dist/store/inbox.js.map +1 -0
  158. package/dist/store/index.d.ts +12 -0
  159. package/dist/store/index.d.ts.map +1 -0
  160. package/dist/store/index.js +8 -0
  161. package/dist/store/index.js.map +1 -0
  162. package/dist/store/outbound.d.ts.map +1 -0
  163. package/dist/store/outbound.js.map +1 -0
  164. package/dist/{endpoint/store/management.d.ts → store/reads.d.ts} +1 -1
  165. package/dist/store/reads.d.ts.map +1 -0
  166. package/dist/{endpoint/store/management.js → store/reads.js} +1 -1
  167. package/dist/store/reads.js.map +1 -0
  168. package/dist/store/records.d.ts.map +1 -0
  169. package/dist/store/records.js.map +1 -0
  170. package/dist/store/rows/index.d.ts.map +1 -0
  171. package/dist/store/rows/index.js.map +1 -0
  172. package/dist/store/runtime-codec.d.ts +17 -0
  173. package/dist/store/runtime-codec.d.ts.map +1 -0
  174. package/dist/store/runtime-codec.js +32 -0
  175. package/dist/store/runtime-codec.js.map +1 -0
  176. package/dist/{endpoint/store/index.d.ts → store/store.d.ts} +2 -2
  177. package/dist/store/store.d.ts.map +1 -0
  178. package/dist/{endpoint/store/index.js → store/store.js} +33 -4
  179. package/dist/store/store.js.map +1 -0
  180. package/dist/{endpoint/store → store}/types.d.ts +41 -0
  181. package/dist/store/types.d.ts.map +1 -0
  182. package/dist/store/types.js.map +1 -0
  183. package/dist/transport/collectives/answer-check.d.ts +22 -0
  184. package/dist/transport/collectives/answer-check.d.ts.map +1 -0
  185. package/dist/transport/collectives/answer-check.js +166 -0
  186. package/dist/transport/collectives/answer-check.js.map +1 -0
  187. package/dist/transport/collectives/answer-formats.d.ts +21 -0
  188. package/dist/transport/collectives/answer-formats.d.ts.map +1 -0
  189. package/dist/transport/collectives/answer-formats.js +127 -0
  190. package/dist/transport/collectives/answer-formats.js.map +1 -0
  191. package/dist/transport/collectives/failures.d.ts +34 -0
  192. package/dist/transport/collectives/failures.d.ts.map +1 -0
  193. package/dist/transport/collectives/failures.js +40 -0
  194. package/dist/transport/collectives/failures.js.map +1 -0
  195. package/dist/transport/collectives/form-grammar.d.ts +175 -0
  196. package/dist/transport/collectives/form-grammar.d.ts.map +1 -0
  197. package/dist/transport/collectives/form-grammar.js +226 -0
  198. package/dist/transport/collectives/form-grammar.js.map +1 -0
  199. package/dist/transport/collectives/forms.d.ts +224 -0
  200. package/dist/transport/collectives/forms.d.ts.map +1 -0
  201. package/dist/transport/collectives/forms.js +183 -0
  202. package/dist/transport/collectives/forms.js.map +1 -0
  203. package/dist/transport/collectives/inbound.d.ts +130 -0
  204. package/dist/transport/collectives/inbound.d.ts.map +1 -0
  205. package/dist/transport/collectives/inbound.js +80 -0
  206. package/dist/transport/collectives/inbound.js.map +1 -0
  207. package/dist/transport/collectives/index.d.ts +10 -0
  208. package/dist/transport/collectives/index.d.ts.map +1 -0
  209. package/dist/transport/collectives/index.js +8 -0
  210. package/dist/transport/collectives/index.js.map +1 -0
  211. package/dist/{message-text.d.ts → transport/collectives/message-text.d.ts} +4 -3
  212. package/dist/transport/collectives/message-text.d.ts.map +1 -0
  213. package/dist/{message-text.js → transport/collectives/message-text.js} +4 -6
  214. package/dist/transport/collectives/message-text.js.map +1 -0
  215. package/dist/{endpoint/collective → transport/collectives}/operation.d.ts +17 -11
  216. package/dist/transport/collectives/operation.d.ts.map +1 -0
  217. package/dist/{endpoint/collective → transport/collectives}/operation.js +20 -48
  218. package/dist/transport/collectives/operation.js.map +1 -0
  219. package/dist/{endpoint/collective → transport/collectives}/received-request.d.ts +2 -1
  220. package/dist/transport/collectives/received-request.d.ts.map +1 -0
  221. package/dist/transport/collectives/received-request.js.map +1 -0
  222. package/dist/{endpoint/collective → transport/collectives}/request-sends.d.ts +3 -2
  223. package/dist/transport/collectives/request-sends.d.ts.map +1 -0
  224. package/dist/transport/collectives/request-sends.js.map +1 -0
  225. package/dist/{endpoint/collective → transport/collectives}/shared-answers.d.ts +3 -2
  226. package/dist/transport/collectives/shared-answers.d.ts.map +1 -0
  227. package/dist/transport/collectives/shared-answers.js.map +1 -0
  228. package/dist/{endpoint/collective → transport/collectives}/validation.d.ts +8 -10
  229. package/dist/transport/collectives/validation.d.ts.map +1 -0
  230. package/dist/{endpoint/collective → transport/collectives}/validation.js +10 -19
  231. package/dist/transport/collectives/validation.js.map +1 -0
  232. package/dist/{endpoint/collective → transport/collectives}/wire.d.ts +14 -9
  233. package/dist/transport/collectives/wire.d.ts.map +1 -0
  234. package/dist/{endpoint/collective → transport/collectives}/wire.js +11 -99
  235. package/dist/transport/collectives/wire.js.map +1 -0
  236. package/dist/{endpoint/addressing/index.d.ts → transport/messaging/address.d.ts} +38 -5
  237. package/dist/transport/messaging/address.d.ts.map +1 -0
  238. package/dist/{endpoint/addressing/index.js → transport/messaging/address.js} +100 -21
  239. package/dist/transport/messaging/address.js.map +1 -0
  240. package/dist/{endpoint/protocol/index.d.ts → transport/messaging/certification.d.ts} +4 -4
  241. package/dist/transport/messaging/certification.d.ts.map +1 -0
  242. package/dist/{endpoint/protocol/index.js → transport/messaging/certification.js} +7 -5
  243. package/dist/transport/messaging/certification.js.map +1 -0
  244. package/dist/{endpoint/engine-dissemination.d.ts → transport/messaging/dissemination.d.ts} +3 -3
  245. package/dist/transport/messaging/dissemination.d.ts.map +1 -0
  246. package/dist/{endpoint/engine-dissemination.js → transport/messaging/dissemination.js} +5 -5
  247. package/dist/transport/messaging/dissemination.js.map +1 -0
  248. package/dist/{endpoint/engine-durability.d.ts → transport/messaging/durability.d.ts} +4 -4
  249. package/dist/{endpoint/engine-durability.d.ts.map → transport/messaging/durability.d.ts.map} +1 -1
  250. package/dist/{endpoint/engine-durability.js → transport/messaging/durability.js} +4 -13
  251. package/dist/transport/messaging/durability.js.map +1 -0
  252. package/dist/transport/messaging/errors.d.ts +50 -0
  253. package/dist/transport/messaging/errors.d.ts.map +1 -0
  254. package/dist/transport/messaging/errors.js +64 -0
  255. package/dist/transport/messaging/errors.js.map +1 -0
  256. package/dist/{endpoint/protocol → transport/messaging}/evidence.d.ts +3 -3
  257. package/dist/{endpoint/protocol → transport/messaging}/evidence.d.ts.map +1 -1
  258. package/dist/{endpoint/protocol → transport/messaging}/evidence.js +1 -1
  259. package/dist/transport/messaging/evidence.js.map +1 -0
  260. package/dist/{endpoint/engine.d.ts → transport/messaging/index.d.ts} +4 -4
  261. package/dist/transport/messaging/index.d.ts.map +1 -0
  262. package/dist/{endpoint/engine.js → transport/messaging/index.js} +14 -9
  263. package/dist/transport/messaging/index.js.map +1 -0
  264. package/dist/transport/messaging/message.d.ts +112 -0
  265. package/dist/transport/messaging/message.d.ts.map +1 -0
  266. package/dist/transport/messaging/message.js +39 -0
  267. package/dist/transport/messaging/message.js.map +1 -0
  268. package/dist/{endpoint → transport/messaging}/recovery/barrier.d.ts +1 -1
  269. package/dist/transport/messaging/recovery/barrier.d.ts.map +1 -0
  270. package/dist/transport/messaging/recovery/barrier.js.map +1 -0
  271. package/dist/{endpoint/recovery/store-evidence.d.ts → transport/messaging/recovery/evidence.d.ts} +5 -5
  272. package/dist/transport/messaging/recovery/evidence.d.ts.map +1 -0
  273. package/dist/{endpoint/recovery/store-evidence.js → transport/messaging/recovery/evidence.js} +3 -3
  274. package/dist/transport/messaging/recovery/evidence.js.map +1 -0
  275. package/dist/{endpoint → transport/messaging}/recovery/index.d.ts +4 -4
  276. package/dist/transport/messaging/recovery/index.d.ts.map +1 -0
  277. package/dist/{endpoint → transport/messaging}/recovery/index.js +29 -25
  278. package/dist/transport/messaging/recovery/index.js.map +1 -0
  279. package/dist/{endpoint/recovery/store.d.ts → transport/messaging/recovery/persistence.d.ts} +5 -5
  280. package/dist/transport/messaging/recovery/persistence.d.ts.map +1 -0
  281. package/dist/{endpoint/recovery/store.js → transport/messaging/recovery/persistence.js} +4 -4
  282. package/dist/transport/messaging/recovery/persistence.js.map +1 -0
  283. package/dist/{endpoint/recovery/reanchor/empty.d.ts → transport/messaging/recovery/reanchor-empty.d.ts} +6 -6
  284. package/dist/transport/messaging/recovery/reanchor-empty.d.ts.map +1 -0
  285. package/dist/{endpoint/recovery/reanchor/empty.js → transport/messaging/recovery/reanchor-empty.js} +4 -4
  286. package/dist/transport/messaging/recovery/reanchor-empty.js.map +1 -0
  287. package/dist/{endpoint/recovery/reanchor/index.d.ts → transport/messaging/recovery/reanchor.d.ts} +4 -4
  288. package/dist/transport/messaging/recovery/reanchor.d.ts.map +1 -0
  289. package/dist/{endpoint/recovery/reanchor/index.js → transport/messaging/recovery/reanchor.js} +29 -14
  290. package/dist/transport/messaging/recovery/reanchor.js.map +1 -0
  291. package/dist/{endpoint → transport/messaging}/recovery/state.d.ts +5 -5
  292. package/dist/transport/messaging/recovery/state.d.ts.map +1 -0
  293. package/dist/{endpoint → transport/messaging}/recovery/state.js +2 -2
  294. package/dist/transport/messaging/recovery/state.js.map +1 -0
  295. package/dist/{endpoint/engine-send.d.ts → transport/messaging/send.d.ts} +5 -4
  296. package/dist/transport/messaging/send.d.ts.map +1 -0
  297. package/dist/{endpoint/engine-send.js → transport/messaging/send.js} +4 -4
  298. package/dist/transport/messaging/send.js.map +1 -0
  299. package/dist/{endpoint/engine-types.d.ts → transport/messaging/types.d.ts} +7 -5
  300. package/dist/transport/messaging/types.d.ts.map +1 -0
  301. package/dist/{endpoint/engine-types.js → transport/messaging/types.js} +1 -1
  302. package/dist/{endpoint/engine-types.js.map → transport/messaging/types.js.map} +1 -1
  303. package/dist/transport/router/index.d.ts.map +1 -0
  304. package/dist/{endpoint/router-worker → transport/router}/index.js +1 -1
  305. package/dist/transport/router/index.js.map +1 -0
  306. package/dist/transport/router/outage.d.ts.map +1 -0
  307. package/dist/transport/router/outage.js.map +1 -0
  308. package/dist/{endpoint/router-worker → transport/router}/types.d.ts +2 -2
  309. package/dist/transport/router/types.d.ts.map +1 -0
  310. package/dist/transport/router/types.js.map +1 -0
  311. package/dist/{endpoint/representation-canonical.d.ts → transport/wire/canonical.d.ts} +1 -1
  312. package/dist/transport/wire/canonical.d.ts.map +1 -0
  313. package/dist/{endpoint/representation-canonical.js → transport/wire/canonical.js} +1 -1
  314. package/dist/transport/wire/canonical.js.map +1 -0
  315. package/dist/{endpoint/representation-codec.d.ts → transport/wire/codec.d.ts} +5 -6
  316. package/dist/transport/wire/codec.d.ts.map +1 -0
  317. package/dist/{endpoint/representation-codec.js → transport/wire/codec.js} +5 -24
  318. package/dist/transport/wire/codec.js.map +1 -0
  319. package/dist/transport/wire/index.d.ts +7 -0
  320. package/dist/transport/wire/index.d.ts.map +1 -0
  321. package/dist/transport/wire/index.js +10 -0
  322. package/dist/transport/wire/index.js.map +1 -0
  323. package/dist/{endpoint/representation-schemas.d.ts → transport/wire/schemas.d.ts} +76 -98
  324. package/dist/transport/wire/schemas.d.ts.map +1 -0
  325. package/dist/{endpoint/representation-schemas.js → transport/wire/schemas.js} +7 -19
  326. package/dist/transport/wire/schemas.js.map +1 -0
  327. package/dist/transport/wire/values.d.ts +79 -0
  328. package/dist/transport/wire/values.d.ts.map +1 -0
  329. package/dist/transport/wire/values.js +115 -0
  330. package/dist/transport/wire/values.js.map +1 -0
  331. package/dist/{endpoint/representation-verification.d.ts → transport/wire/verification.d.ts} +4 -4
  332. package/dist/transport/wire/verification.d.ts.map +1 -0
  333. package/dist/{endpoint/representation-verification.js → transport/wire/verification.js} +5 -4
  334. package/dist/transport/wire/verification.js.map +1 -0
  335. package/package.json +6 -6
  336. package/dist/client-runtime.d.ts.map +0 -1
  337. package/dist/client-runtime.js.map +0 -1
  338. package/dist/contract.d.ts +0 -721
  339. package/dist/contract.d.ts.map +0 -1
  340. package/dist/contract.js +0 -441
  341. package/dist/contract.js.map +0 -1
  342. package/dist/contract.types-check.d.ts.map +0 -1
  343. package/dist/contract.types-check.js.map +0 -1
  344. package/dist/daemon/configuration.d.ts.map +0 -1
  345. package/dist/daemon/configuration.js.map +0 -1
  346. package/dist/daemon/management.d.ts.map +0 -1
  347. package/dist/daemon/management.js.map +0 -1
  348. package/dist/daemon/registration.d.ts.map +0 -1
  349. package/dist/daemon/registration.js.map +0 -1
  350. package/dist/daemon/runtime/activation.d.ts.map +0 -1
  351. package/dist/daemon/runtime/activation.js.map +0 -1
  352. package/dist/daemon/runtime/controller.d.ts.map +0 -1
  353. package/dist/daemon/runtime/controller.js +0 -138
  354. package/dist/daemon/runtime/controller.js.map +0 -1
  355. package/dist/daemon/runtime/history-export.d.ts +0 -33
  356. package/dist/daemon/runtime/history-export.d.ts.map +0 -1
  357. package/dist/daemon/runtime/history-export.js.map +0 -1
  358. package/dist/daemon/runtime/index.d.ts.map +0 -1
  359. package/dist/daemon/runtime/index.js.map +0 -1
  360. package/dist/daemon/runtime/pending-delivery.d.ts +0 -49
  361. package/dist/daemon/runtime/pending-delivery.d.ts.map +0 -1
  362. package/dist/daemon/runtime/pending-delivery.js.map +0 -1
  363. package/dist/daemon/runtime/protocol.d.ts.map +0 -1
  364. package/dist/daemon/runtime/protocol.js.map +0 -1
  365. package/dist/endpoint/addressing/index.d.ts.map +0 -1
  366. package/dist/endpoint/addressing/index.js.map +0 -1
  367. package/dist/endpoint/collective/operation.d.ts.map +0 -1
  368. package/dist/endpoint/collective/operation.js.map +0 -1
  369. package/dist/endpoint/collective/received-request.d.ts.map +0 -1
  370. package/dist/endpoint/collective/received-request.js.map +0 -1
  371. package/dist/endpoint/collective/request-sends.d.ts.map +0 -1
  372. package/dist/endpoint/collective/request-sends.js.map +0 -1
  373. package/dist/endpoint/collective/shared-answers.d.ts.map +0 -1
  374. package/dist/endpoint/collective/shared-answers.js.map +0 -1
  375. package/dist/endpoint/collective/validation.d.ts.map +0 -1
  376. package/dist/endpoint/collective/validation.js.map +0 -1
  377. package/dist/endpoint/collective/wire.d.ts.map +0 -1
  378. package/dist/endpoint/collective/wire.js.map +0 -1
  379. package/dist/endpoint/engine-dissemination.d.ts.map +0 -1
  380. package/dist/endpoint/engine-dissemination.js.map +0 -1
  381. package/dist/endpoint/engine-durability.js.map +0 -1
  382. package/dist/endpoint/engine-send.d.ts.map +0 -1
  383. package/dist/endpoint/engine-send.js.map +0 -1
  384. package/dist/endpoint/engine-types.d.ts.map +0 -1
  385. package/dist/endpoint/engine.d.ts.map +0 -1
  386. package/dist/endpoint/engine.js.map +0 -1
  387. package/dist/endpoint/protocol/evidence.js.map +0 -1
  388. package/dist/endpoint/protocol/index.d.ts.map +0 -1
  389. package/dist/endpoint/protocol/index.js.map +0 -1
  390. package/dist/endpoint/recovery/barrier.d.ts.map +0 -1
  391. package/dist/endpoint/recovery/barrier.js.map +0 -1
  392. package/dist/endpoint/recovery/index.d.ts.map +0 -1
  393. package/dist/endpoint/recovery/index.js.map +0 -1
  394. package/dist/endpoint/recovery/reanchor/empty.d.ts.map +0 -1
  395. package/dist/endpoint/recovery/reanchor/empty.js.map +0 -1
  396. package/dist/endpoint/recovery/reanchor/index.d.ts.map +0 -1
  397. package/dist/endpoint/recovery/reanchor/index.js.map +0 -1
  398. package/dist/endpoint/recovery/state.d.ts.map +0 -1
  399. package/dist/endpoint/recovery/state.js.map +0 -1
  400. package/dist/endpoint/recovery/store-evidence.d.ts.map +0 -1
  401. package/dist/endpoint/recovery/store-evidence.js.map +0 -1
  402. package/dist/endpoint/recovery/store.d.ts.map +0 -1
  403. package/dist/endpoint/recovery/store.js.map +0 -1
  404. package/dist/endpoint/representation-canonical.d.ts.map +0 -1
  405. package/dist/endpoint/representation-canonical.js.map +0 -1
  406. package/dist/endpoint/representation-codec.d.ts.map +0 -1
  407. package/dist/endpoint/representation-codec.js.map +0 -1
  408. package/dist/endpoint/representation-schemas.d.ts.map +0 -1
  409. package/dist/endpoint/representation-schemas.js.map +0 -1
  410. package/dist/endpoint/representation-verification.d.ts.map +0 -1
  411. package/dist/endpoint/representation-verification.js.map +0 -1
  412. package/dist/endpoint/representation.d.ts +0 -6
  413. package/dist/endpoint/representation.d.ts.map +0 -1
  414. package/dist/endpoint/representation.js +0 -8
  415. package/dist/endpoint/representation.js.map +0 -1
  416. package/dist/endpoint/router-worker/index.d.ts.map +0 -1
  417. package/dist/endpoint/router-worker/index.js.map +0 -1
  418. package/dist/endpoint/router-worker/outage.d.ts.map +0 -1
  419. package/dist/endpoint/router-worker/outage.js.map +0 -1
  420. package/dist/endpoint/router-worker/types.d.ts.map +0 -1
  421. package/dist/endpoint/router-worker/types.js.map +0 -1
  422. package/dist/endpoint/store/anchors.d.ts.map +0 -1
  423. package/dist/endpoint/store/anchors.js.map +0 -1
  424. package/dist/endpoint/store/database/index.d.ts.map +0 -1
  425. package/dist/endpoint/store/database/index.js.map +0 -1
  426. package/dist/endpoint/store/database/schema.d.ts.map +0 -1
  427. package/dist/endpoint/store/database/schema.js.map +0 -1
  428. package/dist/endpoint/store/database/values.d.ts.map +0 -1
  429. package/dist/endpoint/store/database/values.js.map +0 -1
  430. package/dist/endpoint/store/deliveries.d.ts.map +0 -1
  431. package/dist/endpoint/store/deliveries.js.map +0 -1
  432. package/dist/endpoint/store/dissemination.d.ts.map +0 -1
  433. package/dist/endpoint/store/dissemination.js.map +0 -1
  434. package/dist/endpoint/store/index.d.ts.map +0 -1
  435. package/dist/endpoint/store/index.js.map +0 -1
  436. package/dist/endpoint/store/management.d.ts.map +0 -1
  437. package/dist/endpoint/store/management.js.map +0 -1
  438. package/dist/endpoint/store/outbound.d.ts.map +0 -1
  439. package/dist/endpoint/store/outbound.js.map +0 -1
  440. package/dist/endpoint/store/records.d.ts.map +0 -1
  441. package/dist/endpoint/store/records.js.map +0 -1
  442. package/dist/endpoint/store/rows/index.d.ts.map +0 -1
  443. package/dist/endpoint/store/rows/index.js.map +0 -1
  444. package/dist/endpoint/store/types.d.ts.map +0 -1
  445. package/dist/endpoint/store/types.js.map +0 -1
  446. package/dist/endpoint/store.d.ts +0 -10
  447. package/dist/endpoint/store.d.ts.map +0 -1
  448. package/dist/endpoint/store.js +0 -6
  449. package/dist/endpoint/store.js.map +0 -1
  450. package/dist/harness-mcp-contract.d.ts.map +0 -1
  451. package/dist/harness-mcp-contract.js +0 -113
  452. package/dist/harness-mcp-contract.js.map +0 -1
  453. package/dist/harness-mcp-http.d.ts.map +0 -1
  454. package/dist/harness-mcp-http.js.map +0 -1
  455. package/dist/harness-mcp-subscription.d.ts +0 -30
  456. package/dist/harness-mcp-subscription.d.ts.map +0 -1
  457. package/dist/harness-mcp-subscription.js +0 -361
  458. package/dist/harness-mcp-subscription.js.map +0 -1
  459. package/dist/harness-mcp-wire.d.ts.map +0 -1
  460. package/dist/harness-mcp-wire.js.map +0 -1
  461. package/dist/management-runtime.d.ts.map +0 -1
  462. package/dist/management-runtime.js.map +0 -1
  463. package/dist/message-text.d.ts.map +0 -1
  464. package/dist/message-text.js.map +0 -1
  465. package/dist/server.d.ts.map +0 -1
  466. package/dist/server.js.map +0 -1
  467. package/dist/server.types-check.d.ts.map +0 -1
  468. package/dist/server.types-check.js.map +0 -1
  469. /package/dist/{endpoint/store → store}/anchors.d.ts +0 -0
  470. /package/dist/{endpoint/store → store}/anchors.js +0 -0
  471. /package/dist/{endpoint/store → store}/database/index.d.ts +0 -0
  472. /package/dist/{endpoint/store → store}/database/index.js +0 -0
  473. /package/dist/{endpoint/store → store}/database/schema.d.ts +0 -0
  474. /package/dist/{endpoint/store → store}/database/values.d.ts +0 -0
  475. /package/dist/{endpoint/store → store}/database/values.js +0 -0
  476. /package/dist/{endpoint/store → store}/dissemination.d.ts +0 -0
  477. /package/dist/{endpoint/store → store}/dissemination.js +0 -0
  478. /package/dist/{endpoint/store → store}/outbound.d.ts +0 -0
  479. /package/dist/{endpoint/store → store}/outbound.js +0 -0
  480. /package/dist/{endpoint/store → store}/records.d.ts +0 -0
  481. /package/dist/{endpoint/store → store}/records.js +0 -0
  482. /package/dist/{endpoint/store → store}/rows/index.d.ts +0 -0
  483. /package/dist/{endpoint/store → store}/rows/index.js +0 -0
  484. /package/dist/{endpoint/store → store}/types.js +0 -0
  485. /package/dist/{endpoint/collective → transport/collectives}/received-request.js +0 -0
  486. /package/dist/{endpoint/collective → transport/collectives}/request-sends.js +0 -0
  487. /package/dist/{endpoint/collective → transport/collectives}/shared-answers.js +0 -0
  488. /package/dist/{endpoint → transport/messaging}/recovery/barrier.js +0 -0
  489. /package/dist/{endpoint/router-worker → transport/router}/index.d.ts +0 -0
  490. /package/dist/{endpoint/router-worker → transport/router}/outage.d.ts +0 -0
  491. /package/dist/{endpoint/router-worker → transport/router}/outage.js +0 -0
  492. /package/dist/{endpoint/router-worker → transport/router}/types.js +0 -0
@@ -0,0 +1,224 @@
1
+ /** @file Collective operations, answers and the closed errors of a refused collective send. */
2
+ import { Schema } from "effect";
3
+ import { JsonValue } from "../wire/values.js";
4
+ /**
5
+ * Identity of one gather or all_gather, minted by the requesting endpoint.
6
+ * The request, each member's answer post, an all_gather's close, the result
7
+ * and any failure carry it. An answer that matches no single open request is
8
+ * refused under an id minted for the refusal, so its failure is named too.
9
+ */
10
+ export declare const CollectiveId: Schema.brand<Schema.filter<typeof Schema.String>, "CollectiveId">;
11
+ /** A validated collective operation id. */
12
+ export type CollectiveId = typeof CollectiveId.Type;
13
+ /**
14
+ * The MCP form-mode `requestedSchema` of a collecting operation: a flat object
15
+ * of primitive properties. This schema fixes its outline; the sending endpoint
16
+ * checks each property against the MCP form-mode grammar before any post.
17
+ */
18
+ export declare const RequestedSchema: Schema.Struct<{
19
+ $schema: Schema.optionalWith<typeof Schema.String, {
20
+ exact: true;
21
+ }>;
22
+ type: Schema.Literal<["object"]>;
23
+ properties: Schema.Record$<typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
24
+ required: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
25
+ exact: true;
26
+ }>;
27
+ }>;
28
+ /** A form-mode schema as stated by its requester. */
29
+ export type RequestedSchema = typeof RequestedSchema.Type;
30
+ /**
31
+ * One answer to a collecting operation, field by field. Its value space is MCP
32
+ * `ElicitResult` content's; the request's schema decides which fields apply.
33
+ */
34
+ export declare const AnswerContent: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.filter<typeof Schema.Number>, typeof Schema.Boolean, Schema.Array$<typeof Schema.String>]>>;
35
+ /** A structurally valid answer. */
36
+ export type AnswerContent = typeof AnswerContent.Type;
37
+ /** The longest deadline a collecting operation may state: 30 days, in seconds. */
38
+ export declare const MAXIMUM_DEADLINE_SECONDS = 2592000;
39
+ /** A collecting operation's relative deadline: whole seconds, up to 30 days. */
40
+ export declare const DeadlineSeconds: Schema.filter<Schema.filter<typeof Schema.Number>>;
41
+ /** The collective operation one send performs, discriminated by `op`. */
42
+ declare const CollectiveOperation: Schema.Union<[Schema.Struct<{
43
+ op: Schema.optionalWith<Schema.Literal<["multicast"]>, {
44
+ exact: true;
45
+ }>;
46
+ }>, Schema.Struct<{
47
+ op: Schema.Literal<["gather", "all_gather"]>;
48
+ deadline: Schema.filter<Schema.filter<typeof Schema.Number>>;
49
+ requestedSchema: Schema.Struct<{
50
+ $schema: Schema.optionalWith<typeof Schema.String, {
51
+ exact: true;
52
+ }>;
53
+ type: Schema.Literal<["object"]>;
54
+ properties: Schema.Record$<typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
55
+ required: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
56
+ exact: true;
57
+ }>;
58
+ }>;
59
+ }>]>;
60
+ /** A validated collective operation. */
61
+ export type CollectiveOperation = typeof CollectiveOperation.Type;
62
+ /**
63
+ * A member's answer to the one request open in the conversation it is sent
64
+ * to: the requester's direct conversation for a gather, the group for an
65
+ * all_gather. It is MCP's `ElicitResult`; only `accept` carries content,
66
+ * valid against the request's schema.
67
+ */
68
+ declare const CollectiveResponse: Schema.Union<[Schema.Struct<{
69
+ action: Schema.Literal<["accept"]>;
70
+ content: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.filter<typeof Schema.Number>, typeof Schema.Boolean, Schema.Array$<typeof Schema.String>]>>;
71
+ }>, Schema.Struct<{
72
+ action: Schema.Literal<["decline"]>;
73
+ }>]>;
74
+ /** A validated collective response. */
75
+ export type CollectiveResponse = typeof CollectiveResponse.Type;
76
+ /**
77
+ * One send to one address: text with its collective operation, multicast
78
+ * when `collective` is omitted, or an answer to the request open in that
79
+ * address's conversation. `parseMessageText` reads both from a message's
80
+ * text.
81
+ */
82
+ export declare const SendInput: Schema.Union<[Schema.Struct<{
83
+ to: Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">;
84
+ text: Schema.filter<typeof Schema.String>;
85
+ collective: Schema.optionalWith<Schema.Union<[Schema.Struct<{
86
+ op: Schema.optionalWith<Schema.Literal<["multicast"]>, {
87
+ exact: true;
88
+ }>;
89
+ }>, Schema.Struct<{
90
+ op: Schema.Literal<["gather", "all_gather"]>;
91
+ deadline: Schema.filter<Schema.filter<typeof Schema.Number>>;
92
+ requestedSchema: Schema.Struct<{
93
+ $schema: Schema.optionalWith<typeof Schema.String, {
94
+ exact: true;
95
+ }>;
96
+ type: Schema.Literal<["object"]>;
97
+ properties: Schema.Record$<typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.Schema<JsonValue, JsonValue, never>>>;
98
+ required: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
99
+ exact: true;
100
+ }>;
101
+ }>;
102
+ }>]>, {
103
+ exact: true;
104
+ }>;
105
+ }>, Schema.Struct<{
106
+ to: Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">;
107
+ collectiveResponse: Schema.Union<[Schema.Struct<{
108
+ action: Schema.Literal<["accept"]>;
109
+ content: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.filter<typeof Schema.Number>, typeof Schema.Boolean, Schema.Array$<typeof Schema.String>]>>;
110
+ }>, Schema.Struct<{
111
+ action: Schema.Literal<["decline"]>;
112
+ }>]>;
113
+ }>]>;
114
+ /** Validated input for one send. */
115
+ export type SendInput = typeof SendInput.Type;
116
+ /**
117
+ * Where a refused collecting operation or response reports its error:
118
+ * returned to the caller, or emitted as an `operationFailed` item while the
119
+ * send completes.
120
+ */
121
+ export type FailureDelivery = "result" | "inbound";
122
+ /** What a completed send returns: a collecting operation names its id. */
123
+ export interface SendResult {
124
+ readonly operationId?: CollectiveId;
125
+ }
126
+ /**
127
+ * Why a collective send was refused, discriminated by `kind`: a gather or
128
+ * all_gather whose schema is outside the form-mode grammar or whose request
129
+ * post some member could not receive, or a response the member's endpoint
130
+ * cannot send.
131
+ */
132
+ declare const collectiveFailure: Schema.Union<[Schema.Struct<{
133
+ kind: Schema.Literal<["members-unreachable"]>;
134
+ members: Schema.NonEmptyArray<Schema.Struct<{
135
+ member: Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">;
136
+ reason: Schema.Literal<["invalid-address", "unknown-agent", "membership-invalid", "content-invalid", "not-registered", "version-mismatch", "certification-unavailable", "persistence-failed", "network-unavailable", "idempotency-conflict", "outcome-unknown"]>;
137
+ }>>;
138
+ }>, Schema.Struct<{
139
+ kind: Schema.Literal<["schema-invalid"]>;
140
+ detail: typeof Schema.String;
141
+ }>, Schema.Struct<{
142
+ kind: Schema.Literal<["answer-invalid"]>;
143
+ fields: Schema.NonEmptyArray<Schema.Struct<{
144
+ field: typeof Schema.String;
145
+ reason: Schema.Literal<["missing", "unexpected", "invalid"]>;
146
+ detail: Schema.optionalWith<typeof Schema.String, {
147
+ exact: true;
148
+ }>;
149
+ }>>;
150
+ }>, Schema.Struct<{
151
+ kind: Schema.Literal<["request-none"]>;
152
+ }>, Schema.Struct<{
153
+ kind: Schema.Literal<["request-ambiguous"]>;
154
+ }>, Schema.Struct<{
155
+ kind: Schema.Literal<["request-answered"]>;
156
+ }>, Schema.Struct<{
157
+ kind: Schema.Literal<["request-expired"]>;
158
+ }>]>;
159
+ /** A validated collective failure. */
160
+ export type CollectiveFailure = typeof collectiveFailure.Type;
161
+ /**
162
+ * Decode a collective failure carried across the loopback MCP boundary.
163
+ * @param value Untrusted failure detail from a refused send's error data.
164
+ * @returns The validated failure.
165
+ */
166
+ export declare const decodeCollectiveFailure: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
167
+ readonly kind: "members-unreachable";
168
+ readonly members: readonly [{
169
+ readonly member: string & import("effect/Brand").Brand<"MessageAddressInput"> & import("effect/Brand").Brand<"AgentAddress">;
170
+ readonly reason: "certification-unavailable" | "content-invalid" | "idempotency-conflict" | "invalid-address" | "membership-invalid" | "network-unavailable" | "not-registered" | "outcome-unknown" | "persistence-failed" | "unknown-agent" | "version-mismatch";
171
+ }, ...{
172
+ readonly member: string & import("effect/Brand").Brand<"MessageAddressInput"> & import("effect/Brand").Brand<"AgentAddress">;
173
+ readonly reason: "certification-unavailable" | "content-invalid" | "idempotency-conflict" | "invalid-address" | "membership-invalid" | "network-unavailable" | "not-registered" | "outcome-unknown" | "persistence-failed" | "unknown-agent" | "version-mismatch";
174
+ }[]];
175
+ } | {
176
+ readonly kind: "schema-invalid";
177
+ readonly detail: string;
178
+ } | {
179
+ readonly kind: "answer-invalid";
180
+ readonly fields: readonly [{
181
+ readonly field: string;
182
+ readonly reason: "invalid" | "missing" | "unexpected";
183
+ readonly detail?: string | undefined;
184
+ }, ...{
185
+ readonly field: string;
186
+ readonly reason: "invalid" | "missing" | "unexpected";
187
+ readonly detail?: string | undefined;
188
+ }[]];
189
+ } | {
190
+ readonly kind: "request-none";
191
+ } | {
192
+ readonly kind: "request-ambiguous";
193
+ } | {
194
+ readonly kind: "request-answered";
195
+ } | {
196
+ readonly kind: "request-expired";
197
+ }, import("effect/ParseResult").ParseError, never>;
198
+ declare const CollectiveEmitError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
199
+ readonly _tag: "CollectiveEmitError";
200
+ } & Readonly<A>;
201
+ /**
202
+ * The service could not keep an item the layer emitted. The service has
203
+ * already reported its own failure, so the layer only stops the work that
204
+ * emitted the item.
205
+ */
206
+ export declare class CollectiveEmitError extends CollectiveEmitError_base {
207
+ }
208
+ declare const CollectiveError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
209
+ readonly _tag: "CollectiveError";
210
+ } & Readonly<A>;
211
+ /**
212
+ * A gather, all_gather or answer was refused. The message is what a host
213
+ * hands its model as the tool error: the failed action and its cause, naming
214
+ * each unreachable member or failing field. The operation id stays in the
215
+ * error's data, not its message.
216
+ */
217
+ export declare class CollectiveError extends CollectiveError_base<{
218
+ readonly id: CollectiveId;
219
+ readonly failure: CollectiveFailure;
220
+ }> {
221
+ get message(): string;
222
+ }
223
+ export {};
224
+ //# sourceMappingURL=forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../../src/transport/collectives/forms.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,OAAO,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,EAGL,SAAS,EAEV,MAAM,mBAAmB,CAAC;AAI3B;;;;;GAKG;AACH,eAAO,MAAM,YAAY,mEAM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AI,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA0C,CAAC;;;;AA6C/E;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,wBAExC;CAAG;;;;AAEJ;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,qBAAoC;IACvE,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF"}
@@ -0,0 +1,183 @@
1
+ /** @file Collective operations, answers and the closed errors of a refused collective send. */
2
+ import { Data, Schema } from "effect";
3
+ import { AgentAddress, MessageAddressInput } from "../messaging/address.js";
4
+ import { sendFailureReasons, sendFailureText } from "../messaging/errors.js";
5
+ import { exactStruct, isCanonicalIdentifier, JsonValue, wellFormedString, } from "../wire/values.js";
6
+ /* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare -- Effect Schemas share their domain names with the nominal values they decode. */
7
+ /**
8
+ * Identity of one gather or all_gather, minted by the requesting endpoint.
9
+ * The request, each member's answer post, an all_gather's close, the result
10
+ * and any failure carry it. An answer that matches no single open request is
11
+ * refused under an id minted for the refusal, so its failure is named too.
12
+ */
13
+ export const CollectiveId = Schema.String.pipe(Schema.filter((value) => isCanonicalIdentifier("col_", value), {
14
+ description: "A collective operation id: col_ followed by 43 base64url characters",
15
+ }), Schema.brand("CollectiveId"));
16
+ /** One property of a form-mode schema as a caller states it. */
17
+ const formProperty = Schema.Record({ key: Schema.String, value: JsonValue });
18
+ /**
19
+ * The MCP form-mode `requestedSchema` of a collecting operation: a flat object
20
+ * of primitive properties. This schema fixes its outline; the sending endpoint
21
+ * checks each property against the MCP form-mode grammar before any post.
22
+ */
23
+ export const RequestedSchema = exactStruct({
24
+ $schema: Schema.optionalWith(Schema.String, { exact: true }),
25
+ type: Schema.Literal("object"),
26
+ properties: Schema.Record({ key: Schema.String, value: formProperty }),
27
+ required: Schema.optionalWith(Schema.Array(Schema.String), { exact: true }),
28
+ });
29
+ /**
30
+ * One answer to a collecting operation, field by field. Its value space is MCP
31
+ * `ElicitResult` content's; the request's schema decides which fields apply.
32
+ */
33
+ export const AnswerContent = Schema.Record({
34
+ key: Schema.String,
35
+ value: Schema.Union(Schema.String, Schema.Number.pipe(Schema.finite()), Schema.Boolean, Schema.Array(Schema.String)),
36
+ }).annotations({
37
+ description: "The answer, one field per requestedSchema property",
38
+ });
39
+ /** The longest deadline a collecting operation may state: 30 days, in seconds. */
40
+ export const MAXIMUM_DEADLINE_SECONDS = 2_592_000;
41
+ /** A collecting operation's relative deadline: whole seconds, up to 30 days. */
42
+ export const DeadlineSeconds = Schema.Number.pipe(Schema.int(), Schema.between(1, MAXIMUM_DEADLINE_SECONDS));
43
+ /**
44
+ * Multicast: one post to the `to` address, complete when certified. `op`
45
+ * defaults to multicast, so an omitted `op` and an omitted `collective` mean
46
+ * the same operation.
47
+ */
48
+ const multicastOperation = exactStruct({
49
+ op: Schema.optionalWith(Schema.Literal("multicast"), { exact: true }),
50
+ });
51
+ /**
52
+ * A collecting operation: the text is a question to every member of `to`.
53
+ * A gather sends one request post to each member, in that member's direct
54
+ * conversation with the requester, and only the requester receives the
55
+ * result. An all_gather sends one request post to the `group:` conversation
56
+ * `to` names; members answer there, no model sees a peer's answer before the
57
+ * requester's close, and every member receives the same result. The deadline
58
+ * is relative, in whole seconds; the sending endpoint converts it to an
59
+ * absolute time at send.
60
+ */
61
+ const collectingOperation = exactStruct({
62
+ op: Schema.Literal("gather", "all_gather"),
63
+ deadline: DeadlineSeconds,
64
+ requestedSchema: RequestedSchema,
65
+ });
66
+ /** The collective operation one send performs, discriminated by `op`. */
67
+ const CollectiveOperation = Schema.Union(multicastOperation, collectingOperation);
68
+ /**
69
+ * A member's answer to the one request open in the conversation it is sent
70
+ * to: the requester's direct conversation for a gather, the group for an
71
+ * all_gather. It is MCP's `ElicitResult`; only `accept` carries content,
72
+ * valid against the request's schema.
73
+ */
74
+ const CollectiveResponse = Schema.Union(exactStruct({
75
+ action: Schema.Literal("accept"),
76
+ content: AnswerContent,
77
+ }), exactStruct({
78
+ action: Schema.Literal("decline"),
79
+ }));
80
+ /**
81
+ * One send to one address: text with its collective operation, multicast
82
+ * when `collective` is omitted, or an answer to the request open in that
83
+ * address's conversation. `parseMessageText` reads both from a message's
84
+ * text.
85
+ */
86
+ export const SendInput = Schema.Union(exactStruct({
87
+ to: MessageAddressInput,
88
+ text: wellFormedString,
89
+ collective: Schema.optionalWith(CollectiveOperation, { exact: true }),
90
+ }), exactStruct({
91
+ to: MessageAddressInput,
92
+ collectiveResponse: CollectiveResponse,
93
+ })).annotations({ identifier: "SendInput" });
94
+ /** Members a send could not reach, each with its send failure's reason. */
95
+ const unreachableMembers = Schema.NonEmptyArray(exactStruct({
96
+ member: AgentAddress,
97
+ reason: Schema.Literal(...sendFailureReasons),
98
+ }));
99
+ /**
100
+ * Why a collective send was refused, discriminated by `kind`: a gather or
101
+ * all_gather whose schema is outside the form-mode grammar or whose request
102
+ * post some member could not receive, or a response the member's endpoint
103
+ * cannot send.
104
+ */
105
+ const collectiveFailure = Schema.Union(exactStruct({
106
+ kind: Schema.Literal("members-unreachable"),
107
+ members: unreachableMembers,
108
+ }), exactStruct({
109
+ kind: Schema.Literal("schema-invalid"),
110
+ detail: Schema.String,
111
+ }), exactStruct({
112
+ kind: Schema.Literal("answer-invalid"),
113
+ fields: Schema.NonEmptyArray(exactStruct({
114
+ field: Schema.String,
115
+ reason: Schema.Literal("missing", "unexpected", "invalid"),
116
+ detail: Schema.optionalWith(Schema.String, { exact: true }),
117
+ })),
118
+ }), exactStruct({ kind: Schema.Literal("request-none") }), exactStruct({ kind: Schema.Literal("request-ambiguous") }), exactStruct({ kind: Schema.Literal("request-answered") }), exactStruct({ kind: Schema.Literal("request-expired") }));
119
+ /**
120
+ * Decode a collective failure carried across the loopback MCP boundary.
121
+ * @param value Untrusted failure detail from a refused send's error data.
122
+ * @returns The validated failure.
123
+ */
124
+ export const decodeCollectiveFailure = Schema.decodeUnknown(collectiveFailure);
125
+ /** What each answer-field problem means in a reply failure. */
126
+ const answerFieldText = {
127
+ missing: "is missing",
128
+ unexpected: "is not in the form",
129
+ invalid: "is invalid",
130
+ };
131
+ function describeCollectiveFailure(failure) {
132
+ switch (failure.kind) {
133
+ case "members-unreachable":
134
+ return `send failed: ${failure.members
135
+ .map(({ member, reason }) => reason === "unknown-agent"
136
+ ? `${member} is not a known agent`
137
+ : `${member} could not be reached (${sendFailureText[reason]})`)
138
+ .join("; ")}`;
139
+ case "schema-invalid":
140
+ return `send failed: the form is invalid (${failure.detail})`;
141
+ case "answer-invalid":
142
+ return `reply failed: ${failure.fields
143
+ .map(({ field, reason, detail }) => {
144
+ const problem = answerFieldText[reason];
145
+ return detail === undefined
146
+ ? `field "${field}" ${problem}`
147
+ : `field "${field}" ${problem} (${detail})`;
148
+ })
149
+ .join("; ")}`;
150
+ case "request-none":
151
+ return "reply failed: no question is open in this conversation";
152
+ case "request-ambiguous":
153
+ return "reply failed: more than one question is open in this conversation, and answering one of several is not supported";
154
+ case "request-answered":
155
+ return "reply failed: the question was already answered";
156
+ case "request-expired":
157
+ return "reply failed: the question's deadline has passed";
158
+ default: {
159
+ const exhaustive = failure;
160
+ return exhaustive;
161
+ }
162
+ }
163
+ }
164
+ /**
165
+ * The service could not keep an item the layer emitted. The service has
166
+ * already reported its own failure, so the layer only stops the work that
167
+ * emitted the item.
168
+ */
169
+ export class CollectiveEmitError extends Data.TaggedError("CollectiveEmitError") {
170
+ }
171
+ /**
172
+ * A gather, all_gather or answer was refused. The message is what a host
173
+ * hands its model as the tool error: the failed action and its cause, naming
174
+ * each unreachable member or failing field. The operation id stays in the
175
+ * error's data, not its message.
176
+ */
177
+ export class CollectiveError extends Data.TaggedError("CollectiveError") {
178
+ get message() {
179
+ return describeCollectiveFailure(this.failure);
180
+ }
181
+ }
182
+ /* eslint-enable @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare -- Restore the package naming rules after the Schema/type pairs. */
183
+ //# sourceMappingURL=forms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms.js","sourceRoot":"","sources":["../../../src/transport/collectives/forms.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,0KAA0K;AAE1K;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;IAC7D,WAAW,EACT,qEAAqE;CACxE,CAAC,EACF,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAC7B,CAAC;AAIF,gEAAgE;AAChE,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAE7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAA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AG,MAAM,0BAA0B,eAAe,CAAC,MAAM,CAAC,GAAG,CAClE;iBACA,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,KAAK,gBAAgB;YACnB,OAAO,qCAAqC,OAAO,CAAC,MAAM,GAAG,CAAC;QAChE,KAAK,gBAAgB;YACnB,OAAO,iBAAiB,OAAO,CAAC,MAAM;iBACnC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE;gBACjC,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;gBACxC,OAAO,MAAM,KAAK,SAAS;oBACzB,CAAC,CAAC,UAAU,KAAK,KAAK,OAAO,EAAE;oBAC/B,CAAC,CAAC,UAAU,KAAK,KAAK,OAAO,KAAK,MAAM,GAAG,CAAC;YAChD,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,KAAK,cAAc;YACjB,OAAO,wDAAwD,CAAC;QAClE,KAAK,mBAAmB;YACtB,OAAO,kHAAkH,CAAC;QAC5H,KAAK,kBAAkB;YACrB,OAAO,iDAAiD,CAAC;QAC3D,KAAK,iBAAiB;YACpB,OAAO,kDAAkD,CAAC;QAC5D,SAAS,CAAC;YACR,MAAM,UAAU,GAAU,OAAO,CAAC;YAClC,OAAO,UAAU,CAAC;QACpB,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,IAAI,CAAC,WAAW,CACvD,qBAAqB,CACtB;CAAG;AAEJ;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAGrE;IACA,IAAa,OAAO;QAClB,OAAO,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;CACF;AAED,0JAA0J"}
@@ -0,0 +1,130 @@
1
+ /** @file The items an endpoint delivers to its host: messages and collective requests, results and failures. */
2
+ import { Schema } from "effect";
3
+ /**
4
+ * One member's outcome in a completed gather or all_gather, discriminated by
5
+ * `kind`. `no-answer` covers every member that did not answer: one whose
6
+ * request post was refused or not certified in time, and one silent at the
7
+ * deadline.
8
+ */
9
+ declare const memberOutcome: Schema.Union<[Schema.Struct<{
10
+ kind: Schema.Literal<["answered"]>;
11
+ content: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.filter<typeof Schema.Number>, typeof Schema.Boolean, Schema.Array$<typeof Schema.String>]>>;
12
+ }>, Schema.Struct<{
13
+ kind: Schema.Literal<["declined"]>;
14
+ }>, Schema.Struct<{
15
+ kind: Schema.Literal<["invalid"]>;
16
+ reason: typeof Schema.String;
17
+ }>, Schema.Struct<{
18
+ kind: Schema.Literal<["no-answer"]>;
19
+ }>]>;
20
+ /** One member's recorded outcome. */
21
+ export type CollectiveMemberOutcome = typeof memberOutcome.Type;
22
+ /**
23
+ * One inbound item, discriminated by `kind`. The endpoint consumes the
24
+ * collective layer's protocol posts, posts whose collective part is malformed
25
+ * or duplicated, and multicasts that carry nothing besides that part; every
26
+ * other certified post becomes one item, and the endpoint itself emits
27
+ * results and failures.
28
+ */
29
+ export declare const InboundItem: Schema.Union<[Schema.Struct<{
30
+ kind: Schema.Literal<["multicast"]>;
31
+ message: Schema.Union<[Schema.filter<Schema.Struct<{
32
+ kind: Schema.Literal<["direct"]>;
33
+ postId: Schema.brand<Schema.filter<typeof Schema.String>, "PostId">;
34
+ address: Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">;
35
+ sender: Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">;
36
+ content: Schema.refine<readonly [{
37
+ readonly type: "text";
38
+ readonly text: string;
39
+ } | {
40
+ readonly type: "data";
41
+ readonly value: import("../wire/values.js").JsonValue;
42
+ }, ...({
43
+ readonly type: "text";
44
+ readonly text: string;
45
+ } | {
46
+ readonly type: "data";
47
+ readonly value: import("../wire/values.js").JsonValue;
48
+ })[]], Schema.NonEmptyArray<Schema.Union<[Schema.Struct<{
49
+ type: Schema.Literal<["text"]>;
50
+ text: Schema.filter<typeof Schema.String>;
51
+ }>, Schema.Struct<{
52
+ type: Schema.Literal<["data"]>;
53
+ value: Schema.Schema<import("../wire/values.js").JsonValue, import("../wire/values.js").JsonValue, never>;
54
+ }>]>>>;
55
+ }>>, Schema.filter<Schema.Struct<{
56
+ kind: Schema.Literal<["group"]>;
57
+ postId: Schema.brand<Schema.filter<typeof Schema.String>, "PostId">;
58
+ address: Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "GroupAddress">;
59
+ sender: Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">;
60
+ members: Schema.filter<Schema.TupleType<readonly [Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">, Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">, Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">], [Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">]>>;
61
+ content: Schema.refine<readonly [{
62
+ readonly type: "text";
63
+ readonly text: string;
64
+ } | {
65
+ readonly type: "data";
66
+ readonly value: import("../wire/values.js").JsonValue;
67
+ }, ...({
68
+ readonly type: "text";
69
+ readonly text: string;
70
+ } | {
71
+ readonly type: "data";
72
+ readonly value: import("../wire/values.js").JsonValue;
73
+ })[]], Schema.NonEmptyArray<Schema.Union<[Schema.Struct<{
74
+ type: Schema.Literal<["text"]>;
75
+ text: Schema.filter<typeof Schema.String>;
76
+ }>, Schema.Struct<{
77
+ type: Schema.Literal<["data"]>;
78
+ value: Schema.Schema<import("../wire/values.js").JsonValue, import("../wire/values.js").JsonValue, never>;
79
+ }>]>>>;
80
+ }>>]>;
81
+ }>, Schema.Struct<{
82
+ kind: Schema.Literal<["collectiveRequest"]>;
83
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "CollectiveId">;
84
+ postId: Schema.brand<Schema.filter<typeof Schema.String>, "PostId">;
85
+ from: Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">;
86
+ to: Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">;
87
+ question: Schema.filter<typeof Schema.String>;
88
+ requestedSchema: Schema.Struct<{
89
+ $schema: Schema.optionalWith<typeof Schema.String, {
90
+ exact: true;
91
+ }>;
92
+ type: Schema.Literal<["object"]>;
93
+ properties: Schema.Record$<typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.Schema<import("../wire/values.js").JsonValue, import("../wire/values.js").JsonValue, never>>>;
94
+ required: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
95
+ exact: true;
96
+ }>;
97
+ }>;
98
+ deadlineAt: Schema.filter<Schema.filter<typeof Schema.Number>>;
99
+ }>, Schema.Struct<{
100
+ kind: Schema.Literal<["collectiveResult"]>;
101
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "CollectiveId">;
102
+ to: Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">;
103
+ question: Schema.filter<typeof Schema.String>;
104
+ outcomes: Schema.NonEmptyArray<Schema.Struct<{
105
+ member: Schema.brand<Schema.filter<Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">>, "AgentAddress">;
106
+ outcome: Schema.Union<[Schema.Struct<{
107
+ kind: Schema.Literal<["answered"]>;
108
+ content: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.filter<typeof Schema.Number>, typeof Schema.Boolean, Schema.Array$<typeof Schema.String>]>>;
109
+ }>, Schema.Struct<{
110
+ kind: Schema.Literal<["declined"]>;
111
+ }>, Schema.Struct<{
112
+ kind: Schema.Literal<["invalid"]>;
113
+ reason: typeof Schema.String;
114
+ }>, Schema.Struct<{
115
+ kind: Schema.Literal<["no-answer"]>;
116
+ }>]>;
117
+ }>>;
118
+ closePostId: Schema.optionalWith<Schema.brand<Schema.filter<typeof Schema.String>, "PostId">, {
119
+ exact: true;
120
+ }>;
121
+ }>, Schema.Struct<{
122
+ kind: Schema.Literal<["operationFailed"]>;
123
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "CollectiveId">;
124
+ to: Schema.brand<Schema.filter<typeof Schema.String>, "MessageAddressInput">;
125
+ error: typeof Schema.String;
126
+ }>]>;
127
+ /** A validated inbound item. */
128
+ export type InboundItem = typeof InboundItem.Type;
129
+ export {};
130
+ //# sourceMappingURL=inbound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../../../src/transport/collectives/inbound.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAEhH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAqChC;;;;;GAKG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;IAKlB,CAAC;AACF,qCAAqC;AACrC,MAAM,MAAM,uBAAuB,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;AAkChE;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOtB,CAAC;AACH,gCAAgC;AAChC,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAC"}
@@ -0,0 +1,80 @@
1
+ /** @file The items an endpoint delivers to its host: messages and collective requests, results and failures. */
2
+ import { Schema } from "effect";
3
+ import { AgentAddress, MessageAddressInput } from "../messaging/address.js";
4
+ import { InboundMessage } from "../messaging/message.js";
5
+ import { exactStruct, PostId, wellFormedString } from "../wire/values.js";
6
+ import { AnswerContent, CollectiveId, RequestedSchema } from "./forms.js";
7
+ /* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare -- Effect Schemas share their domain names with the nominal values they decode. */
8
+ /**
9
+ * A multicast delivered to this endpoint. The message content is the post's
10
+ * content without the collective layer's part.
11
+ */
12
+ const multicastItem = exactStruct({
13
+ kind: Schema.Literal("multicast"),
14
+ message: InboundMessage,
15
+ });
16
+ /** Absolute epoch milliseconds; endpoints assume zero clock skew. */
17
+ const epochMillis = Schema.Number.pipe(Schema.int(), Schema.positive());
18
+ /**
19
+ * A question another agent asked this one. `postId` is the certified request
20
+ * post's and `to` the conversation it arrived in: the requester's `agent:`
21
+ * address for a gather, the group's `group:` address for an all_gather. The
22
+ * member answers once with a `collectiveResponse` sent to `to`.
23
+ */
24
+ const collectiveRequestItem = exactStruct({
25
+ kind: Schema.Literal("collectiveRequest"),
26
+ id: CollectiveId,
27
+ postId: PostId,
28
+ from: AgentAddress,
29
+ to: MessageAddressInput,
30
+ question: wellFormedString,
31
+ requestedSchema: RequestedSchema,
32
+ deadlineAt: epochMillis,
33
+ });
34
+ /**
35
+ * One member's outcome in a completed gather or all_gather, discriminated by
36
+ * `kind`. `no-answer` covers every member that did not answer: one whose
37
+ * request post was refused or not certified in time, and one silent at the
38
+ * deadline.
39
+ */
40
+ const memberOutcome = Schema.Union(exactStruct({ kind: Schema.Literal("answered"), content: AnswerContent }), exactStruct({ kind: Schema.Literal("declined") }), exactStruct({ kind: Schema.Literal("invalid"), reason: Schema.String }), exactStruct({ kind: Schema.Literal("no-answer") }));
41
+ /**
42
+ * The result of a gather this endpoint started, or of an all_gather this
43
+ * endpoint started or was asked: exactly one outcome per member, in member
44
+ * order. `to` is the address the operation named. An all_gather's result
45
+ * names its certified close post in `closePostId`; every member's result is
46
+ * built from exactly the answers that close lists, so each endpoint's result
47
+ * is the same.
48
+ */
49
+ const collectiveResultItem = exactStruct({
50
+ kind: Schema.Literal("collectiveResult"),
51
+ id: CollectiveId,
52
+ to: MessageAddressInput,
53
+ question: wellFormedString,
54
+ outcomes: Schema.NonEmptyArray(exactStruct({ member: AgentAddress, outcome: memberOutcome })),
55
+ closePostId: Schema.optionalWith(PostId, { exact: true }),
56
+ });
57
+ /**
58
+ * A collective send that failed after the host's tool had returned, or an
59
+ * all_gather whose close could not be certified. `to` is the operation's
60
+ * address, or the request's conversation for a response; `error` is the text
61
+ * a waiting host would have received as the tool error.
62
+ */
63
+ const operationFailedItem = exactStruct({
64
+ kind: Schema.Literal("operationFailed"),
65
+ id: CollectiveId,
66
+ to: MessageAddressInput,
67
+ error: Schema.String,
68
+ });
69
+ /**
70
+ * One inbound item, discriminated by `kind`. The endpoint consumes the
71
+ * collective layer's protocol posts, posts whose collective part is malformed
72
+ * or duplicated, and multicasts that carry nothing besides that part; every
73
+ * other certified post becomes one item, and the endpoint itself emits
74
+ * results and failures.
75
+ */
76
+ export const InboundItem = Schema.Union(multicastItem, collectiveRequestItem, collectiveResultItem, operationFailedItem).annotations({
77
+ identifier: "InboundItem",
78
+ });
79
+ /* eslint-enable @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare -- Restore the package naming rules after the Schema/type pairs. */
80
+ //# sourceMappingURL=inbound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound.js","sourceRoot":"","sources":["../../../src/transport/collectives/inbound.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAEhH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE1E,0KAA0K;AAE1K;;;GAGG;AACH,MAAM,aAAa,GAAG,WAAW,C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