@github/copilot-sdk 1.0.3 → 1.0.5-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/cjs/client.js +133 -24
- package/dist/cjs/copilotRequestHandler.js +629 -0
- package/dist/cjs/generated/rpc.js +73 -7
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/session.js +81 -9
- package/dist/cjs/types.js +13 -1
- package/dist/client.d.ts +5 -33
- package/dist/client.js +134 -24
- package/dist/copilotRequestHandler.d.ts +82 -0
- package/dist/copilotRequestHandler.js +601 -0
- package/dist/generated/rpc.d.ts +1240 -576
- package/dist/generated/rpc.js +72 -7
- package/dist/generated/session-events.d.ts +707 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -0
- package/dist/session.d.ts +2 -0
- package/dist/session.js +81 -9
- package/dist/types.d.ts +135 -2
- package/dist/types.js +14 -1
- package/package.json +5 -3
package/dist/generated/rpc.js
CHANGED
|
@@ -36,7 +36,35 @@ function createServerRpc(connection) {
|
|
|
36
36
|
*
|
|
37
37
|
* @returns Quota usage snapshots for the resolved user, keyed by quota type.
|
|
38
38
|
*/
|
|
39
|
-
getQuota: async (params) => connection.sendRequest("account.getQuota", params)
|
|
39
|
+
getQuota: async (params) => connection.sendRequest("account.getQuota", params),
|
|
40
|
+
/**
|
|
41
|
+
* Gets the currently active authentication credentials from the global auth manager.
|
|
42
|
+
*
|
|
43
|
+
* @returns Current authentication state
|
|
44
|
+
*/
|
|
45
|
+
getCurrentAuth: async () => connection.sendRequest("account.getCurrentAuth", {}),
|
|
46
|
+
/**
|
|
47
|
+
* Gets all authenticated users available for account switching.
|
|
48
|
+
*
|
|
49
|
+
* @returns List of all authenticated users
|
|
50
|
+
*/
|
|
51
|
+
getAllUsers: async () => connection.sendRequest("account.getAllUsers", {}),
|
|
52
|
+
/**
|
|
53
|
+
* Stores authentication credentials after successful login (e.g., device code flow).
|
|
54
|
+
*
|
|
55
|
+
* @param params Credentials to store after successful authentication
|
|
56
|
+
*
|
|
57
|
+
* @returns Result of a successful login; throws on failure
|
|
58
|
+
*/
|
|
59
|
+
login: async (params) => connection.sendRequest("account.login", params),
|
|
60
|
+
/**
|
|
61
|
+
* Removes user authentication from keychain and persisted state.
|
|
62
|
+
*
|
|
63
|
+
* @param params User to log out
|
|
64
|
+
*
|
|
65
|
+
* @returns Logout result indicating if more users remain
|
|
66
|
+
*/
|
|
67
|
+
logout: async (params) => connection.sendRequest("account.logout", params)
|
|
40
68
|
},
|
|
41
69
|
secrets: {
|
|
42
70
|
/**
|
|
@@ -599,13 +627,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
599
627
|
*/
|
|
600
628
|
shutdown: async (params) => connection.sendRequest("session.shutdown", { sessionId, ...params }),
|
|
601
629
|
/** @experimental */
|
|
602
|
-
|
|
630
|
+
gitHubAuth: {
|
|
603
631
|
/**
|
|
604
632
|
* Gets authentication status and account metadata for the session.
|
|
605
633
|
*
|
|
606
634
|
* @returns Authentication status and account metadata for the session.
|
|
607
635
|
*/
|
|
608
|
-
getStatus: async () => connection.sendRequest("session.
|
|
636
|
+
getStatus: async () => connection.sendRequest("session.gitHubAuth.getStatus", { sessionId }),
|
|
609
637
|
/**
|
|
610
638
|
* Updates the session's auth credentials used for outbound model and API requests.
|
|
611
639
|
*
|
|
@@ -613,7 +641,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
613
641
|
*
|
|
614
642
|
* @returns Indicates whether the credential update succeeded.
|
|
615
643
|
*/
|
|
616
|
-
setCredentials: async (params) => connection.sendRequest("session.
|
|
644
|
+
setCredentials: async (params) => connection.sendRequest("session.gitHubAuth.setCredentials", { sessionId, ...params })
|
|
617
645
|
},
|
|
618
646
|
/** @experimental */
|
|
619
647
|
canvas: {
|
|
@@ -1076,13 +1104,24 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1076
1104
|
/**
|
|
1077
1105
|
* Starts OAuth authentication for a remote MCP server.
|
|
1078
1106
|
*
|
|
1079
|
-
* @param params Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name,
|
|
1107
|
+
* @param params Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection.
|
|
1080
1108
|
*
|
|
1081
1109
|
* @returns OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server.
|
|
1082
1110
|
*/
|
|
1083
1111
|
login: async (params) => connection.sendRequest("session.mcp.oauth.login", { sessionId, ...params })
|
|
1084
1112
|
},
|
|
1085
1113
|
/** @experimental */
|
|
1114
|
+
headers: {
|
|
1115
|
+
/**
|
|
1116
|
+
* Responds to a pending MCP dynamic headers refresh request. Hosts that subscribe to `mcp.headers_refresh_required` use this to provide short-lived per-server headers or to indicate that no dynamic headers are available for this refresh.
|
|
1117
|
+
*
|
|
1118
|
+
* @param params MCP headers refresh request id and the host response.
|
|
1119
|
+
*
|
|
1120
|
+
* @returns Indicates whether the pending MCP headers refresh response was accepted.
|
|
1121
|
+
*/
|
|
1122
|
+
handlePendingHeadersRefreshRequest: async (params) => connection.sendRequest("session.mcp.headers.handlePendingHeadersRefreshRequest", { sessionId, ...params })
|
|
1123
|
+
},
|
|
1124
|
+
/** @experimental */
|
|
1086
1125
|
apps: {
|
|
1087
1126
|
/**
|
|
1088
1127
|
* Fetch an MCP resource (typically a `ui://` MCP App bundle, per SEP-1865) from a connected server. Requires the `mcp-apps` session capability.
|
|
@@ -1154,7 +1193,15 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1154
1193
|
*
|
|
1155
1194
|
* @returns A snapshot of the provider endpoint the session is currently configured to talk to.
|
|
1156
1195
|
*/
|
|
1157
|
-
getEndpoint: async (params) => connection.sendRequest("session.provider.getEndpoint", { sessionId, ...params })
|
|
1196
|
+
getEndpoint: async (params) => connection.sendRequest("session.provider.getEndpoint", { sessionId, ...params }),
|
|
1197
|
+
/**
|
|
1198
|
+
* Adds BYOK providers and/or models to the session's registry at runtime, extending the additive registry built from the session's `providers`/`models` options. Both fields are optional, so a call may add providers only, models only, or both. Within a single call providers are registered before models, so a model may reference a provider added in the same call; across calls a model may reference any provider already registered (from session creation or a prior add). A model whose referenced provider is not registered by the end of the call is rejected. Newly added models become selectable via `model.list` / `model.switchTo` and are inherited by sub-agents spawned afterwards.
|
|
1199
|
+
*
|
|
1200
|
+
* @param params BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both.
|
|
1201
|
+
*
|
|
1202
|
+
* @returns The selectable model entries synthesized for the models added by this call.
|
|
1203
|
+
*/
|
|
1204
|
+
add: async (params) => connection.sendRequest("session.provider.add", { sessionId, ...params })
|
|
1158
1205
|
},
|
|
1159
1206
|
/** @experimental */
|
|
1160
1207
|
options: {
|
|
@@ -1253,7 +1300,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1253
1300
|
*
|
|
1254
1301
|
* @param params Slash command name and optional raw input string to invoke.
|
|
1255
1302
|
*
|
|
1256
|
-
* @returns Result of invoking the slash command (text output, prompt to send to the agent, or
|
|
1303
|
+
* @returns Result of invoking the slash command (text output, prompt to send to the agent, completion, or subcommand selection).
|
|
1257
1304
|
*/
|
|
1258
1305
|
invoke: async (params) => connection.sendRequest("session.commands.invoke", { sessionId, ...params }),
|
|
1259
1306
|
/**
|
|
@@ -1849,6 +1896,11 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
1849
1896
|
};
|
|
1850
1897
|
}
|
|
1851
1898
|
function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
1899
|
+
connection.onRequest("providerToken.getToken", async (params) => {
|
|
1900
|
+
const handler = getHandlers(params.sessionId).providerToken;
|
|
1901
|
+
if (!handler) throw new Error(`No providerToken handler registered for session: ${params.sessionId}`);
|
|
1902
|
+
return handler.getToken(params);
|
|
1903
|
+
});
|
|
1852
1904
|
connection.onRequest("sessionFs.readFile", async (params) => {
|
|
1853
1905
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
1854
1906
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
@@ -1925,10 +1977,23 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
1925
1977
|
return handler.invoke(params);
|
|
1926
1978
|
});
|
|
1927
1979
|
}
|
|
1980
|
+
function registerClientGlobalApiHandlers(connection, handlers) {
|
|
1981
|
+
connection.onRequest("llmInference.httpRequestStart", async (params) => {
|
|
1982
|
+
const handler = handlers.llmInference;
|
|
1983
|
+
if (!handler) throw new Error("No llmInference client-global handler registered");
|
|
1984
|
+
return handler.httpRequestStart(params);
|
|
1985
|
+
});
|
|
1986
|
+
connection.onRequest("llmInference.httpRequestChunk", async (params) => {
|
|
1987
|
+
const handler = handlers.llmInference;
|
|
1988
|
+
if (!handler) throw new Error("No llmInference client-global handler registered");
|
|
1989
|
+
return handler.httpRequestChunk(params);
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1928
1992
|
export {
|
|
1929
1993
|
createInternalServerRpc,
|
|
1930
1994
|
createInternalSessionRpc,
|
|
1931
1995
|
createServerRpc,
|
|
1932
1996
|
createSessionRpc,
|
|
1997
|
+
registerClientGlobalApiHandlers,
|
|
1933
1998
|
registerClientSessionApiHandlers
|
|
1934
1999
|
};
|