Skip to content

Isolate HybridLLM state on MainActor#27

Merged
corasan merged 1 commit into
mainfrom
t3code/a1a39789
Apr 24, 2026
Merged

Isolate HybridLLM state on MainActor#27
corasan merged 1 commit into
mainfrom
t3code/a1a39789

Conversation

@corasan
Copy link
Copy Markdown
Owner

@corasan corasan commented Apr 24, 2026

Summary

  • Split HybridLLM into a thin Nitro-facing wrapper and a @MainActor-isolated HybridLLMCore that owns the mutable LLM state.
  • Bridge synchronous Nitro entry points through Task { @MainActor in ... } so getters, setters, stop, unload, stats/history access, and clearHistory use the same isolation boundary.
  • Keep public Nitro method signatures unchanged while moving load, generate, stream, and streamWithEvents onto async core methods driven by Promise.async.
  • Clean up Swift concurrency diagnostics by capturing generation parameters before container.perform closures and awaiting main-actor logging from tool execution tasks.

Testing

  • bun --cwd package typecheck
  • bun ios --device [device id]

- Extract logic into @mainactor HybridLLMCore
- Add MainActorSync helper to forward sync property/method calls
@corasan corasan changed the title PR content Isolate HybridLLM state on MainActor Apr 24, 2026
@corasan corasan merged commit abbc592 into main Apr 24, 2026
3 checks passed
@corasan corasan deleted the t3code/a1a39789 branch April 24, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant