refactor(client): drop agentikHttpClient factory, accept HttpClient directly
ci / JVM build + tests (push) Successful in 6m3s
ci / JVM build + tests (push) Successful in 6m3s
- Remove agentikHttpClient(engineFactory: HttpClientEngineFactory<T>, ...)
factory from :client; the typed factory parameter pulled engine-specific
config (HttpClientConfig<T>.engine { ... }) and made the library's
factory API look engine-coupled even though the factory itself was
engine-agnostic.
- KDoc and SseTimeout no longer reference CIO as the canonical example.
- :client still exports applyAgentikDefaults(HttpClientConfig<*>) extension;
consumers build HttpClient themselves with their chosen engine.
- :agentik-cli/defaultCliHttpClient updated to construct HttpClient(CIO)
itself and apply agentik defaults inline; CIO-specific config
(requestTimeout = 0) stays in the same block.
This commit is contained in:
@@ -2,12 +2,12 @@ package pw.binom.agentik.cli
|
||||
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.engine.cio.CIO
|
||||
import pw.binom.agentik.client.agentikHttpClient
|
||||
import pw.binom.agentik.client.applyAgentikDefaults
|
||||
|
||||
/**
|
||||
* HTTP-клиент CLI: движок CIO + конфигурация agentik.
|
||||
*
|
||||
* Движок живёт здесь, а не в `:client`: библиотека не выбирает транспорт за
|
||||
* Движок выбирается здесь, а не в `:client`: библиотека не выбирает транспорт за
|
||||
* потребителя. Таргеты `:agentik-cli` (jvm + linuxX64/macosX64/macosArm64/mingwX64)
|
||||
* покрываются CIO.
|
||||
*
|
||||
@@ -18,6 +18,7 @@ import pw.binom.agentik.client.agentikHttpClient
|
||||
* [token] = `null` — авторизация выключена.
|
||||
*/
|
||||
internal fun defaultCliHttpClient(token: String? = null): HttpClient =
|
||||
agentikHttpClient(engineFactory = CIO, token = token) {
|
||||
HttpClient(CIO) {
|
||||
applyAgentikDefaults(token)
|
||||
engine { requestTimeout = 0 }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user