@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,0BAA0B,GAE3B,MAAM,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Application Service - Application Layer
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates security operations and provides simplified interface.
|
|
5
|
+
*
|
|
6
|
+
* @module v3/security/application/services
|
|
7
|
+
*/
|
|
8
|
+
import { SecurityContext } from '../../domain/entities/security-context.js';
|
|
9
|
+
import { ValidationResult, ThreatDetectionResult } from '../../domain/services/security-domain-service.js';
|
|
10
|
+
/**
|
|
11
|
+
* Security audit result
|
|
12
|
+
*/
|
|
13
|
+
export interface SecurityAuditResult {
|
|
14
|
+
passed: boolean;
|
|
15
|
+
score: number;
|
|
16
|
+
checks: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
passed: boolean;
|
|
19
|
+
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
20
|
+
message: string;
|
|
21
|
+
}>;
|
|
22
|
+
recommendations: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Security Application Service
|
|
26
|
+
*/
|
|
27
|
+
export declare class SecurityApplicationService {
|
|
28
|
+
private readonly domainService;
|
|
29
|
+
private readonly contexts;
|
|
30
|
+
constructor();
|
|
31
|
+
/**
|
|
32
|
+
* Create and register security context for agent
|
|
33
|
+
*/
|
|
34
|
+
createAgentContext(agentId: string, role: string): SecurityContext;
|
|
35
|
+
/**
|
|
36
|
+
* Get security context
|
|
37
|
+
*/
|
|
38
|
+
getContext(principalId: string): SecurityContext | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Remove security context
|
|
41
|
+
*/
|
|
42
|
+
removeContext(principalId: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Validate path access
|
|
45
|
+
*/
|
|
46
|
+
validatePath(path: string, principalId: string): ValidationResult;
|
|
47
|
+
/**
|
|
48
|
+
* Validate command execution
|
|
49
|
+
*/
|
|
50
|
+
validateCommand(command: string, principalId: string): ValidationResult;
|
|
51
|
+
/**
|
|
52
|
+
* Validate user input
|
|
53
|
+
*/
|
|
54
|
+
validateInput(input: string): ValidationResult;
|
|
55
|
+
/**
|
|
56
|
+
* Detect threats in content
|
|
57
|
+
*/
|
|
58
|
+
detectThreats(content: string): ThreatDetectionResult;
|
|
59
|
+
/**
|
|
60
|
+
* Run security audit on codebase
|
|
61
|
+
*/
|
|
62
|
+
auditCodebase(files: Array<{
|
|
63
|
+
path: string;
|
|
64
|
+
content: string;
|
|
65
|
+
}>): Promise<SecurityAuditResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Check if operation is allowed
|
|
68
|
+
*/
|
|
69
|
+
isOperationAllowed(principalId: string, operation: 'path' | 'command', target: string): boolean;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=security-application-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-application-service.d.ts","sourceRoot":"","sources":["../../../src/application/services/security-application-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAmB,MAAM,2CAA2C,CAAC;AAC7F,OAAO,EAAyB,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AAElI;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,OAAO,CAAC;QAChB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;QACjD,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwB;IACtD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2C;;IAUpE;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe;IAMlE;;OAEG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI5D;;OAEG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAQ3C;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,gBAAgB;IAajE;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,gBAAgB;IAavE;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAI9C;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB;IAQrD;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAsDlG;;OAEG;IACH,kBAAkB,CAChB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,GACb,OAAO;CAUX"}
|
package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Application Service - Application Layer
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates security operations and provides simplified interface.
|
|
5
|
+
*
|
|
6
|
+
* @module v3/security/application/services
|
|
7
|
+
*/
|
|
8
|
+
import { SecurityDomainService } from '../../domain/services/security-domain-service.js';
|
|
9
|
+
/**
|
|
10
|
+
* Security Application Service
|
|
11
|
+
*/
|
|
12
|
+
export class SecurityApplicationService {
|
|
13
|
+
domainService;
|
|
14
|
+
contexts = new Map();
|
|
15
|
+
constructor() {
|
|
16
|
+
this.domainService = new SecurityDomainService();
|
|
17
|
+
}
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Context Management
|
|
20
|
+
// ============================================================================
|
|
21
|
+
/**
|
|
22
|
+
* Create and register security context for agent
|
|
23
|
+
*/
|
|
24
|
+
createAgentContext(agentId, role) {
|
|
25
|
+
const context = this.domainService.createAgentContext(agentId, role);
|
|
26
|
+
this.contexts.set(agentId, context);
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get security context
|
|
31
|
+
*/
|
|
32
|
+
getContext(principalId) {
|
|
33
|
+
return this.contexts.get(principalId);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Remove security context
|
|
37
|
+
*/
|
|
38
|
+
removeContext(principalId) {
|
|
39
|
+
return this.contexts.delete(principalId);
|
|
40
|
+
}
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// Validation
|
|
43
|
+
// ============================================================================
|
|
44
|
+
/**
|
|
45
|
+
* Validate path access
|
|
46
|
+
*/
|
|
47
|
+
validatePath(path, principalId) {
|
|
48
|
+
const context = this.contexts.get(principalId);
|
|
49
|
+
if (!context) {
|
|
50
|
+
return {
|
|
51
|
+
valid: false,
|
|
52
|
+
errors: ['Security context not found'],
|
|
53
|
+
warnings: [],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return this.domainService.validatePath(path, context);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Validate command execution
|
|
60
|
+
*/
|
|
61
|
+
validateCommand(command, principalId) {
|
|
62
|
+
const context = this.contexts.get(principalId);
|
|
63
|
+
if (!context) {
|
|
64
|
+
return {
|
|
65
|
+
valid: false,
|
|
66
|
+
errors: ['Security context not found'],
|
|
67
|
+
warnings: [],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return this.domainService.validateCommand(command, context);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate user input
|
|
74
|
+
*/
|
|
75
|
+
validateInput(input) {
|
|
76
|
+
return this.domainService.validateInput(input);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Detect threats in content
|
|
80
|
+
*/
|
|
81
|
+
detectThreats(content) {
|
|
82
|
+
return this.domainService.detectThreats(content);
|
|
83
|
+
}
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// Audit
|
|
86
|
+
// ============================================================================
|
|
87
|
+
/**
|
|
88
|
+
* Run security audit on codebase
|
|
89
|
+
*/
|
|
90
|
+
async auditCodebase(files) {
|
|
91
|
+
const checks = [];
|
|
92
|
+
const recommendations = [];
|
|
93
|
+
let criticalCount = 0;
|
|
94
|
+
let highCount = 0;
|
|
95
|
+
for (const file of files) {
|
|
96
|
+
const threats = this.domainService.detectThreats(file.content);
|
|
97
|
+
for (const threat of threats.threats) {
|
|
98
|
+
checks.push({
|
|
99
|
+
name: `${threat.type} in ${file.path}`,
|
|
100
|
+
passed: false,
|
|
101
|
+
severity: threat.severity,
|
|
102
|
+
message: threat.description,
|
|
103
|
+
});
|
|
104
|
+
if (threat.severity === 'critical')
|
|
105
|
+
criticalCount++;
|
|
106
|
+
if (threat.severity === 'high')
|
|
107
|
+
highCount++;
|
|
108
|
+
}
|
|
109
|
+
if (threats.safe) {
|
|
110
|
+
checks.push({
|
|
111
|
+
name: `Security check: ${file.path}`,
|
|
112
|
+
passed: true,
|
|
113
|
+
severity: 'low',
|
|
114
|
+
message: 'No threats detected',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Generate recommendations
|
|
119
|
+
if (criticalCount > 0) {
|
|
120
|
+
recommendations.push('Address critical security issues immediately');
|
|
121
|
+
}
|
|
122
|
+
if (highCount > 0) {
|
|
123
|
+
recommendations.push('Review and fix high-severity findings');
|
|
124
|
+
}
|
|
125
|
+
recommendations.push('Run regular security scans');
|
|
126
|
+
recommendations.push('Keep dependencies updated');
|
|
127
|
+
// Calculate score
|
|
128
|
+
const totalChecks = checks.length;
|
|
129
|
+
const passedChecks = checks.filter((c) => c.passed).length;
|
|
130
|
+
const score = totalChecks > 0 ? Math.round((passedChecks / totalChecks) * 100) : 100;
|
|
131
|
+
return {
|
|
132
|
+
passed: criticalCount === 0 && highCount === 0,
|
|
133
|
+
score,
|
|
134
|
+
checks,
|
|
135
|
+
recommendations,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Check if operation is allowed
|
|
140
|
+
*/
|
|
141
|
+
isOperationAllowed(principalId, operation, target) {
|
|
142
|
+
const context = this.contexts.get(principalId);
|
|
143
|
+
if (!context || context.isExpired())
|
|
144
|
+
return false;
|
|
145
|
+
if (operation === 'path') {
|
|
146
|
+
return context.canAccessPath(target);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return context.canExecuteCommand(target);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=security-application-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-application-service.js","sourceRoot":"","sources":["../../../src/application/services/security-application-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,qBAAqB,EAA2C,MAAM,kDAAkD,CAAC;AAiBlI;;GAEG;AACH,MAAM,OAAO,0BAA0B;IACpB,aAAa,CAAwB;IACrC,QAAQ,GAAiC,IAAI,GAAG,EAAE,CAAC;IAEpE;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,qBAAqB,EAAE,CAAC;IACnD,CAAC;IAED,+EAA+E;IAC/E,qBAAqB;IACrB,+EAA+E;IAE/E;;OAEG;IACH,kBAAkB,CAAC,OAAe,EAAE,IAAY;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,WAAmB;QAC5B,OAAO,IAAI,C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AC,CAAC;QAChE,CAAC;QACD,eAAe,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACnD,eAAe,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAElD,kBAAkB;QAClB,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;QAClC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QAC3D,MAAM,KAAK,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAErF,OAAO;YACL,MAAM,EAAE,aAAa,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC;YAC9C,KAAK;YACL,MAAM;YACN,eAAe;SAChB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,kBAAkB,CAChB,WAAmB,EACnB,SAA6B,EAC7B,MAAc;QAEd,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE;YAAE,OAAO,KAAK,CAAC;QAElD,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;YACzB,OAAO,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentAuthorizationPropagator — action-layer security for agent delegation.
|
|
3
|
+
*
|
|
4
|
+
* Implements P1 of ADR-144 (ruvnet/ruflo#2248): scope-envelope on SendMessage
|
|
5
|
+
* + per-action authorization checks. P2-P5 wire this into the comms layer,
|
|
6
|
+
* MCP dispatcher, MCP auth validator, and provenance log respectively.
|
|
7
|
+
*
|
|
8
|
+
* Threat model
|
|
9
|
+
* ------------
|
|
10
|
+
* When agent A delegates a task to agent B via SendMessage, B can today
|
|
11
|
+
* escalate the granted scope by calling tools A was never authorized to
|
|
12
|
+
* invoke. RBAC/ABAC on agent roles do not solve this — roles don't compose
|
|
13
|
+
* under dynamic LLM delegation (arXiv:2605.05440, Grade A formal analysis).
|
|
14
|
+
*
|
|
15
|
+
* The fix is scope-based propagation: every SendMessage carries an
|
|
16
|
+
* `AuthScope` that is *monotonically reducing* — each hop can drop tools or
|
|
17
|
+
* servers from the granted set but never add them. This is the same shape
|
|
18
|
+
* as OAuth scope reduction; adding back a tool requires talking to the
|
|
19
|
+
* original principal out-of-band.
|
|
20
|
+
*
|
|
21
|
+
* Scope
|
|
22
|
+
* -----
|
|
23
|
+
* - P1 (this file): the component, the envelope, the type-level invariants.
|
|
24
|
+
* No call sites yet — adding the wrapping/enforcement in P2-P4.
|
|
25
|
+
* - All operations synchronous, pure, allocation-light. Targets < 1 ms p99
|
|
26
|
+
* for `wrapOutbound` + `checkToolCall` so it can sit on every SendMessage.
|
|
27
|
+
*
|
|
28
|
+
* Backwards compatibility
|
|
29
|
+
* -----------------------
|
|
30
|
+
* `scope` on the envelope is optional in v1. Agents without scope set
|
|
31
|
+
* operate in legacy permissive mode (all tools allowed, depth unlimited,
|
|
32
|
+
* server auth unchecked). `CLAUDE_FLOW_STRICT_AUTH=true` enables enforcement.
|
|
33
|
+
*
|
|
34
|
+
* Reference: ADR-144, arXiv:2605.05440 (Authorization Propagation),
|
|
35
|
+
* arXiv:2605.28914 (AIRGuard), arXiv:2605.22333 (MCP auth survey).
|
|
36
|
+
*/
|
|
37
|
+
/** Scope granted to an agent at a delegation hop. Monotonically reducing. */
|
|
38
|
+
export interface AuthScope {
|
|
39
|
+
/** Stable identifier of the originating principal (agent or user). */
|
|
40
|
+
readonly principalId: string;
|
|
41
|
+
/** MCP tool IDs this scope is allowed to call. */
|
|
42
|
+
readonly grantedTools: ReadonlyArray<string>;
|
|
43
|
+
/** MCP server IDs whose tool responses this scope will accept. */
|
|
44
|
+
readonly grantedServers: ReadonlyArray<string>;
|
|
45
|
+
/** Max remaining delegation hops. Decrements on every `wrapOutbound`. */
|
|
46
|
+
readonly delegationDepth: number;
|
|
47
|
+
/** Unix ms after which this scope is no longer valid. */
|
|
48
|
+
readonly expiresAt: number;
|
|
49
|
+
/**
|
|
50
|
+
* Optional opaque ID for cross-referencing with ADR-144 P5 provenance log
|
|
51
|
+
* and ADR-146 telemetry events. Callers should treat as a correlation
|
|
52
|
+
* handle, not a security claim.
|
|
53
|
+
*/
|
|
54
|
+
readonly scopeId?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Envelope shape attached to every SendMessage when strict-auth is on. */
|
|
57
|
+
export interface SendMessageEnvelope<T = unknown> {
|
|
58
|
+
/** Authorization scope governing what the receiver may do. */
|
|
59
|
+
readonly scope: AuthScope;
|
|
60
|
+
/** The original SendMessage payload, untouched. */
|
|
61
|
+
readonly payload: T;
|
|
62
|
+
}
|
|
63
|
+
/** Decision returned by `checkToolCall`. Never throws. */
|
|
64
|
+
export interface ToolCallDecision {
|
|
65
|
+
readonly allowed: boolean;
|
|
66
|
+
/** Human-readable reason; stable enough to match in tests/telemetry. */
|
|
67
|
+
readonly reason?: 'tool-not-in-scope' | 'server-not-in-scope' | 'scope-expired' | 'delegation-depth-exhausted' | 'principal-mismatch';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Wrap-failure reasons surfaced to callers as a typed error. We use a
|
|
71
|
+
* discriminated union rather than throwing so the comms layer (P2) can
|
|
72
|
+
* decide whether to drop the SendMessage or surface to the user.
|
|
73
|
+
*/
|
|
74
|
+
export declare class AuthorizationPropagationError extends Error {
|
|
75
|
+
readonly code: 'scope-cannot-grow' | 'depth-underflow' | 'scope-expired' | 'principal-mismatch';
|
|
76
|
+
constructor(code: 'scope-cannot-grow' | 'depth-underflow' | 'scope-expired' | 'principal-mismatch', message: string);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Construct a default permissive scope. Used in legacy mode when no scope
|
|
80
|
+
* was attached upstream. Callers SHOULD migrate to explicit scopes; this is
|
|
81
|
+
* here so the propagator never has to special-case "no scope".
|
|
82
|
+
*/
|
|
83
|
+
export declare function makeLegacyPermissiveScope(principalId?: string): AuthScope;
|
|
84
|
+
/**
|
|
85
|
+
* `AgentAuthorizationPropagator` — the load-bearing component for ADR-144.
|
|
86
|
+
*
|
|
87
|
+
* Construction is intentionally cheap (no I/O, no async). Callers can build
|
|
88
|
+
* a fresh instance per task without overhead, or share one — it holds no
|
|
89
|
+
* mutable state beyond the optional provenance buffer.
|
|
90
|
+
*/
|
|
91
|
+
export declare class AgentAuthorizationPropagator {
|
|
92
|
+
private readonly opts;
|
|
93
|
+
/**
|
|
94
|
+
* In-memory provenance buffer. P5 will flush this to the structured
|
|
95
|
+
* telemetry sink (ADR-146 GuardrailEvent shape). For P1 we just retain
|
|
96
|
+
* the last N events for inspection/tests.
|
|
97
|
+
*/
|
|
98
|
+
private readonly provenance;
|
|
99
|
+
constructor(opts?: {
|
|
100
|
+
provenanceBufferMax?: number;
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Attach a reduced scope to an outbound SendMessage.
|
|
104
|
+
*
|
|
105
|
+
* Invariants enforced (throws `AuthorizationPropagationError` on violation):
|
|
106
|
+
* - newly granted tools MUST be a subset of `currentScope.grantedTools`
|
|
107
|
+
* - newly granted servers MUST be a subset of `currentScope.grantedServers`
|
|
108
|
+
* - delegationDepth MUST decrement by ≥ 1 (must remain ≥ 0)
|
|
109
|
+
* - principalId is propagated unchanged
|
|
110
|
+
* - expiresAt cannot be extended; copied from the holder
|
|
111
|
+
*/
|
|
112
|
+
wrapOutbound<T>(payload: T, currentScope: AuthScope, requested?: {
|
|
113
|
+
tools?: ReadonlyArray<string>;
|
|
114
|
+
servers?: ReadonlyArray<string>;
|
|
115
|
+
}): SendMessageEnvelope<T>;
|
|
116
|
+
/**
|
|
117
|
+
* Validate a single tool call against a scope. Pure; never throws. Use the
|
|
118
|
+
* result's `allowed` to make the dispatch decision.
|
|
119
|
+
*/
|
|
120
|
+
checkToolCall(toolId: string, scope: AuthScope, opts?: {
|
|
121
|
+
serverId?: string;
|
|
122
|
+
now?: number;
|
|
123
|
+
}): ToolCallDecision;
|
|
124
|
+
/**
|
|
125
|
+
* Verify an MCP server presented a valid credential before its response is
|
|
126
|
+
* consumed. P1 ships a permissive default (any non-empty credential is
|
|
127
|
+
* accepted) so the API is stable; P4 wires this to a real validator.
|
|
128
|
+
*
|
|
129
|
+
* Returns `false` on missing/empty credential; callers MUST treat `false`
|
|
130
|
+
* as a hard reject (same rule as ADR-131 reject findings).
|
|
131
|
+
*/
|
|
132
|
+
verifyServerAuth(serverId: string, credential: unknown): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Record an action in the provenance buffer. P5 will route to telemetry;
|
|
135
|
+
* P1 keeps the last N events for test inspection and post-incident audit.
|
|
136
|
+
*/
|
|
137
|
+
recordAction(agentId: string, toolId: string, scope: AuthScope, outcome: 'allowed' | 'denied', reason?: string): void;
|
|
138
|
+
/** Read-only view of recorded provenance for tests + audit CLI (P5). */
|
|
139
|
+
getProvenance(): ReadonlyArray<{
|
|
140
|
+
agentId: string;
|
|
141
|
+
toolId: string;
|
|
142
|
+
scope: AuthScope;
|
|
143
|
+
outcome: 'allowed' | 'denied';
|
|
144
|
+
reason?: string;
|
|
145
|
+
ts: number;
|
|
146
|
+
}>;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=propagator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagator.d.ts","sourceRoot":"","sources":["../../src/authorization/propagator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,6EAA6E;AAC7E,M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C,UAAU,CAOnB;gBAEqB,IAAI,GAAE;QAAE,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAAO;IAExE;;;;;;;;;OASG;IACH,YAAY,CAAC,CAAC,EACZ,OAAO,EAAE,CAAC,EACV,YAAY,EAAE,SAAS,EACvB,SAAS,GAAE;QAAE,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAAC,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;KAAO,GACjF,mBAAmB,CAAC,CAAC,CAAC;IAsCzB;;;OAGG;IACH,aAAa,CACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,EAChB,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAO,GAC7C,gBAAgB;IAanB;;;;;;;OAOG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO;IAOhE;;;OAGG;IACH,YAAY,CACV,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,SAAS,GAAG,QAAQ,EAC7B,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;IAMP,wEAAwE;IACxE,aAAa,IAAI,aAAa,CAAC;QAC7B,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,SAAS,CAAC;QACjB,OAAO,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CAGH"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentAuthorizationPropagator — action-layer security for agent delegation.
|
|
3
|
+
*
|
|
4
|
+
* Implements P1 of ADR-144 (ruvnet/ruflo#2248): scope-envelope on SendMessage
|
|
5
|
+
* + per-action authorization checks. P2-P5 wire this into the comms layer,
|
|
6
|
+
* MCP dispatcher, MCP auth validator, and provenance log respectively.
|
|
7
|
+
*
|
|
8
|
+
* Threat model
|
|
9
|
+
* ------------
|
|
10
|
+
* When agent A delegates a task to agent B via SendMessage, B can today
|
|
11
|
+
* escalate the granted scope by calling tools A was never authorized to
|
|
12
|
+
* invoke. RBAC/ABAC on agent roles do not solve this — roles don't compose
|
|
13
|
+
* under dynamic LLM delegation (arXiv:2605.05440, Grade A formal analysis).
|
|
14
|
+
*
|
|
15
|
+
* The fix is scope-based propagation: every SendMessage carries an
|
|
16
|
+
* `AuthScope` that is *monotonically reducing* — each hop can drop tools or
|
|
17
|
+
* servers from the granted set but never add them. This is the same shape
|
|
18
|
+
* as OAuth scope reduction; adding back a tool requires talking to the
|
|
19
|
+
* original principal out-of-band.
|
|
20
|
+
*
|
|
21
|
+
* Scope
|
|
22
|
+
* -----
|
|
23
|
+
* - P1 (this file): the component, the envelope, the type-level invariants.
|
|
24
|
+
* No call sites yet — adding the wrapping/enforcement in P2-P4.
|
|
25
|
+
* - All operations synchronous, pure, allocation-light. Targets < 1 ms p99
|
|
26
|
+
* for `wrapOutbound` + `checkToolCall` so it can sit on every SendMessage.
|
|
27
|
+
*
|
|
28
|
+
* Backwards compatibility
|
|
29
|
+
* -----------------------
|
|
30
|
+
* `scope` on the envelope is optional in v1. Agents without scope set
|
|
31
|
+
* operate in legacy permissive mode (all tools allowed, depth unlimited,
|
|
32
|
+
* server auth unchecked). `CLAUDE_FLOW_STRICT_AUTH=true` enables enforcement.
|
|
33
|
+
*
|
|
34
|
+
* Reference: ADR-144, arXiv:2605.05440 (Authorization Propagation),
|
|
35
|
+
* arXiv:2605.28914 (AIRGuard), arXiv:2605.22333 (MCP auth survey).
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Wrap-failure reasons surfaced to callers as a typed error. We use a
|
|
39
|
+
* discriminated union rather than throwing so the comms layer (P2) can
|
|
40
|
+
* decide whether to drop the SendMessage or surface to the user.
|
|
41
|
+
*/
|
|
42
|
+
export class AuthorizationPropagationError extends Error {
|
|
43
|
+
code;
|
|
44
|
+
constructor(code, message) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.code = code;
|
|
47
|
+
this.name = 'AuthorizationPropagationError';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Construct a default permissive scope. Used in legacy mode when no scope
|
|
52
|
+
* was attached upstream. Callers SHOULD migrate to explicit scopes; this is
|
|
53
|
+
* here so the propagator never has to special-case "no scope".
|
|
54
|
+
*/
|
|
55
|
+
export function makeLegacyPermissiveScope(principalId = 'legacy') {
|
|
56
|
+
return {
|
|
57
|
+
principalId,
|
|
58
|
+
grantedTools: ['*'], // sentinel — see `checkToolCall`
|
|
59
|
+
grantedServers: ['*'],
|
|
60
|
+
delegationDepth: Number.MAX_SAFE_INTEGER,
|
|
61
|
+
expiresAt: Number.MAX_SAFE_INTEGER,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* `AgentAuthorizationPropagator` — the load-bearing component for ADR-144.
|
|
66
|
+
*
|
|
67
|
+
* Construction is intentionally cheap (no I/O, no async). Callers can build
|
|
68
|
+
* a fresh instance per task without overhead, or share one — it holds no
|
|
69
|
+
* mutable state beyond the optional provenance buffer.
|
|
70
|
+
*/
|
|
71
|
+
export class AgentAuthorizationPropagator {
|
|
72
|
+
opts;
|
|
73
|
+
/**
|
|
74
|
+
* In-memory provenance buffer. P5 will flush this to the structured
|
|
75
|
+
* telemetry sink (ADR-146 GuardrailEvent shape). For P1 we just retain
|
|
76
|
+
* the last N events for inspection/tests.
|
|
77
|
+
*/
|
|
78
|
+
provenance = [];
|
|
79
|
+
constructor(opts = {}) {
|
|
80
|
+
this.opts = opts;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Attach a reduced scope to an outbound SendMessage.
|
|
84
|
+
*
|
|
85
|
+
* Invariants enforced (throws `AuthorizationPropagationError` on violation):
|
|
86
|
+
* - newly granted tools MUST be a subset of `currentScope.grantedTools`
|
|
87
|
+
* - newly granted servers MUST be a subset of `currentScope.grantedServers`
|
|
88
|
+
* - delegationDepth MUST decrement by ≥ 1 (must remain ≥ 0)
|
|
89
|
+
* - principalId is propagated unchanged
|
|
90
|
+
* - expiresAt cannot be extended; copied from the holder
|
|
91
|
+
*/
|
|
92
|
+
wrapOutbound(payload, currentScope, requested = {}) {
|
|
93
|
+
if (currentScope.delegationDepth <= 0) {
|
|
94
|
+
throw new AuthorizationPropagationError('depth-underflow', `cannot delegate further — delegationDepth=${currentScope.delegationDepth}`);
|
|
95
|
+
}
|
|
96
|
+
const now = Date.now();
|
|
97
|
+
if (currentScope.expiresAt <= now) {
|
|
98
|
+
throw new AuthorizationPropagationError('scope-expired', `scope expired at ${new Date(currentScope.expiresAt).toISOString()}`);
|
|
99
|
+
}
|
|
100
|
+
const reducedTools = subsetOrThrow(currentScope.grantedTools, requested.tools ?? currentScope.grantedTools, 'tools');
|
|
101
|
+
const reducedServers = subsetOrThrow(currentScope.grantedServers, requested.servers ?? currentScope.grantedServers, 'servers');
|
|
102
|
+
const reducedScope = {
|
|
103
|
+
principalId: currentScope.principalId,
|
|
104
|
+
grantedTools: reducedTools,
|
|
105
|
+
grantedServers: reducedServers,
|
|
106
|
+
delegationDepth: currentScope.delegationDepth - 1,
|
|
107
|
+
expiresAt: currentScope.expiresAt,
|
|
108
|
+
scopeId: currentScope.scopeId,
|
|
109
|
+
};
|
|
110
|
+
return { scope: reducedScope, payload };
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Validate a single tool call against a scope. Pure; never throws. Use the
|
|
114
|
+
* result's `allowed` to make the dispatch decision.
|
|
115
|
+
*/
|
|
116
|
+
checkToolCall(toolId, scope, opts = {}) {
|
|
117
|
+
const now = opts.now ?? Date.now();
|
|
118
|
+
if (scope.expiresAt <= now)
|
|
119
|
+
return { allowed: false, reason: 'scope-expired' };
|
|
120
|
+
if (!matchesScopeList(scope.grantedTools, toolId)) {
|
|
121
|
+
return { allowed: false, reason: 'tool-not-in-scope' };
|
|
122
|
+
}
|
|
123
|
+
if (opts.serverId && !matchesScopeList(scope.grantedServers, opts.serverId)) {
|
|
124
|
+
return { allowed: false, reason: 'server-not-in-scope' };
|
|
125
|
+
}
|
|
126
|
+
return { allowed: true };
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Verify an MCP server presented a valid credential before its response is
|
|
130
|
+
* consumed. P1 ships a permissive default (any non-empty credential is
|
|
131
|
+
* accepted) so the API is stable; P4 wires this to a real validator.
|
|
132
|
+
*
|
|
133
|
+
* Returns `false` on missing/empty credential; callers MUST treat `false`
|
|
134
|
+
* as a hard reject (same rule as ADR-131 reject findings).
|
|
135
|
+
*/
|
|
136
|
+
verifyServerAuth(serverId, credential) {
|
|
137
|
+
if (!serverId || typeof serverId !== 'string')
|
|
138
|
+
return false;
|
|
139
|
+
if (credential == null)
|
|
140
|
+
return false;
|
|
141
|
+
if (typeof credential === 'string' && credential.trim().length === 0)
|
|
142
|
+
return false;
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Record an action in the provenance buffer. P5 will route to telemetry;
|
|
147
|
+
* P1 keeps the last N events for test inspection and post-incident audit.
|
|
148
|
+
*/
|
|
149
|
+
recordAction(agentId, toolId, scope, outcome, reason) {
|
|
150
|
+
const max = this.opts.provenanceBufferMax ?? 1024;
|
|
151
|
+
this.provenance.push({ agentId, toolId, scope, outcome, reason, ts: Date.now() });
|
|
152
|
+
if (this.provenance.length > max)
|
|
153
|
+
this.provenance.splice(0, this.provenance.length - max);
|
|
154
|
+
}
|
|
155
|
+
/** Read-only view of recorded provenance for tests + audit CLI (P5). */
|
|
156
|
+
getProvenance() {
|
|
157
|
+
return this.provenance.slice();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// ─── helpers ────────────────────────────────────────────────────────────
|
|
161
|
+
function subsetOrThrow(parent, requested, kind) {
|
|
162
|
+
if (parent.includes('*'))
|
|
163
|
+
return Array.from(new Set(requested));
|
|
164
|
+
for (const item of requested) {
|
|
165
|
+
if (!parent.includes(item) && item !== '*') {
|
|
166
|
+
throw new AuthorizationPropagationError('scope-cannot-grow', `cannot grant ${kind} '${item}' — not in parent scope`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// De-duplicate; preserve requested order
|
|
170
|
+
const seen = new Set();
|
|
171
|
+
const out = [];
|
|
172
|
+
for (const r of requested)
|
|
173
|
+
if (!seen.has(r))
|
|
174
|
+
(seen.add(r), out.push(r));
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
function matchesScopeList(list, item) {
|
|
178
|
+
if (list.includes('*'))
|
|
179
|
+
return true;
|
|
180
|
+
return list.includes(item);
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=propagator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagator.js","sourceRoot":"","sources":["../../src/authorization/propagator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AA0CH;;;;GAIG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAEpC;IADlB,YACkB,IAIQ,EACxB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAPC,SAAI,GAAJ,IAAI,CAII;QAIxB,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,WAAW,GAAG,QAAQ;IAC9D,OAAO;QACL,WAAW;QACX,YAAY,EAAE,CAAC,GAAG,CAAC,EAAM,iCAAiC;QAC1D,cAAc,EAAE,CAAC,GAAG,CAAC;QACrB,eAAe,EAAE,MAAM,CAAC,gBAAgB;QACxC,SAAS,EAAE,MAAM,CAAC,gBAAgB;KACnC,CAAC;AACJ,CAAC;A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