Common Library

Serialization

Two object mappers coexist, because the platform speaks two wire encodings, and a set of database converters handles the types Spring Data cannot map on its own.

JSON Mapper

common/configuration/JacksonConfiguration provides the primary JsonMapper bean (Jackson 3, tools.jackson) used for the REST API and for the JSON element format. It registers custom serializers and deserializers for the types that need a stable external representation:

Type Representation

Ref

The ref string itself, not an object wrapper.

Locale

A BCP 47 language tag.

Instant, ZonedDateTime

ISO 8601 timestamps.

NamedProperties / LLMComponents

A map of component name to properties, where the provider-specific block deserializes into the matching LLMConfiguration variant.

MessagePack Mapper

common/configuration/MessagePackConfiguration provides a second mapper bean, msgpackObjectMapper, built on the MessagePack data format. It exists for the binary MSGPACK element format used by the mobile clients.

Two things differ from the JSON mapper:

ElementMapper (ai.promethist.pipeline.service) is the single class that uses both mappers and implements all three formats for input and output. See Wire Formats for the resulting encodings and Socket Handlers for where it is applied.

Database Converters

Converter Purpose

RefReadConverter, RefWriteConverter

Ref as a plain string in MongoDB.

ZonedDateTimeReadConverter, ZonedDateTimeWriteConverter

Timestamps with zone in MongoDB.

MongoConfiguration.LocaleReader / LocaleWriter

Locales in MongoDB.

MongoConfiguration.ChatMessageReader / ChatMessageWriter

Spring AI Message instances as BSON documents, dispatching on the stored class so InstructionMessage, UserMessage, SystemMessage, AssistantMessage and ToolResponseMessage round-trip with their subtype intact.