mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Subscribe to all owned agents' turn-metric events (kind 44200) as a special case of the #1442 local-save archive primitive. Mirrors the observer-feed (24200) wiring but uses the persistent /query proof path since the relay stores and #p-gates 44200 events. Key design decisions: - owner_p+44200 routes to the persistent bucket (relay is source of truth); owner_p+24200 stays on the ephemeral path unchanged. - Decrypt at ingest (NIP-44, agent→owner); store plaintext payload JSON so token-usage calculators can read archive.db directly without the owner key. Fail-closed: decrypt error → drop, never store ciphertext. - owner_p filter arm added to plan_archive: {ids, #p, kinds}. - Both seed hooks (observer + metric) now merge existing owner_p kinds before upserting, preventing concurrent first-run seeds from clobbering each other. Observer toggle likewise merges rather than stomping. - Build-time flag BUZZ_BUILD_AGENT_METRIC_ARCHIVE_DEFAULT (presence remap → BUZZ_DESKTOP_BUILD_AGENT_METRIC_ARCHIVE_DEFAULT=1); default off for OSS, baked on for internal builds via buzz-releases. - Separate toggle in LocalArchiveSettingsCard with its own enabled state. - KIND_AGENT_TURN_METRIC = 44200 added to kinds.ts. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>