返回 html-video
copilot.ts
根目录 / packages / runtime / src / defs / copilot.ts
1 import type { AgentDef } from '../types.js';
2
3 /**
4 * GitHub Copilot CLI def (`copilot`, by GitHub).
5 *
6 * This is the standalone agentic `copilot` binary (npm `@github/copilot`,
7 * GA 2026-02), NOT the deprecated `gh copilot` gh-cli extension.
8 *
9 * Headless: `-p`/`--prompt` runs one prompt and exits; stdin is also accepted.
10 * We pipe the prompt via stdin and pass `-p` with no value to force prompt
11 * mode, plus `--allow-all-tools` so the agent doesn't stall waiting for a
12 * tool-approval prompt during a non-interactive run. Default stdout carries
13 * some session metadata; the studio extractor still finds the fenced
14 * ```html``` block, so plain mode is fine. (If metadata ever pollutes output
15 * we can add `-s`/silent — left off until confirmed against an installed bin.)
16 */
17 export const copilot: AgentDef = {
18 id: 'copilot',
19 name: 'GitHub Copilot CLI',
20 bin: 'copilot',
21 versionArgs: ['--version'],
22 buildArgs(_prompt, _ctx) {
23 // Prompt via stdin; --allow-all-tools avoids interactive approval stalls.
24 return ['--allow-all-tools'];
25 },
26 streamFormat: 'plain',
27 promptViaStdin: true,
28 installUrl: 'https://github.com/github/copilot-cli',
29 };
30
30 lines TYPESCRIPT