Skip to content

Commit 280ff48

Browse files
committed
fix(desktop): explain open agent access
Signed-off-by: David Hamilton <[email protected]>
1 parent 4a977c5 commit 280ff48

11 files changed

Lines changed: 292 additions & 43 deletions

‎desktop/playwright.config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export default defineConfig({
120120
"**/signout-confirmation.spec.ts",
121121
"**/agent-provider-dropdowns.spec.ts",
122122
"**/agent-lifecycle-feedback.spec.ts",
123+
"**/agent-access-warning.spec.ts",
123124
"**/inbox-live-update.spec.ts",
124125
"**/mesh-compute.spec.ts",
125126
"**/observer-archive-policy.spec.ts",

‎desktop/src/features/agents/AGENTS.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ with a TypeScript lookup table or an id comparison in a component.
106106
Edit. In Edit,
107107
selecting Custom command keeps its required command field beside the harness
108108
picker rather than hiding it in Advanced.
109+
10. **Open agent access names the consequence where it is selected.** The shared
110+
respond-to field shows a persistent warning whenever `anyone` is selected,
111+
including persona-backed create and edit surfaces. Keep that disclosure in
112+
the shared field instead of adding surface-specific flags. Describe the
113+
audience and their ability to use the agent to access the computer or server
114+
where it runs in plain language; don't expose `respond-to`, `allowlist`,
115+
Nostr, or harness jargon in primary UI copy.
109116

110117
## The tests that enforce this
111118

@@ -120,6 +127,8 @@ with a TypeScript lookup table or an id comparison in a component.
120127
`isCacheableDiscoveryResponse`, `deriveModelDiscoveryPending`,
121128
`isSuccessfulEmptyDiscovery`. If the "reopen to retry" copy becomes inert
122129
again, these tests will catch it.
130+
- `ui/respondToFieldContract.test.mjs` — plain-language mode labels and the
131+
persistent warning contract for open agent access.
123132
- `desktop/tests/e2e/onboarding-agent-defaults.spec.ts` — onboarding behavior
124133
acceptance coverage for readiness, failure states, defaults, navigation,
125134
successful-empty vs failed optional-model discovery, and persistence races.

‎desktop/src/features/agents/ui/AgentInstanceEditDialog.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ export function AgentInstanceEditDialog({
913913
</div>
914914
</div>
915915

916-
{/* Who can talk to this agent */}
916+
{/* Who can send instructions */}
917917
<CreateAgentRespondToField
918918
allowlist={respondToAllowlist}
919919
disabled={updateMutation.isPending}

‎desktop/src/features/agents/ui/RespondToField.tsx‎

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from "react";
2-
import { ChevronDown, Search, X } from "lucide-react";
2+
import { AlertTriangle, ChevronDown, Search, X } from "lucide-react";
33
import {
44
mergeAllowlist,
55
parsePubkeyInput,
@@ -20,10 +20,10 @@ import type { PersonaDropdownOption } from "./agentConfigOptions";
2020
* Inbound author gate UI for create/edit agent dialogs.
2121
*
2222
* Dropdown:
23-
* - Owner only (default; matches `buzz-acp --respond-to=owner-only`)
24-
* - Anyone (`--respond-to=anyone` — fully open bot)
25-
* - Allowlist (`--respond-to=allowlist`, plus the chip list as
26-
* `--respond-to-allowlist`)
23+
* - Only me (default; maps to `buzz-acp --respond-to=owner-only`)
24+
* - Anyone (`--respond-to=anyone` — fully open agent)
25+
* - Selected people (`--respond-to=allowlist`, plus the selected pubkeys as
26+
* `--respond-to-allowlist`)
2727
*
2828
* `nobody` is intentionally not surfaced — it pairs with a heartbeat-only
2929
* setup that has no meaningful GUI use case.
@@ -53,7 +53,7 @@ function formatSearchUserSecondary(user: UserSearchResult) {
5353
const RESPOND_TO_OPTIONS: PersonaDropdownOption[] = [
5454
{ label: "Only me (default)", value: "owner-only" },
5555
{ label: "Anyone", value: "anyone" },
56-
{ label: "Allowlist", value: "allowlist" },
56+
{ label: "Selected people", value: "allowlist" },
5757
];
5858

5959
export function CreateAgentRespondToField({
@@ -142,7 +142,7 @@ export function CreateAgentRespondToField({
142142
}
143143
htmlFor="agent-respond-to"
144144
>
145-
Who can talk to this agent
145+
Who can send instructions
146146
</label>
147147
{isPersonaVariant ? (
148148
<PersonaDropdownField
@@ -162,18 +162,35 @@ export function CreateAgentRespondToField({
162162
onChange={(e) => onModeChange(e.target.value as RespondToMode)}
163163
value={mode}
164164
>
165-
<option value="owner-only">Owner only (default)</option>
166-
<option value="anyone">Anyone</option>
167-
<option value="allowlist">Allowlist</option>
165+
{RESPOND_TO_OPTIONS.map((option) => (
166+
<option key={option.value} value={option.value}>
167+
{option.label}
168+
</option>
169+
))}
168170
</select>
169171
)}
170-
{!isPersonaVariant ? (
172+
{mode === "anyone" ? (
173+
<div
174+
className="flex items-start gap-2 rounded-xl border border-warning/30 bg-warning-bg px-3 py-2.5"
175+
data-testid="agent-access-warning"
176+
>
177+
<AlertTriangle
178+
aria-hidden="true"
179+
className="mt-0.5 h-4 w-4 shrink-0 text-warning"
180+
/>
181+
<p aria-live="polite" className="text-xs leading-5 text-warning">
182+
Anyone can send instructions to this agent and use it to access the
183+
computer or server where it runs. This includes files, accounts, and
184+
tools available to the agent.
185+
</p>
186+
</div>
187+
) : (
171188
<p className="text-xs text-muted-foreground">
172-
Controls which Nostr authors the agent listens to (@mentions, DMs,
173-
thread replies). The agent&apos;s owner can always shut it down with
174-
<span className="font-mono"> !shutdown</span>.
189+
{mode === "allowlist"
190+
? "Only you and the people you choose can send instructions."
191+
: "Only you can send instructions."}
175192
</p>
176-
) : null}
193+
)}
177194
{mode === "allowlist" ? (
178195
<AllowlistPicker
179196
allowlist={allowlist}
@@ -269,21 +286,21 @@ function AllowlistPicker({
269286
>
270287
{!isPersona ? (
271288
<div className="flex items-center justify-between gap-2">
272-
<span className="text-sm font-medium">Allowed pubkeys</span>
289+
<span className="text-sm font-medium">Selected people</span>
273290
<span className="rounded-full bg-background px-2 py-1 text-2xs font-medium leading-none text-muted-foreground">
274291
{allowlist.length} selected
275292
</span>
276293
</div>
277294
) : null}
278295
{!isPersona && ownerPubkey ? (
279296
<p className="text-xs text-muted-foreground">
280-
Owner (
281-
<PubKey pubkey={ownerPubkey} />) is always implicitly allowed by the
282-
harness — no need to add it here.
297+
You (
298+
<PubKey pubkey={ownerPubkey} />) can always use this agent. You
299+
don&apos;t need to add yourself.
283300
</p>
284301
) : !isPersona ? (
285302
<p className="text-xs text-muted-foreground">
286-
The agent&apos;s owner is always implicitly allowed.
303+
You can always use this agent.
287304
</p>
288305
) : null}
289306
<div className="rounded-lg border border-border/80 bg-background">
@@ -452,7 +469,7 @@ function AllowlistPicker({
452469
onClick={onAddFromPaste}
453470
type="button"
454471
>
455-
Add to allowlist
472+
Add people
456473
</button>
457474
</div>
458475
</div>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import assert from "node:assert/strict";
2+
import { readFile } from "node:fs/promises";
3+
import test from "node:test";
4+
5+
const respondToFieldSource = await readFile(
6+
new URL("./RespondToField.tsx", import.meta.url),
7+
"utf8",
8+
);
9+
10+
for (const label of ["Only me (default)", "Selected people", "Anyone"]) {
11+
test(`respond-to control uses the plain-language label: ${label}`, () => {
12+
assert.ok(respondToFieldSource.includes(`label: "${label}"`));
13+
});
14+
}
15+
16+
test("native and persona controls share one option list", () => {
17+
assert.match(
18+
respondToFieldSource,
19+
/<select[\s\S]*RESPOND_TO_OPTIONS\.map\(\(option\) => \([\s\S]*<option/,
20+
);
21+
});
22+
23+
test("open agent access always renders a persistent warning", () => {
24+
assert.match(
25+
respondToFieldSource,
26+
/mode === "anyone"[\s\S]*data-testid="agent-access-warning"/,
27+
);
28+
assert.match(
29+
respondToFieldSource,
30+
/Anyone can send instructions to this agent and use it to access the[\s\S]*computer or server where it runs\./,
31+
);
32+
assert.match(
33+
respondToFieldSource,
34+
/This includes files,[\s\S]*accounts, and[\s\S]*tools available to the agent\./,
35+
);
36+
});
37+
38+
test("primary respond-to copy does not expose implementation jargon", () => {
39+
const primaryFieldSource = respondToFieldSource.slice(
40+
respondToFieldSource.indexOf('data-testid="agent-respond-to"'),
41+
respondToFieldSource.indexOf("const HEX_64_RE"),
42+
);
43+
44+
for (const jargon of ["Nostr authors", "!shutdown"]) {
45+
assert.doesNotMatch(primaryFieldSource, new RegExp(jargon));
46+
}
47+
});

‎desktop/src/features/channels/ui/EditRespondToDialog.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ export function EditRespondToDialog({
5454
<Dialog onOpenChange={onOpenChange} open={open}>
5555
<DialogContent className="max-w-md">
5656
<DialogHeader>
57-
<DialogTitle>Edit respond-to</DialogTitle>
57+
<DialogTitle>Manage agent access</DialogTitle>
5858
<DialogDescription>
59-
Choose who {agent?.name ?? "this agent"} responds to.
59+
Choose who can send instructions to {agent?.name ?? "this agent"}.
6060
</DialogDescription>
6161
</DialogHeader>
6262
<CreateAgentRespondToField
@@ -87,7 +87,7 @@ export function EditRespondToDialog({
8787
size="sm"
8888
type="button"
8989
>
90-
{updateMutation.isPending ? "Saving..." : "Save"}
90+
{updateMutation.isPending ? "Saving..." : "Save access"}
9191
</Button>
9292
</div>
9393
</DialogContent>

‎desktop/src/features/channels/ui/MembersSidebarMemberCard.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ function formatRespondToLabel(agent: ManagedAgent) {
109109
case "anyone":
110110
return "Anyone";
111111
case "allowlist":
112-
return `Allowlist (${agent.respondToAllowlist.length})`;
112+
return `Selected people (${agent.respondToAllowlist.length})`;
113113
default:
114-
return "Owner only";
114+
return "Only me";
115115
}
116116
}
117117

@@ -379,7 +379,7 @@ function MemberActionsMenu({
379379
onClick={() => onEditRespondTo(managedAgent)}
380380
>
381381
<Pencil className="h-4 w-4" />
382-
Edit respond-to...
382+
Manage agent access...
383383
</DropdownMenuItem>
384384
) : null}
385385
{canRemoveMember || showChangeRole ? (

‎desktop/src/features/messages/ui/MessageRow.tsx‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from "react";
2+
import { AlertTriangle } from "lucide-react";
23

34
import {
45
depthGuideActionsEqual,
@@ -383,12 +384,8 @@ export const MessageRow = React.memo(
383384
const guideBleedRem = isThreadReplyLayout ? 0.25 : 0;
384385
const avatarButtonRadiusClass = "rounded-full";
385386

386-
const respondToDotColor =
387-
message.respondTo === "anyone"
388-
? "bg-emerald-500"
389-
: message.respondTo === "allowlist"
390-
? "bg-amber-500"
391-
: null;
387+
const showRespondToIndicator =
388+
message.respondTo === "anyone" || message.respondTo === "allowlist";
392389

393390
const avatarNode = (
394391
<div className="relative shrink-0">
@@ -399,18 +396,31 @@ export const MessageRow = React.memo(
399396
displayName={message.author}
400397
testId="message-avatar"
401398
/>
402-
{respondToDotColor && !isThreadReplyLayout ? (
399+
{showRespondToIndicator && !isThreadReplyLayout ? (
403400
<span
404401
className={cn(
405402
"absolute -bottom-0.5 -right-0.5 flex h-3 w-3 items-center justify-center rounded-full bg-background",
406403
)}
404+
role="img"
405+
aria-label={
406+
message.respondTo === "anyone"
407+
? "Anyone can send instructions to this agent"
408+
: "Selected people can send instructions to this agent"
409+
}
407410
title={
408411
message.respondTo === "anyone"
409-
? "Responds to anyone"
410-
: "Responds to allowlist"
412+
? "Anyone can send instructions to this agent"
413+
: "Selected people can send instructions to this agent"
411414
}
412415
>
413-
<span className={cn("h-2 w-2 rounded-full", respondToDotColor)} />
416+
{message.respondTo === "anyone" ? (
417+
<AlertTriangle
418+
aria-hidden="true"
419+
className="h-2.5 w-2.5 fill-background text-amber-500"
420+
/>
421+
) : (
422+
<span className="h-2 w-2 rounded-full bg-blue-500" />
423+
)}
414424
</span>
415425
) : null}
416426
</div>

‎desktop/src/features/profile/ui/UserProfilePanelFields.tsx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const AGENT_INFO_LABELS = new Set([
5656
const AGENT_SETTINGS_LABELS = new Set([
5757
"Runtime",
5858
"Agent profile",
59-
"Respond to",
59+
"Who can send instructions",
6060
"ACP command",
6161
"MCP command",
6262
"Start on launch",
@@ -246,9 +246,13 @@ export function buildOwnerFields({
246246
const fields: ProfileField[] = [];
247247
const respondTo = managedAgent?.respondTo ?? relayAgent?.respondTo ?? null;
248248
const respondToDisplayValue = respondTo
249-
? respondTo === "owner-only" && ownerDisplayName
249+
? respondTo === "owner-only"
250250
? ownerDisplayName
251-
: respondTo.replace(/-/g, " ")
251+
? `Only ${ownerDisplayName} (owner)`
252+
: "Only the owner"
253+
: respondTo === "allowlist"
254+
? "Selected people"
255+
: "Anyone"
252256
: null;
253257

254258
const ownerClickable = Boolean(onOpenProfile && ownerProfilePubkey);
@@ -386,7 +390,7 @@ export function buildOwnerFields({
386390
fields.push({
387391
displayValue: respondToDisplayValue,
388392
icon: Ear,
389-
label: "Respond to",
393+
label: "Who can send instructions",
390394
testId: "user-profile-respond-to",
391395
});
392396
}

0 commit comments

Comments
 (0)