@moltzap/client 2026.529.0 → 2026.717.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 (363) hide show
  1. package/dist/agent-client.d.ts +2 -65
  2. package/dist/agent-client.d.ts.map +1 -1
  3. package/dist/agent-client.js +1 -286
  4. package/dist/agent-client.js.map +1 -1
  5. package/dist/app-client.d.ts +3 -0
  6. package/dist/app-client.d.ts.map +1 -0
  7. package/dist/app-client.js +2 -0
  8. package/dist/app-client.js.map +1 -0
  9. package/dist/auth.d.ts +6 -15
  10. package/dist/auth.d.ts.map +1 -1
  11. package/dist/auth.js +12 -16
  12. package/dist/auth.js.map +1 -1
  13. package/dist/channel-base/format-cross-conv.d.ts +10 -15
  14. package/dist/channel-base/format-cross-conv.d.ts.map +1 -1
  15. package/dist/channel-base/format-cross-conv.js +10 -15
  16. package/dist/channel-base/format-cross-conv.js.map +1 -1
  17. package/dist/channel-base/format-group-block.d.ts +8 -10
  18. package/dist/channel-base/format-group-block.d.ts.map +1 -1
  19. package/dist/channel-base/format-group-block.js +8 -10
  20. package/dist/channel-base/format-group-block.js.map +1 -1
  21. package/dist/channel-base/index.d.ts +3 -62
  22. package/dist/channel-base/index.d.ts.map +1 -1
  23. package/dist/channel-base/index.js +2 -65
  24. package/dist/channel-base/index.js.map +1 -1
  25. package/dist/channel-base/lease-guard.d.ts +0 -2
  26. package/dist/channel-base/lease-guard.d.ts.map +1 -1
  27. package/dist/channel-base/lease-guard.js +0 -2
  28. package/dist/channel-base/lease-guard.js.map +1 -1
  29. package/dist/channel-base/lease-store.d.ts +2 -3
  30. package/dist/channel-base/lease-store.d.ts.map +1 -1
  31. package/dist/channel-base/lease-store.js +2 -3
  32. package/dist/channel-base/lease-store.js.map +1 -1
  33. package/dist/channel-base/lease.d.ts +25 -31
  34. package/dist/channel-base/lease.d.ts.map +1 -1
  35. package/dist/channel-base/lease.js +29 -45
  36. package/dist/channel-base/lease.js.map +1 -1
  37. package/dist/channel-core-enrichment.d.ts +1 -1
  38. package/dist/channel-core-enrichment.d.ts.map +1 -1
  39. package/dist/channel-core-test-support.d.ts +17 -11
  40. package/dist/channel-core-test-support.d.ts.map +1 -1
  41. package/dist/channel-core-test-support.js +5 -6
  42. package/dist/channel-core-test-support.js.map +1 -1
  43. package/dist/channel-core.d.ts +24 -29
  44. package/dist/channel-core.d.ts.map +1 -1
  45. package/dist/channel-core.js +18 -42
  46. package/dist/channel-core.js.map +1 -1
  47. package/dist/cli/commands/agents.d.ts +3 -6
  48. package/dist/cli/commands/agents.d.ts.map +1 -1
  49. package/dist/cli/commands/agents.js +14 -50
  50. package/dist/cli/commands/agents.js.map +1 -1
  51. package/dist/cli/commands/contacts.d.ts +5 -6
  52. package/dist/cli/commands/contacts.d.ts.map +1 -1
  53. package/dist/cli/commands/contacts.js +15 -43
  54. package/dist/cli/commands/contacts.js.map +1 -1
  55. package/dist/cli/commands/conversations.d.ts +8 -18
  56. package/dist/cli/commands/conversations.d.ts.map +1 -1
  57. package/dist/cli/commands/conversations.js +14 -65
  58. package/dist/cli/commands/conversations.js.map +1 -1
  59. package/dist/cli/commands/messages.d.ts +13 -35
  60. package/dist/cli/commands/messages.d.ts.map +1 -1
  61. package/dist/cli/commands/messages.js +21 -46
  62. package/dist/cli/commands/messages.js.map +1 -1
  63. package/dist/cli/commands/register.d.ts +10 -12
  64. package/dist/cli/commands/register.d.ts.map +1 -1
  65. package/dist/cli/commands/register.js +47 -133
  66. package/dist/cli/commands/register.js.map +1 -1
  67. package/dist/cli/commands/send.d.ts +23 -36
  68. package/dist/cli/commands/send.d.ts.map +1 -1
  69. package/dist/cli/commands/send.js +25 -72
  70. package/dist/cli/commands/send.js.map +1 -1
  71. package/dist/cli/commands/start.d.ts +10 -124
  72. package/dist/cli/commands/start.d.ts.map +1 -1
  73. package/dist/cli/commands/start.js +28 -510
  74. package/dist/cli/commands/start.js.map +1 -1
  75. package/dist/cli/commands/status.d.ts +1 -1
  76. package/dist/cli/commands/status.d.ts.map +1 -1
  77. package/dist/cli/commands/status.js +8 -9
  78. package/dist/cli/commands/status.js.map +1 -1
  79. package/dist/cli/commands/test-transport.d.ts +12 -5
  80. package/dist/cli/commands/test-transport.d.ts.map +1 -1
  81. package/dist/cli/commands/test-transport.js +15 -15
  82. package/dist/cli/commands/test-transport.js.map +1 -1
  83. package/dist/cli/index.js +13 -40
  84. package/dist/cli/index.js.map +1 -1
  85. package/dist/cli/output.d.ts +4 -0
  86. package/dist/cli/output.d.ts.map +1 -0
  87. package/dist/cli/output.js +9 -0
  88. package/dist/cli/output.js.map +1 -0
  89. package/dist/cli/socket-client.d.ts +7 -14
  90. package/dist/cli/socket-client.d.ts.map +1 -1
  91. package/dist/cli/socket-client.js +15 -38
  92. package/dist/cli/socket-client.js.map +1 -1
  93. package/dist/cli/transport.d.ts +53 -116
  94. package/dist/cli/transport.d.ts.map +1 -1
  95. package/dist/cli/transport.js +45 -295
  96. package/dist/cli/transport.js.map +1 -1
  97. package/dist/config.d.ts +24 -0
  98. package/dist/config.d.ts.map +1 -0
  99. package/dist/config.js +35 -0
  100. package/dist/config.js.map +1 -0
  101. package/dist/config.test-utils.d.ts +13 -0
  102. package/dist/config.test-utils.d.ts.map +1 -0
  103. package/dist/config.test-utils.js +46 -0
  104. package/dist/config.test-utils.js.map +1 -0
  105. package/dist/index.d.ts +3 -8
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +2 -12
  108. package/dist/index.js.map +1 -1
  109. package/dist/local-daemon-rpc.d.ts +259 -8
  110. package/dist/local-daemon-rpc.d.ts.map +1 -1
  111. package/dist/local-daemon-rpc.js +189 -12
  112. package/dist/local-daemon-rpc.js.map +1 -1
  113. package/dist/{runtime/local-history.d.ts → local-history.d.ts} +16 -21
  114. package/dist/local-history.d.ts.map +1 -0
  115. package/dist/{runtime/local-history.js → local-history.js} +16 -21
  116. package/dist/local-history.js.map +1 -0
  117. package/dist/local-paths.d.ts +0 -2
  118. package/dist/local-paths.d.ts.map +1 -1
  119. package/dist/local-paths.js +0 -4
  120. package/dist/local-paths.js.map +1 -1
  121. package/dist/local-socket-server.d.ts +22 -0
  122. package/dist/local-socket-server.d.ts.map +1 -0
  123. package/dist/{runtime/local-socket-server.js → local-socket-server.js} +4 -9
  124. package/dist/local-socket-server.js.map +1 -0
  125. package/dist/message-rendering.d.ts +3 -0
  126. package/dist/message-rendering.d.ts.map +1 -0
  127. package/dist/message-rendering.js +7 -0
  128. package/dist/message-rendering.js.map +1 -0
  129. package/dist/notification/__tests__/{snapshot-semantics.types-check.d.ts → subscribe-signatures.types-check.d.ts} +1 -1
  130. package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts.map +1 -0
  131. package/dist/notification/__tests__/subscribe-signatures.types-check.js +55 -0
  132. package/dist/notification/__tests__/subscribe-signatures.types-check.js.map +1 -0
  133. package/dist/notification/errors.d.ts +18 -6
  134. package/dist/notification/errors.d.ts.map +1 -1
  135. package/dist/notification/errors.js +13 -15
  136. package/dist/notification/errors.js.map +1 -1
  137. package/dist/notification/index.d.ts +5 -0
  138. package/dist/notification/index.d.ts.map +1 -0
  139. package/dist/notification/index.js +5 -0
  140. package/dist/notification/index.js.map +1 -0
  141. package/dist/notification/stream.d.ts +33 -49
  142. package/dist/notification/stream.d.ts.map +1 -1
  143. package/dist/notification/stream.js +33 -76
  144. package/dist/notification/stream.js.map +1 -1
  145. package/dist/pagination.d.ts +20 -10
  146. package/dist/pagination.d.ts.map +1 -1
  147. package/dist/pagination.js +8 -9
  148. package/dist/pagination.js.map +1 -1
  149. package/dist/profile.d.ts +92 -0
  150. package/dist/profile.d.ts.map +1 -0
  151. package/dist/profile.js +149 -0
  152. package/dist/profile.js.map +1 -0
  153. package/dist/refs.d.ts.map +1 -0
  154. package/dist/refs.js.map +1 -0
  155. package/dist/service-archive-purge.d.ts +2 -1
  156. package/dist/service-archive-purge.d.ts.map +1 -1
  157. package/dist/service-archive-purge.js.map +1 -1
  158. package/dist/{runtime/service-helpers.d.ts → service-helpers.d.ts} +5 -11
  159. package/dist/service-helpers.d.ts.map +1 -0
  160. package/dist/{runtime/service-helpers.js → service-helpers.js} +2 -9
  161. package/dist/service-helpers.js.map +1 -0
  162. package/dist/service-local-daemon.d.ts +22 -0
  163. package/dist/service-local-daemon.d.ts.map +1 -0
  164. package/dist/service-local-daemon.js +185 -0
  165. package/dist/service-local-daemon.js.map +1 -0
  166. package/dist/service.d.ts +65 -57
  167. package/dist/service.d.ts.map +1 -1
  168. package/dist/service.js +205 -156
  169. package/dist/service.js.map +1 -1
  170. package/dist/test-utils/channel-service-fixture.d.ts +3 -2
  171. package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
  172. package/dist/test-utils/channel-service-fixture.js.map +1 -1
  173. package/dist/test-utils/fake-service.d.ts +26 -18
  174. package/dist/test-utils/fake-service.d.ts.map +1 -1
  175. package/dist/test-utils/fake-service.js +28 -42
  176. package/dist/test-utils/fake-service.js.map +1 -1
  177. package/dist/test-utils/ids.d.ts +3 -1
  178. package/dist/test-utils/ids.d.ts.map +1 -1
  179. package/dist/test-utils/ids.js.map +1 -1
  180. package/dist/test-utils/index.d.ts +9 -2
  181. package/dist/test-utils/index.d.ts.map +1 -1
  182. package/dist/test-utils/index.js +8 -1
  183. package/dist/test-utils/index.js.map +1 -1
  184. package/dist/test-utils/standalone-provisioning.d.ts +17 -0
  185. package/dist/test-utils/standalone-provisioning.d.ts.map +1 -0
  186. package/dist/test-utils/standalone-provisioning.js +14 -0
  187. package/dist/test-utils/standalone-provisioning.js.map +1 -0
  188. package/dist/tsconfig.tsbuildinfo +1 -0
  189. package/package.json +39 -17
  190. package/dist/auth.test.d.ts +0 -2
  191. package/dist/auth.test.d.ts.map +0 -1
  192. package/dist/auth.test.js +0 -121
  193. package/dist/auth.test.js.map +0 -1
  194. package/dist/channel-core-context.test.d.ts +0 -2
  195. package/dist/channel-core-context.test.d.ts.map +0 -1
  196. package/dist/channel-core-context.test.js +0 -342
  197. package/dist/channel-core-context.test.js.map +0 -1
  198. package/dist/channel-core-dispatch.test.d.ts +0 -2
  199. package/dist/channel-core-dispatch.test.d.ts.map +0 -1
  200. package/dist/channel-core-dispatch.test.js +0 -557
  201. package/dist/channel-core-dispatch.test.js.map +0 -1
  202. package/dist/channel-core.test.d.ts +0 -2
  203. package/dist/channel-core.test.d.ts.map +0 -1
  204. package/dist/channel-core.test.js +0 -232
  205. package/dist/channel-core.test.js.map +0 -1
  206. package/dist/cli/__tests__/cli-multi-agent.int.test.d.ts +0 -2
  207. package/dist/cli/__tests__/cli-multi-agent.int.test.d.ts.map +0 -1
  208. package/dist/cli/__tests__/cli-multi-agent.int.test.js +0 -132
  209. package/dist/cli/__tests__/cli-multi-agent.int.test.js.map +0 -1
  210. package/dist/cli/commands/invite.d.ts +0 -7
  211. package/dist/cli/commands/invite.d.ts.map +0 -1
  212. package/dist/cli/commands/invite.js +0 -11
  213. package/dist/cli/commands/invite.js.map +0 -1
  214. package/dist/cli/commands/messages.test.d.ts +0 -2
  215. package/dist/cli/commands/messages.test.d.ts.map +0 -1
  216. package/dist/cli/commands/messages.test.js +0 -99
  217. package/dist/cli/commands/messages.test.js.map +0 -1
  218. package/dist/cli/commands/ping.d.ts +0 -7
  219. package/dist/cli/commands/ping.d.ts.map +0 -1
  220. package/dist/cli/commands/ping.js +0 -37
  221. package/dist/cli/commands/ping.js.map +0 -1
  222. package/dist/cli/commands/register.test.d.ts +0 -2
  223. package/dist/cli/commands/register.test.d.ts.map +0 -1
  224. package/dist/cli/commands/register.test.js +0 -91
  225. package/dist/cli/commands/register.test.js.map +0 -1
  226. package/dist/cli/commands/send.test.d.ts +0 -2
  227. package/dist/cli/commands/send.test.d.ts.map +0 -1
  228. package/dist/cli/commands/send.test.js +0 -59
  229. package/dist/cli/commands/send.test.js.map +0 -1
  230. package/dist/cli/commands/start.test.d.ts +0 -2
  231. package/dist/cli/commands/start.test.d.ts.map +0 -1
  232. package/dist/cli/commands/start.test.js +0 -624
  233. package/dist/cli/commands/start.test.js.map +0 -1
  234. package/dist/cli/commands/whoami.d.ts +0 -8
  235. package/dist/cli/commands/whoami.d.ts.map +0 -1
  236. package/dist/cli/commands/whoami.js +0 -28
  237. package/dist/cli/commands/whoami.js.map +0 -1
  238. package/dist/cli/config.d.ts +0 -66
  239. package/dist/cli/config.d.ts.map +0 -1
  240. package/dist/cli/config.js +0 -148
  241. package/dist/cli/config.js.map +0 -1
  242. package/dist/cli/config.test.d.ts +0 -2
  243. package/dist/cli/config.test.d.ts.map +0 -1
  244. package/dist/cli/config.test.js +0 -89
  245. package/dist/cli/config.test.js.map +0 -1
  246. package/dist/cli/http-client.d.ts +0 -17
  247. package/dist/cli/http-client.d.ts.map +0 -1
  248. package/dist/cli/http-client.js +0 -38
  249. package/dist/cli/http-client.js.map +0 -1
  250. package/dist/cli/profile.d.ts +0 -126
  251. package/dist/cli/profile.d.ts.map +0 -1
  252. package/dist/cli/profile.js +0 -231
  253. package/dist/cli/profile.js.map +0 -1
  254. package/dist/cli/profile.test.d.ts +0 -2
  255. package/dist/cli/profile.test.d.ts.map +0 -1
  256. package/dist/cli/profile.test.js +0 -369
  257. package/dist/cli/profile.test.js.map +0 -1
  258. package/dist/cli/transport.test.d.ts +0 -2
  259. package/dist/cli/transport.test.d.ts.map +0 -1
  260. package/dist/cli/transport.test.js +0 -312
  261. package/dist/cli/transport.test.js.map +0 -1
  262. package/dist/notification/__tests__/filter-equivalence.test.d.ts +0 -2
  263. package/dist/notification/__tests__/filter-equivalence.test.d.ts.map +0 -1
  264. package/dist/notification/__tests__/filter-equivalence.test.js +0 -123
  265. package/dist/notification/__tests__/filter-equivalence.test.js.map +0 -1
  266. package/dist/notification/__tests__/snapshot-semantics.test.d.ts +0 -2
  267. package/dist/notification/__tests__/snapshot-semantics.test.d.ts.map +0 -1
  268. package/dist/notification/__tests__/snapshot-semantics.test.js +0 -261
  269. package/dist/notification/__tests__/snapshot-semantics.test.js.map +0 -1
  270. package/dist/notification/__tests__/snapshot-semantics.types-check.d.ts.map +0 -1
  271. package/dist/notification/__tests__/snapshot-semantics.types-check.js +0 -62
  272. package/dist/notification/__tests__/snapshot-semantics.types-check.js.map +0 -1
  273. package/dist/pagination.test.d.ts +0 -2
  274. package/dist/pagination.test.d.ts.map +0 -1
  275. package/dist/pagination.test.js +0 -72
  276. package/dist/pagination.test.js.map +0 -1
  277. package/dist/runtime/close-info.d.ts +0 -84
  278. package/dist/runtime/close-info.d.ts.map +0 -1
  279. package/dist/runtime/close-info.js +0 -102
  280. package/dist/runtime/close-info.js.map +0 -1
  281. package/dist/runtime/close-info.test.d.ts +0 -2
  282. package/dist/runtime/close-info.test.d.ts.map +0 -1
  283. package/dist/runtime/close-info.test.js +0 -109
  284. package/dist/runtime/close-info.test.js.map +0 -1
  285. package/dist/runtime/errors.d.ts +0 -11
  286. package/dist/runtime/errors.d.ts.map +0 -1
  287. package/dist/runtime/errors.js +0 -41
  288. package/dist/runtime/errors.js.map +0 -1
  289. package/dist/runtime/errors.test.d.ts +0 -2
  290. package/dist/runtime/errors.test.d.ts.map +0 -1
  291. package/dist/runtime/errors.test.js +0 -79
  292. package/dist/runtime/errors.test.js.map +0 -1
  293. package/dist/runtime/frame.d.ts +0 -8
  294. package/dist/runtime/frame.d.ts.map +0 -1
  295. package/dist/runtime/frame.js +0 -12
  296. package/dist/runtime/frame.js.map +0 -1
  297. package/dist/runtime/frame.test.d.ts +0 -2
  298. package/dist/runtime/frame.test.d.ts.map +0 -1
  299. package/dist/runtime/frame.test.js +0 -59
  300. package/dist/runtime/frame.test.js.map +0 -1
  301. package/dist/runtime/index.d.ts +0 -10
  302. package/dist/runtime/index.d.ts.map +0 -1
  303. package/dist/runtime/index.js +0 -9
  304. package/dist/runtime/index.js.map +0 -1
  305. package/dist/runtime/local-history.d.ts.map +0 -1
  306. package/dist/runtime/local-history.js.map +0 -1
  307. package/dist/runtime/local-service-commands.d.ts +0 -26
  308. package/dist/runtime/local-service-commands.d.ts.map +0 -1
  309. package/dist/runtime/local-service-commands.js +0 -29
  310. package/dist/runtime/local-service-commands.js.map +0 -1
  311. package/dist/runtime/local-socket-server.d.ts +0 -20
  312. package/dist/runtime/local-socket-server.d.ts.map +0 -1
  313. package/dist/runtime/local-socket-server.js.map +0 -1
  314. package/dist/runtime/refs.d.ts.map +0 -1
  315. package/dist/runtime/refs.js.map +0 -1
  316. package/dist/runtime/runtime.test.d.ts +0 -2
  317. package/dist/runtime/runtime.test.d.ts.map +0 -1
  318. package/dist/runtime/runtime.test.js +0 -37
  319. package/dist/runtime/runtime.test.js.map +0 -1
  320. package/dist/runtime/service-helpers.d.ts.map +0 -1
  321. package/dist/runtime/service-helpers.js.map +0 -1
  322. package/dist/runtime/service-teardown.d.ts +0 -5
  323. package/dist/runtime/service-teardown.d.ts.map +0 -1
  324. package/dist/runtime/service-teardown.js +0 -36
  325. package/dist/runtime/service-teardown.js.map +0 -1
  326. package/dist/runtime/service-teardown.test.d.ts +0 -2
  327. package/dist/runtime/service-teardown.test.d.ts.map +0 -1
  328. package/dist/runtime/service-teardown.test.js +0 -80
  329. package/dist/runtime/service-teardown.test.js.map +0 -1
  330. package/dist/runtime/subscribers.d.ts +0 -152
  331. package/dist/runtime/subscribers.d.ts.map +0 -1
  332. package/dist/runtime/subscribers.js +0 -222
  333. package/dist/runtime/subscribers.js.map +0 -1
  334. package/dist/service-socket-path.test.d.ts +0 -2
  335. package/dist/service-socket-path.test.d.ts.map +0 -1
  336. package/dist/service-socket-path.test.js +0 -87
  337. package/dist/service-socket-path.test.js.map +0 -1
  338. package/dist/service.test.d.ts +0 -2
  339. package/dist/service.test.d.ts.map +0 -1
  340. package/dist/service.test.js +0 -796
  341. package/dist/service.test.js.map +0 -1
  342. package/dist/test/index.d.ts +0 -47
  343. package/dist/test/index.d.ts.map +0 -1
  344. package/dist/test/index.js +0 -39
  345. package/dist/test/index.js.map +0 -1
  346. package/dist/test-utils/conformance-adapter.d.ts +0 -40
  347. package/dist/test-utils/conformance-adapter.d.ts.map +0 -1
  348. package/dist/test-utils/conformance-adapter.js +0 -250
  349. package/dist/test-utils/conformance-adapter.js.map +0 -1
  350. package/dist/tm-client-test-support.d.ts +0 -184
  351. package/dist/tm-client-test-support.d.ts.map +0 -1
  352. package/dist/tm-client-test-support.js +0 -466
  353. package/dist/tm-client-test-support.js.map +0 -1
  354. package/dist/tm-client.d.ts +0 -269
  355. package/dist/tm-client.d.ts.map +0 -1
  356. package/dist/tm-client.js +0 -518
  357. package/dist/tm-client.js.map +0 -1
  358. package/dist/tm-client.test.d.ts +0 -2
  359. package/dist/tm-client.test.d.ts.map +0 -1
  360. package/dist/tm-client.test.js +0 -490
  361. package/dist/tm-client.test.js.map +0 -1
  362. /package/dist/{runtime/refs.d.ts → refs.d.ts} +0 -0
  363. /package/dist/{runtime/refs.js → refs.js} +0 -0
@@ -1,22 +1,19 @@
1
- /* eslint-disable jsdoc/text-escaping -- JSDoc references to generic types like `Stream.async<DecodedNotification<D>>` use the natural angle-bracket form (TS source style) inside backtick-fenced code spans; the lint rule's pre-render check fires false positives on these multi-line spans. Matches the precedent in filter-equivalence.test.ts. */
2
1
  /**
3
2
  * Stream-returning constructors for `MoltZapAgentClient.subscribe` and
4
- * `MoltZapAgentClient.subscribeAll` (Spec B, #596).
3
+ * `MoltZapAgentClient.subscribeAll`.
5
4
  *
6
- * Architect decision **AD1 — path (a)**: trust `Stream.async` cancellation
7
- * to drive registry-stored `unregister` finalizer. The registry's
8
- * `dispatch` snapshots `subsRef` at iteration start, so the spec #222
9
- * §5.3 OQ-3 snapshot semantic is preserved by Ref atomicity without an
10
- * additional per-sub cancelled-flag check (architect plan §3).
5
+ * `Stream.async` cancellation drives the registry-stored `unregister`
6
+ * finalizer. The registry's `dispatch` snapshots `subsRef` at iteration
7
+ * start, so the snapshot semantic holds by Ref atomicity without a
8
+ * per-sub cancelled-flag check.
11
9
  *
12
- * Stream construction uses `Stream.async<DecodedNotification<D>, NotConnectedError>`
13
- * with the registry storing typed callback references — NOT `Queue` of
14
- * `Take` items combined with `Stream.fromQueue`/`Stream.flattenTake`,
15
- * which codex empirically verified is racy under
16
- * `Queue.offer(Take.fail); Queue.shutdown` and does not reliably propagate
17
- * the typed failure to the consumer (architect plan §3.2, codex r4).
10
+ * Stream construction uses `Stream.async&lt;NotificationParamsOf&lt;D>,
11
+ * NotConnectedError>` with the registry storing typed callback references — NOT
12
+ * `Queue` of `Take` items combined with `Stream.fromQueue`/`Stream.flattenTake`,
13
+ * which is racy under `Queue.offer(Take.fail); Queue.shutdown` and does not
14
+ * reliably propagate the typed failure to the consumer.
18
15
  *
19
- * Stream lifecycle (architect-mandated, spec §"Stream lifecycle contract"):
16
+ * Stream lifecycle:
20
17
  * 1. `subscribe(def)` returns a Stream value. Pure; no I/O, no scope.
21
18
  * 2. Materialization opens the `Stream.async` source: `registry.register`
22
19
  * runs synchronously, callbacks are installed; consumer pulls suspend
@@ -24,37 +21,25 @@
24
21
  * 3. Pre-`connect()` consumer pulls suspend inside `Stream.async`'s
25
22
  * internal queue. No `NotConnectedError` until terminal close.
26
23
  * 4. Reconnect leaves registry callbacks intact; `subsRef` survives
27
- * transient disconnects (preserved invariant).
24
+ * transient disconnects. **Reconnect-window
25
+ * frame loss:** any server-originated notification frame that the
26
+ * transport drops while disconnected (between the socket dying and
27
+ * the reconnect `hello` completing) is NOT replayed — the Stream API
28
+ * has no buffering or gap-fill across the reconnect window, so such
29
+ * frames are silently lost to the consumer. Subscriptions resume
30
+ * receiving frames that arrive AFTER reconnect; there is no error or
31
+ * sentinel marking the gap.
28
32
  * 5. `MoltZapAgentClient.close` invokes `SubscriberRegistry.closeAll`, which
29
33
  * calls each live `sub.onClose(new NotConnectedError(...))`. Each
30
34
  * `Stream.async`-backed consumer fails with `NotConnectedError`
31
35
  * via `emit.fail` deterministically (no Queue/shutdown race).
32
36
  */
33
- import { Effect, Stream } from "effect";
34
- import {} from "@moltzap/protocol";
37
+ import { Stream } from "effect";
38
+ import { notificationSubscribe, notificationSubscribeAll, } from "@moltzap/protocol/rpc";
35
39
  export function subscribe(registry, definition, refinement) {
36
- return Stream.async((emit) => {
37
- // Synchronous registration — the registry stores the typed callbacks
38
- // and returns an `unregister` Effect that the Stream's runtime will
39
- // invoke as the cancellation finalizer. #ignore-sloppy-code[async-keyword]: comment references `Stream.async`, not a function modifier
40
- //
41
- // `register` is `Effect<SubscriptionHandle, never>`; `runSync` is safe
42
- // because the registry mutates an in-memory `Ref` and never yields.
43
- const handle = Effect.runSync(registry.register(definition, refinement, {
44
- onFrame: (frame) => Effect.sync(() => {
45
- emit.single(frame);
46
- }),
47
- onClose: (cause) => Effect.sync(() => {
48
- emit.fail(cause);
49
- }),
50
- }));
51
- // Per P3 issue #613: use `Effect.suspend` to defer running `unregister`
52
- // to whenever the Stream's runtime invokes the finalizer Effect. This
53
- // is future-proof if `unregister` ever grows yielded effects (e.g.
54
- // flushing a queue); the `Effect.sync(() => Effect.runSync(handle.unregister))`
55
- // form would force-eager-evaluate as sync.
56
- return Effect.suspend(() => handle.unregister);
57
- });
40
+ if (refinement === undefined)
41
+ return notificationSubscribe(registry, definition);
42
+ return notificationSubscribe(registry, definition, refinement);
58
43
  }
59
44
  /**
60
45
  * Broad-union escape hatch. The only intended in-tree consumer is
@@ -63,44 +48,16 @@ export function subscribe(registry, definition, refinement) {
63
48
  * narrowing is intentionally lost; callers wanting typed payloads use
64
49
  * `subscribe(def, refinement?)`.
65
50
  *
66
- * The `subscribeAll` Stream uses a synthetic "match every definition"
67
- * filter — implemented by the registry treating a `null` definition
68
- * pointer as "match all", but for the Stream API we instead register
69
- * one subscription per inbound frame's definition. Simpler: model
70
- * "match all" by passing an in-band sentinel.
71
- *
72
- * Implementation: the registry has no native "match all" subscription
73
- * shape (intentional — `subscribe<D>` is per-definition). To preserve
74
- * the registry's typed dispatch surface, `subscribeAll` constructs a
75
- * Stream that taps the registry via a per-arrival path: registering
76
- * once with a sentinel definition would require a registry-level "match
77
- * any" capability we deliberately avoid (would complicate the typed
78
- * dispatch in subscribers.ts). Instead, the dispatcher feeds every
79
- * frame to `subscribeAll`'s emit via a dedicated `subscribeAllRef`
80
- * callback list maintained alongside `subsRef`.
81
- *
82
- * Architect-mandated code shape: per spec Goal #2 / plan §5.3, the
83
- * surface returns a Stream value. Implementation passes the literal
84
- * `AnyNotificationDefinition` sentinel via the registry's broad-union
85
- * channel — see `notification/stream.ts → subscribeAllStream` below
86
- * which registers via a new `SubscriberRegistry.registerAll` helper.
87
- *
88
- * To keep the registry minimal we route `subscribeAll` through a thin
89
- * wrapper that the registry exposes as `registerAll(callbacks)` —
90
- * identical lifecycle to `register(def, …)` but with no definition
91
- * match (the dispatcher hits these callbacks for every inbound frame).
51
+ * The registry has no "match all" subscription shape (`subscribe&lt;D>` is
52
+ * per-definition). `subscribeAll` instead registers via
53
+ * `SubscriberRegistry.registerAll`, whose callbacks the dispatcher hits
54
+ * for every inbound frame regardless of definition. Same lifecycle as
55
+ * `register(def, …)`, no definition match.
92
56
  */
93
57
  export function subscribeAll(registry, refinement) {
94
- return Stream.async((emit) => {
95
- const handle = Effect.runSync(registry.registerAll(refinement, {
96
- onFrame: (frame) => Effect.sync(() => {
97
- emit.single(frame);
98
- }),
99
- onClose: (cause) => Effect.sync(() => {
100
- emit.fail(cause);
101
- }),
102
- }));
103
- return Effect.suspend(() => handle.unregister);
104
- });
58
+ if (refinement === undefined) {
59
+ return notificationSubscribeAll(registry);
60
+ }
61
+ return notificationSubscribeAll(registry, (delivery) => refinement(delivery.definition, delivery.params));
105
62
  }
106
63
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/notification/stream.ts"],"names":[],"mappings":"AAAA,wVAAwV;AAExV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAKN,MAAM,mBAAmB,CAAC;AA6B3B,MAAM,UAAU,SAAS,CACvB,QAA4B,EAC5B,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CAAC,IAAI,CAAC,GAAG,EAAE;gBACf,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC,CAAC;SACL,CAAC,CACH,CAAC;QACF,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/notification/stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAGL,qBAAqB,EACrB,wBAAwB,GAGzB,MAAM,uBAAuB,CAAC;AAmC/B,MAAM,UAAU,SAAS,CACvB,QAGC,EACD,UAAa,EACb,UAAyD;IAEzD,IAAI,UAAU,KAAK,SAAS;QAC1B,OAAO,qBAAqB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACrD,OAAO,qBAAqB,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAC1B,QAGC,EACD,UAGY;IAEZ,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,wBAAwB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CACrD,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CACjD,CAAC;AACJ,CAAC"}
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * @file Generic drainer for the cursor-paginated list RPCs.
3
3
  *
4
- * The list RPCs (`contacts/list`, `agents/list`, `task/list`, …) return a
4
+ * The list RPCs (`agent/identity/contacts/list`, `agent/identity/agents/list`, `agent/task/list`, ...) return a
5
5
  * bounded page plus an opaque `nextCursor`. A consumer that needs the
6
6
  * COMPLETE set must page through every cursor. {@link drainPaginatedList}
7
- * does exactly that for any RPC whose result is `{ [K]: T[], nextCursor? }`,
8
- * echoing the opaque `nextCursor` back as the next page's `cursor`.
7
+ * does exactly that for descriptor-based RPC calls, with the caller supplying
8
+ * the descriptor-specific page params and row/cursor accessors.
9
9
  *
10
10
  * Lives in `@moltzap/client` because the logic is wire-generic: any
11
11
  * channel or CLI that drains a list RPC reuses it (openclaw's directory
12
12
  * is the first consumer).
13
13
  */
14
- import type { ParamsOf, ResultOf, RpcDefinition } from "@moltzap/protocol";
14
+ import type { ClientDefinitionPayload, ClientDefinitionSuccess, ClientRpcDefinition } from "@moltzap/protocol/socket";
15
15
  import { Effect } from "effect";
16
16
  declare const NonAdvancingCursorError_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 & {
17
17
  readonly _tag: "NonAdvancingCursorError";
@@ -33,13 +33,23 @@ export declare class NonAdvancingCursorError extends NonAdvancingCursorError_bas
33
33
  * channel `E` so the helper stays decoupled from any one client's error
34
34
  * union.
35
35
  */
36
- export type SendRpcFn<E> = <D extends RpcDefinition<string, any, any>>(definition: D, params: ParamsOf<D>) => Effect.Effect<ResultOf<D>, E>;
36
+ type ClientDescriptor = ClientRpcDefinition & {
37
+ readonly name: string;
38
+ };
39
+ export type SendRpcFn<E, Definition extends ClientDescriptor> = (definition: Definition, params: ClientDefinitionPayload<Definition>) => Effect.Effect<ClientDefinitionSuccess<Definition>, E>;
40
+ export interface DrainPaginatedListOptions<E, D extends ClientDescriptor, Row, Cursor extends string> {
41
+ readonly sendRpc: SendRpcFn<E, D>;
42
+ readonly definition: D;
43
+ readonly paramsForCursor: (cursor: Cursor | undefined) => ClientDefinitionPayload<D>;
44
+ readonly rowsForPage: (page: ClientDefinitionSuccess<D>) => ReadonlyArray<Row>;
45
+ readonly nextCursorForPage: (page: ClientDefinitionSuccess<D>) => Cursor | undefined;
46
+ }
37
47
  /**
38
- * Drain every page of a cursor-paginated list RPC whose result is
39
- * `{ [K]: T[], nextCursor? }`, echoing the opaque `nextCursor` back as the
40
- * next page's `cursor`. Fails with {@link NonAdvancingCursorError} if the
41
- * server returns a cursor it already emitted (cycle guard).
48
+ * Drain every page of a cursor-paginated list RPC, echoing the opaque
49
+ * `nextCursor` back as the next page's `cursor`. Fails with
50
+ * {@link NonAdvancingCursorError} if the server returns a cursor it already
51
+ * emitted (cycle guard).
42
52
  */
43
- export declare function drainPaginatedList<E, D extends RpcDefinition<string, any, any>, K extends keyof ResultOf<D>>(sendRpc: SendRpcFn<E>, definition: D, collectionKey: K): Effect.Effect<ResultOf<D>[K], E | NonAdvancingCursorError>;
53
+ export declare function drainPaginatedList<E, D extends ClientDescriptor, Row, Cursor extends string>({ sendRpc, definition, paramsForCursor, rowsForPage, nextCursorForPage, }: DrainPaginatedListOptions<E, D, Row, Cursor>): Effect.Effect<ReadonlyArray<Row>, E | NonAdvancingCursorError>;
44
54
  export {};
45
55
  //# sourceMappingURL=pagination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAEtC;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,6BAE3C;IACA,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,E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E3D,MAAM,WAAW,yBAAyB,CACxC,CAAC,EACD,CAAC,SAAS,gBAAgB,EAC1B,GAAG,EACH,MAAM,SAAS,MAAM;IAErB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IACvB,QAAQ,CAAC,eAAe,EAAE,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,KACvB,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,CACpB,IAAI,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAC7B,aAAa,CAAC,GAAG,CAAC,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,CAC1B,IAAI,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAC7B,MAAM,GAAG,SAAS,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,EACD,CAAC,SAAS,gBAAgB,EAC1B,GAAG,EACH,MAAM,SAAS,MAAM,EACrB,EACA,OAAO,EACP,UAAU,EACV,eAAe,EACf,WAAW,EACX,iBAAiB,GAClB,EAAE,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAC7D,aAAa,CAAC,GAAG,CAAC,EAClB,CAAC,GAAG,uBAAuB,CAC5B,CAwBA"}
@@ -11,12 +11,12 @@ export class NonAdvancingCursorError extends Data.TaggedError("NonAdvancingCurso
11
11
  }
12
12
  }
13
13
  /**
14
- * Drain every page of a cursor-paginated list RPC whose result is
15
- * `{ [K]: T[], nextCursor? }`, echoing the opaque `nextCursor` back as the
16
- * next page's `cursor`. Fails with {@link NonAdvancingCursorError} if the
17
- * server returns a cursor it already emitted (cycle guard).
14
+ * Drain every page of a cursor-paginated list RPC, echoing the opaque
15
+ * `nextCursor` back as the next page's `cursor`. Fails with
16
+ * {@link NonAdvancingCursorError} if the server returns a cursor it already
17
+ * emitted (cycle guard).
18
18
  */
19
- export function drainPaginatedList(sendRpc, definition, collectionKey) {
19
+ export function drainPaginatedList({ sendRpc, definition, paramsForCursor, rowsForPage, nextCursorForPage, }) {
20
20
  return Effect.gen(function* () {
21
21
  const acc = [];
22
22
  // Cycle guard, not a page cap: a repeated cursor means the server is
@@ -25,11 +25,10 @@ export function drainPaginatedList(sendRpc, definition, collectionKey) {
25
25
  let cursor;
26
26
  let more = true;
27
27
  while (more) {
28
- const params = (cursor !== undefined ? { cursor } : {});
28
+ const params = paramsForCursor(cursor);
29
29
  const page = yield* sendRpc(definition, params);
30
- const rows = page[collectionKey];
31
- acc.push(...rows);
32
- const nextCursor = page.nextCursor;
30
+ acc.push(...rowsForPage(page));
31
+ const nextCursor = nextCursorForPage(page);
33
32
  if (nextCursor !== undefined && seenCursors.has(nextCursor)) {
34
33
  return yield* Effect.fail(new NonAdvancingCursorError({ method: definition.name }));
35
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,IAAI,CAAC,WAAW,CAC3D,yBAAyB,CAGzB;IACA,IAAa,OAAO;QAClB,OAAO,yBAAyB,IAAI,CAAC,MAAM,qCAAqC,CAAC;IACnF,CAAC;CACF;AAaD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAKhC,OAAqB,EACrB,UAAa,EACb,aAAgB;IAEhB,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzB,MAAM,GAAG,GAEL,EAAE,CAAC;QACP,qEAAqE;QACrE,yDAAyD;QACzD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;QACtC,IAAI,MAA0B,CAAC;QAC/B,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB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AgentKey } from "@moltzap/protocol/identity";
4
+ export declare const ProfileName: Schema.brand<Schema.filter<typeof Schema.String>, "ProfileName">;
5
+ /**
6
+ * Branded profile name shared by profile lookup and CLI registration.
7
+ */
8
+ export type ProfileName = Schema.Schema.Type<typeof ProfileName>;
9
+ declare const ProfileRecordSchema: Schema.Struct<{
10
+ agentId: Schema.Schema<AgentId, string, never>;
11
+ apiKey: Schema.Schema<AgentKey, string, never>;
12
+ agentName: typeof Schema.String;
13
+ }>;
14
+ /** One profile's persisted auth record. */
15
+ export type ProfileRecord = Schema.Schema.Type<typeof ProfileRecordSchema>;
16
+ /** Named profile view of config.json. */
17
+ export interface LayeredConfig {
18
+ readonly profiles: ReadonlyMap<ProfileName, ProfileRecord>;
19
+ }
20
+ /** Exhaustive error union for the profile surface. */
21
+ export type ProfileError = ProfileNotFoundError | ProfileInvalidNameError | ProfileConfigReadError | ProfileConfigWriteError;
22
+ declare const ProfileNotFoundError_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 & {
23
+ readonly _tag: "ProfileNotFoundError";
24
+ } & Readonly<A>;
25
+ export declare class ProfileNotFoundError extends ProfileNotFoundError_base<{
26
+ readonly name: string;
27
+ }> {
28
+ }
29
+ declare const ProfileInvalidNameError_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 & {
30
+ readonly _tag: "ProfileInvalidNameError";
31
+ } & Readonly<A>;
32
+ export declare class ProfileInvalidNameError extends ProfileInvalidNameError_base<{
33
+ readonly name: string;
34
+ readonly reason: string;
35
+ }> {
36
+ }
37
+ declare const ProfileConfigReadError_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 & {
38
+ readonly _tag: "ProfileConfigReadError";
39
+ } & Readonly<A>;
40
+ export declare class ProfileConfigReadError extends ProfileConfigReadError_base<{
41
+ readonly path: string;
42
+ readonly cause: unknown;
43
+ }> {
44
+ }
45
+ declare const ProfileConfigWriteError_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 & {
46
+ readonly _tag: "ProfileConfigWriteError";
47
+ } & Readonly<A>;
48
+ export declare class ProfileConfigWriteError extends ProfileConfigWriteError_base<{
49
+ readonly path: string;
50
+ readonly cause: unknown;
51
+ }> {
52
+ }
53
+ /**
54
+ * Parse and brand a raw profile name. Rejects the empty string and any
55
+ * string that fails NAME_PATTERN.
56
+ */
57
+ export declare const parseProfileName: (raw: string) => Effect.Effect<ProfileName, ProfileInvalidNameError>;
58
+ /**
59
+ * Load the full layered config view. Missing file resolves to an empty
60
+ * view; malformed file surfaces as ProfileConfigReadError. No silent
61
+ * defaults on parse error.
62
+ *
63
+ * The file schema is strict: stale fields and malformed profile entries fail
64
+ * decode instead of being silently ignored.
65
+ */
66
+ export declare const loadLayeredConfig: Effect.Effect<LayeredConfig, ProfileConfigReadError>;
67
+ /**
68
+ * Resolve a named profile record. CLI transport selection uses only
69
+ * `agentId`; daemon startup consumes the redacted `apiKey`.
70
+ */
71
+ export declare const resolveProfileRecord: (name: ProfileName) => Effect.Effect<ProfileRecord, ProfileNotFoundError | ProfileConfigReadError>;
72
+ /**
73
+ * Persist a new profile record under `profiles.&lt;name>`.
74
+ */
75
+ export declare const writeProfile: (name: ProfileName, record: ProfileRecord) => Effect.Effect<void, ProfileConfigWriteError | ProfileConfigReadError>;
76
+ /**
77
+ * `--no-persist` contract for `moltzap register`: no file under
78
+ * `$HOME/.moltzap/` is created or modified. Returns the record so the caller
79
+ * can print it; does no I/O under that tree.
80
+ *
81
+ * The register command invokes either `writeProfile` (default) or
82
+ * `emitNoPersist` (when the flag is set). The register handler never calls
83
+ * both paths on the same invocation.
84
+ *
85
+ * The register command pipes the returned record through the printer,
86
+ * which writes non-secret registration details to stdout.
87
+ */
88
+ export declare const emitNoPersist: (record: ProfileRecord) => Effect.Effect<{
89
+ readonly record: ProfileRecord;
90
+ }, never>;
91
+ export {};
92
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAQA,OAAO,EAAQ,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAiBtD,eAAO,MAAM,WAAW,kEAGvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE,QAAA,MAAM,mBAAmB;;;;EAIvB,CAAC;AAEH,2CAA2C;AAC3C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAe3E,yCAAyC;AACzC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;CAC5D;AAID,sDAAsD;AACtD,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,uBAAuB,GACvB,sBAAsB,GACtB,uBAAuB,CAAC;;;;AAE5B,qBAAa,oBAAqB,SAAQ,0BAExC;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;CAAG;;;;AAEL,qBAAa,uBAAwB,SAAQ,6BAE3C;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;CAAG;;;;AAEL,qBAAa,sBAAuB,SAAQ,4BAE1C;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;CAAG;;;;AAEL,qBAAa,uBAAwB,SAAQ,6BAE3C;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;CAAG;AAIL;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,MAAM,KACV,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,uBAAuB,CAWpD,CAAC;AAkEF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAC3C,aAAa,EACb,sBAAsB,CAMqB,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,WAAW,KAChB,MAAM,CAAC,MAAM,CACd,aAAa,EACb,oBAAoB,GAAG,sBAAsB,CASG,CAAC;AAgEnD;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,WAAW,EACjB,QAAQ,aAAa,KACpB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,sBAAsB,CAI7B,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,aAAa,KACpB,MAAM,CAAC,MAAM,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAAE,EAAE,KAAK,CAC9B,CAAC"}
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Profile layer over `~/.moltzap/config.json`.
3
+ *
4
+ * Named profiles live under a top-level `profiles` key. There is no singleton
5
+ * credential fallback; every persisted identity is selected by profile name.
6
+ */
7
+ import { FileSystem } from "@effect/platform";
8
+ import { NodeFileSystem } from "@effect/platform-node";
9
+ import { Data, Effect, Either, Schema } from "effect";
10
+ import { AgentId } from "@moltzap/protocol/identity";
11
+ import { AgentKey } from "@moltzap/protocol/identity";
12
+ import { getMoltZapConfigDir, getMoltZapConfigPath } from "./local-paths.js";
13
+ // ─── Branded names ─────────────────────────────────────────────────────────
14
+ const NAME_PATTERN = /^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$/;
15
+ const PROFILE_NAME_REASON = "must be 3-32 chars, lowercase alphanumeric and hyphens, cannot start or end with a hyphen";
16
+ const CONFIG_FILE_MODE = 0o600;
17
+ const JSON_INDENT_SPACES = 2;
18
+ const getConfigDir = getMoltZapConfigDir;
19
+ const getConfigFilePathSync = getMoltZapConfigPath;
20
+ const STRICT_PARSE_OPTIONS = { onExcessProperty: "error" };
21
+ // ─── Records ───────────────────────────────────────────────────────────────
22
+ export const ProfileName = Schema.String.pipe(Schema.pattern(NAME_PATTERN), Schema.brand("ProfileName"));
23
+ const ProfileRecordSchema = Schema.Struct({
24
+ agentId: AgentId,
25
+ apiKey: AgentKey,
26
+ agentName: Schema.String,
27
+ });
28
+ const ProfileMapSchema = Schema.Record({
29
+ key: ProfileName,
30
+ value: ProfileRecordSchema,
31
+ });
32
+ const ProfileFileSchema = Schema.Struct({
33
+ profiles: Schema.optional(ProfileMapSchema),
34
+ });
35
+ const ProfileFileTextSchema = Schema.parseJson(ProfileFileSchema, {
36
+ space: JSON_INDENT_SPACES,
37
+ });
38
+ export class ProfileNotFoundError extends Data.TaggedError("ProfileNotFoundError") {
39
+ }
40
+ export class ProfileInvalidNameError extends Data.TaggedError("ProfileInvalidNameError") {
41
+ }
42
+ export class ProfileConfigReadError extends Data.TaggedError("ProfileConfigReadError") {
43
+ }
44
+ export class ProfileConfigWriteError extends Data.TaggedError("ProfileConfigWriteError") {
45
+ }
46
+ // ─── Public API ────────────────────────────────────────────────────────────
47
+ /**
48
+ * Parse and brand a raw profile name. Rejects the empty string and any
49
+ * string that fails NAME_PATTERN.
50
+ */
51
+ export const parseProfileName = (raw) => {
52
+ return Schema.decodeUnknown(ProfileName)(raw).pipe(Effect.catchTag("ParseError", () => Effect.fail(new ProfileInvalidNameError({
53
+ name: raw,
54
+ reason: raw.length === 0 ? "empty string" : PROFILE_NAME_REASON,
55
+ }))));
56
+ };
57
+ const readProfileFileText = (configPath) => FileSystem.FileSystem.pipe(Effect.flatMap((fileSystem) => fileSystem
58
+ .exists(configPath)
59
+ .pipe(Effect.flatMap((exists) => exists
60
+ ? fileSystem.readFileString(configPath, "utf-8")
61
+ : Effect.succeed(null)))), Effect.provide(NodeFileSystem.layer), Effect.either, Effect.flatMap(Either.match({
62
+ onLeft: (cause) => Effect.fail(new ProfileConfigReadError({ path: configPath, cause })),
63
+ onRight: (value) => Effect.succeed(value),
64
+ })));
65
+ const decodeProfileFileText = (configPath, text) => Schema.decodeUnknown(ProfileFileTextSchema, STRICT_PARSE_OPTIONS)(text).pipe(Effect.either, Effect.flatMap(Either.match({
66
+ onLeft: (cause) => Effect.fail(new ProfileConfigReadError({ path: configPath, cause })),
67
+ onRight: Effect.succeed,
68
+ })));
69
+ const readProfileFile = () => Effect.gen(function* () {
70
+ const configPath = getConfigFilePathSync();
71
+ const text = yield* readProfileFileText(configPath);
72
+ if (text === null) {
73
+ return { file: {}, existed: false };
74
+ }
75
+ const file = yield* decodeProfileFileText(configPath, text);
76
+ return { file, existed: true };
77
+ });
78
+ function profilesFromFile(file) {
79
+ return new Map(Object.entries(file.profiles ?? {}));
80
+ }
81
+ /**
82
+ * Load the full layered config view. Missing file resolves to an empty
83
+ * view; malformed file surfaces as ProfileConfigReadError. No silent
84
+ * defaults on parse error.
85
+ *
86
+ * The file schema is strict: stale fields and malformed profile entries fail
87
+ * decode instead of being silently ignored.
88
+ */
89
+ export const loadLayeredConfig = Effect.gen(function* () {
90
+ const { file } = yield* readProfileFile();
91
+ return {
92
+ profiles: profilesFromFile(file),
93
+ };
94
+ }).pipe(Effect.withSpan("loadLayeredConfig"));
95
+ /**
96
+ * Resolve a named profile record. CLI transport selection uses only
97
+ * `agentId`; daemon startup consumes the redacted `apiKey`.
98
+ */
99
+ export const resolveProfileRecord = (name) => Effect.gen(function* () {
100
+ const layered = yield* loadLayeredConfig;
101
+ const found = layered.profiles.get(name);
102
+ if (found === undefined) {
103
+ return yield* Effect.fail(new ProfileNotFoundError({ name }));
104
+ }
105
+ return found;
106
+ }).pipe(Effect.withSpan("resolveProfileRecord"));
107
+ function nextProfileFile(file, name, record) {
108
+ return {
109
+ profiles: {
110
+ ...file.profiles,
111
+ [name]: record,
112
+ },
113
+ };
114
+ }
115
+ const encodeProfileFileText = (configPath, file) => Schema.encode(ProfileFileTextSchema, STRICT_PARSE_OPTIONS)(file).pipe(Effect.either, Effect.flatMap(Either.match({
116
+ onLeft: (cause) => Effect.fail(new ProfileConfigWriteError({ path: configPath, cause })),
117
+ onRight: Effect.succeed,
118
+ })));
119
+ const writeProfileFile = (next) => {
120
+ const configDir = getConfigDir();
121
+ const configPath = getConfigFilePathSync();
122
+ return FileSystem.FileSystem.pipe(Effect.flatMap((fileSystem) => encodeProfileFileText(configPath, next).pipe(Effect.flatMap((text) => fileSystem.makeDirectory(configDir, { recursive: true }).pipe(Effect.zipRight(fileSystem.writeFileString(configPath, `${text}\n`, {
123
+ mode: CONFIG_FILE_MODE,
124
+ })))))), Effect.provide(NodeFileSystem.layer), Effect.either, Effect.flatMap(Either.match({
125
+ onLeft: (cause) => Effect.fail(new ProfileConfigWriteError({ path: configPath, cause })),
126
+ onRight: (value) => Effect.succeed(value),
127
+ })));
128
+ };
129
+ /**
130
+ * Persist a new profile record under `profiles.&lt;name>`.
131
+ */
132
+ export const writeProfile = (name, record) => Effect.gen(function* () {
133
+ const { file } = yield* readProfileFile();
134
+ yield* writeProfileFile(nextProfileFile(file, name, record));
135
+ }).pipe(Effect.withSpan("writeProfile"));
136
+ /**
137
+ * `--no-persist` contract for `moltzap register`: no file under
138
+ * `$HOME/.moltzap/` is created or modified. Returns the record so the caller
139
+ * can print it; does no I/O under that tree.
140
+ *
141
+ * The register command invokes either `writeProfile` (default) or
142
+ * `emitNoPersist` (when the flag is set). The register handler never calls
143
+ * both paths on the same invocation.
144
+ *
145
+ * The register command pipes the returned record through the printer,
146
+ * which writes non-secret registration details to stdout.
147
+ */
148
+ export const emitNoPersist = (record) => Effect.succeed({ record });
149
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,8EAA8E;AAE9E,MAAM,YAAY,GAAG,mCAAmC,CAAC;AACzD,MAAM,mBAAmB,GACvB,2FAA2F,CAAC;AAE9F,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,mBAAmB,CAAC;AACzC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AACnD,MAAM,oBAAoB,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAW,CAAC;AAEpE,8EAA8E;AAE9E,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC3C,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAC5B,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAC5B,CAAC;AAOF,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,QAAQ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":[],"mappings":"AAAA,OAAO,EAAU,OAAO,EAAU,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAG,CAAiC,CAAC;AAEhF,6EAA6E;AAC7E,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EACxB,KAAK,CAAC,EACN,MAAM,MAAM,CAAC,KACZ,CAAgD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.js","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,GAAe,EAAK,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,CAAwB,EACxB,GAAM,EACN,IAAa,EACV,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { HashMap } from "effect";
2
- import type { ConversationId, TaskId } from "@moltzap/protocol/task";
2
+ import type { ConversationId } from "@moltzap/protocol/conversation";
3
+ import type { TaskId } from "@moltzap/protocol/task";
3
4
  /**
4
5
  * Helpers extracted from `service.ts → markConversationArchived` to keep
5
6
  * the function under the 50-line ESLint cap and the file under the
@@ -1 +1 @@
1
- {"version":3,"file":"service-archive-purge.d.ts","sourceRoot":"","sources":["../src/service-archive-purge.ts"],"names":[],"mappings":"AAAA,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C;AACd,CAAC"}
@@ -1,13 +1,8 @@
1
- import { type AnyNotificationDefinition, type DecodedNotification, type Message, type Part } from "@moltzap/protocol";
1
+ import type { NotificationDelivery } from "@moltzap/protocol/rpc";
2
+ import type { AnyNotificationDefinition } from "@moltzap/protocol/socket/catalog";
3
+ import type { Message } from "@moltzap/protocol/message";
2
4
  import { HashMap } from "effect";
3
- import type { ConversationMeta, CrossConversationEntry } from "../service.js";
4
- declare const ServiceInputError_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 & {
5
- readonly _tag: "ServiceInputError";
6
- } & Readonly<A>;
7
- export declare class ServiceInputError extends ServiceInputError_base<{
8
- readonly message: string;
9
- }> {
10
- }
5
+ import type { ConversationMeta, CrossConversationEntry } from "./service.js";
11
6
  export interface CrossConvState {
12
7
  readonly messagesMap: HashMap.HashMap<string, ReadonlyArray<Message>>;
13
8
  readonly conversationsMap: HashMap.HashMap<string, ConversationMeta>;
@@ -23,10 +18,9 @@ interface BuiltContextEntries {
23
18
  readonly entries: CrossConversationEntry[];
24
19
  readonly pendingAdvances: ReadonlyArray<readonly [string, string]>;
25
20
  }
26
- export declare const renderPart: (part: Part) => string;
27
21
  export declare function newMessagesForConversation(convId: string, messages: ReadonlyArray<Message>, viewMarkers: HashMap.HashMap<string, string>, currentConvId: string): ReadonlyArray<Message>;
28
22
  export declare function makeContextCandidate(convId: string, newMsgs: ReadonlyArray<Message>): ContextCandidate;
29
23
  export declare function buildContextEntries(candidates: ReadonlyArray<ContextCandidate>, state: CrossConvState, maxMessagesPerConv: number): BuiltContextEntries;
30
- export declare function notificationTraceRecord(notification: DecodedNotification<AnyNotificationDefinition>, agentId: string | undefined): Record<string, unknown>;
24
+ export declare function notificationTraceRecord(notification: NotificationDelivery<AnyNotificationDefinition>, agentId: string | undefined): Record<string, unknown>;
31
25
  export {};
32
26
  //# sourceMappingURL=service-helpers.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,EAChC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5C,aAAa,EAAE,MAAM,GACpB,aAAa,CAAC,OAAO,CAAC,CAQxB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,GAC9B,gBAAgB,CAOlB;AAyCD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC3C,KAAK,EAAE,cAAc,EACrB,kBAAkB,EAAE,MAAM,GACzB,mBAAmB,CAarB;AAQD,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,oBAAoB,CAAC,yBAAyB,CAAC,EAC7D,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB"}
@@ -1,9 +1,7 @@
1
- import {} from "@moltzap/protocol";
2
- import { Data, HashMap, Match, Option } from "effect";
1
+ import { HashMap, Option } from "effect";
2
+ import { renderPart } from "./message-rendering.js";
3
3
  import { getOr } from "./refs.js";
4
4
  const MILLISECONDS_PER_MINUTE = 60_000;
5
- export class ServiceInputError extends Data.TaggedError("ServiceInputError") {
6
- }
7
5
  const isPlainRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8
6
  const recordOrEmpty = (value) => isPlainRecord(value) ? value : {};
9
7
  const recordProperty = (record, key) => {
@@ -14,11 +12,6 @@ const stringProperty = (record, key) => {
14
12
  const value = record[key];
15
13
  return typeof value === "string" ? value : undefined;
16
14
  };
17
- export const renderPart = Match.type().pipe(Match.discriminatorsExhaustive("type")({
18
- text: (text) => text.text,
19
- image: () => "[image]",
20
- file: (file) => `[file: ${file.name}]`,
21
- }));
22
15
  export function newMessagesForConversation(convId, messages, viewMarkers, currentConvId) {
23
16
  if (convId === currentConvId || messages.length === 0)
24
17
  return [];