@github/copilot-sdk 1.0.23-preview.0 → 1.0.23-preview.2
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 +9 -5
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/generated/rpc.js +25 -1
- package/dist/cjs/session.js +8 -6
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/generated/rpc.d.ts +705 -94
- package/dist/generated/rpc.js +25 -1
- package/dist/generated/session-events.d.ts +110 -0
- package/dist/session.js +8 -6
- package/dist/types.d.ts +20 -6
- package/package.json +22 -14
package/README.md
CHANGED
|
@@ -128,11 +128,13 @@ await using host = await client.startAhpHost({
|
|
|
128
128
|
...config,
|
|
129
129
|
onPermissionRequest: approveAll,
|
|
130
130
|
systemMessage: { mode: "append", content: "Use the app's greeting tool." },
|
|
131
|
-
tools: [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
tools: [
|
|
132
|
+
defineTool("greeting", {
|
|
133
|
+
description: "Get the application's greeting",
|
|
134
|
+
parameters: { type: "object", properties: {} },
|
|
135
|
+
handler: () => "Hello from the application!",
|
|
136
|
+
}),
|
|
137
|
+
],
|
|
136
138
|
});
|
|
137
139
|
},
|
|
138
140
|
onSessionReleased: async (originalSession) => {
|
|
@@ -1353,6 +1355,8 @@ Inbound trace context from the CLI is available on the `ToolInvocation` object p
|
|
|
1353
1355
|
|
|
1354
1356
|
An `onPermissionRequest` handler is optional when you create or resume a session. When provided, it is called before the agent executes each tool (file writes, shell commands, custom tools, etc.) and returns a decision. When omitted, permission requests are emitted as events and left pending for the consumer to resolve with the pending permission RPC.
|
|
1355
1357
|
|
|
1358
|
+
Callbacks receive optional derived prompt context as `invocation.promptRequest`. The raw request's `managedApprovalRequired` remains managed-policy provenance and enforces one-shot restrictions. Only derived `commands`, `read`, `write`, `url`, and `workflow` prompts can clear the human requirement after Assisted approval; for missing or other prompt kinds, keep the raw marker authoritative.
|
|
1359
|
+
|
|
1356
1360
|
### Approve All (simplest)
|
|
1357
1361
|
|
|
1358
1362
|
Use the built-in `approveAll` helper when managed settings are disabled:
|
package/dist/cjs/cliVersion.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(cliVersion_exports, {
|
|
|
22
22
|
COPILOT_CLI_VERSION: () => COPILOT_CLI_VERSION
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(cliVersion_exports);
|
|
25
|
-
const COPILOT_CLI_VERSION = "1.0.99-
|
|
25
|
+
const COPILOT_CLI_VERSION = "1.0.99-2";
|
|
26
26
|
const COPILOT_CLI_USE_NPM_PACKAGE = false;
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
|
@@ -761,6 +761,22 @@ function createServerRpc(connection) {
|
|
|
761
761
|
* @returns Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success.
|
|
762
762
|
*/
|
|
763
763
|
search: async (params) => connection.sendRequest("catalog.search", params),
|
|
764
|
+
/**
|
|
765
|
+
* 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.
|
|
766
|
+
*
|
|
767
|
+
* @param params Retrieves one saved feed by its opaque ID. Requires catalog-feeds and catalog-search-credential-required; add catalog-search-session-bound with policySessionId to retain the selected session's authority for installation, exactly as for catalog.search.
|
|
768
|
+
*
|
|
769
|
+
* @returns Outcome of catalog.getSavedFeed: the feed with its entries, or one typed refusal. An entry that cannot be presented never fails the feed.
|
|
770
|
+
*/
|
|
771
|
+
getSavedFeed: async (params) => connection.sendRequest("catalog.getSavedFeed", params),
|
|
772
|
+
/**
|
|
773
|
+
* Retrieves one generated feed by strategy and key, such as telemetry/popular, 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.
|
|
774
|
+
*
|
|
775
|
+
* @param params Retrieves one generated feed, computed on every request, by strategy and key, such as `telemetry` and `popular`. Requires catalog-feeds and catalog-search-credential-required; add catalog-search-session-bound with policySessionId to retain the selected session's authority for installation, exactly as for catalog.search.
|
|
776
|
+
*
|
|
777
|
+
* @returns Outcome of catalog.getGeneratedFeed: the feed with its entries, or one typed refusal. An entry that cannot be presented never fails the feed.
|
|
778
|
+
*/
|
|
779
|
+
getGeneratedFeed: async (params) => connection.sendRequest("catalog.getGeneratedFeed", params),
|
|
764
780
|
/**
|
|
765
781
|
* Terminates one retained catalog selection group. A selected outcome returns the native host a fresh single-use candidate handle plus the original searchId for a later explicit mcp.planInstall call; non-selected outcomes release the group without producing a planning input. Candidate state, cards, URLs, credentials and private identifiers remain inside the runtime. The model-facing catalog_select tool projects the result separately and never exposes the candidate handle or searchId.
|
|
766
782
|
*
|
|
@@ -2156,7 +2172,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
2156
2172
|
/**
|
|
2157
2173
|
* Begin an interactive login flow for a provider kind (dispatch is kind-only) and return its opaque flow id and first step.
|
|
2158
2174
|
*
|
|
2159
|
-
* @param params Begin an interactive login flow for a provider kind
|
|
2175
|
+
* @param params Begin an interactive login flow for a provider kind, optionally reusing a cached base identity or explicitly requesting provider account selection.
|
|
2160
2176
|
*
|
|
2161
2177
|
* @returns A started login flow: its opaque id and first step.
|
|
2162
2178
|
*/
|
|
@@ -2755,6 +2771,14 @@ function createSessionRpc(connection, sessionId) {
|
|
|
2755
2771
|
* @returns Progress information for the task, or null when no task with that ID is tracked.
|
|
2756
2772
|
*/
|
|
2757
2773
|
getProgress: async (params) => connection.sendRequest("session.tasks.getProgress", { ...params, sessionId }),
|
|
2774
|
+
/**
|
|
2775
|
+
* Reads a detached shell task's output after a cursor, optionally waiting for new output or for the shell to finish.
|
|
2776
|
+
*
|
|
2777
|
+
* @param params Detached shell task to read output from, with an optional cursor and long-poll wait. waitMs defaults to zero (maximum 30000).
|
|
2778
|
+
*
|
|
2779
|
+
* @returns Output a detached shell task wrote after the request cursor, with the cursor for the next read.
|
|
2780
|
+
*/
|
|
2781
|
+
readOutput: async (params) => connection.sendRequest("session.tasks.readOutput", { ...params, sessionId }),
|
|
2758
2782
|
/**
|
|
2759
2783
|
* Returns the first sync-waiting task that can currently be promoted to background mode.
|
|
2760
2784
|
*
|
package/dist/cjs/session.js
CHANGED
|
@@ -843,12 +843,12 @@ class CopilotSession {
|
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
845
|
} else if (event.type === "permission.requested") {
|
|
846
|
-
const { requestId, permissionRequest, resolvedByHook } = event.data;
|
|
846
|
+
const { requestId, permissionRequest, promptRequest, resolvedByHook } = event.data;
|
|
847
847
|
if (resolvedByHook) {
|
|
848
848
|
return;
|
|
849
849
|
}
|
|
850
850
|
if (this.permissionHandler) {
|
|
851
|
-
void this._executePermissionAndRespond(requestId, permissionRequest);
|
|
851
|
+
void this._executePermissionAndRespond(requestId, permissionRequest, promptRequest);
|
|
852
852
|
}
|
|
853
853
|
} else if (event.type === "mcp.oauth_required") {
|
|
854
854
|
const data = event.data;
|
|
@@ -1007,12 +1007,14 @@ class CopilotSession {
|
|
|
1007
1007
|
* Executes a permission handler and sends the result back via RPC.
|
|
1008
1008
|
* @internal
|
|
1009
1009
|
*/
|
|
1010
|
-
async _executePermissionAndRespond(requestId, permissionRequest) {
|
|
1010
|
+
async _executePermissionAndRespond(requestId, permissionRequest, promptRequest) {
|
|
1011
1011
|
try {
|
|
1012
|
-
const
|
|
1012
|
+
const invocation = {
|
|
1013
1013
|
sessionId: this.sessionId,
|
|
1014
|
-
managedSettingsEnabled: this.managedSettingsEnabled
|
|
1015
|
-
|
|
1014
|
+
managedSettingsEnabled: this.managedSettingsEnabled,
|
|
1015
|
+
...promptRequest === void 0 ? {} : { promptRequest }
|
|
1016
|
+
};
|
|
1017
|
+
const handlerResult = await this.permissionHandler(permissionRequest, invocation);
|
|
1016
1018
|
const isAttributed = (0, import_types.isAttributedPermissionResult)(handlerResult);
|
|
1017
1019
|
const result = isAttributed ? handlerResult.result : handlerResult;
|
|
1018
1020
|
const decisionContext = isAttributed ? handlerResult.decisionContext : void 0;
|
package/dist/cliVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COPILOT_CLI_VERSION = "1.0.99-
|
|
1
|
+
export declare const COPILOT_CLI_VERSION = "1.0.99-2";
|
|
2
2
|
export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
|
package/dist/cliVersion.js
CHANGED