@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,8 @@
1
+ /**
2
+ * Security Domain Layer - Public Exports
3
+ *
4
+ * @module v3/security/domain
5
+ */
6
+ export { SecurityContext, type PermissionLevel, type SecurityContextProps, } from './entities/security-context.js';
7
+ export { SecurityDomainService, type ValidationResult, type ThreatDetectionResult, } from './services/security-domain-service.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,uCAAuC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Security Domain Layer - Public Exports
3
+ *
4
+ * @module v3/security/domain
5
+ */
6
+ export { SecurityContext, } from './entities/security-context.js';
7
+ export { SecurityDomainService, } from './services/security-domain-service.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,GAGhB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,qBAAqB,GAGtB,MAAM,uCAAuC,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Security Domain Service - Domain Layer
3
+ *
4
+ * Contains security logic for validation, policy enforcement, and threat detection.
5
+ *
6
+ * @module v3/security/domain/services
7
+ */
8
+ import { SecurityContext } from '../entities/security-context.js';
9
+ /**
10
+ * Validation result
11
+ */
12
+ export interface ValidationResult {
13
+ valid: boolean;
14
+ errors: string[];
15
+ warnings: string[];
16
+ sanitized?: string;
17
+ }
18
+ /**
19
+ * Threat detection result
20
+ */
21
+ export interface ThreatDetectionResult {
22
+ safe: boolean;
23
+ threats: Array<{
24
+ type: string;
25
+ severity: 'low' | 'medium' | 'high' | 'critical';
26
+ description: string;
27
+ location?: string;
28
+ }>;
29
+ }
30
+ /**
31
+ * Security Domain Service
32
+ */
33
+ export declare class SecurityDomainService {
34
+ private static readonly PATH_TRAVERSAL_PATTERNS;
35
+ private static readonly DANGEROUS_COMMANDS;
36
+ private static readonly SQL_INJECTION_PATTERNS;
37
+ private static readonly XSS_PATTERNS;
38
+ /**
39
+ * Validate a file path
40
+ */
41
+ validatePath(path: string, context: SecurityContext): ValidationResult;
42
+ /**
43
+ * Validate a command
44
+ */
45
+ validateCommand(command: string, context: SecurityContext): ValidationResult;
46
+ /**
47
+ * Validate user input
48
+ */
49
+ validateInput(input: string): ValidationResult;
50
+ /**
51
+ * Detect threats in content
52
+ */
53
+ detectThreats(content: string): ThreatDetectionResult;
54
+ /**
55
+ * Sanitize path
56
+ */
57
+ private sanitizePath;
58
+ /**
59
+ * Sanitize command
60
+ */
61
+ private sanitizeCommand;
62
+ /**
63
+ * Sanitize user input
64
+ */
65
+ private sanitizeInput;
66
+ /**
67
+ * Create security context for agent
68
+ */
69
+ createAgentContext(agentId: string, role: string, customPaths?: string[]): SecurityContext;
70
+ }
71
+ //# sourceMappingURL=security-domain-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-domain-service.d.ts","sourceRoot":"","sources":["../../../src/domain/services/security-domain-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAmB,MAAM,iCAAiC,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;QACjD,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAEhC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAQ7C;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAYxC;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAO5C;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAOlC;IAEF;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,gBAAgB;IA6BtE;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,gBAAgB;IAiC5E;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAiC9C;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB;IA0CrD;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;OAEG;IACH,kBAAkB,CAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,eAAe;CAuBnB"}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Security Domain Service - Domain Layer
3
+ *
4
+ * Contains security logic for validation, policy enforcement, and threat detection.
5
+ *
6
+ * @module v3/security/domain/services
7
+ */
8
+ import { SecurityContext } from '../entities/security-context.js';
9
+ /**
10
+ * Security Domain Service
11
+ */
12
+ export class SecurityDomainService {
13
+ // Dangerous patterns for path traversal
14
+ static PATH_TRAVERSAL_PATTERNS = [
15
+ /\.\./,
16
+ /~\//,
17
+ /^\/etc\//,
18
+ /^\/tmp\//,
19
+ /^\/var\/log\//,
20
+ /^C:\\Windows/i,
21
+ /^C:\\Users\\[^\\]+\\AppData/i,
22
+ ];
23
+ // Dangerous command patterns
24
+ static DANGEROUS_COMMANDS = [
25
+ /^rm\s+-rf\s+\//,
26
+ /^rm\s+-rf\s+\*/,
27
+ /^dd\s+if=/,
28
+ /^mkfs\./,
29
+ /^format\s+/i,
30
+ /^del\s+\/s\s+\/q/i,
31
+ />\s*\/dev\/sd[a-z]/,
32
+ /\|\s*bash$/,
33
+ /\|\s*sh$/,
34
+ /eval\s*\(/,
35
+ /exec\s*\(/,
36
+ ];
37
+ // SQL injection patterns
38
+ static SQL_INJECTION_PATTERNS = [
39
+ /'\s*OR\s+'1'\s*=\s*'1/i,
40
+ /'\s*OR\s+1\s*=\s*1/i,
41
+ /;\s*DROP\s+TABLE/i,
42
+ /;\s*DELETE\s+FROM/i,
43
+ /UNION\s+SELECT/i,
44
+ /--\s*$/,
45
+ ];
46
+ // XSS patterns
47
+ static XSS_PATTERNS = [
48
+ /<script[\s>]/i,
49
+ /javascript:/i,
50
+ /on\w+\s*=/i,
51
+ /<iframe/i,
52
+ /<object/i,
53
+ /<embed/i,
54
+ ];
55
+ /**
56
+ * Validate a file path
57
+ */
58
+ validatePath(path, context) {
59
+ const errors = [];
60
+ const warnings = [];
61
+ // Check path traversal
62
+ for (const pattern of SecurityDomainService.PATH_TRAVERSAL_PATTERNS) {
63
+ if (pattern.test(path)) {
64
+ errors.push(`Path traversal detected: ${pattern.source}`);
65
+ }
66
+ }
67
+ // Check context permissions
68
+ if (!context.canAccessPath(path)) {
69
+ errors.push(`Access denied to path: ${path}`);
70
+ }
71
+ // Check for suspicious paths
72
+ if (path.includes('..')) {
73
+ warnings.push('Path contains parent directory reference');
74
+ }
75
+ return {
76
+ valid: errors.length === 0,
77
+ errors,
78
+ warnings,
79
+ sanitized: this.sanitizePath(path),
80
+ };
81
+ }
82
+ /**
83
+ * Validate a command
84
+ */
85
+ validateCommand(command, context) {
86
+ const errors = [];
87
+ const warnings = [];
88
+ // Check dangerous commands
89
+ for (const pattern of SecurityDomainService.DANGEROUS_COMMANDS) {
90
+ if (pattern.test(command)) {
91
+ errors.push(`Dangerous command pattern detected: ${pattern.source}`);
92
+ }
93
+ }
94
+ // Check context permissions
95
+ if (!context.canExecuteCommand(command)) {
96
+ errors.push(`Command execution denied: ${command}`);
97
+ }
98
+ if (!context.hasPermission('execute')) {
99
+ errors.push('Execute permission required');
100
+ }
101
+ // Check for shell injection
102
+ if (/[;&|`$(){}]/.test(command)) {
103
+ warnings.push('Command contains shell metacharacters');
104
+ }
105
+ return {
106
+ valid: errors.length === 0,
107
+ errors,
108
+ warnings,
109
+ sanitized: this.sanitizeCommand(command),
110
+ };
111
+ }
112
+ /**
113
+ * Validate user input
114
+ */
115
+ validateInput(input) {
116
+ const errors = [];
117
+ const warnings = [];
118
+ // Check for SQL injection
119
+ for (const pattern of SecurityDomainService.SQL_INJECTION_PATTERNS) {
120
+ if (pattern.test(input)) {
121
+ errors.push(`SQL injection pattern detected`);
122
+ break;
123
+ }
124
+ }
125
+ // Check for XSS
126
+ for (const pattern of SecurityDomainService.XSS_PATTERNS) {
127
+ if (pattern.test(input)) {
128
+ errors.push(`XSS pattern detected`);
129
+ break;
130
+ }
131
+ }
132
+ // Check length
133
+ if (input.length > 10000) {
134
+ warnings.push('Input exceeds recommended length');
135
+ }
136
+ return {
137
+ valid: errors.length === 0,
138
+ errors,
139
+ warnings,
140
+ sanitized: this.sanitizeInput(input),
141
+ };
142
+ }
143
+ /**
144
+ * Detect threats in content
145
+ */
146
+ detectThreats(content) {
147
+ const threats = [];
148
+ // Check for various threat patterns
149
+ if (/<script/i.test(content)) {
150
+ threats.push({
151
+ type: 'xss',
152
+ severity: 'high',
153
+ description: 'Script tag detected',
154
+ });
155
+ }
156
+ if (/password\s*[:=]\s*["'][^"']+["']/i.test(content)) {
157
+ threats.push({
158
+ type: 'credential-exposure',
159
+ severity: 'critical',
160
+ description: 'Hardcoded password detected',
161
+ });
162
+ }
163
+ if (/api[_-]?key\s*[:=]\s*["'][^"']+["']/i.test(content)) {
164
+ threats.push({
165
+ type: 'credential-exposure',
166
+ severity: 'critical',
167
+ description: 'API key detected',
168
+ });
169
+ }
170
+ if (/eval\s*\(/.test(content)) {
171
+ threats.push({
172
+ type: 'code-injection',
173
+ severity: 'high',
174
+ description: 'Eval statement detected',
175
+ });
176
+ }
177
+ return {
178
+ safe: threats.length === 0,
179
+ threats,
180
+ };
181
+ }
182
+ /**
183
+ * Sanitize path
184
+ */
185
+ sanitizePath(path) {
186
+ return path
187
+ .replace(/\.\./g, '')
188
+ .replace(/\/\//g, '/')
189
+ .replace(/^~\//, '')
190
+ .trim();
191
+ }
192
+ /**
193
+ * Sanitize command
194
+ */
195
+ sanitizeCommand(command) {
196
+ return command
197
+ .replace(/[;&|`$]/g, '')
198
+ .replace(/\$\([^)]*\)/g, '')
199
+ .trim();
200
+ }
201
+ /**
202
+ * Sanitize user input
203
+ */
204
+ sanitizeInput(input) {
205
+ return input
206
+ .replace(/</g, '&lt;')
207
+ .replace(/>/g, '&gt;')
208
+ .replace(/"/g, '&quot;')
209
+ .replace(/'/g, '&#x27;')
210
+ .replace(/\//g, '&#x2F;');
211
+ }
212
+ /**
213
+ * Create security context for agent
214
+ */
215
+ createAgentContext(agentId, role, customPaths) {
216
+ // Default permissions based on role
217
+ const rolePermissions = {
218
+ 'queen-coordinator': ['read', 'write', 'execute', 'admin'],
219
+ 'security-architect': ['read', 'write', 'execute', 'admin'],
220
+ 'coder': ['read', 'write', 'execute'],
221
+ 'reviewer': ['read'],
222
+ 'tester': ['read', 'execute'],
223
+ default: ['read'],
224
+ };
225
+ const permissions = rolePermissions[role] ?? rolePermissions.default;
226
+ return SecurityContext.create({
227
+ principalId: agentId,
228
+ principalType: 'agent',
229
+ permissions,
230
+ allowedPaths: customPaths ?? ['./src', './tests', './docs'],
231
+ blockedPaths: ['/etc', '/var', '~/', '../'],
232
+ allowedCommands: ['npm', 'node', 'git', 'vitest'],
233
+ blockedCommands: ['rm -rf /', 'dd', 'mkfs', 'format'],
234
+ });
235
+ }
236
+ }
237
+ //# sourceMappingURL=security-domain-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-domain-service.js","sourceRoot":"","sources":["../../../src/domain/services/security-domain-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAmB,MAAM,iCAAiC,CAAC;AAyBnF;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAChC,wCAAwC;IAChC,MAAM,CAAU,uBAAuB,GAAG;QAChD,MAAM;QACN,KAAK;QACL,UAAU;QACV,UAAU;QACV,eAAe;QACf,eAAe;QACf,8BAA8B;KAC/B,CAAC;IAEF,6BAA6B;IACrB,MAAM,CAAU,kBAAkB,GAAG;QAC3C,gBAAgB;QAChB,gBAAgB;QAChB,WAAW;QACX,SAAS;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OAAO,EAAE,SAAS,CAAC;YACrC,UAAU,EAAE,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;YAC7B,OAAO,EAAE,CAAC,MAAM,CAAC;SAClB,CAAC;QAEF,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC;QAErE,OAAO,eAAe,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,OAAO;YACpB,aAAa,EAAE,OAAO;YACtB,WAAW;YACX,YAAY,EAAE,WAAW,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;YAC3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC;YAC3C,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;YACjD,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC;SACtD,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * V3 Security Module
3
+ *
4
+ * Comprehensive security module addressing all identified vulnerabilities:
5
+ * - CVE-2: Weak Password Hashing (password-hasher.ts)
6
+ * - CVE-3: Hardcoded Default Credentials (credential-generator.ts)
7
+ * - HIGH-1: Command Injection (safe-executor.ts)
8
+ * - HIGH-2: Path Traversal (path-validator.ts)
9
+ *
10
+ * Also provides:
11
+ * - Input validation with Zod schemas
12
+ * - Secure token generation
13
+ *
14
+ * @module v3/security
15
+ */
16
+ export { PasswordHasher, PasswordHashError, createPasswordHasher, type PasswordHasherConfig, type PasswordValidationResult, } from './password-hasher.js';
17
+ export { CredentialGenerator, CredentialGeneratorError, createCredentialGenerator, generateCredentials, type CredentialConfig, type GeneratedCredentials, type ApiKeyCredential, } from './credential-generator.js';
18
+ export { SafeExecutor, SafeExecutorError, createDevelopmentExecutor, createReadOnlyExecutor, type ExecutorConfig, type ExecutionResult, type StreamingExecutor, } from './safe-executor.js';
19
+ export { PathValidator, PathValidatorError, createProjectPathValidator, createFullProjectPathValidator, type PathValidatorConfig, type PathValidationResult, } from './path-validator.js';
20
+ export { InputValidator, sanitizeString, sanitizeHtml, sanitizePath, SafeStringSchema, IdentifierSchema, FilenameSchema, EmailSchema, PasswordSchema, UUIDSchema, HttpsUrlSchema, UrlSchema, SemverSchema, PortSchema, IPv4Schema, IPSchema, UserRoleSchema, PermissionSchema, LoginRequestSchema, CreateUserSchema, CreateApiKeySchema, AgentTypeSchema, SpawnAgentSchema, TaskInputSchema, CommandArgumentSchema, PathSchema, SecurityConfigSchema, ExecutorConfigSchema, PATTERNS, LIMITS, z, } from './input-validator.js';
21
+ export { TokenGenerator, TokenGeneratorError, createTokenGenerator, getDefaultGenerator, quickGenerate, type TokenConfig, type Token, type SignedToken, type VerificationCode, } from './token-generator.js';
22
+ export { ToolOutputGuardrail, createToolOutputGuardrail, isToolOutputSafe, type GuardrailConfig, type GuardrailResult, type GuardrailAction, type InjectionFinding, type InjectionSeverity, type InjectionCategory, } from './tool-output-guardrail.js';
23
+ export { AgentAuthorizationPropagator, AuthorizationPropagationError, makeLegacyPermissiveScope, type AuthScope, type SendMessageEnvelope, type ToolCallDecision, } from './authorization/propagator.js';
24
+ export * from './policy/index.js';
25
+ export { CLIENT_ID as OAUTH_CLIENT_ID, SCOPE as OAUTH_SCOPE, OOB_REDIRECT_URI, OAuthError, authorizeUrl, exchangeCode, refreshToken, exchangeManualCode, type TokenResponse as OAuthTokenResponse, } from './oauth/client.js';
26
+ export { generate as generatePkce, challengeFromVerifier, type PkceRequest } from './oauth/pkce.js';
27
+ export { CallbackServer, CallbackTimeoutError, type CallbackResult } from './oauth/callback-server.js';
28
+ export { openBrowser } from './oauth/browser.js';
29
+ export { createKeychainAdapter, SessionOnlyKeychainAdapter, type KeychainAdapter, } from './keychain-adapter.js';
30
+ export { PluginIntegrityVerifier, canonicalize, hashManifest, fingerprint, findAnchor, type PluginManifest, type SignedPluginManifest, type TrustAnchor, type TrustAnchors, type VerificationStatus, type VerificationResult, type VerifierConfig, } from './plugins/integrity-verifier.js';
31
+ export { inspectToolComposition, evaluateToolComposition, isCompositionBlockEnabled, fnv1a64, simhash64, hammingDistance64, type McpToolDescriptor, type CompositionInspectorOptions, type CompositionFinding, type CompositionInspectionStats, type CompositionInspectionResult, type CompositionGuardResult, } from './mcp-composition-inspector.js';
32
+ import { PasswordHasher } from './password-hasher.js';
33
+ import { CredentialGenerator } from './credential-generator.js';
34
+ import { SafeExecutor } from './safe-executor.js';
35
+ import { PathValidator } from './path-validator.js';
36
+ import { TokenGenerator } from './token-generator.js';
37
+ /**
38
+ * Security module configuration
39
+ */
40
+ export interface SecurityModuleConfig {
41
+ /**
42
+ * Project root directory for path validation
43
+ */
44
+ projectRoot: string;
45
+ /**
46
+ * HMAC secret for token signing
47
+ */
48
+ hmacSecret: string;
49
+ /**
50
+ * Bcrypt rounds for password hashing
51
+ * Default: 12
52
+ */
53
+ bcryptRounds?: number;
54
+ /**
55
+ * Allowed commands for safe executor
56
+ * Default: ['git', 'npm', 'node']
57
+ */
58
+ allowedCommands?: string[];
59
+ }
60
+ /**
61
+ * Complete security module instance
62
+ */
63
+ export interface SecurityModule {
64
+ passwordHasher: PasswordHasher;
65
+ credentialGenerator: CredentialGenerator;
66
+ safeExecutor: SafeExecutor;
67
+ pathValidator: PathValidator;
68
+ tokenGenerator: TokenGenerator;
69
+ }
70
+ /**
71
+ * Creates a complete security module with all components configured.
72
+ *
73
+ * @param config - Module configuration
74
+ * @returns Complete security module
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const security = createSecurityModule({
79
+ * projectRoot: '/workspaces/project',
80
+ * hmacSecret: process.env.HMAC_SECRET!,
81
+ * });
82
+ *
83
+ * // Hash password
84
+ * const hash = await security.passwordHasher.hash('password');
85
+ *
86
+ * // Validate path
87
+ * const result = await security.pathValidator.validate('/workspaces/project/src/file.ts');
88
+ *
89
+ * // Execute command safely
90
+ * const output = await security.safeExecutor.execute('git', ['status']);
91
+ * ```
92
+ */
93
+ export declare function createSecurityModule(config: SecurityModuleConfig): SecurityModule;
94
+ /**
95
+ * Minimum recommended bcrypt rounds for production
96
+ */
97
+ export declare const MIN_BCRYPT_ROUNDS = 12;
98
+ /**
99
+ * Maximum recommended bcrypt rounds (performance consideration)
100
+ */
101
+ export declare const MAX_BCRYPT_ROUNDS = 14;
102
+ /**
103
+ * Minimum password length
104
+ */
105
+ export declare const MIN_PASSWORD_LENGTH = 8;
106
+ /**
107
+ * Maximum password length (bcrypt limitation)
108
+ */
109
+ export declare const MAX_PASSWORD_LENGTH = 72;
110
+ /**
111
+ * Default token expiration in seconds (1 hour)
112
+ */
113
+ export declare const DEFAULT_TOKEN_EXPIRATION = 3600;
114
+ /**
115
+ * Default session expiration in seconds (24 hours)
116
+ */
117
+ export declare const DEFAULT_SESSION_EXPIRATION = 86400;
118
+ /**
119
+ * Checks security configuration for common issues.
120
+ *
121
+ * @param config - Configuration to audit
122
+ * @returns Array of security warnings
123
+ */
124
+ export declare function auditSecurityConfig(config: Partial<SecurityModuleConfig>): string[];
125
+ /**
126
+ * Security module version
127
+ */
128
+ export declare const SECURITY_MODULE_VERSION = "3.0.0-alpha.1";
129
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,YAAY,EACZ,iBAAi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EtD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAiBjF;AAMD;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAMhD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,MAAM,EAAE,CAoBnF;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,kBAAkB,CAAC"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * V3 Security Module
3
+ *
4
+ * Comprehensive security module addressing all identified vulnerabilities:
5
+ * - CVE-2: Weak Password Hashing (password-hasher.ts)
6
+ * - CVE-3: Hardcoded Default Credentials (credential-generator.ts)
7
+ * - HIGH-1: Command Injection (safe-executor.ts)
8
+ * - HIGH-2: Path Traversal (path-validator.ts)
9
+ *
10
+ * Also provides:
11
+ * - Input validation with Zod schemas
12
+ * - Secure token generation
13
+ *
14
+ * @module v3/security
15
+ */
16
+ // Password Hashing (CVE-2 Fix)
17
+ export { PasswordHasher, PasswordHashError, createPasswordHasher, } from './password-hasher.js';
18
+ // Credential Generation (CVE-3 Fix)
19
+ export { CredentialGenerator, CredentialGeneratorError, createCredentialGenerator, generateCredentials, } from './credential-generator.js';
20
+ // Safe Command Execution (HIGH-1 Fix)
21
+ export { SafeExecutor, SafeExecutorError, createDevelopmentExecutor, createReadOnlyExecutor, } from './safe-executor.js';
22
+ // Path Validation (HIGH-2 Fix)
23
+ export { PathValidator, PathValidatorError, createProjectPathValidator, createFullProjectPathValidator, } from './path-validator.js';
24
+ // Input Validation
25
+ export { InputValidator, sanitizeString, sanitizeHtml, sanitizePath,
26
+ // Base schemas
27
+ SafeStringSchema, IdentifierSchema, FilenameSchema, EmailSchema, PasswordSchema, UUIDSchema, HttpsUrlSchema, UrlSchema, SemverSchema, PortSchema, IPv4Schema, IPSchema,
28
+ // Auth schemas
29
+ UserRoleSchema, PermissionSchema, LoginRequestSchema, CreateUserSchema, CreateApiKeySchema,
30
+ // Agent & Task schemas
31
+ AgentTypeSchema, SpawnAgentSchema, TaskInputSchema,
32
+ // Command & Path schemas
33
+ CommandArgumentSchema, PathSchema,
34
+ // Config schemas
35
+ SecurityConfigSchema, ExecutorConfigSchema,
36
+ // Utilities
37
+ PATTERNS, LIMITS, z, } from './input-validator.js';
38
+ // Token Generation
39
+ export { TokenGenerator, TokenGeneratorError, createTokenGenerator, getDefaultGenerator, quickGenerate, } from './token-generator.js';
40
+ // Tool-Output Guardrail (ADR-131 — closes OWASP ASI01 gap; ruvnet/ruflo#2149)
41
+ export { ToolOutputGuardrail, createToolOutputGuardrail, isToolOutputSafe, } from './tool-output-guardrail.js';
42
+ // Agent Authorization Propagation (ADR-144 P1 — ruvnet/ruflo#2248)
43
+ // Action-layer: SendMessage envelope + per-action scope check + MCP server
44
+ // identity probe. Wraps the comms layer in P2; wraps the dispatcher in P3.
45
+ export { AgentAuthorizationPropagator, AuthorizationPropagationError, makeLegacyPermissiveScope, } from './authorization/propagator.js';
46
+ // Agentic Policy Engine (ADR-324)
47
+ // Deterministic policy evaluation, monotonic capability envelopes, approvals,
48
+ // budgets, and tamper-evident decision receipts. Legacy mode preserves the
49
+ // behavior of pre-ADR-324 installations until enforcement is explicitly enabled.
50
+ export * from './policy/index.js';
51
+ // OAuth 2.0 + PKCE + OS Keychain (ADR-306)
52
+ // A TypeScript port of meta-proxy's proven oauth/{client,pkce,browser,
53
+ // callback_server}.rs — see src/oauth/client.ts for why this targets the
54
+ // live auth.cognitum.one surface rather than ADR-308's unconfirmed spec.
55
+ export { CLIENT_ID as OAUTH_CLIENT_ID, SCOPE as OAUTH_SCOPE, OOB_REDIRECT_URI, OAuthError, authorizeUrl, exchangeCode, refreshToken, exchangeManualCode, } from './oauth/client.js';
56
+ export { generate as generatePkce, challengeFromVerifier } from './oauth/pkce.js';
57
+ export { CallbackServer, CallbackTimeoutError } from './oauth/callback-server.js';
58
+ export { openBrowser } from './oauth/browser.js';
59
+ // OS Keychain Adapter (ADR-306)
60
+ export { createKeychainAdapter, SessionOnlyKeychainAdapter, } from './keychain-adapter.js';
61
+ // Plugin Integrity Verifier (ADR-145 P1 — ruvnet/ruflo#2254)
62
+ // Install-layer: Ed25519 signature verification + trust-anchor allowlist.
63
+ // Stage-2 semantic-intent scan (SCH defence) lands in P2.
64
+ export { PluginIntegrityVerifier, canonicalize, hashManifest, fingerprint, findAnchor, } from './plugins/integrity-verifier.js';
65
+ // MCP Tool Composition Inspector (ADR-320 — ruvnet/ruflo dream-cycle,
66
+ // arXiv:2606.27027 "ShareLock"). SimHash-based cross-tool instruction
67
+ // fragment detector — the v2 successor to the CLI-only v1 in
68
+ // @claude-flow/cli/src/security/mcp-composition-inspector.ts (#2783),
69
+ // whose own header deferred exactly this ("Future v2: SimHash + LSH").
70
+ export { inspectToolComposition, evaluateToolComposition, isCompositionBlockEnabled, fnv1a64, simhash64, hammingDistance64, } from './mcp-composition-inspector.js';
71
+ // ============================================================================
72
+ // Convenience Factory Functions
73
+ // ============================================================================
74
+ import { PasswordHasher } from './password-hasher.js';
75
+ import { CredentialGenerator } from './credential-generator.js';
76
+ import { SafeExecutor } from './safe-executor.js';
77
+ import { PathValidator } from './path-validator.js';
78
+ import { TokenGenerator } from './token-generator.js';
79
+ /**
80
+ * Creates a complete security module with all components configured.
81
+ *
82
+ * @param config - Module configuration
83
+ * @returns Complete security module
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * const security = createSecurityModule({
88
+ * projectRoot: '/workspaces/project',
89
+ * hmacSecret: process.env.HMAC_SECRET!,
90
+ * });
91
+ *
92
+ * // Hash password
93
+ * const hash = await security.passwordHasher.hash('password');
94
+ *
95
+ * // Validate path
96
+ * const result = await security.pathValidator.validate('/workspaces/project/src/file.ts');
97
+ *
98
+ * // Execute command safely
99
+ * const output = await security.safeExecutor.execute('git', ['status']);
100
+ * ```
101
+ */
102
+ export function createSecurityModule(config) {
103
+ return {
104
+ passwordHasher: new PasswordHasher({
105
+ rounds: config.bcryptRounds ?? 12,
106
+ }),
107
+ credentialGenerator: new CredentialGenerator(),
108
+ safeExecutor: new SafeExecutor({
109
+ allowedCommands: config.allowedCommands ?? ['git', 'npm', 'node'],
110
+ }),
111
+ pathValidator: new PathValidator({
112
+ allowedPrefixes: [config.projectRoot],
113
+ allowHidden: true,
114
+ }),
115
+ tokenGenerator: new TokenGenerator({
116
+ hmacSecret: config.hmacSecret,
117
+ }),
118
+ };
119
+ }
120
+ // ============================================================================
121
+ // Security Constants
122
+ // ============================================================================
123
+ /**
124
+ * Minimum recommended bcrypt rounds for production
125
+ */
126
+ export const MIN_BCRYPT_ROUNDS = 12;
127
+ /**
128
+ * Maximum recommended bcrypt rounds (performance consideration)
129
+ */
130
+ export const MAX_BCRYPT_ROUNDS = 14;
131
+ /**
132
+ * Minimum password length
133
+ */
134
+ export const MIN_PASSWORD_LENGTH = 8;
135
+ /**
136
+ * Maximum password length (bcrypt limitation)
137
+ */
138
+ export const MAX_PASSWORD_LENGTH = 72;
139
+ /**
140
+ * Default token expiration in seconds (1 hour)
141
+ */
142
+ export const DEFAULT_TOKEN_EXPIRATION = 3600;
143
+ /**
144
+ * Default session expiration in seconds (24 hours)
145
+ */
146
+ export const DEFAULT_SESSION_EXPIRATION = 86400;
147
+ // ============================================================================
148
+ // Security Audit Helper
149
+ // ============================================================================
150
+ /**
151
+ * Checks security configuration for common issues.
152
+ *
153
+ * @param config - Configuration to audit
154
+ * @returns Array of security warnings
155
+ */
156
+ export function auditSecurityConfig(config) {
157
+ const warnings = [];
158
+ if (config.bcryptRounds && config.bcryptRounds < MIN_BCRYPT_ROUNDS) {
159
+ warnings.push(`bcryptRounds (${config.bcryptRounds}) below recommended minimum (${MIN_BCRYPT_ROUNDS})`);
160
+ }
161
+ if (config.hmacSecret && config.hmacSecret.length < 32) {
162
+ warnings.push('hmacSecret should be at least 32 characters');
163
+ }
164
+ if (!config.projectRoot) {
165
+ warnings.push('projectRoot not configured - path validation may be disabled');
166
+ }
167
+ if (config.allowedCommands && config.allowedCommands.length === 0) {
168
+ warnings.push('No commands allowed - executor will reject all commands');
169
+ }
170
+ return warnings;
171
+ }
172
+ /**
173
+ * Security module version
174
+ */
175
+ export const SECURITY_MODULE_VERSION = '3.0.0-alpha.1';
176
+ //# sourceMappingURL=index.js.map