Class AiProviderRegistry

java.lang.Object
com.shaft.pilot.ai.AiProviderRegistry

public final class AiProviderRegistry extends Object
Resolves explicit current-thread providers before ServiceLoader providers, then falls back to the disabled provider.
  • Constructor Details

    • AiProviderRegistry

      public AiProviderRegistry()
  • Method Details

    • registerForCurrentThread

      public void registerForCurrentThread(AiProvider provider)
      Registers a provider for the current thread.

      This is intended for tests and controlled embedding. Call clearForCurrentThread() at the lifecycle boundary.

      Parameters:
      provider - provider override
    • clearForCurrentThread

      public void clearForCurrentThread()
      Clears the explicit provider for the current thread.
    • hasExplicitProviderForCurrentThread

      public boolean hasExplicitProviderForCurrentThread()
      Returns whether the current thread has an embedded provider override.
      Returns:
      true when a provider override is registered
    • resolve

      public AiProvider resolve(PilotConfiguration configuration)
      Resolves the configured provider using explicit, service, then disabled precedence.
      Parameters:
      configuration - effective configuration
      Returns:
      resolved provider
    • serviceProviders

      public List<AiProvider> serviceProviders()
      Returns deterministically ordered service providers.
      Returns:
      discovered providers