Class AhpHost

java.lang.Object
com.github.copilot.AhpHost
All Implemented Interfaces:
AutoCloseable

@CopilotExperimental public final class AhpHost extends Object implements AutoCloseable
A ready, connection-owned AHP listener. The handle remains bound to its original transport across client reconnects. Disposal never deletes application sessions.
  • Method Details

    • getHostId

      public String getHostId()
      Gets the listener identity.
      Returns:
      the listener identity
    • getUrl

      public String getUrl()
      Gets the bound address.
      Returns:
      the actual bound WebSocket URL, or null without a local server
    • getToken

      public String getToken()
      Gets the secret token.
      Returns:
      the token, or null without an authenticated local server
    • getPid

      public Long getPid()
      Gets the legacy process ID.
      Returns:
      the process ID, or null for in-process hosting
    • getEnvironmentId

      public String getEnvironmentId()
      Gets the GitHub Mission Control environment identity.
      Returns:
      the environment ID, or null without a GitHub environment
    • dispose

      public CompletableFuture<Void> dispose()
      Stops the listener and joins runtime cleanup. Every call reaches the runtime, including concurrent and repeated disposal calls.
      Returns:
      completion of listener cleanup
    • publishSession

      public CompletableFuture<HostPublishSessionResult> publishSession(String sessionId)
      Publishes an exact resident session attached to the owning client, without invoking a factory or transferring session ownership.
      Parameters:
      sessionId - resident session identity
      Returns:
      the published AHP session identity
    • close

      public void close()
      Disposes the listener and waits for acknowledged cleanup.
      Specified by:
      close in interface AutoCloseable