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)
      Durably advertises an exact attached session in the compute-scoped catalog, without invoking a factory or transferring session ownership.
      Parameters:
      sessionId - resident session identity
      Returns:
      the published AHP session identity
    • unpublishSession

      public CompletableFuture<HostUnpublishSessionResult> unpublishSession(String sessionId)
      Withdraws a live or dormant application publication and revokes AHP attachments. Preserves local history, worktrees and ongoing work. Rejects nonapplication publications without stopping the host.
      Parameters:
      sessionId - canonical application session identity
      Returns:
      whether a publication was removed; false when already absent
    • listSessions

      public CompletableFuture<HostListSessionsResult> listSessions()
      Lists all live and dormant catalog sessions advertised by this host.
      Returns:
      the advertised host sessions
    • close

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