feat(a2a): CEO can DM the Auditor and PR reviewers (#623)

* feat(a2a): CEO can DM the Auditor and PR reviewers

A mid-flight PR reviewer or Auditor that's stuck was unreachable — the CEO
had no way to DM them. Both roles now carry dm/read_a2a, so the CEO can open
a 1:1 and they can reply in-thread through the existing CEO-reply path.

Scoped deliberately: the Auditor stays a silent observer to its peers — it
gains no peer-initiation surface (can_a2a_direct routes it through
_check_auditor_a2a, which refuses every initiation target; it can only reply
inside a CEO-opened DM). PR reviewers keep their owning-PM scope. Intake and
Secretary stay excluded — they have their own dedicated chat pages.

NO_COMMS_ROLES drops to {prompter, secretary}; the panel's EXCLUDE_NON_DM_ROLES
matches. KB/docs updated so the 'auditor/pr_reviewer have no dm' claim isn't
left stale.

* test(a2a): smoke guard checks _NO_COMMS_ROLES, not a hardcoded 'auditor'

The dm() runtime guard no longer names the auditor (it now carries dm to
reply to the CEO); it refuses the canonical _NO_COMMS_ROLES set. Assert on
that set so the smoke test tracks the guard, not a stale role name.

* chore(foundation): regenerate verb tables for auditor/pr_reviewer dm+read_a2a

---------

Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
Renzo F
2026-07-21 05:54:29 +02:00
committed by GitHub
co-authored by Renn F
parent 775872cac0
commit 73c05cfa5e
24 changed files with 295 additions and 146 deletions
@@ -23,15 +23,15 @@ import { getErrorMessage } from "@/lib/api/client";
import { useCreateCeoConversation } from "@/hooks/use-a2a-live";
import { useAgentDefinitions } from "@/hooks/use-agents";
// Self, plus every role that can't actually read/answer a DM: auditor and
// pr_reviewer carry no read_a2a on their manifests, prompter and secretary
// are human-only note/evidence roles — a DM to any of them is a black hole.
// Self, plus every role that can't actually read/answer a DM: prompter and
// secretary are human-only note/evidence roles with their own dedicated chat
// pages — a DM to either is a black hole. Auditor and pr_reviewer now carry
// dm/read_a2a (the CEO can reach a mid-flight one and it can reply in-thread)
// so they're no longer excluded here.
// Exported so other "start a fresh 1:1" surfaces (the /tg Mini App chat tab)
// share the exact same exclusion list instead of drifting out of sync.
export const EXCLUDE_NON_DM_ROLES = [
AgentRole.CEO,
AgentRole.AUDITOR,
AgentRole.PR_REVIEWER,
AgentRole.PROMPTER,
AgentRole.SECRETARY,
];
@@ -141,9 +141,8 @@ export function A2ANewDmDialog({
<DialogHeader>
<DialogTitle>New direct message</DialogTitle>
<DialogDescription>
Starts (or reopens) your own 1:1 with an agent separate from
the threads you&apos;re watching, and visible only to you and
them.
Starts (or reopens) your own 1:1 with an agent separate from the
threads you&apos;re watching, and visible only to you and them.
</DialogDescription>
</DialogHeader>
<form onSubmit={handleSubmit} className="space-y-4">
@@ -186,7 +186,7 @@ describe("AgentCard", () => {
);
});
it("hides the DM quick-action for a role that can't read/answer a DM", () => {
it("shows the DM quick-action for the auditor now that it carries dm/read_a2a", () => {
const auditor = {
id: "auditor",
name: "Auditor",
@@ -195,8 +195,39 @@ describe("AgentCard", () => {
} as unknown as AgentDefinition;
render(<AgentCard agent={auditor} agentStatus={statusOf()} />);
expect(
screen.queryByRole("button", { name: "DM this agent" }),
).not.toBeInTheDocument();
screen.getByRole("button", { name: "DM this agent" }),
).toBeInTheDocument();
});
it("shows the DM quick-action for a PR reviewer now that it carries dm/read_a2a", () => {
const prReviewer = {
id: "pr-reviewer-1",
name: "PR Reviewer",
role: "pr_reviewer",
team: "board",
} as unknown as AgentDefinition;
render(<AgentCard agent={prReviewer} agentStatus={statusOf()} />);
expect(
screen.getByRole("button", { name: "DM this agent" }),
).toBeInTheDocument();
});
it("hides the DM quick-action for the human-only prompter/secretary roles", () => {
for (const role of ["prompter", "secretary"]) {
const agent = {
id: role,
name: role,
role,
team: null,
} as unknown as AgentDefinition;
const { unmount } = render(
<AgentCard agent={agent} agentStatus={statusOf()} />,
);
expect(
screen.queryByRole("button", { name: "DM this agent" }),
).not.toBeInTheDocument();
unmount();
}
});
it("hides the DM quick-action for the CEO card", () => {