Files
SubochevAV 8f616f359f
ci / JVM build + tests (pull_request) Failing after 54s
docs: per-module READMEs (run vs library) + root navigation hub
Every subproject now has README.md:
- 3 runnable modules (:standalone, :agentik-cli, :agentik-tui):
  quickstart, env table, parameters, known limits
- 11 library modules: what it is, which problem solves, how to
  wire it in, where versions live

Root README.md is the navigation hub (Quickstart, Modules table,
publish + CI/CD notes).

Also: ci.yml prunes the :memory-vector -x excludes now that
text-embedding-kmp artifacts are published to caffeine.

518 tests green.

Verified publish pipeline: :proto:publish to caffeine produces
pom.module + per-target klibs + sources for all 9 KMP targets.

🤖 Generated with [opencode]
2026-09-16 20:44:16 +03:00

79 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# `:storage-sqlite` — SQLite реализация `:storage-core` (JVM-only)
## Что что это
Production persistence для `:standalone` на [SQLDelight](https://cashapp.github.io/sqldelight/):
- **messages** — append-only журнал с `conversation_id`, `created_at`.
- **working_memory** — rolling buffer последних 100 entries, типы
в JSON (`UserMessage / AssistantMessage / ToolExchange / SystemPrompt`).
- **conversations** — метаданные (id, title, model, timestamps).
- **reflections** — произвольные заметки ("I notice you often
prefer short replies").
- Промпт хранителя (`@mem0`) индексирован отдельно для быстрого
доступа.
Решает: стабильная, локальная, нулевая-настройка БД. Подходит и для
desktop-продакшена, и для Android, и для тестов (через Testcontainers).
## Где используется
- `:standalone` подключает по умолчанию (`storage.db` = путь из
`AGENTIK_DB_PATH`).
## Как подключить
```kotlin
jvmMain.dependencies {
implementation("pw.binom.agentik:storage-sqlite:0.1.0")
implementation("pw.binom.agentik:storage-core:0.1.0")
}
val storage = SqliteStorageSystem.open(Path("agentik.db"))
val messages: MessageStore = storage.messages
```
## Версии
`gradle/libs.versions.toml` → `[versions] agentik-storage-sqlite`.
Зависит от `app.cash.sqldelight:sqlite-driver:2.1.0` (через
`gradle/libs.versions.toml`).
## Тесты
```
./gradlew :storage-sqlite:jvmTest
```
Покрывают: миграции (через `migrations/` каталог и SQLDelight
`*.sqm`), round-trip, race-conditions (concurrent append), paged
flow.
## Что в схеме (упрощённо)
```sql
CREATE TABLE messages (
id TEXT PRIMARY KEY,
conversation_id TEXT NOT NULL,
created_at TEXT NOT NULL, -- ISO Instant
kind TEXT NOT NULL, -- 'user', 'assistant', 'tool_call', 'tool_result'
body_json TEXT NOT NULL
);
CREATE INDEX idx_messages_conv_time ON messages(conversation_id, created_at);
CREATE TABLE working_memory (
conversation_id TEXT NOT NULL,
entry_id TEXT PRIMARY KEY,
created_at TEXT NOT NULL,
kind TEXT NOT NULL,
body_json TEXT NOT NULL
);
```
Полная схема + миграции — в `src/jvmMain/sqldelight/`.
## Текущий статус
Используется продакшеном. Миграции 1.0+.