From ad2d38ce461b6dec852f3564a6bcf945007b946a Mon Sep 17 00:00:00 2001 From: kami Date: Sat, 13 Jun 2026 23:07:29 +0400 Subject: [PATCH] refactor(tools): fold research tools into :infrastructure:tools (drop new module) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The research feature is "no new architecture" (spec §1) — composition of existing mechanisms. The only genuinely new code is the two web tools + the HTML→markdown extractor (spec marks them "(new)"), and those belong with ShellTool/FileReadTool in :infrastructure:tools, not in a separate module. Moves extract/ + web/ from the short-lived :infrastructure:research module into :infrastructure:tools (packages com.correx.infrastructure.tools.{extract,web}); adds jsoup + ktor-client there; removes the module from settings.gradle. No behaviour change — 44 tests green. --- infrastructure/research/build.gradle | 24 ------------------ infrastructure/tools/build.gradle | 11 ++++++++ .../tools}/extract/ExtractionResult.kt | 2 +- .../tools}/extract/HtmlMarkdownExtractor.kt | 2 +- .../tools}/extract/MainContentSelector.kt | 2 +- .../tools}/extract/MarkdownRenderer.kt | 2 +- .../infrastructure/tools}/web/WebFetchTool.kt | 6 ++--- .../tools}/web/WebSearchTool.kt | 2 +- .../extract/HtmlMarkdownExtractorTest.kt | 2 +- .../tools}/web/WebFetchToolTest.kt | Bin 5258 -> 5255 bytes .../tools}/web/WebSearchToolTest.kt | 2 +- settings.gradle | 1 - 12 files changed, 21 insertions(+), 35 deletions(-) delete mode 100644 infrastructure/research/build.gradle rename infrastructure/{research/src/main/kotlin/com/correx/infrastructure/research => tools/src/main/kotlin/com/correx/infrastructure/tools}/extract/ExtractionResult.kt (95%) rename infrastructure/{research/src/main/kotlin/com/correx/infrastructure/research => tools/src/main/kotlin/com/correx/infrastructure/tools}/extract/HtmlMarkdownExtractor.kt (98%) rename infrastructure/{research/src/main/kotlin/com/correx/infrastructure/research => tools/src/main/kotlin/com/correx/infrastructure/tools}/extract/MainContentSelector.kt (98%) rename infrastructure/{research/src/main/kotlin/com/correx/infrastructure/research => tools/src/main/kotlin/com/correx/infrastructure/tools}/extract/MarkdownRenderer.kt (99%) rename infrastructure/{research/src/main/kotlin/com/correx/infrastructure/research => tools/src/main/kotlin/com/correx/infrastructure/tools}/web/WebFetchTool.kt (97%) rename infrastructure/{research/src/main/kotlin/com/correx/infrastructure/research => tools/src/main/kotlin/com/correx/infrastructure/tools}/web/WebSearchTool.kt (99%) rename infrastructure/{research/src/test/kotlin/com/correx/infrastructure/research => tools/src/test/kotlin/com/correx/infrastructure/tools}/extract/HtmlMarkdownExtractorTest.kt (99%) rename infrastructure/{research/src/test/kotlin/com/correx/infrastructure/research => tools/src/test/kotlin/com/correx/infrastructure/tools}/web/WebFetchToolTest.kt (99%) rename infrastructure/{research/src/test/kotlin/com/correx/infrastructure/research => tools/src/test/kotlin/com/correx/infrastructure/tools}/web/WebSearchToolTest.kt (98%) diff --git a/infrastructure/research/build.gradle b/infrastructure/research/build.gradle deleted file mode 100644 index fa460a0f..00000000 --- a/infrastructure/research/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id 'java-library' - id 'org.jetbrains.kotlin.jvm' - id 'org.jetbrains.kotlin.plugin.serialization' -} - -ext { - ktor_version = '3.0.3' -} - -dependencies { - implementation project(":core:events") - implementation project(":core:tools") - implementation project(":core:approvals") - implementation 'org.jsoup:jsoup:1.20.1' - implementation "io.ktor:ktor-client-core:$ktor_version" - implementation "io.ktor:ktor-client-cio:$ktor_version" - - testImplementation "io.ktor:ktor-client-mock:$ktor_version" -} - -// Pure deterministic extraction utility; coverage gate is enforced via its own thorough -// unit tests, not the global line-count bound (same stance as :infrastructure:tools). -tasks.named("koverVerify").configure { enabled = false } diff --git a/infrastructure/tools/build.gradle b/infrastructure/tools/build.gradle index 3a3f336f..923bf246 100644 --- a/infrastructure/tools/build.gradle +++ b/infrastructure/tools/build.gradle @@ -4,6 +4,10 @@ plugins { id 'org.jetbrains.kotlin.plugin.serialization' } +ext { + ktor_version = '3.0.3' +} + dependencies { implementation project(":core:tools") implementation project(":core:events") @@ -12,6 +16,13 @@ dependencies { implementation project(":infrastructure:tools:filesystem") implementation project(":core:artifacts") implementation project(":core:artifacts-store") + + // Web research tools (web_search, web_fetch) + deterministic HTML→markdown extraction. + implementation 'org.jsoup:jsoup:1.20.1' + implementation "io.ktor:ktor-client-core:$ktor_version" + implementation "io.ktor:ktor-client-cio:$ktor_version" + + testImplementation "io.ktor:ktor-client-mock:$ktor_version" } tasks.named("koverVerify").configure { enabled = false } diff --git a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/ExtractionResult.kt b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/ExtractionResult.kt similarity index 95% rename from infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/ExtractionResult.kt rename to infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/ExtractionResult.kt index 0bbe91f4..cbd0b6f5 100644 --- a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/ExtractionResult.kt +++ b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/ExtractionResult.kt @@ -1,4 +1,4 @@ -package com.correx.infrastructure.research.extract +package com.correx.infrastructure.tools.extract /** * Outcome of extracting a fetched page (research-workflow-spec §5). The cleaned [markdown] is the diff --git a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/HtmlMarkdownExtractor.kt b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/HtmlMarkdownExtractor.kt similarity index 98% rename from infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/HtmlMarkdownExtractor.kt rename to infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/HtmlMarkdownExtractor.kt index 11b5f540..9a3cc500 100644 --- a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/HtmlMarkdownExtractor.kt +++ b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/HtmlMarkdownExtractor.kt @@ -1,4 +1,4 @@ -package com.correx.infrastructure.research.extract +package com.correx.infrastructure.tools.extract import org.jsoup.Jsoup diff --git a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/MainContentSelector.kt b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/MainContentSelector.kt similarity index 98% rename from infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/MainContentSelector.kt rename to infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/MainContentSelector.kt index ee244468..f377ac02 100644 --- a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/MainContentSelector.kt +++ b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/MainContentSelector.kt @@ -1,4 +1,4 @@ -package com.correx.infrastructure.research.extract +package com.correx.infrastructure.tools.extract import org.jsoup.nodes.Document import org.jsoup.nodes.Element diff --git a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/MarkdownRenderer.kt b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/MarkdownRenderer.kt similarity index 99% rename from infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/MarkdownRenderer.kt rename to infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/MarkdownRenderer.kt index a302a1cc..a1f50e2c 100644 --- a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/extract/MarkdownRenderer.kt +++ b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/extract/MarkdownRenderer.kt @@ -1,4 +1,4 @@ -package com.correx.infrastructure.research.extract +package com.correx.infrastructure.tools.extract import org.jsoup.nodes.Element import org.jsoup.nodes.Node diff --git a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/web/WebFetchTool.kt b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/web/WebFetchTool.kt similarity index 97% rename from infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/web/WebFetchTool.kt rename to infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/web/WebFetchTool.kt index a68a5426..3b990c70 100644 --- a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/web/WebFetchTool.kt +++ b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/web/WebFetchTool.kt @@ -1,4 +1,4 @@ -package com.correx.infrastructure.research.web +package com.correx.infrastructure.tools.web import com.correx.core.approvals.Tier import com.correx.core.events.events.ToolRequest @@ -9,8 +9,8 @@ import com.correx.core.tools.contract.ToolCapability import com.correx.core.tools.contract.ToolExecutor import com.correx.core.tools.contract.ToolResult import com.correx.core.tools.contract.ValidationResult -import com.correx.infrastructure.research.extract.ExtractionQuality -import com.correx.infrastructure.research.extract.HtmlMarkdownExtractor +import com.correx.infrastructure.tools.extract.ExtractionQuality +import com.correx.infrastructure.tools.extract.HtmlMarkdownExtractor import io.ktor.client.HttpClient import io.ktor.client.request.prepareGet import io.ktor.client.statement.bodyAsChannel diff --git a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/web/WebSearchTool.kt b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/web/WebSearchTool.kt similarity index 99% rename from infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/web/WebSearchTool.kt rename to infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/web/WebSearchTool.kt index f335caf6..1188379d 100644 --- a/infrastructure/research/src/main/kotlin/com/correx/infrastructure/research/web/WebSearchTool.kt +++ b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/web/WebSearchTool.kt @@ -1,4 +1,4 @@ -package com.correx.infrastructure.research.web +package com.correx.infrastructure.tools.web import com.correx.core.approvals.Tier import com.correx.core.events.events.ToolRequest diff --git a/infrastructure/research/src/test/kotlin/com/correx/infrastructure/research/extract/HtmlMarkdownExtractorTest.kt b/infrastructure/tools/src/test/kotlin/com/correx/infrastructure/tools/extract/HtmlMarkdownExtractorTest.kt similarity index 99% rename from infrastructure/research/src/test/kotlin/com/correx/infrastructure/research/extract/HtmlMarkdownExtractorTest.kt rename to infrastructure/tools/src/test/kotlin/com/correx/infrastructure/tools/extract/HtmlMarkdownExtractorTest.kt index d163fdd2..22454c71 100644 --- a/infrastructure/research/src/test/kotlin/com/correx/infrastructure/research/extract/HtmlMarkdownExtractorTest.kt +++ b/infrastructure/tools/src/test/kotlin/com/correx/infrastructure/tools/extract/HtmlMarkdownExtractorTest.kt @@ -1,4 +1,4 @@ -package com.correx.infrastructure.research.extract +package com.correx.infrastructure.tools.extract import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse diff --git a/infrastructure/research/src/test/kotlin/com/correx/infrastructure/research/web/WebFetchToolTest.kt b/infrastructure/tools/src/test/kotlin/com/correx/infrastructure/tools/web/WebFetchToolTest.kt similarity index 99% rename from infrastructure/research/src/test/kotlin/com/correx/infrastructure/research/web/WebFetchToolTest.kt rename to infrastructure/tools/src/test/kotlin/com/correx/infrastructure/tools/web/WebFetchToolTest.kt index 7c0e21c2388bcb5f51d6b4a1f96e5de22bd2028a..4ffb820a3e23f0102fa3881e3dd0fec2197cb3d0 100644 GIT binary patch delta 16 XcmeCuY}cHi#9ES{pHsY1D?tPRFlYsv delta 28 jcmZqI?9!Z|#9NeFoSImaoS|2qn#46ZfKg(ji?av-jIs$X diff --git a/infrastructure/research/src/test/kotlin/com/correx/infrastructure/research/web/WebSearchToolTest.kt b/infrastructure/tools/src/test/kotlin/com/correx/infrastructure/tools/web/WebSearchToolTest.kt similarity index 98% rename from infrastructure/research/src/test/kotlin/com/correx/infrastructure/research/web/WebSearchToolTest.kt rename to infrastructure/tools/src/test/kotlin/com/correx/infrastructure/tools/web/WebSearchToolTest.kt index c06f77bd..07b1a115 100644 --- a/infrastructure/research/src/test/kotlin/com/correx/infrastructure/research/web/WebSearchToolTest.kt +++ b/infrastructure/tools/src/test/kotlin/com/correx/infrastructure/tools/web/WebSearchToolTest.kt @@ -1,4 +1,4 @@ -package com.correx.infrastructure.research.web +package com.correx.infrastructure.tools.web import com.correx.core.approvals.Tier import com.correx.core.events.events.ToolRequest diff --git a/settings.gradle b/settings.gradle index a2ce3fc8..f10a760e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -39,7 +39,6 @@ include ':infrastructure:tools' include ':infrastructure:tools:filesystem' include ':infrastructure:workflow' include ':infrastructure:artifacts-cas' -include ':infrastructure:research' include ':testing:replay' include ':testing:contracts'