RegisterInMemoryAIBridgedHTTPHandler mounts [aibridged.Server]'s HTTP router onto [API]'s router, so that requests to aibridged will be relayed from Coder's API server to the in-memory aibridged. This also registers an in-process [agplaibridge.TransportFactory] so that chatd can route coder-agent L
(srv http.Handler)
| 38 | // the entitlement check stays on the HTTP route for external callers, while |
| 39 | // in-process coder-agent traffic is the explicit carve-out. |
| 40 | func (api *API) RegisterInMemoryAIBridgedHTTPHandler(srv http.Handler) { |
| 41 | if srv == nil { |
| 42 | panic("aibridged cannot be nil") |
| 43 | } |
| 44 | |
| 45 | api.aibridgedHandler = http.StripPrefix("/api/v2/aibridge", srv) |
| 46 | |
| 47 | factory := aibridged.NewTransportFactory(api.aibridgedHandler) |
| 48 | var asInterface agplaibridge.TransportFactory = factory |
| 49 | api.AIBridgeTransportFactory.Store(&asInterface) |
| 50 | } |
| 51 | |
| 52 | // CreateInMemoryAIBridgeServer creates a [aibridged.DRPCServer] and returns a |
| 53 | // [aibridged.DRPCClient] to it, connected over an in-memory transport. |