5f0e0da361
Adds `agent.conversationStore` (read-only view on `conversation` table) to
the :proto Agent interface, plus `agent.renameConversation(id, title?)`
command. Client-side cache in :client is built from a snapshot
(`remote.listFlow(0)` → `local.upsert(...)`) + live updates via
`outbox.agentEvents()` (Created/Deleted/Renamed/Touched).
Changes:
- :journal-api — split `ConversationStore` (read-only: get/list) and
`MutableConversationStore` (CRUD: upsert/delete/rename/touch);
`ConversationStore` gained `listFlow` (cold-flow paging via `list`).
- :outbox-api — `AgentEvent.Touched(date, id, updatedAt)` event so
client cache stays fresh after `send()` (which bumps `updatedAt`).
- :proto.Agent — added `conversationStore: ConversationStore` property,
added `renameConversation(id, title?): Instant?` command, removed
`getConversations(offset, limit)` (now: `conversationStore.list(...)`).
- :server — `GET /conversations` now returns `List<ConversationRecord>`
(lightweight metadata, no handle/image-support flags); `PATCH
/conversations/{id}` uses `agent.renameConversation` and returns
the updated `ConversationRecord`.
- :journal-inmemory — expanded targets to jvm+macos+linux+mingw (matches
:client); moved `InMemoryMutableConversationStore` here from
:storage-inmemory so :client can use it without pulling ios targets.
- :storage-inmemory — depends on :journal-inmemory.
- :storage-ksqlite — pre-staged rename `KsqliteConversationStore` →
`KsqliteMutableConversationStore` to match the new interface split.
- :standalone — `ChatAgent` exposes `conversationStore` as a read-only
view of its `mutableConversationStore`; emits `AgentEvent.Touched`
after each `send()` (after `conversationStore.touch(id, ts)`).
- :client — new `HttpConversationStore` (read-only HTTP impl);
`AgentikAgent` wraps the agent with `wrapWithLocalConversationCache`
so the client sees an in-memory cache (snapshot + outbox events)
instead of direct HTTP. Cache scope + HttpClient + background job
all cancelled in `agent.close()`.
- :client/README — new «Кэш списка бесед» section with the
`listFlow → upsert` / `agentEvents → apply` pattern and a note that
`conversationStore` is read-only (writes only via Agent commands).
All 96 jvmTest tasks green.
54 lines
1.9 KiB
Kotlin
54 lines
1.9 KiB
Kotlin
plugins {
|
|
alias(libs.plugins.kotlin.multiplatform)
|
|
alias(libs.plugins.kotlin.serialization)
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(21)
|
|
|
|
// Только то, что нам реально нужно: JVM + 5 desktop-native. iOS не входит —
|
|
// :client не имеет смысла на iOS, а :agentik-cli использует :client и тоже
|
|
// без iOS. См. agentik-cli/build.gradle.kts.
|
|
jvm()
|
|
listOf(
|
|
macosX64(),
|
|
macosArm64(),
|
|
linuxX64(),
|
|
linuxArm64(),
|
|
mingwX64(),
|
|
)
|
|
|
|
sourceSets {
|
|
commonMain.dependencies {
|
|
api(project(":proto"))
|
|
api(project(":outbox-api"))
|
|
api(project(":journal-api"))
|
|
implementation(project(":journal-inmemory"))
|
|
|
|
api(libs.ktor.client.core)
|
|
implementation(libs.ktor.client.content.negotiation)
|
|
implementation(libs.ktor.serialization.kotlinx.json)
|
|
|
|
implementation(libs.kotlinx.coroutines.core)
|
|
implementation(libs.kotlinx.serialization.core)
|
|
implementation(libs.kotlinx.serialization.json)
|
|
}
|
|
commonTest.dependencies {
|
|
implementation(libs.kotlin.test)
|
|
implementation(libs.kotlinx.coroutines.test)
|
|
implementation(libs.ktor.server.core)
|
|
implementation(libs.ktor.server.test.host)
|
|
implementation(libs.ktor.client.content.negotiation)
|
|
implementation(libs.ktor.client.cio)
|
|
implementation(libs.ktor.server.cio)
|
|
implementation(libs.ktor.server.sse)
|
|
}
|
|
jvmTest.dependencies {
|
|
implementation("junit:junit:4.13.2")
|
|
}
|
|
}
|
|
|
|
// :client — это библиотека, не executable. Native-бинари объявляются
|
|
// в :agentik-cli (он зависит от :client и реально предоставляет main).
|
|
}
|