|
save/remove identity
Draft rows (agent === null, id === null) previously keyed the other-names
exclusion and the live isNameTaken predicate by their nullable persisted id,
so a draft falsely collided with its OWN name (every name reported 'already
exists') and saving/removing one of multiple drafts could reconcile all of
them (a null agent captured identity matched every draft).
Identify rows solely by each Row's stable numeric `key` (already the
{#each} key) for: the other-names uniqueness hint, the controller's live
isNameTaken predicate, replaceAgent (save reconciliation), and removeRow.
A draft excludes itself exactly once; a persisted row keeps reconciling the
same row on later edits and no longer self-collides.
Add direct component-level regression tests (NamedAgentsView.test.ts) for
the self-collision, distinct/same-name multi-draft cases, saving-one-
updates-only-that-row, removing-one-removes-only-that-row, and post-persist
re-save reconciliation. 5 of 6 tests fail against the previous code (verified).
Verification: typecheck 0 errors, biome clean, 1252 tests pass, build ok.
|
|
semantics
Implement the frontend of the Named Agents feature (plan §5-§9):
- New features/named-agents module: pure logic (types re-exported from
@dispatch/wire + transport-contract, validation, provider/model options,
snapshot helpers, network normalizers, auto-save status model) + an injected
auto-save controller (name debounce, immediate provider/model save, monotonic
stale-response guard) + the collapsible sidebar card view.
- Store: /named-agents CRUD + boot seed; selectModel(model, snapshot?) persists
the raw model WITH the namedAgent snapshot; draft promotion carries it;
refreshModel restores ModelResponse.namedAgent.
- Chat store setNamedAgent (sends namedAgent on chat.send); Tab.snapshot +
setSnapshot (retained across rename/remove, persisted with tabs).
- Model selector: synthetic Named Agents provider ALWAYS first; selecting one
resolves to the raw model + records a snapshot; a retained snapshot of a
renamed/removed agent still displays as unavailable (plan §7).
- Composition root wires the view (viewKinds + loaded-modules manifest) + feeds
the selector.
Tests: logic + controller + selector + app-store CRUD (1246 pass), typecheck 0,
biome clean (only pre-existing config infos pending a future migrate), build OK.
|