Skip to content

Commit 40039b3

Browse files
authored
Merge pull request #226 from joreilly/dep_updates
dependency updates
2 parents 9903189 + d5f183f commit 40039b3

File tree

9 files changed

+76
-79
lines changed

9 files changed

+76
-79
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![kotlin-version](https://img.shields.io/badge/kotlin-2.2.0-blue?logo=kotlin)
1+
![kotlin-version](https://img.shields.io/badge/kotlin-2.3.0-blue?logo=kotlin)
22

33
Kotlin/Compose Multiplatform project to show climate related emission data from https://climatetrace.org/data. Development just started so very much work in progress right now!
44
Have started with showing sector emission data per country but ton of other info available as well (ideas very welcome!).

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class ClimateTraceAgentProvider(
122122
) {
123123
install(EventHandler) {
124124
onToolCallStarting { ctx ->
125-
onToolCallEvent("Tool ${ctx.tool.name}, args ${ctx.toolArgs}")
125+
onToolCallEvent("Tool ${ctx.toolName}, args ${ctx.toolArgs}")
126126
}
127127

128128

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

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
package dev.johnoreilly.climatetrace.agent
44

55
import ai.koog.agents.core.tools.SimpleTool
6-
import ai.koog.agents.core.tools.ToolDescriptor
7-
import ai.koog.agents.core.tools.ToolParameterDescriptor
8-
import ai.koog.agents.core.tools.ToolParameterType
96
import ai.koog.agents.core.tools.annotations.LLMDescription
107
import dev.johnoreilly.climatetrace.data.ClimateTraceRepository
118
import dev.johnoreilly.climatetrace.remote.Country
@@ -17,19 +14,20 @@ import kotlin.time.Clock
1714
import kotlin.time.ExperimentalTime
1815

1916

20-
class GetCountryTool(val climateTraceRepository: ClimateTraceRepository) : SimpleTool<GetCountryTool.Args>() {
17+
class GetCountryTool(val climateTraceRepository: ClimateTraceRepository) : SimpleTool<GetCountryTool.Args>(
18+
argsSerializer = Args.serializer(),
19+
name = "GetCountryTool",
20+
description = "Look up country code using country name"
21+
) {
2122
@Serializable
2223
data class Args(
2324
@property:LLMDescription("Country name")
2425
val countryName: String
2526
)
2627

27-
override val argsSerializer = Args.serializer()
28-
override val description = "Look up country code using country name"
29-
3028
private var countryList: List<Country>? = null
3129

32-
override suspend fun doExecute(args: Args): String {
30+
override suspend fun execute(args: Args): String {
3331
try {
3432
if (countryList == null) {
3533
countryList = climateTraceRepository.fetchCountries()
@@ -43,57 +41,55 @@ class GetCountryTool(val climateTraceRepository: ClimateTraceRepository) : Simpl
4341
}
4442

4543

46-
class GetEmissionsTool(val climateTraceRepository: ClimateTraceRepository) : SimpleTool<GetEmissionsTool.Args>() {
44+
class GetEmissionsTool(val climateTraceRepository: ClimateTraceRepository) : SimpleTool<GetEmissionsTool.Args>(
45+
argsSerializer = Args.serializer(),
46+
name = "GetEmissionsTool",
47+
description = "Get the emission data for a country for a particular year."
48+
) {
4749
@Serializable
4850
data class Args(
4951
@property:LLMDescription("ISO country code list (e.g., 'USA', 'GBR', 'FRA')")
5052
val countryCodeList: List<String>,
5153
@property:LLMDescription("Year for which emissions occurred")
5254
val year: String
5355
)
54-
override val argsSerializer = Args.serializer()
55-
override val description = "Get the emission data for a country for a particular year."
5656

57-
override suspend fun doExecute(args: Args): String {
57+
override suspend fun execute(args: Args): String {
5858
return climateTraceRepository.fetchCountryEmissionsInfo(args.countryCodeList, args.year).joinToString {
5959
it.emissions.co2.toString()
6060
}
6161
}
6262
}
6363

6464

65-
class GetAssetEmissionsTool(val climateTraceRepository: ClimateTraceRepository) : SimpleTool<GetAssetEmissionsTool.Args>() {
65+
class GetAssetEmissionsTool(val climateTraceRepository: ClimateTraceRepository) : SimpleTool<GetAssetEmissionsTool.Args>(
66+
argsSerializer = Args.serializer(),
67+
name = "GetAssetEmissionsTool",
68+
description = "Get the asset emission data for a country."
69+
) {
6670
@Serializable
6771
data class Args(
6872
@property:LLMDescription("ISO country code list (e.g., 'USA', 'GBR', 'FRA')")
6973
val countryCodeList: List<String>,
7074
)
71-
override val argsSerializer = Args.serializer()
72-
override val description = "Get the asset emission data for a country."
7375

74-
override suspend fun doExecute(args: Args): String {
76+
override suspend fun execute(args: Args): String {
7577
return climateTraceRepository.fetchCountryAssetEmissionsInfo(args.countryCodeList).toString()
7678
}
7779
}
7880

79-
class GetPopulationTool(val climateTraceRepository: ClimateTraceRepository) : SimpleTool<GetPopulationTool.Args>() {
81+
class GetPopulationTool(val climateTraceRepository: ClimateTraceRepository) : SimpleTool<GetPopulationTool.Args>(
82+
argsSerializer = Args.serializer(),
83+
name = "GetPopulationTool",
84+
description = "Get population data for a country by its country code"
85+
) {
8086
@Serializable
81-
data class Args(val countryCode: String)
82-
83-
override val argsSerializer = Args.serializer()
84-
override val description = "Get population data for a country by its country code"
85-
86-
override val descriptor = ToolDescriptor(
87-
name = "GetPopulationTool",
88-
description = "Get population data for a country by its country code",
89-
requiredParameters = listOf(
90-
ToolParameterDescriptor(
91-
name = "countryCode", description = "ISO country code (e.g., 'USA', 'GBR', 'FRA')", type = ToolParameterType.String
92-
)
93-
),
87+
data class Args(
88+
@property:LLMDescription("ISO country code (e.g., 'USA', 'GBR', 'FRA')")
89+
val countryCode: String
9490
)
9591

96-
override suspend fun doExecute(args: Args): String {
92+
override suspend fun execute(args: Args): String {
9793
println("Getting population for ${args.countryCode}")
9894
try {
9995
val population = climateTraceRepository.getPopulation(args.countryCode)
@@ -112,19 +108,18 @@ class GetPopulationTool(val climateTraceRepository: ClimateTraceRepository) : Si
112108
class CurrentDatetimeTool(
113109
val defaultTimeZone: TimeZone = TimeZone.UTC,
114110
val clock: Clock = Clock.System,
115-
) : SimpleTool<CurrentDatetimeTool.Args>() {
111+
) : SimpleTool<CurrentDatetimeTool.Args>(
112+
argsSerializer = Args.serializer(),
113+
name = "current_datetime",
114+
description = "Get the current date and time in the specified timezone"
115+
) {
116116
@Serializable
117117
data class Args(
118118
@property:LLMDescription("The timezone to get the current date and time in (e.g., 'UTC', 'America/New_York', 'Europe/London'). Defaults to UTC.")
119119
val timezone: String = "UTC"
120120
)
121121

122-
override val argsSerializer = Args.serializer()
123-
124-
override val name = "current_datetime"
125-
override val description = "Get the current date and time in the specified timezone"
126-
127-
override suspend fun doExecute(args: Args): String {
122+
override suspend fun execute(args: Args): String {
128123
val zoneId = try {
129124
TimeZone.of(args.timezone)
130125
} catch (_: Exception) {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import ai.koog.agents.core.tools.SimpleTool
44
import ai.koog.agents.core.tools.annotations.LLMDescription
55
import kotlinx.serialization.Serializable
66

7-
object ExitTool : SimpleTool<ExitTool.Args>() {
7+
object ExitTool : SimpleTool<ExitTool.Args>(
8+
argsSerializer = Args.serializer(),
9+
name = "ExitTool",
10+
description = "Exit the agent session with the specified result. Call this tool to finish the conversation with the user."
11+
) {
812
@Serializable
913
data class Args(
1014
@property:LLMDescription("The result of the agent session. Default is empty, if there's no particular result.")
1115
val result: String = ""
1216
)
1317

14-
override val argsSerializer = Args.serializer()
15-
override val description: String =
16-
"Exit the agent session with the specified result. Call this tool to finish the conversation with the user."
17-
18-
override suspend fun doExecute(args: Args): String = args.result
18+
override suspend fun execute(args: Args): String = args.result
1919
}

gradle/libs.versions.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
[versions]
2-
kotlin = "2.2.21"
2+
kotlin = "2.3.0"
33
ksp = "2.3.2"
44
kotlinx-coroutines = "1.10.2"
55
kotlinx-serialization = "1.9.0"
66
kotlinx-dateTime = "0.7.1-0.6.x-compat"
77

8-
agp = "8.12.0"
8+
agp = "8.12.3"
99
android-compileSdk = "36"
1010
android-minSdk = "24"
1111
android-targetSdk = "36"
12-
androidx-activityCompose = "1.12.1"
12+
androidx-activityCompose = "1.12.2"
1313
androidx-datastore = "1.2.0"
14-
compose = "1.10.0"
15-
compose-plugin = "1.9.3"
14+
compose = "1.10.1"
15+
compose-plugin = "1.10.0"
1616
composeAdaptiveLayout = "1.2.0"
1717
harawata-appdirs = "1.5.0"
18-
koalaplot = "0.10.1"
18+
koalaplot = "0.10.4"
1919
koin = "4.1.1"
2020
koin-compose-multiplatform = "4.1.1"
21-
kmpNativeCoroutines = "1.0.0-ALPHA-48"
22-
kmpObservableViewModel = "1.0.0-BETA-15"
21+
kmpNativeCoroutines = "1.0.0"
22+
kmpObservableViewModel = "1.0.1"
2323
kstore = "1.0.0"
2424
ktor = "3.3.3"
2525
treemapChart = "0.1.3"
2626
voyager= "1.1.0-beta03"
2727
molecule = "2.2.0"
28-
mcp = "0.8.0"
29-
shadowPlugin = "9.2.2"
30-
jib = "3.5.1"
31-
googleAdk = "0.4.0"
32-
koogAgents = "0.5.4"
33-
markdownRenderer = "0.38.1"
28+
mcp = "0.8.1"
29+
shadowPlugin = "9.3.1"
30+
jib = "3.5.2"
31+
googleAdk = "0.5.0"
32+
koogAgents = "0.6.0"
33+
markdownRenderer = "0.39.1"
3434
buildkonfig = "0.17.1"
3535

3636

iosApp/iosApp.xcodeproj/project.pbxproj

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; };
1111
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; };
1212
1A64543E2B45D93900204F96 /* KMMViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A64543D2B45D93900204F96 /* KMMViewModel.swift */; };
13-
1AA509B02BEF5CAD0081137F /* KMPObservableViewModelCore in Frameworks */ = {isa = PBXBuildFile; productRef = 1AA509AF2BEF5CAD0081137F /* KMPObservableViewModelCore */; };
14-
1AA509B22BEF5CAD0081137F /* KMPObservableViewModelSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 1AA509B12BEF5CAD0081137F /* KMPObservableViewModelSwiftUI */; };
13+
1AEBF8A82F1A9F6D009F846D /* KMPObservableViewModelCore in Frameworks */ = {isa = PBXBuildFile; productRef = 1AEBF8A72F1A9F6D009F846D /* KMPObservableViewModelCore */; };
14+
1AEBF8AA2F1A9F6D009F846D /* KMPObservableViewModelSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 1AEBF8A92F1A9F6D009F846D /* KMPObservableViewModelSwiftUI */; };
1515
2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; };
1616
7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; };
1717
/* End PBXBuildFile section */
@@ -32,8 +32,8 @@
3232
isa = PBXFrameworksBuildPhase;
3333
buildActionMask = 2147483647;
3434
files = (
35-
1AA509B02BEF5CAD0081137F /* KMPObservableViewModelCore in Frameworks */,
36-
1AA509B22BEF5CAD0081137F /* KMPObservableViewModelSwiftUI in Frameworks */,
35+
1AEBF8A82F1A9F6D009F846D /* KMPObservableViewModelCore in Frameworks */,
36+
1AEBF8AA2F1A9F6D009F846D /* KMPObservableViewModelSwiftUI in Frameworks */,
3737
);
3838
runOnlyForDeploymentPostprocessing = 0;
3939
};
@@ -112,8 +112,8 @@
112112
);
113113
name = iosApp;
114114
packageProductDependencies = (
115-
1AA509AF2BEF5CAD0081137F /* KMPObservableViewModelCore */,
116-
1AA509B12BEF5CAD0081137F /* KMPObservableViewModelSwiftUI */,
115+
1AEBF8A72F1A9F6D009F846D /* KMPObservableViewModelCore */,
116+
1AEBF8A92F1A9F6D009F846D /* KMPObservableViewModelSwiftUI */,
117117
);
118118
productName = iosApp;
119119
productReference = 7555FF7B242A565900829871 /* ClimateTraceKMP.app */;
@@ -144,7 +144,7 @@
144144
);
145145
mainGroup = 7555FF72242A565900829871;
146146
packageReferences = (
147-
1AA509AE2BEF5CAD0081137F /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */,
147+
1AEBF8A62F1A9F6D009F846D /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */,
148148
);
149149
productRefGroup = 7555FF7C242A565900829871 /* Products */;
150150
projectDirPath = "";
@@ -406,25 +406,25 @@
406406
/* End XCConfigurationList section */
407407

408408
/* Begin XCRemoteSwiftPackageReference section */
409-
1AA509AE2BEF5CAD0081137F /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */ = {
409+
1AEBF8A62F1A9F6D009F846D /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */ = {
410410
isa = XCRemoteSwiftPackageReference;
411-
repositoryURL = "https://github.com/rickclephas/KMP-ObservableViewModel.git";
411+
repositoryURL = "https://github.com/rickclephas/KMP-ObservableViewModel";
412412
requirement = {
413-
kind = exactVersion;
414-
version = "1.0.0-BETA-1";
413+
kind = upToNextMajorVersion;
414+
minimumVersion = 1.0.1;
415415
};
416416
};
417417
/* End XCRemoteSwiftPackageReference section */
418418

419419
/* Begin XCSwiftPackageProductDependency section */
420-
1AA509AF2BEF5CAD0081137F /* KMPObservableViewModelCore */ = {
420+
1AEBF8A72F1A9F6D009F846D /* KMPObservableViewModelCore */ = {
421421
isa = XCSwiftPackageProductDependency;
422-
package = 1AA509AE2BEF5CAD0081137F /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */;
422+
package = 1AEBF8A62F1A9F6D009F846D /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */;
423423
productName = KMPObservableViewModelCore;
424424
};
425-
1AA509B12BEF5CAD0081137F /* KMPObservableViewModelSwiftUI */ = {
425+
1AEBF8A92F1A9F6D009F846D /* KMPObservableViewModelSwiftUI */ = {
426426
isa = XCSwiftPackageProductDependency;
427-
package = 1AA509AE2BEF5CAD0081137F /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */;
427+
package = 1AEBF8A62F1A9F6D009F846D /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */;
428428
productName = KMPObservableViewModelSwiftUI;
429429
};
430430
/* End XCSwiftPackageProductDependency section */

iosApp/iosApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iosApp/iosApp/KMMViewModel.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import ComposeApp
22
import KMPObservableViewModelCore
33

4-
extension Kmp_observableviewmodel_coreViewModel: ViewModel { }
4+
extension Kmp_observableviewmodel_coreViewModel: @retroactive ViewModel { }
5+
6+
extension Kmp_observableviewmodel_coreViewModel: @retroactive Observable { }

0 commit comments

Comments
 (0)