Skip to content

Commit aef4921

Browse files
authored
Merge pull request #214 from joreilly/dependency_updates
dependency updates
2 parents fa2fb04 + 31b1534 commit aef4921

File tree

7 files changed

+47
-42
lines changed

7 files changed

+47
-42
lines changed

composeApp/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ kotlin {
6969
implementation(libs.kstore)
7070

7171
implementation(libs.kotlinx.coroutines)
72+
implementation(libs.kotlinx.datetime)
7273
implementation(libs.bundles.ktor.common)
7374

7475
implementation(libs.voyager)
@@ -149,6 +150,7 @@ android {
149150
packaging {
150151
resources {
151152
excludes += "/META-INF/{AL2.0,LGPL2.1}"
153+
excludes += "/META-INF/DEPENDENCIES"
152154
}
153155
}
154156
buildTypes {
@@ -206,5 +208,7 @@ configurations.all {
206208
// Explicitly exclude Ktor CIO engine on iOS/apple targets to avoid bringing non-supported engine
207209
// can be removed once https://github.com/JetBrains/koog/pull/869 is merged
208210
configurations.matching { it.name.contains("ios", ignoreCase = true) || it.name.contains("apple", ignoreCase = true) }.all {
209-
exclude(group = "io.ktor", module = "ktor-client-cio")
211+
//exclude(group = "io.ktor", module = "ktor-client-cio")
212+
// Exclude kotlinx-datetime to avoid Clock type alias conflict with kotlin.time.Clock in Kotlin 2.2.21
213+
//exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-datetime")
210214
}

composeApp/src/commonMain/kotlin/dev/johnoreilly/climatetrace/agent/ClimateTraceAgent.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package dev.johnoreilly.climatetrace.agent
22

33
import ai.koog.agents.core.agent.AIAgent
4-
import ai.koog.agents.core.agent.asAssistantMessage
5-
import ai.koog.agents.core.agent.containsToolCalls
6-
import ai.koog.agents.core.agent.executeMultipleTools
7-
import ai.koog.agents.core.agent.extractToolCalls
84
import ai.koog.agents.core.agent.functionalStrategy
9-
import ai.koog.agents.core.agent.requestLLM
10-
import ai.koog.agents.core.agent.requestLLMMultiple
11-
import ai.koog.agents.core.agent.sendMultipleToolResults
5+
import ai.koog.agents.core.dsl.extension.asAssistantMessage
6+
import ai.koog.agents.core.dsl.extension.containsToolCalls
7+
import ai.koog.agents.core.dsl.extension.executeMultipleTools
8+
import ai.koog.agents.core.dsl.extension.extractToolCalls
9+
import ai.koog.agents.core.dsl.extension.requestLLM
10+
import ai.koog.agents.core.dsl.extension.requestLLMMultiple
11+
import ai.koog.agents.core.dsl.extension.sendMultipleToolResults
1212
import ai.koog.agents.core.tools.ToolRegistry
1313
import ai.koog.prompt.executor.model.PromptExecutor
1414
import ai.koog.prompt.llm.LLModel

composeApp/src/commonMain/kotlin/dev/johnoreilly/climatetrace/agent/ClimateTraceTool.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,12 @@ class GetEmissionsTool(val climateTraceRepository: ClimateTraceRepository) : Sim
4444
@property:LLMDescription("Year for which emissions occurred")
4545
val year: String
4646
)
47-
4847
override val argsSerializer = Args.serializer()
4948
override val description = "Get the emission data for a country for a particular year."
5049

5150
override suspend fun doExecute(args: Args): String {
52-
try {
53-
return climateTraceRepository.fetchCountryEmissionsInfo(args.countryCodeList, args.year).joinToString {
54-
it.emissions.co2.toString()
55-
}
56-
} catch (e: Exception) {
57-
println("Error: $e")
58-
return ""
51+
return climateTraceRepository.fetchCountryEmissionsInfo(args.countryCodeList, args.year).joinToString {
52+
it.emissions.co2.toString()
5953
}
6054
}
6155
}

gradle/libs.versions.toml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
[versions]
2-
kotlin = "2.2.20"
3-
ksp = "2.2.20-2.0.2"
2+
kotlin = "2.2.21"
3+
ksp = "2.3.0"
44
kotlinx-coroutines = "1.10.2"
55
kotlinxSerialization = "1.9.0"
6+
kotlinx-dateTime = "0.7.1-0.6.x-compat"
67

7-
agp = "8.13.0"
8+
agp = "8.13.1"
89
android-compileSdk = "36"
910
android-minSdk = "24"
1011
android-targetSdk = "36"
1112
androidx-activityCompose = "1.11.0"
12-
compose = "1.9.2"
13-
compose-plugin = "1.9.0"
14-
composeAdaptiveLayout = "1.1.2"
15-
harawata-appdirs = "1.4.0"
16-
koalaplot = "0.9.1"
13+
compose = "1.9.4"
14+
compose-plugin = "1.9.3"
15+
composeAdaptiveLayout = "1.2.0"
16+
harawata-appdirs = "1.5.0"
17+
koalaplot = "0.10.1"
1718
koin = "4.1.1"
1819
koin-compose-multiplatform = "4.1.1"
19-
kmpNativeCoroutines = "1.0.0-ALPHA-47"
20-
kmpObservableViewModel = "1.0.0-BETA-14"
20+
kmpNativeCoroutines = "1.0.0-ALPHA-48"
21+
kmpObservableViewModel = "1.0.0-BETA-15"
2122
kstore = "1.0.0"
22-
ktor = "3.3.0"
23+
ktor = "3.3.2"
2324
treemapChart = "0.1.3"
2425
voyager= "1.1.0-beta03"
2526
molecule = "2.2.0"
26-
mcp = "0.7.2"
27+
mcp = "0.7.7"
2728
shadowPlugin = "9.2.2"
2829
jib = "3.4.5"
2930
googleAdk = "0.3.0"
30-
#koogAgents = "0.4.3-develop-20250927-0204"
31-
koogAgents = "0.5.0"
32-
markdownRenderer = "0.37.0"
31+
koogAgents = "0.5.2"
32+
markdownRenderer = "0.38.1"
3333
buildkonfig = "0.17.1"
3434

3535

@@ -52,6 +52,8 @@ koog-agents = { module = "ai.koog:koog-agents", version.ref = "koogAgents" }
5252
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
5353
kotlinx-coroutines-rx3 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx3", version.ref = "kotlinx-coroutines" }
5454
kotlinx-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core", version.ref = "kotlinxSerialization" }
55+
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-dateTime" }
56+
5557
kmpObservableViewModel = { module = "com.rickclephas.kmp:kmp-observableviewmodel-core", version.ref = "kmpObservableViewModel" }
5658

5759
kstore = { module = "io.github.xxfast:kstore", version.ref = "kstore" }
@@ -67,6 +69,8 @@ ktor-serialization-kotlinx-json = { group = "io.ktor", name = "ktor-serializatio
6769
ktor-client-android = { group = "io.ktor", name = "ktor-client-android", version.ref = "ktor" }
6870
ktor-client-darwin = { group = "io.ktor", name = "ktor-client-darwin", version.ref = "ktor" }
6971
ktor-client-java = { group = "io.ktor", name = "ktor-client-java", version.ref = "ktor" }
72+
ktor-server-cio = { group = "io.ktor", name = "ktor-server-cio", version.ref = "ktor" }
73+
ktor-server-sse = { group = "io.ktor", name = "ktor-server-sse", version.ref = "ktor" }
7074

7175
voyager = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }
7276
harawata-appdirs = { module = "net.harawata:appdirs", version.ref = "harawata-appdirs" }

mcp-server/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ plugins {
77
}
88

99
dependencies {
10+
implementation(libs.ktor.client.java)
1011
implementation(libs.mcp.kotlin)
1112
implementation(libs.koin.core)
12-
//implementation("ch.qos.logback:logback-classic:1.5.8")
13+
implementation(libs.ktor.server.cio)
14+
implementation(libs.ktor.server.sse)
15+
// implementation("ch.qos.logback:logback-classic:1.5.8")
1316
implementation(projects.composeApp)
1417
}
1518

mcp-server/src/main/kotlin/McpServer.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import dev.johnoreilly.climatetrace.data.ClimateTraceRepository
22
import dev.johnoreilly.climatetrace.di.initKoin
3-
//import io.ktor.server.cio.*
3+
import io.ktor.server.cio.CIO
44
import io.ktor.server.engine.*
55
import io.ktor.utils.io.streams.*
66
import io.modelcontextprotocol.kotlin.sdk.*
@@ -19,7 +19,7 @@ import kotlinx.serialization.json.putJsonObject
1919

2020

2121
fun main(args: Array<String>) {
22-
val command = args.firstOrNull() ?: "--sse-server"
22+
val command = args.firstOrNull() ?: "--stdio"
2323
val port = args.getOrNull(1)?.toIntOrNull() ?: 8080
2424
when (command) {
2525
"--sse-server" -> `run sse mcp server`(port)
@@ -142,7 +142,7 @@ fun configureMcpServer(): Server {
142142
* a close event.
143143
*/
144144
fun `run mcp server using stdio`() {
145-
val server = configureMcpServer()
145+
` val server = configureMcpServer()
146146
val transport = StdioServerTransport(
147147
System.`in`.asInput(),
148148
System.out.asSink().buffered()
@@ -156,7 +156,7 @@ fun `run mcp server using stdio`() {
156156
}
157157
done.join()
158158
}
159-
}
159+
`}
160160

161161
/**
162162
* Launches an SSE (Server-Sent Events) MCP (Model Context Protocol) server on the specified port.
@@ -166,10 +166,10 @@ fun `run mcp server using stdio`() {
166166
* @param port The port number on which the SSE server should be started.
167167
*/
168168
fun `run sse mcp server`(port: Int): Unit = runBlocking {
169-
// val server = configureMcpServer()
170-
// embeddedServer(CIO, host = "0.0.0.0", port = port) {
171-
// mcp {
172-
// server
173-
// }
174-
// }.start(wait = true)
169+
val server = configureMcpServer()
170+
embeddedServer(CIO, host = "0.0.0.0", port = port) {
171+
mcp {
172+
server
173+
}
174+
}.start(wait = true)
175175
}

0 commit comments

Comments
 (0)