Extract common types for chat-store integration. #106
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extract Common Types for Chat-Store Integration
Summary
This PR introduces a new embabel-common-chat module containing storage-agnostic interfaces for chat/conversation persistence.
These common types enable both embabel-chat-store and embabel-agent to share a consistent contract without being directly coupled to each other.
Motivation
Previously, chat persistence types were tightly coupled to agent-specific abstractions (e.g., PromptContributor, Awaitable,
ActionContext). This made it difficult for embabel-chat-store to depend on conversation types without pulling in the entire
agent framework. By extracting minimal, persistence-focused interfaces into embabel-common, both modules can now share types through this common dependency.
Changes
New Module: embabel-common-chat
File: StorableConversation.kt
Description: Core interface for conversations with message management, slicing support, and persistence awareness
────────────────────────────────────────
File: StorableMessage.kt
Description: Minimal message interface with role, content, timestamp, and optional author/recipient
────────────────────────────────────────
File: MessageRole.kt
Description: Enum: USER, ASSISTANT, SYSTEM
────────────────────────────────────────
File: MessageAuthor.kt
Description: Interface for message author identity with id and displayName
────────────────────────────────────────
File: ConversationFactory.kt
Description: Factory interface for creating conversations, with ConversationStoreType enum (IN_MEMORY, STORED)
────────────────────────────────────────
File: ConversationFactoryProvider.kt
Description: Provider pattern for resolving factories by storage type
Simple Implementations Included:
Architecture
Both downstream modules implement these interfaces: