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

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
  /**
@@ -1092,6 +1110,29 @@ export interface UserPromptSubmittedHookOutput {
1092
1110
  export type UserPromptSubmittedHandler = (input: UserPromptSubmittedHookInput, invocation: {
1093
1111
  sessionId: string;
1094
1112
  }) => Promise<UserPromptSubmittedHookOutput | void> | UserPromptSubmittedHookOutput | void;
1113
+ /**
1114
+ * Input for the user-prompt-transformed hook.
1115
+ *
1116
+ * This hook runs after the runtime has transformed the submitted prompt with
1117
+ * generated context, but before it is persisted to session history or sent to
1118
+ * the model.
1119
+ */
1120
+ export interface UserPromptTransformedHookInput extends BaseHookInput {
1121
+ prompt: string;
1122
+ transformedPrompt: string;
1123
+ }
1124
+ /**
1125
+ * Output for the user-prompt-transformed hook.
1126
+ */
1127
+ export interface UserPromptTransformedHookOutput {
1128
+ modifiedTransformedPrompt?: string;
1129
+ }
1130
+ /**
1131
+ * Handler for the user-prompt-transformed hook.
1132
+ */
1133
+ export type UserPromptTransformedHandler = (input: UserPromptTransformedHookInput, invocation: {
1134
+ sessionId: string;
1135
+ }) => Promise<UserPromptTransformedHookOutput | void> | UserPromptTransformedHookOutput | void;
1095
1136
  /**
1096
1137
  * Input for session-start hook
1097
1138
  */
@@ -1227,6 +1268,10 @@ export interface SessionHooks {
1227
1268
  * Called when the user submits a prompt
1228
1269
  */
1229
1270
  onUserPromptSubmitted?: UserPromptSubmittedHandler;
1271
+ /**
1272
+ * Called after the runtime transforms a submitted prompt and before it is stored.
1273
+ */
1274
+ onUserPromptTransformed?: UserPromptTransformedHandler;
1230
1275
  /**
1231
1276
  * Called when a session starts
1232
1277
  */
@@ -1432,7 +1477,7 @@ export interface LargeToolOutputConfig {
1432
1477
  /**
1433
1478
  * Valid reasoning effort levels for models that support it.
1434
1479
  */
1435
- export type ReasoningEffort = "low" | "medium" | "high" | "xhigh";
1480
+ export type ReasoningEffort = "low" | "medium" | "high" | "xhigh" | "max";
1436
1481
  /**
1437
1482
  * Context window tier for the session. "long_context" pins the session to the
1438
1483
  * long-context tier when the selected model supports it.
@@ -1624,6 +1669,19 @@ export interface CopilotExpAssignmentResponse {
1624
1669
  /** Assignment context string forwarded to CAPI and telemetry. */
1625
1670
  AssignmentContext: string;
1626
1671
  }
1672
+ /**
1673
+ * Configuration for the built-in GitHub MCP server.
1674
+ *
1675
+ * `disableFormDeferral` only applies to the built-in GitHub MCP server and
1676
+ * only has an effect when MCP Apps and form-backed GitHub tools are enabled.
1677
+ */
1678
+ export interface GitHubMcpToolConfig {
1679
+ enableAllTools?: boolean;
1680
+ additionalToolsets?: string[];
1681
+ additionalTools?: string[];
1682
+ enableInsidersMode?: boolean;
1683
+ disableFormDeferral?: boolean;
1684
+ }
1627
1685
  /**
1628
1686
  * Shared configuration fields used by both {@link SessionConfig} (for
1629
1687
  * creating a new session) and {@link ResumeSessionConfig} (for resuming
@@ -1650,6 +1708,11 @@ export interface SessionConfigBase {
1650
1708
  * Use "none" to suppress summary output regardless of whether reasoning is enabled.
1651
1709
  */
1652
1710
  reasoningSummary?: ReasoningSummary;
1711
+ /**
1712
+ * Controls whether the session enables experimental features.
1713
+ * Defaults to `false` in `"empty"` mode; otherwise the runtime decides when unset.
1714
+ */
1715
+ enableExperimentalMode?: boolean;
1653
1716
  /**
1654
1717
  * Context window tier for models that support it. Use "long_context" to pin
1655
1718
  * the session to the long-context tier; omit or use "default" otherwise.
@@ -1914,6 +1977,13 @@ export interface SessionConfigBase {
1914
1977
  * @default false
1915
1978
  */
1916
1979
  enableMcpApps?: boolean;
1980
+ /**
1981
+ * Configuration for the built-in GitHub MCP server.
1982
+ *
1983
+ * `disableFormDeferral` only applies to the built-in GitHub MCP server and
1984
+ * only has an effect when MCP Apps and form-backed GitHub tools are enabled.
1985
+ */
1986
+ githubMcpToolConfig?: GitHubMcpToolConfig;
1917
1987
  /**
1918
1988
  * Handler for exit-plan-mode requests from the agent.
1919
1989
  * When provided, enables `exitPlanMode.request` callbacks.
@@ -1934,6 +2004,12 @@ export interface SessionConfigBase {
1934
2004
  * Tool operations will be relative to this directory.
1935
2005
  */
1936
2006
  workingDirectory?: string;
2007
+ /**
2008
+ * Additional directories the agent may access beyond the working directory.
2009
+ * Relative paths are resolved against the session's working directory.
2010
+ * Re-supply these directories when resuming a session.
2011
+ */
2012
+ additionalDirectories?: string[];
1937
2013
  /**
1938
2014
  * Enable streaming of assistant message and reasoning chunks.
1939
2015
  * When true, ephemeral assistant.message_delta and assistant.reasoning_delta
@@ -2008,6 +2084,12 @@ export interface SessionConfigBase {
2008
2084
  * List of skill names to disable.
2009
2085
  */
2010
2086
  disabledSkills?: string[];
2087
+ /**
2088
+ * Exact MCP server names to disable for this session. Disabled servers are not
2089
+ * started or authenticated when creating or cold-resuming a session. Supplying
2090
+ * this on a resident resume cannot stop servers that are already running.
2091
+ */
2092
+ disabledMcpServers?: string[];
2011
2093
  /**
2012
2094
  * Infinite session configuration for persistent workspaces and automatic compaction.
2013
2095
  * When enabled (default), sessions automatically manage context limits and persist state.
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,9 +268,9 @@ 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
- | `session.idle` | `backgroundTasks` |
273
+ | `session.idle` | `aborted` |
274
274
  | `session.error` | `errorType`, `message`, `stack` |
275
275
  | `permission.requested` | `requestId`, `permissionRequest.kind` |
276
276
  | `session.shutdown` | `shutdownType`, `totalPremiumRequests` |
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,9 +417,9 @@ 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
- | `session.idle` | Session finished processing a turn | `backgroundTasks` |
422
+ | `session.idle` | Session finished processing a turn | `aborted` |
423
423
  | `session.error` | An error occurred | `errorType`, `message`, `stack` |
424
424
  | `permission.requested` | Agent needs permission (shell, file write, etc.) | `requestId`, `permissionRequest.kind` |
425
425
  | `session.shutdown` | Session is ending | `shutdownType`, `totalPremiumRequests`, `codeChanges` |
@@ -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",
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"