@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,239 @@
1
+ /**
2
+ * A2A (Agent2Agent, Linux Foundation) Agent Card adapter — cards only.
3
+ *
4
+ * Maps ruflo's bespoke federation identity (`FederationManifest` /
5
+ * `FederationNode`) to and from a spec-compliant A2A Agent Card so ruflo
6
+ * nodes are discoverable by A2A peers and A2A peers appear in federation
7
+ * discovery. This is an ADAPTER over the existing federation schema, not a
8
+ * rewrite — A2A Tasks/messaging are deliberately out of scope.
9
+ *
10
+ * Spec: A2A Protocol 1.0.0 — https://a2a-protocol.org/latest/specification/
11
+ * (schema source of truth: specification/a2a.proto in a2aproject/A2A).
12
+ * Required AgentCard fields per spec §4.4.1: name, description,
13
+ * supportedInterfaces, version, capabilities, defaultInputModes,
14
+ * defaultOutputModes, skills.
15
+ */
16
+ import { FederationNode } from '../domain/entities/federation-node.js';
17
+ import { TrustLevel } from '../domain/entities/trust-level.js';
18
+ // ---------------------------------------------------------------------------
19
+ // Constants
20
+ // ---------------------------------------------------------------------------
21
+ /** A2A protocol version this adapter targets. */
22
+ export const A2A_PROTOCOL_VERSION = '1.0';
23
+ /**
24
+ * Well-known URI for Agent Card discovery (A2A 1.0 §8.2 + IANA registration
25
+ * §14). NOTE: earlier drafts used `/.well-known/agent.json`; 0.3.0+ settled
26
+ * on `agent-card.json`.
27
+ */
28
+ export const A2A_WELL_KNOWN_PATH = '/.well-known/agent-card.json';
29
+ /**
30
+ * Open-form protocol binding string advertising ruflo's federation wire
31
+ * (Ed25519-signed envelopes over WebSocket/QUIC). Spec §4.4.6 explicitly
32
+ * allows non-core bindings: "This is an open form string, to be easily
33
+ * extended for other protocol bindings."
34
+ */
35
+ export const RUFLO_FEDERATION_BINDING = 'RUFLO-FEDERATION';
36
+ /**
37
+ * Extension URI carrying the bespoke federation identity inside the card
38
+ * (spec §4.6 AgentExtension). Enables lossless round-trip in fromAgentCard.
39
+ */
40
+ export const RUFLO_FEDERATION_EXTENSION_URI = 'urn:ruflo:federation:manifest:v1';
41
+ /** Normalize a federation endpoint (ws://host:port, host:port, …) to a URL. */
42
+ function endpointToUrl(endpoint) {
43
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(endpoint))
44
+ return endpoint;
45
+ return `ws://${endpoint}`;
46
+ }
47
+ /**
48
+ * Generate a spec-compliant A2A Agent Card from a ruflo federation manifest.
49
+ * Every agent type becomes an AgentSkill; the federation endpoint becomes a
50
+ * `RUFLO-FEDERATION` interface; the bespoke identity (nodeId, publicKey,
51
+ * complianceModes, manifest signature) rides in a spec §4.6 extension so
52
+ * `fromAgentCard` can restore it.
53
+ */
54
+ export function toAgentCard(manifest, options = {}) {
55
+ const skills = manifest.capabilities.agentTypes.map((agentType) => ({
56
+ id: `agent-type:${agentType}`,
57
+ name: agentType,
58
+ description: `Federated ruflo agent role "${agentType}" — dispatchable via cross-installation federation sessions.`,
59
+ tags: ['ruflo', 'federation', 'agent-role', agentType],
60
+ }));
61
+ const interfaces = [
62
+ ...(options.additionalInterfaces ?? []),
63
+ {
64
+ url: endpointToUrl(manifest.endpoint),
65
+ protocolBinding: RUFLO_FEDERATION_BINDING,
66
+ protocolVersion: A2A_PROTOCOL_VERSION,
67
+ },
68
+ ];
69
+ const federationExtension = {
70
+ uri: RUFLO_FEDERATION_EXTENSION_URI,
71
+ description: 'ruflo cross-installation federation identity (Ed25519-signed manifest)',
72
+ required: false,
73
+ params: {
74
+ nodeId: manifest.nodeId,
75
+ publicKey: manifest.publicKey,
76
+ endpoint: manifest.endpoint,
77
+ maxConcurrentSessions: manifest.capabilities.maxConcurrentSessions,
78
+ supportedProtocols: [...manifest.capabilities.supportedProtocols],
79
+ complianceModes: [...manifest.capabilities.complianceModes],
80
+ manifestSignature: manifest.signature,
81
+ manifestTimestamp: manifest.timestamp,
82
+ },
83
+ };
84
+ return {
85
+ name: options.name ?? `ruflo-federation/${manifest.nodeId}`,
86
+ description: options.description ??
87
+ `Ruflo federation node ${manifest.nodeId} — zero-trust cross-installation agent federation ` +
88
+ `(${manifest.capabilities.agentTypes.length} agent role(s), PII-gated data flow, compliance-grade audit trail).`,
89
+ supportedInterfaces: interfaces,
90
+ version: manifest.version,
91
+ capabilities: {
92
+ streaming: false,
93
+ pushNotifications: false,
94
+ extendedAgentCard: false,
95
+ extensions: [federationExtension],
96
+ },
97
+ defaultInputModes: ['application/json', 'text/plain'],
98
+ defaultOutputModes: ['application/json', 'text/plain'],
99
+ skills,
100
+ ...(options.provider ? { provider: options.provider } : {}),
101
+ ...(options.documentationUrl ? { documentationUrl: options.documentationUrl } : {}),
102
+ };
103
+ }
104
+ /**
105
+ * Structural validation against the A2A 1.0 AgentCard REQUIRED fields.
106
+ * Intentionally strict on required shape, lenient on unknown extra fields
107
+ * (forward compatibility with future spec minors).
108
+ */
109
+ export function validateAgentCard(value) {
110
+ const errors = [];
111
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
112
+ return { valid: false, errors: ['card must be a JSON object'] };
113
+ }
114
+ const card = value;
115
+ const requireString = (field) => {
116
+ if (typeof card[field] !== 'string' || card[field].length === 0) {
117
+ errors.push(`missing or empty required string field: ${field}`);
118
+ }
119
+ };
120
+ requireString('name');
121
+ requireString('description');
122
+ requireString('version');
123
+ const interfaces = card['supportedInterfaces'];
124
+ if (!Array.isArray(interfaces) || interfaces.length === 0) {
125
+ errors.push('supportedInterfaces must be a non-empty array (spec 4.4.1)');
126
+ }
127
+ else {
128
+ interfaces.forEach((iface, i) => {
129
+ if (typeof iface !== 'object' || iface === null) {
130
+ errors.push(`supportedInterfaces[${i}] must be an object`);
131
+ return;
132
+ }
133
+ for (const f of ['url', 'protocolBinding', 'protocolVersion']) {
134
+ if (typeof iface[f] !== 'string' || !iface[f]) {
135
+ errors.push(`supportedInterfaces[${i}].${f} is required (spec 4.4.6)`);
136
+ }
137
+ }
138
+ });
139
+ }
140
+ if (typeof card['capabilities'] !== 'object' || card['capabilities'] === null || Array.isArray(card['capabilities'])) {
141
+ errors.push('capabilities must be an object (spec 4.4.1)');
142
+ }
143
+ for (const field of ['defaultInputModes', 'defaultOutputModes']) {
144
+ const v = card[field];
145
+ if (!Array.isArray(v) || v.length === 0 || !v.every((x) => typeof x === 'string')) {
146
+ errors.push(`${field} must be a non-empty array of media-type strings (spec 4.4.1)`);
147
+ }
148
+ }
149
+ const skills = card['skills'];
150
+ if (!Array.isArray(skills)) {
151
+ errors.push('skills must be an array (spec 4.4.1)');
152
+ }
153
+ else {
154
+ skills.forEach((skill, i) => {
155
+ if (typeof skill !== 'object' || skill === null) {
156
+ errors.push(`skills[${i}] must be an object`);
157
+ return;
158
+ }
159
+ const s = skill;
160
+ for (const f of ['id', 'name', 'description']) {
161
+ if (typeof s[f] !== 'string' || !s[f])
162
+ errors.push(`skills[${i}].${f} is required (spec 4.4.5)`);
163
+ }
164
+ if (!Array.isArray(s['tags']))
165
+ errors.push(`skills[${i}].tags is required (spec 4.4.5)`);
166
+ });
167
+ }
168
+ return { valid: errors.length === 0, errors };
169
+ }
170
+ // ---------------------------------------------------------------------------
171
+ // Consumption: A2A Agent Card → bespoke federation registry shape
172
+ // ---------------------------------------------------------------------------
173
+ /** Slugify a card name into a stable nodeId when no extension identity exists. */
174
+ function slugify(name) {
175
+ // Linear-time dash trim (no /^-+|-+$/ regex — that anchor+quantifier pattern
176
+ // is polynomial-time on adversarial all-dash input, flagged js/polynomial-redos).
177
+ const collapsed = name.toLowerCase().replace(/[^a-z0-9]+/g, '-');
178
+ let start = 0;
179
+ let end = collapsed.length;
180
+ while (start < end && collapsed.charCodeAt(start) === 45 /* '-' */)
181
+ start++;
182
+ while (end > start && collapsed.charCodeAt(end - 1) === 45 /* '-' */)
183
+ end--;
184
+ return collapsed.slice(start, end).slice(0, 64) || 'a2a-peer';
185
+ }
186
+ function findFederationExtension(card) {
187
+ return card.capabilities.extensions?.find((e) => e.uri === RUFLO_FEDERATION_EXTENSION_URI);
188
+ }
189
+ /**
190
+ * Map a validated remote A2A Agent Card into the bespoke federation registry
191
+ * shape (a `FederationNode`) so A2A peers appear in federation discovery.
192
+ *
193
+ * Trust posture: A2A cards are self-describing metadata, NOT authenticated
194
+ * federation manifests — consumed peers always enter at
195
+ * `TrustLevel.UNTRUSTED` regardless of embedded identity claims. Trust is
196
+ * earned afterwards through the normal handshake + TrustEvaluator path.
197
+ */
198
+ export function fromAgentCard(card, sourceUrl) {
199
+ const ext = findFederationExtension(card);
200
+ const params = (ext?.params ?? {});
201
+ const preferred = card.supportedInterfaces[0];
202
+ const federationIface = card.supportedInterfaces.find((i) => i.protocolBinding === RUFLO_FEDERATION_BINDING);
203
+ const endpoint = (typeof params['endpoint'] === 'string' && params['endpoint']) ||
204
+ federationIface?.url ||
205
+ preferred?.url ||
206
+ '';
207
+ const nodeId = (typeof params['nodeId'] === 'string' && params['nodeId']) || `a2a-${slugify(card.name)}`;
208
+ const agentTypes = card.skills.map((s) => s.id.startsWith('agent-type:') ? s.id.slice('agent-type:'.length) : s.id);
209
+ const supportedProtocols = Array.isArray(params['supportedProtocols'])
210
+ ? params['supportedProtocols']
211
+ : [...new Set(card.supportedInterfaces.map((i) => i.protocolBinding.toLowerCase()))];
212
+ return FederationNode.create({
213
+ nodeId,
214
+ publicKey: typeof params['publicKey'] === 'string' ? params['publicKey'] : '',
215
+ endpoint,
216
+ capabilities: {
217
+ agentTypes,
218
+ maxConcurrentSessions: typeof params['maxConcurrentSessions'] === 'number'
219
+ ? params['maxConcurrentSessions']
220
+ : 1,
221
+ supportedProtocols,
222
+ complianceModes: Array.isArray(params['complianceModes'])
223
+ ? params['complianceModes']
224
+ : [],
225
+ },
226
+ trustLevel: TrustLevel.UNTRUSTED,
227
+ metadata: {
228
+ discoveryMechanism: 'a2a-card',
229
+ version: card.version,
230
+ a2a: {
231
+ cardName: card.name,
232
+ protocolVersion: preferred?.protocolVersion ?? A2A_PROTOCOL_VERSION,
233
+ sourceUrl: sourceUrl ?? null,
234
+ skillCount: card.skills.length,
235
+ },
236
+ },
237
+ });
238
+ }
239
+ //# sourceMappingURL=agent-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-card.js","sourceRoot":"","sources":["../../src/a2a/agent-card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAG/D,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,iDAAiD;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAE1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,kCAAkC,CAAC;AA+EjF,+EAA+E;AAC/E,SAAS,aAAa,CAAC,QAAgB;IACrC,IAAI,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC/D,OAAO,QAAQ,QAAQ,EAAE,CAA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AAS,EAAE,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAM,CAAC,WAAW,CAAY,CAAC,CAAC,CAAC,EAAE;QACzF,QAAQ;QACR,YAAY,EAAE;YACZ,UAAU;YACV,qBAAqB,EACnB,OAAO,MAAM,CAAC,uBAAuB,CAAC,KAAK,QAAQ;gBACjD,CAAC,CAAE,MAAM,CAAC,uBAAuB,CAAY;gBAC7C,CAAC,CAAC,CAAC;YACP,kBAAkB;YAClB,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBACvD,CAAC,CAAE,MAAM,CAAC,iBAAiB,CAAc;gBACzC,CAAC,CAAC,EAAE;SACP;QACD,UAAU,EAAE,UAAU,CAAC,SAAS;QAChC,QAAQ,EAAE;YACR,kBAAkB,EAAE,UAAU;YAC9B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,EAAE;gBACH,QAAQ,EAAE,IAAI,CAAC,IAAI;gBACnB,eAAe,EAAE,SAAS,EAAE,eAAe,IAAI,oBAAoB;gBACnE,SAAS,EAAE,SAAS,IAAI,IAAI;gBAC5B,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;aAC/B;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * A2A Agent Card consumption — fetch + validate a remote card and map it
3
+ * into the bespoke federation registry so A2A peers appear in federation
4
+ * discovery. Cards only (no A2A Tasks/messaging in this iteration).
5
+ */
6
+ import type { DiscoveryService } from '../domain/services/discovery-service.js';
7
+ import type { FederationNode } from '../domain/entities/federation-node.js';
8
+ import { type A2AAgentCard } from './agent-card.js';
9
+ export interface FetchAgentCardOptions {
10
+ /** Injectable fetch for tests / restricted environments. Default: globalThis.fetch. */
11
+ readonly fetchImpl?: typeof fetch;
12
+ readonly timeoutMs?: number;
13
+ /** Response size cap in bytes (defense against decompression floods). Default 256 KiB. */
14
+ readonly maxBytes?: number;
15
+ }
16
+ export interface FetchAgentCardResult {
17
+ readonly card: A2AAgentCard;
18
+ readonly sourceUrl: string;
19
+ }
20
+ /**
21
+ * Resolve the card URL: a bare base URL (`https://host[:port]` or a path-less
22
+ * URL) gets the A2A well-known path appended; anything already pointing at a
23
+ * JSON document is used as-is.
24
+ */
25
+ export declare function resolveAgentCardUrl(baseOrCardUrl: string): string;
26
+ /** Fetch and structurally validate a remote A2A Agent Card. */
27
+ export declare function fetchAgentCard(baseOrCardUrl: string, options?: FetchAgentCardOptions): Promise<FetchAgentCardResult>;
28
+ /**
29
+ * Fetch a remote Agent Card and register the peer in federation discovery.
30
+ * The peer enters at TrustLevel.UNTRUSTED (see fromAgentCard) — the card is
31
+ * self-asserted metadata, and trust is earned through the normal handshake.
32
+ */
33
+ export declare function consumeAgentCard(discovery: DiscoveryService, baseOrCardUrl: string, options?: FetchAgentCardOptions): Promise<FederationNode>;
34
+ //# sourceMappingURL=consume.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consume.d.ts","sourceRoot":"","sources":["../../src/a2a/consume.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,qBAAqB;IACpC,uFAAuF;IACvF,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAMjE;AAED,+DAA+D;AAC/D,wBAAsB,cAAc,CAClC,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAyC/B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,gBAAgB,EAC3B,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,cAAc,CAAC,CAIzB"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * A2A Agent Card consumption — fetch + validate a remote card and map it
3
+ * into the bespoke federation registry so A2A peers appear in federation
4
+ * discovery. Cards only (no A2A Tasks/messaging in this iteration).
5
+ */
6
+ import { A2A_WELL_KNOWN_PATH, fromAgentCard, validateAgentCard, } from './agent-card.js';
7
+ /**
8
+ * Resolve the card URL: a bare base URL (`https://host[:port]` or a path-less
9
+ * URL) gets the A2A well-known path appended; anything already pointing at a
10
+ * JSON document is used as-is.
11
+ */
12
+ export function resolveAgentCardUrl(baseOrCardUrl) {
13
+ const url = new URL(baseOrCardUrl);
14
+ if (url.pathname === '/' || url.pathname === '') {
15
+ url.pathname = A2A_WELL_KNOWN_PATH;
16
+ }
17
+ return url.toString();
18
+ }
19
+ /** Fetch and structurally validate a remote A2A Agent Card. */
20
+ export async function fetchAgentCard(baseOrCardUrl, options = {}) {
21
+ const fetchImpl = options.fetchImpl ?? globalThis.fetch;
22
+ if (typeof fetchImpl !== 'function') {
23
+ throw new Error('fetchAgentCard: no fetch implementation available');
24
+ }
25
+ const sourceUrl = resolveAgentCardUrl(baseOrCardUrl);
26
+ const maxBytes = options.maxBytes ?? 256 * 1024;
27
+ const controller = new AbortController();
28
+ const timer = setTimeout(() => controller.abort(), options.timeoutMs ?? 10_000);
29
+ let text;
30
+ try {
31
+ const res = await fetchImpl(sourceUrl, {
32
+ signal: controller.signal,
33
+ headers: { accept: 'application/json' },
34
+ });
35
+ if (!res.ok) {
36
+ throw new Error(`fetchAgentCard: ${sourceUrl} returned HTTP ${res.status}`);
37
+ }
38
+ text = await res.text();
39
+ }
40
+ finally {
41
+ clearTimeout(timer);
42
+ }
43
+ if (text.length > maxBytes) {
44
+ throw new Error(`fetchAgentCard: card exceeds ${maxBytes} bytes`);
45
+ }
46
+ let parsed;
47
+ try {
48
+ parsed = JSON.parse(text);
49
+ }
50
+ catch {
51
+ throw new Error(`fetchAgentCard: ${sourceUrl} did not return valid JSON`);
52
+ }
53
+ const validation = validateAgentCard(parsed);
54
+ if (!validation.valid) {
55
+ throw new Error(`fetchAgentCard: invalid A2A agent card from ${sourceUrl}: ${validation.errors.join('; ')}`);
56
+ }
57
+ return { card: parsed, sourceUrl };
58
+ }
59
+ /**
60
+ * Fetch a remote Agent Card and register the peer in federation discovery.
61
+ * The peer enters at TrustLevel.UNTRUSTED (see fromAgentCard) — the card is
62
+ * self-asserted metadata, and trust is earned through the normal handshake.
63
+ */
64
+ export async function consumeAgentCard(discovery, baseOrCardUrl, options = {}) {
65
+ const { card, sourceUrl } = await fetchAgentCard(baseOrCardUrl, options);
66
+ const node = fromAgentCard(card, sourceUrl);
67
+ return discovery.registerExternalPeer(node);
68
+ }
69
+ //# sourceMappingURL=consume.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consume.js","sourceRoot":"","sources":["../../src/a2a/consume.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,iBAAiB,GAElB,MAAM,iBAAiB,CAAC;AAezB;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,aAAqB;IACvD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;IACnC,IAAI,GAAG,CAAC,QAAQ,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE,EAAE,CAAC;QAChD,GAAG,CAAC,QAAQ,GA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QAAQ,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,4BAA4B,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,+CAA+C,SAAS,KAAK,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC5F,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAsB,EAAE,SAAS,EAAE,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAA2B,EAC3B,aAAqB,EACrB,UAAiC,EAAE;IAEnC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC5C,OAAO,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * A2A well-known Agent Card endpoint (A2A 1.0 §8.2 discovery + §8.6 caching).
3
+ *
4
+ * Serves `GET /.well-known/agent-card.json` from a minimal `node:http`
5
+ * server. Security posture follows ADR-166 (mcp-bridge unauthenticated-RCE
6
+ * remediation): binds 127.0.0.1 by default and REFUSES a non-loopback bind
7
+ * unless the caller passes `allowNonLoopback: true` explicitly. The endpoint
8
+ * is read-only (GET/HEAD on one exact path), exposes only the public card,
9
+ * and is entirely opt-in — nothing here weakens the federation transport's
10
+ * existing bind or auth behavior.
11
+ */
12
+ import { type A2AAgentCard } from './agent-card.js';
13
+ export interface AgentCardServerOptions {
14
+ /** Card supplier — re-invoked per request so a late-published manifest is picked up. */
15
+ readonly getCard: () => A2AAgentCard | null;
16
+ readonly port: number;
17
+ /** Bind host. Default 127.0.0.1 (ADR-166 posture). */
18
+ readonly host?: string;
19
+ /** Serve path. Default A2A_WELL_KNOWN_PATH. */
20
+ readonly path?: string;
21
+ /**
22
+ * Explicit opt-in required to bind anything other than loopback. Without
23
+ * it a non-loopback host is rejected at start (fail-closed).
24
+ */
25
+ readonly allowNonLoopback?: boolean;
26
+ /** Cache-Control max-age seconds (spec §8.6.1). Default 300. */
27
+ readonly cacheMaxAgeSeconds?: number;
28
+ }
29
+ export interface AgentCardServerHandle {
30
+ readonly url: string;
31
+ readonly host: string;
32
+ readonly port: number;
33
+ close(): Promise<void>;
34
+ }
35
+ export declare function isLoopbackHost(host: string): boolean;
36
+ /**
37
+ * Start the well-known Agent Card HTTP endpoint.
38
+ *
39
+ * Responses:
40
+ * GET/HEAD <path> → 200 application/json (+ Cache-Control, ETag per §8.6)
41
+ * or 503 when no card is available yet
42
+ * other method → 405
43
+ * other path → 404
44
+ */
45
+ export declare function startAgentCardServer(options: AgentCardServerOptions): Promise<AgentCardServerHandle>;
46
+ //# sourceMappingURL=well-known.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"well-known.d.ts","sourceRoot":"","sources":["../../src/a2a/well-known.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzE,MAAM,WAAW,sBAAsB;IACrC,wFAAwF;IACxF,QAAQ,CAAC,OAAO,EAAE,MAAM,YAAY,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,gEAAgE;IAChE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CA6DhC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * A2A well-known Agent Card endpoint (A2A 1.0 §8.2 discovery + §8.6 caching).
3
+ *
4
+ * Serves `GET /.well-known/agent-card.json` from a minimal `node:http`
5
+ * server. Security posture follows ADR-166 (mcp-bridge unauthenticated-RCE
6
+ * remediation): binds 127.0.0.1 by default and REFUSES a non-loopback bind
7
+ * unless the caller passes `allowNonLoopback: true` explicitly. The endpoint
8
+ * is read-only (GET/HEAD on one exact path), exposes only the public card,
9
+ * and is entirely opt-in — nothing here weakens the federation transport's
10
+ * existing bind or auth behavior.
11
+ */
12
+ import { createServer } from 'node:http';
13
+ import { createHash } from 'node:crypto';
14
+ import { A2A_WELL_KNOWN_PATH } from './agent-card.js';
15
+ const LOOPBACK_HOSTS = new Set(['127.0.0.1', '::1', 'localhost']);
16
+ export function isLoopbackHost(host) {
17
+ return LOOPBACK_HOSTS.has(host) || host.startsWith('127.');
18
+ }
19
+ /**
20
+ * Start the well-known Agent Card HTTP endpoint.
21
+ *
22
+ * Responses:
23
+ * GET/HEAD <path> → 200 application/json (+ Cache-Control, ETag per §8.6)
24
+ * or 503 when no card is available yet
25
+ * other method → 405
26
+ * other path → 404
27
+ */
28
+ export function startAgentCardServer(options) {
29
+ const host = options.host ?? '127.0.0.1';
30
+ const path = options.path ?? A2A_WELL_KNOWN_PATH;
31
+ const maxAge = options.cacheMaxAgeSeconds ?? 300;
32
+ if (!isLoopbackHost(host) && options.allowNonLoopback !== true) {
33
+ return Promise.reject(new Error(`A2A agent-card server: refusing non-loopback bind ${host} without allowNonLoopback: true (ADR-166)`));
34
+ }
35
+ const server = createServer((req, res) => {
36
+ const reqPath = (req.url ?? '').split('?')[0];
37
+ if (reqPath !== path) {
38
+ res.writeHead(404, { 'content-type': 'application/json' });
39
+ res.end(JSON.stringify({ error: 'not_found', agentCardPath: path }));
40
+ return;
41
+ }
42
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
43
+ res.writeHead(405, { allow: 'GET, HEAD', 'content-type': 'application/json' });
44
+ res.end(JSON.stringify({ error: 'method_not_allowed' }));
45
+ return;
46
+ }
47
+ const card = options.getCard();
48
+ if (!card) {
49
+ res.writeHead(503, { 'content-type': 'application/json', 'retry-after': '5' });
50
+ res.end(JSON.stringify({ error: 'agent_card_not_ready' }));
51
+ return;
52
+ }
53
+ const body = JSON.stringify(card, null, 2);
54
+ const etag = `"${createHash('sha256').update(body).digest('hex').slice(0, 32)}"`;
55
+ if (req.headers['if-none-match'] === etag) {
56
+ res.writeHead(304, { etag });
57
+ res.end();
58
+ return;
59
+ }
60
+ res.writeHead(200, {
61
+ 'content-type': 'application/json',
62
+ 'cache-control': `public, max-age=${maxAge}`,
63
+ etag,
64
+ });
65
+ res.end(req.method === 'HEAD' ? undefined : body);
66
+ });
67
+ return new Promise((resolvePromise, rejectPromise) => {
68
+ server.once('error', rejectPromise);
69
+ server.listen(options.port, host, () => {
70
+ server.removeListener('error', rejectPromise);
71
+ const addr = server.address();
72
+ const boundPort = typeof addr === 'object' && addr !== null ? addr.port : options.port;
73
+ resolvePromise({
74
+ url: `http://${host}:${boundPort}${path}`,
75
+ host,
76
+ port: boundPort,
77
+ close: () => new Promise((res2, rej2) => {
78
+ server.close((err) => (err ? rej2(err) : res2()));
79
+ }),
80
+ });
81
+ });
82
+ });
83
+ }
84
+ //# sourceMappingURL=well-known.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"well-known.js","sourceRoot":"","sources":["../../src/a2a/well-known.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iBAAiB,CAAC;AA0BzE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AAElE,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAA+B;IAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,WAAW,CAAC;IACzC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,mBAAmB,CAAC;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,IAAI,GAAG,CAAC;IAEjD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,gBAAgB,KAAK,IAAI,EAAE,CAAC;QAC/D,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAC7B,qDAAqD,IAAI,2CAA2C,CACrG,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAW,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC/C,MAAM,OAAO,GAAG,CAAC,G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CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBACpD,CAAC,CAAC;aACL,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { FederationClaimType, PolicyEngineDeps } from './policy-engine.js';
2
+ export type FederationAuthorizationMode = 'legacy' | 'observe' | 'enforce';
3
+ export interface FederationClaimCheckerConfig {
4
+ mode?: FederationAuthorizationMode;
5
+ grantedClaims?: readonly string[];
6
+ onObservation?: (claim: FederationClaimType, granted: boolean) => void;
7
+ }
8
+ export interface FederationClaimChecker {
9
+ mode: FederationAuthorizationMode;
10
+ grantedClaims: ReadonlySet<FederationClaimType>;
11
+ checkClaim: PolicyEngineDeps['checkClaim'];
12
+ }
13
+ /**
14
+ * Compatibility bridge for the legacy federation policy engine.
15
+ *
16
+ * This removes the anonymous `() => true` production stub and makes
17
+ * compatibility behavior explicit:
18
+ * - legacy: preserve pre-ADR-325 behavior;
19
+ * - observe: calculate and report missing grants without blocking;
20
+ * - enforce: default deny unless the exact claim is configured.
21
+ *
22
+ * ADR-324 policy adapters can supply the `grantedClaims` set after evaluating
23
+ * the request; ownership-changing federation messages remain disabled in the
24
+ * default message policy until the full ingress PEP is composed.
25
+ */
26
+ export declare function createFederationClaimChecker(config?: FederationClaimCheckerConfig): FederationClaimChecker;
27
+ //# sourceMappingURL=claim-checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-checker.d.ts","sourceRoot":"","sources":["../../src/application/claim-checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAY3E,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,2BAA2B,CAAC;IACnC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACxE;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,2BAA2B,CAAC;IAClC,aAAa,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAChD,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;CAC5C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,GAAE,4BAAiC,GACxC,sBAAsB,CAuBxB"}
@@ -0,0 +1,46 @@
1
+ const FEDERATION_CLAIMS = new Set([
2
+ 'federation:discover',
3
+ 'federation:connect',
4
+ 'federation:read',
5
+ 'federation:write',
6
+ 'federation:admin',
7
+ 'federation:memory',
8
+ 'federation:spawn',
9
+ ]);
10
+ /**
11
+ * Compatibility bridge for the legacy federation policy engine.
12
+ *
13
+ * This removes the anonymous `() => true` production stub and makes
14
+ * compatibility behavior explicit:
15
+ * - legacy: preserve pre-ADR-325 behavior;
16
+ * - observe: calculate and report missing grants without blocking;
17
+ * - enforce: default deny unless the exact claim is configured.
18
+ *
19
+ * ADR-324 policy adapters can supply the `grantedClaims` set after evaluating
20
+ * the request; ownership-changing federation messages remain disabled in the
21
+ * default message policy until the full ingress PEP is composed.
22
+ */
23
+ export function createFederationClaimChecker(config = {}) {
24
+ const mode = config.mode ?? 'legacy';
25
+ if (mode !== 'legacy' && mode !== 'observe' && mode !== 'enforce') {
26
+ throw new TypeError(`Unsupported federation authorization mode: ${String(mode)}`);
27
+ }
28
+ const grantedClaims = new Set();
29
+ for (const claim of config.grantedClaims ?? []) {
30
+ if (!FEDERATION_CLAIMS.has(claim)) {
31
+ throw new TypeError(`Unknown federation claim: ${claim}`);
32
+ }
33
+ grantedClaims.add(claim);
34
+ }
35
+ return {
36
+ mode,
37
+ grantedClaims,
38
+ checkClaim: (claim) => {
39
+ const granted = grantedClaims.has(claim);
40
+ if (mode === 'observe')
41
+ config.onObservation?.(claim, granted);
42
+ return mode !== 'enforce' || granted;
43
+ },
44
+ };
45
+ }
46
+ //# sourceMappingURL=claim-checker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-checker.js","sourceRoot":"","sources":["../../src/application/claim-checker.ts"],"names":[],"mappings":"AAIA,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAsB;IACrD,qBAAqB;IACrB,oBAAoB;IACpB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;CACnB,CAAC,CAAC;AAcH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,4BAA4B,CAC1C,SAAuC,EAAE;IAEzC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,QAAQ,CAAC;IACrC,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,IAAI,SAAS,CAAC,8CAA8C,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,GAAG,EAAuB,CAAC;IACrD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,aAAa,IAAI,EAAE,EAAE,CAAC;QAC/C,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAA4B,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,SAAS,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;QAC5D,CAAC;QACD,aAAa,CAAC,GAAG,CAAC,KAA4B,CAAC,CAAC;IAClD,CAAC;IAED,OAAO;QACL,IAAI;QACJ,aAAa;QACb,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;YACpB,MAAM,OAAO,GAAG,aAAa,C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