-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
129 lines (111 loc) · 4.03 KB
/
index.ts
File metadata and controls
129 lines (111 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
/**
* Copilot Engine SDK
*
* A standalone SDK for engine authors building on the GitHub Copilot agent platform.
* Provides platform event reporting, git utilities, and an MCP server for tool execution.
*
* @example
* ```typescript
* import {
* PlatformClient,
* createAssistantMessageEvent,
* createToolExecutionEvent,
* createEngineMcpServer,
* } from "@github/copilot-engine-sdk";
*
* // Create a client to send events to the platform
* const client = new PlatformClient({
* apiUrl: process.env.GITHUB_PLATFORM_API_URL!,
* jobId: process.env.GITHUB_JOB_ID!,
* token: process.env.GITHUB_PLATFORM_API_TOKEN!,
* });
*
* // Send events using convenience methods
* await client.sendAssistantMessage({
* turn: 1,
* callId: "call-123",
* content: "I'll help you with that.",
* toolCalls: [{ id: "tc-1", name: "read_file", arguments: '{"path": "foo.txt"}' }],
* });
*
* // Or create an MCP server for use with any LLM SDK
* const mcpServer = createEngineMcpServer({
* workingDir: process.cwd(),
* branchName: "feature-branch",
* push: true,
* platform: client,
* });
* ```
*/
// =============================================================================
// Types
// =============================================================================
export type {
// Event types
Event,
MessageEvent,
ModelCallFailureEvent,
AssistantMessageEvent,
ToolMessageEvent,
ToolExecutionEvent,
TruncationEvent,
ResponseEvent,
// Supporting types
ToolCall,
ToolResult,
ChatCompletionMessage,
ModelCallParam,
} from "./types.js";
// =============================================================================
// Event Factories
// =============================================================================
export {
// Factory functions
createModelCallFailureEvent,
createAssistantMessageEvent,
createToolMessageEvent,
createToolExecutionEvent,
createTruncationEvent,
createResponseEvent,
} from "./events.js";
// Factory input types
export type {
CreateModelCallFailureOptions,
CreateAssistantMessageOptions,
CreateToolMessageOptions,
CreateToolExecutionOptions,
CreateTruncationOptions,
CreateResponseOptions,
} from "./events.js";
// =============================================================================
// Platform Client
// =============================================================================
export { PlatformClient, resolveSelectedModel, isModelSelectionEnabled } from "./client.js";
export type { PlatformClientConfig, ProgressPayload, ProgressRecord, ProgressResponse, SendResult, JobDetails, ProblemStatement, ResolveSelectedModelOptions } from "./client.js";
// =============================================================================
// MCP Server
// =============================================================================
export {
createEngineMcpServer,
startEngineMcpServer,
REPORT_PROGRESS_TOOL_NAME,
reportProgressToolDescription,
reportProgressInputSchema,
} from "./mcp-server.js";
export type {
EngineMcpServerConfig,
ReportProgressInput,
} from "./mcp-server.js";
// =============================================================================
// Git Utilities
// =============================================================================
export { cloneRepo, commitAndPush, finalizeChanges } from "./git.js";
export type { CloneRepoOptions, CommitAndPushResult } from "./git.js";
// =============================================================================
// MCP Proxy Discovery
// =============================================================================
export { discoverMCPServers, isMCPProxyAvailable } from "./mcp-proxy.js";
export type { MCPServerEntry, DiscoveredMCPServer } from "./mcp-proxy.js";