mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 14:43:05 +09:00
ADR-097 Phase 1 (federation_send budget envelope) is landed; Phase 3
(federation_spend event bus that publishes per-completion {peerId,
taskId, tokensUsed, usdSpent, ts}) is deferred upstream. This plugin
is the declared consumer of those events. P6 wires the consumer side
so it activates the moment Phase 3 emits.
What lands:
- scripts/federation.mjs — reads namespace `federation-spend` for keys
`fed-spend-*`, aggregates per-peer 1h/24h/7d rolling windows, flags
peers exceeding the suspension threshold (default $5/24h per ADR-097
Phase 2). FED_FORMAT=json for machine-readable; FED_NAMESPACE and
FED_SUSPEND_THRESHOLD_USD overrides.
- skills/cost-federation/SKILL.md — documents the consumer contract
(event shape, namespace, key prefix) so upstream knows where to write
- `cost federation` subcommand
- 1 new smoke check (39b — pre-39a)
Live verified by injecting two mock events:
- peer-alice $0.045 → no flag
- peer-bob $7.50 → ⚠ flagged over $5/24h threshold
Phase 3 status: not yet emitting upstream. Skill prints "no events
found, will activate when upstream lands" and exits cleanly.
Version: 0.13.0 → 0.14.0. Keywords: + federation.
Co-Authored-By: RuFlo <ruv@ruv.net>