Architecture
Overview
llm-chat-message is a leaf package. It defines the message vocabulary used by chat engines, tool packages and adapters.
flowchart TD
accTitle: Message package boundary
accDescr: The message package defines enums, types and interfaces. A host or engine owns message storage and transport. Writers are structural interfaces implemented outside this package.
host["Host / engine"] -->|"uses"| message["llm-chat-message<br/>enums · types · interfaces"]
message -->|"describes"| data["ChatMessage · ToolCall · ChatMatch"]
message -->|"defines"| writers["MessageWriter · HookMessageWriter"]
message -->|"defines"| finish["FinishReason"]
host -->|"implements"| writers
Type Relationships
ChatMessagecombines aChatRole, content, timestamp, optional tool-call data and aChatMessageOrigin.ToolCallis the function-call payload carried by an assistant message and referenced by a tool result.ChatMatchpairs aChatMessagewith a successful regular-expression match.MessageWriterandHookMessageWriterdescribe how consumers append messages.FinishReasondescribes why a stream or response ended.
No Runtime Behavior
The only runtime values are the three enums. Storage, validation, transport and conversation management belong to the consumer.