Repository navigation
Drop LLM and Panicking; state the device scope - #3
Merged
Merged
Conversation
Swift builds apps here, never services, so the scope correction other primitives ports need barely applies to this one. Auditing every module against "would a handset ever construct this" left only two that fail: - LLM — Anthropic and OpenAI URLSession clients, which require a vendor API key to sit on the device. Calls like these belong behind a platform-go service. - Panicking — a Go-ism. Swift's failure model is not panic/recover, and the module wrapped fatalError/assertionFailure to mirror a seam Go needs and Swift does not. Everything else stays, and deliberately: Database is SQLite on device (no server driver in it), Search is a SQLiteTextSearcher plus an in-memory vector index over that, Uploads is URLSession presigned upload and thumbnailing, Capitalism is StoreKit/RevenueCat, Notifications is device tokens and UNUserNotificationCenter, Secrets is Keychain, Authentication is JWT *parsing* and TOTP generation, HealthCheck is reachability and disk space. None of those are the server-tier packages of the same name elsewhere. Neither removed module was imported by any other module — only by its own tests. Verified: swift build clean, swift test 1152 tests in 251 suites passing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 20, 2026
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.
Why this PR is small
I went in expecting to cut a server tier out of this port the way the TypeScript one needed (primitives-ts#71 drops 13 packages). Auditing the modules one at a time, almost nothing qualified — Swift builds apps here and never services, so this port was already written for the device.
The audit is the valuable part of this PR; the diff is the small consequence.
What goes
LLMAnthropicProvider+OpenAIProviderover URLSession — both need a vendor API key on the handset. Calls like these belong behind aplatform-goservice.PanickingfatalError/assertionFailureto mirror a seam Go needs and Swift doesn't.Neither was imported by any other module — only by its own tests — so the cut is clean.
What stays, and why it looks server-shaped but isn't
These share names with packages being deleted from
primitives-ts, which is exactly why they're worth calling out. Same name, different thing:DatabaseSQLiteDatabase— on-device SQLite. No server driver in it. The target evenlinkedLibrary("sqlite3").SearchSQLiteTextSearcher+InMemoryVectorIndexover that local storeUploadsURLSessionPresignedUploader,FileManagerUploader,ImageThumbnailer— the client half of presign → PUT → confirmCapitalismStoreKitClient,StoreKitPurchaseManager,RevenueCatConfig— on-device IAP, not a secret-key payment managerNotificationsDeviceTokenBroadcaster,SystemNotificationCenterManager— receiving, where TS's providers wereapns.node/fcm.nodesendingSecretsKeychainSecretSourceAuthenticationHealthCheckReachabilityChecker,DiskSpaceChecker— device health, not DB/cache/queue readiness probesLeft for a follow-up
Embeddingsships both anOnDeviceEmbedder(fine, and it's whatSearch's vector index feeds on) and anOpenAIEmbedder(same API-key-on-device problem asLLM). Trimming one provider out of a kept module changes its public surface, so it wants its own PR.Verification
swift buildclean ·swift test— 1152 tests in 251 suites passing.🤖 Generated with Claude Code