diff --git a/docs/buzz-help.md b/docs/buzz-help.md index c21c1b0ddc..799249ace9 100644 --- a/docs/buzz-help.md +++ b/docs/buzz-help.md @@ -1216,8 +1216,8 @@ available rather than silently discarding it. owner, must not disclose it elsewhere, and must not treat quoted, forwarded, or other people's text as facts about the owner. - Turning **Remembers you** off removes that guidance but does not delete stored - memory; the agent's core memory can still be included in every prompt. Clear - stored memory in the agent's **Memory** tab. If someone edited the guidance's + memory; the agent's core memory can still be included in every prompt. To + clear a memory, ask Bestie to forget it. If someone edited the guidance's section markers in Instructions, the Bestie tab says it was edited instead of adding a duplicate. **Restore** can put the standard guidance back when the remaining markers still identify the section. @@ -1672,7 +1672,7 @@ even when no session is connected; it asks you to confirm first. Full access req ### Reconnecting an old agent in a DM -On desktop, **Connect [agent name]** may appear inside a DM with an old agent you own that is available to import from this computer. It preselects compatible saved harness, provider and model choices, and preserves saved effort settings. Choose another harness if the old type is unavailable or does not support inline connection setup; settings that were not saved use the selected type’s defaults. Review the inline controls; **Connect** stays disabled until the harness has a resolved model and provider, including usable defaults. If a saved Codex model is unavailable, choose another model or harness to continue. Complete installation or sign-in if prompted, stop the agent in old Buzz, then choose **Connect**. Your agent keeps its identity and conversation. This does not resend earlier messages. The same private card can appear in a channel or thread after you send a new mention of an eligible agent you own while that conversation is open, if that agent is still a member of the channel. Loading older mentions does not show cards, and known-archived agents are excluded. Only you see it, once per agent in the loaded conversation. Choose the **X** in the card’s top-right corner to hide that agent’s card in this conversation; the dismissal survives reopening and reloads. After connecting, **Ask the agent to respond** explicitly queues a follow-up addressed only to that agent in the original message’s thread; it does not automatically replay your request. If no prompt appears, use **Agents → New agent → Import an agent**. +On desktop, **Connect [agent name]** may appear inside a DM with an old agent you own that is available to import from this computer. It preselects compatible saved harness, provider and model choices, and preserves saved effort settings. Choose another harness if the old type is unavailable or does not support inline connection setup; settings that were not saved use the selected type’s defaults. Review the inline controls; **Connect** stays disabled until the harness has a resolved model and provider, including usable defaults. If a saved Codex model is unavailable, choose another model or harness to continue. Complete installation or sign-in if prompted, stop the agent in old Buzz, then choose **Connect**. Your agent keeps its identity and conversation. This does not resend earlier messages. The same private card can appear in a channel or thread after you send a new mention of an eligible agent you own while that conversation is open, if that agent is still a member of the channel. Loading older mentions does not show cards, and known-archived agents are excluded. Only you see it, once per agent in the loaded conversation. Choose the **X** in the card’s top-right corner to hide that agent’s card in this conversation; the dismissal survives reopening and reloads. After connecting, **Ask the agent to respond** explicitly queues a follow-up addressed only to that agent in the original message’s thread; it does not automatically replay your request. If no prompt appears, use **Agents → New agent → Import an agent**. Import works only in the desktop app. If no harness that runs agents on this computer is available (a hosted type such as Builderlab doesn’t count, and a plugin that is on but failed to activate registers none), the dialog says so and links to **Manage plugins** to turn one on or retry it. ## Choosing a channel for a workflow diff --git a/src/bundled/agents/AgentBrowse.test.tsx b/src/bundled/agents/AgentBrowse.test.tsx index d92ddb3086..cbc2d71e97 100644 --- a/src/bundled/agents/AgentBrowse.test.tsx +++ b/src/bundled/agents/AgentBrowse.test.tsx @@ -18,6 +18,7 @@ import type { ReadTransport } from "../../features/relay/transport"; import type { Agent, Agents, + AgentsSnapshot, RegisteredAgentType, } from "../../features/agents/service"; import type { Profile } from "../../features/relay/contracts"; @@ -32,6 +33,7 @@ function AgentBrowse( props: ReturnType & { relay: RelayData; onOpen?: (agent: Agent) => void; + openSettings?: (section: string) => void; }, ) { const [selection, setSelection] = useState(); @@ -72,13 +74,15 @@ const echo = { } as RegisteredAgentType; const notes = { key: "test/notes", title: "Notes" } as RegisteredAgentType; const imported = { pubkey: "e".repeat(64), name: "Shared helper" } as Agent; -/** Import's props: one type, and an `agents` holding `own` whose `port` - * resolves. */ +/** Import's props: one type, and an `agents` in `status` (with `error`) + * holding `own` whose `port` resolves. */ const importing = ( types: readonly RegisteredAgentType[] = [echo], own: readonly Agent[] = [], + status: AgentsSnapshot["status"] = "ready", + error?: string, ) => { - const snapshot = { agents: own }; + const snapshot = { status, error, agents: own }; return { agents: { subscribe: () => () => {}, @@ -530,6 +534,174 @@ it("does not silently replace an unavailable shared runtime", async () => { expect(props.agents.port).not.toHaveBeenCalled(); }); +/** Opens a shared agent's Import dialog with no type to import as, while + * Agents is in `status`. */ +async function noTypes( + status: AgentsSnapshot["status"], + openSettings = vi.fn(), + error?: string, +) { + const read = vi.fn().mockResolvedValue([shared]); + const props = importing([], [], status, error); + render( + , + ); + fireEvent.click(await screen.findByRole("button", { name: "Shared helper" })); + fireEvent.click(screen.getByRole("button", { name: "Import" })); + return screen.getByRole("dialog", { name: "Shared helper" }); +} + +// Desktop where no plugin registered a type that runs agents here: every +// agent plugin off, or one on that failed to activate. The component cannot +// tell these apart, so it names what is missing, not why. +it("says why a shared agent can't be imported here, and links Manage plugins", async () => { + const openSettings = vi.fn(); + const dialog = await noTypes("ready", openSettings); + expect( + within(dialog).getByText(/No harness that runs agents on this computer/), + ).toHaveTextContent( + "No harness that runs agents on this computer is available. Check Manage plugins.", + ); + expect(within(dialog).getByRole("button", { name: "Import" })).toBeDisabled(); + fireEvent.click( + within(dialog).getByRole("button", { name: "Manage plugins" }), + ); + expect(openSettings).toHaveBeenCalledExactlyOnceWith("plugins"); + // Settings opens in place of the dialog, not over it. + expect( + screen.queryByRole("dialog", { name: "Shared helper" }), + ).not.toBeInTheDocument(); +}); + +// Only a hosted type is on, so Manage plugins shows a plugin enabled. The +// page keeps hosted types out of Import, since an imported agent needs a key +// here, and the dialog must not claim no plugin is on. +it("does not say no plugin is on when only a hosted type is", async () => { + const read = vi.fn().mockResolvedValue([shared]); + const props = importing([], [], "ready"); + const hosted = [ + { ...echo, key: "test/cloud", title: "Cloud", remote: {} }, + ] as unknown as RegisteredAgentType[]; + props.agents.types = () => hosted; + const openSettings = vi.fn(); + render( + , + ); + fireEvent.click(await screen.findByRole("button", { name: "Shared helper" })); + fireEvent.click(screen.getByRole("button", { name: "Import" })); + const dialog = screen.getByRole("dialog", { name: "Shared helper" }); + expect( + within(dialog).getByText(/No harness that runs agents on this computer/), + ).toHaveTextContent( + "No harness that runs agents on this computer is available. Check Manage plugins.", + ); + expect(within(dialog).queryByText(/plugin is turned on/)).toBeNull(); + fireEvent.click( + within(dialog).getByRole("button", { name: "Manage plugins" }), + ); + expect(openSettings).toHaveBeenCalledExactlyOnceWith("plugins"); +}); + +it("keeps Manage plugins plain text while a shared agent is still importing", async () => { + const read = vi.fn().mockResolvedValue([shared]); + const props = importing(); + let fail = () => {}; + props.agents.port.mockImplementationOnce( + () => + new Promise((_, reject) => { + fail = () => reject(new Error("Keychain access was denied")); + }), + ); + const openSettings = vi.fn(); + const view = render( + , + ); + fireEvent.click(await screen.findByRole("button", { name: "Shared helper" })); + fireEvent.click(screen.getByRole("button", { name: "Import" })); + const dialog = screen.getByRole("dialog", { name: "Shared helper" }); + fireEvent.click(within(dialog).getByRole("button", { name: "Import" })); + expect(props.agents.port).toHaveBeenCalledTimes(1); + // The last agent plugin goes off while the import is still running. + const gone = importing([]); + view.rerender( + , + ); + expect( + within(dialog).getByText(/No harness that runs agents on this computer/), + ).toHaveTextContent( + "No harness that runs agents on this computer is available. Check Manage plugins.", + ); + // Opening Settings would close the dialog over the import, which Close + // may not do either, so the link waits as plain text. + expect( + within(dialog).queryByRole("button", { name: "Manage plugins" }), + ).not.toBeInTheDocument(); + expect(within(dialog).getByRole("button", { name: "Close" })).toBeDisabled(); + await act(async () => { + fail(); + }); + // The import's outcome still lands in the dialog, and the link is back. + expect(within(dialog).getByRole("alert")).toHaveTextContent( + "Keychain access was denied", + ); + fireEvent.click( + within(dialog).getByRole("button", { name: "Manage plugins" }), + ); + expect(openSettings).toHaveBeenCalledExactlyOnceWith("plugins"); + expect( + screen.queryByRole("dialog", { name: "Shared helper" }), + ).not.toBeInTheDocument(); +}); + +it("tells a browser that shared agents import only in the desktop app", async () => { + // Outside the desktop app Agents is unavailable and no type registers. + const dialog = await noTypes("unavailable"); + expect( + within(dialog).getByText( + "Agents runs in the desktop app. Open Buzz there to import one.", + ), + ).toBeVisible(); + expect(within(dialog).queryByText(/Manage plugins/)).not.toBeInTheDocument(); +}); + +it("says a shared agent can't be imported while Agents could not load", async () => { + const dialog = await noTypes("error", vi.fn(), "Keychain is locked."); + expect( + within(dialog).getByText("Agents could not load. Keychain is locked."), + ).toBeVisible(); + expect(within(dialog).queryByText(/Manage plugins/)).not.toBeInTheDocument(); +}); + +it("waits for agent types to register instead of asking for a plugin", async () => { + const dialog = await noTypes("loading"); + // Loading feedback is delayed a second, as LoadingRegion does everywhere. + expect( + await within(dialog).findByRole("status", undefined, { timeout: 2000 }), + ).toHaveTextContent("Loading agent types…"); + expect( + within(dialog).queryByText(/No harness that runs agents on this computer/), + ).not.toBeInTheDocument(); + expect(within(dialog).queryByText(/Manage plugins/)).not.toBeInTheDocument(); +}); + it("collapses long instructions and expands them on request", async () => { const read = vi.fn().mockResolvedValue([ { diff --git a/src/bundled/agents/AgentBrowse.tsx b/src/bundled/agents/AgentBrowse.tsx index 847873d3be..276f71927b 100644 --- a/src/bundled/agents/AgentBrowse.tsx +++ b/src/bundled/agents/AgentBrowse.tsx @@ -51,7 +51,9 @@ import { SurfaceButton } from "../../shared/design-system/ui/SurfaceButton"; import { PreferenceRow } from "../../shared/design-system/ui/PreferenceRow"; import { SettingsGroup } from "../../shared/design-system/ui/SettingsGroup"; import { InlineHeader } from "../../shared/design-system/ui/Header"; +import { LoadingRegion } from "../../shared/design-system/ui/LoadingRegion"; import { AgentInstructions } from "../../features/agents/AgentInstructions"; +import { SettingsSectionLink } from "../../features/navigation/SettingsSectionLink"; import { ProfileBackdrop } from "../../features/profiles/ProfileBackdrop"; import { agentAvatars } from "../../features/agents/avatar-packs"; import hero from "../../features/profiles/ProfileHero.module.css"; @@ -68,6 +70,8 @@ type Importing = Readonly<{ onImported(agent: Agent): void; /** Opens an agent of yours that an import would only copy. */ onOpen?: ((agent: Agent) => void) | undefined; + /** Opens a Settings section, such as Manage plugins. */ + openSettings?: ((section: string) => void) | undefined; }>; export type SharedAgentSelection = { @@ -446,12 +450,52 @@ function copies( } } +/** Why Import has no type to import as: agents run only in the desktop app, + * they could not load, their types are still registering, or no harness that + * runs agents on this computer is available. Only the last has a remedy in + * Settings, and it has more than one cause: every agent plugin is off, only a + * hosted type (one its provider runs, so it cannot take an imported key) is + * on, or a plugin that is on failed to activate. The snapshot being ready + * says the inventory loaded, not that a plugin activated, so this names what + * is missing rather than why. */ +export function NoImportTypes({ + agents, + openSettings, +}: Pick) { + const { snapshot } = useAgents(agents); + if (snapshot.status === "loading") + return ( + + {null} + + ); + return ( +

+ {snapshot.status === "unavailable" ? ( + // As the Agents page's own empty state words it. + "Agents runs in the desktop app. Open Buzz there to import one." + ) : snapshot.status === "error" ? ( + `Agents could not load. ${snapshot.error ?? "Try again."}` + ) : ( + <> + No harness that runs agents on this computer is available. Check{" "} + + Manage plugins + + . + + )} +

+ ); +} + export function SharedImportDialog({ shared, agents, types, onImported, onOpen, + openSettings, onClose, finalFocus, }: Importing & { @@ -586,9 +630,19 @@ export function SharedImportDialog({ {/* Laid out as the agent's Identity tab will show it once imported. */}
{types.length === 0 ? ( -

- Enable an agent type plugin to import agents. -

+ { + onClose(); + openSettings(section); + } + : undefined + } + /> ) : ( { ); }); +it("links Manage plugins from a card while no agent type plugin is on", async () => { + const user = userEvent.setup(); + await serve(ada()); + const none: RegisteredAgentType[] = []; + const navigator = { open: vi.fn(async () => ({})) }; + render( + none }} + relay={relay} + navigator={navigator as unknown as Navigation} + canOpen={() => false} + open={() => false} + />, + ); + const button = await screen.findByRole("button", { + name: "Add agent: Ada", + }); + await vi.waitFor(() => expect(button).toBeEnabled()); + await user.click(button); + const dialog = screen.getByRole("dialog", { name: "Ada" }); + expect( + within(dialog).getByText(/No harness that runs agents on this computer/), + ).toHaveTextContent( + "No harness that runs agents on this computer is available. Check Manage plugins.", + ); + await user.click( + within(dialog).getByRole("button", { name: "Manage plugins" }), + ); + expect(navigator.open).toHaveBeenCalledExactlyOnceWith({ + version: 1, + kind: "settings", + section: "plugins", + }); + // Settings opens in place of the dialog, not over it. + expect(screen.queryByRole("dialog", { name: "Ada" })).not.toBeInTheDocument(); +}); + it("refuses a card larger than the limit without reading it all", async () => { const chunk = new Uint8Array(1024 * 1024); const chunks = Array.from({ length: 20 }, () => chunk); diff --git a/src/bundled/agents/AgentCardAttachment.tsx b/src/bundled/agents/AgentCardAttachment.tsx index 83df2a6c93..94a78bd014 100644 --- a/src/bundled/agents/AgentCardAttachment.tsx +++ b/src/bundled/agents/AgentCardAttachment.tsx @@ -59,7 +59,8 @@ export function AgentCardAttachment({ }: AttachmentRendererProps & { agents: Agents; relay: RelayData; - /** Opens an agent of yours on the Agents page; absent, nothing offers to. */ + /** Opens an agent of yours on the Agents page, or a Settings section; + * absent, nothing offers to. */ navigator?: Navigation | undefined; }) { const connection = useRelayConnection(relay); @@ -157,6 +158,8 @@ export function AgentCardAttachment({ setAdding(false); opener(agent)?.(); }, + openSettings: (section: string) => + void navigator.open({ version: 1, kind: "settings", section }), })} onClose={() => setAdding(false)} finalFocus={trigger} diff --git a/src/bundled/agents/AgentsPage.test.tsx b/src/bundled/agents/AgentsPage.test.tsx index eb02fee0fd..93df86016c 100644 --- a/src/bundled/agents/AgentsPage.test.tsx +++ b/src/bundled/agents/AgentsPage.test.tsx @@ -3914,6 +3914,231 @@ it.each(["error", "unavailable"] as const)( }, ); +it("tells a browser's Import an agent that agents run in the desktop app", async () => { + const user = userEvent.setup(); + const navigator = { + open: vi.fn(async () => ({ status: "opened" as const })), + } as unknown as Navigation; + // Outside the desktop app no agent type registers. + const { agents } = setup([], { status: "unavailable", page: { navigator } }); + const none: RegisteredAgentType[] = []; + agents.types = () => none; + await user.click(screen.getByRole("button", { name: "New agent" })); + await user.click( + await screen.findByRole("menuitem", { name: "Import an agent" }), + ); + const dialog = await screen.findByRole("dialog", { name: "Import an agent" }); + expect( + within(dialog).getByText( + "Agents runs in the desktop app. Open Buzz there to import one.", + ), + ).toBeVisible(); + // The page behind it says the same. + expect( + screen.getByText("Agents runs in the desktop app", { exact: true }), + ).toBeInTheDocument(); + expect(within(dialog).queryByText(/Manage plugins/)).not.toBeInTheDocument(); +}); + +it("tells Import an agent that agents could not load, as the page does", async () => { + const user = userEvent.setup(); + const navigator = { + open: vi.fn(async () => ({ status: "opened" as const })), + } as unknown as Navigation; + const { agents } = setup([], { status: "error", page: { navigator } }); + const none: RegisteredAgentType[] = []; + agents.types = () => none; + await user.click(screen.getByRole("button", { name: "New agent" })); + await user.click( + await screen.findByRole("menuitem", { name: "Import an agent" }), + ); + const dialog = await screen.findByRole("dialog", { name: "Import an agent" }); + // Without a reason, the page's own fallback. + expect( + within(dialog).getByText("Agents could not load. Try again."), + ).toBeVisible(); + expect(within(dialog).queryByText(/Manage plugins/)).not.toBeInTheDocument(); +}); + +// No plugin registered a type that runs agents here: every agent plugin off, +// or one on that failed to activate. The dialog names what is missing. +it("links Import an agent to Manage plugins while no type runs agents here", async () => { + const user = userEvent.setup(); + const navigator = { + open: vi.fn(async () => ({ status: "opened" as const })), + } as unknown as Navigation; + const { agents } = setup([agent("Ada", 1)], { page: { navigator } }); + const none: RegisteredAgentType[] = []; + agents.types = () => none; + await user.click(screen.getByRole("button", { name: "New agent" })); + await user.click( + await screen.findByRole("menuitem", { name: "Import an agent" }), + ); + const dialog = await screen.findByRole("dialog", { name: "Import an agent" }); + expect( + within(dialog).getByText(/No harness that runs agents on this computer/), + ).toHaveTextContent( + "No harness that runs agents on this computer is available. Check Manage plugins.", + ); + await user.click( + within(dialog).getByRole("button", { name: "Manage plugins" }), + ); + expect(navigator.open).toHaveBeenCalledExactlyOnceWith({ + version: 1, + kind: "settings", + section: "plugins", + }); + // Settings opens in place of the dialog, not over it. + expect( + screen.queryByRole("dialog", { name: "Import an agent" }), + ).not.toBeInTheDocument(); +}); + +// Only a hosted type is on. Import keeps it out, since an imported agent +// needs a key here, and must not claim no plugin is on: Manage plugins shows +// one enabled. +it("does not say no plugin is on when only a hosted type is", async () => { + const user = userEvent.setup(); + const navigator = { + open: vi.fn(async () => ({ status: "opened" as const })), + } as unknown as Navigation; + const { agents, types } = setup([agent("Ada", 1)], { page: { navigator } }); + const cloud = { + ...types[0], + key: "test/cloud", + title: "Cloud", + remote: {}, + } as unknown as RegisteredAgentType; + const hosted = [cloud]; + agents.types = () => hosted; + await user.click(screen.getByRole("button", { name: "New agent" })); + await user.click( + await screen.findByRole("menuitem", { name: "Import an agent" }), + ); + const dialog = await screen.findByRole("dialog", { name: "Import an agent" }); + expect( + within(dialog).getByText(/No harness that runs agents on this computer/), + ).toHaveTextContent( + "No harness that runs agents on this computer is available. Check Manage plugins.", + ); + expect(within(dialog).queryByText(/plugin is turned on/)).toBeNull(); + await user.click( + within(dialog).getByRole("button", { name: "Manage plugins" }), + ); + expect(navigator.open).toHaveBeenCalledExactlyOnceWith({ + version: 1, + kind: "settings", + section: "plugins", + }); +}); + +it("keeps Manage plugins plain text while an import is still running", async () => { + const user = userEvent.setup(); + const navigator = { + open: vi.fn(async () => ({ status: "opened" as const })), + } as unknown as Navigation; + const { agents, change } = setup([], { page: { navigator } }); + let finish = () => {}; + agents.port.mockImplementationOnce( + () => + new Promise((resolve) => { + finish = () => resolve({ agent: agent("Ada", 1), notes: [] }); + }), + ); + await user.click( + await screen.findByRole("button", { name: /Import them now/ }), + ); + const dialog = screen.getByRole("dialog", { name: "Import an agent" }); + await user.click( + await within(dialog).findByRole("button", { name: "Import as Echo, Ada" }), + ); + // The last agent plugin goes off while Ada is still importing. + const none: RegisteredAgentType[] = []; + agents.types = () => none; + act(() => change({})); + expect( + within(dialog).getByText(/No harness that runs agents on this computer/), + ).toHaveTextContent( + "No harness that runs agents on this computer is available. Check Manage plugins.", + ); + // Opening Settings would close the dialog over the import, which Close + // and Escape may not do either, so the link waits as plain text. + expect( + within(dialog).queryByRole("button", { name: "Manage plugins" }), + ).not.toBeInTheDocument(); + await user.keyboard("{Escape}"); + expect(screen.getByRole("dialog", { name: "Import an agent" })).toBeVisible(); + finish(); + await user.click( + await within(dialog).findByRole("button", { name: "Manage plugins" }), + ); + expect(navigator.open).toHaveBeenCalledExactlyOnceWith({ + version: 1, + kind: "settings", + section: "plugins", + }); + expect( + screen.queryByRole("dialog", { name: "Import an agent" }), + ).not.toBeInTheDocument(); +}); + +it("links a Marketplace agent's Import to Manage plugins while no agent type plugin is on", async () => { + const user = userEvent.setup(); + const navigator = { + open: vi.fn(async () => ({ status: "opened" as const })), + } as unknown as Navigation; + const view = setup([], { page: { navigator } }); + const none: RegisteredAgentType[] = []; + view.agents.types = () => none; + const owner = createRelaySession(null); + const session = { + ...owner.session, + read: vi.fn().mockResolvedValue([ + { + id: "ab".repeat(32), + pubkey: "cd".repeat(32), + kind: 30175, + created_at: 1, + tags: [ + ["d", "helper"], + ["shared", "true"], + ], + content: JSON.stringify({ + display_name: "Marketplace helper", + system_prompt: "Help with tasks.", + }), + }, + ]), + }; + const snapshot = { status: "ready" as const, generation: 1, session }; + const relay = { ...view.relay, snapshot: () => snapshot }; + try { + view.rerender( + , + ); + await user.click(screen.getByRole("tab", { name: "Marketplace" })); + await user.click( + await screen.findByRole("button", { name: "Marketplace helper" }), + ); + await user.click(screen.getByRole("button", { name: "Import" })); + const dialog = screen.getByRole("dialog", { name: "Marketplace helper" }); + await user.click( + within(dialog).getByRole("button", { name: "Manage plugins" }), + ); + expect(navigator.open).toHaveBeenCalledExactlyOnceWith({ + version: 1, + kind: "settings", + section: "plugins", + }); + expect( + screen.queryByRole("dialog", { name: "Marketplace helper" }), + ).not.toBeInTheDocument(); + } finally { + view.unmount(); + owner.dispose(); + } +}); + it("says in Settings where an agent's config lives, and why it is only here", async () => { const user = userEvent.setup(); const { agents, notify } = setup([agent("Ada", 1)]); diff --git a/src/bundled/agents/AgentsPage.tsx b/src/bundled/agents/AgentsPage.tsx index 123b4bcedb..88fbbef3aa 100644 --- a/src/bundled/agents/AgentsPage.tsx +++ b/src/bundled/agents/AgentsPage.tsx @@ -41,6 +41,7 @@ import styles from "./AgentsPage.module.css"; import cardStyles from "./AgentCard.module.css"; import { AgentBrowse, + NoImportTypes, SharedAgentPanel, type SharedAgentSelection, SharedImportDialog, @@ -926,6 +927,7 @@ export function AgentsPage({ onImported={leaveListing} // Stays on the listing if an unsaved draft is kept. onOpen={(agent) => browse(agent.pubkey, leaveListing)} + openSettings={openSettings} /> ), }, @@ -988,6 +990,16 @@ export function AgentsPage({ flow === "import" ? () => changeTab("yours") : returnTo("teams") } onPendingChange={setImporting} + // Settings opens in place of the dialog, not over it, so while + // an import keeps the dialog open the link is plain text. + openSettings={ + openSettings && !importing + ? (section) => { + setFlow(undefined); + openSettings(section); + } + : undefined + } /> )} @@ -1788,6 +1800,7 @@ function ImportAgents({ only, onImported, onPendingChange, + openSettings, }: { agents: Agents; community: string | undefined; @@ -1798,6 +1811,7 @@ function ImportAgents({ only: "agents" | "teams"; onImported(): void; onPendingChange(pending: boolean): void; + openSettings: ((section: string) => void) | undefined; }) { const [found, setFound] = useState(); const [confirming, setConfirming] = useState(); @@ -1990,11 +2004,7 @@ function ImportAgents({ }); }, [agents, snapshot]); if (!types.length) - return ( -

- Enable an agent type plugin to import agents. -

- ); + return ; const elsewhere = only === "agents" ? offered : []; const teamsElsewhere = only === "teams" ? teamsToJoin(snapshot.teams, agents.joinable()) : []; diff --git a/src/bundled/bestie/BestieTab.test.tsx b/src/bundled/bestie/BestieTab.test.tsx index b0455fd507..51c2c57563 100644 --- a/src/bundled/bestie/BestieTab.test.tsx +++ b/src/bundled/bestie/BestieTab.test.tsx @@ -516,8 +516,12 @@ it("turns memory on and off as a marked section of the instructions", async () = const { rerender } = render(); const remembers = screen.getByRole("switch", { name: "Remembers you" }); expect(remembers).not.toBeChecked(); + // The Memory tab only reads, so the row says how to clear a memory instead. + expect(remembers).toHaveAccessibleDescription( + "Adds memory rules to Bestie's instructions. Off removes them. Nothing Bestie remembered is deleted, and its core memory still goes into every prompt. To clear a memory, ask Bestie to forget it.", + ); expect( - screen.getByText(/Nothing Bestie remembered is deleted/), + screen.getByText(/To clear a memory, ask Bestie to forget it\./), ).toBeVisible(); await user.click(remembers); diff --git a/src/bundled/bestie/README.md b/src/bundled/bestie/README.md index e13eb2f9a6..7297467c5d 100644 --- a/src/bundled/bestie/README.md +++ b/src/bundled/bestie/README.md @@ -93,8 +93,8 @@ markers, the row says the section was edited instead of showing a switch, so it never adds a second one. **Restore** puts back the original section in place of its two markers and what lies between them, when they still show where it starts and ends; otherwise fix its markers in Instructions. Off -deletes no memory, and the agent's core memory is still in every prompt; -clear memory in the Memory tab. +deletes no memory, and the agent's core memory is still in every prompt; to +clear a memory, ask Bestie to forget it. **Private channels Bestie can read** lists the private channels you share with Bestie, each with **Remove**, which asks first, as the Members dialog does. diff --git a/src/bundled/bestie/features.ts b/src/bundled/bestie/features.ts index 52bc41cd78..d4f42859d0 100644 --- a/src/bundled/bestie/features.ts +++ b/src/bundled/bestie/features.ts @@ -27,7 +27,7 @@ export const memory: Feature = { id: "memory", title: "Remembers you", description: - "Adds memory rules to Bestie's instructions. Off removes them. Nothing Bestie remembered is deleted, and its core memory still goes into every prompt. Clear memory in the Memory tab.", + "Adds memory rules to Bestie's instructions. Off removes them. Nothing Bestie remembered is deleted, and its core memory still goes into every prompt. To clear a memory, ask Bestie to forget it.", version: 1, text: `# Memory Your owner turned on "Remembers you": keep memory about them, so your help gets better over time. That is their approval to save what they tell you by these rules; still ask before you change or remove something they told you before. Call mem_get mem/user when the answer depends on who the owner is or what they asked for before. Save only what will improve future help, and say something is saved only after the tool confirms it.