@claude-flow/cli 3.32.29 → 3.32.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/helpers/helpers.manifest.json +2 -2
- package/catalog-manifest.json +2 -2
- package/dist/src/init/claudemd-generator.js +53 -2
- package/dist/src/mcp-tools/capability-brain.js +22 -22
- package/dist/src/mcp-tools/guidance-tools.js +1 -1
- 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 +24 -8
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Validator - Comprehensive Input Validation
|
|
3
|
+
*
|
|
4
|
+
* Provides Zod-based validation schemas for all security-critical inputs.
|
|
5
|
+
*
|
|
6
|
+
* Security Properties:
|
|
7
|
+
* - Type-safe validation
|
|
8
|
+
* - Custom error messages
|
|
9
|
+
* - Sanitization transforms
|
|
10
|
+
* - Reusable schemas
|
|
11
|
+
*
|
|
12
|
+
* @module v3/security/input-validator
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
/**
|
|
16
|
+
* Custom error map for security-focused messages
|
|
17
|
+
*/
|
|
18
|
+
const securityErrorMap = (issue, ctx) => {
|
|
19
|
+
switch (issue.code) {
|
|
20
|
+
case z.ZodIssueCode.too_big:
|
|
21
|
+
return { message: `Input exceeds maximum allowed size` };
|
|
22
|
+
case z.ZodIssueCode.too_small:
|
|
23
|
+
return { message: `Input below minimum required size` };
|
|
24
|
+
case z.ZodIssueCode.invalid_string:
|
|
25
|
+
if (issue.validation === 'email') {
|
|
26
|
+
return { message: 'Invalid email format' };
|
|
27
|
+
}
|
|
28
|
+
if (issue.validation === 'url') {
|
|
29
|
+
return { message: 'Invalid URL format' };
|
|
30
|
+
}
|
|
31
|
+
if (issue.validation === 'uuid') {
|
|
32
|
+
return { message: 'Invalid UUID format' };
|
|
33
|
+
}
|
|
34
|
+
return { message: 'Invalid string format' };
|
|
35
|
+
default:
|
|
36
|
+
return { message: ctx.defaultError };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// Apply custom error map globally for this module
|
|
40
|
+
z.setErrorMap(securityErrorMap);
|
|
41
|
+
/**
|
|
42
|
+
* Common validation patterns as reusable regex
|
|
43
|
+
*/
|
|
44
|
+
const PATTERNS = {
|
|
45
|
+
// Safe identifier: alphanumeric with underscore/hyphen
|
|
46
|
+
SAFE_IDENTIFIER: /^[a-zA-Z][a-zA-Z0-9_-]*$/,
|
|
47
|
+
// Safe filename: alphanumeric with dot, underscore, hyphen
|
|
48
|
+
SAFE_FILENAME: /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,
|
|
49
|
+
// Safe path segment: no traversal
|
|
50
|
+
SAFE_PATH_SEGMENT: /^[^<>:"|?*\x00-\x1f]+$/,
|
|
51
|
+
// No shell metacharacters
|
|
52
|
+
NO_SHELL_CHARS: /^[^;&|`$(){}><\n\r\0]+$/,
|
|
53
|
+
// Semantic version
|
|
54
|
+
SEMVER: /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Validation limits
|
|
58
|
+
*/
|
|
59
|
+
const LIMITS = {
|
|
60
|
+
MIN_PASSWORD_LENGTH: 8,
|
|
61
|
+
MAX_PASSWORD_LENGTH: 128,
|
|
62
|
+
MAX_EMAIL_LENGTH: 254,
|
|
63
|
+
MAX_IDENTIFIER_LENGTH: 64,
|
|
64
|
+
MAX_PATH_LENGTH: 4096,
|
|
65
|
+
MAX_CONTENT_LENGTH: 1024 * 1024, // 1MB
|
|
66
|
+
MAX_ARRAY_LENGTH: 1000,
|
|
67
|
+
MAX_OBJECT_KEYS: 100,
|
|
68
|
+
};
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// Base Validation Schemas
|
|
71
|
+
// ============================================================================
|
|
72
|
+
/**
|
|
73
|
+
* Safe string that cannot contain shell metacharacters
|
|
74
|
+
*/
|
|
75
|
+
export const SafeStringSchema = z.string()
|
|
76
|
+
.min(1, 'String cannot be empty')
|
|
77
|
+
.max(LIMITS.MAX_CONTENT_LENGTH, 'String too long')
|
|
78
|
+
.regex(PATTERNS.NO_SHELL_CHARS, 'String contains invalid characters');
|
|
79
|
+
/**
|
|
80
|
+
* Safe identifier for IDs, names, etc.
|
|
81
|
+
*/
|
|
82
|
+
export const IdentifierSchema = z.string()
|
|
83
|
+
.min(1, 'Identifier cannot be empty')
|
|
84
|
+
.max(LIMITS.MAX_IDENTIFIER_LENGTH, 'Identifier too long')
|
|
85
|
+
.regex(PATTERNS.SAFE_IDENTIFIER, 'Invalid identifier format');
|
|
86
|
+
/**
|
|
87
|
+
* Safe filename
|
|
88
|
+
*/
|
|
89
|
+
export const FilenameSchema = z.string()
|
|
90
|
+
.min(1, 'Filename cannot be empty')
|
|
91
|
+
.max(255, 'Filename too long')
|
|
92
|
+
.regex(PATTERNS.SAFE_FILENAME, 'Invalid filename format');
|
|
93
|
+
/**
|
|
94
|
+
* Email schema with length limit
|
|
95
|
+
*/
|
|
96
|
+
export const EmailSchema = z.string()
|
|
97
|
+
.email('Invalid email format')
|
|
98
|
+
.max(LIMITS.MAX_EMAIL_LENGTH, 'Email too long')
|
|
99
|
+
.toLowerCase();
|
|
100
|
+
/**
|
|
101
|
+
* Password schema with complexity requirements
|
|
102
|
+
*/
|
|
103
|
+
export const PasswordSchema = z.string()
|
|
104
|
+
.min(LIMITS.MIN_PASSWORD_LENGTH, `Password must be at least ${LIMITS.MIN_PASSWORD_LENGTH} characters`)
|
|
105
|
+
.max(LIMITS.MAX_PASSWORD_LENGTH, `Password must not exceed ${LIMITS.MAX_PASSWORD_LENGTH} characters`)
|
|
106
|
+
.refine((val) => /[A-Z]/.test(val), 'Password must contain uppercase letter')
|
|
107
|
+
.refine((val) => /[a-z]/.test(val), 'Password must contain lowercase letter')
|
|
108
|
+
.refine((val) => /\d/.test(val), 'Password must contain digit');
|
|
109
|
+
/**
|
|
110
|
+
* UUID schema
|
|
111
|
+
*/
|
|
112
|
+
export const UUIDSchema = z.string().uuid('Invalid UUID format');
|
|
113
|
+
/**
|
|
114
|
+
* URL schema with HTTPS enforcement
|
|
115
|
+
*/
|
|
116
|
+
export const HttpsUrlSchema = z.string()
|
|
117
|
+
.url('Invalid URL format')
|
|
118
|
+
.refine((val) => val.startsWith('https://'), 'URL must use HTTPS');
|
|
119
|
+
/**
|
|
120
|
+
* URL schema (allows HTTP for development)
|
|
121
|
+
*/
|
|
122
|
+
export const UrlSchema = z.string()
|
|
123
|
+
.url('Invalid URL format');
|
|
124
|
+
/**
|
|
125
|
+
* Semantic version schema
|
|
126
|
+
*/
|
|
127
|
+
export const SemverSchema = z.string()
|
|
128
|
+
.regex(PATTERNS.SEMVER, 'Invalid semantic version format');
|
|
129
|
+
/**
|
|
130
|
+
* Port number schema
|
|
131
|
+
*/
|
|
132
|
+
export const PortSchema = z.number()
|
|
133
|
+
.int('Port must be an integer')
|
|
134
|
+
.min(1, 'Port must be at least 1')
|
|
135
|
+
.max(65535, 'Port must be at most 65535');
|
|
136
|
+
/**
|
|
137
|
+
* IP address schema (v4)
|
|
138
|
+
*/
|
|
139
|
+
export const IPv4Schema = z.string()
|
|
140
|
+
.ip({ version: 'v4', message: 'Invalid IPv4 address' });
|
|
141
|
+
/**
|
|
142
|
+
* IP address schema (v4 or v6)
|
|
143
|
+
*/
|
|
144
|
+
export const IPSchema = z.string()
|
|
145
|
+
.ip({ message: 'Invalid IP address' });
|
|
146
|
+
// ============================================================================
|
|
147
|
+
// Authentication Schemas
|
|
148
|
+
// ============================================================================
|
|
149
|
+
/**
|
|
150
|
+
* User role schema
|
|
151
|
+
*/
|
|
152
|
+
export const UserRoleSchema = z.enum([
|
|
153
|
+
'admin',
|
|
154
|
+
'operator',
|
|
155
|
+
'developer',
|
|
156
|
+
'viewer',
|
|
157
|
+
'service',
|
|
158
|
+
]);
|
|
159
|
+
/**
|
|
160
|
+
* Permission schema
|
|
161
|
+
*/
|
|
162
|
+
export const PermissionSchema = z.enum([
|
|
163
|
+
'swarm.create',
|
|
164
|
+
'swarm.read',
|
|
165
|
+
'swarm.update',
|
|
166
|
+
'swarm.delete',
|
|
167
|
+
'swarm.scale',
|
|
168
|
+
'agent.spawn',
|
|
169
|
+
'agent.read',
|
|
170
|
+
'agent.terminate',
|
|
171
|
+
'task.create',
|
|
172
|
+
'task.read',
|
|
173
|
+
'task.cancel',
|
|
174
|
+
'metrics.read',
|
|
175
|
+
'system.admin',
|
|
176
|
+
'api.access',
|
|
177
|
+
]);
|
|
178
|
+
/**
|
|
179
|
+
* Login request schema
|
|
180
|
+
*/
|
|
181
|
+
export const LoginRequestSchema = z.object({
|
|
182
|
+
email: EmailSchema,
|
|
183
|
+
password: z.string().min(1, 'Password is required'),
|
|
184
|
+
mfaCode: z.string().length(6, 'MFA code must be 6 digits').optional(),
|
|
185
|
+
});
|
|
186
|
+
/**
|
|
187
|
+
* User creation schema
|
|
188
|
+
*/
|
|
189
|
+
export const CreateUserSchema = z.object({
|
|
190
|
+
email: EmailSchema,
|
|
191
|
+
password: PasswordSchema,
|
|
192
|
+
role: UserRoleSchema,
|
|
193
|
+
permissions: z.array(PermissionSchema).optional(),
|
|
194
|
+
isActive: z.boolean().optional().default(true),
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* API key creation schema
|
|
198
|
+
*/
|
|
199
|
+
export const CreateApiKeySchema = z.object({
|
|
200
|
+
name: IdentifierSchema,
|
|
201
|
+
permissions: z.array(PermissionSchema).optional(),
|
|
202
|
+
expiresAt: z.date().optional(),
|
|
203
|
+
});
|
|
204
|
+
// ============================================================================
|
|
205
|
+
// Agent & Task Schemas
|
|
206
|
+
// ============================================================================
|
|
207
|
+
/**
|
|
208
|
+
* Agent type schema
|
|
209
|
+
*/
|
|
210
|
+
export const AgentTypeSchema = z.enum([
|
|
211
|
+
'coder',
|
|
212
|
+
'reviewer',
|
|
213
|
+
'tester',
|
|
214
|
+
'planner',
|
|
215
|
+
'researcher',
|
|
216
|
+
'security-architect',
|
|
217
|
+
'security-auditor',
|
|
218
|
+
'memory-specialist',
|
|
219
|
+
'swarm-specialist',
|
|
220
|
+
'integration-architect',
|
|
221
|
+
'performance-engineer',
|
|
222
|
+
'core-architect',
|
|
223
|
+
'test-architect',
|
|
224
|
+
'queen-coordinator',
|
|
225
|
+
'project-coordinator',
|
|
226
|
+
]);
|
|
227
|
+
/**
|
|
228
|
+
* Agent spawn request schema
|
|
229
|
+
*/
|
|
230
|
+
export const SpawnAgentSchema = z.object({
|
|
231
|
+
type: AgentTypeSchema,
|
|
232
|
+
id: IdentifierSchema.optional(),
|
|
233
|
+
config: z.record(z.unknown()).optional(),
|
|
234
|
+
timeout: z.number().positive().optional(),
|
|
235
|
+
});
|
|
236
|
+
/**
|
|
237
|
+
* Task input schema
|
|
238
|
+
*/
|
|
239
|
+
export const TaskInputSchema = z.object({
|
|
240
|
+
taskId: UUIDSchema,
|
|
241
|
+
content: SafeStringSchema.max(10000, 'Task content too long'),
|
|
242
|
+
agentType: AgentTypeSchema,
|
|
243
|
+
priority: z.enum(['low', 'medium', 'high', 'critical']).optional(),
|
|
244
|
+
metadata: z.record(z.unknown()).optional(),
|
|
245
|
+
});
|
|
246
|
+
// ============================================================================
|
|
247
|
+
// Command & Path Schemas
|
|
248
|
+
// ============================================================================
|
|
249
|
+
/**
|
|
250
|
+
* Command argument schema
|
|
251
|
+
*/
|
|
252
|
+
export const CommandArgumentSchema = z.string()
|
|
253
|
+
.max(1024, 'Argument too long')
|
|
254
|
+
.refine((val) => !val.includes('\0'), 'Argument contains null byte')
|
|
255
|
+
.refine((val) => !/[;&|`$(){}><]/.test(val), 'Argument contains shell metacharacters');
|
|
256
|
+
/**
|
|
257
|
+
* Path schema
|
|
258
|
+
*/
|
|
259
|
+
export const PathSchema = z.string()
|
|
260
|
+
.max(LIMITS.MAX_PATH_LENGTH, 'Path too long')
|
|
261
|
+
.refine((val) => !val.includes('\0'), 'Path contains null byte')
|
|
262
|
+
.refine((val) => !val.includes('..'), 'Path contains traversal pattern');
|
|
263
|
+
// ============================================================================
|
|
264
|
+
// Configuration Schemas
|
|
265
|
+
// ============================================================================
|
|
266
|
+
/**
|
|
267
|
+
* Security configuration schema
|
|
268
|
+
*/
|
|
269
|
+
export const SecurityConfigSchema = z.object({
|
|
270
|
+
bcryptRounds: z.number().int().min(10).max(20).default(12),
|
|
271
|
+
jwtExpiresIn: z.string().default('24h'),
|
|
272
|
+
sessionTimeout: z.number().positive().default(3600000),
|
|
273
|
+
maxLoginAttempts: z.number().int().positive().default(5),
|
|
274
|
+
lockoutDuration: z.number().positive().default(900000),
|
|
275
|
+
requireMFA: z.boolean().default(false),
|
|
276
|
+
});
|
|
277
|
+
/**
|
|
278
|
+
* Executor configuration schema
|
|
279
|
+
*/
|
|
280
|
+
export const ExecutorConfigSchema = z.object({
|
|
281
|
+
allowedCommands: z.array(IdentifierSchema).min(1),
|
|
282
|
+
blockedPatterns: z.array(z.string()).optional(),
|
|
283
|
+
timeout: z.number().positive().default(30000),
|
|
284
|
+
maxBuffer: z.number().positive().default(10 * 1024 * 1024),
|
|
285
|
+
cwd: PathSchema.optional(),
|
|
286
|
+
allowSudo: z.boolean().default(false),
|
|
287
|
+
});
|
|
288
|
+
// ============================================================================
|
|
289
|
+
// Sanitization Functions
|
|
290
|
+
// ============================================================================
|
|
291
|
+
/**
|
|
292
|
+
* Sanitizes a string by removing dangerous characters
|
|
293
|
+
*/
|
|
294
|
+
export function sanitizeString(input) {
|
|
295
|
+
return input
|
|
296
|
+
.replace(/\0/g, '') // Remove null bytes
|
|
297
|
+
.replace(/[<>]/g, '') // Remove HTML brackets
|
|
298
|
+
.replace(/javascript:/gi, '') // Remove javascript: protocol
|
|
299
|
+
.replace(/data:/gi, '') // Remove data: protocol
|
|
300
|
+
.trim();
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Sanitizes HTML entities
|
|
304
|
+
*/
|
|
305
|
+
export function sanitizeHtml(input) {
|
|
306
|
+
return input
|
|
307
|
+
.replace(/&/g, '&')
|
|
308
|
+
.replace(/</g, '<')
|
|
309
|
+
.replace(/>/g, '>')
|
|
310
|
+
.replace(/"/g, '"')
|
|
311
|
+
.replace(/'/g, ''');
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Sanitizes a path by removing traversal patterns
|
|
315
|
+
*/
|
|
316
|
+
export function sanitizePath(input) {
|
|
317
|
+
return input
|
|
318
|
+
.replace(/\0/g, '') // Remove null bytes
|
|
319
|
+
.replace(/\.\./g, '') // Remove traversal patterns
|
|
320
|
+
.replace(/\/+/g, '/') // Normalize slashes
|
|
321
|
+
.replace(/^\//, '') // Remove leading slash
|
|
322
|
+
.trim();
|
|
323
|
+
}
|
|
324
|
+
// ============================================================================
|
|
325
|
+
// Validation Helper Class
|
|
326
|
+
// ============================================================================
|
|
327
|
+
export class InputValidator {
|
|
328
|
+
/**
|
|
329
|
+
* Validates input against a schema
|
|
330
|
+
*/
|
|
331
|
+
static validate(schema, input) {
|
|
332
|
+
return schema.parse(input);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Safely validates input, returning result
|
|
336
|
+
*/
|
|
337
|
+
static safeParse(schema, input) {
|
|
338
|
+
return schema.safeParse(input);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Validates email
|
|
342
|
+
*/
|
|
343
|
+
static validateEmail(email) {
|
|
344
|
+
return EmailSchema.parse(email);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Validates password
|
|
348
|
+
*/
|
|
349
|
+
static validatePassword(password) {
|
|
350
|
+
return PasswordSchema.parse(password);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Validates identifier
|
|
354
|
+
*/
|
|
355
|
+
static validateIdentifier(id) {
|
|
356
|
+
return IdentifierSchema.parse(id);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Validates path
|
|
360
|
+
*/
|
|
361
|
+
static validatePath(path) {
|
|
362
|
+
return PathSchema.parse(path);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Validates command argument
|
|
366
|
+
*/
|
|
367
|
+
static validateCommandArg(arg) {
|
|
368
|
+
return CommandArgumentSchema.parse(arg);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Validates login request
|
|
372
|
+
*/
|
|
373
|
+
static validateLoginRequest(data) {
|
|
374
|
+
return LoginRequestSchema.parse(data);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Validates user creation request
|
|
378
|
+
*/
|
|
379
|
+
static validateCreateUser(data) {
|
|
380
|
+
return CreateUserSchema.parse(data);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Validates task input
|
|
384
|
+
*/
|
|
385
|
+
static validateTaskInput(data) {
|
|
386
|
+
return TaskInputSchema.parse(data);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
// ============================================================================
|
|
390
|
+
// Export all schemas for direct use
|
|
391
|
+
// ============================================================================
|
|
392
|
+
export { z, PATTERNS, LIMITS, };
|
|
393
|
+
//# sourceMappingURL=input-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-validator.js","sourceRoot":"","sources":["../src/input-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,gBAAgB,GAAkB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACrD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,CAAC,CAAC,YAAY,CAAC,OAAO;YACzB,OAAO,EAAE,OAAO,EAAE,oCAAoC,EAAE,CAAC;QAC3D,KAAK,CAAC,CAAC,YAAY,CAAC,SAAS;YAC3B,OAAO,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC;QAC1D,KAAK,CAAC,CAAC,YAAY,CAAC,cAAc;YAChC,IAAI,KAAK,CAAC,UAAU,KAAK,OAAO,EAAE,CAAC;gBACjC,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;YAC7C,CAAC;YACD,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;gBAC/B,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;YAC3C,CAAC;YACD,IAAI,KAAK,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;gBAChC,OAAO,EAAE,OAAO,EAAE,qBAAqB,E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;QACvC,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,IAAa;QACrC,OAAO,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAa;QACpC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACF;AAED,+EAA+E;AAC/E,oCAAoC;AACpC,+EAA+E;AAE/E,OAAO,EACL,CAAC,EACD,QAAQ,EACR,MAAM,GACP,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform OS keychain adapter (ADR-306) — macOS Keychain, Windows
|
|
3
|
+
* Credential Manager (DPAPI), Linux Secret Service (libsecret), backed by
|
|
4
|
+
* `@napi-rs/keyring` (prebuilt N-API binaries per platform, wraps the Rust
|
|
5
|
+
* `keyring-rs` crate — no node-gyp compile step, same "optional native
|
|
6
|
+
* binding" shape this monorepo already tolerates for `ruvector`).
|
|
7
|
+
*
|
|
8
|
+
* `keytar` was considered and rejected: archived by the Electron team,
|
|
9
|
+
* compiles from source via node-gyp at install time.
|
|
10
|
+
*
|
|
11
|
+
* ADR-306's refresh-token storage rule: OS keychain only, never plain-text
|
|
12
|
+
* config. When no keychain backend is reachable (typical headless Linux —
|
|
13
|
+
* the binding can be present but no D-Bus Secret Service running), the CLI
|
|
14
|
+
* falls back to session-only tokens (never persisted) rather than writing
|
|
15
|
+
* the secret to disk unencrypted — a deliberate usability cost, not a bug.
|
|
16
|
+
* `SessionOnlyKeychainAdapter` is that fallback, made explicit rather than
|
|
17
|
+
* silently degrading.
|
|
18
|
+
*
|
|
19
|
+
* @module v3/security/keychain-adapter
|
|
20
|
+
*/
|
|
21
|
+
export interface KeychainAdapter {
|
|
22
|
+
/**
|
|
23
|
+
* A real write+read+delete canary probe against a throwaway entry — not
|
|
24
|
+
* just "did the native module load". A headless box can have the binding
|
|
25
|
+
* present but no reachable Secret Service, which only a real round-trip
|
|
26
|
+
* reveals.
|
|
27
|
+
*/
|
|
28
|
+
isAvailable(): Promise<boolean>;
|
|
29
|
+
setSecret(service: string, account: string, secret: string): Promise<void>;
|
|
30
|
+
getSecret(service: string, account: string): Promise<string | null>;
|
|
31
|
+
deleteSecret(service: string, account: string): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
/** In-memory-only fallback — the ADR-306-mandated degrade path, not an error state. */
|
|
34
|
+
export declare class SessionOnlyKeychainAdapter implements KeychainAdapter {
|
|
35
|
+
private readonly store;
|
|
36
|
+
private key;
|
|
37
|
+
isAvailable(): Promise<boolean>;
|
|
38
|
+
setSecret(service: string, account: string, secret: string): Promise<void>;
|
|
39
|
+
getSecret(service: string, account: string): Promise<string | null>;
|
|
40
|
+
deleteSecret(service: string, account: string): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Selects a real OS keychain when reachable, falling back to
|
|
44
|
+
* `SessionOnlyKeychainAdapter` otherwise. Always resolves — never throws —
|
|
45
|
+
* so callers can treat "no keychain" as a normal, expected outcome.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createKeychainAdapter(): Promise<KeychainAdapter>;
|
|
48
|
+
//# sourceMappingURL=keychain-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keychain-adapter.d.ts","sourceRoot":"","sources":["../src/keychain-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,SAAS,CAAC,OAAO,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UAAU,qBAAqB;IACzC,MAAM,MAAM,GAAG,IAAI,qBAAqB,EAAE,CAAC;IAC3C,IAAI,MAAM,MAAM,CAAC,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;IAC9C,OAAO,IAAI,0BAA0B,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Composition Inspector — ADR-320 (this ADR; ruvnet/ruflo dream-cycle
|
|
3
|
+
* proposal, arXiv:2606.27027 "ShareLock").
|
|
4
|
+
*
|
|
5
|
+
* The attack: an adversary registers N seemingly-benign MCP tools whose
|
|
6
|
+
* individual descriptions look fine in isolation, but whose CONCATENATION
|
|
7
|
+
* (or pairwise overlap) forms an injection payload targeting a downstream
|
|
8
|
+
* agent — a Shamir-secret-sharing-style split across tool descriptions.
|
|
9
|
+
* Per-tool inspection misses this because each fragment sits under any
|
|
10
|
+
* single-tool detection threshold.
|
|
11
|
+
*
|
|
12
|
+
* Relationship to prior art in this repo
|
|
13
|
+
* ---------------------------------------
|
|
14
|
+
* A CLI-only v1 of this idea already shipped directly to `main`
|
|
15
|
+
* (dream-cycle #2783, commits 381b7ebcc/581cd2bf3) as
|
|
16
|
+
* `v3/@claude-flow/cli/src/security/mcp-composition-inspector.ts` — an
|
|
17
|
+
* on-demand `ruflo security composition-scan` command using exact
|
|
18
|
+
* common-substring matching plus an injection-phrase catalog and
|
|
19
|
+
* typosquat check. That module's own header explicitly scopes itself as
|
|
20
|
+
* "a bounded engineering fix rather than an ADR-scope subsystem" and lists
|
|
21
|
+
* "Future v2: SimHash + LSH for scale" as deliberately deferred. THIS
|
|
22
|
+
* module is that v2: a reusable `@claude-flow/security` library primitive
|
|
23
|
+
* (not a CLI-only tool) built around a real SimHash fingerprint, so it can
|
|
24
|
+
* be called from a pre-task/pre-tool-use hook before a multi-tool chain
|
|
25
|
+
* executes, per this ADR's implementation target. It does not replace or
|
|
26
|
+
* import the CLI v1 — the two are independent, complementary detectors
|
|
27
|
+
* (exact-substring vs. hashed-shingle-overlap) that a caller may run
|
|
28
|
+
* together.
|
|
29
|
+
*
|
|
30
|
+
* Detection method (deterministic, no LLM call)
|
|
31
|
+
* -----------------------------------------------
|
|
32
|
+
* 1. Each tool description is normalized and split into overlapping
|
|
33
|
+
* word-shingles (default: 5-word windows). Shingling — rather than
|
|
34
|
+
* whole-description comparison — is what lets us find a SMALL embedded
|
|
35
|
+
* fragment inside an otherwise unrelated, benign description.
|
|
36
|
+
* 2. Each tool gets a 64-bit SimHash fingerprint: every shingle is hashed
|
|
37
|
+
* (FNV-1a, 64-bit) and the fingerprint bits are set by majority vote
|
|
38
|
+
* across all of a tool's shingle hashes. Two tools whose descriptions
|
|
39
|
+
* share enough content have a SMALL Hamming distance between
|
|
40
|
+
* fingerprints — this is the O(1)-per-pair coarse filter that avoids an
|
|
41
|
+
* LLM call and stays cheap even at hundreds of registered tools (fast
|
|
42
|
+
* 64-bit XOR + popcount per pair).
|
|
43
|
+
* 3. An inverted shingle-hash index (hash -> set of tool indices) is built
|
|
44
|
+
* once, in O(total shingles). For each pair flagged by the SimHash
|
|
45
|
+
* filter (or found in the index) the SAME index is used to compute the
|
|
46
|
+
* actual overlapping shingle text — this is what makes the finding
|
|
47
|
+
* reportable (the SimHash score alone can't tell an operator *what*
|
|
48
|
+
* matched).
|
|
49
|
+
* 4. A fragment's "population" (how many distinct tools carry it) caps
|
|
50
|
+
* false positives: shared shingles that appear in more than
|
|
51
|
+
* `maxFragmentPopulation` (default 3) tools are template language
|
|
52
|
+
* (e.g. every ruflo `memory_*` tool's boilerplate), not an attack —
|
|
53
|
+
* Shamir-split attacks concentrate a fragment in a small conspiracy of
|
|
54
|
+
* 2-3 tools. Same population-cap idea as the CLI v1, reimplemented here
|
|
55
|
+
* against the hash index instead of raw substrings.
|
|
56
|
+
*
|
|
57
|
+
* This is a heuristic detector, not a security boundary: it reports
|
|
58
|
+
* SUSPECTS. Default action is warn + log; blocking is opt-in via
|
|
59
|
+
* `CLAUDE_FLOW_MCP_COMPOSITION_BLOCK=1` (see {@link evaluateToolComposition}).
|
|
60
|
+
*
|
|
61
|
+
* @module @claude-flow/security/mcp-composition-inspector
|
|
62
|
+
*/
|
|
63
|
+
export interface McpToolDescriptor {
|
|
64
|
+
name: string;
|
|
65
|
+
description: string;
|
|
66
|
+
}
|
|
67
|
+
export interface CompositionInspectorOptions {
|
|
68
|
+
/** Words per shingle window. Default 5. */
|
|
69
|
+
shingleSize?: number;
|
|
70
|
+
/** SimHash similarity (1 - Hamming/64) at/above which a pair is a candidate. Default 0.6. */
|
|
71
|
+
simhashThreshold?: number;
|
|
72
|
+
/** Fraction of a tool's shingles shared with a peer (low-population only) at/above which a pair is flagged. Default 0.25. */
|
|
73
|
+
fragmentOverlapThreshold?: number;
|
|
74
|
+
/** Max number of distinct tools a shingle may appear in before it's treated as template language, not an attack fragment. Default 3. */
|
|
75
|
+
maxFragmentPopulation?: number;
|
|
76
|
+
/** Minimum character length for a shingle to be indexed (filters trivial/common short phrases). Default 12. */
|
|
77
|
+
minShingleChars?: number;
|
|
78
|
+
/** Max sample shared fragments recorded per finding (display only). Default 5. */
|
|
79
|
+
maxSampleFragments?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface CompositionFinding {
|
|
82
|
+
toolA: string;
|
|
83
|
+
toolB: string;
|
|
84
|
+
/** 1 - (Hamming distance / 64) between the two tools' SimHash fingerprints. */
|
|
85
|
+
simhashSimilarity: number;
|
|
86
|
+
/** sharedLowPopulationShingles / min(shingleCount(A), shingleCount(B)). */
|
|
87
|
+
fragmentOverlapScore: number;
|
|
88
|
+
/** Sample of the actual shared shingle text driving the finding (truncated). */
|
|
89
|
+
sharedFragments: string[];
|
|
90
|
+
/** Max population (distinct tools) observed among the shared shingles that triggered this finding. */
|
|
91
|
+
fragmentPopulation: number;
|
|
92
|
+
reason: string;
|
|
93
|
+
}
|
|
94
|
+
export interface CompositionInspectionStats {
|
|
95
|
+
toolsScanned: number;
|
|
96
|
+
pairsCompared: number;
|
|
97
|
+
shinglesIndexed: number;
|
|
98
|
+
/** Pairs whose SimHash similarity alone crossed simhashThreshold (diagnostic — includes pairs later excluded for having no low-population shared shingle). */
|
|
99
|
+
candidatePairsFromSimhash: number;
|
|
100
|
+
}
|
|
101
|
+
export interface CompositionInspectionResult {
|
|
102
|
+
findings: CompositionFinding[];
|
|
103
|
+
stats: CompositionInspectionStats;
|
|
104
|
+
}
|
|
105
|
+
export interface CompositionGuardResult {
|
|
106
|
+
result: CompositionInspectionResult;
|
|
107
|
+
action: 'none' | 'warn' | 'block';
|
|
108
|
+
blocked: boolean;
|
|
109
|
+
message?: string;
|
|
110
|
+
}
|
|
111
|
+
/** FNV-1a, 64-bit. Deterministic, dependency-free, good avalanche for short strings. */
|
|
112
|
+
export declare function fnv1a64(input: string): bigint;
|
|
113
|
+
/**
|
|
114
|
+
* Classic SimHash: bit-vote a 64-bit fingerprint across a list of token
|
|
115
|
+
* hashes. Near-duplicate token sets (even with some fragments differing)
|
|
116
|
+
* produce fingerprints with a small Hamming distance.
|
|
117
|
+
*/
|
|
118
|
+
export declare function simhash64(shingles: readonly string[]): bigint;
|
|
119
|
+
/** Hamming distance between two 64-bit fingerprints (0..64). */
|
|
120
|
+
export declare function hammingDistance64(a: bigint, b: bigint): number;
|
|
121
|
+
export declare function inspectToolComposition(tools: readonly McpToolDescriptor[], options?: CompositionInspectorOptions): CompositionInspectionResult;
|
|
122
|
+
/** Reads `CLAUDE_FLOW_MCP_COMPOSITION_BLOCK` fresh on every call. '1' or 'true' (case-insensitive) enables blocking; unset/anything else keeps the default warn+log posture. */
|
|
123
|
+
export declare function isCompositionBlockEnabled(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Runs {@link inspectToolComposition} and applies the ADR-320 default
|
|
126
|
+
* posture: warn + log (via `console.warn`) unless
|
|
127
|
+
* `CLAUDE_FLOW_MCP_COMPOSITION_BLOCK=1`, in which case the chain is marked
|
|
128
|
+
* `blocked: true` — the caller (the pre-task hook / MCP dispatcher) decides
|
|
129
|
+
* what "blocked" means operationally; this function does not throw or abort
|
|
130
|
+
* anything itself.
|
|
131
|
+
*/
|
|
132
|
+
export declare function evaluateToolComposition(tools: readonly McpToolDescriptor[], options?: CompositionInspectorOptions): CompositionGuardResult;
|
|
133
|
+
//# sourceMappingURL=mcp-composition-inspector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-composition-inspector.d.ts","sourceRoot":"","sources":["../src/mcp-composition-inspector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAMH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,2BAA2B;IAC1C,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6HAA6H;IAC7H,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,wIAAwI;IACxI,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,+GAA+G;IAC/G,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gFAAgF;IAChF,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,sGAAsG;IACtG,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,YAAY,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