Repository navigation
feat(coach): Apple's on-device model as a keyless, offline provider - #2935
Open
obinfalah1 wants to merge 2 commits into
Open
obinfalah1 wants to merge 2 commits into
obinfalah1 wants to merge 2 commits into
Conversation
Adds a switch that routes the coach (chat, the brief, the morning brief and the history summary) to Apple's Foundation Models on iOS 26 / macOS 26. No key, no network: the prompt and the answer stay on the device. The model's window is about 4k tokens, so the instructions and prompt are capped and a plain TODAY / week-over-week header goes first. While it is on, the bring-your-own-model fields are hidden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- TODAY in the model's header is the row for the Today screen's logical day, not the newest stored row; the two weeks are calendar windows. - respond has a 60 s timeout that releases the coach even if generation ignores cancellation. - The switch cannot be turned on while the model is unavailable, and the status refreshes when the app becomes active. - The four status messages are localized in all locales. - AICoachAppleHeaderTests pins the header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Follow-up hardening on the on-device route:
Added |
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.
What this PR does
A switch that runs the coach on Apple's on-device model (Foundation Models, iOS 26 / macOS 26+): no API key, no network. The prompt and the answer stay on the device, which matches NOOP's offline-first approach.
Strand/AI/AppleOnDeviceAI.swift(new): availability status (not enabled, still downloading, device not eligible, older OS) andrespond(messages:)throughLanguageModelSession. It sits behind#if canImport(FoundationModels)and#available, so older SDKs and OS versions still build and run.AICoachEngine: anappleOnDevicesetting. When it's on,callProviderand the streaming path answer from Apple's model, a key isn't required, anddisconnect()turns it off.AppleOnDeviceToggleRow(new), on the Coach setup card and in Coach settings, usingStrandDesigntokens only. While it's on, the bring-your-own-model bar is hidden.Strand/Resources/Localizable.xcstrings(de, es, fr, it, pl, pt-PT, ru, zh-Hans, zh-Hant).Tradeoff: Apple's model is small. It gives short plain-text answers from the data summary. The user's own provider is still the better choice for deep questions, and switching it off returns to that.
Type of change
How it was tested
python3 Tools/i18n_audit.py --cipasses, and so doesTools/doc_comment_lint.py.Checklist
android/(not touched)StrandDesigntokens (no hardcoded colors or fonts; spacing literals match the neighbouring Coach settings rows)docs/CONTRIBUTING.mdStrand.xcodeproj/) or any secrets/keystoresRelated issues
None.
🤖 Generated with Claude Code