@github/copilot-sdk 1.0.9-preview.2 → 1.0.9-preview.3

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/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  import type { Canvas } from "./canvas.js";
5
5
  import type { SessionFsProvider } from "./sessionFsProvider.js";
6
6
  import type { CopilotRequestHandler } from "./copilotRequestHandler.js";
7
- import type { ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
7
+ import type { PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
8
8
  import type { CopilotSession } from "./session.js";
9
9
  import type { GitHubTelemetryNotification, ModelBillingTokenPrices, OpenCanvasInstance, RemoteSessionMode, CurrentToolMetadata } from "./generated/rpc.js";
10
10
  import type { ToolSet } from "./toolSet.js";
@@ -12,7 +12,9 @@ export type { RemoteSessionMode } from "./generated/rpc.js";
12
12
  export type { CurrentToolMetadata } from "./generated/rpc.js";
13
13
  export type { GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, } from "./generated/rpc.js";
14
14
  export type { ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, } from "./generated/rpc.js";
15
- export type SessionEvent = GeneratedSessionEvent;
15
+ export type SessionEvent = Exclude<GeneratedSessionEvent, {
16
+ type: "permission.requested";
17
+ }> | PermissionRequestedEvent;
16
18
  export type { ReasoningSummary } from "./generated/session-events.js";
17
19
  export type { SessionFsProvider } from "./sessionFsProvider.js";
18
20
  export { createSessionFsAdapter } from "./sessionFsProvider.js";
@@ -838,15 +840,27 @@ export interface SystemMessageCustomizeConfig {
838
840
  * - Customize mode: Section-level overrides with graceful fallback
839
841
  */
840
842
  export type SystemMessageConfig = SystemMessageAppendConfig | SystemMessageReplaceConfig | SystemMessageCustomizeConfig;
843
+ import type { PermissionDecisionRequest } from "./generated/rpc.js";
841
844
  /**
842
845
  * Permission request types from the server. This is the generated
843
846
  * discriminated union from the runtime schema — switch on `kind` to
844
847
  * access the variant-specific fields (e.g. shell `commands`, write
845
848
  * `fileName`/`diff`, mcp `toolName`/`args`).
849
+ *
850
+ * `managedApprovalRequired` indicates that managed policy requires an explicit
851
+ * user decision. Hosts should bypass automatic approval and present their
852
+ * normal confirmation UI. The runtime currently emits it for managed Shell,
853
+ * Read, Edit, and Domain selector asks.
846
854
  */
847
- export type { PermissionRequest } from "./generated/session-events.js";
848
- import type { PermissionRequest } from "./generated/session-events.js";
849
- import type { PermissionDecisionRequest } from "./generated/rpc.js";
855
+ export type PermissionRequest = GeneratedPermissionRequest & {
856
+ readonly managedApprovalRequired?: boolean;
857
+ };
858
+ export type PermissionRequestedData = Omit<GeneratedPermissionRequestedData, "permissionRequest"> & {
859
+ permissionRequest: PermissionRequest;
860
+ };
861
+ export type PermissionRequestedEvent = Omit<GeneratedPermissionRequestedEvent, "data"> & {
862
+ data: PermissionRequestedData;
863
+ };
850
864
  /**
851
865
  * Permission decision result returned from a {@link PermissionHandler}.
852
866
  * The discriminated `kind` field selects the decision. Variant-specific
@@ -858,7 +872,11 @@ export type PermissionRequestResult = PermissionDecisionRequest["result"] | {
858
872
  };
859
873
  export type PermissionHandler = (request: PermissionRequest, invocation: {
860
874
  sessionId: string;
875
+ managedSettingsEnabled?: boolean;
861
876
  }) => Promise<PermissionRequestResult> | PermissionRequestResult;
877
+ /**
878
+ * Approves permission requests when managed settings are disabled.
879
+ */
862
880
  export declare const approveAll: PermissionHandler;
863
881
  export declare const defaultJoinSessionPermissionHandler: PermissionHandler;
864
882
  /**
@@ -1624,6 +1642,19 @@ export interface CopilotExpAssignmentResponse {
1624
1642
  /** Assignment context string forwarded to CAPI and telemetry. */
1625
1643
  AssignmentContext: string;
1626
1644
  }
1645
+ /**
1646
+ * Configuration for the built-in GitHub MCP server.
1647
+ *
1648
+ * `disableFormDeferral` only applies to the built-in GitHub MCP server and
1649
+ * only has an effect when MCP Apps and form-backed GitHub tools are enabled.
1650
+ */
1651
+ export interface GitHubMcpToolConfig {
1652
+ enableAllTools?: boolean;
1653
+ additionalToolsets?: string[];
1654
+ additionalTools?: string[];
1655
+ enableInsidersMode?: boolean;
1656
+ disableFormDeferral?: boolean;
1657
+ }
1627
1658
  /**
1628
1659
  * Shared configuration fields used by both {@link SessionConfig} (for
1629
1660
  * creating a new session) and {@link ResumeSessionConfig} (for resuming
@@ -1650,6 +1681,11 @@ export interface SessionConfigBase {
1650
1681
  * Use "none" to suppress summary output regardless of whether reasoning is enabled.
1651
1682
  */
1652
1683
  reasoningSummary?: ReasoningSummary;
1684
+ /**
1685
+ * Controls whether the session enables experimental features.
1686
+ * Defaults to `false` in `"empty"` mode; otherwise the runtime decides when unset.
1687
+ */
1688
+ enableExperimentalMode?: boolean;
1653
1689
  /**
1654
1690
  * Context window tier for models that support it. Use "long_context" to pin
1655
1691
  * the session to the long-context tier; omit or use "default" otherwise.
@@ -1914,6 +1950,13 @@ export interface SessionConfigBase {
1914
1950
  * @default false
1915
1951
  */
1916
1952
  enableMcpApps?: boolean;
1953
+ /**
1954
+ * Configuration for the built-in GitHub MCP server.
1955
+ *
1956
+ * `disableFormDeferral` only applies to the built-in GitHub MCP server and
1957
+ * only has an effect when MCP Apps and form-backed GitHub tools are enabled.
1958
+ */
1959
+ githubMcpToolConfig?: GitHubMcpToolConfig;
1917
1960
  /**
1918
1961
  * Handler for exit-plan-mode requests from the agent.
1919
1962
  * When provided, enables `exitPlanMode.request` callbacks.
@@ -1934,6 +1977,12 @@ export interface SessionConfigBase {
1934
1977
  * Tool operations will be relative to this directory.
1935
1978
  */
1936
1979
  workingDirectory?: string;
1980
+ /**
1981
+ * Additional directories the agent may access beyond the working directory.
1982
+ * Relative paths are resolved against the session's working directory.
1983
+ * Re-supply these directories when resuming a session.
1984
+ */
1985
+ additionalDirectories?: string[];
1937
1986
  /**
1938
1987
  * Enable streaming of assistant message and reasoning chunks.
1939
1988
  * When true, ephemeral assistant.message_delta and assistant.reasoning_delta
package/dist/types.js CHANGED
@@ -112,7 +112,18 @@ const SYSTEM_MESSAGE_SECTIONS = {
112
112
  description: "End-of-prompt instructions: parallel tool calling, persistence, task completion"
113
113
  }
114
114
  };
115
- const approveAll = () => ({ kind: "approve-once" });
115
+ const approveAll = (request, invocation) => {
116
+ if (invocation.managedSettingsEnabled) {
117
+ throw new Error("approveAll cannot be used when managed settings are enabled");
118
+ }
119
+ if ("managedApprovalRequired" in request) {
120
+ const managedApprovalRequired = request.managedApprovalRequired;
121
+ if (managedApprovalRequired !== void 0 && managedApprovalRequired !== false) {
122
+ return { kind: "no-result" };
123
+ }
124
+ }
125
+ return { kind: "approve-once" };
126
+ };
116
127
  const defaultJoinSessionPermissionHandler = () => ({
117
128
  kind: "no-result"
118
129
  });
@@ -258,7 +258,7 @@ Subscribe to session events. Returns an unsubscribe function.
258
258
 
259
259
  ```js
260
260
  const unsub = session.on("tool.execution_complete", (event) => {
261
- // event.data.toolName, event.data.success, event.data.result
261
+ // event.data.success, event.data.result
262
262
  });
263
263
  ```
264
264
 
@@ -268,7 +268,7 @@ const unsub = session.on("tool.execution_complete", (event) => {
268
268
  | ------------------------- | ------------------------------------------------------ |
269
269
  | `assistant.message` | `content`, `messageId` |
270
270
  | `tool.execution_start` | `toolCallId`, `toolName`, `arguments` |
271
- | `tool.execution_complete` | `toolCallId`, `toolName`, `success`, `result`, `error` |
271
+ | `tool.execution_complete` | `toolCallId`, `success`, `result`, `error` |
272
272
  | `user.message` | `content`, `attachments`, `source` |
273
273
  | `session.idle` | `backgroundTasks` |
274
274
  | `session.error` | `errorType`, `message`, `stack` |
package/docs/examples.md CHANGED
@@ -368,7 +368,7 @@ session.on((event) => {
368
368
 
369
369
  ```js
370
370
  const unsubscribe = session.on("tool.execution_complete", (event) => {
371
- // event.data.toolName, event.data.success, event.data.result, event.data.error
371
+ // event.data.success, event.data.result, event.data.error
372
372
  });
373
373
 
374
374
  // Later, stop listening
@@ -417,7 +417,7 @@ session.on("assistant.message", (event) => {
417
417
  | `assistant.message` | Agent's final response | `content`, `messageId`, `toolRequests` |
418
418
  | `assistant.message_delta` | Message content chunks (ephemeral) | `deltaContent` |
419
419
  | `tool.execution_start` | A tool is about to run | `toolCallId`, `toolName`, `arguments` |
420
- | `tool.execution_complete` | A tool finished running | `toolCallId`, `toolName`, `success`, `result`, `error` |
420
+ | `tool.execution_complete` | A tool finished running | `toolCallId`, `success`, `result`, `error` |
421
421
  | `user.message` | User sent a message | `content`, `attachments`, `source` |
422
422
  | `session.idle` | Session finished processing a turn | `backgroundTasks` |
423
423
  | `session.error` | An error occurred | `errorType`, `message`, `stack` |
@@ -677,6 +677,6 @@ session.on("assistant.message", (event) => {
677
677
  });
678
678
 
679
679
  session.on("tool.execution_complete", (event) => {
680
- // event.data.success, event.data.toolName, event.data.result
680
+ // event.data.success, event.data.result
681
681
  });
682
682
  ```
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/github/copilot-sdk.git"
6
6
  },
7
- "version": "1.0.9-preview.2",
7
+ "version": "1.0.9-preview.3",
8
8
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
9
9
  "main": "./dist/cjs/index.js",
10
10
  "types": "./dist/index.d.ts",
@@ -56,7 +56,7 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.76-5",
59
+ "@github/copilot": "^1.0.78",
60
60
  "koffi": "^3.1.0",
61
61
  "vscode-jsonrpc": "^8.2.1",
62
62
  "zod": "^4.3.6"