feat(agents): land GitHub Copilot CLI provider#1124
Open
anxkhn wants to merge 1 commit into
Open
Conversation
Add a CopilotAgent adapter that mirrors the Gemini/OpenCode pattern and uses the verified copilot v1.0.65 surface: a single prompt via -p, clean final output with -s, autonomous runs with --allow-all-tools and --no-ask-user, and --model passthrough. reviewTask adds --output-format json and parses the JSONL stream (assistant.message content as the answer, per-message outputTokens as tokens_out; the final result line carries sessionId/exitCode). Register copilot in the agent index, KNOWN_AGENTS, host detection (COPILOT_CLI), model registry, install hints, and the fallback provider message. Replaces the wrong flags and guessed JSON schema attempted in manufosela#1085.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR solves
Lands GitHub Copilot CLI as a first-class provider, sitting next to claude, codex, gemini, aider, and opencode.
CopilotAgentmirrors the Gemini/OpenCode adapters and drives the verified copilot v1.0.65 non-interactive surface:copilot -p "<prompt>" -s --allow-all-tools --no-ask-user [--model]so it never blocks on a permission or ask-user prompt.reviewTaskadds--output-format jsonand parses the JSONL stream: the answer is the lastassistant.messagecontent,tokens_outsums per-messageoutputTokens, and the finalresultline carriessessionId/exitCode. Copilot exposes no prompt tokens, sotokens_in/cached_tokensstay 0 (unmeasured) instead of being faked.KNOWN_AGENTS, host detection (COPILOT_CLI), model registry, install hints, and the fallback-provider message.This supersedes #1085, which used wrong flags (
--allow-all,--silent) and a guessed OpenAIprompt_tokensschema that never matched copilot output. Pi is intentionally left out to keep this PR atomic.How to test it
npm installnpm run lint(0 errors),npm run lint:syntax,npx prettier --checkon changed files (clean)npx vitest run tests/agents tests/config tests/brain tests/commands tests/integration(all pass)reviewTaskreturnedok=true exit=0 output="smoke-ok" tokens_out=36, confirming the JSONLassistant.message/resultparsing.Tests added or modified
tests/agents/copilot-agent.test.js(new): surface flags,--model, exit codes, JSONL content + token parsing.tests/agents/agent-detect.test.js,tests/integration/agents-index-contract.test.js: extend coverage to copilot.Notes for the reviewer
Net source delta stays under the 200-LOC shrink budget (~194). README and docs are excluded by the gate.
Qué resuelve este PR
Incorpora la CLI de GitHub Copilot como proveedor de primera clase.
CopilotAgentreplica los adaptadores Gemini/OpenCode y usa la superficie verificada de copilot v1.0.65:-pcon-s --allow-all-tools --no-ask-user [--model], y enreviewTaskañade--output-format jsonpara parsear el JSONL (contenido deassistant.message,outputTokens, y la línearesultconsessionId/exitCode). Reemplaza los flags y el esquema JSON incorrectos de #1085. Pi se deja fuera para mantener el PR atómico.Cómo probarlo
npm install,npm run lint, tests de agentes/config/brain/commands/integration, y smoke real con la CLI.Tests añadidos o modificados
copilot-agent.test.jsnuevo, mas extensiones en agent-detect e index-contract.Notas para el revisor
Delta neto por debajo del presupuesto de 200 LOC.