Repository navigation
feat: rebuild plugin on OS on-device models - #1
Merged
Merged
Conversation
Replace the MLX/llama.cpp feasibility probe with a plugin that uses only the operating system's built-in model: Apple Foundation Models on iOS and Gemini Nano through ML Kit GenAI on Android. Models are no longer downloaded or bundled by the plugin. - PHP API: availability, download, generate, chat, generation handles, cancel and snapshots, with typed errors and strict option validation - Native runtimes: process-scoped FIFO queue, one active generation, cooperative cancellation, in-memory snapshots, background pause - Events implement DispatchableFromNative for NativePHP 4.6 - pre_compile hook raises the Android host to Kotlin 2.3.21 and migrates kotlinOptions to compilerOptions, because ML Kit GenAI ships Kotlin 2.4 metadata that NativePHP's Kotlin 2.0 template cannot read - MIT licence Amp-Thread-ID: https://ampcode.com/threads/T-01a1866d-8add-73f3-a00b-1cc5a82f4ef7 Co-authored-by: Amp <amp@ampcode.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rebuilds the plugin from scratch on top of the operating system's built-in on-device models. iOS uses Apple Foundation Models and Android uses Gemini Nano through ML Kit GenAI. The plugin no longer downloads, bundles or runs its own models. It removes the MLX/llama.cpp feasibility probe, the model manifests, the download tools and the old design docs.
What's included
LocalAI::availability(),download(),generate(),chat()andgeneration($id). AGenerationhandle offersstatus(),text(),cancel(),result()andsnapshot(). Errors are typed, and the only options aretemperatureandmaxTokens; anything else is rejected.TextDeltaGenerated,GenerationCompleted,GenerationFailed,GenerationCancelledandModelDownloadProgress. All implementDispatchableFromNative, which NativePHP 4.6 requires before it delivers an event to PHP.pre_compilehook raises the host to Kotlin 2.3.21 and migrateskotlinOptionstocompilerOptions. It never lowers a newer version, and should do nothing once Build the Android template on current and future JDKs NativePHP/mobile-air#552 is released.Verification
vendor/bin/pest: 15 tests pass, including the hook's edits against NativePHP's real Gradle template.assembleDebugsucceeded. The APK contains the plugin and ML Kit classes, and the bridge functions are registered.Amp thread: https://ampcode.com/threads/T-01a1866d-8add-73f3-a00b-1cc5a82f4ef7