InjectableNativeLlm
Generic delegate-or-degrade injection seam, same shape as Doori's InjectableDocumentAiAnalyzer/ InjectableTextGenerator — kept in commonMain (not iosMain) so this logic is unit-testable; the iosMain holder (FoundationModelsBridge) has nothing left to test once it just forwards here.
Properties
Functions
Null means "declined" — unavailable, or a runtime failure — never throws. Matches OnDeviceLlm.generate's no-throw contract, and keeps a Swift implementation from having to propagate a native error across the interop boundary.
Streams prompt token-by-token through callback — real per-token output (Apple's LanguageModelSession.streamResponse), not a single-emission replay of generate. Returns a NativeLlmCancelHandle the Kotlin side calls when its collecting coroutine is cancelled, so Stop/screen-leave actually halts native generation instead of only stopping the Kotlin side from listening — the same contract MediaPipeOnDeviceLlm's Android backend already honors for its own callbackFlow.