Skip to content

Commit 5bfb224

Browse files
committed
feat: Integrate GitHub Copilot as a first-class provider
- Added GitHub Copilot integration with canonical ID `copilot` using ACP stdio mode. - Implemented provider identity and contracts in the contracts module. - Created a new action plan for GitHub Copilot integration detailing phases for implementation. - Added tests for Copilot provider settings and model selection in server settings. - Established binary probing and provider registration for Copilot. - Developed ACP runtime generalization to support Copilot-specific authentication and environment restrictions. - Implemented Copilot-specific parsing and normalization for tool identity and permissions. - Updated web integration for provider model/config UI and provider selection.
1 parent c83bc5d commit 5bfb224

76 files changed

Lines changed: 6773 additions & 87 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/server/scripts/acp-mock-agent.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ const emitInterleavedAssistantToolCalls =
1717
process.env.T3_ACP_EMIT_INTERLEAVED_ASSISTANT_TOOL_CALLS === "1";
1818
const emitGenericToolPlaceholders = process.env.T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS === "1";
1919
const emitAskQuestion = process.env.T3_ACP_EMIT_ASK_QUESTION === "1";
20+
const emitElicitation = process.env.T3_ACP_EMIT_ELICITATION === "1";
2021
const failSetConfigOption = process.env.T3_ACP_FAIL_SET_CONFIG_OPTION === "1";
2122
const exitOnSetConfigOption = process.env.T3_ACP_EXIT_ON_SET_CONFIG_OPTION === "1";
2223
const promptResponseText = process.env.T3_ACP_PROMPT_RESPONSE_TEXT;
24+
const authMethods = (process.env.T3_ACP_AUTH_METHODS ?? "")
25+
.split(",")
26+
.map((method) => method.trim())
27+
.filter((method) => method.length > 0);
2328
const sessionId = "mock-session-1";
2429

2530
let currentModeId = "ask";
@@ -217,6 +222,14 @@ const program = Effect.gen(function* () {
217222
return {
218223
protocolVersion: 1,
219224
agentCapabilities: { loadSession: true },
225+
...(authMethods.length > 0
226+
? {
227+
authMethods: authMethods.map((id) => ({
228+
id,
229+
name: id,
230+
})),
231+
}
232+
: {}),
220233
};
221234
}),
222235
);
@@ -285,6 +298,20 @@ const program = Effect.gen(function* () {
285298
}),
286299
);
287300

301+
yield* agent.handleSetSessionMode((request) =>
302+
Effect.gen(function* () {
303+
currentModeId = request.modeId;
304+
yield* agent.client.sessionUpdate({
305+
sessionId: String(request.sessionId ?? sessionId),
306+
update: {
307+
sessionUpdate: "current_mode_update",
308+
currentModeId,
309+
},
310+
});
311+
return {};
312+
}),
313+
);
314+
288315
yield* agent.handleCancel(({ sessionId }) =>
289316
Effect.sync(() => {
290317
cancelledSessions.add(String(sessionId ?? "mock-session-1"));
@@ -484,6 +511,35 @@ const program = Effect.gen(function* () {
484511
return { stopReason: "end_turn" };
485512
}
486513

514+
if (emitElicitation) {
515+
yield* agent.client.elicit({
516+
sessionId: requestedSessionId,
517+
mode: "form",
518+
message: "Choose deployment options",
519+
requestedSchema: {
520+
type: "object",
521+
title: "Deployment",
522+
properties: {
523+
environment: {
524+
type: "string",
525+
title: "Environment",
526+
description: "Which environment should Copilot use?",
527+
enum: ["staging", "production"],
528+
},
529+
runChecks: {
530+
type: "boolean",
531+
title: "Run checks",
532+
description: "Run validation before deploy?",
533+
default: true,
534+
},
535+
},
536+
required: ["environment"],
537+
},
538+
});
539+
540+
return { stopReason: "end_turn" };
541+
}
542+
487543
yield* agent.client.sessionUpdate({
488544
sessionId: requestedSessionId,
489545
update: {

apps/server/src/git/Services/TextGeneration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { ChatAttachment, ModelSelection } from "@t3tools/contracts";
1313
import type { TextGenerationError } from "@t3tools/contracts";
1414

1515
/** Providers that support git text generation (commit messages, PR content, branch names). */
16-
export type TextGenerationProvider = "codex" | "claudeAgent" | "cursor" | "opencode";
16+
export type TextGenerationProvider = "codex" | "claudeAgent" | "cursor" | "copilot" | "opencode";
1717

1818
export interface CommitMessageGenerationInput {
1919
cwd: string;

apps/server/src/orchestration/Layers/ProviderCommandReactor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ const make = Effect.gen(function* () {
309309
...(preferredProvider ? { provider: preferredProvider } : {}),
310310
...(effectiveCwd ? { cwd: effectiveCwd } : {}),
311311
modelSelection: desiredModelSelection,
312+
...(thread.interactionMode !== undefined
313+
? { interactionMode: thread.interactionMode }
314+
: {}),
312315
...(input?.resumeCursor !== undefined ? { resumeCursor: input.resumeCursor } : {}),
313316
runtimeMode: desiredRuntimeMode,
314317
});

0 commit comments

Comments
 (0)