@animalabs/agent-framework 0.32.0 → 0.34.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 (368) hide show
  1. package/README.md +340 -22
  2. package/dist/src/admission/admit.d.ts +18 -0
  3. package/dist/src/admission/admit.d.ts.map +1 -1
  4. package/dist/src/admission/admit.js +16 -3
  5. package/dist/src/admission/admit.js.map +1 -1
  6. package/dist/src/agent.d.ts +208 -80
  7. package/dist/src/agent.d.ts.map +1 -1
  8. package/dist/src/agent.js +345 -113
  9. package/dist/src/agent.js.map +1 -1
  10. package/dist/src/api/mcp-server-core.d.ts.map +1 -1
  11. package/dist/src/api/mcp-server-core.js +50 -12
  12. package/dist/src/api/mcp-server-core.js.map +1 -1
  13. package/dist/src/api/server.d.ts.map +1 -1
  14. package/dist/src/api/server.js +4 -20
  15. package/dist/src/api/server.js.map +1 -1
  16. package/dist/src/append-all.d.ts +5 -0
  17. package/dist/src/append-all.d.ts.map +1 -0
  18. package/dist/src/append-all.js +8 -0
  19. package/dist/src/append-all.js.map +1 -0
  20. package/dist/src/code-execution/isolate/scripts.d.ts +12 -8
  21. package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -1
  22. package/dist/src/code-execution/isolate/scripts.js +24 -0
  23. package/dist/src/code-execution/isolate/scripts.js.map +1 -1
  24. package/dist/src/config-checks.d.ts +7 -0
  25. package/dist/src/config-checks.d.ts.map +1 -1
  26. package/dist/src/config-checks.js +14 -0
  27. package/dist/src/config-checks.js.map +1 -1
  28. package/dist/src/context-manager-errors.d.ts +25 -0
  29. package/dist/src/context-manager-errors.d.ts.map +1 -0
  30. package/dist/src/context-manager-errors.js +31 -0
  31. package/dist/src/context-manager-errors.js.map +1 -0
  32. package/dist/src/context-options.d.ts +70 -0
  33. package/dist/src/context-options.d.ts.map +1 -0
  34. package/dist/src/context-options.js +90 -0
  35. package/dist/src/context-options.js.map +1 -0
  36. package/dist/src/cut-off-round.js +4 -4
  37. package/dist/src/deferred-import.d.ts +93 -0
  38. package/dist/src/deferred-import.d.ts.map +1 -0
  39. package/dist/src/deferred-import.js +177 -0
  40. package/dist/src/deferred-import.js.map +1 -0
  41. package/dist/src/dendrite/audience.d.ts +223 -0
  42. package/dist/src/dendrite/audience.d.ts.map +1 -0
  43. package/dist/src/dendrite/audience.js +202 -0
  44. package/dist/src/dendrite/audience.js.map +1 -0
  45. package/dist/src/dendrite/index.d.ts +5 -3
  46. package/dist/src/dendrite/index.d.ts.map +1 -1
  47. package/dist/src/dendrite/index.js +2 -1
  48. package/dist/src/dendrite/index.js.map +1 -1
  49. package/dist/src/dendrite/presets.d.ts +10 -5
  50. package/dist/src/dendrite/presets.d.ts.map +1 -1
  51. package/dist/src/dendrite/presets.js +17 -5
  52. package/dist/src/dendrite/presets.js.map +1 -1
  53. package/dist/src/dendrite/registry.d.ts +62 -7
  54. package/dist/src/dendrite/registry.d.ts.map +1 -1
  55. package/dist/src/dendrite/registry.js +183 -12
  56. package/dist/src/dendrite/registry.js.map +1 -1
  57. package/dist/src/dendrite/types.d.ts +91 -8
  58. package/dist/src/dendrite/types.d.ts.map +1 -1
  59. package/dist/src/failure-text.d.ts +36 -0
  60. package/dist/src/failure-text.d.ts.map +1 -0
  61. package/dist/src/failure-text.js +89 -0
  62. package/dist/src/failure-text.js.map +1 -0
  63. package/dist/src/foreign-rounds.d.ts +69 -0
  64. package/dist/src/foreign-rounds.d.ts.map +1 -0
  65. package/dist/src/foreign-rounds.js +152 -0
  66. package/dist/src/foreign-rounds.js.map +1 -0
  67. package/dist/src/framework.d.ts +2064 -842
  68. package/dist/src/framework.d.ts.map +1 -1
  69. package/dist/src/framework.js +8586 -3739
  70. package/dist/src/framework.js.map +1 -1
  71. package/dist/src/gate/event-gate.d.ts +125 -21
  72. package/dist/src/gate/event-gate.d.ts.map +1 -1
  73. package/dist/src/gate/event-gate.js +487 -72
  74. package/dist/src/gate/event-gate.js.map +1 -1
  75. package/dist/src/gate/index.d.ts +1 -1
  76. package/dist/src/gate/index.d.ts.map +1 -1
  77. package/dist/src/gate/index.js.map +1 -1
  78. package/dist/src/gate/reply-judge.d.ts +4 -0
  79. package/dist/src/gate/reply-judge.d.ts.map +1 -1
  80. package/dist/src/gate/reply-judge.js +12 -3
  81. package/dist/src/gate/reply-judge.js.map +1 -1
  82. package/dist/src/gate/rule-scope.d.ts +30 -0
  83. package/dist/src/gate/rule-scope.d.ts.map +1 -0
  84. package/dist/src/gate/rule-scope.js +41 -0
  85. package/dist/src/gate/rule-scope.js.map +1 -0
  86. package/dist/src/gate/suppress-script-worker.d.ts +2 -0
  87. package/dist/src/gate/suppress-script-worker.d.ts.map +1 -0
  88. package/dist/src/gate/suppress-script-worker.js +103 -0
  89. package/dist/src/gate/suppress-script-worker.js.map +1 -0
  90. package/dist/src/gate/suppress-scripts.d.ts +105 -0
  91. package/dist/src/gate/suppress-scripts.d.ts.map +1 -0
  92. package/dist/src/gate/suppress-scripts.js +403 -0
  93. package/dist/src/gate/suppress-scripts.js.map +1 -0
  94. package/dist/src/gate/suppression-review.d.ts +143 -0
  95. package/dist/src/gate/suppression-review.d.ts.map +1 -0
  96. package/dist/src/gate/suppression-review.js +463 -0
  97. package/dist/src/gate/suppression-review.js.map +1 -0
  98. package/dist/src/gate/suppression-stats.d.ts +125 -0
  99. package/dist/src/gate/suppression-stats.d.ts.map +1 -0
  100. package/dist/src/gate/suppression-stats.js +214 -0
  101. package/dist/src/gate/suppression-stats.js.map +1 -0
  102. package/dist/src/gate/types.d.ts +142 -7
  103. package/dist/src/gate/types.d.ts.map +1 -1
  104. package/dist/src/gate/wake-onboarding.d.ts +119 -0
  105. package/dist/src/gate/wake-onboarding.d.ts.map +1 -0
  106. package/dist/src/gate/wake-onboarding.js +277 -0
  107. package/dist/src/gate/wake-onboarding.js.map +1 -0
  108. package/dist/src/heartbeat/heartbeat.js +1 -1
  109. package/dist/src/heartbeat/heartbeat.js.map +1 -1
  110. package/dist/src/held-writes.d.ts +31 -23
  111. package/dist/src/held-writes.d.ts.map +1 -1
  112. package/dist/src/held-writes.js +44 -59
  113. package/dist/src/held-writes.js.map +1 -1
  114. package/dist/src/index.d.ts +6 -2
  115. package/dist/src/index.d.ts.map +1 -1
  116. package/dist/src/index.js +4 -0
  117. package/dist/src/index.js.map +1 -1
  118. package/dist/src/inference-bounds.d.ts +2 -1
  119. package/dist/src/inference-bounds.d.ts.map +1 -1
  120. package/dist/src/inference-bounds.js +9 -6
  121. package/dist/src/inference-bounds.js.map +1 -1
  122. package/dist/src/jsonrpc-envelope.d.ts +69 -0
  123. package/dist/src/jsonrpc-envelope.d.ts.map +1 -0
  124. package/dist/src/jsonrpc-envelope.js +66 -0
  125. package/dist/src/jsonrpc-envelope.js.map +1 -0
  126. package/dist/src/mcpl/channel-registry.d.ts +188 -28
  127. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  128. package/dist/src/mcpl/channel-registry.js +426 -70
  129. package/dist/src/mcpl/channel-registry.js.map +1 -1
  130. package/dist/src/mcpl/checkpoint-manager.d.ts +2 -4
  131. package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
  132. package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
  133. package/dist/src/mcpl/feature-set-manager.d.ts +2 -4
  134. package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
  135. package/dist/src/mcpl/feature-set-manager.js.map +1 -1
  136. package/dist/src/mcpl/inbound-source.d.ts +2 -1
  137. package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
  138. package/dist/src/mcpl/inbound-source.js +2 -1
  139. package/dist/src/mcpl/inbound-source.js.map +1 -1
  140. package/dist/src/mcpl/inference-router.d.ts +6 -6
  141. package/dist/src/mcpl/inference-router.d.ts.map +1 -1
  142. package/dist/src/mcpl/inference-router.js.map +1 -1
  143. package/dist/src/mcpl/modern-connection.d.ts +109 -15
  144. package/dist/src/mcpl/modern-connection.d.ts.map +1 -1
  145. package/dist/src/mcpl/modern-connection.js +593 -86
  146. package/dist/src/mcpl/modern-connection.js.map +1 -1
  147. package/dist/src/mcpl/protocol-family.d.ts +3 -1
  148. package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
  149. package/dist/src/mcpl/protocol-family.js +15 -9
  150. package/dist/src/mcpl/protocol-family.js.map +1 -1
  151. package/dist/src/mcpl/push-coalescer.d.ts +132 -22
  152. package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
  153. package/dist/src/mcpl/push-coalescer.js +105 -15
  154. package/dist/src/mcpl/push-coalescer.js.map +1 -1
  155. package/dist/src/mcpl/push-handler.d.ts +9 -7
  156. package/dist/src/mcpl/push-handler.d.ts.map +1 -1
  157. package/dist/src/mcpl/push-handler.js.map +1 -1
  158. package/dist/src/mcpl/server-connection.d.ts +50 -28
  159. package/dist/src/mcpl/server-connection.d.ts.map +1 -1
  160. package/dist/src/mcpl/server-connection.js +165 -72
  161. package/dist/src/mcpl/server-connection.js.map +1 -1
  162. package/dist/src/mcpl/tool-classes.d.ts.map +1 -1
  163. package/dist/src/mcpl/tool-classes.js +3 -0
  164. package/dist/src/mcpl/tool-classes.js.map +1 -1
  165. package/dist/src/mcpl/tool-presence.d.ts.map +1 -1
  166. package/dist/src/mcpl/tool-presence.js +10 -6
  167. package/dist/src/mcpl/tool-presence.js.map +1 -1
  168. package/dist/src/mcpl/toolset-host.d.ts.map +1 -1
  169. package/dist/src/mcpl/toolset-host.js +7 -6
  170. package/dist/src/mcpl/toolset-host.js.map +1 -1
  171. package/dist/src/mcpl/toolsets-module.d.ts.map +1 -1
  172. package/dist/src/mcpl/toolsets-module.js +2 -1
  173. package/dist/src/mcpl/toolsets-module.js.map +1 -1
  174. package/dist/src/mcpl/types.d.ts +33 -6
  175. package/dist/src/mcpl/types.d.ts.map +1 -1
  176. package/dist/src/mcpl/types.js.map +1 -1
  177. package/dist/src/module-registry.d.ts +24 -1
  178. package/dist/src/module-registry.d.ts.map +1 -1
  179. package/dist/src/module-registry.js +68 -18
  180. package/dist/src/module-registry.js.map +1 -1
  181. package/dist/src/modules/discord/index.d.ts +45 -8
  182. package/dist/src/modules/discord/index.d.ts.map +1 -1
  183. package/dist/src/modules/discord/index.js +238 -87
  184. package/dist/src/modules/discord/index.js.map +1 -1
  185. package/dist/src/modules/health/index.js +2 -2
  186. package/dist/src/modules/health/index.js.map +1 -1
  187. package/dist/src/modules/history/index.d.ts +59 -0
  188. package/dist/src/modules/history/index.d.ts.map +1 -1
  189. package/dist/src/modules/history/index.js +432 -67
  190. package/dist/src/modules/history/index.js.map +1 -1
  191. package/dist/src/modules/history/semantic.d.ts +6 -5
  192. package/dist/src/modules/history/semantic.d.ts.map +1 -1
  193. package/dist/src/modules/history/semantic.js +18 -25
  194. package/dist/src/modules/history/semantic.js.map +1 -1
  195. package/dist/src/modules/workspace/disk-agreement.d.ts +1 -1
  196. package/dist/src/modules/workspace/disk-agreement.js +1 -1
  197. package/dist/src/modules/workspace/index.d.ts +28 -7
  198. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  199. package/dist/src/modules/workspace/index.js +80 -25
  200. package/dist/src/modules/workspace/index.js.map +1 -1
  201. package/dist/src/modules/workspace/observe.d.ts.map +1 -1
  202. package/dist/src/modules/workspace/observe.js +2 -1
  203. package/dist/src/modules/workspace/observe.js.map +1 -1
  204. package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
  205. package/dist/src/modules/workspace/reconcile.js +3 -2
  206. package/dist/src/modules/workspace/reconcile.js.map +1 -1
  207. package/dist/src/notice-tags.d.ts +20 -9
  208. package/dist/src/notice-tags.d.ts.map +1 -1
  209. package/dist/src/notice-tags.js +20 -9
  210. package/dist/src/notice-tags.js.map +1 -1
  211. package/dist/src/operator-log.d.ts +36 -3
  212. package/dist/src/operator-log.d.ts.map +1 -1
  213. package/dist/src/operator-log.js +2 -2
  214. package/dist/src/operator-log.js.map +1 -1
  215. package/dist/src/presentation.d.ts +747 -0
  216. package/dist/src/presentation.d.ts.map +1 -0
  217. package/dist/src/presentation.js +1437 -0
  218. package/dist/src/presentation.js.map +1 -0
  219. package/dist/src/prose-drafts.d.ts +15 -11
  220. package/dist/src/prose-drafts.d.ts.map +1 -1
  221. package/dist/src/prose-drafts.js +16 -12
  222. package/dist/src/prose-drafts.js.map +1 -1
  223. package/dist/src/read-marks.d.ts +192 -0
  224. package/dist/src/read-marks.d.ts.map +1 -0
  225. package/dist/src/read-marks.js +242 -0
  226. package/dist/src/read-marks.js.map +1 -0
  227. package/dist/src/reasoning-loss.d.ts +5 -0
  228. package/dist/src/reasoning-loss.d.ts.map +1 -0
  229. package/dist/src/reasoning-loss.js +8 -0
  230. package/dist/src/reasoning-loss.js.map +1 -0
  231. package/dist/src/recovery/offline-branch.d.ts +91 -6
  232. package/dist/src/recovery/offline-branch.d.ts.map +1 -1
  233. package/dist/src/recovery/offline-branch.js +277 -32
  234. package/dist/src/recovery/offline-branch.js.map +1 -1
  235. package/dist/src/recovery/recover-cli.js +24 -4
  236. package/dist/src/recovery/recover-cli.js.map +1 -1
  237. package/dist/src/send-tools.d.ts +5 -9
  238. package/dist/src/send-tools.d.ts.map +1 -1
  239. package/dist/src/send-tools.js +40 -7
  240. package/dist/src/send-tools.js.map +1 -1
  241. package/dist/src/sent-rows.js +1 -1
  242. package/dist/src/stored-injections.d.ts +2 -2
  243. package/dist/src/stored-injections.js +2 -2
  244. package/dist/src/stored-removal.d.ts +17 -4
  245. package/dist/src/stored-removal.d.ts.map +1 -1
  246. package/dist/src/stored-removal.js +29 -5
  247. package/dist/src/stored-removal.js.map +1 -1
  248. package/dist/src/supplied-text.d.ts +1 -1
  249. package/dist/src/supplied-text.js +3 -3
  250. package/dist/src/supplied-text.js.map +1 -1
  251. package/dist/src/thinking-drops.d.ts +2 -0
  252. package/dist/src/thinking-drops.d.ts.map +1 -1
  253. package/dist/src/thinking-drops.js.map +1 -1
  254. package/dist/src/tool-presentation.d.ts.map +1 -1
  255. package/dist/src/tool-presentation.js +38 -9
  256. package/dist/src/tool-presentation.js.map +1 -1
  257. package/dist/src/tool-result-guard.d.ts +12 -1
  258. package/dist/src/tool-result-guard.d.ts.map +1 -1
  259. package/dist/src/tool-result-guard.js +42 -8
  260. package/dist/src/tool-result-guard.js.map +1 -1
  261. package/dist/src/tune-out/coordinator.d.ts +1170 -81
  262. package/dist/src/tune-out/coordinator.d.ts.map +1 -1
  263. package/dist/src/tune-out/coordinator.js +3732 -369
  264. package/dist/src/tune-out/coordinator.js.map +1 -1
  265. package/dist/src/tune-out/tools.d.ts +114 -17
  266. package/dist/src/tune-out/tools.d.ts.map +1 -1
  267. package/dist/src/tune-out/tools.js +89 -28
  268. package/dist/src/tune-out/tools.js.map +1 -1
  269. package/dist/src/tune-out/window-anchor.d.ts +143 -0
  270. package/dist/src/tune-out/window-anchor.d.ts.map +1 -0
  271. package/dist/src/tune-out/window-anchor.js +202 -0
  272. package/dist/src/tune-out/window-anchor.js.map +1 -0
  273. package/dist/src/types/agent.d.ts +121 -25
  274. package/dist/src/types/agent.d.ts.map +1 -1
  275. package/dist/src/types/events.d.ts +2 -0
  276. package/dist/src/types/events.d.ts.map +1 -1
  277. package/dist/src/types/framework.d.ts +72 -17
  278. package/dist/src/types/framework.d.ts.map +1 -1
  279. package/dist/src/types/inference-log.d.ts +1 -0
  280. package/dist/src/types/inference-log.d.ts.map +1 -1
  281. package/dist/src/types/module.d.ts +180 -69
  282. package/dist/src/types/module.d.ts.map +1 -1
  283. package/dist/src/types/trace.d.ts +573 -39
  284. package/dist/src/types/trace.d.ts.map +1 -1
  285. package/package.json +4 -4
  286. package/src/admission/admit.ts +32 -3
  287. package/src/agent.ts +392 -132
  288. package/src/api/mcp-server-core.ts +54 -17
  289. package/src/api/server.ts +4 -23
  290. package/src/append-all.ts +6 -0
  291. package/src/code-execution/isolate/scripts.ts +28 -3
  292. package/src/config-checks.ts +14 -0
  293. package/src/context-manager-errors.ts +37 -0
  294. package/src/context-options.ts +106 -0
  295. package/src/cut-off-round.ts +4 -4
  296. package/src/deferred-import.ts +239 -0
  297. package/src/dendrite/audience.ts +315 -0
  298. package/src/dendrite/index.ts +14 -2
  299. package/src/dendrite/presets.ts +18 -6
  300. package/src/dendrite/registry.ts +213 -14
  301. package/src/dendrite/types.ts +92 -8
  302. package/src/failure-text.ts +88 -0
  303. package/src/foreign-rounds.ts +199 -0
  304. package/src/framework.ts +8796 -3813
  305. package/src/gate/event-gate.ts +518 -91
  306. package/src/gate/index.ts +3 -0
  307. package/src/gate/reply-judge.ts +12 -3
  308. package/src/gate/rule-scope.ts +45 -0
  309. package/src/gate/suppress-script-worker.ts +89 -0
  310. package/src/gate/suppress-scripts.ts +414 -0
  311. package/src/gate/suppression-review.ts +517 -0
  312. package/src/gate/suppression-stats.ts +314 -0
  313. package/src/gate/types.ts +148 -7
  314. package/src/gate/wake-onboarding.ts +309 -0
  315. package/src/heartbeat/heartbeat.ts +1 -1
  316. package/src/held-writes.ts +49 -60
  317. package/src/index.ts +10 -2
  318. package/src/inference-bounds.ts +11 -6
  319. package/src/jsonrpc-envelope.ts +81 -0
  320. package/src/mcpl/channel-registry.ts +513 -116
  321. package/src/mcpl/checkpoint-manager.ts +3 -2
  322. package/src/mcpl/feature-set-manager.ts +2 -1
  323. package/src/mcpl/inbound-source.ts +2 -1
  324. package/src/mcpl/inference-router.ts +7 -4
  325. package/src/mcpl/modern-connection.ts +629 -91
  326. package/src/mcpl/protocol-family.ts +15 -9
  327. package/src/mcpl/push-coalescer.ts +193 -34
  328. package/src/mcpl/push-handler.ts +10 -5
  329. package/src/mcpl/server-connection.ts +169 -75
  330. package/src/mcpl/tool-classes.ts +3 -0
  331. package/src/mcpl/tool-presence.ts +10 -5
  332. package/src/mcpl/toolset-host.ts +7 -6
  333. package/src/mcpl/toolsets-module.ts +2 -1
  334. package/src/mcpl/types.ts +33 -6
  335. package/src/module-registry.ts +73 -17
  336. package/src/modules/discord/index.ts +230 -82
  337. package/src/modules/health/index.ts +2 -2
  338. package/src/modules/history/index.ts +439 -70
  339. package/src/modules/history/semantic.ts +18 -24
  340. package/src/modules/workspace/disk-agreement.ts +1 -1
  341. package/src/modules/workspace/index.ts +89 -26
  342. package/src/modules/workspace/observe.ts +2 -1
  343. package/src/modules/workspace/reconcile.ts +3 -2
  344. package/src/notice-tags.ts +21 -9
  345. package/src/operator-log.ts +36 -3
  346. package/src/presentation.ts +1678 -0
  347. package/src/prose-drafts.ts +16 -12
  348. package/src/read-marks.ts +328 -0
  349. package/src/reasoning-loss.ts +7 -0
  350. package/src/recovery/offline-branch.ts +350 -35
  351. package/src/recovery/recover-cli.ts +23 -4
  352. package/src/send-tools.ts +40 -7
  353. package/src/sent-rows.ts +1 -1
  354. package/src/stored-injections.ts +2 -2
  355. package/src/stored-removal.ts +31 -7
  356. package/src/supplied-text.ts +3 -3
  357. package/src/thinking-drops.ts +2 -0
  358. package/src/tool-presentation.ts +34 -9
  359. package/src/tool-result-guard.ts +41 -7
  360. package/src/tune-out/coordinator.ts +4121 -472
  361. package/src/tune-out/tools.ts +162 -44
  362. package/src/tune-out/window-anchor.ts +277 -0
  363. package/src/types/agent.ts +122 -25
  364. package/src/types/events.ts +2 -0
  365. package/src/types/framework.ts +73 -17
  366. package/src/types/inference-log.ts +1 -0
  367. package/src/types/module.ts +181 -68
  368. package/src/types/trace.ts +607 -43
@@ -1,69 +1,54 @@
1
+ import { suppressionRecordOf } from './gate/suppression-stats.js';
1
2
  /**
2
- * The id a module holds for a write the framework holds. addMessage holds a
3
- * write while its agent's turn is alive or the host is quiesced, and stores
4
- * it at a later boundary. Until then, a module's context answers its id as a
5
- * handle: `held:` and the write's id in the deferred queue. The context's
6
- * getMessage, editMessage and removeMessage take the handle as they take a
7
- * stored id, as a process answer's edits and removals do, and once the write
8
- * lands, the handle names the stored row, which carries the write's id as
9
- * `metadata.deferredWriteId`.
3
+ * The id a release before #291 gave a module for a write it held while the
4
+ * write's agent's turn was alive: `held:` and the write's id in its deferred
5
+ * queue, which the stored row carries as `metadata.deferredWriteId` once it
6
+ * lands. This release stores every write at once and answers its stored id,
7
+ * unless a surgery's hold or a context manager refusing its work keeps the
8
+ * write in memory, where it answers '', so no write gets a handle any more.
9
+ * A module may have kept one across the upgrade: for one release the
10
+ * context's getMessage, editMessage and removeMessage still take it, and
11
+ * reach the row its write landed as (AgentFramework.landedRow), which the
12
+ * importer stores at boot for a write that release left queued.
10
13
  */
11
14
  const HELD = 'held:';
12
- export function heldHandle(writeId) {
13
- return `${HELD}${writeId}`;
14
- }
15
- /** The deferred write a handle names, or undefined for any other id. A value
16
- * that isn't a string, which only an untyped caller passes, is no handle,
17
- * and goes on to the store as it did before handles. */
15
+ /** The queued write a `held:` handle names, or undefined for any other id. A
16
+ * value that isn't a string, which only an untyped caller passes, is no
17
+ * handle, and goes on to the store as it did before handles. */
18
18
  export function heldWriteId(id) {
19
19
  return typeof id === 'string' && id.startsWith(HELD) ? id.slice(HELD.length) : undefined;
20
20
  }
21
21
  /**
22
- * Whether a row matches `filter` as context-manager's queryMessages matches a
23
- * stored one. That's its MessageStore's private matchesFilter, the same at
24
- * 0.14.1, 0.16.0, 0.17.1 and 0.18.0, which the package doesn't export, so the rule is copied
25
- * here, and a test compares the two on the same rows. A row matches the external source, one of the
26
- * external ids (an empty list filters nothing), the participant, and each
27
- * metadata path, dot-separated, by strict equality.
28
- */
29
- export function matchesMessageQuery(row, filter) {
30
- const external = row.metadata?.external;
31
- if (filter.source !== undefined && external?.source !== filter.source)
32
- return false;
33
- if (filter.externalIds !== undefined &&
34
- filter.externalIds.length > 0 &&
35
- (!external?.id || !filter.externalIds.includes(external.id))) {
36
- return false;
37
- }
38
- if (filter.participant !== undefined && row.participant !== filter.participant)
39
- return false;
40
- if (filter.metadata !== undefined) {
41
- for (const [path, value] of Object.entries(filter.metadata)) {
42
- if (valueAt(row.metadata, path) !== value)
43
- return false;
44
- }
45
- }
46
- return true;
47
- }
48
- function valueAt(value, path) {
49
- for (const part of path.split('.')) {
50
- if (value === undefined || value === null || typeof value !== 'object')
51
- return undefined;
52
- value = value[part];
53
- }
54
- return value;
55
- }
56
- /**
57
- * A row as a module's context answers it: marked `heldFromResidents` when it
58
- * carries the stamp a tune-out puts on a message it holds from the residents
59
- * (`metadata.tuneOut`). Every resident's viewFilter leaves a stamped row out
60
- * of its compiled view (framework.ts, createAgent), and a resident's tool
61
- * boundary stores a stamped write without injecting it into the live turn, so
62
- * a marked row is one the store keeps and no resident is shown
63
- * (ModuleMessage.heldFromResidents says where its text can still reach
64
- * one). Any other row comes back as it is.
22
+ * A row as a module's context answers it, for the agent whose store it was
23
+ * read from:
24
+ *
25
+ * - `heldFromResidents` when it carries the stamp a tune-out puts on a
26
+ * message it holds from the residents (`metadata.tuneOut`). Every
27
+ * resident's viewFilter leaves a stamped row out of its compiled view
28
+ * (framework.ts, createAgent), and a tool boundary never presents one to a
29
+ * resident, so a marked row is one the store keeps and no resident is
30
+ * shown (ModuleMessage.heldFromResidents says where its text can still
31
+ * reach one). So is a row a suppress rule hid (`metadata.suppressed`),
32
+ * which no view shows either, nor any window presents (one stored before
33
+ * audience stamps stays in a window written down from the record; the
34
+ * view still leaves it out).
35
+ * - `held` when that agent's window (`window`) presents rows and doesn't
36
+ * hold it (#291): stored and not yet presented to the agent, which its
37
+ * next presentation point does, or taken out of it as an undone turn's,
38
+ * or one it is never presented, as a held row is for a resident. Never in
39
+ * legacy mode, where the window is the record. A resident's window
40
+ * written down from the record holds the held rows an earlier release
41
+ * stored, unstamped, so those read without `held`: `heldFromResidents`
42
+ * marks every held row.
43
+ *
44
+ * Any other row comes back as it is.
65
45
  */
66
- export function asModuleRow(row) {
67
- return row.metadata?.tuneOut ? { ...row, heldFromResidents: true } : row;
46
+ export function asModuleRow(row, window) {
47
+ const metadata = row.metadata;
48
+ const fromResidents = !!metadata?.tuneOut || suppressionRecordOf(metadata) !== undefined;
49
+ const held = window !== undefined && window.windowMode() === 'presented' && window.ordinalOf(row.id) === undefined;
50
+ if (!fromResidents && !held)
51
+ return row;
52
+ return { ...row, ...(fromResidents ? { heldFromResidents: true } : {}), ...(held ? { held: true } : {}) };
68
53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H,MAAM,UAAU,WAAW,CACzB,GAAM,EACN,MAAwB;IAExB,MAAM,QAAQ,GAAG,GAAG,CAAC,QAA+C,CAAC;IACrE,MAAM,aAAa,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,IAAI,mBAAmB,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC;IACzF,MAAM,IAAI,GAAG,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC;IACnH,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI;QAAE,OAAO,GAAG,CAAC;IACxC,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC9H,CAAC"}
@@ -1,10 +1,14 @@
1
1
  export * from './types/index.js';
2
2
  export { AgentFramework, AgentStoppedError, BudgetPreflightError, DefaultErrorPolicy, ProviderWaitNotSleptError, QuiesceBlockedError, ResumeBlockedError } from './framework.js';
3
+ export { isReasoningLoss } from './reasoning-loss.js';
3
4
  export type { RuntimeSettingsPreview, HostModeStatus, DeriveAgentOptions } from './framework.js';
4
5
  export { Agent } from './agent.js';
5
6
  export { FLAT_MINIMUM_MS, type InferenceBoundsOptions } from './inference-bounds.js';
6
7
  export { storedInjectionMarkOf, type StoredInjectionMark } from './stored-injections.js';
7
8
  export type { StartStreamResult } from './agent.js';
9
+ export type { PresentationOccasion } from './presentation.js';
10
+ export { covers, coverTest, describeReadMark, markAtOrAfter, type Cover, type MarkCm, type MarkedRow, type ReadMark } from './read-marks.js';
11
+ export { residentContextOptions, residentViewFilter, subconsciousContextOptions, subconsciousViewFilter, type ContextManagerOpenOptions, } from './context-options.js';
8
12
  export { ProcessQueueImpl } from './queue.js';
9
13
  export { ModuleRegistry } from './module-registry.js';
10
14
  export { ShutdownTimeoutError, DEFAULT_SHUTDOWN_TIMEOUT_MS } from './shutdown.js';
@@ -21,9 +25,9 @@ export { UsageTracker } from './usage/index.js';
21
25
  export { buildCodeExecutionToolDefinition, CODE_EXECUTION_TOOL_NAME } from './code-execution/index.js';
22
26
  export type { SessionUsage, AgentUsage, SessionUsageSnapshot, UsageUpdatedEvent } from './usage/index.js';
23
27
  export { EventGate, MCPL_GATE_EVENT_TYPES, wakeLineText, type EventTypesFrom, type WakeProvenance, type WritePlacement } from './gate/index.js';
24
- export type { GateConfig, GateOptions, GatePolicy, GatePolicyMatch, GateBehavior, WakeLine } from './gate/index.js';
28
+ export type { GateConfig, GateOptions, GatePolicy, GatePolicyMatch, GateBehavior, WakeLine, SuppressConfig, SuppressionReviewOptions } from './gate/index.js';
25
29
  export { ReplyJudge, DEFAULT_JUDGE_MODEL, DEFAULT_JUDGE_MAX_INPUT_TOKENS, MIN_JUDGE_INPUT_TOKENS } from './gate/index.js';
26
- export type { JudgeConfig, JudgeEventSummary, JudgeFn, JudgeRequest, JudgeVerdict, ReplyJudgeOptions, ReplyJudgeDeps, UpcomingWake } from './gate/index.js';
30
+ export type { JudgeConfig, JudgeEventSummary, JudgeFn, JudgeRequest, JudgeVerdict, ReplyJudgeOptions, ReplyJudgeDeps, UpcomingWake, UpcomingWakeKind } from './gate/index.js';
27
31
  export { Heartbeat, DEFAULT_HEARTBEAT, HEARTBEAT_TOOL_PREFIX } from './heartbeat/heartbeat.js';
28
32
  export type { HeartbeatOptions, HeartbeatSettings, HeartbeatWake, HeartbeatDeliveryMode, HeartbeatScheduledWake, Reminder } from './heartbeat/heartbeat.js';
29
33
  export { ChannelRegistry } from './mcpl/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names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EACzB,KAAK,mBAAmB,GACzB,MAAM,uBAAuB,CAAC"}
package/dist/src/index.js CHANGED
@@ -2,9 +2,13 @@
2
2
  export * from './types/index.js';
3
3
  // Core classes
4
4
  export { AgentFramework, AgentStoppedError, BudgetPreflightError, DefaultErrorPolicy, ProviderWaitNotSleptError, QuiesceBlockedError, ResumeBlockedError } from './framework.js';
5
+ export { isReasoningLoss } from './reasoning-loss.js';
5
6
  export { Agent } from './agent.js';
6
7
  export { FLAT_MINIMUM_MS } from './inference-bounds.js';
7
8
  export { storedInjectionMarkOf } from './stored-injections.js';
9
+ export { covers, coverTest, describeReadMark, markAtOrAfter } from './read-marks.js';
10
+ // How a resident's context and the subconscious's are opened (#291), for a host that opens one itself.
11
+ export { residentContextOptions, residentViewFilter, subconsciousContextOptions, subconsciousViewFilter, } from './context-options.js';
8
12
  export { ProcessQueueImpl } from './queue.js';
9
13
  export { ModuleRegistry } from './module-registry.js';
10
14
  export { ShutdownTimeoutError, DEFAULT_SHUTDOWN_TIMEOUT_MS } from './shutdown.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,kBAAkB,CAAC;AAEjC,eAAe;AACf,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEjL,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAA+B,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAA4B,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC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F,mCAAmC;AACnC,2HAA2H;AAC3H,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAc7E,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI9G,gEAAgE;AAChE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,EAC3B,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,wCAAwC,CAAC;AAsBhD,yEAAyE;AACzE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAS7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAM3E,cAAc,wBAAwB,CAAC;AAEvC,gFAAgF;AAChF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACzG,OAAO,EACL,oBAAoB,GAKrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,GAIlB,MAAM,uBAAuB,CAAC"}
@@ -27,11 +27,12 @@ export declare function wholeCallMs(bounds: InferenceBounds, maxTokens: number |
27
27
  export declare function isDeadlineExpiry(error: unknown): boolean;
28
28
  /**
29
29
  * Names the host setting for the bound a stream cut hit, read from the opening
30
- * of membrane 0.8.0's message for it (its progress-bounds.ts and
30
+ * of membrane 0.8.0's and 0.9.0's message for it (their progress-bounds.ts and
31
31
  * providers/utils.ts), so the reason an operator and the agent see names the
32
32
  * host's setting for that bound, as the README's table maps them. A message it
33
33
  * doesn't know is left as it is.
34
34
  */
35
35
  export declare function withHostSetting(message: string): string;
36
36
  export declare function deadlineCut(message: string | undefined): MembraneError;
37
+ export declare function isDeadlineCut(error: unknown): boolean;
37
38
  //# sourceMappingURL=inference-bounds.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inference-bounds.d.ts","sourceRoot":"","sources":["../../src/inference-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAA0C,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAElH;2BAC2B;AAC3B,MAAM,WAAW,sBAAsB;IACrC;;;;gDAI4C;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACzC;0CACsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,eAAe,UAAY,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,KAAK,GAAG,sBAAsB,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,CAqBjH;AAYD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,eAAe,GAAG,IAAI,EAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B;IAAE,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,CAO3E;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAG1F;AASD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOvD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAStE"}
1
+ {"version":3,"file":"inference-bounds.d.ts","sourceRoot":"","sources":["../../src/inference-bounds.ts"],"names":[],"mappings":"AAAA,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s);
48
48
  return setupMs(bounds.progressBounds) + allowanceMs(bounds.progressBounds, maxTokens);
49
49
  }
50
- // membrane 0.8.0 marks a deadline it reports as run out with this registered
51
- // symbol (on a sent request, or the Anthropic SDK's timeout, which covers its
52
- // connect timeout too) and exports no reader or marker for it. The one reader:
53
- // the deadline class here and the transient-failure check of an exhausted
54
- // turn's re-arm both use it.
50
+ // membrane 0.8.0 and 0.9.0 mark a deadline they report as run out with this
51
+ // registered symbol (on a sent request, or the Anthropic SDK's timeout, which
52
+ // covers its connect timeout too) and export no reader or marker for it.
55
53
  const DEADLINE_EXPIRY = Symbol.for('membrane.deadlineExpiry');
56
54
  export function isDeadlineExpiry(error) {
57
55
  return typeof error === 'object' && error !== null && error[DEADLINE_EXPIRY] === true;
58
56
  }
59
57
  /**
60
58
  * Names the host setting for the bound a stream cut hit, read from the opening
61
- * of membrane 0.8.0's message for it (its progress-bounds.ts and
59
+ * of membrane 0.8.0's and 0.9.0's message for it (their progress-bounds.ts and
62
60
  * providers/utils.ts), so the reason an operator and the agent see names the
63
61
  * host's setting for that bound, as the README's table maps them. A message it
64
62
  * doesn't know is left as it is.
@@ -71,6 +69,7 @@ export function withHostSetting(message) {
71
69
  : undefined;
72
70
  return setting === undefined ? message : `${message} (the host's setting for this bound: \`inferenceBounds.${setting}\`)`;
73
71
  }
72
+ const CUTS = new WeakSet();
74
73
  export function deadlineCut(message) {
75
74
  const error = new MembraneError({
76
75
  type: 'timeout',
@@ -79,6 +78,10 @@ export function deadlineCut(message) {
79
78
  rawError: undefined,
80
79
  });
81
80
  Object.defineProperty(error, DEADLINE_EXPIRY, { value: true });
81
+ CUTS.add(error);
82
82
  return error;
83
83
  }
84
+ export function isDeadlineCut(error) {
85
+ return typeof error === 'object' && error !== null && CUTS.has(error);
86
+ }
84
87
  //# sourceMappingURL=inference-bounds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"inference-bounds.js","sourceRoot":"","sources":["../../src/inference-bounds.ts"],"names":[],"mappings":"AAAA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Q,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * A JSON-RPC 2.0 message's envelope, read once where a message arrives, by
3
+ * each of the framework's endpoints that answers requests: the MCPL
4
+ * connection, for its servers' requests, and the MCP server
5
+ * (src/api/mcp-server-core.ts), for its client's.
6
+ *
7
+ * A message with an id member and no method is a response, whatever the
8
+ * id's value: a peer answers a request it couldn't read with id null (§5),
9
+ * and taking that answer for a request would answer it in turn. So is an
10
+ * error with no id, which MCP lets a peer send for a request it couldn't
11
+ * read (MCP 2025-11-25, Basic, Error Responses), but only from a message
12
+ * whose jsonrpc member is "2.0": a peer's own JSON log lines, which an MCPL
13
+ * server's stdout can carry, can have an error key. Any other object with
14
+ * neither a method nor an id isn't JSON-RPC: the MCP server answers it
15
+ * -32600 with id null, as it does a value that isn't an object, and the MCPL
16
+ * connection, whose server's stdout carries other output, ignores it. A
17
+ * message with a method is a request when it has an id member, whatever its
18
+ * value, and a notification when it has none (§4.1), so `"id": null` is a
19
+ * request. MCP says a request's id MUST NOT be null (2025-11-25, Basic); one
20
+ * is served anyway, as JSON-RPC allows, since its sender waits for the
21
+ * answer. A request's method must be a string and its id a string, a number
22
+ * or null (§4). A message that breaks either isn't a Request object, and so
23
+ * isn't a notification either, with or without an id: the endpoints answer
24
+ * it once with -32600, carrying its id where that's a string or a number and
25
+ * null otherwise (§5, and the spec's own example of an invalid Request
26
+ * object, which has no id), and don't dispatch it. The MCPL handshake, which
27
+ * answers only pings, ignores it, as it ignores every other request then.
28
+ * Apart from the error with no id, the `jsonrpc` member isn't checked: a
29
+ * peer that leaves it out is served, as before.
30
+ */
31
+ /** A JSON value's kind, as a log line or an error names what a peer sent
32
+ * without repeating it: "null", "an array", "an object", "a number". */
33
+ export declare function jsonKind(value: unknown): string;
34
+ export type JsonRpcEnvelope =
35
+ /** An id member and no method, or a JSON-RPC 2.0 error with neither: an
36
+ * answer, which the endpoint matches to one of its own requests by the
37
+ * id where it can. */
38
+ {
39
+ kind: 'response';
40
+ }
41
+ /** Neither a method nor an id member, and not such an error: not a
42
+ * JSON-RPC message. */
43
+ | {
44
+ kind: 'neither';
45
+ } | {
46
+ kind: 'request';
47
+ method: string;
48
+ id: string | number | null;
49
+ } | {
50
+ kind: 'notification';
51
+ method: string;
52
+ }
53
+ /** Not a Request object, with or without an id: answered with `error`,
54
+ * carrying `id`, and not dispatched. `method` is its method where that's
55
+ * a string, for a log line. */
56
+ | {
57
+ kind: 'invalid';
58
+ id: string | number | null;
59
+ error: {
60
+ code: -32600;
61
+ message: string;
62
+ };
63
+ method?: string;
64
+ problems: string;
65
+ };
66
+ /** Read a parsed message's envelope. What to do with a value that isn't an
67
+ * object is the endpoint's own call. */
68
+ export declare function readEnvelope(msg: Record<string, unknown>): JsonRpcEnvelope;
69
+ //# sourceMappingURL=jsonrpc-envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonrpc-envelope.d.ts","sourceRoot":"","sources":["../../src/jsonrpc-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;yEACyE;AACzE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI/C;AAED,MAAM,MAAM,eAAe;AACzB;;uBAEuB;AACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE;AACtB;wBACwB;GACtB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAC1C;;gCAEgC;GAC9B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE;QAAE,IAAI,EAAE,CAAC,KAAK,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjI;yCACyC;AACzC,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAwB1E"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * A JSON-RPC 2.0 message's envelope, read once where a message arrives, by
3
+ * each of the framework's endpoints that answers requests: the MCPL
4
+ * connection, for its servers' requests, and the MCP server
5
+ * (src/api/mcp-server-core.ts), for its client's.
6
+ *
7
+ * A message with an id member and no method is a response, whatever the
8
+ * id's value: a peer answers a request it couldn't read with id null (§5),
9
+ * and taking that answer for a request would answer it in turn. So is an
10
+ * error with no id, which MCP lets a peer send for a request it couldn't
11
+ * read (MCP 2025-11-25, Basic, Error Responses), but only from a message
12
+ * whose jsonrpc member is "2.0": a peer's own JSON log lines, which an MCPL
13
+ * server's stdout can carry, can have an error key. Any other object with
14
+ * neither a method nor an id isn't JSON-RPC: the MCP server answers it
15
+ * -32600 with id null, as it does a value that isn't an object, and the MCPL
16
+ * connection, whose server's stdout carries other output, ignores it. A
17
+ * message with a method is a request when it has an id member, whatever its
18
+ * value, and a notification when it has none (§4.1), so `"id": null` is a
19
+ * request. MCP says a request's id MUST NOT be null (2025-11-25, Basic); one
20
+ * is served anyway, as JSON-RPC allows, since its sender waits for the
21
+ * answer. A request's method must be a string and its id a string, a number
22
+ * or null (§4). A message that breaks either isn't a Request object, and so
23
+ * isn't a notification either, with or without an id: the endpoints answer
24
+ * it once with -32600, carrying its id where that's a string or a number and
25
+ * null otherwise (§5, and the spec's own example of an invalid Request
26
+ * object, which has no id), and don't dispatch it. The MCPL handshake, which
27
+ * answers only pings, ignores it, as it ignores every other request then.
28
+ * Apart from the error with no id, the `jsonrpc` member isn't checked: a
29
+ * peer that leaves it out is served, as before.
30
+ */
31
+ /** A JSON value's kind, as a log line or an error names what a peer sent
32
+ * without repeating it: "null", "an array", "an object", "a number". */
33
+ export function jsonKind(value) {
34
+ if (value === null)
35
+ return 'null';
36
+ const kind = Array.isArray(value) ? 'array' : typeof value;
37
+ return `${/^[aeiou]/.test(kind) ? 'an' : 'a'} ${kind}`;
38
+ }
39
+ /** Read a parsed message's envelope. What to do with a value that isn't an
40
+ * object is the endpoint's own call. */
41
+ export function readEnvelope(msg) {
42
+ if (!Object.hasOwn(msg, 'method')) {
43
+ const answers = Object.hasOwn(msg, 'id') || (msg.jsonrpc === '2.0' && Object.hasOwn(msg, 'error'));
44
+ return { kind: answers ? 'response' : 'neither' };
45
+ }
46
+ const isRequest = Object.hasOwn(msg, 'id');
47
+ const { method, id } = msg;
48
+ const problems = [
49
+ ...(typeof method === 'string' ? [] : [`the method must be a string, not ${jsonKind(method)}`]),
50
+ ...(!isRequest || typeof id === 'string' || typeof id === 'number' || id === null
51
+ ? [] : [`the id must be a string, a number or null, not ${jsonKind(id)}`]),
52
+ ].join('; ');
53
+ if (problems) {
54
+ return {
55
+ kind: 'invalid',
56
+ id: typeof id === 'string' || typeof id === 'number' ? id : null,
57
+ error: { code: -32600, message: `Invalid Request: ${problems}` },
58
+ ...(typeof method === 'string' ? { method } : {}),
59
+ problems,
60
+ };
61
+ }
62
+ return isRequest
63
+ ? { kind: 'request', method: method, id: id }
64
+ : { kind: 'notification', method: method };
65
+ }
66
+ //# sourceMappingURL=jsonrpc-envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonrpc-envelope.js","sourceRoot":"","sources":["../../src/jsonrpc-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;yEACyE;AACzE,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,IAAI;QA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