Skip to main content

Module solid_chat

Module solid_chat 

Source
Expand description

Solid Chat interop — bidirectional mapping between the native chat model and the SolidOS “long chat” data model (https://solid.github.io/chat/), without degrading the native format.

The native chat (threaded ChatSession/ChatMessage with Lamport clocks, roles, agent sub-DIDs, provenance) is unchanged; this is an adapter at the boundary. The no-degradation mechanism is additive fidelity: every exported message carries BOTH

  • the standard Solid subset every long-chat client understands — meeting:LongChat + meeting:message, and per message dct:created / sioc:content / foaf:maker; AND
  • native-only fields as extra qc: (https://ns.webcivics.net/qualia-chat/) triples on the SAME resource (qc:lamport, qc:role, qc:contentHash, qc:agentDid, qc:modelId, qc:replyToFragment, …).

A vanilla Solid client reads the sioc:/meeting: subset and ignores qc:; a Qualia peer reads the full graph. So Qualia → Solid → Qualia round-trips losslessly (proven by the tests), while a Solid user still sees a normal chat. Messages are serialised with single-line, escaped string literals (one predicate per line) so the round-trip parser is small and robust; hardening for arbitrary Turtle reuses the engine N3Parser (a follow-on). Layout matches the spec: index.ttl (the channel) + date-partitioned YYYY/MM/DD/chat.ttl (the day’s messages).

Structs§

ImportedMessage
A message parsed back from a Solid long-chat day file. Fields absent in a pure-Solid file (no qc:) are defaulted honestly (role = User, Lamport derived from order by the caller if needed).
SolidChatExport
The rendered Solid long-chat resources for a session: the channel index plus each day’s message file.

Functions§

export_parts
Export from a session’s metadata + messages (decoupled from the heavy ChatEnvironment).
export_session
Export a native session to the Solid long-chat resources (index.ttl + date-partitioned day files).
parse_day_ttl
Parse a Solid long-chat day file (chat.ttl) into messages. Handles our own additive qc: output and the standard sioc:/foaf:/dct: subset produced by any long-chat client (single-line literals).