@github/copilot-sdk 1.0.28 → 1.0.29-preview.1
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 +58 -13
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +64 -6
- package/dist/cjs/entra.js +83 -0
- package/dist/cjs/generated/lifecycle-diagnostics.js +16 -0
- package/dist/cjs/generated/rpc.js +156 -9
- package/dist/cjs/installationConfirmation.js +1 -1
- package/dist/cjs/jsonrpcTypes.js +16 -0
- package/dist/cjs/session.js +39 -25
- package/dist/cjs/sessionFsProvider.js +28 -0
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.js +64 -6
- package/dist/entra.d.ts +3 -0
- package/dist/entra.js +59 -0
- package/dist/extension.d.ts +1 -1
- package/dist/generated/lifecycle-diagnostics.d.ts +220 -0
- package/dist/generated/lifecycle-diagnostics.js +0 -0
- package/dist/generated/rpc.d.ts +3698 -41
- package/dist/generated/rpc.js +156 -9
- package/dist/generated/session-events.d.ts +2329 -36
- package/dist/index.d.ts +3 -3
- package/dist/installationConfirmation.d.ts +1 -1
- package/dist/installationConfirmation.js +1 -4
- package/dist/jsonrpcTypes.d.ts +14 -0
- package/dist/jsonrpcTypes.js +0 -0
- package/dist/sdkProtocolVersion.d.ts +1 -1
- package/dist/session.js +39 -25
- package/dist/sessionFsProvider.d.ts +15 -0
- package/dist/sessionFsProvider.js +28 -0
- package/dist/types.d.ts +94 -23
- package/dist/workflow.d.ts +1 -1
- package/docs/agent-author.md +4 -4
- package/docs/extensions.md +4 -3
- package/docs/workflows.md +3 -1
- package/package.json +23 -23
|
@@ -268,7 +268,7 @@ function createServerRpc(connection) {
|
|
|
268
268
|
/**
|
|
269
269
|
* Lists Copilot models available to the authenticated user.
|
|
270
270
|
*
|
|
271
|
-
* @param params Optional opaque account selection
|
|
271
|
+
* @param params Optional opaque account selection, compatibility GitHub token, or streamer-mode masking used to list models.
|
|
272
272
|
*
|
|
273
273
|
* @returns List of Copilot models available to the resolved user, including capabilities and billing metadata.
|
|
274
274
|
*/
|
|
@@ -282,7 +282,7 @@ function createServerRpc(connection) {
|
|
|
282
282
|
/**
|
|
283
283
|
* Reports the unit of each model's published token prices: AI Credits or nano-AIU. Pair these units with models.list prices by model ID and use identical account-selection options for both calls. When options are omitted, the current account and its model providers are used.
|
|
284
284
|
*
|
|
285
|
-
* @param params Optional opaque account selection
|
|
285
|
+
* @param params Optional opaque account selection, compatibility GitHub token, or streamer-mode masking used to list models.
|
|
286
286
|
*
|
|
287
287
|
* @returns Price units for every catalog model that publishes token prices.
|
|
288
288
|
*/
|
|
@@ -949,6 +949,15 @@ function createServerRpc(connection) {
|
|
|
949
949
|
httpResponseChunk: async (params) => connection.sendRequest("llmInference.httpResponseChunk", params)
|
|
950
950
|
},
|
|
951
951
|
/** @experimental */
|
|
952
|
+
kerberosAuth: {
|
|
953
|
+
/**
|
|
954
|
+
* Registers the calling SDK client's Kerberos callback. The callback authenticates requests made for the client's sessions and, with `runtime` scope, the runtime's shared background traffic; only one connection may hold `runtime` scope. The registration ends when the connection closes.
|
|
955
|
+
*
|
|
956
|
+
* @param params Registers the calling SDK connection's Kerberos credential provider.
|
|
957
|
+
*/
|
|
958
|
+
setProvider: async (params) => connection.sendRequest("kerberosAuth.setProvider", params)
|
|
959
|
+
},
|
|
960
|
+
/** @experimental */
|
|
952
961
|
sessions: {
|
|
953
962
|
/**
|
|
954
963
|
* Creates or resumes a local session and returns the opened session ID.
|
|
@@ -1297,6 +1306,14 @@ function createInternalServerRpc(connection) {
|
|
|
1297
1306
|
* @returns The startup warning, absent when the machine can run a sandbox.
|
|
1298
1307
|
*/
|
|
1299
1308
|
getUnsupportedStartupNotice: async (params) => connection.sendRequest("sandbox.getUnsupportedStartupNotice", params),
|
|
1309
|
+
/**
|
|
1310
|
+
* The warning to show before a user adds a sandbox path grant, when the sandbox backend cannot honor it. On Windows a read/write grant on a drive root such as `C:\` or `V:\` is accepted but gives no access to the files inside it, so the warning steers the user to a specific folder. A read-only grant on a drive root works and gets no warning. The grant is still stored as written: this only advises. Returns no warning on other platforms and for paths that are not a drive root, so a host can call it unconditionally while the user types. A host must ask rather than test the path itself, because which volume shapes the backend honors is a property of the backend, and a host-side check goes stale when it changes.
|
|
1311
|
+
*
|
|
1312
|
+
* @param params The path a user is about to grant.
|
|
1313
|
+
*
|
|
1314
|
+
* @returns Advice for a path grant, when it needs any.
|
|
1315
|
+
*/
|
|
1316
|
+
getPathGrantWarning: async (params) => connection.sendRequest("sandbox.getPathGrantWarning", params),
|
|
1300
1317
|
/**
|
|
1301
1318
|
* Whether one slash command stays reachable while sandbox enforcement is unavailable and the session is otherwise blocked. The permitted set is deliberately narrow — commands that only report state, and the few that let the user repair or leave the situation — and it is keyed on the arguments as well as the name, so `/sandbox status` is admitted where `/sandbox enable` is not. A host must ask rather than keep its own list: a command this returns false for is one the runtime would refuse anyway, and a divergent list either strands the user with no way out or admits a command that acts on an unenforced session.
|
|
1302
1319
|
*
|
|
@@ -1752,6 +1769,16 @@ function createInternalServerRpc(connection) {
|
|
|
1752
1769
|
*/
|
|
1753
1770
|
connect: async (params) => connection.sendRequest("connect", params),
|
|
1754
1771
|
/** @experimental */
|
|
1772
|
+
tools: {
|
|
1773
|
+
/** @experimental */
|
|
1774
|
+
largeOutput: {
|
|
1775
|
+
/**
|
|
1776
|
+
* Removes expired tool output files using the runtime's retention policy. Refuses extension callers.
|
|
1777
|
+
*/
|
|
1778
|
+
cleanup: async () => connection.sendRequest("tools.largeOutput.cleanup", {})
|
|
1779
|
+
}
|
|
1780
|
+
},
|
|
1781
|
+
/** @experimental */
|
|
1755
1782
|
account: {
|
|
1756
1783
|
/**
|
|
1757
1784
|
* Renders the sign-in banner and the one-line account description the runtime uses for an authentication identity. The runtime words these in several places for its own callers, so a host that announces a sign-in or an account switch should render them from here rather than composing its own, which would let the two spellings drift apart.
|
|
@@ -1947,6 +1974,25 @@ function createInternalServerRpc(connection) {
|
|
|
1947
1974
|
writeKey: async (params) => connection.sendRequest("globalState.writeKey", params)
|
|
1948
1975
|
},
|
|
1949
1976
|
/** @experimental */
|
|
1977
|
+
settings: {
|
|
1978
|
+
/**
|
|
1979
|
+
* Removes one key from a settings file addressed by path, leaving every other key untouched. Takes the key exactly as written rather than a canonical setting path, because its purpose is to delete a key the loader refused: a misspelling, or a setting that no longer exists. Refuses rather than overwrites when the file does not parse, so a malformed file is never replaced by a rewrite that drops everything it could not read.
|
|
1980
|
+
*
|
|
1981
|
+
* @param params One key to remove from a settings file, named exactly as it appears in the file.
|
|
1982
|
+
*
|
|
1983
|
+
* @returns The outcome of the settings-file edit.
|
|
1984
|
+
*/
|
|
1985
|
+
removeRawKey: async (params) => connection.sendRequest("settings.removeRawKey", params),
|
|
1986
|
+
/**
|
|
1987
|
+
* Replaces the secret-bearing parts of a settings value with a redacted placeholder, so the value can be shown to a user or written to a log. `basePath` is where the value sits in the settings tree, which is what decides whether a field is secret.
|
|
1988
|
+
*
|
|
1989
|
+
* @param params A settings value to redact before showing it.
|
|
1990
|
+
*
|
|
1991
|
+
* @returns A settings value with its secret-bearing parts replaced.
|
|
1992
|
+
*/
|
|
1993
|
+
redactValueForDisplay: async (params) => connection.sendRequest("settings.redactValueForDisplay", params)
|
|
1994
|
+
},
|
|
1995
|
+
/** @experimental */
|
|
1950
1996
|
gitHubRepository: {
|
|
1951
1997
|
/**
|
|
1952
1998
|
* Resolves the GitHub repository that owns a working-tree path by reading the selected git remote configured for it, preferring `origin`. Returns a null `repository` when the path is inside a git working tree but that selected remote does not resolve to a GitHub host. Fails when the path is not inside a git working tree at all, so a caller can tell 'not a repository' apart from 'a repository with no GitHub remote'.
|
|
@@ -2010,6 +2056,15 @@ function createInternalServerRpc(connection) {
|
|
|
2010
2056
|
reposFromRemotes: async (params) => connection.sendRequest("git.reposFromRemotes", params)
|
|
2011
2057
|
},
|
|
2012
2058
|
/** @experimental */
|
|
2059
|
+
runtime: {
|
|
2060
|
+
/**
|
|
2061
|
+
* Opens an authorization URL using the same browser policy as the runtime's OAuth flows, including BROWSER and COPILOT_DEBUG_BROWSER. Refuses extension callers.
|
|
2062
|
+
*
|
|
2063
|
+
* @param params An authorization URL for the host browser.
|
|
2064
|
+
*/
|
|
2065
|
+
openBrowser: async (params) => connection.sendRequest("runtime.openBrowser", params)
|
|
2066
|
+
},
|
|
2067
|
+
/** @experimental */
|
|
2013
2068
|
sessions: {
|
|
2014
2069
|
/**
|
|
2015
2070
|
* Reads lightweight persisted metadata for one local session without opening it.
|
|
@@ -2087,6 +2142,33 @@ function createInternalServerRpc(connection) {
|
|
|
2087
2142
|
* @param params Params to attach or detach an in-process ExtensionController delegate.
|
|
2088
2143
|
*/
|
|
2089
2144
|
configureSessionExtensions: async (params) => connection.sendRequest("sessions.configureSessionExtensions", params)
|
|
2145
|
+
},
|
|
2146
|
+
/** @experimental */
|
|
2147
|
+
agentRegistry: {
|
|
2148
|
+
/**
|
|
2149
|
+
* Creates the local agent registry with mode 0700. Requires a trusted SDK host or runtime-direct caller.
|
|
2150
|
+
*
|
|
2151
|
+
* @param params The location of a local agent registry.
|
|
2152
|
+
*
|
|
2153
|
+
* @returns The resolved registry directory and any creation failure.
|
|
2154
|
+
*/
|
|
2155
|
+
ensureDir: async (params) => connection.sendRequest("agentRegistry.ensureDir", params),
|
|
2156
|
+
/**
|
|
2157
|
+
* Removes a local agent entry. An absent entry succeeds. Requires a trusted SDK host or runtime-direct caller.
|
|
2158
|
+
*
|
|
2159
|
+
* @param params A local agent entry identified by its publisher.
|
|
2160
|
+
*
|
|
2161
|
+
* @returns The outcome of removing a registry entry, with no success payload.
|
|
2162
|
+
*/
|
|
2163
|
+
removeEntry: async (params) => connection.sendRequest("agentRegistry.removeEntry", params),
|
|
2164
|
+
/**
|
|
2165
|
+
* Lists live local agents without connection credentials. Only stale entries are removed; dead-pid entries remain on disk. Requires a trusted SDK host or runtime-direct caller.
|
|
2166
|
+
*
|
|
2167
|
+
* @param params Options for local agent discovery.
|
|
2168
|
+
*
|
|
2169
|
+
* @returns Live agent metadata without connection credentials.
|
|
2170
|
+
*/
|
|
2171
|
+
listEntries: async (params) => connection.sendRequest("agentRegistry.listEntries", params)
|
|
2090
2172
|
}
|
|
2091
2173
|
};
|
|
2092
2174
|
}
|
|
@@ -3337,7 +3419,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3337
3419
|
*
|
|
3338
3420
|
* @returns Effective enterprise managed settings and contributing channels. Session events report applied policy; sessionless resolve reports an account/device snapshot, and compose reports a non-applying preview of candidate documents. Device values take precedence over server values, then the policy helper, per ordinary key, while permissions compose restrictively. Session-local SDK-client policy is included only in session results. Marked experimental while the managed-settings surface stabilizes.
|
|
3339
3421
|
*/
|
|
3340
|
-
get: async () => connection.sendRequest("session.managedSettings.get", { sessionId })
|
|
3422
|
+
get: async () => connection.sendRequest("session.managedSettings.get", { sessionId }),
|
|
3423
|
+
/**
|
|
3424
|
+
* Runs a fresh Policy Helper evaluation for the live session's current account, registration, working directory, repository and client context, bypassing only a completed cached helper result for that exact context while coalescing an equivalent execution already in flight. The previous failure and safeguards remain active until fresh success is applied. Returns the same retained snapshot as session.managedSettings.get after the recheck settles.
|
|
3425
|
+
*
|
|
3426
|
+
* @returns Effective enterprise managed settings and contributing channels. Session events report applied policy; sessionless resolve reports an account/device snapshot, and compose reports a non-applying preview of candidate documents. Device values take precedence over server values, then the policy helper, per ordinary key, while permissions compose restrictively. Session-local SDK-client policy is included only in session results. Marked experimental while the managed-settings surface stabilizes.
|
|
3427
|
+
*/
|
|
3428
|
+
recheckPolicyHelper: async () => connection.sendRequest("session.managedSettings.recheckPolicyHelper", { sessionId })
|
|
3341
3429
|
},
|
|
3342
3430
|
/** @experimental */
|
|
3343
3431
|
plugins: {
|
|
@@ -3494,6 +3582,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3494
3582
|
},
|
|
3495
3583
|
/** @experimental */
|
|
3496
3584
|
extensions: {
|
|
3585
|
+
/**
|
|
3586
|
+
* Returns the runtime-derived standalone extension admission policy for the session's actual project and managed-settings context. enforcementVersion 1 means this runtime enforces strictPluginOnlyCustomization for executable extensions. Hosts executing independent extension targets must deny standalone targets unless standalone is allowed; plugin_only requires runtime-verified eligible plugin provenance, not a caller-supplied source label or transport bridge. pending is not confirmed absence. Older runtimes return method-not-found and must not be represented as enforcing this restriction. Re-read on managed-settings changes; a snapshot is not a launch authorization token.
|
|
3587
|
+
*
|
|
3588
|
+
* @returns Runtime support and session-context standalone executable extension policy.
|
|
3589
|
+
*/
|
|
3590
|
+
getPolicy: async () => connection.sendRequest("session.extensions.getPolicy", { sessionId }),
|
|
3497
3591
|
/**
|
|
3498
3592
|
* Lists extensions discovered for the session and their current status.
|
|
3499
3593
|
*
|
|
@@ -3754,7 +3848,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3754
3848
|
/** @experimental */
|
|
3755
3849
|
permissions: {
|
|
3756
3850
|
/**
|
|
3757
|
-
* Replaces selected permission
|
|
3851
|
+
* Replaces selected session permission fields, including rules, paths, URLs, exclusions, allow-all flags, user-authored judge instructions, bounded host-supplied advisory judge context, owner-authenticated session authority, and the owner's host-policy declaration for its own tools.
|
|
3758
3852
|
*
|
|
3759
3853
|
* @param params Patch of permission policy fields to apply (omit a field to leave it unchanged).
|
|
3760
3854
|
*
|
|
@@ -3821,6 +3915,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3821
3915
|
* @returns Indicates whether the operation succeeded.
|
|
3822
3916
|
*/
|
|
3823
3917
|
resetSessionApprovals: async (params) => connection.sendRequest("session.permissions.resetSessionApprovals", { ...params, sessionId }),
|
|
3918
|
+
/**
|
|
3919
|
+
* Clears, in memory only, the allow-all and assisted-approval posture that resuming the session restored from its history. No permission event is recorded, so a later resume restores the user's choice again. A headless caller, which has no one to approve requests, calls it before configuring permissions from its own flags.
|
|
3920
|
+
*
|
|
3921
|
+
* @returns Indicates whether the operation succeeded.
|
|
3922
|
+
*/
|
|
3923
|
+
clearResumeEscalation: async () => connection.sendRequest("session.permissions.clearResumeEscalation", { sessionId }),
|
|
3824
3924
|
/**
|
|
3825
3925
|
* Notifies the runtime that a permission prompt UI has been shown to the user.
|
|
3826
3926
|
*
|
|
@@ -4302,7 +4402,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
4302
4402
|
*
|
|
4303
4403
|
* @param params Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering.
|
|
4304
4404
|
*
|
|
4305
|
-
* @returns GitHub URL
|
|
4405
|
+
* @returns GitHub URL and remote export and steering state, with an optional warning when cloud session storage policy refuses export.
|
|
4306
4406
|
*/
|
|
4307
4407
|
enable: async (params) => connection.sendRequest("session.remote.enable", { ...params, sessionId }),
|
|
4308
4408
|
/**
|
|
@@ -4488,6 +4588,15 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
4488
4588
|
clearStartupSeed: async (params) => connection.sendRequest("session.model.clearStartupSeed", { ...params, sessionId })
|
|
4489
4589
|
},
|
|
4490
4590
|
/** @experimental */
|
|
4591
|
+
autopilot: {
|
|
4592
|
+
/**
|
|
4593
|
+
* Applies the runtime-owned Autopilot continuation policy at the session-idle decision point and routes any admitted continuation through the normal session send lifecycle. Only the SDK connection that owns the session can invoke this method.
|
|
4594
|
+
*
|
|
4595
|
+
* @returns Result of applying the ordinary session-idle Autopilot continuation decision.
|
|
4596
|
+
*/
|
|
4597
|
+
evaluateIdleContinuation: async () => connection.sendRequest("session.autopilot.evaluateIdleContinuation", { sessionId })
|
|
4598
|
+
},
|
|
4599
|
+
/** @experimental */
|
|
4491
4600
|
mcp: {
|
|
4492
4601
|
/**
|
|
4493
4602
|
* Records the IDE the host is connected to, so the agent's system prompt can name it and its workspace folder. Null or an omitted `ide` clears the recorded value, which is how a host reports that it is disconnected; there is no separate clear method. Both `ideName` and `workspaceFolder` are required together, because half a state cannot be attributed to a project.
|
|
@@ -4525,6 +4634,20 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
4525
4634
|
unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { ...params, sessionId })
|
|
4526
4635
|
},
|
|
4527
4636
|
/** @experimental */
|
|
4637
|
+
diagnostics: {
|
|
4638
|
+
/** @experimental */
|
|
4639
|
+
lifecycle: {
|
|
4640
|
+
/**
|
|
4641
|
+
* Reads a bounded page of retained experimental runtime lifecycle diagnostic events. The read is passive and never prepares conversation history or starts subsystem work.
|
|
4642
|
+
*
|
|
4643
|
+
* @param params Cursor-based request for experimental runtime lifecycle diagnostic events. The default max is 100 (maximum 500); the default waitMs is zero (maximum 30000).
|
|
4644
|
+
*
|
|
4645
|
+
* @returns One cursor-addressed page of retained experimental runtime lifecycle diagnostic events.
|
|
4646
|
+
*/
|
|
4647
|
+
read: async (params) => connection.sendRequest("session.diagnostics.lifecycle.read", { ...params, sessionId })
|
|
4648
|
+
}
|
|
4649
|
+
},
|
|
4650
|
+
/** @experimental */
|
|
4528
4651
|
connectors: {
|
|
4529
4652
|
/**
|
|
4530
4653
|
* Reconciles the authoritative Connector catalog into the session MCP projection during startup with a bounded deadline and fail-closed cleanup.
|
|
@@ -4550,12 +4673,20 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
4550
4673
|
*
|
|
4551
4674
|
* @returns Whether finalizing the invocation effect succeeded, and the failure reason when it did not.
|
|
4552
4675
|
*/
|
|
4553
|
-
finalizeInvocationEffect: async (params) => connection.sendRequest("session.commands.finalizeInvocationEffect", { ...params, sessionId })
|
|
4676
|
+
finalizeInvocationEffect: async (params) => connection.sendRequest("session.commands.finalizeInvocationEffect", { ...params, sessionId }),
|
|
4677
|
+
/**
|
|
4678
|
+
* Reports that the host's execution of a queued command started or stopped waiting for runtime state, so lifecycle progress can attribute the wait. Observational only: it never changes command execution.
|
|
4679
|
+
*
|
|
4680
|
+
* @param params Host report that its execution of a queued command started or stopped waiting for runtime state. The report is observational and never changes command execution.
|
|
4681
|
+
*
|
|
4682
|
+
* @returns Whether the runtime recorded the queued-command wait.
|
|
4683
|
+
*/
|
|
4684
|
+
reportQueuedCommandWait: async (params) => connection.sendRequest("session.commands.reportQueuedCommandWait", { ...params, sessionId })
|
|
4554
4685
|
},
|
|
4555
4686
|
/** @experimental */
|
|
4556
4687
|
ui: {
|
|
4557
4688
|
/**
|
|
4558
|
-
* Resolves a pending elicitation request after direct interaction in the trusted in-process client. Only an accepted response to the built-in ask_user tool can become trusted human evidence.
|
|
4689
|
+
* Resolves a pending elicitation request after direct interaction in the trusted in-process client or authenticated owning host. Only an accepted response to the built-in ask_user tool can become trusted human evidence.
|
|
4559
4690
|
*
|
|
4560
4691
|
* @param params Pending elicitation request ID and the user's response (accept/decline/cancel + form values).
|
|
4561
4692
|
*
|
|
@@ -4563,7 +4694,7 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
4563
4694
|
*/
|
|
4564
4695
|
handleHumanAskUser: async (params) => connection.sendRequest("session.ui.handleHumanAskUser", { ...params, sessionId }),
|
|
4565
4696
|
/**
|
|
4566
|
-
* Resolves a pending `user_input.requested` event after direct interaction in the trusted in-process client.
|
|
4697
|
+
* Resolves a pending `user_input.requested` event after direct interaction in the trusted in-process client or authenticated owning host.
|
|
4567
4698
|
*
|
|
4568
4699
|
* @param params Request ID of a pending `user_input.requested` event and the user's response.
|
|
4569
4700
|
*
|
|
@@ -4571,7 +4702,7 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
4571
4702
|
*/
|
|
4572
4703
|
handleHumanUserInput: async (params) => connection.sendRequest("session.ui.handleHumanUserInput", { ...params, sessionId }),
|
|
4573
4704
|
/**
|
|
4574
|
-
* Resolves a pending `exit_plan_mode.requested` event after direct interaction in the trusted in-process client.
|
|
4705
|
+
* Resolves a pending `exit_plan_mode.requested` event after direct interaction in the trusted in-process client or authenticated owning host.
|
|
4575
4706
|
*
|
|
4576
4707
|
* @param params Request ID of a pending `exit_plan_mode.requested` event and the user's response.
|
|
4577
4708
|
*
|
|
@@ -4746,6 +4877,12 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
4746
4877
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
4747
4878
|
return handler.readFileBytes(params);
|
|
4748
4879
|
});
|
|
4880
|
+
connection.onRequest("sessionFs.readFileRange", async (params) => {
|
|
4881
|
+
const handler = getHandlers(params.sessionId).sessionFs;
|
|
4882
|
+
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
4883
|
+
if (!handler.readFileRange) throw new Error("Optional client handler sessionFs.readFileRange is not implemented");
|
|
4884
|
+
return handler.readFileRange(params);
|
|
4885
|
+
});
|
|
4749
4886
|
connection.onRequest("sessionFs.writeFile", async (params) => {
|
|
4750
4887
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
4751
4888
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
@@ -4838,6 +4975,11 @@ function registerClientGlobalApiHandlers(connection, handlers) {
|
|
|
4838
4975
|
if (!handler) throw new Error("No extensionLaunchProvider client-global handler registered");
|
|
4839
4976
|
return handler.resolve(params);
|
|
4840
4977
|
});
|
|
4978
|
+
connection.onRequest("kerberosAuth.acquire", async (params) => {
|
|
4979
|
+
const handler = handlers.kerberosAuth;
|
|
4980
|
+
if (!handler) throw new Error("No kerberosAuth client-global handler registered");
|
|
4981
|
+
return handler.acquire(params);
|
|
4982
|
+
});
|
|
4841
4983
|
connection.onRequest("llmInference.httpRequestStart", async (params) => {
|
|
4842
4984
|
const handler = handlers.llmInference;
|
|
4843
4985
|
if (!handler) throw new Error("No llmInference client-global handler registered");
|
|
@@ -4858,6 +5000,11 @@ function registerClientGlobalApiHandlers(connection, handlers) {
|
|
|
4858
5000
|
if (!handler) throw new Error("No gitHubToken client-global handler registered");
|
|
4859
5001
|
return handler.getToken(params);
|
|
4860
5002
|
});
|
|
5003
|
+
connection.onRequest("entraToken.getToken", async (params) => {
|
|
5004
|
+
const handler = handlers.entraToken;
|
|
5005
|
+
if (!handler) throw new Error("No entraToken client-global handler registered");
|
|
5006
|
+
return handler.getToken(params);
|
|
5007
|
+
});
|
|
4861
5008
|
connection.onRequest("uiThread.run", async (params) => {
|
|
4862
5009
|
const handler = handlers.uiThread;
|
|
4863
5010
|
if (!handler) throw new Error("No uiThread client-global handler registered");
|
|
@@ -21,7 +21,7 @@ __export(installationConfirmation_exports, {
|
|
|
21
21
|
createInstallationConfirmationAdapter: () => createInstallationConfirmationAdapter
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(installationConfirmation_exports);
|
|
24
|
-
var import_node = require("vscode-jsonrpc/node
|
|
24
|
+
var import_node = require("vscode-jsonrpc/node");
|
|
25
25
|
function createInstallationConfirmationAdapter(connection, handler) {
|
|
26
26
|
const closed = new import_node.CancellationTokenSource();
|
|
27
27
|
const closeSubscription = connection.onClose(() => closed.cancel());
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var jsonrpcTypes_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(jsonrpcTypes_exports);
|
package/dist/cjs/session.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(session_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(session_exports);
|
|
24
24
|
var import_node_async_hooks = require("node:async_hooks");
|
|
25
|
-
var import_node = require("vscode-jsonrpc/node
|
|
25
|
+
var import_node = require("vscode-jsonrpc/node");
|
|
26
26
|
var import_rpc = require("./generated/rpc.js");
|
|
27
27
|
var import_canvas = require("./canvas.js");
|
|
28
28
|
var import_telemetry = require("./telemetry.js");
|
|
@@ -258,6 +258,15 @@ function isWorkflowAbortError(error) {
|
|
|
258
258
|
function isWorkflowFatalError(error) {
|
|
259
259
|
return isWorkflowAbortError(error) || error instanceof import_node.ResponseError || error instanceof import_node.ConnectionError;
|
|
260
260
|
}
|
|
261
|
+
const MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
|
|
262
|
+
function setLongTimeout(callback, delayMs) {
|
|
263
|
+
let timer;
|
|
264
|
+
const arm = (remainingMs) => {
|
|
265
|
+
timer = remainingMs > MAX_TIMER_DELAY_MS ? setTimeout(() => arm(remainingMs - MAX_TIMER_DELAY_MS), MAX_TIMER_DELAY_MS) : setTimeout(callback, remainingMs);
|
|
266
|
+
};
|
|
267
|
+
arm(delayMs);
|
|
268
|
+
return () => clearTimeout(timer);
|
|
269
|
+
}
|
|
261
270
|
const TOOL_SEARCH_TOOL_NAME = "tool_search_tool";
|
|
262
271
|
class CopilotSession {
|
|
263
272
|
/**
|
|
@@ -668,11 +677,11 @@ class CopilotSession {
|
|
|
668
677
|
else resolveOutcome({ kind: "error", error });
|
|
669
678
|
};
|
|
670
679
|
this.pendingResponseWaits.add(fail);
|
|
671
|
-
let
|
|
680
|
+
let cancelTimeout;
|
|
672
681
|
let waiting = true;
|
|
673
682
|
try {
|
|
674
683
|
const timeoutPromise = new Promise((_, reject) => {
|
|
675
|
-
|
|
684
|
+
cancelTimeout = setLongTimeout(
|
|
676
685
|
() => reject(
|
|
677
686
|
new Error(
|
|
678
687
|
`Timeout after ${effectiveTimeout}ms waiting for response completion`
|
|
@@ -700,9 +709,7 @@ class CopilotSession {
|
|
|
700
709
|
return outcome.message;
|
|
701
710
|
} finally {
|
|
702
711
|
waiting = false;
|
|
703
|
-
|
|
704
|
-
clearTimeout(timeoutId);
|
|
705
|
-
}
|
|
712
|
+
cancelTimeout?.();
|
|
706
713
|
unsubscribe();
|
|
707
714
|
buffered.length = 0;
|
|
708
715
|
this.pendingResponseWaits.delete(fail);
|
|
@@ -736,7 +743,7 @@ class CopilotSession {
|
|
|
736
743
|
fail = reject;
|
|
737
744
|
});
|
|
738
745
|
this.pendingResponseWaits.add(fail);
|
|
739
|
-
const
|
|
746
|
+
const cancelTimeout = setLongTimeout(
|
|
740
747
|
() => fail(new Error(`Timeout after ${timeout}ms waiting for session.idle`)),
|
|
741
748
|
timeout
|
|
742
749
|
);
|
|
@@ -775,7 +782,7 @@ class CopilotSession {
|
|
|
775
782
|
try {
|
|
776
783
|
return await Promise.race([operation(), stopped]);
|
|
777
784
|
} finally {
|
|
778
|
-
|
|
785
|
+
cancelTimeout();
|
|
779
786
|
unsubscribe();
|
|
780
787
|
this.pendingResponseWaits.delete(fail);
|
|
781
788
|
resolveDispatched();
|
|
@@ -833,7 +840,7 @@ class CopilotSession {
|
|
|
833
840
|
});
|
|
834
841
|
this.pendingStructuredWaits.add(fail);
|
|
835
842
|
let waiting = true;
|
|
836
|
-
const
|
|
843
|
+
const cancelTimeout = setLongTimeout(
|
|
837
844
|
() => fail(new Error(`Timeout after ${timeout}ms waiting for the structured response`)),
|
|
838
845
|
timeout
|
|
839
846
|
);
|
|
@@ -860,7 +867,7 @@ class CopilotSession {
|
|
|
860
867
|
return outcome.message;
|
|
861
868
|
} finally {
|
|
862
869
|
waiting = false;
|
|
863
|
-
|
|
870
|
+
cancelTimeout();
|
|
864
871
|
buffered.length = 0;
|
|
865
872
|
unsubscribe();
|
|
866
873
|
this.pendingStructuredWaits.delete(fail);
|
|
@@ -1017,12 +1024,23 @@ class CopilotSession {
|
|
|
1017
1024
|
}
|
|
1018
1025
|
}
|
|
1019
1026
|
} else if (event.type === "permission.requested") {
|
|
1020
|
-
const {
|
|
1027
|
+
const {
|
|
1028
|
+
requestId,
|
|
1029
|
+
permissionRequest,
|
|
1030
|
+
promptRequest,
|
|
1031
|
+
assistedApprovalAssessment,
|
|
1032
|
+
resolvedByHook
|
|
1033
|
+
} = event.data;
|
|
1021
1034
|
if (resolvedByHook) {
|
|
1022
1035
|
return;
|
|
1023
1036
|
}
|
|
1024
1037
|
if (this.permissionHandler) {
|
|
1025
|
-
void this._executePermissionAndRespond(
|
|
1038
|
+
void this._executePermissionAndRespond(
|
|
1039
|
+
requestId,
|
|
1040
|
+
permissionRequest,
|
|
1041
|
+
promptRequest,
|
|
1042
|
+
assistedApprovalAssessment
|
|
1043
|
+
);
|
|
1026
1044
|
}
|
|
1027
1045
|
} else if (event.type === "mcp.oauth_required") {
|
|
1028
1046
|
const data = event.data;
|
|
@@ -1041,15 +1059,7 @@ class CopilotSession {
|
|
|
1041
1059
|
void this._executeCommandAndRespond(requestId, commandName, command, args);
|
|
1042
1060
|
} else if (event.type === "elicitation.requested") {
|
|
1043
1061
|
if (this.elicitationHandler) {
|
|
1044
|
-
const {
|
|
1045
|
-
message,
|
|
1046
|
-
requestedSchema,
|
|
1047
|
-
mode,
|
|
1048
|
-
elicitationSource,
|
|
1049
|
-
elicitationSourceDisplayName,
|
|
1050
|
-
url,
|
|
1051
|
-
requestId
|
|
1052
|
-
} = event.data;
|
|
1062
|
+
const { message, requestedSchema, mode, elicitationSource, url, requestId } = event.data;
|
|
1053
1063
|
void this._handleElicitationRequest(
|
|
1054
1064
|
{
|
|
1055
1065
|
sessionId: this.sessionId,
|
|
@@ -1057,14 +1067,17 @@ class CopilotSession {
|
|
|
1057
1067
|
requestedSchema,
|
|
1058
1068
|
mode,
|
|
1059
1069
|
elicitationSource,
|
|
1060
|
-
elicitationSourceDisplayName,
|
|
1061
1070
|
url
|
|
1062
1071
|
},
|
|
1063
1072
|
requestId
|
|
1064
1073
|
);
|
|
1065
1074
|
}
|
|
1066
1075
|
} else if (event.type === "capabilities.changed") {
|
|
1067
|
-
|
|
1076
|
+
const { ui, ...changed } = event.data;
|
|
1077
|
+
this._capabilities = { ...this._capabilities, ...changed };
|
|
1078
|
+
if (ui) {
|
|
1079
|
+
this._capabilities.ui = { ...this._capabilities.ui, ...ui };
|
|
1080
|
+
}
|
|
1068
1081
|
} else if (event.type === "session.canvas.opened") {
|
|
1069
1082
|
this.upsertOpenCanvasFromEvent(event.data);
|
|
1070
1083
|
} else if (event.type === "session.canvas.closed") {
|
|
@@ -1190,12 +1203,13 @@ class CopilotSession {
|
|
|
1190
1203
|
* Executes a permission handler and sends the result back via RPC.
|
|
1191
1204
|
* @internal
|
|
1192
1205
|
*/
|
|
1193
|
-
async _executePermissionAndRespond(requestId, permissionRequest, promptRequest) {
|
|
1206
|
+
async _executePermissionAndRespond(requestId, permissionRequest, promptRequest, assistedApprovalAssessment) {
|
|
1194
1207
|
try {
|
|
1195
1208
|
const invocation = {
|
|
1196
1209
|
sessionId: this.sessionId,
|
|
1197
1210
|
managedSettingsEnabled: this.managedSettingsEnabled,
|
|
1198
|
-
...promptRequest === void 0 ? {} : { promptRequest }
|
|
1211
|
+
...promptRequest === void 0 ? {} : { promptRequest },
|
|
1212
|
+
...assistedApprovalAssessment === void 0 ? {} : { assistedApprovalAssessment }
|
|
1199
1213
|
};
|
|
1200
1214
|
const handlerResult = await this.permissionHandler(permissionRequest, invocation);
|
|
1201
1215
|
const isAttributed = (0, import_types.isAttributedPermissionResult)(handlerResult);
|
|
@@ -51,6 +51,34 @@ function normalizeSqliteParams(params) {
|
|
|
51
51
|
}
|
|
52
52
|
function createSessionFsAdapter(provider) {
|
|
53
53
|
return {
|
|
54
|
+
readFileRange: async ({ path, offset, length }) => {
|
|
55
|
+
try {
|
|
56
|
+
if (!Number.isSafeInteger(offset) || offset < 0 || length !== void 0 && (!Number.isSafeInteger(length) || length < 0)) {
|
|
57
|
+
throw new RangeError(
|
|
58
|
+
"SessionFs byte offset and length must be non-negative safe integers"
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
if (!provider.readFileRange) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
"Byte-range reads are not supported by this SessionFs provider"
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const result = await provider.readFileRange(path, offset, length);
|
|
67
|
+
if (!Number.isSafeInteger(result.byteLength) || result.byteLength < 0) {
|
|
68
|
+
throw new Error("SessionFs byte length must be a non-negative safe integer");
|
|
69
|
+
}
|
|
70
|
+
const available = Math.max(0, result.byteLength - offset);
|
|
71
|
+
if (result.content.byteLength !== Math.min(length ?? available, available)) {
|
|
72
|
+
throw new Error("SessionFs returned an incorrect byte range length");
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
content: Buffer.from(result.content).toString("base64"),
|
|
76
|
+
byteLength: result.byteLength
|
|
77
|
+
};
|
|
78
|
+
} catch (err) {
|
|
79
|
+
return { content: "", byteLength: 0, error: toSessionFsError(err) };
|
|
80
|
+
}
|
|
81
|
+
},
|
|
54
82
|
readFile: async ({ path }) => {
|
|
55
83
|
try {
|
|
56
84
|
const content = await provider.readFile(path);
|
package/dist/cliVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COPILOT_CLI_VERSION = "1.0.
|
|
1
|
+
export declare const COPILOT_CLI_VERSION = "1.0.106-2";
|
|
2
2
|
export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
|
package/dist/cliVersion.js
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export declare class CopilotClient {
|
|
|
50
50
|
private sessionFsConfig;
|
|
51
51
|
private requestHandler;
|
|
52
52
|
private extensionLaunchProvider?;
|
|
53
|
+
private readonly kerberosAuth?;
|
|
53
54
|
private installationConfirmationHandler?;
|
|
54
55
|
private builtinPluginDirectories;
|
|
55
56
|
private onGitHubTelemetry?;
|