@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.
- package/.claude/helpers/.helpers-version +1 -1
- package/.claude/helpers/helpers.manifest.json +2 -2
- package/catalog-manifest.json +4 -4
- package/dist/src/commands/index.d.ts +1 -0
- package/dist/src/commands/index.js +5 -3
- package/dist/src/commands/memory.js +49 -5
- package/dist/src/commands/metaharness.js +25 -5
- package/dist/src/commands/policy.d.ts +4 -0
- package/dist/src/commands/policy.js +107 -0
- package/dist/src/index.js +18 -0
- package/dist/src/init/claudemd-generator.js +53 -2
- package/dist/src/mcp-client.js +25 -1
- package/dist/src/mcp-tools/capability-brain.d.ts +134 -0
- package/dist/src/mcp-tools/capability-brain.js +697 -0
- package/dist/src/mcp-tools/guidance-tools.d.ts +2 -0
- package/dist/src/mcp-tools/guidance-tools.js +369 -37
- package/dist/src/mcp-tools/index.d.ts +4 -1
- package/dist/src/mcp-tools/index.js +3 -1
- package/dist/src/mcp-tools/memory-tools.js +26 -0
- package/dist/src/mcp-tools/metaharness-tools.js +27 -1
- package/dist/src/mcp-tools/policy-tools.d.ts +3 -0
- package/dist/src/mcp-tools/policy-tools.js +121 -0
- package/dist/src/memory/memory-bridge.d.ts +11 -0
- package/dist/src/memory/memory-bridge.js +100 -21
- package/dist/src/memory/memory-initializer.d.ts +22 -1
- package/dist/src/memory/memory-initializer.js +184 -39
- package/dist/src/services/bounded-worker-pool.d.ts +28 -0
- package/dist/src/services/bounded-worker-pool.js +90 -0
- package/dist/src/services/harness-flywheel-runtime.d.ts +2 -0
- package/dist/src/services/harness-flywheel-runtime.js +18 -0
- package/dist/src/services/harness-flywheel.d.ts +4 -1
- package/dist/src/services/harness-flywheel.js +27 -6
- package/dist/src/services/policy-runtime.d.ts +38 -0
- package/dist/src/services/policy-runtime.js +340 -0
- package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
- package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
- package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
- package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
- package/node_modules/@claude-flow/codex/README.md +1044 -0
- package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
- package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
- package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/index.js +54 -0
- package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
- package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/types.js +8 -0
- package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/package.json +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
- package/node_modules/@claude-flow/security/README.md +292 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
- package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
- package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
- package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
- package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
- package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/index.js +176 -0
- package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
- package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
- package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
- package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
- package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
- package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
- package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
- package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
- package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
- package/node_modules/@claude-flow/security/package.json +44 -0
- package/package.json +44 -12
- package/plugins/ruflo-metaharness/scripts/smoke.sh +22 -14
- package/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs +3 -1
package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Midstream-aware federation transport loader (ADR-120, Step 2).
|
|
3
|
+
*
|
|
4
|
+
* Extends the agentic-flow `loadQuicTransport` loader pattern with a
|
|
5
|
+
* preferred branch that probes `midstreamer` first. When `midstreamer`
|
|
6
|
+
* ships real QUIC (currently the WASM build is a counter-tracking
|
|
7
|
+
* stub per ADR-119), this loader picks it up automatically without
|
|
8
|
+
* any change to consumer plugins.
|
|
9
|
+
*
|
|
10
|
+
* Resolution order:
|
|
11
|
+
*
|
|
12
|
+
* 1. If `MIDSTREAMER_QUIC_NATIVE=1` AND the `midstreamer` module
|
|
13
|
+
* exposes a real `QuicMultistream`-derived `AgentTransport`,
|
|
14
|
+
* use it. (Today: probes fail closed and we fall through.)
|
|
15
|
+
*
|
|
16
|
+
* 2. Otherwise: defer to agentic-flow's existing loader, which
|
|
17
|
+
* itself respects `AGENTIC_FLOW_QUIC_NATIVE=1` (ADR-108) and
|
|
18
|
+
* falls back to WebSocket (ADR-104) otherwise.
|
|
19
|
+
*
|
|
20
|
+
* The loader is opt-in: callers must explicitly invoke
|
|
21
|
+
* `loadFederationTransport()` instead of `loadQuicTransport()`.
|
|
22
|
+
* Behavior is identical to `loadQuicTransport()` until upstream
|
|
23
|
+
* `midstreamer` ships its real QUIC build AND the operator sets the
|
|
24
|
+
* env flag — so this change is safe to land before any of that
|
|
25
|
+
* happens.
|
|
26
|
+
*
|
|
27
|
+
* Re-exports the `AgentTransport` / `AgentMessage` / `QuicTransportConfig`
|
|
28
|
+
* surface from agentic-flow so consumers only import from one place.
|
|
29
|
+
*/
|
|
30
|
+
function isCompatibleTransport(value, requireListen = false) {
|
|
31
|
+
if (!value || typeof value !== 'object')
|
|
32
|
+
return false;
|
|
33
|
+
const transport = value;
|
|
34
|
+
return (typeof transport.send === 'function' &&
|
|
35
|
+
typeof transport.onMessage === 'function' &&
|
|
36
|
+
(!requireListen || typeof transport.listen === 'function'));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Lazy loader for agentic-flow's `loadQuicTransport`. Returns `null`
|
|
40
|
+
* when `agentic-flow` is not installed — callers must then fall back
|
|
41
|
+
* to the midstream-first path or surface a clear error.
|
|
42
|
+
*
|
|
43
|
+
* Per ADR-120 + issue #1949, `agentic-flow` is now an **optional**
|
|
44
|
+
* peer dependency. Operators who only want the midstream-native
|
|
45
|
+
* transport (via `MIDSTREAMER_QUIC_NATIVE=1`) can omit it to avoid
|
|
46
|
+
* the deep `koa-router` → `cookies@0.9.1` transitive chain that
|
|
47
|
+
* hardened npm registries reject.
|
|
48
|
+
*/
|
|
49
|
+
async function loadAgenticFlowQuicTransport(config) {
|
|
50
|
+
// Direct dynamic `import()` (not the `new Function` trick) so
|
|
51
|
+
// test frameworks like vitest can intercept via `vi.mock`. The
|
|
52
|
+
// try/catch makes the module-not-found case a clean `null` so the
|
|
53
|
+
// caller falls back gracefully — agentic-flow is now an optional
|
|
54
|
+
// peer dependency.
|
|
55
|
+
let mod;
|
|
56
|
+
try {
|
|
57
|
+
// Cast through `unknown` because upstream's exported AgentTransport /
|
|
58
|
+
// AgentMessage carry a richer surface (InboundMessageHandler with an
|
|
59
|
+
// options bag, extra fields) that intentionally differs from our
|
|
60
|
+
// locally-declared minimal shim. The shim exists so the plugin can
|
|
61
|
+
// compile without importing agentic-flow's exports map at all
|
|
62
|
+
// (#2578). Downstream code (`plugin.ts`) uses our shim types.
|
|
63
|
+
mod = (await import('agentic-flow/transport/loader'));
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const fn = typeof mod.loadQuicTransport === 'function'
|
|
69
|
+
? mod.loadQuicTransport
|
|
70
|
+
: mod.default?.loadQuicTransport;
|
|
71
|
+
if (typeof fn !== 'function') {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const transport = await fn(config);
|
|
76
|
+
return isCompatibleTransport(transport, typeof config?.port === 'number')
|
|
77
|
+
? transport
|
|
78
|
+
: null;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Plugin-owned ADR-104 WebSocket fallback. This closes issue #2618's
|
|
86
|
+
* failure mode: current `agentic-flow` releases do not export
|
|
87
|
+
* `agentic-flow/transport/loader`, so the federation plugin must not
|
|
88
|
+
* depend on that subpath for its baseline wire transport.
|
|
89
|
+
*/
|
|
90
|
+
class WebSocketFallbackTransport {
|
|
91
|
+
config;
|
|
92
|
+
handlers = [];
|
|
93
|
+
server = null;
|
|
94
|
+
sockets = new Set();
|
|
95
|
+
constructor(config = {}) {
|
|
96
|
+
this.config = config;
|
|
97
|
+
}
|
|
98
|
+
async send(address, message) {
|
|
99
|
+
const { default: WebSocket } = await import('ws');
|
|
100
|
+
const url = address.includes('://') ? address : `ws://${address}`;
|
|
101
|
+
const socket = new WebSocket(url);
|
|
102
|
+
await new Promise((resolve, reject) => {
|
|
103
|
+
socket.on('open', () => {
|
|
104
|
+
socket.send(JSON.stringify(message), (err) => {
|
|
105
|
+
socket.close();
|
|
106
|
+
if (err)
|
|
107
|
+
reject(err);
|
|
108
|
+
else
|
|
109
|
+
resolve();
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
socket.on('error', (err) => reject(err instanceof Error ? err : new Error(String(err))));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
onMessage(handler) {
|
|
116
|
+
this.handlers.push(handler);
|
|
117
|
+
}
|
|
118
|
+
async listen(port = Number(this.config.port ?? 0), host = String(this.config.host ?? '0.0.0.0')) {
|
|
119
|
+
const { WebSocketServer } = await import('ws');
|
|
120
|
+
const server = new WebSocketServer({ port, host });
|
|
121
|
+
this.server = server;
|
|
122
|
+
await new Promise((resolve, reject) => {
|
|
123
|
+
server.on('listening', () => resolve());
|
|
124
|
+
server.on('error', (err) => reject(err instanceof Error ? err : new Error(String(err))));
|
|
125
|
+
server.on('connection', (socket, request) => {
|
|
126
|
+
const ws = socket;
|
|
127
|
+
this.sockets.add(ws);
|
|
128
|
+
const remoteAddress = (request?.socket);
|
|
129
|
+
const address = remoteAddress?.remoteAddress
|
|
130
|
+
? `${remoteAddress.remoteAddress}${remoteAddress.remotePort ? `:${remoteAddress.remotePort}` : ''}`
|
|
131
|
+
: 'unknown';
|
|
132
|
+
ws.on('message', (data) => {
|
|
133
|
+
try {
|
|
134
|
+
const raw = typeof data === 'string'
|
|
135
|
+
? data
|
|
136
|
+
: Buffer.isBuffer(data)
|
|
137
|
+
? data.toString('utf8')
|
|
138
|
+
: String(data);
|
|
139
|
+
const message = JSON.parse(raw);
|
|
140
|
+
for (const handler of this.handlers)
|
|
141
|
+
handler(address, message);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// Drop malformed frames. Signature/envelope validation happens
|
|
145
|
+
// above this layer in inbound-dispatcher.
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
ws.on('close', () => this.sockets.delete(ws));
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async close() {
|
|
153
|
+
for (const socket of this.sockets)
|
|
154
|
+
socket.close();
|
|
155
|
+
this.sockets.clear();
|
|
156
|
+
if (this.server) {
|
|
157
|
+
await new Promise((resolve) => this.server?.close(resolve));
|
|
158
|
+
this.server = null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Probe the `midstreamer` npm package for a real QUIC transport.
|
|
164
|
+
* Returns `null` when the env flag is off, when the package isn't
|
|
165
|
+
* installed, when the import surface doesn't match expectations, or
|
|
166
|
+
* when the loaded module is detectably the WASM stub (per ADR-119
|
|
167
|
+
* the current shipped build is a counter-tracking stub — `isNative()`
|
|
168
|
+
* or `isStub()` probes are checked when available).
|
|
169
|
+
*
|
|
170
|
+
* The function never throws — any failure becomes `null` so the
|
|
171
|
+
* outer `loadFederationTransport` can transparently fall back.
|
|
172
|
+
*/
|
|
173
|
+
async function probeMidstreamerTransport(config) {
|
|
174
|
+
if (process.env.MIDSTREAMER_QUIC_NATIVE !== '1') {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
let mod;
|
|
178
|
+
try {
|
|
179
|
+
// Lazy + indirect so bundlers don't try to resolve at compile time.
|
|
180
|
+
// Prefer the `midstreamer/quic` sub-path (added in midstreamer@0.3.1
|
|
181
|
+
// per upstream ruvnet/midstream#81) which exposes
|
|
182
|
+
// `loadQuicTransport` directly without WASM init. Fall back to the
|
|
183
|
+
// root `midstreamer` package for older versions that put the QUIC
|
|
184
|
+
// surface on the default export.
|
|
185
|
+
const dynamicImport = new Function('s', 'return import(s)');
|
|
186
|
+
try {
|
|
187
|
+
mod = await dynamicImport('midstreamer/quic');
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
mod = await dynamicImport('midstreamer');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
const candidate = mod;
|
|
197
|
+
// CommonJS sub-path exposes its API via `module.exports = {...};
|
|
198
|
+
// module.exports.default = module.exports;` — so we also accept the
|
|
199
|
+
// `.default` form. ESM imports flatten the named exports directly.
|
|
200
|
+
const surface = (typeof candidate.loadQuicTransport === 'function'
|
|
201
|
+
? candidate
|
|
202
|
+
: candidate.default);
|
|
203
|
+
if (!surface) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
// Refuse to use the WASM stub. ADR-119 documented the previous
|
|
207
|
+
// QuicMultistream as a counter-tracking stub with no real UDP, TLS,
|
|
208
|
+
// or protocol — using it would silently downgrade the federation
|
|
209
|
+
// path. midstreamer@0.3.1+ ships a real QUIC transport via
|
|
210
|
+
// `midstreamer/quic` (ADR-120, Step 1 — upstream PR ruvnet/midstream#81)
|
|
211
|
+
// and reports `isNative() === true`. Older versions either expose
|
|
212
|
+
// `isStub()` returning true or omit both probes.
|
|
213
|
+
if (typeof surface.isStub === 'function' && surface.isStub()) {
|
|
214
|
+
return { transport: null, reason: 'midstreamer module reports isStub() === true; refusing to bind a stub QUIC backend (ADR-119)' };
|
|
215
|
+
}
|
|
216
|
+
if (typeof surface.loadQuicTransport !== 'function') {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
if (typeof surface.isNative === 'function' && !surface.isNative()) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
try {
|
|
223
|
+
const transport = await surface.loadQuicTransport(config);
|
|
224
|
+
return isCompatibleTransport(transport, typeof config?.port === 'number')
|
|
225
|
+
? { transport }
|
|
226
|
+
: {
|
|
227
|
+
transport: null,
|
|
228
|
+
reason: 'midstreamer transport does not implement the federation send/onMessage/listen contract',
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
return {
|
|
233
|
+
transport: null,
|
|
234
|
+
reason: `midstreamer.loadQuicTransport failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Top-level loader for federation transport. Identical signature to
|
|
240
|
+
* agentic-flow's `loadQuicTransport`, but with the midstreamer-first
|
|
241
|
+
* preference. Use this from `plugins/ruflo-federation` in place of
|
|
242
|
+
* the bare `loadQuicTransport`.
|
|
243
|
+
*
|
|
244
|
+
* Failure mode: if midstreamer is requested but rejects (stub, init
|
|
245
|
+
* error, missing package), this function falls through to the
|
|
246
|
+
* agentic-flow loader. If current agentic-flow does not export its
|
|
247
|
+
* historical loader subpath, the plugin-owned WebSocket fallback is
|
|
248
|
+
* used directly (ADR-104, #2618).
|
|
249
|
+
*/
|
|
250
|
+
export async function loadFederationTransport(config) {
|
|
251
|
+
const probe = await probeMidstreamerTransport(config);
|
|
252
|
+
if (probe && probe.transport) {
|
|
253
|
+
return { transport: probe.transport, source: 'midstreamer-native' };
|
|
254
|
+
}
|
|
255
|
+
const transport = await loadAgenticFlowQuicTransport(config);
|
|
256
|
+
if (transport) {
|
|
257
|
+
return {
|
|
258
|
+
transport,
|
|
259
|
+
source: 'agentic-flow-loader',
|
|
260
|
+
fallbackReason: probe?.reason,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
transport: new WebSocketFallbackTransport(config),
|
|
265
|
+
source: 'websocket-fallback',
|
|
266
|
+
fallbackReason: probe?.reason ?? 'agentic-flow transport loader unavailable; using plugin-owned WebSocket fallback',
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=midstream-aware-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"midstream-aware-loader.js","sourceRoot":"","sources":["../../src/transport/midstream-aware-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA+BH,SAAS,qBAAqB,CAC5B,KAAc,EACd,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,SAAS,GAAG,KAAgC,CAAC;IACnD,OAAO,CACL,OAAO,SAAS,CAAC,IAAI,KAAK,UAAU;QACpC,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU;QACzC,CAAC,CAAC,aAAa,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,UAAU,CAAC,CAC3D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,4BAA4B,CACzC,MAA4B;IAE5B,8DAA8D;IAC9D,+DAA+D;IAC/D,kEAAkE;IAClE,iEAAiE;IACjE,mBAAmB;IACnB,IAAI,GAKH,CAAC;IACF,IAAI,CAAC;QACH,sEAAsE;QACtE,qEAAqE;QACrE,iEAAiE;QACjE,mEAAmE;QACnE,8DAA8D;QAC9D,8DAA8D;QAC9D,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAA0B,CAAC;IACjF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,GACN,OAAO,GAAG,CAAC,iBAAiB,KAAK,UAAU;QACzC,CAAC,CAAC,GAAG,CAAC,iBAAiB;QACvB,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACrC,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;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MAAM,4BAA4B,CAAC,MAAM,CAAC,CAAC;IAC7D,IAAI,SAAS,EAAE,CAAC;QACd,OAAO;YACL,SAAS;YACT,MAAM,EAAE,qBAAqB;YAC7B,cAAc,EAAE,KAAK,EAAE,MAAM;SAC9B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,SAAS,EAAE,IAAI,0BAA0B,CAAC,MAAM,CAAC;QACjD,MAAM,EAAE,oBAAoB;QAC5B,cAAc,EAAE,KAAK,EAAE,MAAM,IAAI,kFAAkF;KACpH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,eAAO,MAAM,yBAAyB,EAAG,gBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAyB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@claude-flow/plugin-agent-federation",
|
|
3
|
+
"version": "1.0.0-alpha.18",
|
|
4
|
+
"description": "Cross-installation agent federation with zero-trust security, PII-gated data flow, and compliance-grade audit trails.",
|
|
5
|
+
"homepage": "https://github.com/ruvnet/ruflo",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"ruflo-federation": "dist/bin.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/**",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"benchmark:canonicalization": "npm run build && node scripts/benchmark-envelope-canonicalization.mjs",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@claude-flow/shared": "3.0.0-alpha.8",
|
|
26
|
+
"@claude-flow/security": "file:../security",
|
|
27
|
+
"@types/ws": "^8.18.1",
|
|
28
|
+
"agentic-flow": "2.0.12-fix.8",
|
|
29
|
+
"typescript": "^5.4.0",
|
|
30
|
+
"vitest": "^4.1.0"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"federation",
|
|
34
|
+
"multi-agent",
|
|
35
|
+
"trust",
|
|
36
|
+
"pii",
|
|
37
|
+
"security",
|
|
38
|
+
"audit",
|
|
39
|
+
"compliance"
|
|
40
|
+
],
|
|
41
|
+
"author": "Claude Flow Team",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"rufloBundledRuntime": {
|
|
44
|
+
"format": 1,
|
|
45
|
+
"sourceDependencies": {
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@noble/ed25519": "^2.0.0",
|
|
48
|
+
"ws": "^8.20.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"agentic-flow": ">=2.0.12-fix.8 <4.0.0",
|
|
52
|
+
"midstreamer": ">=0.3.1"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"agentic-flow": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"midstreamer": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# @claude-flow/security
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@claude-flow/security)
|
|
4
|
+
[](https://www.npmjs.com/package/@claude-flow/security)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://github.com/ruvnet/claude-flow)
|
|
8
|
+
|
|
9
|
+
> Comprehensive security module for Claude Flow V3 - CVE fixes, input validation, path security, and secure credential management.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **CVE Remediation** - Fixes for CVE-2 (Weak Password Hashing), CVE-3 (Hardcoded Credentials), HIGH-1 (Command Injection), HIGH-2 (Path Traversal)
|
|
14
|
+
- **Password Hashing** - Secure bcrypt-based password hashing with configurable rounds (12+ recommended)
|
|
15
|
+
- **Credential Generation** - Cryptographically secure credential and API key generation
|
|
16
|
+
- **Safe Command Execution** - Allowlist-based command execution preventing injection attacks
|
|
17
|
+
- **Path Validation** - Protection against path traversal and symlink attacks
|
|
18
|
+
- **Input Validation** - Zod-based schema validation for all input types
|
|
19
|
+
- **Token Generation** - Secure token creation with HMAC signing
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @claude-flow/security
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Standalone use (without the Ruflo CLI)
|
|
28
|
+
|
|
29
|
+
This is a plain library — every primitive (`PasswordHasher`,
|
|
30
|
+
`PathValidator`, `SafeExecutor`, `InputValidator`, `CredentialGenerator`)
|
|
31
|
+
is independently importable. No CLI, no MCP server, no daemon. The
|
|
32
|
+
primitives close CVE-2 (weak hashing), CVE-3 (default credentials),
|
|
33
|
+
HIGH-1 (command injection), and HIGH-2 (path traversal) — drop them
|
|
34
|
+
into any Node app that needs to validate at a system boundary.
|
|
35
|
+
|
|
36
|
+
### Recipe — Validate input, hash a password, generate an API key
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// recipe.mjs
|
|
40
|
+
import {
|
|
41
|
+
InputValidator,
|
|
42
|
+
EmailSchema,
|
|
43
|
+
PasswordHasher,
|
|
44
|
+
createCredentialGenerator,
|
|
45
|
+
} from '@claude-flow/security';
|
|
46
|
+
|
|
47
|
+
// 1. Validate user input at the boundary (Zod schemas, no surprises)
|
|
48
|
+
const email = InputValidator.validate(EmailSchema, 'user@example.com');
|
|
49
|
+
// ↳ throws if invalid; returns the typed value otherwise
|
|
50
|
+
|
|
51
|
+
// 2. Hash a password with bcrypt at the recommended cost (CVE-2)
|
|
52
|
+
// Default policy: ≥8 chars, ≥1 upper, ≥1 lower, ≥1 digit.
|
|
53
|
+
// Tune with new PasswordHasher({ rounds, requireUppercase, ... }).
|
|
54
|
+
const hasher = new PasswordHasher({ rounds: 12 });
|
|
55
|
+
const hash = await hasher.hash('CorrectHorseBatteryStaple9');
|
|
56
|
+
const ok = await hasher.verify('CorrectHorseBatteryStaple9', hash); // true
|
|
57
|
+
|
|
58
|
+
// 3. Generate a high-entropy API key (CVE-3) — uses crypto.randomBytes
|
|
59
|
+
// under the hood and refuses to emit keys below 32 bytes of entropy.
|
|
60
|
+
const creds = createCredentialGenerator();
|
|
61
|
+
const apiKey = creds.generateApiKey('ck_live_');
|
|
62
|
+
console.log(apiKey.keyId, apiKey.key.slice(0, 16) + '…');
|
|
63
|
+
// → 7e2b1a9c-… ck_live_xX9aQ…
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Recipe — Refuse command injection + path traversal
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import {
|
|
70
|
+
createDevelopmentExecutor,
|
|
71
|
+
createProjectPathValidator,
|
|
72
|
+
} from '@claude-flow/security';
|
|
73
|
+
|
|
74
|
+
// SafeExecutor — only the allow-listed commands ever run (HIGH-1)
|
|
75
|
+
const exec = createDevelopmentExecutor({ projectRoot: process.cwd() });
|
|
76
|
+
const { stdout } = await exec.execute('git', ['status', '--porcelain']);
|
|
77
|
+
|
|
78
|
+
// PathValidator — refuses traversal and symlinks out of the project (HIGH-2)
|
|
79
|
+
const paths = createProjectPathValidator(process.cwd());
|
|
80
|
+
const result = await paths.validate('../../etc/passwd');
|
|
81
|
+
if (!result.isValid) console.log('blocked:', result.errors.join('; '));
|
|
82
|
+
// → blocked: Path traversal pattern detected
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { createSecurityModule } from '@claude-flow/security';
|
|
89
|
+
|
|
90
|
+
// Create a complete security module
|
|
91
|
+
const security = createSecurityModule({
|
|
92
|
+
projectRoot: '/workspaces/project',
|
|
93
|
+
hmacSecret: process.env.HMAC_SECRET!,
|
|
94
|
+
bcryptRounds: 12,
|
|
95
|
+
allowedCommands: ['git', 'npm', 'node']
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Hash a password
|
|
99
|
+
const hash = await security.passwordHasher.hash('userPassword123');
|
|
100
|
+
|
|
101
|
+
// Validate a path
|
|
102
|
+
const pathResult = await security.pathValidator.validate('/workspaces/project/src/file.ts');
|
|
103
|
+
|
|
104
|
+
// Execute command safely
|
|
105
|
+
const output = await security.safeExecutor.execute('git', ['status']);
|
|
106
|
+
|
|
107
|
+
// Generate secure credentials
|
|
108
|
+
const creds = await security.credentialGenerator.generate();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## API Reference
|
|
112
|
+
|
|
113
|
+
### Password Hashing (CVE-2 Fix)
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { PasswordHasher, createPasswordHasher } from '@claude-flow/security';
|
|
117
|
+
|
|
118
|
+
const hasher = createPasswordHasher({ rounds: 12 });
|
|
119
|
+
|
|
120
|
+
// Hash password
|
|
121
|
+
const hash = await hasher.hash('password');
|
|
122
|
+
|
|
123
|
+
// Verify password
|
|
124
|
+
const isValid = await hasher.verify('password', hash);
|
|
125
|
+
|
|
126
|
+
// Check if hash needs rehashing
|
|
127
|
+
const needsRehash = hasher.needsRehash(hash);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Credential Generation (CVE-3 Fix)
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { CredentialGenerator, generateCredentials } from '@claude-flow/security';
|
|
134
|
+
|
|
135
|
+
const generator = new CredentialGenerator();
|
|
136
|
+
|
|
137
|
+
// Generate API key
|
|
138
|
+
const apiKey = await generator.generateApiKey({
|
|
139
|
+
prefix: 'cf',
|
|
140
|
+
length: 32
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Generate complete credentials
|
|
144
|
+
const creds = generateCredentials({
|
|
145
|
+
includeApiKey: true,
|
|
146
|
+
includeSecret: true
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Safe Command Execution (HIGH-1 Fix)
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { SafeExecutor, createDevelopmentExecutor } from '@claude-flow/security';
|
|
154
|
+
|
|
155
|
+
const executor = createDevelopmentExecutor();
|
|
156
|
+
|
|
157
|
+
// Execute allowed command
|
|
158
|
+
const result = await executor.execute('git', ['status']);
|
|
159
|
+
|
|
160
|
+
// With timeout
|
|
161
|
+
const result2 = await executor.execute('npm', ['install'], {
|
|
162
|
+
timeout: 60000,
|
|
163
|
+
cwd: '/workspaces/project'
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Path Validation (HIGH-2 Fix)
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { PathValidator, createProjectPathValidator } from '@claude-flow/security';
|
|
171
|
+
|
|
172
|
+
const validator = createProjectPathValidator('/workspaces/project');
|
|
173
|
+
|
|
174
|
+
// Validate path
|
|
175
|
+
const result = await validator.validate('../../../etc/passwd');
|
|
176
|
+
// { valid: false, reason: 'Path traversal detected' }
|
|
177
|
+
|
|
178
|
+
// Safe path
|
|
179
|
+
const result2 = await validator.validate('/workspaces/project/src/index.ts');
|
|
180
|
+
// { valid: true, normalized: '/workspaces/project/src/index.ts' }
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Input Validation
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
import {
|
|
187
|
+
InputValidator,
|
|
188
|
+
SafeStringSchema,
|
|
189
|
+
EmailSchema,
|
|
190
|
+
PasswordSchema,
|
|
191
|
+
SpawnAgentSchema
|
|
192
|
+
} from '@claude-flow/security';
|
|
193
|
+
|
|
194
|
+
// Validate email
|
|
195
|
+
const email = EmailSchema.parse('user@example.com');
|
|
196
|
+
|
|
197
|
+
// Validate password
|
|
198
|
+
const password = PasswordSchema.parse('SecurePass123!');
|
|
199
|
+
|
|
200
|
+
// Validate agent spawn request
|
|
201
|
+
const agentRequest = SpawnAgentSchema.parse({
|
|
202
|
+
type: 'coder',
|
|
203
|
+
name: 'code-agent-1'
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// Sanitize HTML
|
|
207
|
+
import { sanitizeHtml } from '@claude-flow/security';
|
|
208
|
+
const safe = sanitizeHtml('<script>alert("xss")</script>Hello');
|
|
209
|
+
// 'Hello'
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Token Generation
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
import { TokenGenerator, quickGenerate } from '@claude-flow/security';
|
|
216
|
+
|
|
217
|
+
const generator = new TokenGenerator({
|
|
218
|
+
hmacSecret: process.env.HMAC_SECRET!
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// Generate signed token
|
|
222
|
+
const token = await generator.generate({
|
|
223
|
+
type: 'session',
|
|
224
|
+
expiresIn: 3600
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// Verify token
|
|
228
|
+
const verified = await generator.verify(token);
|
|
229
|
+
|
|
230
|
+
// Quick generation
|
|
231
|
+
const sessionToken = quickGenerate.sessionToken();
|
|
232
|
+
const verificationCode = quickGenerate.verificationCode();
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Security Constants
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
import {
|
|
239
|
+
MIN_BCRYPT_ROUNDS, // 12
|
|
240
|
+
MAX_BCRYPT_ROUNDS, // 14
|
|
241
|
+
MIN_PASSWORD_LENGTH, // 8
|
|
242
|
+
MAX_PASSWORD_LENGTH, // 72 (bcrypt limit)
|
|
243
|
+
DEFAULT_TOKEN_EXPIRATION, // 3600 (1 hour)
|
|
244
|
+
DEFAULT_SESSION_EXPIRATION // 86400 (24 hours)
|
|
245
|
+
} from '@claude-flow/security';
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Security Audit
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import { auditSecurityConfig } from '@claude-flow/security';
|
|
252
|
+
|
|
253
|
+
const warnings = auditSecurityConfig({
|
|
254
|
+
bcryptRounds: 10,
|
|
255
|
+
hmacSecret: 'short'
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// ['bcryptRounds (10) below recommended minimum (12)',
|
|
259
|
+
// 'hmacSecret should be at least 32 characters']
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Validation Schemas
|
|
263
|
+
|
|
264
|
+
| Schema | Description |
|
|
265
|
+
|--------|-------------|
|
|
266
|
+
| `SafeStringSchema` | Basic safe string with length limits |
|
|
267
|
+
| `IdentifierSchema` | Alphanumeric identifiers |
|
|
268
|
+
| `FilenameSchema` | Safe filenames |
|
|
269
|
+
| `EmailSchema` | Email addresses |
|
|
270
|
+
| `PasswordSchema` | Secure passwords |
|
|
271
|
+
| `UUIDSchema` | UUID v4 format |
|
|
272
|
+
| `HttpsUrlSchema` | HTTPS URLs only |
|
|
273
|
+
| `SemverSchema` | Semantic versions |
|
|
274
|
+
| `PortSchema` | Valid port numbers |
|
|
275
|
+
| `IPv4Schema` | IPv4 addresses |
|
|
276
|
+
| `SpawnAgentSchema` | Agent spawn requests |
|
|
277
|
+
| `TaskInputSchema` | Task definitions |
|
|
278
|
+
| `SecurityConfigSchema` | Security configuration |
|
|
279
|
+
|
|
280
|
+
## Dependencies
|
|
281
|
+
|
|
282
|
+
- `bcrypt` - Password hashing
|
|
283
|
+
- `zod` - Schema validation
|
|
284
|
+
|
|
285
|
+
## Related Packages
|
|
286
|
+
|
|
287
|
+
- [@claude-flow/shared](../shared) - Shared types and utilities
|
|
288
|
+
- [@claude-flow/swarm](../swarm) - Swarm coordination (secure agent spawning)
|
|
289
|
+
|
|
290
|
+
## License
|
|
291
|
+
|
|
292
|
+
MIT
|