Repository navigation
feat: add Apple Intelligence as a local model provider (text only) - #2157
Open
Douglasymlai wants to merge 3 commits into
Open
Douglasymlai wants to merge 3 commits into
Douglasymlai wants to merge 3 commits into
Conversation
1 of 8 tasks
First working version of docs/apple-intelligence-models-plan.md. - native/apple-bridge: Swift helper that serves the on-device model over an OpenAI-compatible API on 127.0.0.1 with a per-start token, Origin and Host checks, error mapping, streaming and an idle stop. Tools are rejected with tools_unsupported for now. - Backend: supervisor that starts the bridge on demand, a status and a test route, the apple-intelligence alias, and the live bridge URL and token filled in when a model is built, with no fallback. - Desktop: passes the bridge path on Apple silicon Macs only, and opens the Apple Intelligence pane of System Settings. - Settings: an Apple Intelligence entry in Add provider, offered only in the macOS desktop app, with status, Test and Add model. - CI: builds and tests the bridge on a macOS runner. - Plan: corrected the Settings section against current code and added the implementation status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Douglasymlai
marked this pull request as ready for review
November 19, 2026 00:23
Comment on lines
+50
to
+55
| return { | ||
| "ok": False, | ||
| "elapsed_ms": None, | ||
| "code": exc.reason, | ||
| "message": str(exc), | ||
| } |
This branch has not been deployed
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.
Pull Request
Related Issue
N/A — maintainer-directed work; no linked issue required for this PR.
Description
First working version of the plan in
docs/apple-intelligence-models-plan.md: Apple Intelligence as a local model provider on Apple silicon Macs, using the on-device model with no endpoint, key or download. Text only for now.What it does
native/apple-bridge/). A small helper that the backend starts on demand. It serves the on-device model through Apple's Foundation Models framework as an OpenAI-compatible API (/v1/health,/v1/models,/v1/chat/completions, streaming or not) on127.0.0.1only. Every request needs the token the backend passes on stdin; requests with anOriginheader or anotherHostare rejected. It exits when the backend goes away or after 10 idle minutes. Requests with tools get400 tools_unsupported. Foundation Models is weak-linked, so on older macOS the bridge still starts and reportsunsupported_os.backend/app/apple_bridge/). A supervisor that starts the bridge, reads its port, restarts it after a crash with backoff, and gives up after three crashes in five minutes until Try again.GET /model/apple-intelligence/statusandPOST /model/apple-intelligence/testserve Settings. The provider idapple-intelligencealiases to the OpenAI-compatible client, and the live bridge URL and token are filled in when a model is built, so no port is ever stored. If the bridge can't run, the Run fails with the reason. There is no fallback to another model.EIGENT_APPLE_BRIDGEon Apple silicon Macs only, and has a fixed IPC call that opens the Apple Intelligence pane of System Settings.apple-on-devicewith an empty endpoint. Copy is in all 11 locales.Apple Bridgeworkflow builds and tests the Swift package on a macOS runner and checks that Foundation Models is weak-linked.Platform gating
not_macoswithout starting anythingnot_apple_silicon, nothing startedbridge_missingunsupported_osA failed status call is shown as "helper isn't responding" and never breaks Settings or model selection. Startup is unchanged: nothing about Apple Intelligence runs until the provider is opened or an Apple model is used.
Changes to the plan
ConfigModelCard) and a "local providers group". Neither exists in Settings → Models any more: providers are added from the Add provider dialog. The section now follows the Codex entry, which also has no fields.custom, notlocal, for now: four places in the renderer classify providers fromLOCAL_MODEL_OPTIONS, and default-model selection needs them to agree.Transcript. ATranscriptis only needed to replay tool calls, so it comes with tool calling.Not done yet
Transcript(plan PR 3). Until then only Sessions that need no tools work. A simple question gets an answer; a Task that needs tools fails withtools_unsupported./health?detail=true.npm run build:apple-bridge.apple-on-devicein model lists, without a friendlier name.Testing
On Windows:
backend/tests/app/apple_bridge/. They cover platform gating, a fake bridge process that follows the real start-up protocol (handshake, token, idle exit, crash limit, backoff, start timeout, stop), status for each unavailable reason, the test route, URL and token substitution throughagent_model, no fallback, and an OpenAI SDK round trip. Ruff, ruff format and Bandit pass. The neighbouringtest_agent_model.py,tests/app/modelandtest_local_control.pysuites pass (445 tests).AppleIntelligenceProvider.test.tsx,appleIntelligence.test.ts,appleBridge.test.ts) cover gating on each platform, each status, Add model, Test, Open System Settings, Try again and an unreadable status.ModelsNavigation,SettingsPage,configuredModelsandbundledGitPackagingtests pass.npm run type-check, ESLint,check:design-tokens, the Electron access guard and i18n locale parity pass.Apple Bridgeworkflow on a macOS runner. Nothing ran on a Mac with Apple Intelligence.macOS checks for a tester
Build the bridge with
npm run build:apple-bridge, thennpm run dev.eigent-apple-bridgeprocess is left (pgrep eigent-apple-bridge). Leave it idle for 10 minutes: the bridge exits, and the next request starts it again.fetch('http://127.0.0.1:<port>/v1/models')is rejected (port fromlsof -iTCP -sTCP:LISTEN | grep eigent-ap).Testing Evidence (REQUIRED)
Not yet available: the UI only appears in the macOS desktop app, and this was built on Windows. Screenshots and human testing need a Mac; see the checks above.
What is the purpose of this pull request?
Contribution Guidelines Acknowledgement
🤖 Generated with Claude Code