-
-
Notifications
You must be signed in to change notification settings - Fork 24
ADFA-1843 | Refactor Local LLM agent and tool handling #911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
a71712c
fix(agent): Force simplified workflow for Local LLM to prevent max st…
jatezzz e8065f0
test(agent): Add tests for Local LLM simplified workflow
jatezzz 2dd20d4
fix(agent): Fix build errors and complete module extraction
jatezzz b906372
fix(agent): Make integration tests skip gracefully when Llama library…
jatezzz 4fd005a
feat(agent): Auto-install Llama library from test assets for integrat…
jatezzz 579b525
Fix(test): Improve local LLM test stability and library loading
jatezzz b363939
feat: Configure llama.cpp parameters and clip prompts
jatezzz ec9d71d
Refactor: Improve local LLM agent and tool handling
jatezzz 4087da8
feat: Add KV cache reuse and context-aware history
jatezzz 0bc94ec
feat: Add KV cache reuse and context-aware history
jatezzz 6972766
feat(agent): Add UI tests for agent and improve search
jatezzz e993177
fix: Address P0 issues — Zip Slip, batch memory leak, and stop strings
jatezzz 8fc77b8
fix: Address P1 issues — thread safety, race condition, and callback …
jatezzz 8c109df
refactor: Address P2 issues in LocalAgenticRunner and Executor
jatezzz b6a721e
fix: Resolve EmptyStateFragment build errors in common-ui module
jatezzz 796eafe
fix: Resolve remaining build errors for assembleV8Debug
jatezzz 5940eb9
fix: Whitelist StrictMode DiskReadViolation in OnboardingActivity
jatezzz cf9e5fa
local llm
jatezzz 5e4586b
feat(agent): Add list_files tool and improve tool parsing
jatezzz 994d32d
feat: Implement adaptive orientation
jatezzz d02e833
feat(agent): Improve tool calling and add Qwen support
jatezzz 79afa4e
feat: Add H2O model family support
jatezzz 4d65698
feat: add local hardware benchmark runner
jatezzz 176b91e
Revert "feat: add local hardware benchmark runner"
jatezzz c60a9f2
Refactor: Improve AI agent and core IDE components
jatezzz b75d18c
Refactor: Improve AI agent and core IDE components
jatezzz 7afc552
feat: Add `destroy` method to `GeminiRepository`
jatezzz 9dfe588
fix: harden agent tools, logging, and sampling
jatezzz 7ce3aa5
fix: normalize tool args and kv cache updates
jatezzz a372a6e
refactor(agent): Improve UX, add strings, and enhance runner logic
jatezzz f404e05
Merge branch 'stage' into feat/local-llm-work
jatezzz 7214818
Fix various issues with chat and project management
jatezzz f5c79aa
Merge branch 'stage' into feat/local-llm-work
jatezzz 6a8d6a1
Merge branch 'stage' into feat/local-llm-work
jatezzz e0cd835
Refactor: Normalize H2O tool responses
jatezzz a6cd55e
Merge branch 'stage' into feat/local-llm-work
jatezzz 2c9e7c3
chore: refactor over maintainability issues.
jatezzz 545a934
Merge branch 'stage' into feat/local-llm-work
jatezzz 5f5702e
chore: refactor over maintainability issues.
jatezzz be2f904
Merge branch 'stage' into feat/local-llm-work
jatezzz db59169
Merge branch 'stage' into feat/local-llm-work
jatezzz 835baf5
Merge branch 'stage' into feat/local-llm-work
jatezzz 1ef2ca7
Merge branch 'stage' into feat/local-llm-work
jatezzz 3949698
refactor: Remove unused test
jatezzz 4ea8a19
Merge branch 'stage' into feat/local-llm-work
jatezzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| import com.itsaky.androidide.build.config.BuildConfig | ||
|
|
||
| plugins { | ||
| alias(libs.plugins.kotlin.android) | ||
| alias(libs.plugins.android.library) | ||
| id("kotlin-kapt") | ||
| kotlin("plugin.serialization") | ||
| } | ||
|
|
||
| android { | ||
| namespace = "${BuildConfig.PACKAGE_NAME}.agent" | ||
| buildFeatures { | ||
| viewBinding = true | ||
| } | ||
| defaultConfig { | ||
| testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
| } | ||
| testOptions { | ||
| unitTests.isIncludeAndroidResources = true | ||
| } | ||
| packaging { | ||
| resources { | ||
| excludes += listOf( | ||
| "META-INF/DEPENDENCIES", | ||
| "META-INF/LICENSE", | ||
| "META-INF/LICENSE.txt", | ||
| "META-INF/NOTICE", | ||
| "META-INF/NOTICE.txt" | ||
| ) | ||
| } | ||
| } | ||
| sourceSets { | ||
| getByName("androidTest") { | ||
| assets.srcDirs("src/androidTest/assets", "$buildDir/generated/androidTest/assets") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Task to extract processed Llama AAR (with classes.dex) from app's assets zip for integration tests | ||
| // The app module processes the AAR with D8 to convert classes.jar to classes.dex | ||
| val extractLlamaAarForTests by tasks.registering { | ||
| description = "Extracts processed Llama AAR files from app's assets zip for integration tests" | ||
|
|
||
| val v8AssetsZip = file("../app/build/outputs/assets/assets-arm64-v8a.zip") | ||
| val v7AssetsZip = file("../app/build/outputs/assets/assets-armeabi-v7a.zip") | ||
| val outputDir = file("$buildDir/generated/androidTest/assets/dynamic_libs") | ||
|
|
||
| inputs.files(v8AssetsZip, v7AssetsZip).optional() | ||
| outputs.dir(outputDir) | ||
|
|
||
| doLast { | ||
| outputDir.mkdirs() | ||
|
|
||
| fun extractLlamaAar(assetsZip: File, dest: File, label: String) { | ||
| if (!assetsZip.exists()) { | ||
| logger.warn( | ||
| "{} assets zip not found at {}. Run ':app:packageAssets{}' first.", | ||
| label, | ||
| assetsZip.absolutePath, | ||
| label | ||
| ) | ||
| return | ||
| } | ||
|
|
||
| var extracted = false | ||
| java.util.zip.ZipInputStream(assetsZip.inputStream().buffered()).use { zipIn -> | ||
| val buffer = ByteArray(8 * 1024) | ||
| var entry = zipIn.nextEntry | ||
| while (entry != null) { | ||
| if (!entry.isDirectory && entry.name == "dynamic_libs/llama.aar") { | ||
| dest.outputStream().buffered().use { out -> | ||
| while (true) { | ||
| val read = zipIn.read(buffer) | ||
| if (read <= 0) break | ||
| out.write(buffer, 0, read) | ||
| } | ||
| out.flush() | ||
| } | ||
| extracted = true | ||
| break | ||
| } | ||
| entry = zipIn.nextEntry | ||
| } | ||
| } | ||
|
|
||
| if (extracted) { | ||
| logger.lifecycle("Extracted processed Llama {} AAR to {}", label, dest.absolutePath) | ||
| } else { | ||
| logger.warn( | ||
| "Failed to locate dynamic_libs/llama.aar in {} assets zip at {}.", | ||
| label, | ||
| assetsZip.absolutePath | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| extractLlamaAar(v8AssetsZip, File(outputDir, "llama-v8.aar"), "v8") | ||
| extractLlamaAar(v7AssetsZip, File(outputDir, "llama-v7.aar"), "v7") | ||
| } | ||
| } | ||
|
|
||
| // Make sure the extract task runs before androidTest tasks | ||
| tasks.matching { it.name.contains("AndroidTest") && it.name.contains("Assets") }.configureEach { | ||
| dependsOn(extractLlamaAarForTests) | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation(projects.common) | ||
| implementation(projects.commonUi) | ||
| implementation(projects.subprojects.projects) | ||
| implementation(projects.idetooltips) | ||
| implementation(projects.resources) | ||
| implementation(projects.llamaApi) | ||
|
|
||
| implementation(libs.androidx.core.ktx) | ||
| implementation(libs.androidx.appcompat) | ||
| implementation(libs.androidx.recyclerview) | ||
| implementation(libs.androidx.constraintlayout) | ||
| implementation(libs.androidx.lifecycle.viewmodel.ktx) | ||
| implementation(libs.androidx.lifecycle.runtime.ktx) | ||
| implementation(libs.androidx.nav.fragment) | ||
| implementation(libs.androidx.nav.ui) | ||
|
|
||
| implementation(libs.google.material) | ||
| implementation(libs.common.kotlin.coroutines.android) | ||
| implementation(libs.koin.android) | ||
| implementation(libs.common.markwon.core) | ||
| implementation(libs.common.markwon.linkify) | ||
| implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") | ||
| implementation(libs.tooling.slf4j) | ||
| implementation("io.github.java-diff-utils:java-diff-utils:4.12") | ||
| implementation(libs.androidx.security.crypto) | ||
| implementation(libs.google.genai) | ||
| "v7Implementation"(files("../app/libs/v7/llama-v7-release.aar")) | ||
| "v8Implementation"(files("../app/libs/v8/llama-v8-release.aar")) | ||
|
|
||
| testImplementation(projects.testing.unit) | ||
| testImplementation("io.mockk:mockk:1.13.3") | ||
| testImplementation("org.mockito:mockito-core:5.11.0") | ||
| testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1") | ||
|
|
||
| androidTestImplementation("androidx.test.ext:junit:1.1.5") | ||
| androidTestImplementation("androidx.test:runner:1.5.2") | ||
| androidTestImplementation("androidx.test:rules:1.5.0") | ||
| androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1") | ||
|
|
||
| // Use slf4j-android for tests instead of Logback (Logback uses Java modules which Android doesn't support) | ||
| androidTestImplementation("org.slf4j:slf4j-android:1.7.36") | ||
| } | ||
|
|
||
| configurations.named("androidTestImplementation") { | ||
| exclude(group = "ch.qos.logback", module = "logback-classic") | ||
| exclude(group = "ch.qos.logback", module = "logback-core") | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.