Skip to content

Commit fad5a65

Browse files
wesbillmanCarl
andauthored
Define private managed agent wire protocol (#4593)
## Summary - reserve kind `30179` for owner-private managed-agent aggregates - define the fail-closed owner-self NIP-44 v2 envelope and versioned payload codec - bind runnable identity/configuration to complete signed `30175`/`30177` recovery projections - validate NIP-OA owner→agent attestations and reject self-attestation - document NIP-PMA authority, migration prerequisites, privacy, and deployment order - keep generic relay ingest closed until private storage and atomic aggregate CAS exist ## Safety boundary This is the inert protocol/codec slice only. It does not publish secrets, change agent authority, migrate local records, or enable kind `30179` ingestion. The relay regression test proves generic EVENT ingest still rejects the kind. The finalized migration plan adds later prerequisites for relay-private storage/CAS, runtime lease/fencing, Desktop cutover, and harness authentication. Those belong in staged follow-up PRs rather than expanding this inert foundation. ## Validation At commit `67f0ea4ebb8d3ccba3a3eb9374e89a7178913f74`: - `cargo test -p buzz-core` — 246 unit + 2 doc tests passed - `cargo test -p buzz-relay private_managed_agent_kind_remains_rejected_until_atomic_ingest_exists` — passed - push hooks: Rust tests and desktop checks passed (`2145` desktop tests passed, `14` ignored) - `cargo fmt --all -- --check` - `git diff --check` ## Review Princess Donut cleared security/data integrity with no remaining high/medium findings. Mongo cleared migration compatibility and wire grammar. The later runtime lease/fencing protocol was also adversarially cleared as a plan; implementation slices still require independent evidence before activation. Deterministic plaintext/signed-projection/auth-tag interoperability vectors remain a valuable follow-up, not an S0 merge gate; random NIP-44 ciphertext is intentionally not snapshotted. --------- Signed-off-by: Wes <[email protected]> Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
1 parent dae57d3 commit fad5a65

5 files changed

Lines changed: 1276 additions & 1 deletion

File tree

‎crates/buzz-core/src/kind.rs‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ pub const KIND_EVENT_REMINDER: u32 = 30300;
108108
/// dedicated push lease tables.
109109
pub const KIND_PUSH_LEASE: u32 = 30350;
110110

111+
/// NIP-PMA: owner-encrypted private managed-agent aggregate.
112+
///
113+
/// Addressed by `(owner pubkey, kind, agent pubkey)`. The signed outer tags
114+
/// expose only the agent coordinate, CAS generation/predecessor, and active/deleted
115+
/// state required for relay enforcement. Content is NIP-44 v2 encrypted from
116+
/// the owner's key to itself and contains the runnable identity/configuration
117+
/// plus exact public projection bindings. See `docs/nips/NIP-PMA.md`.
118+
pub const KIND_PRIVATE_MANAGED_AGENT: u32 = 30179;
119+
111120
/// Kinds whose stored events are readable only by their author.
112121
///
113122
/// The relay must never reveal the existence, count, tags, content, schedule,
@@ -117,7 +126,11 @@ pub const KIND_PUSH_LEASE: u32 = 30350;
117126
///
118127
/// Currently a tiny linear set. If this grows past ~4 kinds, convert to a
119128
/// compile-time bitset or sorted array with binary search for hot-path use.
120-
pub const AUTHOR_ONLY_KINDS: &[u32] = &[KIND_EVENT_REMINDER, KIND_PUSH_LEASE];
129+
pub const AUTHOR_ONLY_KINDS: &[u32] = &[
130+
KIND_EVENT_REMINDER,
131+
KIND_PUSH_LEASE,
132+
KIND_PRIVATE_MANAGED_AGENT,
133+
];
121134

122135
/// Kinds that require a result-level read gate beyond the filter-layer
123136
/// `#p` check: even a reader who knows an event id MUST match the event's
@@ -643,6 +656,7 @@ pub const ALL_KINDS: &[u32] = &[
643656
KIND_TEAM,
644657
KIND_MANAGED_AGENT,
645658
KIND_TEAM_CATALOG,
659+
KIND_PRIVATE_MANAGED_AGENT,
646660
KIND_REPORT,
647661
KIND_PRODUCT_FEEDBACK,
648662
KIND_NIP29_PUT_USER,
@@ -843,6 +857,7 @@ const _: () = assert!(is_parameterized_replaceable(KIND_PERSONA)); // 30175 ∈
843857
const _: () = assert!(is_parameterized_replaceable(KIND_TEAM)); // 30176 ∈ 30000–39999
844858
const _: () = assert!(is_parameterized_replaceable(KIND_MANAGED_AGENT)); // 30177 ∈ 30000–39999
845859
const _: () = assert!(is_parameterized_replaceable(KIND_TEAM_CATALOG)); // 30178 ∈ 30000–39999
860+
const _: () = assert!(is_parameterized_replaceable(KIND_PRIVATE_MANAGED_AGENT)); // 30179 ∈ 30000–39999
846861
const _: () = assert!(is_parameterized_replaceable(KIND_WORKFLOW_DEF)); // 30620 ∈ 30000–39999
847862
const _: () = assert!(is_parameterized_replaceable(KIND_EVENT_REMINDER)); // 30300 ∈ 30000–39999
848863
const _: () = assert!(is_parameterized_replaceable(KIND_DM_VISIBILITY)); // 30622 ∈ 30000–39999

‎crates/buzz-core/src/lib.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ pub mod observer;
3232
pub mod pairing;
3333
/// Presence status types shared across crates.
3434
pub mod presence;
35+
/// NIP-PMA owner-encrypted private managed-agent wire codec.
36+
pub mod private_managed_agent;
3537
/// Canonical relay runtime identities.
3638
pub mod relay;
3739
/// Tenant identity — the server-resolved community key carried on scoped paths.

0 commit comments

Comments
 (0)