mirror of
https://github.com/block/buzz.git
synced 2026-11-04 08:21:48 +00:00
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>