MantraArtifact requires a dialectId (FK), but the add-artifact screen had
no way to provide one. Let the user either reuse an existing source
dialect or create a new one inline.
- DatabaseMantraRepository.addDialect builds a DialectEvent, derives a
MantraDialect with the real chatRoomId/userPublicKey, and persists it
plus a MarmotInnerEvent rumor (kind = DialectEvent.KIND) for the
outbound pipeline, mirroring addArtifact. getDialects exposes the chat
room's dialects via a new MantraDialectDao query.
- MantraDialect.fromDialectEventTemplate mirrors the other models for
consistent id derivation; DialectEvent.build now takes name/country/
language (emitting NameTag/CountryTag/LanguageTag), and toDialectEvent's
tag order matches build so the event id round-trips. Also fixes the
DialectEvent.build / toDialectEvent phantom generics.
- AddArtifactViewModel loads the dialects on init and its addArtifact now
takes existingDialectId: reuse it when set, otherwise create a new
dialect (fields required only in create mode), then create the artifact.
- AddArtifactScreen shows a FilterChip row (one chip per existing dialect
plus a "New dialect" chip); the name/country/language fields appear only
when creating a new dialect.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>