@claude-flow/cli 3.32.29 → 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 (372) hide show
  1. package/.claude/helpers/helpers.manifest.json +2 -2
  2. package/catalog-manifest.json +2 -2
  3. package/dist/src/init/claudemd-generator.js +53 -2
  4. package/dist/src/mcp-tools/capability-brain.js +22 -22
  5. package/dist/src/mcp-tools/guidance-tools.js +1 -1
  6. package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
  7. package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
  8. package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
  9. package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
  10. package/node_modules/@claude-flow/codex/README.md +1044 -0
  11. package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
  12. package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
  13. package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
  14. package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
  15. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
  16. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
  17. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
  18. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
  19. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
  20. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
  21. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
  22. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
  23. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
  24. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
  25. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
  26. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
  27. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
  28. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
  29. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
  30. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
  31. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
  32. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
  33. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
  34. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
  35. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
  36. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
  37. package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
  38. package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
  39. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
  40. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
  41. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
  42. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
  43. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
  44. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
  45. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
  46. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
  47. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
  48. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
  49. package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
  50. package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
  51. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
  52. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
  53. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
  54. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
  55. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
  56. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
  57. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
  58. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
  59. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
  60. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
  61. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
  62. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
  63. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
  64. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
  65. package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
  66. package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
  67. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
  68. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
  69. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
  70. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
  71. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
  72. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
  73. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
  74. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
  75. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
  76. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
  77. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
  78. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
  79. package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
  80. package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
  81. package/node_modules/@claude-flow/codex/dist/index.js +54 -0
  82. package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
  83. package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
  84. package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
  85. package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
  86. package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
  87. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
  88. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
  89. package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
  90. package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
  91. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
  92. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
  93. package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
  94. package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
  95. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
  96. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
  97. package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
  98. package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
  99. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
  100. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
  101. package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
  102. package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
  103. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
  104. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
  105. package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
  106. package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
  107. package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
  108. package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
  109. package/node_modules/@claude-flow/codex/dist/types.js +8 -0
  110. package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
  111. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
  112. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
  113. package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
  114. package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
  115. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
  116. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
  117. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
  118. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
  119. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
  120. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
  121. package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
  122. package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
  123. package/node_modules/@claude-flow/codex/package.json +122 -0
  124. package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
  125. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
  126. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
  127. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
  128. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
  129. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
  130. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
  131. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
  132. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
  133. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
  134. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
  135. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
  136. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
  137. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
  138. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
  139. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
  140. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
  141. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
  142. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
  143. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
  144. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
  145. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
  146. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
  147. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
  148. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
  149. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
  150. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
  151. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
  152. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
  153. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
  154. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
  155. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
  156. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
  157. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
  158. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
  159. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
  160. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
  161. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
  162. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
  163. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
  164. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
  165. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
  166. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
  167. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
  168. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
  169. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
  170. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
  171. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
  172. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
  173. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
  174. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
  175. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
  176. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
  177. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
  178. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
  179. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
  180. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
  181. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
  182. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
  183. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
  184. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
  185. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
  186. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
  187. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
  188. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
  189. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
  190. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
  191. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
  192. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
  193. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
  194. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
  195. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
  196. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
  197. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
  198. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
  199. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
  200. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
  201. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
  202. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
  203. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
  204. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
  205. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
  206. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
  207. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
  208. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
  209. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
  210. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
  211. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
  212. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
  213. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
  214. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
  215. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
  216. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
  217. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
  218. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
  219. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
  220. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
  221. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
  222. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
  223. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
  224. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
  225. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
  226. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
  227. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
  228. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
  229. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
  230. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
  231. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
  232. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
  233. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
  234. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
  235. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
  236. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
  237. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
  238. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
  239. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
  240. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
  241. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
  242. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
  243. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
  244. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
  245. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
  246. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
  247. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
  248. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
  249. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
  250. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
  251. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
  252. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
  253. package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
  254. package/node_modules/@claude-flow/security/README.md +292 -0
  255. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
  256. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
  257. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
  258. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
  259. package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
  260. package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
  261. package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
  262. package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
  263. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
  264. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
  265. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
  266. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
  267. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
  268. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
  269. package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
  270. package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
  271. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
  272. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
  273. package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
  274. package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
  275. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
  276. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
  277. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
  278. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
  279. package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
  280. package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
  281. package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
  282. package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
  283. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
  284. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
  285. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
  286. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
  287. package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
  288. package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
  289. package/node_modules/@claude-flow/security/dist/index.js +176 -0
  290. package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
  291. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
  292. package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
  293. package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
  294. package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
  295. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
  296. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
  297. package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
  298. package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
  299. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
  300. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
  301. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
  302. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
  303. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
  304. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
  305. package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
  306. package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
  307. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
  308. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
  309. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
  310. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
  311. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
  312. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
  313. package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
  314. package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
  315. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
  316. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
  317. package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
  318. package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
  319. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
  320. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
  321. package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
  322. package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
  323. package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
  324. package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
  325. package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
  326. package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
  327. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
  328. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
  329. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
  330. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
  331. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
  332. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
  333. package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
  334. package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
  335. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
  336. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
  337. package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
  338. package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
  339. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
  340. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
  341. package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
  342. package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
  343. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
  344. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
  345. package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
  346. package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
  347. package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
  348. package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
  349. package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
  350. package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
  351. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
  352. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
  353. package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
  354. package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
  355. package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
  356. package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
  357. package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
  358. package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
  359. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
  360. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
  361. package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
  362. package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
  363. package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
  364. package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
  365. package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
  366. package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
  367. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
  368. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
  369. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
  370. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
  371. package/node_modules/@claude-flow/security/package.json +44 -0
  372. package/package.json +24 -8
@@ -0,0 +1,71 @@
1
+ export class FederationEnvelope {
2
+ envelopeId;
3
+ sourceNodeId;
4
+ targetNodeId;
5
+ sessionId;
6
+ messageType;
7
+ payload;
8
+ timestamp;
9
+ nonce;
10
+ hmacSignature;
11
+ piiScanResult;
12
+ constructor(props) {
13
+ this.envelopeId = props.envelopeId;
14
+ this.sourceNodeId = props.sourceNodeId;
15
+ this.targetNodeId = props.targetNodeId;
16
+ this.sessionId = props.sessionId;
17
+ this.messageType = props.messageType;
18
+ this.payload = props.payload;
19
+ this.timestamp = props.timestamp;
20
+ this.nonce = props.nonce;
21
+ this.hmacSignature = props.hmacSignature;
22
+ this.piiScanResult = props.piiScanResult;
23
+ }
24
+ isExpired(maxAgeMs) {
25
+ return Date.now() - this.timestamp.getTime() > maxAgeMs;
26
+ }
27
+ toJSON() {
28
+ return {
29
+ envelopeId: this.envelopeId,
30
+ sourceNodeId: this.sourceNodeId,
31
+ targetNodeId: this.targetNodeId,
32
+ sessionId: this.sessionId,
33
+ messageType: this.messageType,
34
+ payload: this.payload,
35
+ timestamp: this.timestamp.toISOString(),
36
+ nonce: this.nonce,
37
+ hmacSignature: this.hmacSignature,
38
+ piiScanResult: this.piiScanResult,
39
+ };
40
+ }
41
+ toSignablePayload() {
42
+ return JSON.stringify({
43
+ envelopeId: this.envelopeId,
44
+ sourceNodeId: this.sourceNodeId,
45
+ targetNodeId: this.targetNodeId,
46
+ sessionId: this.sessionId,
47
+ messageType: this.messageType,
48
+ payload: this.payload,
49
+ timestamp: this.timestamp.toISOString(),
50
+ nonce: this.nonce,
51
+ });
52
+ }
53
+ static emptyScanResult() {
54
+ return {
55
+ scanned: false,
56
+ piiFound: false,
57
+ detections: [],
58
+ actionsApplied: [],
59
+ scanDurationMs: 0,
60
+ };
61
+ }
62
+ }
63
+ export const CONSENSUS_REQUIRED_TYPES = new Set([
64
+ 'trust-change',
65
+ 'topology-change',
66
+ 'agent-spawn',
67
+ // ADR-101 Component C: handoffs cross trust boundaries — optionally
68
+ // require quorum from validators in high-trust deployments.
69
+ 'agent-handoff',
70
+ ]);
71
+ //# sourceMappingURL=federation-envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-envelope.js","sourceRoot":"","sources":["../../../src/domain/entities/federation-envelope.ts"],"names":[],"mappings":"AAiDA,MAAM,OAAO,kBAAkB;IACpB,UAAU,CAAS;IACnB,YAAY,CAAS;IACrB,YAAY,CAAS;IACrB,SAAS,CAAS;IAClB,WAAW,CAAwB;IACnC,OAAO,CAAI;IACX,SAAS,CAAO;IAChB,KAAK,CAAS;IACd,aAAa,CAAS;IACtB,aAAa,CAAgB;IAEtC,YAAY,KAAiC;QAC3C,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,KAAK,CAA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W,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;YACvC,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,eAAe;QACpB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,EAAE;YACd,cAAc,EAAE,EAAE;YAClB,cAAc,EAAE,CAAC;SAClB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAuC,IAAI,GAAG,CAAC;IAClF,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,oEAAoE;IACpE,4DAA4D;IAC5D,eAAe;CAChB,CAAC,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { TrustLevel } from './trust-level.js';
2
+ import { FederationNodeState, SuspensionReason, TransitionReason } from '../value-objects/federation-node-state.js';
3
+ export interface FederationNodeCapabilities {
4
+ readonly agentTypes: readonly string[];
5
+ readonly maxConcurrentSessions: number;
6
+ readonly supportedProtocols: readonly string[];
7
+ readonly complianceModes: readonly string[];
8
+ }
9
+ export interface FederationNodeMetadata {
10
+ readonly organizationId?: string;
11
+ readonly region?: string;
12
+ readonly version?: string;
13
+ readonly [key: string]: unknown;
14
+ }
15
+ /** Last-transition record kept on the entity for the audit trail. */
16
+ export interface FederationNodeStateRecord {
17
+ readonly state: FederationNodeState;
18
+ readonly changedAt: Date;
19
+ readonly reason?: SuspensionReason;
20
+ readonly correlationId?: string;
21
+ }
22
+ export interface FederationNodeProps {
23
+ readonly nodeId: string;
24
+ readonly publicKey: string;
25
+ readonly endpoint: string;
26
+ readonly capabilities: FederationNodeCapabilities;
27
+ readonly trustLevel: TrustLevel;
28
+ readonly trustScore: number;
29
+ readonly lastSeen: Date;
30
+ readonly metadata: FederationNodeMetadata;
31
+ /** Phase 2: peer state. Defaults to ACTIVE if unset. */
32
+ readonly state?: FederationNodeState;
33
+ /** Phase 2: when the current state was entered. Defaults to now. */
34
+ readonly stateChangedAt?: Date;
35
+ /** Phase 2: why we entered the current non-ACTIVE state. */
36
+ readonly stateReason?: SuspensionReason;
37
+ /** Phase 2: caller correlation key for the last transition. */
38
+ readonly stateCorrelationId?: string;
39
+ }
40
+ export declare class FederationNode {
41
+ readonly nodeId: string;
42
+ readonly publicKey: string;
43
+ readonly endpoint: string;
44
+ readonly capabilities: FederationNodeCapabilities;
45
+ private _trustLevel;
46
+ private _trustScore;
47
+ private _lastSeen;
48
+ private readonly _metadata;
49
+ private _state;
50
+ private _stateChangedAt;
51
+ private _stateReason?;
52
+ private _stateCorrelationId?;
53
+ constructor(props: FederationNodeProps);
54
+ get trustLevel(): TrustLevel;
55
+ get trustScore(): number;
56
+ get lastSeen(): Date;
57
+ get metadata(): FederationNodeMetadata;
58
+ /** Current peer state (ADR-097 Phase 2). */
59
+ get state(): FederationNodeState;
60
+ /** When the current state was entered. */
61
+ get stateChangedAt(): Date;
62
+ /** Last-transition record for the audit trail. */
63
+ get stateRecord(): FederationNodeStateRecord;
64
+ /** Convenience predicate: is this peer accepting outbound sends? */
65
+ get isActive(): boolean;
66
+ /** Convenience predicate: is this peer terminally evicted? */
67
+ get isEvicted(): boolean;
68
+ updateTrustLevel(level: TrustLevel): void;
69
+ updateTrustScore(score: number): void;
70
+ markSeen(): void;
71
+ isStale(maxAgeMs: number): boolean;
72
+ /**
73
+ * Transition this peer to SUSPENDED. Legal from ACTIVE only — calling
74
+ * from SUSPENDED or EVICTED returns false (the entity is already at or
75
+ * past the breaker threshold, so a duplicate trip is a no-op).
76
+ *
77
+ * Returns true if the state changed, false if the call was rejected
78
+ * (illegal transition). The breaker treats false as "already handled."
79
+ */
80
+ suspend(reason: TransitionReason, now?: Date): boolean;
81
+ /**
82
+ * Transition this peer to EVICTED. Legal from ACTIVE or SUSPENDED.
83
+ * EVICTED is terminal under normal flow — only `reactivate` (operator-
84
+ * initiated) can move the peer back to ACTIVE.
85
+ */
86
+ evict(reason: TransitionReason, now?: Date): boolean;
87
+ /**
88
+ * Transition back to ACTIVE. Legal from SUSPENDED (after cooldown +
89
+ * probe success — the breaker is responsible for those checks; this
90
+ * entity does not gate on time) or from EVICTED (operator override).
91
+ *
92
+ * `correlationId` lets the caller record *why* they're reactivating
93
+ * (probe ID, operator ticket, etc.) for the audit trail.
94
+ */
95
+ reactivate(correlationId?: string, now?: Date): boolean;
96
+ private _transition;
97
+ toProps(): FederationNodeProps;
98
+ static create(props: Omit<FederationNodeProps, 'trustLevel' | 'trustScore' | 'lastSeen'> & {
99
+ trustLevel?: TrustLevel;
100
+ trustScore?: number;
101
+ lastSeen?: Date;
102
+ }): FederationNode;
103
+ }
104
+ //# sourceMappingURL=federation-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-node.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/federation-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAEjB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED,qEAA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,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,IAAI,CAAC;KACjB,GAAG,cAAc;CAQnB"}
@@ -0,0 +1,152 @@
1
+ import { TrustLevel } from './trust-level.js';
2
+ import { FederationNodeState, canTransition, } from '../value-objects/federation-node-state.js';
3
+ export class FederationNode {
4
+ nodeId;
5
+ publicKey;
6
+ endpoint;
7
+ capabilities;
8
+ _trustLevel;
9
+ _trustScore;
10
+ _lastSeen;
11
+ _metadata;
12
+ // Phase 2 state machine. Mutated only via suspend()/evict()/reactivate().
13
+ // Direct field writes are not permitted — every transition flows through
14
+ // canTransition() in federation-node-state.ts.
15
+ _state;
16
+ _stateChangedAt;
17
+ _stateReason;
18
+ _stateCorrelationId;
19
+ constructor(props) {
20
+ this.nodeId = props.nodeId;
21
+ this.publicKey = props.publicKey;
22
+ this.endpoint = props.endpoint;
23
+ this.capabilities = props.capabilities;
24
+ this._trustLevel = props.trustLevel;
25
+ this._trustScore = props.trustScore;
26
+ this._lastSeen = props.lastSeen;
27
+ this._metadata = props.metadata;
28
+ this._state = props.state ?? FederationNodeState.ACTIVE;
29
+ this._stateChangedAt = props.stateChangedAt ?? new Date();
30
+ this._stateReason = props.stateReason;
31
+ this._stateCorrelationId = props.stateCorrelationId;
32
+ }
33
+ get trustLevel() {
34
+ return this._trustLevel;
35
+ }
36
+ get trustScore() {
37
+ return this._trustScore;
38
+ }
39
+ get lastSeen() {
40
+ return this._lastSeen;
41
+ }
42
+ get metadata() {
43
+ return this._metadata;
44
+ }
45
+ /** Current peer state (ADR-097 Phase 2). */
46
+ get state() {
47
+ return this._state;
48
+ }
49
+ /** When the current state was entered. */
50
+ get stateChangedAt() {
51
+ return this._stateChangedAt;
52
+ }
53
+ /** Last-transition record for the audit trail. */
54
+ get stateRecord() {
55
+ return {
56
+ state: this._state,
57
+ changedAt: this._stateChangedAt,
58
+ reason: this._stateReason,
59
+ correlationId: this._stateCorrelationId,
60
+ };
61
+ }
62
+ /** Convenience predicate: is this peer accepting outbound sends? */
63
+ get isActive() {
64
+ return this._state === FederationNodeState.ACTIVE;
65
+ }
66
+ /** Convenience predicate: is this peer terminally evicted? */
67
+ get isEvicted() {
68
+ return this._state === FederationNodeState.EVICTED;
69
+ }
70
+ updateTrustLevel(level) {
71
+ this._trustLevel = level;
72
+ }
73
+ updateTrustScore(score) {
74
+ this._trustScore = Math.max(0, Math.min(1, score));
75
+ }
76
+ markSeen() {
77
+ this._lastSeen = new Date();
78
+ }
79
+ isStale(maxAgeMs) {
80
+ return Date.now() - this._lastSeen.getTime() > maxAgeMs;
81
+ }
82
+ /**
83
+ * Transition this peer to SUSPENDED. Legal from ACTIVE only — calling
84
+ * from SUSPENDED or EVICTED returns false (the entity is already at or
85
+ * past the breaker threshold, so a duplicate trip is a no-op).
86
+ *
87
+ * Returns true if the state changed, false if the call was rejected
88
+ * (illegal transition). The breaker treats false as "already handled."
89
+ */
90
+ suspend(reason, now = new Date()) {
91
+ return this._transition(FederationNodeState.SUSPENDED, reason, now);
92
+ }
93
+ /**
94
+ * Transition this peer to EVICTED. Legal from ACTIVE or SUSPENDED.
95
+ * EVICTED is terminal under normal flow — only `reactivate` (operator-
96
+ * initiated) can move the peer back to ACTIVE.
97
+ */
98
+ evict(reason, now = new Date()) {
99
+ return this._transition(FederationNodeState.EVICTED, reason, now);
100
+ }
101
+ /**
102
+ * Transition back to ACTIVE. Legal from SUSPENDED (after cooldown +
103
+ * probe success — the breaker is responsible for those checks; this
104
+ * entity does not gate on time) or from EVICTED (operator override).
105
+ *
106
+ * `correlationId` lets the caller record *why* they're reactivating
107
+ * (probe ID, operator ticket, etc.) for the audit trail.
108
+ */
109
+ reactivate(correlationId, now = new Date()) {
110
+ if (!canTransition(this._state, FederationNodeState.ACTIVE))
111
+ return false;
112
+ this._state = FederationNodeState.ACTIVE;
113
+ this._stateChangedAt = now;
114
+ this._stateReason = undefined;
115
+ this._stateCorrelationId = correlationId;
116
+ return true;
117
+ }
118
+ _transition(target, reason, now) {
119
+ if (!canTransition(this._state, target))
120
+ return false;
121
+ this._state = target;
122
+ this._stateChangedAt = now;
123
+ this._stateReason = reason.reason;
124
+ this._stateCorrelationId = reason.correlationId;
125
+ return true;
126
+ }
127
+ toProps() {
128
+ return {
129
+ nodeId: this.nodeId,
130
+ publicKey: this.publicKey,
131
+ endpoint: this.endpoint,
132
+ capabilities: this.capabilities,
133
+ trustLevel: this._trustLevel,
134
+ trustScore: this._trustScore,
135
+ lastSeen: this._lastSeen,
136
+ metadata: this._metadata,
137
+ state: this._state,
138
+ stateChangedAt: this._stateChangedAt,
139
+ stateReason: this._stateReason,
140
+ stateCorrelationId: this._stateCorrelationId,
141
+ };
142
+ }
143
+ static create(props) {
144
+ return new FederationNode({
145
+ ...props,
146
+ trustLevel: props.trustLevel ?? TrustLevel.UNTRUSTED,
147
+ trustScore: props.trustScore ?? 0,
148
+ lastSeen: props.lastSeen ?? new Date(),
149
+ });
150
+ }
151
+ }
152
+ //# sourceMappingURL=federation-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-node.js","sourceRoot":"","sources":["../../../src/domain/entities/federation-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EAGnB,aAAa,GACd,MAAM,2CAA2C,CAAC;AA2CnD,MAAM,OAAO,cAAc;IAChB,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,QAAQ,CAAS;IACjB,YAAY,CAA6B;IAE1C,WAAW,CAAa;IACxB,WAAW,CAAS;IACpB,SAAS,CAAO;IACP,SAAS,CAAyB;IAEnD,0EAA0E;IAC1E,yEAAyE;IACzE,+CAA+C;IACvC,MAAM,CAAsB;IAC5B,eAAe,CAAO;IACtB,YAAY,CAAoB;IAChC,mBAAmB,CAAU;IAErC,YAAY,KAA0B;QACpC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,SAAS,GA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CAAC,SAAS;YACpD,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,CAAC;YACjC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI,IAAI,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,55 @@
1
+ import { TrustLevel } from './trust-level.js';
2
+ export interface SessionMetrics {
3
+ messagesSent: number;
4
+ messagesReceived: number;
5
+ piiRedactions: number;
6
+ threatDetections: number;
7
+ hmacFailures: number;
8
+ totalInteractions: number;
9
+ }
10
+ export interface FederationSessionProps {
11
+ readonly sessionId: string;
12
+ readonly localNodeId: string;
13
+ readonly remoteNodeId: string;
14
+ readonly trustLevel: TrustLevel;
15
+ readonly negotiatedCapabilities: readonly string[];
16
+ readonly createdAt: Date;
17
+ readonly expiresAt: Date;
18
+ readonly heartbeatInterval: number;
19
+ readonly sessionToken: string;
20
+ readonly metrics: SessionMetrics;
21
+ }
22
+ export declare class FederationSession {
23
+ readonly sessionId: string;
24
+ readonly localNodeId: string;
25
+ readonly remoteNodeId: string;
26
+ readonly negotiatedCapabilities: readonly string[];
27
+ readonly createdAt: Date;
28
+ readonly heartbeatInterval: number;
29
+ readonly sessionToken: string;
30
+ private _trustLevel;
31
+ private _expiresAt;
32
+ private _lastHeartbeat;
33
+ private _metrics;
34
+ private _active;
35
+ constructor(props: FederationSessionProps);
36
+ get trustLevel(): TrustLevel;
37
+ get expiresAt(): Date;
38
+ get lastHeartbeat(): Date;
39
+ get metrics(): Readonly<SessionMetrics>;
40
+ get active(): boolean;
41
+ isExpired(): boolean;
42
+ isHeartbeatOverdue(): boolean;
43
+ recordHeartbeat(): void;
44
+ renew(newExpiresAt: Date): void;
45
+ updateTrustLevel(level: TrustLevel): void;
46
+ recordMessageSent(): void;
47
+ recordMessageReceived(): void;
48
+ recordPiiRedaction(): void;
49
+ recordThreatDetection(): void;
50
+ recordHmacFailure(): void;
51
+ terminate(): void;
52
+ toProps(): FederationSessionProps;
53
+ static createMetrics(): SessionMetrics;
54
+ }
55
+ //# sourceMappingURL=federation-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-session.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/federation-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CAClC;AAED,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,cAAc,CAAO;IAC7B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,OAAO,CAAU;gBAEb,KAAK,EAAE,sBAAsB;IAezC,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED,IAAI,SAAS,IAAI,IAAI,CAEpB;IAED,IAAI,aAAa,IAAI,IAAI,CAExB;IAED,IAAI,OAAO,IAAI,QAAQ,CAAC,cAAc,CAAC,CAEtC;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,SAAS,IAAI,OAAO;IAIpB,kBAAkB,IAAI,OAAO;IAK7B,eAAe,IAAI,IAAI;IAIvB,KAAK,CAAC,YAAY,EAAE,IAAI,GAAG,IAAI;IAK/B,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAIzC,iBAAiB,IAAI,IAAI;IAKzB,qBAAqB,IAAI,IAAI;IAK7B,kBAAkB,IAAI,IAAI;IAI1B,qBAAqB,IAAI,IAAI;IAI7B,iBAAiB,IAAI,IAAI;IAIzB,SAAS,IAAI,IAAI;IAIjB,OAAO,IAAI,sBAAsB;IAejC,MAAM,CAAC,aAAa,IAAI,cAAc;CAUvC"}
@@ -0,0 +1,105 @@
1
+ export class FederationSession {
2
+ sessionId;
3
+ localNodeId;
4
+ remoteNodeId;
5
+ negotiatedCapabilities;
6
+ createdAt;
7
+ heartbeatInterval;
8
+ sessionToken;
9
+ _trustLevel;
10
+ _expiresAt;
11
+ _lastHeartbeat;
12
+ _metrics;
13
+ _active;
14
+ constructor(props) {
15
+ this.sessionId = props.sessionId;
16
+ this.localNodeId = props.localNodeId;
17
+ this.remoteNodeId = props.remoteNodeId;
18
+ this._trustLevel = props.trustLevel;
19
+ this.negotiatedCapabilities = props.negotiatedCapabilities;
20
+ this.createdAt = props.createdAt;
21
+ this._expiresAt = props.expiresAt;
22
+ this.heartbeatInterval = props.heartbeatInterval;
23
+ this.sessionToken = props.sessionToken;
24
+ this._metrics = { ...props.metrics };
25
+ this._lastHeartbeat = new Date();
26
+ this._active = true;
27
+ }
28
+ get trustLevel() {
29
+ return this._trustLevel;
30
+ }
31
+ get expiresAt() {
32
+ return this._expiresAt;
33
+ }
34
+ get lastHeartbeat() {
35
+ return this._lastHeartbeat;
36
+ }
37
+ get metrics() {
38
+ return this._metrics;
39
+ }
40
+ get active() {
41
+ return this._active;
42
+ }
43
+ isExpired() {
44
+ return Date.now() >= this._expiresAt.getTime();
45
+ }
46
+ isHeartbeatOverdue() {
47
+ const overdueThreshold = this.heartbeatInterval * 3;
48
+ return Date.now() - this._lastHeartbeat.getTime() > overdueThreshold;
49
+ }
50
+ recordHeartbeat() {
51
+ this._lastHeartbeat = new Date();
52
+ }
53
+ renew(newExpiresAt) {
54
+ this._expiresAt = newExpiresAt;
55
+ this._lastHeartbeat = new Date();
56
+ }
57
+ updateTrustLevel(level) {
58
+ this._trustLevel = level;
59
+ }
60
+ recordMessageSent() {
61
+ this._metrics.messagesSent++;
62
+ this._metrics.totalInteractions++;
63
+ }
64
+ recordMessageReceived() {
65
+ this._metrics.messagesReceived++;
66
+ this._metrics.totalInteractions++;
67
+ }
68
+ recordPiiRedaction() {
69
+ this._metrics.piiRedactions++;
70
+ }
71
+ recordThreatDetection() {
72
+ this._metrics.threatDetections++;
73
+ }
74
+ recordHmacFailure() {
75
+ this._metrics.hmacFailures++;
76
+ }
77
+ terminate() {
78
+ this._active = false;
79
+ }
80
+ toProps() {
81
+ return {
82
+ sessionId: this.sessionId,
83
+ localNodeId: this.localNodeId,
84
+ remoteNodeId: this.remoteNodeId,
85
+ trustLevel: this._trustLevel,
86
+ negotiatedCapabilities: this.negotiatedCapabilities,
87
+ createdAt: this.createdAt,
88
+ expiresAt: this._expiresAt,
89
+ heartbeatInterval: this.heartbeatInterval,
90
+ sessionToken: this.sessionToken,
91
+ metrics: { ...this._metrics },
92
+ };
93
+ }
94
+ static createMetrics() {
95
+ return {
96
+ messagesSent: 0,
97
+ messagesReceived: 0,
98
+ piiRedactions: 0,
99
+ threatDetections: 0,
100
+ hmacFailures: 0,
101
+ totalInteractions: 0,
102
+ };
103
+ }
104
+ }
105
+ //# sourceMappingURL=federation-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-session.js","sourceRoot":"","sources":["../../../src/domain/entities/federation-session.ts"],"names":[],"mappings":"AAwBA,MAAM,OAAO,iBAAiB;IACnB,SAAS,CAAS;IAClB,WAAW,CAAS;IACpB,YAAY,CAAS;IACrB,sBAAsB,CAAoB;IAC1C,SAAS,CAAO;IAChB,iBAAiB,CAAS;IAC1B,YAAY,CAAS;IAEtB,WAAW,CAAa;IACxB,UAAU,CAAO;IACjB,cAAc,CAAO;IACrB,QAAQ,CAAiB;IACzB,OAAO,CAAU;IAEzB,YAAY,KAA6B;QACvC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC,sBAAsB,CAAC;QAC3D,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,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;IAChC,CAAC;IAED,qBAAqB;QACnB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IACnC,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;IAC/B,CAAC;IAED,SAAS;QACP,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,OAAO;QACL,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE;SAC9B,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,OAAO;YACL,YAAY,EAAE,CAAC;YACf,gBAAgB,EAAE,CAAC;YACnB,aAAa,EAAE,CAAC;YAChB,gBAAgB,EAAE,CAAC;YACnB,YAAY,EAAE,CAAC;YACf,iBAAiB,EAAE,CAAC;SACrB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ export declare enum TrustLevel {
2
+ UNTRUSTED = 0,
3
+ VERIFIED = 1,
4
+ ATTESTED = 2,
5
+ TRUSTED = 3,
6
+ PRIVILEGED = 4
7
+ }
8
+ export interface TrustTransitionThreshold {
9
+ upgradeScore: number;
10
+ downgradeScore: number;
11
+ minInteractions: number;
12
+ }
13
+ export declare const TRUST_TRANSITION_THRESHOLDS: Record<string, TrustTransitionThreshold>;
14
+ export declare const CAPABILITY_GATES: Record<TrustLevel, readonly string[]>;
15
+ export declare function isOperationAllowed(trustLevel: TrustLevel, operation: string): boolean;
16
+ export declare function getTrustLevelLabel(level: TrustLevel): string;
17
+ //# sourceMappingURL=trust-level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust-level.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/trust-level.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,OAAO,IAAI;IACX,UAAU,IAAI;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAIhF,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAMlE,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAGrF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAS5D"}
@@ -0,0 +1,35 @@
1
+ export var TrustLevel;
2
+ (function (TrustLevel) {
3
+ TrustLevel[TrustLevel["UNTRUSTED"] = 0] = "UNTRUSTED";
4
+ TrustLevel[TrustLevel["VERIFIED"] = 1] = "VERIFIED";
5
+ TrustLevel[TrustLevel["ATTESTED"] = 2] = "ATTESTED";
6
+ TrustLevel[TrustLevel["TRUSTED"] = 3] = "TRUSTED";
7
+ TrustLevel[TrustLevel["PRIVILEGED"] = 4] = "PRIVILEGED";
8
+ })(TrustLevel || (TrustLevel = {}));
9
+ export const TRUST_TRANSITION_THRESHOLDS = {
10
+ '1->2': { upgradeScore: 0.7, downgradeScore: 0.5, minInteractions: 50 },
11
+ '2->3': { upgradeScore: 0.85, downgradeScore: 0.65, minInteractions: 500 },
12
+ '3->4': { upgradeScore: 0.95, downgradeScore: 0.8, minInteractions: 5000 },
13
+ };
14
+ export const CAPABILITY_GATES = {
15
+ [TrustLevel.UNTRUSTED]: ['discovery'],
16
+ [TrustLevel.VERIFIED]: ['discovery', 'status', 'ping'],
17
+ [TrustLevel.ATTESTED]: ['discovery', 'status', 'ping', 'send', 'receive', 'query-redacted'],
18
+ [TrustLevel.TRUSTED]: ['discovery', 'status', 'ping', 'send', 'receive', 'query-redacted', 'share-context', 'collaborative-task'],
19
+ [TrustLevel.PRIVILEGED]: ['discovery', 'status', 'ping', 'send', 'receive', 'query-redacted', 'share-context', 'collaborative-task', 'full-memory', 'remote-spawn'],
20
+ };
21
+ export function isOperationAllowed(trustLevel, operation) {
22
+ const allowed = CAPABILITY_GATES[trustLevel];
23
+ return allowed.includes(operation);
24
+ }
25
+ export function getTrustLevelLabel(level) {
26
+ const labels = {
27
+ [TrustLevel.UNTRUSTED]: 'UNTRUSTED',
28
+ [TrustLevel.VERIFIED]: 'VERIFIED',
29
+ [TrustLevel.ATTESTED]: 'ATTESTED',
30
+ [TrustLevel.TRUSTED]: 'TRUSTED',
31
+ [TrustLevel.PRIVILEGED]: 'PRIVILEGED',
32
+ };
33
+ return labels[level];
34
+ }
35
+ //# sourceMappingURL=trust-level.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust-level.js","sourceRoot":"","sources":["../../../src/domain/entities/trust-level.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,qDAAa,CAAA;IACb,mDAAY,CAAA;IACZ,mDAAY,CAAA;IACZ,iDAAW,CAAA;IACX,uDAAc,CAAA;AAChB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAQD,MAAM,CAAC,MAAM,2BAA2B,GAA6C;IACnF,MAAM,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,eAAe,EAAE,EAAE,EAAE;IACvE,MAAM,EAA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ACjC,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS;QAC/B,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,YAAY;KACtC,CAAC;IACF,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,69 @@
1
+ export type FederationAuditEventType = 'peer_discovered' | 'peer_manifest_published' | 'handshake_initiated' | 'handshake_completed' | 'handshake_failed' | 'handshake_rejected' | 'session_created' | 'session_renewed' | 'session_expired' | 'session_terminated' | 'message_sent' | 'message_received' | 'message_rejected' | 'message_timeout' | 'pii_detected' | 'pii_stripped' | 'pii_blocked' | 'threat_detected' | 'threat_blocked' | 'threat_learned' | 'claim_checked' | 'claim_denied' | 'trust_level_changed' | 'consensus_proposed' | 'consensus_voted' | 'consensus_reached' | 'consensus_failed';
2
+ export type AuditSeverity = 'info' | 'warn' | 'error' | 'critical';
3
+ export type AuditCategory = 'discovery' | 'handshake' | 'message' | 'pii' | 'security' | 'consensus';
4
+ export type ComplianceMode = 'hipaa' | 'soc2' | 'gdpr' | 'none';
5
+ export interface FederationAuditEvent {
6
+ readonly eventId: string;
7
+ readonly timestamp: string;
8
+ readonly nodeId: string;
9
+ readonly sessionId?: string;
10
+ readonly eventType: FederationAuditEventType;
11
+ readonly severity: AuditSeverity;
12
+ readonly category: AuditCategory;
13
+ readonly sourceNodeId?: string;
14
+ readonly targetNodeId?: string;
15
+ readonly agentId?: string;
16
+ readonly trustLevel?: number;
17
+ readonly piiDetected?: boolean;
18
+ readonly piiTypesFound?: string[];
19
+ readonly piiAction?: string;
20
+ readonly threatDetected?: boolean;
21
+ readonly threatTypes?: string[];
22
+ readonly claimsChecked?: string[];
23
+ readonly claimsResult?: 'granted' | 'denied';
24
+ readonly latencyMs?: number;
25
+ readonly messageSizeBytes?: number;
26
+ readonly complianceMode?: ComplianceMode;
27
+ readonly dataResidency?: string;
28
+ readonly metadata?: Record<string, unknown>;
29
+ }
30
+ export interface AuditQuery {
31
+ readonly eventType?: FederationAuditEventType;
32
+ readonly severity?: AuditSeverity;
33
+ readonly category?: AuditCategory;
34
+ readonly nodeId?: string;
35
+ readonly sessionId?: string;
36
+ readonly since?: Date;
37
+ readonly until?: Date;
38
+ readonly limit?: number;
39
+ readonly offset?: number;
40
+ }
41
+ export type AuditExportFormat = 'json' | 'csv' | 'ndjson';
42
+ export interface AuditServiceDeps {
43
+ generateEventId: () => string;
44
+ getLocalNodeId: () => string;
45
+ persistEvent: (event: FederationAuditEvent) => Promise<void>;
46
+ queryEvents: (query: AuditQuery) => Promise<FederationAuditEvent[]>;
47
+ onAuditEvent?: (event: FederationAuditEvent) => void;
48
+ }
49
+ export interface AuditServiceConfig {
50
+ readonly complianceMode: ComplianceMode;
51
+ readonly dataResidency?: string;
52
+ readonly retentionDays: number;
53
+ readonly batchSize: number;
54
+ }
55
+ export declare class AuditService {
56
+ private readonly deps;
57
+ private readonly config;
58
+ private readonly buffer;
59
+ constructor(deps: AuditServiceDeps, config?: Partial<AuditServiceConfig>);
60
+ log(eventType: FederationAuditEventType, details?: Partial<Omit<FederationAuditEvent, 'eventId' | 'timestamp' | 'nodeId' | 'eventType' | 'severity' | 'category' | 'complianceMode'>>): Promise<FederationAuditEvent>;
61
+ query(query: AuditQuery): Promise<FederationAuditEvent[]>;
62
+ export(query: AuditQuery, format: AuditExportFormat): Promise<string>;
63
+ flush(): Promise<void>;
64
+ getBufferSize(): number;
65
+ private buildEvent;
66
+ private applyHipaaCompliance;
67
+ private toCsv;
68
+ }
69
+ //# sourceMappingURL=audit-service.d.ts.map