Skip to content

feat: add AppRuntime for unified service composition#21953

Merged
kitlangton merged 1 commit intodevfrom
kit/app-layer
Apr 10, 2026
Merged

feat: add AppRuntime for unified service composition#21953
kitlangton merged 1 commit intodevfrom
kit/app-layer

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Adds src/effect/app-runtime.ts — a single ManagedRuntime that composes every service's defaultLayer into one flat list
  • Uses the existing shared memoMap so layer construction is fully deduplicated
  • Exports previously-private defaultLayer from SessionPrompt, Vcs, Worktree, Pty, McpAuth
  • Adds Bus.defaultLayer alias for pattern consistency

Why

Each service currently has its own makeRuntime + defaultLayer, creating ~40 independent ManagedRuntime instances. Facade methods hop through these per-service runtimes, which was necessary when the layer graph had cycles. Now that cycles are resolved, we can compose everything into one runtime.

This is the foundation for gradually:

  1. Migrating facade callers (server routes, CLI commands) to use AppRuntime directly
  2. Removing per-service makeRuntime calls as their facades become unused
  3. Replacing Effect.promise(() => Facade.method(...)) hops with direct yield* Service calls

Test plan

  • Typecheck clean
  • CI green
  • No behavioral change — AppRuntime is defined but not yet consumed

Composes every service defaultLayer into one flat list and creates a
shared ManagedRuntime. This is the foundation for migrating facade
callers to use AppRuntime directly instead of per-service makeRuntime.

Also exports previously-private defaultLayers from SessionPrompt, Vcs,
Worktree, Pty, and McpAuth, and adds Bus.defaultLayer alias for
consistency.
@kitlangton kitlangton marked this pull request as ready for review April 10, 2026 23:46
@kitlangton kitlangton merged commit cf27a73 into dev Apr 10, 2026
11 of 12 checks passed
@kitlangton kitlangton deleted the kit/app-layer branch April 10, 2026 23:46
mrsimpson pushed a commit to mrsimpson/opencode that referenced this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant