mirror of
https://github.com/block/buzz.git
synced 2026-11-27 03:31:50 +00:00
## Summary - add a targeted native `revalidate_relay_agents(pubkeys, channel_id)` command for send-time authorization - scope membership discovery to the destination channel and selected pubkeys before runtime/profile/policy queries - replace full relay-directory rebuilds with targeted checks before agent side effects and again at publication - preserve managed-agent evidence independently and retain internal owner-only filtering ## Security and trust boundary The targeted command reuses the existing authoritative chain: 1. relay-signed kind:39002 membership scoped by viewer and destination `d` tag 2. agent runtime directory event 3. agent-signed owner profile verification 4. owner-signed managed policy 5. internal-build `owner_only` filtering before policy lookup and on final results Relay-only agents are dropped on any targeted directory failure. Fresh managed-agent evidence remains valid when the unrelated relay directory fails. ## Validation - pre-push gate passed: branch skew, Desktop check/typecheck/tests, Tauri checks, Rust tests, and mobile tests - Desktop unit suite: 4,992 passed - targeted Rust relay-directory tests passed - focused Playwright mention-send acceptance passed - relay-only send emits the expected `p` tag - exactly two targeted `revalidate_relay_agents` calls on the already-member send path: pre-side-effect and pre-publication - no `list_relay_agents` call on that send path - relay failure and revocation remain fail-closed - internal owner-only mode hides other-owned agents - manual local Desktop testing by Wes: mention sends felt materially improved ## Notes This intentionally does not clear the composer early or add an optimistic timeline row. Publication still waits for fresh authorization. --------- Signed-off-by: Wes <wesbillman@users.noreply.github.com> Co-authored-by: Princess Donut <68157ebd23b3897c1991015c3038658ea916200c67d3a54620b0754d1b92f6e0@buzz.block.builderlab.xyz>
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import { invokeTauri } from "@/shared/api/tauri";
|
|
import type { RelayAgent } from "@/shared/api/types";
|
|
|
|
type RawRelayAgent = {
|
|
pubkey: string;
|
|
owner_pubkey?: string | null;
|
|
name: string;
|
|
agent_type: string;
|
|
channels: string[];
|
|
channel_ids: string[];
|
|
capabilities: string[];
|
|
status: RelayAgent["status"];
|
|
respond_to?: RelayAgent["respondTo"];
|
|
respond_to_allowlist?: string[];
|
|
};
|
|
|
|
export async function revalidateRelayAgents(
|
|
pubkeys: string[],
|
|
channelId?: string,
|
|
): Promise<RelayAgent[]> {
|
|
const agents = await invokeTauri<RawRelayAgent[]>("revalidate_relay_agents", {
|
|
pubkeys,
|
|
channelId,
|
|
});
|
|
return agents.map((agent) => ({
|
|
pubkey: agent.pubkey,
|
|
ownerPubkey: agent.owner_pubkey ?? null,
|
|
name: agent.name,
|
|
agentType: agent.agent_type,
|
|
channels: agent.channels,
|
|
channelIds: agent.channel_ids ?? [],
|
|
capabilities: agent.capabilities,
|
|
status: agent.status,
|
|
respondTo: agent.respond_to ?? null,
|
|
respondToAllowlist: agent.respond_to_allowlist ?? [],
|
|
}));
|
|
}
|