feat(cli-registry): GitHub Copilot CLI as a run mode

Copilot (`copilot`, npm @github/copilot) as a stock CLI entry with the same launch options as the other agent CLIs: model (--model), resume (--resume), continue (--continue) and allow-all (--yolo, clamped off for non-granted multi-user owners). Adds a resolver and GET /api/copilot/status probe, the agent-image package, Run-menu/mobile/logo entries, skill docs and tests.
This commit is contained in:
Devvyn committed 2026-10-18 00:47:46 +08:00
1 parent de99a6d57a
commit c5de8383e7
48 files changed
+867 -79

No files matched your search

+19 -3
View File
@@ -28,6 +28,7 @@ import {
type AntigravityConfig,
type PiConfig,
type GrokConfig,
type CopilotConfig,
type DeepSeekConfig,
type OmpConfig,
type RemoteHost,
@@ -611,7 +612,8 @@ export async function _clampExternalCliBypassForOwner(
antigravityConfig?: AntigravityConfig,
piConfig?: PiConfig,
grokConfig?: GrokConfig,
deepSeekConfig?: DeepSeekConfig
deepSeekConfig?: DeepSeekConfig,
copilotConfig?: CopilotConfig
): Promise<{
codexConfig: CodexConfig | undefined;
geminiConfig: GeminiConfig | undefined;
@@ -619,6 +621,7 @@ export async function _clampExternalCliBypassForOwner(
piConfig: PiConfig | undefined;
grokConfig: GrokConfig | undefined;
deepSeekConfig: DeepSeekConfig | undefined;
copilotConfig: CopilotConfig | undefined;
}> {
const out = await clampExternalCliBypassForOwner(owner, {
codexConfig,
@@ -627,6 +630,7 @@ export async function _clampExternalCliBypassForOwner(
piConfig,
grokConfig,
deepSeekConfig,
copilotConfig,
});
return out as {
codexConfig: CodexConfig | undefined;
@@ -635,6 +639,7 @@ export async function _clampExternalCliBypassForOwner(
piConfig: PiConfig | undefined;
grokConfig: GrokConfig | undefined;
deepSeekConfig: DeepSeekConfig | undefined;
copilotConfig: CopilotConfig | undefined;
};
}
@@ -1348,6 +1353,7 @@ export function registerSessionRoutes(
piConfig: gatedPiConfig,
grokConfig: gatedGrokConfig,
deepSeekConfig: gatedDeepSeekConfig,
copilotConfig: gatedCopilotConfig,
} = await _clampExternalCliBypassForOwner(
owner,
launchBody.codexConfig,
@@ -1355,7 +1361,8 @@ export function registerSessionRoutes(
launchBody.antigravityConfig,
launchBody.piConfig,
launchBody.grokConfig,
launchBody.deepSeekConfig
launchBody.deepSeekConfig,
launchBody.copilotConfig
);
const terminalHistoryConfig = await ctx.getTerminalHistoryConfig();
const session = new Session({
@@ -1374,6 +1381,7 @@ export function registerSessionRoutes(
antigravityConfig: mode === 'antigravity' ? gatedAntigravityConfig : undefined,
piConfig: mode === 'pi' ? gatedPiConfig : undefined,
grokConfig: mode === 'grok' ? gatedGrokConfig : undefined,
copilotConfig: mode === 'copilot' ? gatedCopilotConfig : undefined,
deepSeekConfig: mode === 'deepseek' ? gatedDeepSeekConfig : undefined,
ompConfig: resolveOmpConfigForCreate(mode, workingDir, launchBody.ompConfig),
resumeSessionId: validatedResumeId,
@@ -3725,6 +3733,7 @@ export function registerSessionRoutes(
antigravityConfig,
piConfig,
grokConfig,
copilotConfig,
deepSeekConfig,
ompConfig,
envOverrides,
@@ -3796,6 +3805,7 @@ export function registerSessionRoutes(
antigravityConfig ||
piConfig ||
grokConfig ||
copilotConfig ||
deepSeekConfig ||
ompConfig ||
openCodeConfig ||
@@ -3866,6 +3876,7 @@ export function registerSessionRoutes(
antigravityConfig ||
piConfig ||
grokConfig ||
copilotConfig ||
deepSeekConfig ||
ompConfig ||
openCodeConfig ||
@@ -3966,6 +3977,7 @@ export function registerSessionRoutes(
antigravityConfig,
piConfig,
grokConfig,
copilotConfig,
deepSeekConfig,
} as unknown as Record<string, unknown>)
);
@@ -4168,6 +4180,7 @@ export function registerSessionRoutes(
antigravityConfig,
piConfig,
grokConfig,
copilotConfig,
deepSeekConfig,
ompConfig,
};
@@ -4197,6 +4210,7 @@ export function registerSessionRoutes(
piConfig: qsGatedPiConfig,
grokConfig: qsGatedGrokConfig,
deepSeekConfig: qsGatedDeepSeekConfig,
copilotConfig: qsGatedCopilotConfig,
} = await _clampExternalCliBypassForOwner(
owner,
qsLaunchConfigs.codexConfig,
@@ -4204,7 +4218,8 @@ export function registerSessionRoutes(
qsLaunchConfigs.antigravityConfig,
qsLaunchConfigs.piConfig,
qsLaunchConfigs.grokConfig,
qsLaunchConfigs.deepSeekConfig
qsLaunchConfigs.deepSeekConfig,
qsLaunchConfigs.copilotConfig
);
const qsTerminalHistoryConfig = await ctx.getTerminalHistoryConfig();
const qsGatedEnvOverrides = await clampEnvOverridesForOwner(owner, envOverrides);
@@ -4371,6 +4386,7 @@ export function registerSessionRoutes(
antigravityConfig: mode === 'antigravity' ? qsGatedAntigravityConfig : undefined,
piConfig: mode === 'pi' ? qsGatedPiConfig : undefined,
grokConfig: mode === 'grok' ? qsGatedGrokConfig : undefined,
copilotConfig: mode === 'copilot' ? qsGatedCopilotConfig : undefined,
deepSeekConfig: mode === 'deepseek' ? qsGatedDeepSeekConfig : undefined,
ompConfig: qsResolvedOmpConfig,
envOverrides: qsCustomModelEnvOverrides,
+14
View File
@@ -762,6 +762,20 @@ export function registerSystemRoutes(
};
});
// ========== GitHub Copilot ==========
// Carries `version` like pi/grok/omp: `copilot` is a generic binary name, so the resolver
// only accepts one whose `--version` says "GitHub Copilot CLI".
app.get('/api/copilot/status', async () => {
const { isCopilotAvailable, resolveCopilotDir, getCopilotCliVersion } =
await import('../../utils/copilot-cli-resolver.js');
return {
available: isCopilotAvailable(),
path: resolveCopilotDir(),
version: getCopilotCliVersion(),
};
});
// ═══════════════════════════════════════════════════════════════
// State & Lifecycle (cleanup, lifecycle log, stats)
// ═══════════════════════════════════════════════════════════════