mirror of
https://github.com/block/buzz.git
synced 2026-11-26 11:12:22 +00:00
- Add a relay ownership endpoint backed by agent_owner_pubkey and is_agent_owner so desktop activity visibility uses the same source of truth as observer telemetry authorization. - Add a Tauri ownership command, frontend API wrapper, and useCanViewAgentActivity hook with local managed-agent optimism only while relay ownership is loading. - Replace profile popover, profile panel, and members sidebar activity gates so owned agents can open activity across different builds and worktrees without relying on local managed-agent lists. - Refactor channel agent session candidate resolution so owned agents can keep an activity panel open when channel metadata is stale, while preserving local-only lifecycle controls. - Add focused desktop unit coverage for the ownership predicate and stale-metadata session resolution path, plus E2E bridge support for ownership mocks.
61 lines
1.7 KiB
JavaScript
61 lines
1.7 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { resolveCanViewAgentActivity } from "./canViewAgentActivity.ts";
|
|
|
|
test("resolveCanViewAgentActivity returns true when relay confirms ownership", () => {
|
|
const result = resolveCanViewAgentActivity({
|
|
relayOwnership: {
|
|
agentPubkey: "aa".repeat(32),
|
|
ownerPubkey: "bb".repeat(32),
|
|
isOwner: true,
|
|
},
|
|
isManagedAgent: false,
|
|
isOwnershipLoading: false,
|
|
isManagedLoading: false,
|
|
});
|
|
|
|
assert.equal(result.canView, true);
|
|
assert.equal(result.isLoading, false);
|
|
});
|
|
|
|
test("resolveCanViewAgentActivity returns false when relay denies ownership", () => {
|
|
const result = resolveCanViewAgentActivity({
|
|
relayOwnership: {
|
|
agentPubkey: "aa".repeat(32),
|
|
ownerPubkey: "bb".repeat(32),
|
|
isOwner: false,
|
|
},
|
|
isManagedAgent: true,
|
|
isOwnershipLoading: false,
|
|
isManagedLoading: false,
|
|
});
|
|
|
|
assert.equal(result.canView, false);
|
|
assert.equal(result.isLoading, false);
|
|
});
|
|
|
|
test("resolveCanViewAgentActivity optimistically allows locally managed agents while loading", () => {
|
|
const result = resolveCanViewAgentActivity({
|
|
relayOwnership: undefined,
|
|
isManagedAgent: true,
|
|
isOwnershipLoading: true,
|
|
isManagedLoading: false,
|
|
});
|
|
|
|
assert.equal(result.canView, true);
|
|
assert.equal(result.isLoading, true);
|
|
});
|
|
|
|
test("resolveCanViewAgentActivity stays closed for non-managed agents while loading", () => {
|
|
const result = resolveCanViewAgentActivity({
|
|
relayOwnership: undefined,
|
|
isManagedAgent: false,
|
|
isOwnershipLoading: true,
|
|
isManagedLoading: false,
|
|
});
|
|
|
|
assert.equal(result.canView, false);
|
|
assert.equal(result.isLoading, true);
|
|
});
|