From 92406067619fbffad8655759a6a36ed800204eb5 Mon Sep 17 00:00:00 2001 From: nbschultz97 <126931519+nbschultz97@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:32:18 -0600 Subject: [PATCH] feat: scaffold multi-module LLM-enabled project --- .github/workflows/build.yml | 17 ++++++ CHANGELOG.md | 4 ++ CONTRIBUTING.md | 11 ++++ README.md | 28 +++++----- app/build.gradle | 41 -------------- app/build.gradle.kts | 56 +++++++++++++++++++ .../com/example/tacticalapp/MainActivity.kt | 20 ++++--- app/src/main/res/layout/activity_main.xml | 21 +++++++ build.gradle | 17 ------ build.gradle.kts | 6 ++ docs/README.md | 3 + llm/build.gradle.kts | 34 +++++++++++ llm/src/main/java/com/example/llm/EdgeLlm.kt | 48 ++++++++++++++++ llm/src/main/java/com/example/llm/Llm.kt | 9 +++ .../main/java/com/example/llm/LlmRouter.kt | 21 +++++++ llm/src/main/java/com/example/llm/LocalLlm.kt | 13 +++++ .../java/com/example/llm/LlmRouterTest.kt | 40 +++++++++++++ prompts/medevac_9line.md | 9 +++ prompts/system.txt | 1 + scripts/dev/run_edge_stub.sh | 18 ++++++ settings.gradle | 2 - settings.gradle.kts | 17 ++++++ tak-plugin/build.gradle.kts | 32 +++++++++++ tak-plugin/src/main/AndroidManifest.xml | 8 +++ .../com/example/takplugin/TakPluginService.kt | 12 ++++ 25 files changed, 406 insertions(+), 82 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts create mode 100644 app/src/main/res/layout/activity_main.xml delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 docs/README.md create mode 100644 llm/build.gradle.kts create mode 100644 llm/src/main/java/com/example/llm/EdgeLlm.kt create mode 100644 llm/src/main/java/com/example/llm/Llm.kt create mode 100644 llm/src/main/java/com/example/llm/LlmRouter.kt create mode 100644 llm/src/main/java/com/example/llm/LocalLlm.kt create mode 100644 llm/src/test/java/com/example/llm/LlmRouterTest.kt create mode 100644 prompts/medevac_9line.md create mode 100644 prompts/system.txt create mode 100755 scripts/dev/run_edge_stub.sh delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts create mode 100644 tak-plugin/build.gradle.kts create mode 100644 tak-plugin/src/main/AndroidManifest.xml create mode 100644 tak-plugin/src/main/java/com/example/takplugin/TakPluginService.kt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..439dabb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,17 @@ +name: Build + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + - name: Build + run: gradle test assembleDebug diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..37be459 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +# Changelog + +## [Unreleased] +- Initial multi-module setup with LLM interface and TAK plugin stub. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..86389b5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing + +## Prerequisites +- Android Studio Giraffe or newer +- JDK 17 +- Android SDK with API 34 + +## Building +``` +./gradlew assembleDebug +``` diff --git a/README.md b/README.md index 404235c..dff16bb 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ # Tactical App -This repository contains a minimal Android application skeleton intended for tactical scenarios. +Multi-module Android project for an offline-first tactical AI assistant. -## Features -- Placeholder `MainActivity` ready for integration with the **Android Team Awareness Kit (ATAK)** SDK. -- Kotlin-based implementation with Material3 theme. -- Structured to support future offline LLM integration (e.g., GPT-OSS models) for edge deployments. +## Modules +- `app`: main Android application with basic home screen. +- `llm`: common LLM interface, router, and stub implementations. +- `tak-plugin`: CivTAK plugin stub for future CoT integration. ## Building -The project uses Gradle. Ensure a compatible Gradle version is installed on your system and run: - -```bash -gradle assembleDebug +Ensure JDK 17 and Android SDK are installed, then run: +``` +./gradlew assembleDebug ``` -> **Note:** Building requires the Android SDK and network access to resolve dependencies. The Gradle wrapper is omitted to keep binary files out of version control. +## Development +A simple edge LLM stub server is available: +``` +./scripts/dev/run_edge_stub.sh +``` -## Future Work -- Integrate ATAK APIs for mission planning and situational awareness. -- Embed a local LLM runtime (e.g., `llama.cpp`) for disconnected operations. -- Add WiFi CSI processing and pose estimation modules as described in Vantage Scanner roadmap. +See `CONTRIBUTING.md` for details. diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 76a567f..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,41 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' -} - -android { - namespace 'com.example.tacticalapp' - compileSdk 34 - - defaultConfig { - applicationId 'com.example.tacticalapp' - minSdk 26 - targetSdk 34 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } -} - -dependencies { - implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.24' - implementation 'androidx.appcompat:appcompat:1.7.0' - implementation 'com.google.android.material:material:1.12.0' - // Placeholder for ATAK SDK integration - // implementation 'com.atakmap.android:atakapi:4.10.0' -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..9c4b80c --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,56 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("org.jetbrains.kotlin.kapt") + id("org.jetbrains.kotlin.plugin.serialization") +} + +android { + namespace = "com.example.tacticalapp" + compileSdk = 34 + + defaultConfig { + applicationId = "com.example.tacticalapp" + minSdk = 26 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + } + + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + buildFeatures { + viewBinding = true + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } +} + +dependencies { + implementation(project(":llm")) + implementation(project(":tak-plugin")) + + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.24") + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("com.google.android.material:material:1.12.0") + implementation("com.squareup.okhttp3:okhttp:4.12.0") + implementation("com.squareup.retrofit2:retrofit:2.11.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0") + implementation("androidx.room:room-runtime:2.6.1") + implementation("androidx.room:room-ktx:2.6.1") + kapt("androidx.room:room-compiler:2.6.1") + implementation("androidx.work:work-runtime-ktx:2.9.0") +} diff --git a/app/src/main/java/com/example/tacticalapp/MainActivity.kt b/app/src/main/java/com/example/tacticalapp/MainActivity.kt index 1d939eb..15c79e7 100644 --- a/app/src/main/java/com/example/tacticalapp/MainActivity.kt +++ b/app/src/main/java/com/example/tacticalapp/MainActivity.kt @@ -2,17 +2,21 @@ package com.example.tacticalapp import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import android.widget.TextView +import com.example.tacticalapp.databinding.ActivityMainBinding -/** - * Main entry point for TacticalApp. - * Future enhancements: integrate ATAK API and local LLM for offline analysis. - */ class MainActivity : AppCompatActivity() { + private lateinit var binding: ActivityMainBinding + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val tv = TextView(this) - tv.text = "Tactical App Placeholder" - setContentView(tv) + binding = ActivityMainBinding.inflate(layoutInflater) + setContentView(binding.root) + + binding.btnLocalChat.setOnClickListener { + // TODO: open local chat UI + } + binding.btnTakStatus.setOnClickListener { + // TODO: show TAK plugin status + } } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..57604eb --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,21 @@ + + + +