@claude-flow/cli 3.32.26 → 3.32.30

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 (403) hide show
  1. package/.claude/helpers/.helpers-version +1 -1
  2. package/.claude/helpers/helpers.manifest.json +2 -2
  3. package/catalog-manifest.json +4 -4
  4. package/dist/src/commands/index.d.ts +1 -0
  5. package/dist/src/commands/index.js +5 -3
  6. package/dist/src/commands/memory.js +49 -5
  7. package/dist/src/commands/metaharness.js +25 -5
  8. package/dist/src/commands/policy.d.ts +4 -0
  9. package/dist/src/commands/policy.js +107 -0
  10. package/dist/src/index.js +18 -0
  11. package/dist/src/init/claudemd-generator.js +53 -2
  12. package/dist/src/mcp-client.js +25 -1
  13. package/dist/src/mcp-tools/capability-brain.d.ts +134 -0
  14. package/dist/src/mcp-tools/capability-brain.js +697 -0
  15. package/dist/src/mcp-tools/guidance-tools.d.ts +2 -0
  16. package/dist/src/mcp-tools/guidance-tools.js +369 -37
  17. package/dist/src/mcp-tools/index.d.ts +4 -1
  18. package/dist/src/mcp-tools/index.js +3 -1
  19. package/dist/src/mcp-tools/memory-tools.js +26 -0
  20. package/dist/src/mcp-tools/metaharness-tools.js +27 -1
  21. package/dist/src/mcp-tools/policy-tools.d.ts +3 -0
  22. package/dist/src/mcp-tools/policy-tools.js +121 -0
  23. package/dist/src/memory/memory-bridge.d.ts +11 -0
  24. package/dist/src/memory/memory-bridge.js +100 -21
  25. package/dist/src/memory/memory-initializer.d.ts +22 -1
  26. package/dist/src/memory/memory-initializer.js +184 -39
  27. package/dist/src/services/bounded-worker-pool.d.ts +28 -0
  28. package/dist/src/services/bounded-worker-pool.js +90 -0
  29. package/dist/src/services/harness-flywheel-runtime.d.ts +2 -0
  30. package/dist/src/services/harness-flywheel-runtime.js +18 -0
  31. package/dist/src/services/harness-flywheel.d.ts +4 -1
  32. package/dist/src/services/harness-flywheel.js +27 -6
  33. package/dist/src/services/policy-runtime.d.ts +38 -0
  34. package/dist/src/services/policy-runtime.js +340 -0
  35. package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
  36. package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
  37. package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
  38. package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
  39. package/node_modules/@claude-flow/codex/README.md +1044 -0
  40. package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
  41. package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
  42. package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
  43. package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
  44. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
  45. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
  46. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
  47. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
  48. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
  49. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
  50. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
  51. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
  52. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
  53. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
  54. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
  55. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
  56. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
  57. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
  58. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
  59. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
  60. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
  61. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
  62. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
  63. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
  64. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
  65. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
  66. package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
  67. package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
  68. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
  69. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
  70. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
  71. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
  72. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
  73. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
  74. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
  75. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
  76. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
  77. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
  78. package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
  79. package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
  80. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
  81. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
  82. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
  83. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
  84. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
  85. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
  86. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
  87. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
  88. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
  89. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
  90. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
  91. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
  92. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
  93. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
  94. package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
  95. package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
  96. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
  97. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
  98. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
  99. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
  100. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
  101. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
  102. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
  103. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
  104. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
  105. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
  106. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
  107. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
  108. package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
  109. package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
  110. package/node_modules/@claude-flow/codex/dist/index.js +54 -0
  111. package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
  112. package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
  113. package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
  114. package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
  115. package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
  116. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
  117. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
  118. package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
  119. package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
  120. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
  121. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
  122. package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
  123. package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
  124. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
  125. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
  126. package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
  127. package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
  128. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
  129. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
  130. package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
  131. package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
  132. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
  133. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
  134. package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
  135. package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
  136. package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
  137. package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
  138. package/node_modules/@claude-flow/codex/dist/types.js +8 -0
  139. package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
  140. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
  141. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
  142. package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
  143. package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
  144. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
  145. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
  146. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
  147. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
  148. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
  149. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
  150. package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
  151. package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
  152. package/node_modules/@claude-flow/codex/package.json +122 -0
  153. package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
  154. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
  155. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
  156. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
  157. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
  158. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
  159. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
  160. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
  161. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
  162. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
  163. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
  164. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
  165. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
  166. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
  167. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
  168. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
  169. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
  170. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
  171. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
  172. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
  173. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
  174. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
  175. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
  176. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
  177. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
  178. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
  179. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
  180. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
  181. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
  182. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
  183. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
  184. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
  185. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
  186. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
  187. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
  188. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
  189. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
  190. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
  191. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
  192. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
  193. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
  194. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
  195. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
  196. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
  197. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
  198. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
  199. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
  200. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
  201. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
  202. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
  203. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
  204. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
  205. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
  206. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
  207. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
  208. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
  209. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
  210. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
  211. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
  212. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
  213. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
  214. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
  215. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
  216. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
  217. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
  218. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
  219. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
  220. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
  221. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
  222. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
  223. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
  224. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
  225. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
  226. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
  227. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
  228. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
  229. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
  230. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
  231. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
  232. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
  233. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
  234. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
  235. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
  236. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
  237. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
  238. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
  239. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
  240. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
  241. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
  242. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
  243. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
  244. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
  245. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
  246. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
  247. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
  248. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
  249. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
  250. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
  251. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
  252. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
  253. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
  254. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
  255. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
  256. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
  257. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
  258. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
  259. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
  260. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
  261. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
  262. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
  263. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
  264. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
  265. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
  266. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
  267. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
  268. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
  269. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
  270. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
  271. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
  272. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
  273. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
  274. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
  275. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
  276. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
  277. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
  278. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
  279. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
  280. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
  281. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
  282. package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
  283. package/node_modules/@claude-flow/security/README.md +292 -0
  284. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
  285. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
  286. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
  287. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
  288. package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
  289. package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
  290. package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
  291. package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
  292. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
  293. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
  294. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
  295. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
  296. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
  297. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
  298. package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
  299. package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
  300. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
  301. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
  302. package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
  303. package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
  304. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
  305. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
  306. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
  307. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
  308. package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
  309. package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
  310. package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
  311. package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
  312. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
  313. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
  314. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
  315. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
  316. package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
  317. package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
  318. package/node_modules/@claude-flow/security/dist/index.js +176 -0
  319. package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
  320. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
  321. package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
  322. package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
  323. package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
  324. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
  325. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
  326. package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
  327. package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
  328. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
  329. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
  330. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
  331. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
  332. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
  333. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
  334. package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
  335. package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
  336. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
  337. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
  338. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
  339. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
  340. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
  341. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
  342. package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
  343. package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
  344. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
  345. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
  346. package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
  347. package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
  348. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
  349. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
  350. package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
  351. package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
  352. package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
  353. package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
  354. package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
  355. package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
  356. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
  357. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
  358. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
  359. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
  360. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
  361. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
  362. package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
  363. package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
  364. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
  365. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
  366. package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
  367. package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
  368. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
  369. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
  370. package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
  371. package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
  372. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
  373. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
  374. package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
  375. package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
  376. package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
  377. package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
  378. package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
  379. package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
  380. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
  381. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
  382. package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
  383. package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
  384. package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
  385. package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
  386. package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
  387. package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
  388. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
  389. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
  390. package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
  391. package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
  392. package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
  393. package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
  394. package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
  395. package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
  396. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
  397. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
  398. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
  399. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
  400. package/node_modules/@claude-flow/security/package.json +44 -0
  401. package/package.json +44 -12
  402. package/plugins/ruflo-metaharness/scripts/smoke.sh +22 -14
  403. package/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs +3 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-coordinator.d.ts","sourceRoot":"","sources":["../../src/application/federation-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EA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AGG;IACH,kBAAkB,IAAI;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAcvG;;;;;;;OAOG;IACG,SAAS,CACb,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,gBAAiC,EACzC,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC;IA+BnB;;;;;;;;;;;;;;;;OAgBG;IACG,WAAW,CAAC,KAAK,EAAE;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;QAC1B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BjB;;;;;;;;;OASG;IACG,oBAAoB,CACxB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC;IAuB/C;;;;OAIG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA2B9E,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAI5D,iBAAiB,IAAI,iBAAiB,EAAE;YAI1B,gBAAgB;IA0B9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,iBAAiB;CAK1B"}
@@ -0,0 +1,501 @@
1
+ import { TrustLevel } from '../domain/entities/trust-level.js';
2
+ import { FederationNodeState, } from '../domain/value-objects/federation-node-state.js';
3
+ import { enforceBudget, validateBudget, } from '../domain/value-objects/federation-budget.js';
4
+ export class FederationCoordinator {
5
+ config;
6
+ discovery;
7
+ handshake;
8
+ routing;
9
+ audit;
10
+ piiPipeline;
11
+ trustEvaluator;
12
+ policyEngine;
13
+ sessions;
14
+ initialized;
15
+ spendReporter;
16
+ breakerService;
17
+ wgMesh;
18
+ wgCommandSink;
19
+ constructor(config, discovery, handshake, routing, audit, piiPipeline, trustEvaluator, policyEngine, integrations = {}) {
20
+ this.config = config;
21
+ this.discovery = discovery;
22
+ this.handshake = handshake;
23
+ this.routing = routing;
24
+ this.audit = audit;
25
+ this.piiPipeline = piiPipeline;
26
+ this.trustEvaluator = trustEvaluator;
27
+ this.policyEngine = policyEngine;
28
+ this.sessions = new Map();
29
+ this.initialized = false;
30
+ this.spendReporter = integrations.spendReporter;
31
+ this.breakerService = integrations.breakerService;
32
+ this.wgMesh = integrations.wgMesh;
33
+ this.wgCommandSink = integrations.wgCommandSink;
34
+ }
35
+ /**
36
+ * ADR-111 Phase 3 — emit a WG command for an audited peer transition.
37
+ * No-op if no wgMesh is configured or the peer lacks a `wg` manifest
38
+ * block. Commands flow to `wgCommandSink` (if any) and always to the
39
+ * audit log so reactivation is fully traceable.
40
+ */
41
+ async emitWgCommand(peer, builder) {
42
+ if (!this.wgMesh)
43
+ return;
44
+ const wgPubkey = peer.metadata.wgPublicKey;
45
+ const wgMeshIP = peer.metadata.wgMeshIP;
46
+ if (!wgPubkey || !wgMeshIP)
47
+ return;
48
+ const cmd = builder(wgPubkey, wgMeshIP);
49
+ if (!cmd)
50
+ return;
51
+ await this.audit.log('peer_manifest_published', {
52
+ targetNodeId: peer.nodeId,
53
+ metadata: {
54
+ wgCommand: cmd.cmd,
55
+ wgVerb: cmd.verb,
56
+ wgRationale: cmd.rationale,
57
+ },
58
+ });
59
+ if (this.wgCommandSink) {
60
+ await this.wgCommandSink(cmd);
61
+ }
62
+ }
63
+ async initialize(manifest) {
64
+ // The coordinator's keypair and runtime protocol configuration are
65
+ // authoritative. CLI/MCP callers may describe agent/compliance capacity,
66
+ // but cannot replace the identity created by the plugin.
67
+ await this.discovery.publishManifest({
68
+ ...manifest,
69
+ nodeId: this.config.nodeId,
70
+ publicKey: this.config.publicKey,
71
+ endpoint: this.config.endpoint,
72
+ capabilities: {
73
+ ...manifest.capabilities,
74
+ supportedProtocols: this.config.supportedProtocols ?? manifest.capabilities.supportedProtocols,
75
+ },
76
+ version: this.config.version ?? manifest.version,
77
+ });
78
+ this.discovery.startPeriodicDiscovery();
79
+ this.initialized = true;
80
+ await this.audit.log('peer_manifest_published', {
81
+ metadata: { endpoint: this.config.endpoint },
82
+ });
83
+ }
84
+ async shutdown() {
85
+ this.discovery.stopPeriodicDiscovery();
86
+ for (const [sessionId, session] of this.sessions) {
87
+ session.terminate();
88
+ await this.audit.log('session_terminated', {
89
+ sessionId,
90
+ targetNodeId: session.remoteNodeId,
91
+ });
92
+ }
93
+ this.sessions.clear();
94
+ await this.audit.flush();
95
+ this.initialized = false;
96
+ }
97
+ async joinPeer(endpoint, manifest) {
98
+ this.ensureInitialized();
99
+ const node = await this.discovery.addStaticPeer(endpoint, manifest);
100
+ await this.audit.log('peer_discovered', {
101
+ targetNodeId: node.nodeId,
102
+ metadata: { endpoint },
103
+ });
104
+ return this.establishSession(node, manifest !== undefined);
105
+ }
106
+ async leavePeer(nodeId) {
107
+ this.ensureInitialized();
108
+ const session = this.findSessionByNodeId(nodeId);
109
+ if (session) {
110
+ session.terminate();
111
+ this.sessions.delete(session.sessionId);
112
+ await this.audit.log('session_terminated', {
113
+ sessionId: session.sessionId,
114
+ targetNodeId: nodeId,
115
+ });
116
+ }
117
+ this.discovery.removePeer(nodeId);
118
+ }
119
+ async sendMessage(targetNodeId, messageType, payload, options = {}) {
120
+ this.ensureInitialized();
121
+ // ADR-097 Phase 2.b: outbound short-circuit on tripped breaker. If the
122
+ // peer is SUSPENDED or EVICTED we refuse the send before doing any work,
123
+ // and emit a constant-string error (no remaining-budget echo per the
124
+ // anti-oracle posture inherited from Phase 1). The check fires *before*
125
+ // session lookup so an evicted peer cannot consume cycles even on a
126
+ // dangling session reference.
127
+ const peer = this.discovery.getPeer(targetNodeId);
128
+ if (peer && !peer.isActive) {
129
+ const reason = peer.isEvicted ? 'PEER_EVICTED' : 'PEER_SUSPENDED';
130
+ await this.audit.log('message_rejected', {
131
+ targetNodeId,
132
+ metadata: { reason },
133
+ });
134
+ return {
135
+ success: false,
136
+ mode: 'direct',
137
+ envelopeId: '',
138
+ targetNodeIds: [targetNodeId],
139
+ error: reason,
140
+ };
141
+ }
142
+ const session = this.findSessionByNodeId(targetNodeId);
143
+ if (!session) {
144
+ return {
145
+ success: false,
146
+ mode: 'direct',
147
+ envelopeId: '',
148
+ targetNodeIds: [targetNodeId],
149
+ error: `No active session with node ${targetNodeId}`,
150
+ };
151
+ }
152
+ const policyResult = this.policyEngine.evaluateMessage(messageType, session.trustLevel, JSON.stringify(payload).length, this.config.nodeId);
153
+ if (!policyResult.allowed) {
154
+ await this.audit.log('message_rejected', {
155
+ targetNodeId,
156
+ sessionId: session.sessionId,
157
+ metadata: { reason: policyResult.reason },
158
+ });
159
+ return {
160
+ success: false,
161
+ mode: 'direct',
162
+ envelopeId: '',
163
+ targetNodeIds: [targetNodeId],
164
+ error: policyResult.reason,
165
+ };
166
+ }
167
+ // ADR-097 Phase 1: validate caller-supplied budget + enforce hop limit
168
+ // and cumulative spend BEFORE outbound dispatch. Synchronous & atomic —
169
+ // no awaits between validate and enforce, so concurrent sends cannot
170
+ // both pass a single-hop budget. Errors are constant strings so a
171
+ // malicious caller cannot use the response as a budget oracle.
172
+ const budgetResult = validateBudget(options.budget, options.maxHops);
173
+ if (!budgetResult.ok) {
174
+ await this.audit.log('message_rejected', {
175
+ targetNodeId,
176
+ sessionId: session.sessionId,
177
+ metadata: { reason: 'INVALID_BUDGET', detail: budgetResult.error },
178
+ });
179
+ return {
180
+ success: false,
181
+ mode: 'direct',
182
+ envelopeId: '',
183
+ targetNodeIds: [targetNodeId],
184
+ error: 'INVALID_BUDGET',
185
+ };
186
+ }
187
+ const enforcement = enforceBudget(budgetResult.budget, options.hopCount ?? 0, {
188
+ tokens: options.spent?.tokens ?? 0,
189
+ usd: options.spent?.usd ?? 0,
190
+ });
191
+ if (!enforcement.ok) {
192
+ await this.audit.log('message_rejected', {
193
+ targetNodeId,
194
+ sessionId: session.sessionId,
195
+ metadata: { reason: enforcement.reason },
196
+ });
197
+ return {
198
+ success: false,
199
+ mode: 'direct',
200
+ envelopeId: '',
201
+ targetNodeIds: [targetNodeId],
202
+ error: enforcement.reason, // constant string — no oracle leak
203
+ };
204
+ }
205
+ const result = await this.routing.send(session, messageType, payload);
206
+ await this.audit.log(result.success ? 'message_sent' : 'message_rejected', {
207
+ targetNodeId,
208
+ sessionId: session.sessionId,
209
+ latencyMs: result.latencyMs,
210
+ metadata: {
211
+ messageType,
212
+ mode: result.mode,
213
+ hopCount: enforcement.nextHopCount,
214
+ },
215
+ });
216
+ return result;
217
+ }
218
+ /**
219
+ * Re-export the budget primitives so external callers (e.g. follow-up
220
+ * iterations adding receive-side decrement) can reuse them without
221
+ * dipping into domain/value-objects directly.
222
+ */
223
+ static budget = { validate: validateBudget, enforce: enforceBudget };
224
+ async broadcastMessage(messageType, payload) {
225
+ this.ensureInitialized();
226
+ return this.routing.broadcast(messageType, payload);
227
+ }
228
+ handleThreatDetection(nodeId) {
229
+ const exceedsThreshold = this.trustEvaluator.recordThreatDetection(nodeId);
230
+ const node = this.discovery.getPeer(nodeId);
231
+ if (node && exceedsThreshold) {
232
+ this.trustEvaluator.downgrade(node, 'repeated-threat-detection');
233
+ const session = this.findSessionByNodeId(nodeId);
234
+ if (session) {
235
+ session.terminate();
236
+ this.sessions.delete(session.sessionId);
237
+ }
238
+ this.audit.log('threat_blocked', {
239
+ sourceNodeId: nodeId,
240
+ trustLevel: TrustLevel.UNTRUSTED,
241
+ threatDetected: true,
242
+ metadata: { reason: 'repeated-threat-detection' },
243
+ });
244
+ }
245
+ }
246
+ handleHmacFailure(nodeId) {
247
+ const node = this.discovery.getPeer(nodeId);
248
+ if (node) {
249
+ this.trustEvaluator.downgrade(node, 'hmac-verification-failure');
250
+ const session = this.findSessionByNodeId(nodeId);
251
+ if (session) {
252
+ session.terminate();
253
+ this.sessions.delete(session.sessionId);
254
+ }
255
+ this.audit.log('threat_blocked', {
256
+ sourceNodeId: nodeId,
257
+ trustLevel: TrustLevel.UNTRUSTED,
258
+ metadata: { reason: 'hmac-verification-failure' },
259
+ });
260
+ }
261
+ }
262
+ getStatus() {
263
+ const peers = this.discovery.listPeers();
264
+ const trustLevels = {};
265
+ for (const peer of peers) {
266
+ trustLevels[peer.nodeId] = peer.trustLevel;
267
+ }
268
+ return {
269
+ nodeId: this.config.nodeId,
270
+ activeSessions: Array.from(this.sessions.values()).filter(s => s.active).length,
271
+ knownPeers: peers.length,
272
+ trustLevels,
273
+ healthy: this.initialized,
274
+ };
275
+ }
276
+ /**
277
+ * ADR-097 Phase 4: per-peer breaker state snapshot for the doctor
278
+ * surface and `federation_breaker_status` MCP tool.
279
+ *
280
+ * Returns one entry per known peer with the entity's stateRecord —
281
+ * what state, when it changed, why, and which caller's correlation
282
+ * key triggered it. Pure read; does not mutate.
283
+ */
284
+ getPeerStates() {
285
+ return this.discovery.listPeers().map((peer) => ({
286
+ nodeId: peer.nodeId,
287
+ ...peer.stateRecord,
288
+ }));
289
+ }
290
+ /**
291
+ * ADR-111 Phase 6: public read of the discovery peer list. Used by
292
+ * federation_wg_status MCP tool + WG firewall projection. Returns the
293
+ * full known-peer set (active + suspended + evicted) — filter via
294
+ * .isActive / state if you only want the live mesh members.
295
+ */
296
+ listPeers() {
297
+ return this.discovery.listPeers();
298
+ }
299
+ /**
300
+ * Aggregated counts for the doctor surface — `{ active: N, suspended: M,
301
+ * evicted: K }`. Cheap O(peers) sweep; safe to call from a status line.
302
+ */
303
+ getPeerStateCounts() {
304
+ let active = 0;
305
+ let suspended = 0;
306
+ let evicted = 0;
307
+ for (const peer of this.discovery.listPeers()) {
308
+ switch (peer.state) {
309
+ case FederationNodeState.ACTIVE:
310
+ active++;
311
+ break;
312
+ case FederationNodeState.SUSPENDED:
313
+ suspended++;
314
+ break;
315
+ case FederationNodeState.EVICTED:
316
+ evicted++;
317
+ break;
318
+ }
319
+ }
320
+ return { active, suspended, evicted };
321
+ }
322
+ /**
323
+ * Operator-initiated evict. Returns true on transition, false if the
324
+ * peer was already EVICTED or unknown. Logs to audit either way.
325
+ *
326
+ * Does NOT remove the peer from the discovery registry — `leavePeer`
327
+ * is the registry-removal API. Eviction is the breaker layer; the peer
328
+ * remains queryable so the operator can later reactivate.
329
+ */
330
+ async evictPeer(nodeId, reason = 'MANUAL_EVICT', correlationId) {
331
+ this.ensureInitialized();
332
+ const peer = this.discovery.getPeer(nodeId);
333
+ if (!peer)
334
+ return false;
335
+ const ok = peer.evict({ reason, correlationId });
336
+ await this.audit.log('threat_blocked', {
337
+ targetNodeId: nodeId,
338
+ metadata: {
339
+ reason,
340
+ correlationId: correlationId ?? null,
341
+ state: peer.state,
342
+ applied: ok,
343
+ },
344
+ });
345
+ if (ok) {
346
+ const session = this.findSessionByNodeId(nodeId);
347
+ if (session) {
348
+ session.terminate();
349
+ this.sessions.delete(session.sessionId);
350
+ }
351
+ // ADR-111 Phase 3 — propagate eviction to the WG mesh. No-op if the
352
+ // peer never published a wg block; otherwise drops the peer from the
353
+ // mesh runtime (config rebuild will also exclude it).
354
+ await this.emitWgCommand(peer, (pubkey) => this.wgMesh.removePeer(peer, pubkey, reason));
355
+ }
356
+ return ok;
357
+ }
358
+ /**
359
+ * ADR-097 Phase 3 upstream: report the actual cost of a federated
360
+ * call. Federation doesn't own model pricing, so the integrator calls
361
+ * this after the downstream agent completes.
362
+ *
363
+ * Fans out to:
364
+ * - spendReporter (if injected) — persists to integrator's backend
365
+ * - breakerService.recordOutcome (if injected) — feeds the breaker's
366
+ * in-memory rolling buffer for cost/failure-ratio thresholds
367
+ *
368
+ * Both are no-ops if the corresponding integration isn't wired, so
369
+ * callers don't need to branch on configuration. Negative tokens/usd
370
+ * are clamped to 0 at the breaker layer (anti-credit-inflation); the
371
+ * spend reporter receives the raw values so backends can audit them.
372
+ *
373
+ * Auto-fills `ts` if the caller omits it.
374
+ */
375
+ async reportSpend(input) {
376
+ const event = {
377
+ peerId: input.peerId,
378
+ taskId: input.taskId,
379
+ tokensUsed: input.tokensUsed,
380
+ usdSpent: input.usdSpent,
381
+ success: input.success,
382
+ ts: input.ts ?? new Date().toISOString(),
383
+ };
384
+ // Fan out in parallel — neither side blocks the other. Reporter
385
+ // failures bubble up (integrator's responsibility); breaker is
386
+ // sync-internally so its branch is fire-and-forget safe.
387
+ const tasks = [];
388
+ if (this.spendReporter) {
389
+ tasks.push(this.spendReporter.reportSpend(event));
390
+ }
391
+ if (this.breakerService) {
392
+ this.breakerService.recordOutcome({
393
+ nodeId: event.peerId,
394
+ success: event.success,
395
+ tokensUsed: event.tokensUsed,
396
+ usdSpent: event.usdSpent,
397
+ at: new Date(event.ts),
398
+ });
399
+ }
400
+ if (tasks.length > 0)
401
+ await Promise.all(tasks);
402
+ }
403
+ /**
404
+ * Founder-bootstrap trust elevation (ADR-164 §3.5.4 — operator escape hatch
405
+ * used in the autopilot Day-1 scenario where a freshly-joined BBS peer
406
+ * needs TRUSTED before organic minInteractions thresholds can accrue).
407
+ *
408
+ * Refuses if the target node is not a registered federation peer (returns
409
+ * null). On success, writes a `trust_level_changed` audit entry tagged
410
+ * `bootstrap_elevation` with the operator-supplied reason, and returns
411
+ * the audit entry so the CLI / caller can print it to stdout.
412
+ */
413
+ async bootstrapElevatePeer(nodeId, newLevel, reason) {
414
+ this.ensureInitialized();
415
+ const peer = this.discovery.getPeer(nodeId);
416
+ if (!peer)
417
+ return null;
418
+ const entry = this.trustEvaluator.bootstrapElevate(peer, newLevel, reason);
419
+ await this.audit.log('trust_level_changed', {
420
+ targetNodeId: nodeId,
421
+ trustLevel: newLevel,
422
+ metadata: {
423
+ tag: 'bootstrap_elevation',
424
+ previousLevel: entry.previousLevel,
425
+ newLevel: entry.newLevel,
426
+ reason: entry.reason,
427
+ operatorBypass: true,
428
+ timestamp: entry.timestamp,
429
+ },
430
+ });
431
+ return entry;
432
+ }
433
+ /**
434
+ * Operator-initiated reactivate. Used after an integrator-supplied
435
+ * health probe confirms a SUSPENDED peer is healthy, OR as an
436
+ * operator-override escape from EVICTED. Returns true on transition.
437
+ */
438
+ async reactivatePeer(nodeId, correlationId) {
439
+ this.ensureInitialized();
440
+ const peer = this.discovery.getPeer(nodeId);
441
+ if (!peer)
442
+ return false;
443
+ const ok = peer.reactivate(correlationId);
444
+ await this.audit.log('trust_level_changed', {
445
+ targetNodeId: nodeId,
446
+ metadata: {
447
+ action: 'reactivate',
448
+ correlationId: correlationId ?? null,
449
+ state: peer.state,
450
+ applied: ok,
451
+ },
452
+ });
453
+ if (ok) {
454
+ // ADR-111 Phase 3 — restore the WG AllowedIPs slice the peer had
455
+ // before suspension. removePeer-then-reactivate stays evicted at the
456
+ // mesh layer because removePeer marks the peer terminally evicted;
457
+ // the operator must reconfigure manually for an evicted peer to rejoin.
458
+ await this.emitWgCommand(peer, (pubkey, meshIP) => this.wgMesh.restoreAllowedIPs(peer, meshIP, pubkey));
459
+ }
460
+ return ok;
461
+ }
462
+ getSession(sessionId) {
463
+ return this.sessions.get(sessionId);
464
+ }
465
+ getActiveSessions() {
466
+ return Array.from(this.sessions.values()).filter(s => s.active && !s.isExpired());
467
+ }
468
+ async establishSession(node, verifiedManifest) {
469
+ const session = this.handshake.establishDiscoverySession(node, verifiedManifest);
470
+ this.sessions.set(session.sessionId, session);
471
+ await this.audit.log('handshake_completed', {
472
+ targetNodeId: node.nodeId,
473
+ sessionId: session.sessionId,
474
+ trustLevel: session.trustLevel,
475
+ metadata: {
476
+ mode: verifiedManifest ? 'verified-manifest' : 'endpoint-only',
477
+ liveChallengeAuthenticated: false,
478
+ },
479
+ });
480
+ await this.audit.log('session_created', {
481
+ sessionId: session.sessionId,
482
+ targetNodeId: node.nodeId,
483
+ trustLevel: session.trustLevel,
484
+ });
485
+ return session;
486
+ }
487
+ findSessionByNodeId(nodeId) {
488
+ for (const session of this.sessions.values()) {
489
+ if (session.remoteNodeId === nodeId && session.active) {
490
+ return session;
491
+ }
492
+ }
493
+ return undefined;
494
+ }
495
+ ensureInitialized() {
496
+ if (!this.initialized) {
497
+ throw new Error('FederationCoordinator is not initialized. Call initialize() first.');
498
+ }
499
+ }
500
+ }
501
+ //# sourceMappingURL=federation-coordinator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-coordinator.js","sourceRoot":"","sources":["../../src/application/federation-coordinator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EACL,mBAAmB,GAEpB,MAAM,kDAAkD,CAAC;AAQ1D,OAAO,EAGL,aAAa,EACb,cAAc,GACf,MAAM,8CAA8C,CAAC;AA2EtD,MAAM,OAAO,qBAAqB;IACf,MAAM,CAA8B;IACpC,SAAS,CAAmB;IAC5B,SAAS,CAAmB;IAC5B,OAAO,CAAiB;IACxB,KAAK,CAAe;IACpB,WAAW,CAAqB;IAChC,cAAc,CAAiB;IAC/B,YAAY,CAAe;IAC3B,QAAQ,CAAiC;IAClD,WAAW,CAAU;IACZ,aAAa,CAAiB;IAC9B,cAAc,CAA4B;IAC1C,MAAM,CAAiB;IACvB,aAAa,CAA4C;IAE1E,YACE,MAAmC,EACnC,SAA2B,EAC3B,SAA2B,EAC3B,OAAuB,EACvB,KAAmB,EACnB,WAA+B,EAC/B,cAA8B,EAC9B,YAA0B,EAC1B,eAAkD,EAAE;QAEpD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,G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,YAAY,EAAE,IAAI,CAAC,MAAM;YACzB,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,mBAAmB,CAAC,MAAc;QACxC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,IAAI,OAAO,CAAC,YAAY,KAAK,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACtD,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;QACxF,CAAC;IACH,CAAC"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Inbound message dispatcher (ADR-109).
3
+ *
4
+ * The federation plugin's `transport.listen()` accepts inbound bytes
5
+ * but until this module landed, the bytes had no consumer — they sat
6
+ * in the transport's per-address message queue with no one polling.
7
+ *
8
+ * `dispatchInbound()` is what the plugin registers as the
9
+ * transport.onMessage handler. For each received message it:
10
+ *
11
+ * 1. Resolves the sender via `sourceNodeId` in metadata
12
+ * 2. Verifies the peer is in the discovery registry (unknown → reject)
13
+ * 3. Verifies peer is ACTIVE (SUSPENDED/EVICTED → reject defense-in-depth)
14
+ * 4. Audits success or rejection
15
+ * 5. Emits a typed event on the eventBus for the integrator to handle
16
+ *
17
+ * Anti-coupling: dispatcher does NOT actually execute inbound tasks.
18
+ * That's the integrator's job. The dispatcher's contract is "deliver
19
+ * an envelope to the integrator's handler IFF it passes safety gates."
20
+ */
21
+ import type { AgentMessage } from '../transport/midstream-aware-loader.js';
22
+ import type { DiscoveryService } from '../domain/services/discovery-service.js';
23
+ import type { AuditService } from '../domain/services/audit-service.js';
24
+ import type { FederationNode } from '../domain/entities/federation-node.js';
25
+ /** What gets emitted on the event bus per messageType. */
26
+ export declare const FEDERATION_INBOUND_EVENT_PREFIX = "federation:inbound";
27
+ /** Reasons we reject an inbound message — constant strings, no oracle leak. */
28
+ export type InboundRejectionReason = 'PEER_UNKNOWN' | 'PEER_SUSPENDED' | 'PEER_EVICTED' | 'MISSING_METADATA' | 'INVALID_PAYLOAD' | 'INVALID_SIGNATURE' | 'LEGACY_SIGNATURE_TYPE_REJECTED' | 'AUTHORIZATION_DENIED' | 'AUTHORIZATION_ERROR';
29
+ /**
30
+ * Verifier function for inbound envelopes. Given the canonical bytes of
31
+ * the message + the claimed signature + the peer's published public
32
+ * key, returns true iff the signature is valid. Plugin wires this with
33
+ * `@noble/ed25519`; tests inject a mock.
34
+ *
35
+ * Returning `null` means "no signature provided" — handled by the
36
+ * dispatcher as INVALID_SIGNATURE (defense: unsigned messages from
37
+ * known peers are still rejected).
38
+ */
39
+ export type EnvelopeVerifier = (canonicalBytes: string, signatureHex: string | null, peerPublicKeyHex: string) => boolean;
40
+ export declare const JCS_SIGNATURE_PROTOCOL: "ruflo-signature-jcs-v1";
41
+ export type EnvelopeSignatureVersion = 'legacy-v1' | 'jcs-v1';
42
+ export type EnvelopeSignatureMode = 'legacy' | 'prefer-jcs' | 'require-jcs';
43
+ /**
44
+ * Updated peers advertise and negotiate recursively complete JCS signatures
45
+ * without operator configuration. Legacy mode remains explicit for low-risk
46
+ * heartbeat/status interoperability only.
47
+ */
48
+ export declare const DEFAULT_ENVELOPE_SIGNATURE_MODE: EnvelopeSignatureMode;
49
+ export type InboundAuthorizationMode = 'legacy' | 'observe' | 'enforce';
50
+ export declare function isLegacyEnvelopeTypeAllowed(messageType: string): boolean;
51
+ export interface InboundAuthorizationRequest {
52
+ readonly address: string;
53
+ readonly sourceNodeId: string;
54
+ readonly messageType: string;
55
+ readonly message: AgentMessage;
56
+ readonly peer: FederationNode;
57
+ readonly signatureVersion: EnvelopeSignatureVersion;
58
+ readonly messageSizeBytes: number;
59
+ }
60
+ export interface InboundAuthorizationDecision {
61
+ readonly allowed: boolean;
62
+ readonly reason?: string;
63
+ }
64
+ export type InboundAuthorizationEvaluator = (request: InboundAuthorizationRequest) => InboundAuthorizationDecision | Promise<InboundAuthorizationDecision>;
65
+ /** Dispatch dependencies (kept narrow for testability). */
66
+ export interface InboundDispatchDeps {
67
+ readonly discovery: Pick<DiscoveryService, 'getPeer'>;
68
+ readonly audit: Pick<AuditService, 'log'>;
69
+ readonly eventBus: {
70
+ emit: (event: string, data: unknown) => void;
71
+ };
72
+ readonly logger: {
73
+ debug: (m: string) => void;
74
+ warn: (m: string) => void;
75
+ };
76
+ /**
77
+ * Optional Ed25519 envelope verifier. When PROVIDED, every accepted
78
+ * message MUST pass verification — `null` signature or false-returning
79
+ * verifier rejects the message as INVALID_SIGNATURE.
80
+ *
81
+ * When OMITTED, the dispatcher operates in legacy "trust the metadata"
82
+ * mode (backward compat for tests that inject minimal deps). Production
83
+ * MUST inject this — see the plugin.ts wiring.
84
+ */
85
+ readonly verifyEnvelope?: EnvelopeVerifier;
86
+ /** Defaults to both versions; enforce-only deployments pass `['jcs-v1']`. */
87
+ readonly acceptedSignatureVersions?: readonly EnvelopeSignatureVersion[];
88
+ /** Compatibility mode defaults to legacy; enforce is fail-closed. */
89
+ readonly authorizationMode?: InboundAuthorizationMode;
90
+ /** Injected policy decision point. It is always called before event emission. */
91
+ readonly authorizeInbound?: InboundAuthorizationEvaluator;
92
+ }
93
+ export declare function selectEnvelopeSignatureVersion(mode: EnvelopeSignatureMode, peerProtocols: readonly string[], messageType?: string): EnvelopeSignatureVersion;
94
+ export declare function canonicalizeEnvelopeForVerify(message: AgentMessage, requestedVersion?: EnvelopeSignatureVersion): string;
95
+ /** Outcome reported to the caller (mostly for tests + observability). */
96
+ export type InboundDispatchOutcome = {
97
+ readonly accepted: true;
98
+ readonly sourceNodeId: string;
99
+ readonly messageType: string;
100
+ } | {
101
+ readonly accepted: false;
102
+ readonly reason: InboundRejectionReason;
103
+ };
104
+ /**
105
+ * Process one received message. Pure-ish: no side effects beyond audit
106
+ * + event emission, both injected.
107
+ *
108
+ * `address` is the wire-level remote (e.g. `192.168.1.42:54321`).
109
+ * `message.metadata.sourceNodeId` is the cryptographic identity claim.
110
+ * The two MAY differ (e.g. behind NAT) — we trust `sourceNodeId` for
111
+ * peer lookup since it's bound to the Ed25519 keypair.
112
+ */
113
+ export declare function dispatchInbound(address: string, message: AgentMessage, deps: InboundDispatchDeps): Promise<InboundDispatchOutcome>;
114
+ //# sourceMappingURL=inbound-dispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-dispatcher.d.ts","sourceRoot":"","sources":["../../src/application/inbound-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAG5E,0DAA0D;AAC1D,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;AAEpE,+EAA+E;AAC/E,MAAM,MAAM,sBAAsB,GAC9B,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,mBAAmB,GACnB,gCAAgC,GAChC,sBAAsB,GACtB,qBAAqB,CAAC;AAE1B;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,gBAAgB,EAAE,MAAM,KACrB,OAAO,CAAC;AAEb,eAAO,MAAM,sBAAsB,EAAG,wBAAiC,CAAC;AACxE,MAAM,MAAM,wBAAwB,GAAG,WAAW,GAAG,QAAQ,CAAC;AAC9D,MAAM,MAAM,qBAAqB,GAAG,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