Files
buzz/desktop/src-tauri
DuncanandWill Pfleger 2f539397a8 feat(desktop): add cross-workspace agent-library compatibility seam (Phase 0)
Phase 0 of the cross-workspace agent library (spec §2.7) — the compatibility
seam that lets §3's library machinery land without a data-loss regression.
No library code exists yet; this is the pure refactor that makes every persona
writer merge-preserving by construction.

- `ManagedAgentRecord` gains `library_ref` / `library_applied_revision`
  (§2.6), both `#[serde(default, skip_serializing_if)]` so records without
  them stay byte-identical to head. Only §3 authors them.
- `apply_definition_view` writes ONLY the view-carried slots onto a canonical
  raw record, so any record-only field survives an unrelated save. At head,
  `save_personas` reconstructed every record wholesale through
  `into_agent_record`, silently erasing such fields on every other definition.
- `save_personas[_at]` now merges views onto existing raw records by slug via
  `merge_preserving_definitions`; a genuinely new persona is still projected
  fresh. Loader signatures are untouched (P5-I2).
- `load_persona_views[_at]` + `PersonaView` (flattened wire, skip-none) expose
  the library metadata at the list/get command boundary; `list_personas`
  returns `PersonaView`. The ~78 non-command readers keep the flat loader.
- Two preservation tests: every writer shape through the in-memory seam, and a
  full on-disk save/reload cycle through `_at` plus the read-side exposure.

The `AgentDefinition <-> ManagedAgentRecord` conversions move to a new
`types/conversions.rs` submodule (following the existing `types/` split), which
keeps `types.rs` under the 1000-line file-size cap after the two new fields.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-11 04:40:17 -04:00
..