feat(client): refactor AgentikAgent to manage its own HttpClient
ci / JVM build + tests (push) Failing after 54s
release / Publish KMP libraries → caffeine Nexus (release) Failing after 5s

- `AgentikAgent` now accepts `engineFactory` and an optional `token` to create an internal `HttpClient`, handling all configuration (JSON, Bearer).
- Removed `applyAgentikDefaults` and replaced it with `agentikHttpClient` for `HttpClient` creation with consistent settings.
- Updated `Agent` to implement `AutoCloseable`, ensuring proper resource closure with `agent.close()`.
- Adjusted tests, docs, and examples to align with the new `AgentikAgent` API.
This commit is contained in:
2026-09-21 03:53:35 +03:00
parent fb963bfb6b
commit f946186ef5
7 changed files with 95 additions and 102 deletions
@@ -19,11 +19,18 @@ import kotlin.time.Instant
* `outbox.agentEvents(after)`. Это даёт единый путь для всех read-операций
* по хранилищу и убирает дублирование между протоколом и хранилищем.
*/
public interface Agent {
interface Agent : AutoCloseable {
/** Идентификатор агента. */
val id: String
/**
* Освобождает ресурсы агента (HTTP-клиент, сетевые handles, подписки).
* После [close] вызовы [createConversation] / [getConversation] и т.п.
* не определены. Idempotent.
*/
override fun close()
/**
* Append-only audit log всех сообщений диалогов (read-only view).
*