--- kind: task slug: agent-registry-api title: Expose the shared agent catalog and private draft API plan_slug: workspace-communications epic_slug: agent-participation status: ready priority: P1 tenant_id: global owner: unassigned cursor_todo_id: null updated_at: "2026-10-22" --- # Task summary Add one workspace-authorized tRPC registry API for catalog/detail reads and member-owned private draft persistence. ## Description Consume the schema/contracts from `Task-agent-registry-marketplace.md`. This task owns list/detail/filter and private draft create/read/save/discard procedures; library/editor tasks consume them. AI Chat selectors, Agents builder/library, mention completion and jobs all reference the same immutable agent IDs and versions. Curated templates supply provenance, not a second installed-agent identity. Do not duplicate model routing, harness aliases, users or run records as an agent registry. ## Subtasks - [ ] Add zod-validated, tenant-filtered catalog/detail queries for visible curated templates, installed/workspace agents and the caller's private drafts, with stable pagination. - [ ] Add private draft create/read/save/discard with optimistic base-revision checks, immutable versions and actor audit metadata; requested tools/context access remain inert. - [ ] Expose safe lifecycle/provenance/version/update metadata for library/selector clients without leaking another user's private drafts or restricted configuration. - [ ] Test cross-tenant ID guessing, same-workspace draft isolation including admins/owners, stale saves, retries and handle uniqueness conflicts. ## Owner or assignee `unassigned` ## Status `ready` for scheduling after registry schema/contracts; not currently running. ## Estimation `M` ## Acceptance criteria - [ ] One registry API supports all AI and chat surfaces; clients cannot create competing agent identities. - [ ] Only the draft owner can mutate/read their private draft; workspace admin status alone grants no private-draft access. - [ ] Saves are concurrency-safe and never install, publish, activate, grant tools/context, or enqueue execution. - [ ] List/detail/mention projections reveal only authorized agents and safe fields. - [ ] `pnpm lint && pnpm type-check && pnpm test` pass. ## Links to related Epic / Plan - Epic: [Agent participation](./Epic-agent-participation.md) - Plan: [Workspace communications](../Plan-workspace-communications.md) - Depends on: [Registry schema](./Task-agent-registry-marketplace.md) - Consumers: [Library UI](./Task-agent-marketplace-library-ui.md), [Draft editor](./Task-agent-builder-editor-drafts.md) - Separate mutations: [Install lifecycle](./Task-agent-install-lifecycle.md)