claude-flow 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 (400) hide show
  1. package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
  2. package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
  3. package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
  4. package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
  5. package/node_modules/@claude-flow/codex/README.md +1044 -0
  6. package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
  7. package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
  8. package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
  9. package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
  10. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
  11. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
  12. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
  13. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
  14. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
  15. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
  16. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
  17. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
  18. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
  19. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
  20. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
  21. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
  22. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
  23. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
  24. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
  25. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
  26. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
  27. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
  28. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
  29. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
  30. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
  31. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
  32. package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
  33. package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
  34. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
  35. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
  36. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
  37. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
  38. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
  39. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
  40. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
  41. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
  42. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
  43. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
  44. package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
  45. package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
  46. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
  47. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
  48. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
  49. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
  50. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
  51. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
  52. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
  53. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
  54. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
  55. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
  56. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
  57. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
  58. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
  59. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
  60. package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
  61. package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
  62. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
  63. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
  64. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
  65. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
  66. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
  67. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
  68. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
  69. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
  70. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
  71. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
  72. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
  73. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
  74. package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
  75. package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
  76. package/node_modules/@claude-flow/codex/dist/index.js +54 -0
  77. package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
  78. package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
  79. package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
  80. package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
  81. package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
  82. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
  83. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
  84. package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
  85. package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
  86. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
  87. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
  88. package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
  89. package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
  90. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
  91. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
  92. package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
  93. package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
  94. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
  95. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
  96. package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
  97. package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
  98. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
  99. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
  100. package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
  101. package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
  102. package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
  103. package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
  104. package/node_modules/@claude-flow/codex/dist/types.js +8 -0
  105. package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
  106. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
  107. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
  108. package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
  109. package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
  110. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
  111. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
  112. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
  113. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
  114. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
  115. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
  116. package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
  117. package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
  118. package/node_modules/@claude-flow/codex/package.json +122 -0
  119. package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
  120. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
  121. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
  122. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
  123. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
  124. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
  125. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
  126. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
  127. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
  128. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
  129. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
  130. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
  131. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
  132. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
  133. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
  134. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
  135. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
  136. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
  137. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
  138. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
  139. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
  140. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
  141. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
  142. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
  143. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
  144. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
  145. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
  146. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
  147. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
  148. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
  149. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
  150. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
  151. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
  152. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
  153. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
  154. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
  155. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
  156. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
  157. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
  158. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
  159. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
  160. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
  161. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
  162. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
  163. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
  164. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
  165. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
  166. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
  167. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
  168. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
  169. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
  170. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
  171. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
  172. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
  173. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
  174. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
  175. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
  176. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
  177. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
  178. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
  179. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
  180. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
  181. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
  182. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
  183. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
  184. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
  185. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
  186. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
  187. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
  188. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
  189. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
  190. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
  191. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
  192. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
  193. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
  194. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
  195. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
  196. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
  197. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
  198. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
  199. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
  200. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
  201. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
  202. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
  203. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
  204. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
  205. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
  206. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
  207. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
  208. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
  209. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
  210. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
  211. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
  212. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
  213. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
  214. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
  215. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
  216. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
  217. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
  218. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
  219. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
  220. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
  221. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
  222. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
  223. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
  224. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
  225. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
  226. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
  227. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
  228. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
  229. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
  230. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
  231. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
  232. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
  233. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
  234. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
  235. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
  236. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
  237. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
  238. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
  239. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
  240. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
  241. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
  242. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
  243. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
  244. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
  245. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
  246. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
  247. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
  248. package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
  249. package/node_modules/@claude-flow/security/README.md +292 -0
  250. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
  251. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
  252. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
  253. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
  254. package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
  255. package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
  256. package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
  257. package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
  258. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
  259. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
  260. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
  261. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
  262. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
  263. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
  264. package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
  265. package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
  266. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
  267. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
  268. package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
  269. package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
  270. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
  271. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
  272. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
  273. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
  274. package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
  275. package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
  276. package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
  277. package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
  278. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
  279. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
  280. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
  281. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
  282. package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
  283. package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
  284. package/node_modules/@claude-flow/security/dist/index.js +176 -0
  285. package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
  286. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
  287. package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
  288. package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
  289. package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
  290. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
  291. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
  292. package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
  293. package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
  294. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
  295. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
  296. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
  297. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
  298. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
  299. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
  300. package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
  301. package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
  302. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
  303. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
  304. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
  305. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
  306. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
  307. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
  308. package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
  309. package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
  310. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
  311. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
  312. package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
  313. package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
  314. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
  315. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
  316. package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
  317. package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
  318. package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
  319. package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
  320. package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
  321. package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
  322. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
  323. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
  324. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
  325. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
  326. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
  327. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
  328. package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
  329. package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
  330. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
  331. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
  332. package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
  333. package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
  334. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
  335. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
  336. package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
  337. package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
  338. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
  339. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
  340. package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
  341. package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
  342. package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
  343. package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
  344. package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
  345. package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
  346. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
  347. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
  348. package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
  349. package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
  350. package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
  351. package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
  352. package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
  353. package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
  354. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
  355. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
  356. package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
  357. package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
  358. package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
  359. package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
  360. package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
  361. package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
  362. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
  363. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
  364. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
  365. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
  366. package/node_modules/@claude-flow/security/package.json +44 -0
  367. package/package.json +30 -8
  368. package/v3/@claude-flow/cli/catalog-manifest.json +4 -4
  369. package/v3/@claude-flow/cli/dist/src/commands/index.d.ts +1 -0
  370. package/v3/@claude-flow/cli/dist/src/commands/index.js +5 -3
  371. package/v3/@claude-flow/cli/dist/src/commands/memory.js +49 -5
  372. package/v3/@claude-flow/cli/dist/src/commands/metaharness.js +25 -5
  373. package/v3/@claude-flow/cli/dist/src/commands/policy.d.ts +4 -0
  374. package/v3/@claude-flow/cli/dist/src/commands/policy.js +107 -0
  375. package/v3/@claude-flow/cli/dist/src/index.js +18 -0
  376. package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.js +53 -2
  377. package/v3/@claude-flow/cli/dist/src/mcp-client.js +25 -1
  378. package/v3/@claude-flow/cli/dist/src/mcp-tools/capability-brain.d.ts +134 -0
  379. package/v3/@claude-flow/cli/dist/src/mcp-tools/capability-brain.js +697 -0
  380. package/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.d.ts +2 -0
  381. package/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.js +369 -37
  382. package/v3/@claude-flow/cli/dist/src/mcp-tools/index.d.ts +4 -1
  383. package/v3/@claude-flow/cli/dist/src/mcp-tools/index.js +3 -1
  384. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +26 -0
  385. package/v3/@claude-flow/cli/dist/src/mcp-tools/metaharness-tools.js +27 -1
  386. package/v3/@claude-flow/cli/dist/src/mcp-tools/policy-tools.d.ts +3 -0
  387. package/v3/@claude-flow/cli/dist/src/mcp-tools/policy-tools.js +121 -0
  388. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +11 -0
  389. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +100 -21
  390. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +22 -1
  391. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +184 -39
  392. package/v3/@claude-flow/cli/dist/src/services/bounded-worker-pool.d.ts +28 -0
  393. package/v3/@claude-flow/cli/dist/src/services/bounded-worker-pool.js +90 -0
  394. package/v3/@claude-flow/cli/dist/src/services/harness-flywheel-runtime.d.ts +2 -0
  395. package/v3/@claude-flow/cli/dist/src/services/harness-flywheel-runtime.js +18 -0
  396. package/v3/@claude-flow/cli/dist/src/services/harness-flywheel.d.ts +4 -1
  397. package/v3/@claude-flow/cli/dist/src/services/harness-flywheel.js +27 -6
  398. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.d.ts +38 -0
  399. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +340 -0
  400. package/v3/@claude-flow/cli/package.json +44 -12
@@ -0,0 +1,257 @@
1
+ /**
2
+ * ToolOutputGuardrail — semantic screening of content returned by MCP tool
3
+ * calls, memory reads, and external API responses before that content enters
4
+ * agent reasoning. Closes the OWASP ASI01 (Agent Goal Hijacking) gap
5
+ * identified in ruvnet/ruflo#2149 / ADR-131.
6
+ *
7
+ * Threat model
8
+ * ------------
9
+ * Attackers embed malicious instructions in content the agent retrieves
10
+ * autonomously (web page, MCP tool response, memory entry). An LLM cannot
11
+ * reliably distinguish instructions from data once both are in the prompt.
12
+ * System-level per-boundary guardrails are the only category with
13
+ * sub-millisecond latency and no model dependency (arXiv:2601.17548,
14
+ * Jan 2026 systematic review).
15
+ *
16
+ * Scope
17
+ * -----
18
+ * - Detection only — does NOT modify the running prompt; callers decide
19
+ * what action to take (allow, flag, redact, reject) via `scanAndEnforce`.
20
+ * - Synchronous pattern match — designed for <1ms p99 on typical tool
21
+ * responses (≤32KB). Large content is capped at `maxScanBytes` and the
22
+ * truncation itself is reported as a low-severity finding.
23
+ * - Pure-function shape — no I/O, no async, no model calls. Safe to invoke
24
+ * in hot paths (every MCP tool result, every memory read).
25
+ *
26
+ * Non-goals
27
+ * ---------
28
+ * - Not a replacement for input validation at HTTP/CLI boundaries
29
+ * (InputValidator handles that). This is the *content* boundary.
30
+ * - Not a model-based classifier. False-positive rate is bounded by
31
+ * pattern specificity; tune via `customPatterns` and `policy`.
32
+ *
33
+ * Reference: ADR-131, OpenAI Agents SDK ToolGuardrail API (March 2025).
34
+ */
35
+ const DEFAULT_POLICY = {
36
+ low: 'allow',
37
+ medium: 'flag',
38
+ high: 'redact',
39
+ critical: 'reject',
40
+ };
41
+ const DEFAULT_MAX_SCAN_BYTES = 1024 * 1024;
42
+ /**
43
+ * Built-in pattern library. Ordered by severity (critical first) so the
44
+ * `highest` field reflects the worst category. Patterns are intentionally
45
+ * conservative — they target the explicit instruction-override / role-hijack
46
+ * shapes that show up in published indirect-injection corpora rather than
47
+ * general "suspicious looking" text.
48
+ */
49
+ const BUILTIN_PATTERNS = [
50
+ // ── critical: instruction override + embedded system frames ──
51
+ {
52
+ label: 'ignore-previous-instructions',
53
+ // Allow optional filler words between the verb and the temporal keyword
54
+ // ("ignore the above", "disregard your earlier", "forget all prior").
55
+ regex: /\b(?:ignore|disregard|forget)\s+(?:all\s+|any\s+|the\s+|my\s+|your\s+|these\s+|those\s+)?(?:previous|prior|above|earlier|preceding|aforementioned)\s+(?:instructions?|prompts?|rules?|directives?)\b/gi,
56
+ severity: 'critical',
57
+ category: 'instruction-override',
58
+ },
59
+ {
60
+ label: 'chatml-frame',
61
+ regex: /<\|(?:im_start|im_end|system|assistant|user|endoftext)\|>/gi,
62
+ severity: 'critical',
63
+ category: 'embedded-system',
64
+ },
65
+ {
66
+ label: 'llama-inst-frame',
67
+ regex: /\[\/?INST\]/g,
68
+ severity: 'critical',
69
+ category: 'embedded-system',
70
+ },
71
+ {
72
+ label: 'exfiltrate-secret',
73
+ regex: /\b(?:exfiltrate|leak|send|post|upload|transmit)\b[^.\n]{0,80}\b(?:secret|token|api[-_\s]?keys?|password|credential|env\s+vars?)\b/gi,
74
+ severity: 'critical',
75
+ category: 'exfiltration',
76
+ },
77
+ // ── high: role hijack + jailbreak + system tags + bidi unicode ──
78
+ {
79
+ label: 'system-tag-injection',
80
+ regex: /<\/?system>/gi,
81
+ severity: 'high',
82
+ category: 'embedded-system',
83
+ },
84
+ {
85
+ label: 'role-hijack-you-are-now',
86
+ regex: /\byou\s+are\s+(?:now|actually|secretly)\s+(?:a|an|the)\s+/gi,
87
+ severity: 'high',
88
+ category: 'role-hijack',
89
+ },
90
+ {
91
+ label: 'jailbreak-dan',
92
+ regex: /\b(?:DAN(?:\s+mode)?|developer\s+mode|jailbreak\s+mode|do\s+anything\s+now)\b/gi,
93
+ severity: 'high',
94
+ category: 'jailbreak',
95
+ },
96
+ {
97
+ label: 'new-instructions-directive',
98
+ regex: /\b(?:new|updated|revised|additional)\s+(?:instructions?|task|directives?|objectives?)\s*[:.]/gi,
99
+ severity: 'high',
100
+ category: 'instruction-override',
101
+ },
102
+ {
103
+ label: 'bidi-override',
104
+ regex: /[‪-‮⁦-⁩]/g,
105
+ severity: 'high',
106
+ category: 'hidden-unicode',
107
+ },
108
+ // ── medium: softer role manipulation + tool spoofing ──
109
+ {
110
+ label: 'role-hijack-act-as',
111
+ regex: /\b(?:act|behave|pretend|role[-\s]?play)\s+as\s+(?:if\s+)?(?:a|an|the)\s+/gi,
112
+ severity: 'medium',
113
+ category: 'role-hijack',
114
+ },
115
+ {
116
+ label: 'tool-call-spoof',
117
+ regex: /\b(?:tool_call|function_call|mcp_tool)\s*[:=]\s*["'{]/gi,
118
+ severity: 'medium',
119
+ category: 'tool-spoofing',
120
+ },
121
+ // ── low: zero-width whitespace (common in copy-paste attacks) ──
122
+ {
123
+ label: 'zero-width-char',
124
+ regex: /[​-‍]/g,
125
+ severity: 'low',
126
+ category: 'hidden-unicode',
127
+ },
128
+ ];
129
+ const SEVERITY_ORDER = {
130
+ none: 0,
131
+ low: 1,
132
+ medium: 2,
133
+ high: 3,
134
+ critical: 4,
135
+ };
136
+ function snippet(text, idx, len) {
137
+ const start = Math.max(0, idx - 24);
138
+ const end = Math.min(text.length, idx + len + 24);
139
+ const head = start > 0 ? '…' : '';
140
+ const tail = end < text.length ? '…' : '';
141
+ return head + text.slice(start, end).replace(/\s+/g, ' ') + tail;
142
+ }
143
+ function maxSeverity(a, b) {
144
+ return SEVERITY_ORDER[a] >= SEVERITY_ORDER[b]
145
+ ? (a === 'none' ? b : a)
146
+ : b;
147
+ }
148
+ export class ToolOutputGuardrail {
149
+ patterns;
150
+ policy;
151
+ maxScanBytes;
152
+ constructor(config = {}) {
153
+ this.patterns = [...BUILTIN_PATTERNS, ...(config.customPatterns ?? [])];
154
+ this.policy = { ...DEFAULT_POLICY, ...(config.policy ?? {}) };
155
+ this.maxScanBytes = config.maxScanBytes ?? DEFAULT_MAX_SCAN_BYTES;
156
+ }
157
+ /**
158
+ * Pure scan — no side effects, no content modification. Useful when the
159
+ * caller wants to log findings but cannot drop the content (e.g. read-only
160
+ * audit mode).
161
+ */
162
+ scan(content) {
163
+ if (typeof content !== 'string') {
164
+ return { safe: true, findings: [], highest: 'none' };
165
+ }
166
+ let scanned = content;
167
+ const findings = [];
168
+ if (this.maxScanBytes > 0 && content.length > this.maxScanBytes) {
169
+ scanned = content.slice(0, this.maxScanBytes);
170
+ findings.push({
171
+ pattern: 'content-truncated',
172
+ severity: 'medium',
173
+ category: 'truncation',
174
+ position: this.maxScanBytes,
175
+ context: `(content truncated at ${this.maxScanBytes} bytes; ${content.length - this.maxScanBytes} bytes unscanned)`,
176
+ });
177
+ }
178
+ for (const { label, regex, severity, category } of this.patterns) {
179
+ // Clone the RegExp so that the global-flag lastIndex state doesn't
180
+ // leak between calls. Built-in patterns are immutable; user-supplied
181
+ // patterns are also defensively cloned.
182
+ const re = new RegExp(regex.source, regex.flags.includes('g') ? regex.flags : regex.flags + 'g');
183
+ let match;
184
+ while ((match = re.exec(scanned)) !== null) {
185
+ findings.push({
186
+ pattern: label,
187
+ severity,
188
+ category,
189
+ position: match.index,
190
+ context: snippet(scanned, match.index, match[0].length),
191
+ });
192
+ // Defensive: zero-length match would loop forever
193
+ if (match[0].length === 0)
194
+ re.lastIndex++;
195
+ }
196
+ }
197
+ let highest = 'none';
198
+ for (const f of findings)
199
+ highest = maxSeverity(highest, f.severity);
200
+ const action = highest === 'none' ? 'allow' : this.policy[highest];
201
+ const safe = action === 'allow' || action === 'flag';
202
+ return { safe, findings, highest };
203
+ }
204
+ /**
205
+ * Scan + enforce policy. Returns the content to pass forward (possibly
206
+ * redacted or empty) plus the scan result and the action that was taken.
207
+ * Callers should treat `reject` as "drop the tool result and signal an
208
+ * error" — do NOT silently substitute empty content.
209
+ */
210
+ scanAndEnforce(content) {
211
+ const result = this.scan(content);
212
+ const action = result.highest === 'none' ? 'allow' : this.policy[result.highest];
213
+ let outgoing = content;
214
+ if (action === 'redact') {
215
+ outgoing = this.redact(content, result.findings);
216
+ }
217
+ else if (action === 'reject') {
218
+ outgoing = '';
219
+ }
220
+ return { content: outgoing, result, action };
221
+ }
222
+ /**
223
+ * Replace each non-truncation finding's matched substring with
224
+ * `[REDACTED:<pattern>]`. Truncation findings have no substring to redact
225
+ * (their `position` is a length, not an offset into the content) and are
226
+ * skipped. Idempotent for already-redacted strings.
227
+ */
228
+ redact(content, findings) {
229
+ if (findings.length === 0)
230
+ return content;
231
+ // Build a single combined regex per pattern label to avoid replacing
232
+ // overlapping matches multiple times.
233
+ const labels = new Set(findings
234
+ .filter((f) => f.category !== 'truncation')
235
+ .map((f) => f.pattern));
236
+ let out = content;
237
+ for (const { label, regex } of this.patterns) {
238
+ if (!labels.has(label))
239
+ continue;
240
+ const re = new RegExp(regex.source, regex.flags.includes('g') ? regex.flags : regex.flags + 'g');
241
+ out = out.replace(re, `[REDACTED:${label}]`);
242
+ }
243
+ return out;
244
+ }
245
+ }
246
+ /** Convenience factory that returns a guardrail with the default policy. */
247
+ export function createToolOutputGuardrail(config) {
248
+ return new ToolOutputGuardrail(config);
249
+ }
250
+ /**
251
+ * One-shot helper for callers that just want a yes/no answer without
252
+ * constructing a guardrail. Uses the default policy.
253
+ */
254
+ export function isToolOutputSafe(content) {
255
+ return createToolOutputGuardrail().scan(content).safe;
256
+ }
257
+ //# sourceMappingURL=tool-output-guardrail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-output-guardrail.js","sourceRoot":"","sources":["../src/tool-output-guardrail.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAwEH,MAAM,cAAc,GAAqD;IACvE,GAAG,EAAE,OAAO;IACZ,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,MAAM,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,gBAAgB,GAKjB;IACH,gEAAgE;IAChE;QACE,KAAK,EAAE,8BAA8B;QACrC,wEAAwE;QACxE,sEAAsE;QACtE,KAAK,EAAE,wMAAwM;QAC/M,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,sBAAsB;KACjC;IACD;QACE,KAAK,EAAE,cAAc;QACrB,KAAK,EAAE,6DAA6D;QACpE,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,iBAAiB;KAC5B;IACD;QACE,KAAK,EAAE,kBAAkB;QACzB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AC5E,MAAM,UAAU,yBAAyB,CAAC,MAAwB;IAChE,OAAO,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,yBAAyB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@claude-flow/security",
3
+ "version": "3.0.0-alpha.14",
4
+ "type": "module",
5
+ "description": "Security module - CVE fixes, input validation, path security",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "exports": {
13
+ ".": "./dist/index.js",
14
+ "./*": "./dist/*.js"
15
+ },
16
+ "scripts": {
17
+ "test": "vitest run",
18
+ "benchmark:policy": "npm run build && node scripts/benchmark-policy-engine.mjs",
19
+ "benchmark:product-plane": "npm run build && node scripts/benchmark-product-plane.mjs",
20
+ "test:oauth-surface": "vitest run __tests__/oauth-export-surface.test.ts __tests__/oauth-pkce.test.ts __tests__/oauth-browser.test.ts",
21
+ "build": "tsc && node scripts/verify-oauth-exports.mjs",
22
+ "prepublishOnly": "npm run build && npm run test:oauth-surface"
23
+ },
24
+ "devDependencies": {
25
+ "vitest": "^4.1.0"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public",
29
+ "tag": "v3alpha"
30
+ },
31
+ "rufloBundledRuntime": {
32
+ "format": 1,
33
+ "sourceDependencies": {
34
+ "dependencies": {
35
+ "@noble/ed25519": "^2.1.0",
36
+ "bcryptjs": "^3.0.3",
37
+ "zod": "^3.22.0"
38
+ },
39
+ "optionalDependencies": {
40
+ "@napi-rs/keyring": "1.3.0"
41
+ }
42
+ }
43
+ }
44
+ }
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.32.26",
3
+ "version": "3.32.30",
4
+ "workspaces": [
5
+ "v3/@claude-flow/codex",
6
+ "v3/@claude-flow/plugin-agent-federation",
7
+ "v3/@claude-flow/security"
8
+ ],
4
9
  "description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
10
  "main": "dist/index.js",
6
11
  "type": "module",
@@ -61,16 +66,28 @@
61
66
  },
62
67
  "dependencies": {
63
68
  "@claude-flow/cli-core": "3.7.0-alpha.5",
69
+ "@claude-flow/codex": "3.0.3",
64
70
  "@claude-flow/mcp": "3.0.0-alpha.9",
65
71
  "@claude-flow/neural": "3.0.0-alpha.9",
72
+ "@claude-flow/plugin-agent-federation": "1.0.0-alpha.18",
73
+ "@claude-flow/security": "3.0.0-alpha.14",
66
74
  "@claude-flow/shared": "3.0.0-alpha.8",
75
+ "@iarna/toml": "^2.2.5",
67
76
  "@noble/ed25519": "2.3.0",
68
77
  "@ruvector/rabitq-wasm": "0.1.0",
78
+ "bcryptjs": "^3.0.3",
79
+ "chalk": "^5.3.0",
80
+ "commander": "^12.0.0",
81
+ "fs-extra": "^11.2.0",
82
+ "inquirer": "^9.2.0",
69
83
  "semver": "7.7.3",
84
+ "toml": "^3.0.0",
85
+ "ws": ">=8.21.0",
86
+ "yaml": "^2.8.0",
70
87
  "zod": "3.25.76"
71
88
  },
72
89
  "optionalDependencies": {
73
- "@claude-flow/codex": "^3.0.1",
90
+ "@napi-rs/keyring": "1.3.0",
74
91
  "@claude-flow/plugin-gastown-bridge": "^0.1.3",
75
92
  "@ruvector/attention": "^0.1.3",
76
93
  "@ruvector/core": "^0.1.30",
@@ -142,7 +159,7 @@
142
159
  },
143
160
  "repository": {
144
161
  "type": "git",
145
- "url": "https://github.com/ruvnet/claude-flow.git"
162
+ "url": "git+https://github.com/ruvnet/claude-flow.git"
146
163
  },
147
164
  "keywords": [
148
165
  "ruvflow",
@@ -179,14 +196,19 @@
179
196
  "consensus",
180
197
  "self-learning"
181
198
  ],
182
- "author": {
183
- "name": "RuvNet",
184
- "email": "ruv@ruv.io",
185
- "url": "https://ruv.io"
186
- },
199
+ "author": "RuvNet <ruv@ruv.io> (https://ruv.io)",
187
200
  "license": "MIT",
188
201
  "publishConfig": {
189
202
  "access": "public",
190
203
  "tag": "latest"
204
+ },
205
+ "bundleDependencies": [
206
+ "@claude-flow/codex",
207
+ "@claude-flow/plugin-agent-federation",
208
+ "@claude-flow/security"
209
+ ],
210
+ "directories": {
211
+ "doc": "docs",
212
+ "test": "tests"
191
213
  }
192
214
  }
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generation": 2,
4
- "generatedAt": "2026-07-28T19:25:02.626Z",
5
- "gitSha": "80634fa0",
3
+ "generation": 3,
4
+ "generatedAt": "2026-07-29T05:35:40.000Z",
5
+ "gitSha": "1385e21b",
6
6
  "catalog": {
7
7
  "agents": 164,
8
- "tools": 388,
8
+ "tools": 395,
9
9
  "skills": 34
10
10
  },
11
11
  "benchmark": null
@@ -33,6 +33,7 @@ export declare function getProvidersCommand(): Promise<Command | undefined>;
33
33
  export declare function getPluginsCommand(): Promise<Command | undefined>;
34
34
  export declare function getDeploymentCommand(): Promise<Command | undefined>;
35
35
  export declare function getClaimsCommand(): Promise<Command | undefined>;
36
+ export declare function getPolicyCommand(): Promise<Command | undefined>;
36
37
  export declare function getEmbeddingsCommand(): Promise<Command | undefined>;
37
38
  export declare function getCompletionsCommand(): Promise<Command | undefined>;
38
39
  export declare function getAnalyzeCommand(): Promise<Command | undefined>;
@@ -40,6 +40,7 @@ const commandLoaders = {
40
40
  plugins: () => import('./plugins.js'),
41
41
  deployment: () => import('./deployment.js'),
42
42
  claims: () => import('./claims.js'),
43
+ policy: () => import('./policy.js'),
43
44
  embeddings: () => import('./embeddings.js'),
44
45
  // P0 Commands
45
46
  completions: () => import('./completions.js'),
@@ -175,6 +176,7 @@ export async function getProvidersCommand() { return loadCommand('providers'); }
175
176
  export async function getPluginsCommand() { return loadCommand('plugins'); }
176
177
  export async function getDeploymentCommand() { return loadCommand('deployment'); }
177
178
  export async function getClaimsCommand() { return loadCommand('claims'); }
179
+ export async function getPolicyCommand() { return loadCommand('policy'); }
178
180
  export async function getEmbeddingsCommand() { return loadCommand('embeddings'); }
179
181
  export async function getCompletionsCommand() { return loadCommand('completions'); }
180
182
  export async function getAnalyzeCommand() { return loadCommand('analyze'); }
@@ -230,14 +232,14 @@ export const commandsByCategory = {
230
232
  * Use this for help display and full command listings.
231
233
  */
232
234
  export async function getCommandsByCategory() {
233
- const [daemonCmd, doctorCmd, embeddingsCmd, neuralCmd, performanceCmd, securityCmd, ruvectorCmd, hiveMindCmd, configCmd, completionsCmd, migrateCmd, workflowCmd, analyzeCmd, routeCmd, progressCmd, providersCmd, pluginsCmd, deploymentCmd, claimsCmd, issuesCmd, updateCmd, processCmd, guidanceCmd, applianceCmd, cleanupCmd, autopilotCmd,] = await Promise.all([
235
+ const [daemonCmd, doctorCmd, embeddingsCmd, neuralCmd, performanceCmd, securityCmd, ruvectorCmd, hiveMindCmd, configCmd, completionsCmd, migrateCmd, workflowCmd, analyzeCmd, routeCmd, progressCmd, providersCmd, pluginsCmd, deploymentCmd, claimsCmd, issuesCmd, updateCmd, processCmd, guidanceCmd, applianceCmd, cleanupCmd, autopilotCmd, policyCmd,] = await Promise.all([
234
236
  loadCommand('daemon'), loadCommand('doctor'), loadCommand('embeddings'), loadCommand('neural'),
235
237
  loadCommand('performance'), loadCommand('security'), loadCommand('ruvector'), loadCommand('hive-mind'),
236
238
  loadCommand('config'), loadCommand('completions'), loadCommand('migrate'), loadCommand('workflow'),
237
239
  loadCommand('analyze'), loadCommand('route'), loadCommand('progress'), loadCommand('providers'),
238
240
  loadCommand('plugins'), loadCommand('deployment'), loadCommand('claims'), loadCommand('issues'),
239
241
  loadCommand('update'), loadCommand('process'), loadCommand('guidance'), loadCommand('appliance'),
240
- loadCommand('cleanup'), loadCommand('autopilot'),
242
+ loadCommand('cleanup'), loadCommand('autopilot'), loadCommand('policy'),
241
243
  ]);
242
244
  return {
243
245
  primary: [
@@ -246,7 +248,7 @@ export async function getCommandsByCategory() {
246
248
  mcpCommand, hooksCommand,
247
249
  ],
248
250
  advanced: [
249
- neuralCmd, securityCmd, performanceCmd, embeddingsCmd,
251
+ neuralCmd, securityCmd, policyCmd, performanceCmd, embeddingsCmd,
250
252
  hiveMindCmd, ruvectorCmd, guidanceCmd, autopilotCmd,
251
253
  ].filter(Boolean),
252
254
  utility: [
@@ -86,12 +86,23 @@ const storeCommand = {
86
86
  description: 'Scan the value for injection payloads before persisting (dream-cycle #2752 MemPoison gate)',
87
87
  type: 'boolean',
88
88
  },
89
+ {
90
+ // ADR-323 — typed memory provenance. Distinguishes who/what produced
91
+ // this entry so shared-namespace retrieval can filter by trust level
92
+ // instead of conflating a user's stated claim with an agent's own
93
+ // output or a raw tool/system observation.
94
+ name: 'provenance',
95
+ description: 'Who/what produced this value: user_claim | agent_output | system_observation | tool_result | unknown (default: unknown) — ADR-323',
96
+ type: 'string',
97
+ choices: ['user_claim', 'agent_output', 'system_observation', 'tool_result', 'unknown'],
98
+ },
89
99
  DB_PATH_OPTION
90
100
  ],
91
101
  examples: [
92
102
  { command: 'claude-flow memory store -k "api/auth" -v "JWT implementation"', description: 'Store text' },
93
103
  { command: 'claude-flow memory store -k "pattern/singleton" --vector', description: 'Store vector' },
94
- { command: 'claude-flow memory store -k "pattern" -v "new" --no-upsert', description: 'Strict insert (fail if key exists)' }
104
+ { command: 'claude-flow memory store -k "pattern" -v "new" --no-upsert', description: 'Strict insert (fail if key exists)' },
105
+ { command: 'claude-flow memory store -k "user/goal" -v "ship by Friday" --provenance user_claim', description: 'Store with typed provenance (ADR-323)' }
95
106
  ],
96
107
  action: async (ctx) => {
97
108
  const key = ctx.flags.key;
@@ -114,6 +125,10 @@ const storeCommand = {
114
125
  // regardless of the parser gap: only an explicit `--no-upsert` (which
115
126
  // arrives as `false`) turns it off.
116
127
  const upsert = ctx.flags.upsert !== false;
128
+ // ADR-323: leave undefined (not 'unknown') when omitted so storeEntry's
129
+ // own default applies uniformly across the CLI, MCP tool, and direct
130
+ // callers — one place decides the default, not three.
131
+ const provenance = ctx.flags.provenance;
117
132
  if (!key) {
118
133
  output.printError('Key is required. Use --key or -k');
119
134
  return { success: false, exitCode: 1 };
@@ -174,6 +189,7 @@ const storeCommand = {
174
189
  tags,
175
190
  ttl,
176
191
  upsert,
192
+ provenanceType: provenance,
177
193
  dbPath
178
194
  });
179
195
  if (!result.success) {
@@ -193,12 +209,13 @@ const storeCommand = {
193
209
  { property: 'TTL', val: ttl ? `${ttl}s` : 'None' },
194
210
  { property: 'Tags', val: tags.length > 0 ? tags.join(', ') : 'None' },
195
211
  { property: 'Vector', val: result.embedding ? `Yes (${result.embedding.dimensions}-dim)` : 'No' },
212
+ { property: 'Provenance', val: provenance || 'unknown' },
196
213
  { property: 'ID', val: result.id.substring(0, 20) }
197
214
  ]
198
215
  });
199
216
  output.writeln();
200
217
  output.printSuccess('Data stored successfully');
201
- return { success: true, data: { ...storeData, id: result.id, embedding: result.embedding } };
218
+ return { success: true, data: { ...storeData, id: result.id, embedding: result.embedding, provenanceType: provenance || 'unknown' } };
202
219
  }
203
220
  catch (error) {
204
221
  output.printError(`Failed to store: ${error instanceof Error ? error.message : 'Unknown error'}`);
@@ -361,6 +378,15 @@ const searchCommand = {
361
378
  choices: ['auto', 'mixed', 'episodic', 'semantic', 'procedural'],
362
379
  default: 'mixed',
363
380
  },
381
+ {
382
+ // ADR-323 — restrict results to entries with a matching provenance
383
+ // type (e.g. exclude user_claim when retrieving for fact-checking,
384
+ // per MemSyco-Bench's memory-induced sycophancy finding). Enforced
385
+ // across semantic, keyword, hybrid, and SmartRetrieval paths.
386
+ name: 'provenance-filter',
387
+ description: 'Comma-separated provenance types to restrict results to: user_claim,agent_output,system_observation,tool_result,unknown — ADR-323',
388
+ type: 'string',
389
+ },
364
390
  DB_PATH_OPTION
365
391
  ],
366
392
  examples: [
@@ -369,11 +395,18 @@ const searchCommand = {
369
395
  { command: 'claude-flow memory search -q "test" --build-hnsw', description: 'Build HNSW index and search' },
370
396
  { command: 'claude-flow memory search -q "auth patterns" --smart', description: 'SmartRetrieval with RRF + MMR' },
371
397
  { command: 'claude-flow memory search -q "when did we last touch auth" --intent auto', description: 'SCM-routed retrieval (dream-cycle #2760)' },
398
+ { command: 'claude-flow memory search -q "deploy plan" --provenance-filter agent_output,tool_result', description: 'Only trust agent/tool-sourced entries (ADR-323)' },
372
399
  ],
373
400
  action: async (ctx) => {
374
401
  const query = ctx.flags.query || ctx.args[0];
375
402
  let namespace = ctx.flags.namespace || 'all';
376
403
  const limit = ctx.flags.limit || 10;
404
+ // Matches the --build-hnsw / buildHnsw dual-check convention already used
405
+ // below: the parser doesn't consistently camelCase every hyphenated flag.
406
+ const provenanceFilterRaw = (ctx.flags['provenance-filter'] || ctx.flags.provenanceFilter);
407
+ const provenanceFilter = provenanceFilterRaw
408
+ ? provenanceFilterRaw.split(',').map(s => s.trim()).filter(Boolean)
409
+ : undefined;
377
410
  // #2790 fix — `||` discards an explicit `--threshold 0` (falsy) and
378
411
  // silently uses the fallback; that made `--threshold 0` return
379
412
  // FEWER results than `--threshold 0.01` (non-monotonic). Nullish
@@ -456,8 +489,13 @@ const searchCommand = {
456
489
  limit: 5000,
457
490
  includeContent: true,
458
491
  dbPath: dbPathSearch,
492
+ provenanceFilter,
459
493
  });
460
- if (list.success) {
494
+ if (!list.success) {
495
+ output.printError(list.error || 'Keyword search failed');
496
+ return { success: false, exitCode: 1 };
497
+ }
498
+ else {
461
499
  const q = query.toLowerCase();
462
500
  keywordResults = list.entries
463
501
  .filter((e) => {
@@ -473,6 +511,7 @@ const searchCommand = {
473
511
  score: inKey ? 1.0 : 0.7,
474
512
  namespace: e.namespace,
475
513
  preview: c.slice(0, 200),
514
+ provenanceType: e.provenanceType,
476
515
  };
477
516
  })
478
517
  .sort((a, b) => b.score - a.score)
@@ -526,6 +565,7 @@ const searchCommand = {
526
565
  limit: req.limit || limit * 3,
527
566
  threshold: req.threshold ?? threshold,
528
567
  dbPath: dbPathSearch,
568
+ provenanceFilter,
529
569
  });
530
570
  return {
531
571
  results: r.results.map(e => ({
@@ -534,6 +574,7 @@ const searchCommand = {
534
574
  content: e.content,
535
575
  score: e.score,
536
576
  namespace: e.namespace,
577
+ provenanceType: e.provenanceType,
537
578
  })),
538
579
  };
539
580
  };
@@ -548,6 +589,7 @@ const searchCommand = {
548
589
  score: r.score,
549
590
  namespace: r.namespace,
550
591
  preview: r.content,
592
+ provenanceType: r.provenanceType,
551
593
  }));
552
594
  searchTimeMs = smartResult.stats.durationMs;
553
595
  smartStats = smartResult.stats;
@@ -559,7 +601,8 @@ const searchCommand = {
559
601
  namespace,
560
602
  limit,
561
603
  threshold,
562
- dbPath: dbPathSearch
604
+ dbPath: dbPathSearch,
605
+ provenanceFilter
563
606
  });
564
607
  if (!searchResult.success) {
565
608
  output.printError(searchResult.error || 'Search failed');
@@ -569,7 +612,8 @@ const searchCommand = {
569
612
  key: r.key,
570
613
  score: r.score,
571
614
  namespace: r.namespace,
572
- preview: r.content
615
+ preview: r.content,
616
+ provenanceType: r.provenanceType,
573
617
  }));
574
618
  searchTimeMs = searchResult.searchTime;
575
619
  }