@claude-flow/cli 3.32.26 → 3.32.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/helpers/.helpers-version +1 -1
- package/.claude/helpers/helpers.manifest.json +2 -2
- package/catalog-manifest.json +4 -4
- package/dist/src/commands/index.d.ts +1 -0
- package/dist/src/commands/index.js +5 -3
- package/dist/src/commands/memory.js +49 -5
- package/dist/src/commands/metaharness.js +25 -5
- package/dist/src/commands/policy.d.ts +4 -0
- package/dist/src/commands/policy.js +107 -0
- package/dist/src/index.js +18 -0
- package/dist/src/init/claudemd-generator.js +53 -2
- package/dist/src/mcp-client.js +25 -1
- package/dist/src/mcp-tools/capability-brain.d.ts +134 -0
- package/dist/src/mcp-tools/capability-brain.js +697 -0
- package/dist/src/mcp-tools/guidance-tools.d.ts +2 -0
- package/dist/src/mcp-tools/guidance-tools.js +369 -37
- package/dist/src/mcp-tools/index.d.ts +4 -1
- package/dist/src/mcp-tools/index.js +3 -1
- package/dist/src/mcp-tools/memory-tools.js +26 -0
- package/dist/src/mcp-tools/metaharness-tools.js +27 -1
- package/dist/src/mcp-tools/policy-tools.d.ts +3 -0
- package/dist/src/mcp-tools/policy-tools.js +121 -0
- package/dist/src/memory/memory-bridge.d.ts +11 -0
- package/dist/src/memory/memory-bridge.js +100 -21
- package/dist/src/memory/memory-initializer.d.ts +22 -1
- package/dist/src/memory/memory-initializer.js +184 -39
- package/dist/src/services/bounded-worker-pool.d.ts +28 -0
- package/dist/src/services/bounded-worker-pool.js +90 -0
- package/dist/src/services/harness-flywheel-runtime.d.ts +2 -0
- package/dist/src/services/harness-flywheel-runtime.js +18 -0
- package/dist/src/services/harness-flywheel.d.ts +4 -1
- package/dist/src/services/harness-flywheel.js +27 -6
- package/dist/src/services/policy-runtime.d.ts +38 -0
- package/dist/src/services/policy-runtime.js +340 -0
- package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
- package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
- package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
- package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
- package/node_modules/@claude-flow/codex/README.md +1044 -0
- package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
- package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
- package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/index.js +54 -0
- package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
- package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/types.js +8 -0
- package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/package.json +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
- package/node_modules/@claude-flow/security/README.md +292 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
- package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
- package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
- package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
- package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
- package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/index.js +176 -0
- package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
- package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
- package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
- package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
- package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
- package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
- package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
- package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
- package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
- package/node_modules/@claude-flow/security/package.json +44 -0
- package/package.json +44 -12
- package/plugins/ruflo-metaharness/scripts/smoke.sh +22 -14
- package/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs +3 -1
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import * as ed from '@noble/ed25519';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
// @noble/ed25519 v2 needs a sync sha512 wired explicitly.
|
|
6
|
+
ed.etc.sha512Sync = (...m) => {
|
|
7
|
+
const h = createHash('sha512');
|
|
8
|
+
for (const x of m)
|
|
9
|
+
h.update(x);
|
|
10
|
+
return h.digest();
|
|
11
|
+
};
|
|
12
|
+
import { FederationCoordinator } from './application/federation-coordinator.js';
|
|
13
|
+
import { DiscoveryService } from './domain/services/discovery-service.js';
|
|
14
|
+
import { HandshakeService } from './domain/services/handshake-service.js';
|
|
15
|
+
import { RoutingService } from './domain/services/routing-service.js';
|
|
16
|
+
import { AuditService } from './domain/services/audit-service.js';
|
|
17
|
+
import { PIIPipelineService } from './domain/services/pii-pipeline-service.js';
|
|
18
|
+
import { TrustEvaluator } from './application/trust-evaluator.js';
|
|
19
|
+
import { PolicyEngine } from './application/policy-engine.js';
|
|
20
|
+
import { createFederationClaimChecker, } from './application/claim-checker.js';
|
|
21
|
+
import { getTrustLevelLabel } from './domain/entities/trust-level.js';
|
|
22
|
+
// ADR-104: real wire transport via agentic-flow loader pattern.
|
|
23
|
+
// ADR-120: midstream-aware loader wraps the agentic-flow loader so
|
|
24
|
+
// when `midstreamer` (ruvnet/midstream) ships its production QUIC
|
|
25
|
+
// build (Step 1 of ADR-120) and operators opt in with
|
|
26
|
+
// MIDSTREAMER_QUIC_NATIVE=1, the federation transport auto-upgrades.
|
|
27
|
+
// Until then, the wrapper transparently defers to the agentic-flow
|
|
28
|
+
// loader — which itself resolves to WebSocketFallbackTransport
|
|
29
|
+
// today, or native QUIC when AGENTIC_FLOW_QUIC_NATIVE=1.
|
|
30
|
+
import { loadFederationTransport, } from './transport/midstream-aware-loader.js';
|
|
31
|
+
import { DEFAULT_ENVELOPE_SIGNATURE_MODE, JCS_SIGNATURE_PROTOCOL, canonicalizeEnvelopeForVerify, dispatchInbound, selectEnvelopeSignatureVersion, } from './application/inbound-dispatcher.js';
|
|
32
|
+
import { createMcpTools } from './mcp-tools.js';
|
|
33
|
+
import { createCliCommands } from './cli-commands.js';
|
|
34
|
+
import { FEDERATION_PLUGIN_VERSION } from './version.js';
|
|
35
|
+
// A2A (Agent2Agent, Linux Foundation) Agent Card adapter — cards only.
|
|
36
|
+
// Opt-in via config.a2aCard; serves /.well-known/agent-card.json on a
|
|
37
|
+
// 127.0.0.1-default bind (ADR-166 posture preserved).
|
|
38
|
+
import { toAgentCard } from './a2a/agent-card.js';
|
|
39
|
+
import { startAgentCardServer } from './a2a/well-known.js';
|
|
40
|
+
export class AgentFederationPlugin {
|
|
41
|
+
name = '@claude-flow/plugin-agent-federation';
|
|
42
|
+
version = FEDERATION_PLUGIN_VERSION;
|
|
43
|
+
description = 'Cross-installation agent federation with PII protection and AI defence';
|
|
44
|
+
author = 'Claude Flow Team';
|
|
45
|
+
dependencies = ['@claude-flow/security', '@claude-flow/aidefence'];
|
|
46
|
+
coordinator = null;
|
|
47
|
+
context = null;
|
|
48
|
+
// ADR-104: live transport instance, created in initialize() and torn
|
|
49
|
+
// down in shutdown(). Null when transport is disabled (the legacy
|
|
50
|
+
// in-process behavior — preserves backward compat for tests that
|
|
51
|
+
// don't supply a port).
|
|
52
|
+
transport = null;
|
|
53
|
+
// A2A Agent Card well-known endpoint (opt-in via config.a2aCard). Null
|
|
54
|
+
// when the HTTP surface is off — everything else works without it.
|
|
55
|
+
agentCardServer = null;
|
|
56
|
+
async initialize(context) {
|
|
57
|
+
this.context = context;
|
|
58
|
+
const config = context.config;
|
|
59
|
+
const nodeId = config['nodeId'] ?? `node-${Date.now().toString(36)}`;
|
|
60
|
+
const endpoint = config['endpoint'] ?? 'ws://localhost:9100';
|
|
61
|
+
const complianceMode = config['complianceMode'] ?? 'none';
|
|
62
|
+
const staticPeers = config['staticPeers'] ?? [];
|
|
63
|
+
const hashSalt = config['hashSalt'] ?? `salt-${nodeId}`;
|
|
64
|
+
const signatureMode = config['signatureMode']
|
|
65
|
+
?? DEFAULT_ENVELOPE_SIGNATURE_MODE;
|
|
66
|
+
if (!['legacy', 'prefer-jcs', 'require-jcs'].includes(signatureMode)) {
|
|
67
|
+
throw new TypeError(`Unsupported federation signature mode: ${String(signatureMode)}`);
|
|
68
|
+
}
|
|
69
|
+
// ADR-095 G2: real Ed25519 keypair instead of empty publicKey + stub
|
|
70
|
+
// signatures. Persist to .claude-flow/federation/key-<nodeId>.json so
|
|
71
|
+
// the same node identity survives restarts. Audit log
|
|
72
|
+
// audit_1776483149979 flagged the previous "verifySignature returns
|
|
73
|
+
// true unconditionally" as a critical authn bypass; this closes it.
|
|
74
|
+
const keyDir = join(process.cwd(), '.claude-flow', 'federation');
|
|
75
|
+
const keyPath = join(keyDir, `key-${nodeId}.json`);
|
|
76
|
+
let privateKey;
|
|
77
|
+
let publicKeyHex;
|
|
78
|
+
try {
|
|
79
|
+
if (existsSync(keyPath)) {
|
|
80
|
+
const stored = JSON.parse(readFileSync(keyPath, 'utf-8'));
|
|
81
|
+
privateKey = new Uint8Array(Buffer.from(stored.privateKey, 'hex'));
|
|
82
|
+
publicKeyHex = stored.publicKey;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
privateKey = ed.utils.randomPrivateKey();
|
|
86
|
+
const pk = ed.getPublicKey(privateKey);
|
|
87
|
+
publicKeyHex = Buffer.from(pk).toString('hex');
|
|
88
|
+
if (!existsSync(keyDir))
|
|
89
|
+
mkdirSync(keyDir, { recursive: true, mode: 0o700 });
|
|
90
|
+
writeFileSync(keyPath, JSON.stringify({
|
|
91
|
+
nodeId,
|
|
92
|
+
privateKey: Buffer.from(privateKey).toString('hex'),
|
|
93
|
+
publicKey: publicKeyHex,
|
|
94
|
+
createdAt: new Date().toISOString(),
|
|
95
|
+
}, null, 2), { mode: 0o600 });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
// Fall back to ephemeral key if persistence fails — still real crypto.
|
|
100
|
+
privateKey = ed.utils.randomPrivateKey();
|
|
101
|
+
const pk = ed.getPublicKey(privateKey);
|
|
102
|
+
publicKeyHex = Buffer.from(pk).toString('hex');
|
|
103
|
+
context.logger.warn(`Federation: could not persist keypair (${err instanceof Error ? err.message : err}); using ephemeral key for this session`);
|
|
104
|
+
}
|
|
105
|
+
const coordConfig = {
|
|
106
|
+
nodeId,
|
|
107
|
+
publicKey: publicKeyHex,
|
|
108
|
+
endpoint,
|
|
109
|
+
capabilities: [
|
|
110
|
+
'send',
|
|
111
|
+
'receive',
|
|
112
|
+
'query-redacted',
|
|
113
|
+
'status',
|
|
114
|
+
'ping',
|
|
115
|
+
'discovery',
|
|
116
|
+
...(signatureMode === 'legacy' ? [] : [JCS_SIGNATURE_PROTOCOL]),
|
|
117
|
+
],
|
|
118
|
+
supportedProtocols: [
|
|
119
|
+
'websocket',
|
|
120
|
+
'http',
|
|
121
|
+
...(signatureMode === 'legacy' ? [] : [JCS_SIGNATURE_PROTOCOL]),
|
|
122
|
+
],
|
|
123
|
+
version: FEDERATION_PLUGIN_VERSION,
|
|
124
|
+
};
|
|
125
|
+
const generateId = () => `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
126
|
+
// ADR-095 G2: real signing + verification using @noble/ed25519. The
|
|
127
|
+
// sign* helpers use this node's private key; verify* helpers accept
|
|
128
|
+
// a peer's public key over the wire and check the signature with
|
|
129
|
+
// ed.verify(). No "return true" stubs.
|
|
130
|
+
const signBytes = (msg) => {
|
|
131
|
+
const sig = ed.sign(new TextEncoder().encode(msg), privateKey);
|
|
132
|
+
return Buffer.from(sig).toString('hex');
|
|
133
|
+
};
|
|
134
|
+
const verifyBytes = (msg, signatureHex, peerPublicKeyHex) => {
|
|
135
|
+
try {
|
|
136
|
+
if (!signatureHex || !peerPublicKeyHex)
|
|
137
|
+
return false;
|
|
138
|
+
return ed.verify(Buffer.from(signatureHex, 'hex'), new TextEncoder().encode(msg), Buffer.from(peerPublicKeyHex, 'hex'));
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
// Canonical manifest serialization for signing — sorts keys to keep
|
|
145
|
+
// sign/verify deterministic. Excludes the signature field itself.
|
|
146
|
+
const canonicalize = (obj) => {
|
|
147
|
+
const stripped = {};
|
|
148
|
+
for (const k of Object.keys(obj).sort()) {
|
|
149
|
+
if (k === 'signature')
|
|
150
|
+
continue;
|
|
151
|
+
const v = obj[k];
|
|
152
|
+
stripped[k] = (v && typeof v === 'object' && !Array.isArray(v))
|
|
153
|
+
? JSON.parse(canonicalize(v))
|
|
154
|
+
: v;
|
|
155
|
+
}
|
|
156
|
+
return JSON.stringify(stripped);
|
|
157
|
+
};
|
|
158
|
+
const discovery = new DiscoveryService({
|
|
159
|
+
signManifest: async (manifest) => signBytes(canonicalize(manifest)),
|
|
160
|
+
verifyManifest: async (manifest) => {
|
|
161
|
+
const peerPub = manifest.publicKey;
|
|
162
|
+
const sig = manifest.signature;
|
|
163
|
+
if (!peerPub || !sig)
|
|
164
|
+
return false;
|
|
165
|
+
return verifyBytes(canonicalize(manifest), sig, peerPub);
|
|
166
|
+
},
|
|
167
|
+
onPeerDiscovered: (node) => {
|
|
168
|
+
context.logger.info(`Peer discovered: ${node.nodeId} at ${node.endpoint}`);
|
|
169
|
+
},
|
|
170
|
+
}, { staticPeers });
|
|
171
|
+
const handshake = new HandshakeService({
|
|
172
|
+
generateSessionId: generateId,
|
|
173
|
+
generateSessionToken: () => `token-${generateId()}`,
|
|
174
|
+
generateNonce: () => `nonce-${Math.random().toString(36).slice(2)}`,
|
|
175
|
+
signChallenge: async (nonce) => signBytes(nonce),
|
|
176
|
+
verifySignature: async (nonce, signature, peerPublicKey) => verifyBytes(nonce, signature, peerPublicKey),
|
|
177
|
+
getLocalNodeId: () => nodeId,
|
|
178
|
+
getLocalPublicKey: () => publicKeyHex,
|
|
179
|
+
getLocalCapabilities: () => coordConfig.capabilities,
|
|
180
|
+
});
|
|
181
|
+
const piiPipeline = new PIIPipelineService({ hashFunction: (val, salt) => `hash-${salt}-${val.slice(0, 4)}` }, { hashSalt });
|
|
182
|
+
const auditEvents = [];
|
|
183
|
+
const audit = new AuditService({
|
|
184
|
+
generateEventId: generateId,
|
|
185
|
+
getLocalNodeId: () => nodeId,
|
|
186
|
+
persistEvent: async (event) => { auditEvents.push(event); },
|
|
187
|
+
queryEvents: async (query) => {
|
|
188
|
+
return auditEvents
|
|
189
|
+
.filter(e => {
|
|
190
|
+
if (query.eventType && e['eventType'] !== query.eventType)
|
|
191
|
+
return false;
|
|
192
|
+
if (query.severity && e['severity'] !== query.severity)
|
|
193
|
+
return false;
|
|
194
|
+
if (query.category && e['category'] !== query.category)
|
|
195
|
+
return false;
|
|
196
|
+
return true;
|
|
197
|
+
})
|
|
198
|
+
.slice(query.offset ?? 0, (query.offset ?? 0) + (query.limit ?? 100));
|
|
199
|
+
},
|
|
200
|
+
onAuditEvent: (event) => {
|
|
201
|
+
context.eventBus.emit('federation:audit', event);
|
|
202
|
+
},
|
|
203
|
+
}, { complianceMode });
|
|
204
|
+
const trustEvaluator = new TrustEvaluator({
|
|
205
|
+
onTrustChange: (nid, result) => {
|
|
206
|
+
context.logger.info(`Trust change for ${nid}: ${getTrustLevelLabel(result.previousLevel)} -> ${getTrustLevelLabel(result.newLevel)}`);
|
|
207
|
+
context.eventBus.emit('federation:trust-change', { nodeId: nid, ...result });
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
const authorizationMode = config['authorizationMode'] ?? 'legacy';
|
|
211
|
+
const grantedClaims = Array.isArray(config['federationClaims'])
|
|
212
|
+
? config['federationClaims'].filter((claim) => typeof claim === 'string')
|
|
213
|
+
: [];
|
|
214
|
+
const claimChecker = createFederationClaimChecker({
|
|
215
|
+
mode: authorizationMode,
|
|
216
|
+
grantedClaims,
|
|
217
|
+
onObservation: (claim, granted) => {
|
|
218
|
+
context.eventBus.emit('federation:policy-observation', {
|
|
219
|
+
claim,
|
|
220
|
+
granted,
|
|
221
|
+
mode: authorizationMode,
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
if (claimChecker.mode === 'legacy') {
|
|
226
|
+
context.logger.warn('Federation authorization is in ADR-325 legacy compatibility mode; ' +
|
|
227
|
+
'use observe before enabling enforce');
|
|
228
|
+
}
|
|
229
|
+
const policyEngine = new PolicyEngine({ checkClaim: claimChecker.checkClaim });
|
|
230
|
+
const sessions = new Map();
|
|
231
|
+
// ADR-104 + ADR-120: load wire transport. WebSocket fallback by
|
|
232
|
+
// default; native QUIC when AGENTIC_FLOW_QUIC_NATIVE=1 (ADR-108) or
|
|
233
|
+
// MIDSTREAMER_QUIC_NATIVE=1 (ADR-120 Step 1, when midstream@0.3.0
|
|
234
|
+
// ships its real QUIC build). The midstream-aware loader picks the
|
|
235
|
+
// best available transport transparently. Failures downgrade to
|
|
236
|
+
// in-process noop (logged), preserving backward compat for
|
|
237
|
+
// tests/environments without ws available.
|
|
238
|
+
let transport = null;
|
|
239
|
+
try {
|
|
240
|
+
const loaded = await loadFederationTransport({
|
|
241
|
+
serverName: nodeId,
|
|
242
|
+
maxIdleTimeoutMs: 30_000,
|
|
243
|
+
maxConcurrentStreams: 100,
|
|
244
|
+
enable0Rtt: true,
|
|
245
|
+
});
|
|
246
|
+
transport = loaded.transport;
|
|
247
|
+
this.transport = transport;
|
|
248
|
+
context.logger.info(`Federation transport loaded: ${nodeId} (source=${loaded.source}${loaded.fallbackReason ? `, note=${loaded.fallbackReason}` : ''})`);
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
context.logger.warn(`Federation transport unavailable (${err instanceof Error ? err.message : err}); ` +
|
|
252
|
+
`falling back to in-process routing — federation_send will log only`);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Resolve a peer's nodeId to a wire address suitable for
|
|
256
|
+
* transport.send(). Looks up the discovery registry to get the
|
|
257
|
+
* peer's published endpoint, then strips the protocol prefix to
|
|
258
|
+
* get a `host:port` string.
|
|
259
|
+
*
|
|
260
|
+
* Endpoint shapes accepted:
|
|
261
|
+
* - "ws://host:port" → "host:port"
|
|
262
|
+
* - "tailscale://host:port" → "host:port"
|
|
263
|
+
* - "host:port" → "host:port" (passthrough)
|
|
264
|
+
*/
|
|
265
|
+
const resolveAddress = (targetNodeId) => {
|
|
266
|
+
const peer = discovery.getPeer(targetNodeId);
|
|
267
|
+
if (!peer)
|
|
268
|
+
return null;
|
|
269
|
+
const ep = peer.endpoint;
|
|
270
|
+
const m = ep.match(/^(?:[a-z]+:\/\/)?(.+)$/);
|
|
271
|
+
return m ? m[1] : ep;
|
|
272
|
+
};
|
|
273
|
+
const routing = new RoutingService({
|
|
274
|
+
generateEnvelopeId: generateId,
|
|
275
|
+
generateNonce: () => `nonce-${Math.random().toString(36).slice(2)}`,
|
|
276
|
+
signEnvelope: (payload, token) => `hmac-${token.slice(0, 6)}-${payload.length}`,
|
|
277
|
+
verifyEnvelope: () => true,
|
|
278
|
+
scanPii: (text, trustLevel) => {
|
|
279
|
+
const result = piiPipeline.transform(text, trustLevel);
|
|
280
|
+
return {
|
|
281
|
+
transformedText: result.transformedText,
|
|
282
|
+
scanResult: {
|
|
283
|
+
scanned: true,
|
|
284
|
+
piiFound: result.detections.length > 0,
|
|
285
|
+
detections: result.detections.map(d => ({
|
|
286
|
+
type: d.type,
|
|
287
|
+
action: result.actionsApplied.find(a => a.type === d.type)?.action ?? 'pass',
|
|
288
|
+
confidence: d.confidence,
|
|
289
|
+
})),
|
|
290
|
+
actionsApplied: result.actionsApplied.map(a => a.action),
|
|
291
|
+
scanDurationMs: 0,
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
sendToNode: async (targetNodeId, envelope) => {
|
|
296
|
+
// ADR-104: real wire send via the loaded transport. If the
|
|
297
|
+
// transport failed to load OR the peer's address can't be
|
|
298
|
+
// resolved, log + return (the upstream RoutingService.send
|
|
299
|
+
// already wraps this in try/catch and returns a RoutingResult
|
|
300
|
+
// with the error to the caller).
|
|
301
|
+
if (!transport) {
|
|
302
|
+
context.logger.debug(`Federation send (in-process noop): ${envelope.envelopeId} → ${targetNodeId}`);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const address = resolveAddress(targetNodeId);
|
|
306
|
+
const peer = discovery.getPeer(targetNodeId);
|
|
307
|
+
if (!address || !peer) {
|
|
308
|
+
context.logger.warn(`Federation send aborted: peer ${targetNodeId} not in discovery registry`);
|
|
309
|
+
throw new Error(`PEER_UNKNOWN: ${targetNodeId}`);
|
|
310
|
+
}
|
|
311
|
+
const signatureVersion = selectEnvelopeSignatureVersion(signatureMode, peer.capabilities.supportedProtocols, envelope.messageType);
|
|
312
|
+
// Build the AgentMessage WITHOUT signature first, canonicalize
|
|
313
|
+
// the bytes, sign them, then attach the signature to metadata.
|
|
314
|
+
// The receiver runs the same canonicalization and verifies
|
|
315
|
+
// against this node's published public key.
|
|
316
|
+
const baseMessage = {
|
|
317
|
+
id: envelope.envelopeId,
|
|
318
|
+
type: envelope.messageType,
|
|
319
|
+
payload: envelope,
|
|
320
|
+
metadata: {
|
|
321
|
+
sourceNodeId: envelope.sourceNodeId,
|
|
322
|
+
targetNodeId: envelope.targetNodeId,
|
|
323
|
+
sessionId: envelope.sessionId,
|
|
324
|
+
...(signatureVersion === 'jcs-v1' ? { signatureVersion } : {}),
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
const canon = canonicalizeEnvelopeForVerify(baseMessage, signatureVersion);
|
|
328
|
+
const signature = signBytes(canon);
|
|
329
|
+
const signed = {
|
|
330
|
+
...baseMessage,
|
|
331
|
+
metadata: { ...baseMessage.metadata, signature },
|
|
332
|
+
};
|
|
333
|
+
await transport.send(address, signed);
|
|
334
|
+
context.logger.debug(`Federation send → ${address} (envelope=${envelope.envelopeId}, type=${envelope.messageType}, signed)`);
|
|
335
|
+
},
|
|
336
|
+
getActiveSessions: () => Array.from(sessions.values()).filter(s => s.active),
|
|
337
|
+
getLocalNodeId: () => nodeId,
|
|
338
|
+
});
|
|
339
|
+
this.coordinator = new FederationCoordinator(coordConfig, discovery, handshake, routing, audit, piiPipeline, trustEvaluator, policyEngine);
|
|
340
|
+
context.services.register('federation:coordinator', this.coordinator);
|
|
341
|
+
context.services.register('federation:discovery', discovery);
|
|
342
|
+
context.services.register('federation:audit', audit);
|
|
343
|
+
context.services.register('federation:pii', piiPipeline);
|
|
344
|
+
context.services.register('federation:trust', trustEvaluator);
|
|
345
|
+
context.services.register('federation:policy', policyEngine);
|
|
346
|
+
context.services.register('federation:routing', routing);
|
|
347
|
+
if (transport) {
|
|
348
|
+
context.services.register('federation:transport', transport);
|
|
349
|
+
}
|
|
350
|
+
// ADR-104: bind the inbound listener if config supplies a port. The
|
|
351
|
+
// port is OPTIONAL — peers that only initiate outbound (no inbound
|
|
352
|
+
// accept) leave it unset. Common config: port 9100 for tailscale
|
|
353
|
+
// hosts. Defaults to "no listener" so existing tests/configs don't
|
|
354
|
+
// need to free a port.
|
|
355
|
+
const listenPort = config['port'];
|
|
356
|
+
if (transport && typeof listenPort === 'number' && transport.listen) {
|
|
357
|
+
const listenHost = config['host'] ?? '0.0.0.0';
|
|
358
|
+
try {
|
|
359
|
+
await transport.listen(listenPort, listenHost);
|
|
360
|
+
context.logger.info(`Federation listening on ${listenHost}:${listenPort}`);
|
|
361
|
+
}
|
|
362
|
+
catch (err) {
|
|
363
|
+
context.logger.error(`Federation listener bind failed on ${listenHost}:${listenPort}: ` +
|
|
364
|
+
(err instanceof Error ? err.message : String(err)));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// ADR-109: subscribe to inbound messages. transport.onMessage was
|
|
368
|
+
// added in agentic-flow@2.0.12-fix.3 — older builds gracefully
|
|
369
|
+
// degrade (optional method, no-op via the ?? guard).
|
|
370
|
+
if (transport && typeof transport.onMessage === 'function') {
|
|
371
|
+
// Real Ed25519 envelope verifier — closes the inbound trust gap
|
|
372
|
+
// (without this, sourceNodeId in metadata is a self-claim, not
|
|
373
|
+
// an authenticated assertion).
|
|
374
|
+
const verifyEnvelope = (canonicalBytes, signatureHex, peerPublicKeyHex) => {
|
|
375
|
+
if (!signatureHex || !peerPublicKeyHex)
|
|
376
|
+
return false;
|
|
377
|
+
return verifyBytes(canonicalBytes, signatureHex, peerPublicKeyHex);
|
|
378
|
+
};
|
|
379
|
+
transport.onMessage(async (address, message) => {
|
|
380
|
+
await dispatchInbound(address, message, {
|
|
381
|
+
discovery,
|
|
382
|
+
audit,
|
|
383
|
+
eventBus: context.eventBus,
|
|
384
|
+
logger: context.logger,
|
|
385
|
+
verifyEnvelope,
|
|
386
|
+
acceptedSignatureVersions: signatureMode === 'require-jcs' ? ['jcs-v1'] : ['legacy-v1', 'jcs-v1'],
|
|
387
|
+
authorizationMode,
|
|
388
|
+
authorizeInbound: ({ messageType, peer, messageSizeBytes, sourceNodeId }) => policyEngine.evaluateMessage(messageType, peer.trustLevel, messageSizeBytes, sourceNodeId),
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
context.logger.debug('Federation inbound dispatcher subscribed (with Ed25519 sig verify)');
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
context.logger.warn('Federation transport does not expose onMessage(); inbound bytes will queue but not dispatch. ' +
|
|
395
|
+
'Upgrade agentic-flow to >= 2.0.12-fix.3.');
|
|
396
|
+
}
|
|
397
|
+
// A2A Agent Card well-known endpoint (opt-in, graceful). Enabled with
|
|
398
|
+
// config.a2aCard = true + config.a2aCardPort. Serves the local node's
|
|
399
|
+
// manifest as a spec-compliant A2A 1.0 card at
|
|
400
|
+
// /.well-known/agent-card.json. Binds 127.0.0.1 unless config.a2aCardHost
|
|
401
|
+
// is set AND config.a2aCardAllowNonLoopback is true (ADR-166: never
|
|
402
|
+
// loosen binding implicitly). A bind failure logs and degrades — the
|
|
403
|
+
// rest of federation is unaffected.
|
|
404
|
+
const a2aEnabled = config['a2aCard'] === true;
|
|
405
|
+
const a2aPort = config['a2aCardPort'];
|
|
406
|
+
if (a2aEnabled && typeof a2aPort === 'number') {
|
|
407
|
+
try {
|
|
408
|
+
this.agentCardServer = await startAgentCardServer({
|
|
409
|
+
getCard: () => {
|
|
410
|
+
const manifest = discovery.getLocalManifest() ?? {
|
|
411
|
+
nodeId,
|
|
412
|
+
publicKey: publicKeyHex,
|
|
413
|
+
endpoint,
|
|
414
|
+
capabilities: {
|
|
415
|
+
agentTypes: coordConfig.capabilities,
|
|
416
|
+
maxConcurrentSessions: 10,
|
|
417
|
+
supportedProtocols: [
|
|
418
|
+
'websocket',
|
|
419
|
+
'http',
|
|
420
|
+
...(signatureMode === 'legacy' ? [] : [JCS_SIGNATURE_PROTOCOL]),
|
|
421
|
+
],
|
|
422
|
+
complianceModes: complianceMode === 'none' ? [] : [complianceMode],
|
|
423
|
+
},
|
|
424
|
+
version: this.version,
|
|
425
|
+
signature: '',
|
|
426
|
+
timestamp: new Date().toISOString(),
|
|
427
|
+
};
|
|
428
|
+
return toAgentCard(manifest);
|
|
429
|
+
},
|
|
430
|
+
port: a2aPort,
|
|
431
|
+
host: config['a2aCardHost'] ?? '127.0.0.1',
|
|
432
|
+
allowNonLoopback: config['a2aCardAllowNonLoopback'] === true,
|
|
433
|
+
});
|
|
434
|
+
context.logger.info(`A2A agent card served at ${this.agentCardServer.url}`);
|
|
435
|
+
}
|
|
436
|
+
catch (err) {
|
|
437
|
+
context.logger.warn(`A2A agent card endpoint unavailable (${err instanceof Error ? err.message : err}); ` +
|
|
438
|
+
'federation continues without the A2A discovery surface');
|
|
439
|
+
this.agentCardServer = null;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
context.logger.info('Agent Federation plugin initialized');
|
|
443
|
+
}
|
|
444
|
+
async shutdown() {
|
|
445
|
+
if (this.agentCardServer) {
|
|
446
|
+
try {
|
|
447
|
+
await this.agentCardServer.close();
|
|
448
|
+
}
|
|
449
|
+
catch (err) {
|
|
450
|
+
this.context?.logger.warn(`A2A agent card server close error: ${err instanceof Error ? err.message : err}`);
|
|
451
|
+
}
|
|
452
|
+
this.agentCardServer = null;
|
|
453
|
+
}
|
|
454
|
+
if (this.coordinator) {
|
|
455
|
+
await this.coordinator.shutdown();
|
|
456
|
+
this.coordinator = null;
|
|
457
|
+
}
|
|
458
|
+
if (this.transport) {
|
|
459
|
+
try {
|
|
460
|
+
await this.transport.close?.();
|
|
461
|
+
}
|
|
462
|
+
catch (err) {
|
|
463
|
+
this.context?.logger.warn(`Federation transport close error: ${err instanceof Error ? err.message : err}`);
|
|
464
|
+
}
|
|
465
|
+
this.transport = null;
|
|
466
|
+
}
|
|
467
|
+
this.context?.logger.info('Agent Federation plugin shut down');
|
|
468
|
+
this.context = null;
|
|
469
|
+
}
|
|
470
|
+
registerMCPTools() {
|
|
471
|
+
return createMcpTools(() => this.coordinator, () => this.context);
|
|
472
|
+
}
|
|
473
|
+
registerCLICommands() {
|
|
474
|
+
return createCliCommands(() => this.coordinator, () => this.context);
|
|
475
|
+
}
|
|
476
|
+
registerAgentTypes() {
|
|
477
|
+
return [
|
|
478
|
+
{
|
|
479
|
+
type: 'federation-coordinator',
|
|
480
|
+
name: 'Federation Coordinator',
|
|
481
|
+
description: 'Coordinates cross-installation agent federation, managing discovery, handshake, trust evaluation, and secure message routing between federated nodes.',
|
|
482
|
+
defaultConfig: {
|
|
483
|
+
id: '',
|
|
484
|
+
name: 'federation-coordinator',
|
|
485
|
+
type: 'coordinator',
|
|
486
|
+
capabilities: [
|
|
487
|
+
'federation:discover',
|
|
488
|
+
'federation:connect',
|
|
489
|
+
'federation:read',
|
|
490
|
+
'federation:write',
|
|
491
|
+
'federation:admin',
|
|
492
|
+
],
|
|
493
|
+
maxConcurrentTasks: 10,
|
|
494
|
+
priority: 90,
|
|
495
|
+
timeout: 300_000,
|
|
496
|
+
metadata: {
|
|
497
|
+
pluginSource: '@claude-flow/plugin-agent-federation',
|
|
498
|
+
},
|
|
499
|
+
},
|
|
500
|
+
requiredCapabilities: ['federation:discover', 'federation:connect'],
|
|
501
|
+
metadata: {
|
|
502
|
+
trustAware: true,
|
|
503
|
+
piiAware: true,
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
];
|
|
507
|
+
}
|
|
508
|
+
async healthCheck() {
|
|
509
|
+
if (!this.coordinator)
|
|
510
|
+
return false;
|
|
511
|
+
const status = this.coordinator.getStatus();
|
|
512
|
+
return status.healthy;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
//# sourceMappingURL=plugin.js.map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EAAE,uJAAuJ;gBACpK,aAAa,EAAE;oBACb,EAAE,EAAE,EAAE;oBACN,IAAI,EAAE,wBAAwB;oBAC9B,IAAI,EAAE,aAAa;oBACnB,YAAY,EAAE;wBACZ,qBAAqB;wBACrB,oBAAoB;wBACpB,iBAAiB;wBACjB,kBAAkB;wBAClB,kBAAkB;qBACnB;oBACD,kBAAkB,EAAE,EAAE;oBACtB,QAAQ,EAAE,EAAE;oBACZ,OAAO,EAAE,OAAO;oBAChB,QAAQ,EAAE;wBACR,YAAY,EAAE,sCAAsC;qBACrD;iBACF;gBACD,oBAAoB,EAAE,CAAC,qBAAqB,EAAE,oBAAoB,CAAC;gBACnE,QAAQ,EAAE;oBACR,UAAU,EAAE,IAAI;oBAChB,QAAQ,EAAE,IAAI;iBACf;aACF;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QAC5C,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;CACF"}
|
package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Midstream-aware federation transport loader (ADR-120, Step 2).
|
|
3
|
+
*
|
|
4
|
+
* Extends the agentic-flow `loadQuicTransport` loader pattern with a
|
|
5
|
+
* preferred branch that probes `midstreamer` first. When `midstreamer`
|
|
6
|
+
* ships real QUIC (currently the WASM build is a counter-tracking
|
|
7
|
+
* stub per ADR-119), this loader picks it up automatically without
|
|
8
|
+
* any change to consumer plugins.
|
|
9
|
+
*
|
|
10
|
+
* Resolution order:
|
|
11
|
+
*
|
|
12
|
+
* 1. If `MIDSTREAMER_QUIC_NATIVE=1` AND the `midstreamer` module
|
|
13
|
+
* exposes a real `QuicMultistream`-derived `AgentTransport`,
|
|
14
|
+
* use it. (Today: probes fail closed and we fall through.)
|
|
15
|
+
*
|
|
16
|
+
* 2. Otherwise: defer to agentic-flow's existing loader, which
|
|
17
|
+
* itself respects `AGENTIC_FLOW_QUIC_NATIVE=1` (ADR-108) and
|
|
18
|
+
* falls back to WebSocket (ADR-104) otherwise.
|
|
19
|
+
*
|
|
20
|
+
* The loader is opt-in: callers must explicitly invoke
|
|
21
|
+
* `loadFederationTransport()` instead of `loadQuicTransport()`.
|
|
22
|
+
* Behavior is identical to `loadQuicTransport()` until upstream
|
|
23
|
+
* `midstreamer` ships its real QUIC build AND the operator sets the
|
|
24
|
+
* env flag — so this change is safe to land before any of that
|
|
25
|
+
* happens.
|
|
26
|
+
*
|
|
27
|
+
* Re-exports the `AgentTransport` / `AgentMessage` / `QuicTransportConfig`
|
|
28
|
+
* surface from agentic-flow so consumers only import from one place.
|
|
29
|
+
*/
|
|
30
|
+
export interface AgentMessage {
|
|
31
|
+
id: string;
|
|
32
|
+
type: 'task' | 'result' | 'status' | 'coordination' | 'heartbeat' | string;
|
|
33
|
+
payload: unknown;
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
export interface AgentTransport {
|
|
38
|
+
send: (address: string, message: AgentMessage) => Promise<void>;
|
|
39
|
+
onMessage: (handler: (address: string, message: AgentMessage) => void) => void;
|
|
40
|
+
listen?: (port: number, host?: string) => Promise<void>;
|
|
41
|
+
close?: () => Promise<void> | void;
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface QuicTransportConfig {
|
|
45
|
+
port?: number;
|
|
46
|
+
host?: string;
|
|
47
|
+
serverName?: string;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
/** Result envelope describing which backend the loader picked. */
|
|
51
|
+
export interface LoadedFederationTransport {
|
|
52
|
+
/** The live transport. Send/receive against this. */
|
|
53
|
+
transport: AgentTransport;
|
|
54
|
+
/** Which loader branch resolved. Useful for logs/metrics. */
|
|
55
|
+
source: 'midstreamer-native' | 'agentic-flow-loader' | 'websocket-fallback';
|
|
56
|
+
/** Free-form note when a probe failed (helps explain a fallback). */
|
|
57
|
+
fallbackReason?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Top-level loader for federation transport. Identical signature to
|
|
61
|
+
* agentic-flow's `loadQuicTransport`, but with the midstreamer-first
|
|
62
|
+
* preference. Use this from `plugins/ruflo-federation` in place of
|
|
63
|
+
* the bare `loadQuicTransport`.
|
|
64
|
+
*
|
|
65
|
+
* Failure mode: if midstreamer is requested but rejects (stub, init
|
|
66
|
+
* error, missing package), this function falls through to the
|
|
67
|
+
* agentic-flow loader. If current agentic-flow does not export its
|
|
68
|
+
* historical loader subpath, the plugin-owned WebSocket fallback is
|
|
69
|
+
* used directly (ADR-104, #2618).
|
|
70
|
+
*/
|
|
71
|
+
export declare function loadFederationTransport(config?: QuicTransportConfig): Promise<LoadedFederationTransport>;
|
|
72
|
+
//# sourceMappingURL=midstream-aware-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"midstream-aware-loader.d.ts","sourceRoot":"","sources":["../../src/transport/midstream-aware-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAUH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,MAAM,CAAC;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AACD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAA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