Files
buzz/mobile/test/shared/agents
Tom Brow 543ecf2b1f fix(mobile): list the same owned agents as desktop (#8857)
## Summary

Mobile's Agents modal listed agents that desktop does not show. Most
were agents created in the earlier Buzz app (this repository's
`desktop/`), which the owner had not imported into Buzz 1.0
([block/buzz-app](https://github.com/block/buzz-app)). @ completion
offered them as well.

Desktop lists an owned agent only when the owner's newest kind:30177
record for that agent has a `pluginId/typeId` `runtime` tag and a name.
Records written by the earlier app have no `runtime` tag. Importing an
agent on desktop republishes its record with one
([`listingsOf`](662e91800a/src/features/agents/service.ts (L1413-L1460))).
Mobile now applies the same rule:

- **Agents modal:** shows listed owned agents, plus the account's remote
agents that have a verified owner profile here (so one stays listed
while a deletion that already removed its registration is retried).
Owned kind:10100 directory entries no longer add agents on their own.
- **@ completion:** channel members are always offered. Listed owned
agents are offered in streams and forums, where they can be added, as on
desktop. An owned agent that isn't listed is no longer offered from the
directory or from search, because mobile can't import it. The check that
runs before sending a restored draft follows the same rule.

The owned-agent directory moved to `lib/shared/agents` so the channels
feature can use it.

Shared agents owned by other people still come from the kind:10100
directory, which desktop doesn't use for @. That difference is unchanged
here.

### Related issue

None found.

### Validation

iPhone 17 simulator, debug build, against a local relay seeded with one
owner and two owned agents. Both agents have a NIP-OA profile. "Current
Agent" has a desktop runtime tag. "Old App Agent" has a registration
written the way the earlier app writes it, with no runtime tag. The
before captures are `origin/main` with the same data.

| | Before | After |
| --- | --- | --- |
| Agents modal | ![Agents modal before: Current Agent and Old App
Agent](https://github.com/user-attachments/assets/9089a820-9b30-4372-a133-7a0aa00fb6d8)
| ![Agents modal after: only Current
Agent](https://github.com/user-attachments/assets/f0585e0c-1bbf-4605-910f-90f6f9dc033a)
|
| `@` in a stream | ![Mention list before: only the
member](https://github.com/user-attachments/assets/aa88a5d6-5dec-41e9-aebd-07a62d06e48e)
| ![Mention list after: the member and Current
Agent](https://github.com/user-attachments/assets/d4de914d-23a4-4437-83b7-4b23dd641aac)
|
| `@Old` in a stream | ![Search before: Old App Agent
offered](https://github.com/user-attachments/assets/e038eb64-1fed-40f8-960b-18d6fad0a86f)
| ![Search after: nothing
offered](https://github.com/user-attachments/assets/47246f69-e939-402d-acfc-d0c764df967c)
|

Added tests:
- Directory loading: remote, desktop, earlier-app, later-imported, and
reverted agents, plus agents owned by someone else; only the newest
record counts. A table test covers the runtime and name rule.
- Agents modal widget test: an earlier-app agent is not shown.
- Mention candidates: only listed owned agents are offered outside the
channel, including from search.
- Compose bar: a restored draft that mentions an unlisted owned agent
outside the channel is rejected before sending.

I disabled the runtime check and the unlisted-agent filter, and the four
new guarding tests failed. The full mobile suite passes.

Human test: not applicable for this mobile change under the author's
standing exception.

buzz-review-completed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
2026-11-01 07:36:37 -08:00
..