mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 16:02:56 +00:00
fix: use -i flag for GitHub Copilot CLI prompt injection (#799)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -82,7 +82,7 @@ export const GENERAL_AGENT_SEARCH_ENTRIES: SettingsSearchEntry[] = [
|
||||
{
|
||||
title: 'Default Agent',
|
||||
description: 'Pre-select an AI coding agent in the new-workspace composer.',
|
||||
keywords: ['agent', 'default', 'claude', 'codex', 'opencode', 'pi', 'gemini', 'aider']
|
||||
keywords: ['agent', 'default', 'claude', 'codex', 'opencode', 'pi', 'gemini', 'aider', 'copilot']
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -173,6 +173,13 @@ export const AGENT_CATALOG: AgentCatalogEntry[] = [
|
||||
cmd: 'hermes',
|
||||
faviconDomain: 'nousresearch.com',
|
||||
homepageUrl: 'https://hermes-agent.nousresearch.com/docs/'
|
||||
},
|
||||
{
|
||||
id: 'copilot',
|
||||
label: 'GitHub Copilot',
|
||||
cmd: 'copilot',
|
||||
faviconDomain: 'github.com',
|
||||
homepageUrl: 'https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli'
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('buildAgentStartupPlan', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('passes Copilot prompts with the --prompt flag', () => {
|
||||
it('passes Copilot prompts with the -i flag for an interactive session', () => {
|
||||
expect(
|
||||
buildAgentStartupPlan({
|
||||
agent: 'copilot',
|
||||
@@ -86,7 +86,7 @@ describe('buildAgentStartupPlan', () => {
|
||||
platform: 'darwin'
|
||||
})
|
||||
).toEqual({
|
||||
launchCommand: "copilot --prompt 'Fix the bug'",
|
||||
launchCommand: "copilot -i 'Fix the bug'",
|
||||
expectedProcess: 'copilot',
|
||||
followupPrompt: null
|
||||
})
|
||||
@@ -102,6 +102,21 @@ describe('buildAgentStartupPlan', () => {
|
||||
})
|
||||
).toBeNull()
|
||||
})
|
||||
|
||||
it('uses -i flag for copilot to start an interactive session with initial prompt', () => {
|
||||
expect(
|
||||
buildAgentStartupPlan({
|
||||
agent: 'copilot',
|
||||
prompt: 'Fix the bug',
|
||||
cmdOverrides: {},
|
||||
platform: 'darwin'
|
||||
})
|
||||
).toEqual({
|
||||
launchCommand: "copilot -i 'Fix the bug'",
|
||||
expectedProcess: 'copilot',
|
||||
followupPrompt: null
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('isShellProcess', () => {
|
||||
|
||||
@@ -55,6 +55,14 @@ export function buildAgentStartupPlan(args: {
|
||||
}
|
||||
}
|
||||
|
||||
if (config.promptInjectionMode === 'flag-interactive') {
|
||||
return {
|
||||
launchCommand: `${baseCommand} -i ${quotedPrompt}`,
|
||||
expectedProcess: config.expectedProcess,
|
||||
followupPrompt: null
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
launchCommand: baseCommand,
|
||||
expectedProcess: config.expectedProcess,
|
||||
|
||||
@@ -4,6 +4,7 @@ export type AgentPromptInjectionMode =
|
||||
| 'argv'
|
||||
| 'flag-prompt'
|
||||
| 'flag-prompt-interactive'
|
||||
| 'flag-interactive'
|
||||
| 'stdin-after-start'
|
||||
|
||||
export type TuiAgentConfig = {
|
||||
@@ -156,6 +157,10 @@ export const TUI_AGENT_CONFIG: Record<TuiAgent, TuiAgentConfig> = {
|
||||
detectCmd: 'copilot',
|
||||
launchCmd: 'copilot',
|
||||
expectedProcess: 'copilot',
|
||||
promptInjectionMode: 'flag-prompt'
|
||||
// Why: `copilot --prompt <text>` runs non-interactively and exits on
|
||||
// completion, which would kill the TUI session Orca is hosting.
|
||||
// `-i/--interactive <prompt>` starts an interactive session with the
|
||||
// initial prompt pre-executed — the behavior Orca needs.
|
||||
promptInjectionMode: 'flag-interactive'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user