@github/copilot-sdk 1.0.29-preview.1 → 1.0.29-preview.10
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 +658 -11
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +138 -39
- package/dist/cjs/copilotRequestHandler.js +17 -7
- package/dist/cjs/generated/rpc.js +321 -6
- package/dist/cjs/session.js +59 -1
- package/dist/cjs/types.js +3 -5
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +8 -7
- package/dist/client.js +140 -41
- package/dist/copilotRequestHandler.js +17 -7
- package/dist/generated/lifecycle-diagnostics.d.ts +4 -0
- package/dist/generated/rpc.d.ts +670 -14
- package/dist/generated/rpc.js +321 -6
- package/dist/generated/session-events.d.ts +48 -2
- package/dist/index.d.ts +1 -1
- package/dist/session.d.ts +11 -3
- package/dist/session.js +59 -1
- package/dist/types.d.ts +50 -16
- package/dist/types.js +3 -5
- package/docs/agent-author.md +53 -5
- package/docs/examples.md +21 -16
- package/docs/workflows.md +2 -3
- package/package.json +17 -14
|
@@ -841,9 +841,17 @@ function createServerRpc(connection) {
|
|
|
841
841
|
*
|
|
842
842
|
* @param params A bounded catalog search. Both the query length and the result count are capped by the schema so a caller cannot request an unbounded scan.
|
|
843
843
|
*
|
|
844
|
-
* @returns Outcome of
|
|
844
|
+
* @returns Outcome of catalog.search or catalog.recommend: either bounded inert candidates, or one typed refusal. Never a partial success.
|
|
845
845
|
*/
|
|
846
846
|
search: async (params) => connection.sendRequest("catalog.search", params),
|
|
847
|
+
/**
|
|
848
|
+
* Requests the initial page of at most ten official-product recommendations for a complete task and product, bound to an existing attached local session. Requires catalog-recommend, catalog-search-session-bound and catalog-search-credential-required. Uses the selected GitHub.com user credential on the fixed Agent Finder recommendations route; successful capability negotiation does not establish service acceptance. Returns the existing inert catalog candidates and retained install references with the typed catalog refusal union. No anonymous retry, unfiltered search fallback or continuation is performed. Server-owned product approvals establish provenance, not task suitability. Read-only: nothing is installed, configured or persisted.
|
|
849
|
+
*
|
|
850
|
+
* @param params Initial-page official-product recommendations for a complete task. The runtime fixes recommendationPolicy to official-product and pageSize to 10; callers cannot override the policy, request pagination or fall back to search.
|
|
851
|
+
*
|
|
852
|
+
* @returns Outcome of catalog.search or catalog.recommend: either bounded inert candidates, or one typed refusal. Never a partial success.
|
|
853
|
+
*/
|
|
854
|
+
recommend: async (params) => connection.sendRequest("catalog.recommend", params),
|
|
847
855
|
/**
|
|
848
856
|
* Retrieves one saved feed by its opaque ID, optionally filtered by trust tier. Requires catalog-feeds and catalog-search-credential-required, and uses the same authority, credential policy, optional session binding and candidate projection as catalog.search, so available entries are the same inert candidates, with the same installability, handles and display metadata, and install through the same confirmed flows. Entries keep the feed's order; an entry the runtime cannot present is returned as unavailable with a reason rather than failing the feed. No anonymous retry. Read-only: nothing is installed, configured, or persisted.
|
|
849
857
|
*
|
|
@@ -1809,7 +1817,23 @@ function createInternalServerRpc(connection) {
|
|
|
1809
1817
|
*
|
|
1810
1818
|
* @returns The environment variable supplying a classic personal access token, when one is set.
|
|
1811
1819
|
*/
|
|
1812
|
-
getTokenEnvVar: async () => connection.sendRequest("account.getTokenEnvVar", {})
|
|
1820
|
+
getTokenEnvVar: async () => connection.sendRequest("account.getTokenEnvVar", {}),
|
|
1821
|
+
/**
|
|
1822
|
+
* Enrolls the supplied identity in Copilot Free. A host offers this when a signed-in user has no Copilot subscription, so that signing up does not mean leaving for a browser. The runtime resolves the identity's credential itself, so the caller sends none. Read `kind` before `status`: an identity whose credential cannot be resolved answers `no-token` rather than failing the call, because that asks the user to sign in again rather than reporting that enrollment broke. Enrolling an already-enrolled account succeeds and reports `already_subscribed`. This does not refresh the caller's cached account state; a host that shows subscription status should re-read it afterwards.
|
|
1823
|
+
*
|
|
1824
|
+
* @param params The authentication identity to enroll in Copilot Free.
|
|
1825
|
+
*
|
|
1826
|
+
* @returns What came of a Copilot Free enrollment attempt.
|
|
1827
|
+
*/
|
|
1828
|
+
subscribeCopilotFree: async (params) => connection.sendRequest("account.subscribeCopilotFree", params),
|
|
1829
|
+
/**
|
|
1830
|
+
* Resolves the base URL of the GitHub host from its configured names, normalizing a bare hostname into an `https://` URL and falling back to the public github.com host when neither name is set. Unlike `account.getWebUrl` this needs no identity, so a host can reach it before anyone has signed in -- which is when an enterprise instance must already be known.
|
|
1831
|
+
*
|
|
1832
|
+
* @param params Configured names of the GitHub host to resolve.
|
|
1833
|
+
*
|
|
1834
|
+
* @returns Absolute base URL of the GitHub host.
|
|
1835
|
+
*/
|
|
1836
|
+
getHostUrl: async (params) => connection.sendRequest("account.getHostUrl", params)
|
|
1813
1837
|
},
|
|
1814
1838
|
/** @experimental */
|
|
1815
1839
|
mcp: {
|
|
@@ -2001,7 +2025,23 @@ function createInternalServerRpc(connection) {
|
|
|
2001
2025
|
*
|
|
2002
2026
|
* @returns The GitHub repository that owns the requested path, when the selected remote (`origin`, else the first) is on a GitHub host.
|
|
2003
2027
|
*/
|
|
2004
|
-
atPath: async (params) => connection.sendRequest("gitHubRepository.atPath", params)
|
|
2028
|
+
atPath: async (params) => connection.sendRequest("gitHubRepository.atPath", params),
|
|
2029
|
+
/**
|
|
2030
|
+
* Resolves the owner and name of a GitHub repository from its numeric repository id, by asking the GitHub API under the supplied credential. Returns a null `repository` when the id names nothing the credential can see, which the API reports as a 404, so a caller can tell 'no such visible repository' apart from a request that failed. The host queried is derived from `authInfo` rather than supplied separately, so the lookup always runs against the account's own GitHub host.
|
|
2031
|
+
*
|
|
2032
|
+
* @param params Selects a GitHub repository by its numeric repository id, and the credential to look it up under.
|
|
2033
|
+
*
|
|
2034
|
+
* @returns The repository the requested id names, when the credential can see one.
|
|
2035
|
+
*/
|
|
2036
|
+
getById: async (params) => connection.sendRequest("gitHubRepository.getById", params),
|
|
2037
|
+
/**
|
|
2038
|
+
* Finds the pull request a branch is open against, searching every repository in `baseRepositories` so a fork's branch finds the pull request it opened upstream. A candidate is discarded unless `headOwner` owns its head branch, because a branch name alone is ambiguous across forks. `status` separates 'not authenticated', 'no such pull request' and 'the search failed', so a caller can tell a conclusive absence apart from an unknown one. The host queried is derived from `authInfo` rather than supplied separately, so the lookup always runs against the account's own GitHub host.
|
|
2039
|
+
*
|
|
2040
|
+
* @param params Selects the pull request a branch is open against, and the credential to look it up under. The branch is searched across every repository in `baseRepositories`, which lets a fork's branch find the pull request it opened against upstream.
|
|
2041
|
+
*
|
|
2042
|
+
* @returns Outcome of a branch pull-request lookup. `status` carries why, because 'not authenticated', 'no pull request' and 'the search failed' are three different answers and only the first two are conclusive.
|
|
2043
|
+
*/
|
|
2044
|
+
lookupBranchPullRequest: async (params) => connection.sendRequest("gitHubRepository.lookupBranchPullRequest", params)
|
|
2005
2045
|
},
|
|
2006
2046
|
/** @experimental */
|
|
2007
2047
|
gitHubOwners: {
|
|
@@ -2169,11 +2209,242 @@ function createInternalServerRpc(connection) {
|
|
|
2169
2209
|
* @returns Live agent metadata without connection credentials.
|
|
2170
2210
|
*/
|
|
2171
2211
|
listEntries: async (params) => connection.sendRequest("agentRegistry.listEntries", params)
|
|
2212
|
+
},
|
|
2213
|
+
/** @experimental */
|
|
2214
|
+
gitHubFetch: {
|
|
2215
|
+
/**
|
|
2216
|
+
* Registers one authenticated GitHub API request before it starts, so cancellation can name the operation. Each request claims its id once. Refused for extensions.
|
|
2217
|
+
*
|
|
2218
|
+
* @returns One registered GitHub request, shared by execution and cancellation.
|
|
2219
|
+
*/
|
|
2220
|
+
allocateRequestId: async () => connection.sendRequest("gitHubFetch.allocateRequestId", {}),
|
|
2221
|
+
/**
|
|
2222
|
+
* Calls the GitHub API with session credentials, or process credentials when sessionId is absent. A bound host can select its existing auth handle with authOwnerId. The URL must match that identity's API origin or the runtime's explicit debug API origin. Retries and eligible redirects resolve the current credential again. Explicit caller Authorization remains unchanged; cross-origin redirects discard credentials without restoring them on later hops. Release asset bodies require gitHubRelease.downloadAsset. JSON asset metadata and other response bodies remain supported. The runtime supplies a default User-Agent and records request diagnostics. Extensions cannot use this method.
|
|
2223
|
+
*
|
|
2224
|
+
* @param params A GitHub API request without caller-supplied auth identity or credential fields.
|
|
2225
|
+
*
|
|
2226
|
+
* @returns The HTTP response or a classified request failure.
|
|
2227
|
+
*/
|
|
2228
|
+
request: async (params) => connection.sendRequest("gitHubFetch.request", params),
|
|
2229
|
+
/**
|
|
2230
|
+
* Executes a named GitHub or Copilot job operation. The runtime derives its URL, headers, retry policy, and credential. sessionId selects session auth; omission selects process auth. A bound host connection can select its existing auth handle with authOwnerId. Retries and eligible redirects resolve the current credential again. Cross-origin redirects discard credentials without restoring them on later hops. Non-success HTTP responses include the formatted error for the host. Extensions cannot use this method.
|
|
2231
|
+
*
|
|
2232
|
+
* @param params Arguments for a named authenticated operation.
|
|
2233
|
+
*
|
|
2234
|
+
* @returns The HTTP response or a classified request failure.
|
|
2235
|
+
*/
|
|
2236
|
+
executeOperation: async (params) => connection.sendRequest("gitHubFetch.executeOperation", params),
|
|
2237
|
+
/**
|
|
2238
|
+
* Cancels a registered GitHub request. False means the id is no longer registered. Uses the same runtime request registry as request and executeOperation. Refused for extensions.
|
|
2239
|
+
*
|
|
2240
|
+
* @param params One registered GitHub request, shared by execution and cancellation.
|
|
2241
|
+
*
|
|
2242
|
+
* @returns Whether cancellation reached a registered GitHub request.
|
|
2243
|
+
*/
|
|
2244
|
+
cancel: async (params) => connection.sendRequest("gitHubFetch.cancel", params)
|
|
2245
|
+
},
|
|
2246
|
+
/** @experimental */
|
|
2247
|
+
gitHubRelease: {
|
|
2248
|
+
/**
|
|
2249
|
+
* Allocates a connection-owned request id before a release lookup, snapshot, or asset download starts. Use the id to cancel that operation. A snapshot retains its allocation until disposal or connection close.
|
|
2250
|
+
*
|
|
2251
|
+
* @returns A freshly registered request id. Registering it before the work starts is what lets a cancel that races the request still find something to cancel.
|
|
2252
|
+
*/
|
|
2253
|
+
allocateRequestId: async () => connection.sendRequest("gitHubRelease.allocateRequestId", {}),
|
|
2254
|
+
/**
|
|
2255
|
+
* Retires an unused allocation that this caller will never dispatch. Only an unclaimed id on this connection with no active guard is eligible. Active, foreign, unknown and previously retired ids return abandoned: false. Ordinary cancellation still preserves the first canceled claim. This cleanup remains available during shutdown and is refused for extensions.
|
|
2256
|
+
*
|
|
2257
|
+
* @param params An unused release allocation that this caller will never dispatch. This is separate from cancellation before a request arrives.
|
|
2258
|
+
*
|
|
2259
|
+
* @returns Whether the runtime retired an unused allocation without affecting active work.
|
|
2260
|
+
*/
|
|
2261
|
+
abandonRequest: async (params) => connection.sendRequest("gitHubRelease.abandonRequest", params),
|
|
2262
|
+
/**
|
|
2263
|
+
* Looks up a published release or release list. A bound host connection uses its original auth source. Other SDK callers keep the existing authInfo path. The runtime resolves credentials for each request and redirect. Public releases also permit anonymous access. The kind field distinguishes a result, a missing tag, no release, a rate limit, and failure. This raw lookup does not return a shared snapshot.
|
|
2264
|
+
*
|
|
2265
|
+
* @param params Which release to look up, the credential to look it up under, and the request id that makes the lookup cancellable.
|
|
2266
|
+
*
|
|
2267
|
+
* @returns Outcome of a release lookup. `releaseJson` is present only for `found`, and `message` only for the kinds that carry an explanation.
|
|
2268
|
+
*/
|
|
2269
|
+
lookup: async (params) => connection.sendRequest("gitHubRelease.lookup", params),
|
|
2270
|
+
/**
|
|
2271
|
+
* Loads one immutable release snapshot for an update client or SDK host. The runtime retains the original credential source and resolves it for each request. Calls with the same allocated request id and options share one lookup and result. A dropped waiter does not cancel that lookup. Use gitHubRelease.cancel to dispose the operation. The runtime admits one failure report before it publishes a failed result. Extensions cannot use this method.
|
|
2272
|
+
*
|
|
2273
|
+
* @param params Immutable options for one connection-owned release snapshot.
|
|
2274
|
+
*
|
|
2275
|
+
* @returns The shared release result with its original lookup duration. Runtime worker faults remain RPC errors.
|
|
2276
|
+
*/
|
|
2277
|
+
getSnapshot: async (params) => connection.sendRequest("gitHubRelease.getSnapshot", params),
|
|
2278
|
+
/**
|
|
2279
|
+
* Cancels an allocated operation on this connection. For a snapshot, disposal also waits for its owned lookup and retires its credential authority. It does not delete completed caller-owned downloads. An unknown or foreign id returns canceled: false. A completed download still returns its owned file, which the caller must dispose.
|
|
2280
|
+
*
|
|
2281
|
+
* @param params The release lookup or asset download to abandon.
|
|
2282
|
+
*
|
|
2283
|
+
* @returns Whether the cancel reached live work.
|
|
2284
|
+
*/
|
|
2285
|
+
cancel: async (params) => connection.sendRequest("gitHubRelease.cancel", params),
|
|
2286
|
+
/**
|
|
2287
|
+
* Streams a published Copilot release asset to a private file and computes its SHA-256. The URL must name an HTTPS release download in a supported repository. A snapshotRequestId retains that snapshot's original credential source. Otherwise, a bound host uses its original owner, and other SDK callers keep the authInfo path. Each request and redirect resolves credentials again. Revocation fails without an auth fallback. Ordinary credential rejection and transport fallback keep their existing behavior. A digest mismatch removes the file. The result contains file metadata, not archive bytes. The caller must dispose the completed file after use. The download's own requestId controls progress and cancellation. Extensions cannot use this method.
|
|
2288
|
+
*
|
|
2289
|
+
* @param params Which release asset to download, the credential to download it under, and the request id that makes the download cancellable.
|
|
2290
|
+
*
|
|
2291
|
+
* @returns Outcome of an asset download. Each field is present only for the kinds its description names.
|
|
2292
|
+
*/
|
|
2293
|
+
downloadAsset: async (params) => connection.sendRequest("gitHubRelease.downloadAsset", params),
|
|
2294
|
+
/**
|
|
2295
|
+
* Reports how many bytes a running `gitHubRelease.downloadAsset` has written, for a progress display. The runtime sends no progress notification for a download, so a host polls this while the download runs. An id with no running download reports zero bytes and no total, which is the normal answer before the body starts and after the download ends.
|
|
2296
|
+
*
|
|
2297
|
+
* @param params The download whose progress to report.
|
|
2298
|
+
*
|
|
2299
|
+
* @returns Byte progress of a running download.
|
|
2300
|
+
*/
|
|
2301
|
+
getDownloadProgress: async (params) => connection.sendRequest("gitHubRelease.getDownloadProgress", params)
|
|
2302
|
+
},
|
|
2303
|
+
/** @experimental */
|
|
2304
|
+
cloudTasks: {
|
|
2305
|
+
/**
|
|
2306
|
+
* Starts a cloud coding-agent task, the remote run whose record `cloudTasks.get` later reads. Answered above any session because the task it creates is not a background task inside one. Hosts other than the CLI want this: a GitHub App or an SDK consumer that hands work to a cloud agent creates the same task under the same credential, and resolving it here keeps one credential, endpoint and validation path. Target the task either by repository, supplying both `repositoryOwner` and `repositoryName`, or by `owner` alone for an account-level run. The result separates a rejected request from a failed one: when `ok` is false, `reason` categorises the rejection and `message` carries the explanation to show, while `failure` describes the HTTP call itself and is present only when one was actually made.
|
|
2307
|
+
*
|
|
2308
|
+
* @param params Describes the cloud coding-agent task to start and the credential to start it under. Target it either by repository, supplying both `repositoryOwner` and `repositoryName`, or by `owner` alone for an account-level run.
|
|
2309
|
+
*
|
|
2310
|
+
* @returns The outcome of starting a cloud task. A rejected request and a failed one are reported separately: `reason` and `message` describe a request the service declined, while `statusCode` and `errorMessage` describe the HTTP call itself and appear only when one was actually made.
|
|
2311
|
+
*/
|
|
2312
|
+
create: async (params) => connection.sendRequest("cloudTasks.create", params),
|
|
2313
|
+
/**
|
|
2314
|
+
* Deletes one cloud coding-agent task, the remote run `cloudTasks.create` started. The deletion is a soft one: the service withdraws the task from its listings rather than destroying the record, so a host removing a run from its own UI is the intended caller. Answered above any session for the same reason as `cloudTasks.get` -- the task is remote and has no local counterpart. Hosts other than the CLI want this: a GitHub App or an SDK consumer that manages cloud agent runs withdraws the same record under the same credential, and resolving it here keeps one credential-resolution and endpoint path. The runtime resolves each token from `authInfo` or `authContextId`. A host may preserve an explicit `baseUrl`; omission derives the endpoint from `authInfo`. The result is the HTTP outcome rather than a bare success flag: the call returns no body, so `ok` alone describes a success, while a failure is reported through `statusCode`, `errorMessage` and `errorPayloadJson` instead of being raised as an error.
|
|
2315
|
+
*
|
|
2316
|
+
* @param params Identifies one cloud coding-agent task to delete, and the credential to delete it under.
|
|
2317
|
+
*
|
|
2318
|
+
* @returns The HTTP outcome of deleting a cloud task. The deletion returns no body, so a successful call carries nothing beyond `ok`; a failed one is described by the remaining fields rather than raised as an error, so a caller can surface the service's own explanation.
|
|
2319
|
+
*/
|
|
2320
|
+
delete: async (params) => connection.sendRequest("cloudTasks.delete", params),
|
|
2321
|
+
/**
|
|
2322
|
+
* Reads one cloud coding-agent task from the Copilot API. This is the task a cloud agent runs on a host's behalf, not a background task inside a session, so it is answered above any session and the `tasks` group does not cover it. Hosts other than the CLI want this: a GitHub App or an SDK consumer that shows the state of a cloud agent run must read the same task record, and resolving it here keeps one credential-resolution, task-URL and circuit-breaker path instead of each host rebuilding them. The result is the HTTP outcome rather than the task itself: a caller must read `ok` and `statusCode` before `payloadJson`, because a 404 is reported as a non-ok result rather than an error, which is what lets a caller tell "no such task" apart from "the API call failed".
|
|
2323
|
+
*
|
|
2324
|
+
* @param params Identifies one cloud coding-agent task and the credential to read it under.
|
|
2325
|
+
*
|
|
2326
|
+
* @returns The HTTP outcome of reading a cloud task, rather than the task alone. A 404 arrives here as a non-ok result with `statusCode` 404, not as an error, so a caller can tell an absent task apart from a failed call.
|
|
2327
|
+
*/
|
|
2328
|
+
get: async (params) => connection.sendRequest("cloudTasks.get", params),
|
|
2329
|
+
/**
|
|
2330
|
+
* Reads the logs a cloud coding-agent session produced, from the Copilot API. Answered above any session, for the same reason as `cloudTasks.get`: the session being asked about runs remotely and has no local counterpart. Read `resolved` first. It is false when no Copilot API URL could be resolved for the credential, which is a different outcome from a request that was made and failed, and a caller that treats the two alike will report a transport error for an account that simply has no API endpoint. When `resolved` is true, `debugMessages` carries the diagnostics the fetch produced and should be logged whatever the outcome, `errorString` reports a retrieval fault, and only then do `ok` and `statusCode` describe the HTTP result.
|
|
2331
|
+
*
|
|
2332
|
+
* @param params Identifies one cloud coding-agent session whose logs are to be read, and the credential to read them under.
|
|
2333
|
+
*
|
|
2334
|
+
* @returns The outcome of reading a cloud session's logs. `resolved` distinguishes "this credential has no Copilot API endpoint" from "the request was made and failed"; every other field describes a request that was actually attempted.
|
|
2335
|
+
*/
|
|
2336
|
+
getSessionLogs: async (params) => connection.sendRequest("cloudTasks.getSessionLogs", params),
|
|
2337
|
+
/**
|
|
2338
|
+
* Reconstructs the session a cloud coding-agent task recorded, by reading that task's events and ordering them for replay. Answered above any session, for the same reason as `cloudTasks.get`: the session being rebuilt ran remotely and has no local counterpart. Hosts other than the CLI want this: an SDK consumer attaching to a run in progress, an ACP client resuming one, or a GitHub App rendering a task's transcript all rebuild the same history from the same events, and resolving it here keeps one credential, endpoint, ordering and anchor-detection path. A newly created task has no events yet, so this polls for them and fails once they do not arrive. Read `preStart` before either list: when it is true the session has not started, `replayEventsJson` is deliberately empty because there is no history to reconstruct, and only `observedEventsJson` is meaningful.
|
|
2339
|
+
*
|
|
2340
|
+
* @param params Identifies one cloud coding-agent task whose recorded session is to be replayed, and the credential to read it under.
|
|
2341
|
+
*
|
|
2342
|
+
* @returns A cloud task's recorded events, ordered for replay. Read `preStart` first: it selects which of the two event lists a caller should use, and they differ deliberately.
|
|
2343
|
+
*/
|
|
2344
|
+
getSessionReplay: async (params) => connection.sendRequest("cloudTasks.getSessionReplay", params),
|
|
2345
|
+
/**
|
|
2346
|
+
* Reads whether one cloud coding-agent task is shared, from the Mission Control service. Answered above any session, for the same reason as `cloudTasks.get`: the task is a remote record with no local counterpart. Hosts other than the CLI want this: an SDK consumer or a GitHub App that offers a "share this run" affordance must read the same flag from the same service, and resolving it here keeps one credential-resolution and endpoint path. The credential is resolved from `authInfo` inside the runtime rather than being carried across the door, so no caller handles a raw token. Read `credentialResolved` first: it is false when the account has no usable credential, in which case no request was made at all, which a caller must not report as a failed request.
|
|
2347
|
+
*
|
|
2348
|
+
* @param params Identifies one cloud coding-agent task whose sharing status is to be read, and the credential to read it under.
|
|
2349
|
+
*
|
|
2350
|
+
* @returns The sharing status a cloud task carries after the call. Read `credentialResolved` first: when it is false no request was attempted at all, which is a different outcome from a request the service declined.
|
|
2351
|
+
*/
|
|
2352
|
+
getSharingStatus: async (params) => connection.sendRequest("cloudTasks.getSharingStatus", params),
|
|
2353
|
+
/**
|
|
2354
|
+
* Changes whether one cloud coding-agent task is shared, through the Mission Control service, and reports the status the task carries afterwards. The companion to `cloudTasks.getSharingStatus` and answered above any session for the same reason. The status is sent verbatim and is not narrowed to a closed set, because the service owns these values. The credential is resolved from `authInfo` inside the runtime rather than being carried across the door. Read `credentialResolved` first: it is false when the account has no usable credential, in which case nothing was changed and no request was made.
|
|
2355
|
+
*
|
|
2356
|
+
* @param params Identifies one cloud coding-agent task whose sharing status is to be changed, the status to set, and the credential to change it under.
|
|
2357
|
+
*
|
|
2358
|
+
* @returns The sharing status a cloud task carries after the call. Read `credentialResolved` first: when it is false no request was attempted at all, which is a different outcome from a request the service declined.
|
|
2359
|
+
*/
|
|
2360
|
+
setSharingStatus: async (params) => connection.sendRequest("cloudTasks.setSharingStatus", params),
|
|
2361
|
+
/**
|
|
2362
|
+
* Finds the session a caller should open for one cloud coding-agent task. A task identifier alone does not say what to open: the run may already exist locally, it may exist only in the cloud, or it may be a task that cannot be resumed at all. Resolving that needs a local session scan and a Mission Control lookup that agree on identity, which is why it is answered here rather than left to each host. Hosts other than the CLI want it: an IDE or a GitHub App that opens a run from a task link faces the same three outcomes. Read `kind` before any other field. `local-session` carries `sessionId`, `remote-session` carries `metadataJson`, `unresumable-task` means the task exists but cannot be continued, and `none` means no session matched. A failed service call is reported as `error` rather than raised, so a caller can surface the service's own message. Pass every local session identifier already rejected in `ignoredLocalSessionIds` and call again to get the next candidate; that is how a host skips a local session it could not load.
|
|
2363
|
+
*
|
|
2364
|
+
* @param params Identifies one cloud coding-agent task to resolve to an openable session, the credential to resolve it under, and the local candidates the caller has already rejected.
|
|
2365
|
+
*
|
|
2366
|
+
* @returns What a caller should open for the task. The four outcomes are distinct and carry different payloads, so read `kind` before any other field.
|
|
2367
|
+
*/
|
|
2368
|
+
resolveTaskId: async (params) => connection.sendRequest("cloudTasks.resolveTaskId", params)
|
|
2369
|
+
},
|
|
2370
|
+
/** @experimental */
|
|
2371
|
+
cafeMetrics: {
|
|
2372
|
+
/**
|
|
2373
|
+
* Starts anonymous CAFE metrics for this process. The runtime selects the endpoint from COPILOT_CAFE_METRICS_URL or this connection's original auth owner. Offline and unsupported platforms refuse startup. Release eligibility must resolve before samples are sent. Requires the private trusted CLI host capability.
|
|
2374
|
+
*
|
|
2375
|
+
* @param params Versions and provider configuration for CAFE.
|
|
2376
|
+
*
|
|
2377
|
+
* @returns CAFE startup result.
|
|
2378
|
+
*/
|
|
2379
|
+
start: async (params) => connection.sendRequest("cafeMetrics.start", params),
|
|
2380
|
+
/**
|
|
2381
|
+
* Resolves release eligibility once from the immutable release lookup shared with auto-update. Requires the private trusted CLI host capability.
|
|
2382
|
+
*
|
|
2383
|
+
* @param params Immutable release lookup result.
|
|
2384
|
+
*
|
|
2385
|
+
* @returns Admission result.
|
|
2386
|
+
*/
|
|
2387
|
+
resolveAdmission: async (params) => connection.sendRequest("cafeMetrics.resolveAdmission", params),
|
|
2388
|
+
/**
|
|
2389
|
+
* Records one terminal resume result. Does nothing before startup. Requires the private trusted CLI host capability.
|
|
2390
|
+
*
|
|
2391
|
+
* @param params Terminal result of one resume attempt.
|
|
2392
|
+
*/
|
|
2393
|
+
recordResumeResult: async (params) => connection.sendRequest("cafeMetrics.recordResumeResult", params),
|
|
2394
|
+
/**
|
|
2395
|
+
* Stops recording and drains within one 1.5-second deadline. flushOnly sends at most one batch without stopping recording. Requires the private trusted CLI host capability.
|
|
2396
|
+
*
|
|
2397
|
+
* @param params Preliminary flush or final disposal.
|
|
2398
|
+
*/
|
|
2399
|
+
shutdown: async (params) => connection.sendRequest("cafeMetrics.shutdown", params)
|
|
2172
2400
|
}
|
|
2173
2401
|
};
|
|
2174
2402
|
}
|
|
2175
2403
|
function createSessionRpc(connection, sessionId) {
|
|
2176
2404
|
return {
|
|
2405
|
+
/** @experimental */
|
|
2406
|
+
management: {
|
|
2407
|
+
/**
|
|
2408
|
+
* Updates opt-in session management policy live. Enabling the master enables all tools before applying individual overrides. Opt-in is scoped to the session's configuration directory.
|
|
2409
|
+
*
|
|
2410
|
+
* @param params Updates the session's live policy without changing persistent host settings.
|
|
2411
|
+
*
|
|
2412
|
+
* @returns Opt-in policy for local session management.
|
|
2413
|
+
*/
|
|
2414
|
+
configure: async (params) => connection.sendRequest("session.management.configure", { ...params, sessionId }),
|
|
2415
|
+
/**
|
|
2416
|
+
* Lists other live, opted-in sessions in the same configuration directory. Requires the list tool to be enabled.
|
|
2417
|
+
*
|
|
2418
|
+
* @param params Lists opted-in local peers. The caller is omitted.
|
|
2419
|
+
*
|
|
2420
|
+
* @returns Eligible live peers reported by their owning runtimes.
|
|
2421
|
+
*/
|
|
2422
|
+
list: async (params) => connection.sendRequest("session.management.list", { ...params, sessionId }),
|
|
2423
|
+
/**
|
|
2424
|
+
* Injects peer text into an opted-in session. Wakes an idle agent and safely queues delivery to a busy agent. Acceptance does not imply an answer or completed task.
|
|
2425
|
+
*
|
|
2426
|
+
* @param params Sends peer text, never human approval, to another opted-in session.
|
|
2427
|
+
*
|
|
2428
|
+
* @returns Acceptance is not a completed turn or a reply.
|
|
2429
|
+
*/
|
|
2430
|
+
message: async (params) => connection.sendRequest("session.management.message", { ...params, sessionId }),
|
|
2431
|
+
/**
|
|
2432
|
+
* Asks the owning host to create and supervise a separate session, preserving permissions and model restrictions. Omitted model, reasoning effort, context tier and cwd inherit the caller's current values; explicit overrides use normal model validation and workspace trust. Records durable creation lineage before delivering the initial task as peer text. Returns the new session ID, not task completion. Requires the create tool and a host creation handler.
|
|
2433
|
+
*
|
|
2434
|
+
* @param params Requests a separate session. Omitted launch options inherit the caller's current configuration.
|
|
2435
|
+
*
|
|
2436
|
+
* @returns Identifies a session owned and supervised by the creating host.
|
|
2437
|
+
*/
|
|
2438
|
+
create: async (params) => connection.sendRequest("session.management.create", { ...params, sessionId }),
|
|
2439
|
+
/**
|
|
2440
|
+
* Closes a live opted-in session created by the caller or one of its descendants, preserving saved history and leaving descendants open. Requires the close capability to be enabled. Self, ancestors, siblings and unrelated sessions cannot be closed.
|
|
2441
|
+
*
|
|
2442
|
+
* @param params Closes one live opted-in descendant without deleting its saved history or closing its children.
|
|
2443
|
+
*
|
|
2444
|
+
* @returns Completion of the existing non-deleting close lifecycle.
|
|
2445
|
+
*/
|
|
2446
|
+
close: async (params) => connection.sendRequest("session.management.close", { ...params, sessionId })
|
|
2447
|
+
},
|
|
2177
2448
|
/** @experimental */
|
|
2178
2449
|
providers: {
|
|
2179
2450
|
/**
|
|
@@ -2357,7 +2628,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
2357
2628
|
/** @experimental */
|
|
2358
2629
|
login: {
|
|
2359
2630
|
/**
|
|
2360
|
-
* Begin an interactive login flow for a provider kind (
|
|
2631
|
+
* Begin an interactive login flow for a provider kind, optionally selecting how to authorize (`method`: `web` by default, or `device-code`), and return its opaque flow id and first step.
|
|
2361
2632
|
*
|
|
2362
2633
|
* @param params Begin an interactive login flow for a provider kind, optionally reusing a cached base identity or explicitly requesting provider account selection.
|
|
2363
2634
|
*
|
|
@@ -2369,7 +2640,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
2369
2640
|
*
|
|
2370
2641
|
* @param params Advance an in-flight login flow, optionally fulfilling an input-required step.
|
|
2371
2642
|
*
|
|
2372
|
-
* @returns One step in an interactive login flow. The consumer acts on the step and calls advance to proceed. Browser-open is encoded as two distinct steps by design: `open-url` is CONSUMER-driven (the provider surfaces the authorize URL and the consumer opens it — github.com/GHEC web), while `needs-interaction` is PROVIDER-driven (the provider opens the browser or broker UI itself and does not surface a URL — Entra).
|
|
2643
|
+
* @returns One step in an interactive login flow. The consumer acts on the step and calls advance to proceed. Browser-open is encoded as two distinct steps by design: `open-url` is CONSUMER-driven (the provider surfaces the authorize URL and the consumer opens it — github.com/GHEC web), while `needs-interaction` is PROVIDER-driven (the provider opens the browser or broker UI itself and does not surface a URL — Entra). A device-code flow surfaces its one-time code as `device-code`; the consumer shows the code, may open the verification URI, and calls advance, which resolves once the user has authorized the device.
|
|
2373
2644
|
*/
|
|
2374
2645
|
advance: async (params) => connection.sendRequest("session.accounts.login.advance", { ...params, sessionId }),
|
|
2375
2646
|
/**
|
|
@@ -2811,7 +3082,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
2811
3082
|
*
|
|
2812
3083
|
* @returns Canonical runtime state for the session's current autopilot objective.
|
|
2813
3084
|
*/
|
|
2814
|
-
getState: async () => connection.sendRequest("session.autopilotObjective.getState", { sessionId })
|
|
3085
|
+
getState: async () => connection.sendRequest("session.autopilotObjective.getState", { sessionId }),
|
|
3086
|
+
/**
|
|
3087
|
+
* Sets whether completing or pausing this session's objective preserves autopilot mode. This in-memory preference defaults to true and must be reapplied when attaching a client.
|
|
3088
|
+
*
|
|
3089
|
+
* @param params Client-resolved preference for retaining autopilot mode after objective completion or pause.
|
|
3090
|
+
*/
|
|
3091
|
+
setStayInAutopilot: async (params) => connection.sendRequest("session.autopilotObjective.setStayInAutopilot", { ...params, sessionId })
|
|
2815
3092
|
},
|
|
2816
3093
|
/** @experimental */
|
|
2817
3094
|
completions: {
|
|
@@ -3551,6 +3828,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3551
3828
|
* @returns The selectable model entries and selection ids synthesized for the synchronized BYOK models.
|
|
3552
3829
|
*/
|
|
3553
3830
|
sync: async (params) => connection.sendRequest("session.provider.sync", { ...params, sessionId }),
|
|
3831
|
+
/**
|
|
3832
|
+
* Returns credential-free provider configuration status for the selected model. This does not validate provider credentials or contact the provider.
|
|
3833
|
+
*
|
|
3834
|
+
* @returns Credential-free provider configuration status for the selected model.
|
|
3835
|
+
*/
|
|
3836
|
+
getStatus: async () => connection.sendRequest("session.provider.getStatus", { sessionId }),
|
|
3554
3837
|
/**
|
|
3555
3838
|
* Withdraws named host-managed models from the session's BYOK registry, leaving every other entry untouched. The scoped counterpart to `provider.sync`: a snapshot can only describe entries the caller knows about, so using it to remove one model silently withdraws rows registered by another source, such as a plugin calling `provider.add` at runtime. Naming what to remove leaves unrelated entries alone. Selection ids that are not registered are ignored, so withdrawal is idempotent. A provider is removed only when one of the withdrawn models was the last entry referencing it; a provider that simply has no models, which is the normal state while its rows are supplied by catalog discovery, is left in place.
|
|
3556
3839
|
*
|
|
@@ -3891,6 +4174,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3891
4174
|
* @returns Current permission mode.
|
|
3892
4175
|
*/
|
|
3893
4176
|
getMode: async () => connection.sendRequest("session.permissions.getMode", { sessionId }),
|
|
4177
|
+
/**
|
|
4178
|
+
* Returns the approval modes currently available under the session's feature and managed permission policy. This read does not change permissions; mutations must still check their authoritative result because policy may change.
|
|
4179
|
+
*
|
|
4180
|
+
* @returns Available permission modes, derived from current session policy.
|
|
4181
|
+
*/
|
|
4182
|
+
getCapabilities: async () => connection.sendRequest("session.permissions.getCapabilities", { sessionId }),
|
|
3894
4183
|
/**
|
|
3895
4184
|
* Adds or removes session-scoped or location-scoped permission rules.
|
|
3896
4185
|
*
|
|
@@ -4211,6 +4500,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
4211
4500
|
* @returns Indicates whether an in-progress background compaction was cancelled.
|
|
4212
4501
|
*/
|
|
4213
4502
|
cancelBackgroundCompaction: async () => connection.sendRequest("session.history.cancelBackgroundCompaction", { sessionId }),
|
|
4503
|
+
/**
|
|
4504
|
+
* Replaces this local session's compaction settings: the model, prompt and reasoning effort its automatic and manual compactions use. Each call replaces all three: an omitted field returns to its default. Settings are held in memory only, so re-apply them after resuming the session in a new process. A change applies to compactions that start afterwards, except that automatic compactions keep the model the running turn already chose for them until that turn ends; a compaction already in progress may still pick up a new reasoning effort. Rejects on a remote session.
|
|
4505
|
+
*
|
|
4506
|
+
* @param params Compaction settings for this session. Each call replaces the previous settings: an omitted field returns to its default. Settings live in memory until the session ends; re-apply them after resuming a session in a new process.
|
|
4507
|
+
*/
|
|
4508
|
+
setCompactionConfig: async (params) => connection.sendRequest("session.history.setCompactionConfig", { ...params, sessionId }),
|
|
4214
4509
|
/**
|
|
4215
4510
|
* Aborts any in-progress manual compaction on a local session.
|
|
4216
4511
|
*
|
|
@@ -4548,6 +4843,15 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
4548
4843
|
}
|
|
4549
4844
|
},
|
|
4550
4845
|
/** @experimental */
|
|
4846
|
+
canvasSource: {
|
|
4847
|
+
/**
|
|
4848
|
+
* Closes a canvas through its original session source. Requires the privately admitted in-process CLI host.
|
|
4849
|
+
*
|
|
4850
|
+
* @param params Closes a canvas through its original owned or attached session namespace.
|
|
4851
|
+
*/
|
|
4852
|
+
close: async (params) => connection.sendRequest("session.canvasSource.close", { ...params, sessionId })
|
|
4853
|
+
},
|
|
4854
|
+
/** @experimental */
|
|
4551
4855
|
workflow: {
|
|
4552
4856
|
/**
|
|
4553
4857
|
* Internal tool-originated dynamic workflow invocation.
|
|
@@ -4843,6 +5147,17 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
4843
5147
|
* @returns Result of registering or re-arming a scheduled prompt.
|
|
4844
5148
|
*/
|
|
4845
5149
|
rearmSelfPaced: async (params) => connection.sendRequest("session.schedule.rearmSelfPaced", { ...params, sessionId })
|
|
5150
|
+
},
|
|
5151
|
+
/** @experimental */
|
|
5152
|
+
cafeMetrics: {
|
|
5153
|
+
/**
|
|
5154
|
+
* Records live model-call events, including subagents, and root compaction events. Replaces any earlier recorder. Requires the private trusted CLI host capability.
|
|
5155
|
+
*/
|
|
5156
|
+
attach: async () => connection.sendRequest("session.cafeMetrics.attach", { sessionId }),
|
|
5157
|
+
/**
|
|
5158
|
+
* Stops recording this session. Does nothing if it has no recorder. Requires the private trusted CLI host capability.
|
|
5159
|
+
*/
|
|
5160
|
+
detach: async () => connection.sendRequest("session.cafeMetrics.detach", { sessionId })
|
|
4846
5161
|
}
|
|
4847
5162
|
};
|
|
4848
5163
|
}
|
package/dist/cjs/session.js
CHANGED
|
@@ -170,6 +170,11 @@ class WorkflowProgressBuffer {
|
|
|
170
170
|
if (this.closed) {
|
|
171
171
|
throw new Error("Cannot log after the workflow run has settled");
|
|
172
172
|
}
|
|
173
|
+
if (typeof text !== "string") {
|
|
174
|
+
throw new TypeError(
|
|
175
|
+
`${kind}() expects a string; got ${text === null ? "null" : typeof text}.`
|
|
176
|
+
);
|
|
177
|
+
}
|
|
173
178
|
this.pending.push({ seq: this.nextSeq++, kind, text });
|
|
174
179
|
this.scheduleFlush();
|
|
175
180
|
}
|
|
@@ -297,6 +302,7 @@ class CopilotSession {
|
|
|
297
302
|
/** Settles once every earlier `setTools` call has finished. */
|
|
298
303
|
setToolsQueue = Promise.resolve();
|
|
299
304
|
pendingExternalTools = /* @__PURE__ */ new Map();
|
|
305
|
+
pendingSessionCreations = /* @__PURE__ */ new Set();
|
|
300
306
|
canvases = /* @__PURE__ */ new Map();
|
|
301
307
|
bearerTokenProviders = /* @__PURE__ */ new Map();
|
|
302
308
|
commandHandlers = /* @__PURE__ */ new Map();
|
|
@@ -309,6 +315,7 @@ class CopilotSession {
|
|
|
309
315
|
exitPlanModeHandler;
|
|
310
316
|
autoModeSwitchHandler;
|
|
311
317
|
skillProvider;
|
|
318
|
+
sessionCreationHandler;
|
|
312
319
|
hooks;
|
|
313
320
|
transformCallbacks;
|
|
314
321
|
_rpc = null;
|
|
@@ -896,6 +903,10 @@ class CopilotSession {
|
|
|
896
903
|
controller.abort();
|
|
897
904
|
}
|
|
898
905
|
this.pendingExternalTools.clear();
|
|
906
|
+
for (const controller of this.pendingSessionCreations) {
|
|
907
|
+
controller.abort();
|
|
908
|
+
}
|
|
909
|
+
this.pendingSessionCreations.clear();
|
|
899
910
|
this.eventHandlers.clear();
|
|
900
911
|
this.typedEventHandlers.clear();
|
|
901
912
|
this.toolHandlers.clear();
|
|
@@ -906,6 +917,7 @@ class CopilotSession {
|
|
|
906
917
|
this.exitPlanModeHandler = void 0;
|
|
907
918
|
this.autoModeSwitchHandler = void 0;
|
|
908
919
|
this.skillProvider = void 0;
|
|
920
|
+
this.sessionCreationHandler = void 0;
|
|
909
921
|
this.hooks = void 0;
|
|
910
922
|
this.traceContextProvider = void 0;
|
|
911
923
|
this.bearerTokenProviders.clear();
|
|
@@ -1165,6 +1177,13 @@ class CopilotSession {
|
|
|
1165
1177
|
} else if (typeof rawResult === "string") {
|
|
1166
1178
|
result = rawResult;
|
|
1167
1179
|
} else if (isToolResultObject(rawResult)) {
|
|
1180
|
+
try {
|
|
1181
|
+
JSON.stringify(rawResult.toolTelemetry);
|
|
1182
|
+
} catch (error) {
|
|
1183
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1184
|
+
throw new Error(`failed to serialize tool telemetry: ${message}`);
|
|
1185
|
+
}
|
|
1186
|
+
JSON.stringify(rawResult);
|
|
1168
1187
|
result = rawResult;
|
|
1169
1188
|
} else {
|
|
1170
1189
|
result = JSON.stringify(rawResult);
|
|
@@ -1177,7 +1196,10 @@ class CopilotSession {
|
|
|
1177
1196
|
if (!this._claimExternalTool(requestId, controller)) {
|
|
1178
1197
|
return;
|
|
1179
1198
|
}
|
|
1180
|
-
|
|
1199
|
+
let message = error instanceof Error ? error.message : String(error);
|
|
1200
|
+
if (!message) {
|
|
1201
|
+
message = error instanceof Error && error.name || "Error";
|
|
1202
|
+
}
|
|
1181
1203
|
try {
|
|
1182
1204
|
await this.rpc.tools.handlePendingToolCall({ requestId, error: message });
|
|
1183
1205
|
} catch (rpcError) {
|
|
@@ -1575,6 +1597,7 @@ class CopilotSession {
|
|
|
1575
1597
|
assertWorkflowResult(result);
|
|
1576
1598
|
return { result };
|
|
1577
1599
|
} finally {
|
|
1600
|
+
controller.abort(new DOMException("Workflow run has settled", "AbortError"));
|
|
1578
1601
|
try {
|
|
1579
1602
|
await progress.close();
|
|
1580
1603
|
} finally {
|
|
@@ -1869,6 +1892,41 @@ class CopilotSession {
|
|
|
1869
1892
|
this.assertConnected();
|
|
1870
1893
|
this.skillProvider = provider;
|
|
1871
1894
|
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Registers the host's creation callback without enabling the tool group.
|
|
1897
|
+
* Enable it separately with `session.rpc.management.configure({ enabled: true })`.
|
|
1898
|
+
*/
|
|
1899
|
+
async setSessionCreationHandler(handler) {
|
|
1900
|
+
this.assertConnected();
|
|
1901
|
+
const previous = this.sessionCreationHandler;
|
|
1902
|
+
this.sessionCreationHandler = handler;
|
|
1903
|
+
try {
|
|
1904
|
+
return await this.rpc.management.configure({ hasCreateHandler: handler !== void 0 });
|
|
1905
|
+
} catch (error) {
|
|
1906
|
+
if (this.sessionCreationHandler === handler) this.sessionCreationHandler = previous;
|
|
1907
|
+
throw error;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
/** @internal */
|
|
1911
|
+
async _handleSessionManagementCreate(request, token) {
|
|
1912
|
+
this.assertConnected();
|
|
1913
|
+
const handler = this.sessionCreationHandler;
|
|
1914
|
+
if (!handler || request.parentSessionId !== this.sessionId || request.sessionId !== this.sessionId) {
|
|
1915
|
+
throw new Error("Session creation handler is unavailable");
|
|
1916
|
+
}
|
|
1917
|
+
const controller = new AbortController();
|
|
1918
|
+
this.pendingSessionCreations.add(controller);
|
|
1919
|
+
const subscription = token.onCancellationRequested(() => controller.abort());
|
|
1920
|
+
if (token.isCancellationRequested) controller.abort();
|
|
1921
|
+
try {
|
|
1922
|
+
return await handler(request, { signal: controller.signal });
|
|
1923
|
+
} catch {
|
|
1924
|
+
throw new Error("Session creation callback failed");
|
|
1925
|
+
} finally {
|
|
1926
|
+
subscription.dispose();
|
|
1927
|
+
this.pendingSessionCreations.delete(controller);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1872
1930
|
/**
|
|
1873
1931
|
* Handles a `skillProvider.list` request from the runtime.
|
|
1874
1932
|
*
|
package/dist/cjs/types.js
CHANGED
|
@@ -71,11 +71,9 @@ const RuntimeConnection = {
|
|
|
71
71
|
/**
|
|
72
72
|
* Host the runtime in-process over the native runtime library's C ABI (FFI).
|
|
73
73
|
*
|
|
74
|
-
* @experimental
|
|
75
|
-
* `
|
|
76
|
-
*
|
|
77
|
-
* corresponding environment variables on the host process instead. See
|
|
78
|
-
* https://github.com/github/copilot-sdk/issues/1934.
|
|
74
|
+
* @experimental Runtime configuration from `gitHubToken` and
|
|
75
|
+
* `baseDirectory` is scoped to this host, not the process environment.
|
|
76
|
+
* Client-level `env`, `telemetry` and `workingDirectory` are unsupported.
|
|
79
77
|
*/
|
|
80
78
|
forInProcess(options = {}) {
|
|
81
79
|
return { kind: "inprocess", ...options };
|
package/dist/cliVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COPILOT_CLI_VERSION = "1.0.106-
|
|
1
|
+
export declare const COPILOT_CLI_VERSION = "1.0.106-11";
|
|
2
2
|
export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
|
package/dist/cliVersion.js
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -38,7 +38,6 @@ export declare class CopilotClient {
|
|
|
38
38
|
private onListModels?;
|
|
39
39
|
private onGetTraceContext?;
|
|
40
40
|
private modelsCache;
|
|
41
|
-
private modelsCacheLock;
|
|
42
41
|
private sessionLifecycleHandlers;
|
|
43
42
|
private typedLifecycleHandlers;
|
|
44
43
|
private _rpc;
|
|
@@ -140,12 +139,17 @@ export declare class CopilotClient {
|
|
|
140
139
|
* Stops the CLI server and closes all active sessions.
|
|
141
140
|
*
|
|
142
141
|
* This method performs graceful cleanup:
|
|
143
|
-
* 1. Closes all active sessions (releases in-memory resources)
|
|
142
|
+
* 1. Closes all active sessions (releases in-memory resources); detach
|
|
143
|
+
* requests share one shutdown timeout
|
|
144
144
|
* 2. Requests runtime shutdown for SDK-owned CLI processes
|
|
145
145
|
* 3. Closes the JSON-RPC connection
|
|
146
146
|
* 4. Signals EOF to an owned stdio process and waits for host cleanup, then
|
|
147
147
|
* terminates the process if it does not exit within the shutdown timeout
|
|
148
148
|
*
|
|
149
|
+
* In-process connections first abort active turns without a timeout. That
|
|
150
|
+
* step is outside the detach deadline, so in-process stop() can still wait
|
|
151
|
+
* indefinitely if the runtime stops answering abort requests.
|
|
152
|
+
*
|
|
149
153
|
* Note: session data on disk is preserved, so sessions can be resumed later.
|
|
150
154
|
* To permanently remove session data before stopping, call
|
|
151
155
|
* {@link deleteSession} for each session first.
|
|
@@ -470,11 +474,8 @@ export declare class CopilotClient {
|
|
|
470
474
|
*/
|
|
471
475
|
onLifecycle(handler: SessionLifecycleHandler): () => void;
|
|
472
476
|
/**
|
|
473
|
-
* Builds
|
|
474
|
-
*
|
|
475
|
-
* variables on top of the effective env. Not used by the in-process (FFI) transport,
|
|
476
|
-
* whose worker inherits the host process's ambient environment
|
|
477
|
-
* (see {@link CopilotClient.startInProcessFfi}).
|
|
477
|
+
* Builds runtime configuration for child processes and the per-host FFI snapshot.
|
|
478
|
+
* Typed auth, home, keychain, and telemetry options override the effective env.
|
|
478
479
|
*/
|
|
479
480
|
private buildRuntimeEnv;
|
|
480
481
|
/**
|