Files
buzz/desktop/src
npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w c9debf3620 feat(agents): re-home save-as-persona-template onto an existing agent
Adds a 'Save as persona template' action to an existing agent's menus,
re-homing the #1301 logic onto main's surfaces:

- saveAsPersonaTemplateDialogState() prefills the persona editor from a
  ManagedAgent, reverse-mapping the agent's harness command to a runtime
  id via commandsMatch (graceful fallback to no runtime). provider is
  omitted intentionally: ManagedAgent has no top-level provider field on
  main, so there is nothing lossless to carry.
- useSaveAsPersonaTemplate() is a self-contained hook (dialog + mutation)
  so a later visual reskin can move the trigger without untangling the
  behavior. Derives dialog state from agent + live runtimes via a memo to
  avoid the lazy-runtime-query first-open race.
- Wired into ManagedAgentRow's actions menu (gated personaId === null) and
  the sidebar agent profile (gated canEditAgent + persona-less).
- personaLibraryCopy.ts documents the UI<->backend vocabulary boundary:
  'persona template' is the product term for a backend persona (kind:30175).

Tests cover the dialog-state mapping: vocabulary, command reverse-map hit,
miss/empty-catalog fallback, null-command catalog entries, field carry-over,
provider omission, and null systemPrompt/model tolerance.

Co-authored-by: Taylor Ho <taylorkmho@gmail.com>
Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
2026-06-26 13:55:01 -07:00
..
2026-03-09 13:02:11 -07:00