The github-copilot-enhanced script hardcodes https://api.individual.githubcopilot.com, so background sync (Ne/Pe) fails on GitHub Enterprise, where the host differs (e.g. copilot-api..ghe.com). The fetch-interception hooks already work since they match on path, but the script's own API calls don't.
Could the API origin be auto-detected (e.g. captured from intercepted /github/chat/threads requests) with an optional override? I'm happy to contribute — is the source available somewhere to PR against? The repo appears to contain only the built .user.js.
Copilot suggests something like this:
// Replace the constant with a mutable value + a captured origin.
let copilotApiOrigin = `https://api.individual.githubcopilot.com`; // sensible default
// In the fetch interceptor, learn the real origin from actual Copilot traffic:
function maybeCaptureApiOrigin(url) {
try {
const u = new URL(url);
if (/\/github\/chat\/threads/.test(u.pathname)) {
copilotApiOrigin = u.origin; // e.g. https://copilot-api.<company>.ghe.com
}
} catch { /* ignore */ }
}
// Then Ne()/Pe() build URLs from copilotApiOrigin instead of the constant Me.
The github-copilot-enhanced script hardcodes https://api.individual.githubcopilot.com, so background sync (Ne/Pe) fails on GitHub Enterprise, where the host differs (e.g. copilot-api..ghe.com). The fetch-interception hooks already work since they match on path, but the script's own API calls don't.
Could the API origin be auto-detected (e.g. captured from intercepted /github/chat/threads requests) with an optional override? I'm happy to contribute — is the source available somewhere to PR against? The repo appears to contain only the built .user.js.
Copilot suggests something like this: