Skip to content

Commit 191b768

Browse files
authored
#107 Monitor STDERR and refactor StdioClientTransport to use flows (#442)
1 parent 4645ebf commit 191b768

File tree

15 files changed

+660
-87
lines changed

15 files changed

+660
-87
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ concurrency:
1212
# Cancel only when the run is NOT on `main` branch
1313
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1414

15+
permissions:
16+
checks: write
17+
pull-requests: write # only required if `comment: true` was enabled
18+
1519
jobs:
1620
validate-pr:
1721
runs-on: macos-latest-xlarge
@@ -70,12 +74,16 @@ jobs:
7074
uses: mikepenz/action-junit-report@v6
7175
if: ${{ !cancelled() }} # always run even if the previous step fails
7276
with:
73-
report_paths: '**/test-results/**/TEST-*.xml'
77+
annotate_only: true
78+
comment: true
7479
detailed_summary: true
7580
flaky_summary: true
81+
group_suite: true
7682
include_empty_in_summary: false
7783
include_time_in_summary: true
78-
annotate_only: true
84+
report_paths: '**/test-results/**/TEST-*.xml'
85+
truncate_stack_traces: false
86+
updateComment: true
7987

8088
- name: Disable Auto-Merge on Fail
8189
if: failure() && github.event_name == 'pull_request'

gradle/libs.versions.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ binaryCompatibilityValidatorPlugin = "0.18.1"
1111
openapi-generator = "7.17.0"
1212

1313
# libraries version
14-
serialization = "1.9.0"
14+
awaitility = "4.3.0"
1515
collections-immutable = "0.4.0"
1616
coroutines = "1.10.2"
17+
kotest = "6.0.7"
1718
kotlinx-io = "0.8.2"
1819
ktor = "3.2.3"
1920
logging = "7.0.13"
20-
slf4j = "2.0.17"
21-
kotest = "6.0.7"
22-
awaitility = "4.3.0"
21+
mockk = "1.14.6"
2322
mokksy = "0.6.2"
23+
serialization = "1.9.0"
24+
slf4j = "2.0.17"
2425

2526
[libraries]
2627
# Plugins
@@ -53,6 +54,7 @@ kotest-assertions-json = { group = "io.kotest", name = "kotest-assertions-json",
5354
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }
5455
ktor-client-mock = { group = "io.ktor", name = "ktor-client-mock", version.ref = "ktor" }
5556
ktor-server-test-host = { group = "io.ktor", name = "ktor-server-test-host", version.ref = "ktor" }
57+
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
5658
mokksy = { group = "dev.mokksy", name = "mokksy", version.ref = "mokksy" }
5759
netty-bom = { group = "io.netty", name = "netty-bom", version.ref = "netty" }
5860
slf4j-simple = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j" }

kotlin-sdk-client/api/kotlin-sdk-client.api

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,28 @@ public final class io/modelcontextprotocol/kotlin/sdk/client/SseClientTransport
7171
}
7272

7373
public final class io/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport : io/modelcontextprotocol/kotlin/sdk/shared/AbstractTransport {
74+
public static final field BUFFER_SIZE J
7475
public fun <init> (Lkotlinx/io/Source;Lkotlinx/io/Sink;)V
76+
public fun <init> (Lkotlinx/io/Source;Lkotlinx/io/Sink;Lkotlinx/io/Source;)V
77+
public fun <init> (Lkotlinx/io/Source;Lkotlinx/io/Sink;Lkotlinx/io/Source;Lkotlinx/coroutines/channels/Channel;)V
78+
public fun <init> (Lkotlinx/io/Source;Lkotlinx/io/Sink;Lkotlinx/io/Source;Lkotlinx/coroutines/channels/Channel;Lkotlin/jvm/functions/Function1;)V
79+
public synthetic fun <init> (Lkotlinx/io/Source;Lkotlinx/io/Sink;Lkotlinx/io/Source;Lkotlinx/coroutines/channels/Channel;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
7580
public fun close (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
7681
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
7782
public fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
7883
}
7984

85+
public final class io/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport$StderrSeverity : java/lang/Enum {
86+
public static final field DEBUG Lio/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport$StderrSeverity;
87+
public static final field FATAL Lio/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport$StderrSeverity;
88+
public static final field IGNORE Lio/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport$StderrSeverity;
89+
public static final field INFO Lio/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport$StderrSeverity;
90+
public static final field WARNING Lio/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport$StderrSeverity;
91+
public static fun getEntries ()Lkotlin/enums/EnumEntries;
92+
public static fun valueOf (Ljava/lang/String;)Lio/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport$StderrSeverity;
93+
public static fun values ()[Lio/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport$StderrSeverity;
94+
}
95+
8096
public final class io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTransport : io/modelcontextprotocol/kotlin/sdk/shared/AbstractTransport {
8197
public synthetic fun <init> (Lio/ktor/client/HttpClient;Ljava/lang/String;Lkotlin/time/Duration;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
8298
public synthetic fun <init> (Lio/ktor/client/HttpClient;Ljava/lang/String;Lkotlin/time/Duration;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V

kotlin-sdk-client/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,20 @@ kotlin {
4141
commonTest {
4242
dependencies {
4343
implementation(kotlin("test"))
44-
implementation(libs.ktor.client.mock)
45-
implementation(libs.ktor.server.websockets)
44+
implementation(libs.kotest.assertions.core)
4645
implementation(libs.kotlinx.coroutines.test)
4746
implementation(libs.ktor.client.logging)
47+
implementation(libs.ktor.client.mock)
48+
implementation(libs.ktor.server.websockets)
4849
}
4950
}
5051

5152
jvmTest {
5253
dependencies {
53-
implementation(libs.mokksy)
5454
implementation(libs.awaitility)
5555
implementation(libs.ktor.client.apache5)
56+
implementation(libs.mockk)
57+
implementation(libs.mokksy)
5658
implementation(dependencies.platform(libs.netty.bom))
5759
runtimeOnly(libs.slf4j.simple)
5860
}

0 commit comments

Comments
 (0)