744
745
private _getCapiBase(): Promise<ICapiBase> {
747
>
this._capiBasePromise = this._buildCapiBase().catch(err => {
748
this._capiBasePromise = null;
749
throw err;
751
>
}
752
>
return this._capiBasePromise;
753
>
}
754
755
private async _buildCapiBase(): Promise<ICapiBase> {
757
>
getMachineId(err => this._logService.warn('[CopilotApiService] getMachineId failed', err)),
758
>
getDevDeviceId(err => this._logService.warn('[CopilotApiService] getDevDeviceId failed', err)),
759
>
]);
760
>
761
>
const extensionInfo: IExtensionInformation = {
762
>
name: 'agent-host',
763
>
sessionId: generateUuid(),
764
>
machineId,
765
>
deviceId,
766
>
vscodeVersion: this._productService.version,
767
>
version: this._productService.version,
768
>
buildType: this._productService.quality === 'stable' ? 'prod' : 'dev',
769
>
};
770
>
771
>
// Copilot endpoint discovery: GET `/copilot_internal/user` on the GitHub API
772
>
// host. For GitHub Enterprise the host is derived from `githubEnterpriseUri`
773
>
// (via the endpoint service); the response's `endpoints.api` then carries the
774
>
// enterprise CAPI base that CAPIClient routes through. Defaults to
775
>
// api.github.com when no enterprise URI is set. (GHE Cloud `*.ghe.com` is
776
>
// handled; GHE Server on-prem `/copilot_internal` routing is unverified.)
777
>
const userUrl = `${this._gitHubEndpointService.getApiBaseUri()}/copilot_internal/user`;
778
>
779
>
return { extensionInfo, userUrl };
780
>
}
781
782
// #endregion