@github/copilot-sdk 0.2.1 → 0.2.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.
@@ -166,6 +166,9 @@ class CopilotClient {
166
166
  "githubToken and useLoggedInUser cannot be used with cliUrl (external server manages its own auth)"
167
167
  );
168
168
  }
169
+ if (options.sessionFs) {
170
+ this.validateSessionFsConfig(options.sessionFs);
171
+ }
169
172
  if (options.cliUrl) {
170
173
  const { host, port } = this.parseCliUrl(options.cliUrl);
171
174
  this.actualHost = host;
@@ -220,6 +223,17 @@ class CopilotClient {
220
223
  }
221
224
  return { host, port };
222
225
  }
226
+ validateSessionFsConfig(config) {
227
+ if (!config.initialCwd) {
228
+ throw new Error("sessionFs.initialCwd is required");
229
+ }
230
+ if (!config.sessionStatePath) {
231
+ throw new Error("sessionFs.sessionStatePath is required");
232
+ }
233
+ if (config.conventions !== "windows" && config.conventions !== "posix") {
234
+ throw new Error("sessionFs.conventions must be either 'windows' or 'posix'");
235
+ }
236
+ }
223
237
  /**
224
238
  * Starts the CLI server and establishes a connection.
225
239
  *
@@ -514,6 +528,7 @@ class CopilotClient {
514
528
  availableTools: config.availableTools,
515
529
  excludedTools: config.excludedTools,
516
530
  provider: config.provider,
531
+ modelCapabilities: config.modelCapabilities,
517
532
  requestPermission: true,
518
533
  requestUserInput: !!config.onUserInputRequest,
519
534
  requestElicitation: !!config.onElicitationRequest,
@@ -525,6 +540,7 @@ class CopilotClient {
525
540
  customAgents: config.customAgents,
526
541
  agent: config.agent,
527
542
  configDir: config.configDir,
543
+ enableConfigDiscovery: config.enableConfigDiscovery,
528
544
  skillDirectories: config.skillDirectories,
529
545
  disabledSkills: config.disabledSkills,
530
546
  infiniteSessions: config.infiniteSessions
@@ -634,12 +650,14 @@ class CopilotClient {
634
650
  description: cmd.description
635
651
  })),
636
652
  provider: config.provider,
653
+ modelCapabilities: config.modelCapabilities,
637
654
  requestPermission: true,
638
655
  requestUserInput: !!config.onUserInputRequest,
639
656
  requestElicitation: !!config.onElicitationRequest,
640
657
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
641
658
  workingDirectory: config.workingDirectory,
642
659
  configDir: config.configDir,
660
+ enableConfigDiscovery: config.enableConfigDiscovery,
643
661
  streaming: config.streaming,
644
662
  mcpServers: config.mcpServers,
645
663
  envValueMode: "direct",
@@ -45,6 +45,10 @@ function createServerRpc(connection) {
45
45
  },
46
46
  sessionFs: {
47
47
  setProvider: async (params) => connection.sendRequest("sessionFs.setProvider", params)
48
+ },
49
+ /** @experimental */
50
+ sessions: {
51
+ fork: async (params) => connection.sendRequest("sessions.fork", params)
48
52
  }
49
53
  };
50
54
  }
@@ -105,10 +109,6 @@ function createSessionRpc(connection, sessionId) {
105
109
  disable: async (params) => connection.sendRequest("session.extensions.disable", { sessionId, ...params }),
106
110
  reload: async () => connection.sendRequest("session.extensions.reload", { sessionId })
107
111
  },
108
- /** @experimental */
109
- compaction: {
110
- compact: async () => connection.sendRequest("session.compaction.compact", { sessionId })
111
- },
112
112
  tools: {
113
113
  handlePendingToolCall: async (params) => connection.sendRequest("session.tools.handlePendingToolCall", { sessionId, ...params })
114
114
  },
@@ -126,6 +126,11 @@ function createSessionRpc(connection, sessionId) {
126
126
  shell: {
127
127
  exec: async (params) => connection.sendRequest("session.shell.exec", { sessionId, ...params }),
128
128
  kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params })
129
+ },
130
+ /** @experimental */
131
+ history: {
132
+ compact: async () => connection.sendRequest("session.history.compact", { sessionId }),
133
+ truncate: async (params) => connection.sendRequest("session.history.truncate", { sessionId, ...params })
129
134
  }
130
135
  };
131
136
  }
package/dist/client.d.ts CHANGED
@@ -89,6 +89,7 @@ export declare class CopilotClient {
89
89
  * Supports formats: "host:port", "http://host:port", "https://host:port", or just "port"
90
90
  */
91
91
  private parseCliUrl;
92
+ private validateSessionFsConfig;
92
93
  /**
93
94
  * Starts the CLI server and establishes a connection.
94
95
  *
package/dist/client.js CHANGED
@@ -146,6 +146,9 @@ class CopilotClient {
146
146
  "githubToken and useLoggedInUser cannot be used with cliUrl (external server manages its own auth)"
147
147
  );
148
148
  }
149
+ if (options.sessionFs) {
150
+ this.validateSessionFsConfig(options.sessionFs);
151
+ }
149
152
  if (options.cliUrl) {
150
153
  const { host, port } = this.parseCliUrl(options.cliUrl);
151
154
  this.actualHost = host;
@@ -200,6 +203,17 @@ class CopilotClient {
200
203
  }
201
204
  return { host, port };
202
205
  }
206
+ validateSessionFsConfig(config) {
207
+ if (!config.initialCwd) {
208
+ throw new Error("sessionFs.initialCwd is required");
209
+ }
210
+ if (!config.sessionStatePath) {
211
+ throw new Error("sessionFs.sessionStatePath is required");
212
+ }
213
+ if (config.conventions !== "windows" && config.conventions !== "posix") {
214
+ throw new Error("sessionFs.conventions must be either 'windows' or 'posix'");
215
+ }
216
+ }
203
217
  /**
204
218
  * Starts the CLI server and establishes a connection.
205
219
  *
@@ -494,6 +508,7 @@ class CopilotClient {
494
508
  availableTools: config.availableTools,
495
509
  excludedTools: config.excludedTools,
496
510
  provider: config.provider,
511
+ modelCapabilities: config.modelCapabilities,
497
512
  requestPermission: true,
498
513
  requestUserInput: !!config.onUserInputRequest,
499
514
  requestElicitation: !!config.onElicitationRequest,
@@ -505,6 +520,7 @@ class CopilotClient {
505
520
  customAgents: config.customAgents,
506
521
  agent: config.agent,
507
522
  configDir: config.configDir,
523
+ enableConfigDiscovery: config.enableConfigDiscovery,
508
524
  skillDirectories: config.skillDirectories,
509
525
  disabledSkills: config.disabledSkills,
510
526
  infiniteSessions: config.infiniteSessions
@@ -614,12 +630,14 @@ class CopilotClient {
614
630
  description: cmd.description
615
631
  })),
616
632
  provider: config.provider,
633
+ modelCapabilities: config.modelCapabilities,
617
634
  requestPermission: true,
618
635
  requestUserInput: !!config.onUserInputRequest,
619
636
  requestElicitation: !!config.onElicitationRequest,
620
637
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
621
638
  workingDirectory: config.workingDirectory,
622
639
  configDir: config.configDir,
640
+ enableConfigDiscovery: config.enableConfigDiscovery,
623
641
  streaming: config.streaming,
624
642
  mcpServers: config.mcpServers,
625
643
  envValueMode: "direct",
@@ -36,41 +36,7 @@ export interface ModelsListResult {
36
36
  * Display name
37
37
  */
38
38
  name: string;
39
- /**
40
- * Model capabilities and limits
41
- */
42
- capabilities: {
43
- /**
44
- * Feature flags indicating what the model supports
45
- */
46
- supports: {
47
- /**
48
- * Whether this model supports vision/image input
49
- */
50
- vision?: boolean;
51
- /**
52
- * Whether this model supports reasoning effort configuration
53
- */
54
- reasoningEffort?: boolean;
55
- };
56
- /**
57
- * Token limits for prompts, outputs, and context window
58
- */
59
- limits: {
60
- /**
61
- * Maximum number of prompt/input tokens
62
- */
63
- max_prompt_tokens?: number;
64
- /**
65
- * Maximum number of output/completion tokens
66
- */
67
- max_output_tokens?: number;
68
- /**
69
- * Maximum total context window size in tokens
70
- */
71
- max_context_window_tokens: number;
72
- };
73
- };
39
+ capabilities: ModelCapabilities;
74
40
  /**
75
41
  * Policy state (if applicable)
76
42
  */
@@ -103,6 +69,61 @@ export interface ModelsListResult {
103
69
  defaultReasoningEffort?: string;
104
70
  }[];
105
71
  }
72
+ /**
73
+ * Model capabilities and limits
74
+ */
75
+ export interface ModelCapabilities {
76
+ supports: ModelCapabilitiesSupports;
77
+ limits: ModelCapabilitiesLimits;
78
+ }
79
+ /**
80
+ * Feature flags indicating what the model supports
81
+ */
82
+ export interface ModelCapabilitiesSupports {
83
+ /**
84
+ * Whether this model supports vision/image input
85
+ */
86
+ vision?: boolean;
87
+ /**
88
+ * Whether this model supports reasoning effort configuration
89
+ */
90
+ reasoningEffort?: boolean;
91
+ }
92
+ /**
93
+ * Token limits for prompts, outputs, and context window
94
+ */
95
+ export interface ModelCapabilitiesLimits {
96
+ /**
97
+ * Maximum number of prompt/input tokens
98
+ */
99
+ max_prompt_tokens?: number;
100
+ /**
101
+ * Maximum number of output/completion tokens
102
+ */
103
+ max_output_tokens?: number;
104
+ /**
105
+ * Maximum total context window size in tokens
106
+ */
107
+ max_context_window_tokens: number;
108
+ vision?: ModelCapabilitiesLimitsVision;
109
+ }
110
+ /**
111
+ * Vision-specific limits
112
+ */
113
+ export interface ModelCapabilitiesLimitsVision {
114
+ /**
115
+ * MIME types the model accepts
116
+ */
117
+ supported_media_types: string[];
118
+ /**
119
+ * Maximum number of images per prompt
120
+ */
121
+ max_prompt_images: number;
122
+ /**
123
+ * Maximum image size in bytes
124
+ */
125
+ max_prompt_image_size: number;
126
+ }
106
127
  export interface ToolsListResult {
107
128
  /**
108
129
  * List of available built-in tools with metadata
@@ -330,6 +351,24 @@ export interface SessionFsSetProviderParams {
330
351
  */
331
352
  conventions: "windows" | "posix";
332
353
  }
354
+ /** @experimental */
355
+ export interface SessionsForkResult {
356
+ /**
357
+ * The new forked session's ID
358
+ */
359
+ sessionId: string;
360
+ }
361
+ /** @experimental */
362
+ export interface SessionsForkParams {
363
+ /**
364
+ * Source session ID to fork from
365
+ */
366
+ sessionId: string;
367
+ /**
368
+ * Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included.
369
+ */
370
+ toEventId?: string;
371
+ }
333
372
  export interface SessionModelGetCurrentResult {
334
373
  /**
335
374
  * Currently active model identifier
@@ -361,6 +400,47 @@ export interface SessionModelSwitchToParams {
361
400
  * Reasoning effort level to use for the model
362
401
  */
363
402
  reasoningEffort?: string;
403
+ modelCapabilities?: ModelCapabilitiesOverride;
404
+ }
405
+ /**
406
+ * Override individual model capabilities resolved by the runtime
407
+ */
408
+ export interface ModelCapabilitiesOverride {
409
+ supports?: ModelCapabilitiesOverrideSupports;
410
+ limits?: ModelCapabilitiesOverrideLimits;
411
+ }
412
+ /**
413
+ * Feature flags indicating what the model supports
414
+ */
415
+ export interface ModelCapabilitiesOverrideSupports {
416
+ vision?: boolean;
417
+ reasoningEffort?: boolean;
418
+ }
419
+ /**
420
+ * Token limits for prompts, outputs, and context window
421
+ */
422
+ export interface ModelCapabilitiesOverrideLimits {
423
+ max_prompt_tokens?: number;
424
+ max_output_tokens?: number;
425
+ /**
426
+ * Maximum total context window size in tokens
427
+ */
428
+ max_context_window_tokens?: number;
429
+ vision?: ModelCapabilitiesOverrideLimitsVision;
430
+ }
431
+ export interface ModelCapabilitiesOverrideLimitsVision {
432
+ /**
433
+ * MIME types the model accepts
434
+ */
435
+ supported_media_types?: string[];
436
+ /**
437
+ * Maximum number of images per prompt
438
+ */
439
+ max_prompt_images?: number;
440
+ /**
441
+ * Maximum image size in bytes
442
+ */
443
+ max_prompt_image_size?: number;
364
444
  }
365
445
  export interface SessionModeGetResult {
366
446
  /**
@@ -864,28 +944,6 @@ export interface SessionExtensionsReloadParams {
864
944
  */
865
945
  sessionId: string;
866
946
  }
867
- /** @experimental */
868
- export interface SessionCompactionCompactResult {
869
- /**
870
- * Whether compaction completed successfully
871
- */
872
- success: boolean;
873
- /**
874
- * Number of tokens freed by compaction
875
- */
876
- tokensRemoved: number;
877
- /**
878
- * Number of messages removed during compaction
879
- */
880
- messagesRemoved: number;
881
- }
882
- /** @experimental */
883
- export interface SessionCompactionCompactParams {
884
- /**
885
- * Target session identifier
886
- */
887
- sessionId: string;
888
- }
889
947
  export interface SessionToolsHandlePendingToolCallResult {
890
948
  /**
891
949
  * Whether the tool call result was handled successfully
@@ -1161,6 +1219,46 @@ export interface SessionShellKillParams {
1161
1219
  */
1162
1220
  signal?: "SIGTERM" | "SIGKILL" | "SIGINT";
1163
1221
  }
1222
+ /** @experimental */
1223
+ export interface SessionHistoryCompactResult {
1224
+ /**
1225
+ * Whether compaction completed successfully
1226
+ */
1227
+ success: boolean;
1228
+ /**
1229
+ * Number of tokens freed by compaction
1230
+ */
1231
+ tokensRemoved: number;
1232
+ /**
1233
+ * Number of messages removed during compaction
1234
+ */
1235
+ messagesRemoved: number;
1236
+ }
1237
+ /** @experimental */
1238
+ export interface SessionHistoryCompactParams {
1239
+ /**
1240
+ * Target session identifier
1241
+ */
1242
+ sessionId: string;
1243
+ }
1244
+ /** @experimental */
1245
+ export interface SessionHistoryTruncateResult {
1246
+ /**
1247
+ * Number of events that were removed
1248
+ */
1249
+ eventsRemoved: number;
1250
+ }
1251
+ /** @experimental */
1252
+ export interface SessionHistoryTruncateParams {
1253
+ /**
1254
+ * Target session identifier
1255
+ */
1256
+ sessionId: string;
1257
+ /**
1258
+ * Event ID to truncate to. This event and all events after it are removed from the session.
1259
+ */
1260
+ eventId: string;
1261
+ }
1164
1262
  export interface SessionFsReadFileResult {
1165
1263
  /**
1166
1264
  * File content as UTF-8 string
@@ -1375,6 +1473,10 @@ export declare function createServerRpc(connection: MessageConnection): {
1375
1473
  sessionFs: {
1376
1474
  setProvider: (params: SessionFsSetProviderParams) => Promise<SessionFsSetProviderResult>;
1377
1475
  };
1476
+ /** @experimental */
1477
+ sessions: {
1478
+ fork: (params: SessionsForkParams) => Promise<SessionsForkResult>;
1479
+ };
1378
1480
  };
1379
1481
  /** Create typed session-scoped RPC methods. */
1380
1482
  export declare function createSessionRpc(connection: MessageConnection, sessionId: string): {
@@ -1433,10 +1535,6 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
1433
1535
  disable: (params: Omit<SessionExtensionsDisableParams, "sessionId">) => Promise<SessionExtensionsDisableResult>;
1434
1536
  reload: () => Promise<SessionExtensionsReloadResult>;
1435
1537
  };
1436
- /** @experimental */
1437
- compaction: {
1438
- compact: () => Promise<SessionCompactionCompactResult>;
1439
- };
1440
1538
  tools: {
1441
1539
  handlePendingToolCall: (params: Omit<SessionToolsHandlePendingToolCallParams, "sessionId">) => Promise<SessionToolsHandlePendingToolCallResult>;
1442
1540
  };
@@ -1455,6 +1553,11 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
1455
1553
  exec: (params: Omit<SessionShellExecParams, "sessionId">) => Promise<SessionShellExecResult>;
1456
1554
  kill: (params: Omit<SessionShellKillParams, "sessionId">) => Promise<SessionShellKillResult>;
1457
1555
  };
1556
+ /** @experimental */
1557
+ history: {
1558
+ compact: () => Promise<SessionHistoryCompactResult>;
1559
+ truncate: (params: Omit<SessionHistoryTruncateParams, "sessionId">) => Promise<SessionHistoryTruncateResult>;
1560
+ };
1458
1561
  };
1459
1562
  /** Handler for `sessionFs` client session API methods. */
1460
1563
  export interface SessionFsHandler {
@@ -20,6 +20,10 @@ function createServerRpc(connection) {
20
20
  },
21
21
  sessionFs: {
22
22
  setProvider: async (params) => connection.sendRequest("sessionFs.setProvider", params)
23
+ },
24
+ /** @experimental */
25
+ sessions: {
26
+ fork: async (params) => connection.sendRequest("sessions.fork", params)
23
27
  }
24
28
  };
25
29
  }
@@ -80,10 +84,6 @@ function createSessionRpc(connection, sessionId) {
80
84
  disable: async (params) => connection.sendRequest("session.extensions.disable", { sessionId, ...params }),
81
85
  reload: async () => connection.sendRequest("session.extensions.reload", { sessionId })
82
86
  },
83
- /** @experimental */
84
- compaction: {
85
- compact: async () => connection.sendRequest("session.compaction.compact", { sessionId })
86
- },
87
87
  tools: {
88
88
  handlePendingToolCall: async (params) => connection.sendRequest("session.tools.handlePendingToolCall", { sessionId, ...params })
89
89
  },
@@ -101,6 +101,11 @@ function createSessionRpc(connection, sessionId) {
101
101
  shell: {
102
102
  exec: async (params) => connection.sendRequest("session.shell.exec", { sessionId, ...params }),
103
103
  kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params })
104
+ },
105
+ /** @experimental */
106
+ history: {
107
+ compact: async () => connection.sendRequest("session.history.compact", { sessionId }),
108
+ truncate: async (params) => connection.sendRequest("session.history.truncate", { sessionId, ...params })
104
109
  }
105
110
  };
106
111
  }
@@ -264,44 +264,9 @@ export type SessionEvent = {
264
264
  ephemeral: true;
265
265
  type: "session.idle";
266
266
  /**
267
- * Payload indicating the agent is idle; includes any background tasks still in flight
267
+ * Payload indicating the session is idle with no background agents in flight
268
268
  */
269
269
  data: {
270
- /**
271
- * Background tasks still running when the agent became idle
272
- */
273
- backgroundTasks?: {
274
- /**
275
- * Currently running background agents
276
- */
277
- agents: {
278
- /**
279
- * Unique identifier of the background agent
280
- */
281
- agentId: string;
282
- /**
283
- * Type of the background agent
284
- */
285
- agentType: string;
286
- /**
287
- * Human-readable description of the agent task
288
- */
289
- description?: string;
290
- }[];
291
- /**
292
- * Currently running background shell commands
293
- */
294
- shells: {
295
- /**
296
- * Unique identifier of the background shell
297
- */
298
- shellId: string;
299
- /**
300
- * Human-readable description of the shell command
301
- */
302
- description?: string;
303
- }[];
304
- };
305
270
  /**
306
271
  * True when the preceding agentic loop was cancelled via abort signal
307
272
  */
@@ -668,7 +633,7 @@ export type SessionEvent = {
668
633
  */
669
634
  data: {
670
635
  /**
671
- * Event ID that was rewound to; all events after this one were removed
636
+ * Event ID that was rewound to; this event and all after it were removed
672
637
  */
673
638
  upToEventId: string;
674
639
  /**
@@ -1477,6 +1442,10 @@ export type SessionEvent = {
1477
1442
  * CAPI interaction ID for correlating this message with upstream telemetry
1478
1443
  */
1479
1444
  interactionId?: string;
1445
+ /**
1446
+ * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
1447
+ */
1448
+ requestId?: string;
1480
1449
  /**
1481
1450
  * Tool call ID of the parent tool invocation when this event originates from a sub-agent
1482
1451
  */
@@ -2893,13 +2862,21 @@ export type SessionEvent = {
2893
2862
  ephemeral: true;
2894
2863
  type: "user_input.completed";
2895
2864
  /**
2896
- * User input request completion notification signaling UI dismissal
2865
+ * User input request completion with the user's response
2897
2866
  */
2898
2867
  data: {
2899
2868
  /**
2900
2869
  * Request ID of the resolved user input request; clients should dismiss any UI for this request
2901
2870
  */
2902
2871
  requestId: string;
2872
+ /**
2873
+ * The user's answer to the input request
2874
+ */
2875
+ answer?: string;
2876
+ /**
2877
+ * Whether the answer was typed as free-form text rather than selected from choices
2878
+ */
2879
+ wasFreeform?: boolean;
2903
2880
  };
2904
2881
  } | {
2905
2882
  /**
@@ -2981,13 +2958,23 @@ export type SessionEvent = {
2981
2958
  ephemeral: true;
2982
2959
  type: "elicitation.completed";
2983
2960
  /**
2984
- * Elicitation request completion notification signaling UI dismissal
2961
+ * Elicitation request completion with the user's response
2985
2962
  */
2986
2963
  data: {
2987
2964
  /**
2988
2965
  * Request ID of the resolved elicitation request; clients should dismiss any UI for this request
2989
2966
  */
2990
2967
  requestId: string;
2968
+ /**
2969
+ * The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
2970
+ */
2971
+ action?: "accept" | "decline" | "cancel";
2972
+ /**
2973
+ * The submitted form data when action is 'accept'; keys match the requested schema fields
2974
+ */
2975
+ content?: {
2976
+ [k: string]: string | number | boolean | string[];
2977
+ };
2991
2978
  };
2992
2979
  } | {
2993
2980
  /**
@@ -3389,13 +3376,29 @@ export type SessionEvent = {
3389
3376
  ephemeral: true;
3390
3377
  type: "exit_plan_mode.completed";
3391
3378
  /**
3392
- * Plan mode exit completion notification signaling UI dismissal
3379
+ * Plan mode exit completion with the user's approval decision and optional feedback
3393
3380
  */
3394
3381
  data: {
3395
3382
  /**
3396
3383
  * Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request
3397
3384
  */
3398
3385
  requestId: string;
3386
+ /**
3387
+ * Whether the plan was approved by the user
3388
+ */
3389
+ approved?: boolean;
3390
+ /**
3391
+ * Which action the user selected (e.g. 'autopilot', 'interactive', 'exit_only')
3392
+ */
3393
+ selectedAction?: string;
3394
+ /**
3395
+ * Whether edits should be auto-approved without confirmation
3396
+ */
3397
+ autoApproveEdits?: boolean;
3398
+ /**
3399
+ * Free-form feedback from the user if they requested changes to the plan
3400
+ */
3401
+ feedback?: string;
3399
3402
  };
3400
3403
  } | {
3401
3404
  /**
package/dist/index.d.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  export { CopilotClient } from "./client.js";
7
7
  export { CopilotSession, type AssistantMessageEvent } from "./session.js";
8
8
  export { defineTool, approveAll, SYSTEM_PROMPT_SECTIONS } from "./types.js";
9
- export type { CommandContext, CommandDefinition, CommandHandler, ConnectionState, CopilotClientOptions, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, InputOptions, MCPLocalServerConfig, MCPRemoteServerConfig, MCPServerConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsHandler, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemPromptSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
9
+ export type { CommandContext, CommandDefinition, CommandHandler, ConnectionState, CopilotClientOptions, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, InputOptions, MCPLocalServerConfig, MCPRemoteServerConfig, MCPServerConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsHandler, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemPromptSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
package/dist/session.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  import type { MessageConnection } from "vscode-jsonrpc/node.js";
6
6
  import { createSessionRpc } from "./generated/rpc.js";
7
7
  import type { ClientSessionApiHandlers } from "./generated/rpc.js";
8
- import type { CommandHandler, ElicitationHandler, ElicitationContext, MessageOptions, PermissionHandler, PermissionRequestResult, ReasoningEffort, SectionTransformFn, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionHooks, SessionUiApi, Tool, ToolHandler, TraceContextProvider, TypedSessionEventHandler, UserInputHandler, UserInputResponse } from "./types.js";
8
+ import type { CommandHandler, ElicitationHandler, ElicitationContext, MessageOptions, PermissionHandler, PermissionRequestResult, ReasoningEffort, ModelCapabilitiesOverride, SectionTransformFn, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionHooks, SessionUiApi, Tool, ToolHandler, TraceContextProvider, TypedSessionEventHandler, UserInputHandler, UserInputResponse } from "./types.js";
9
9
  export declare const NO_RESULT_PERMISSION_V2_ERROR = "Permission handlers cannot return 'no-result' when connected to a protocol v2 server.";
10
10
  /** Assistant message event - the final response from the assistant. */
11
11
  export type AssistantMessageEvent = Extract<SessionEvent, {
@@ -432,6 +432,7 @@ export declare class CopilotSession {
432
432
  */
433
433
  setModel(model: string, options?: {
434
434
  reasoningEffort?: ReasoningEffort;
435
+ modelCapabilities?: ModelCapabilitiesOverride;
435
436
  }): Promise<void>;
436
437
  /**
437
438
  * Log a message to the session timeline.
package/dist/types.d.ts CHANGED
@@ -880,11 +880,25 @@ export interface SessionConfig {
880
880
  * Use client.listModels() to check supported values for each model.
881
881
  */
882
882
  reasoningEffort?: ReasoningEffort;
883
+ /** Per-property overrides for model capabilities, deep-merged over runtime defaults. */
884
+ modelCapabilities?: ModelCapabilitiesOverride;
883
885
  /**
884
886
  * Override the default configuration directory location.
885
887
  * When specified, the session will use this directory for storing config and state.
886
888
  */
887
889
  configDir?: string;
890
+ /**
891
+ * When true, automatically discovers MCP server configurations (e.g. `.mcp.json`,
892
+ * `.vscode/mcp.json`) and skill directories from the working directory and merges
893
+ * them with any explicitly provided `mcpServers` and `skillDirectories`, with
894
+ * explicit values taking precedence on name collision.
895
+ *
896
+ * Note: custom instruction files (`.github/copilot-instructions.md`, `AGENTS.md`, etc.)
897
+ * are always loaded from the working directory regardless of this setting.
898
+ *
899
+ * @default false
900
+ */
901
+ enableConfigDiscovery?: boolean;
888
902
  /**
889
903
  * Tools exposed to the CLI server
890
904
  */
@@ -990,7 +1004,7 @@ export interface SessionConfig {
990
1004
  /**
991
1005
  * Configuration for resuming a session
992
1006
  */
993
- export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "streaming" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "onElicitationRequest" | "hooks" | "workingDirectory" | "configDir" | "mcpServers" | "customAgents" | "agent" | "skillDirectories" | "disabledSkills" | "infiniteSessions" | "onEvent" | "createSessionFsHandler"> & {
1007
+ export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "modelCapabilities" | "streaming" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "onElicitationRequest" | "hooks" | "workingDirectory" | "configDir" | "enableConfigDiscovery" | "mcpServers" | "customAgents" | "agent" | "skillDirectories" | "disabledSkills" | "infiniteSessions" | "onEvent" | "createSessionFsHandler"> & {
994
1008
  /**
995
1009
  * When true, skips emitting the session.resume event.
996
1010
  * Useful for reconnecting to a session without triggering resume-related side effects.
@@ -1202,6 +1216,12 @@ export interface ModelCapabilities {
1202
1216
  };
1203
1217
  };
1204
1218
  }
1219
+ /** Recursively makes all properties optional, preserving arrays as-is. */
1220
+ type DeepPartial<T> = T extends readonly (infer U)[] ? DeepPartial<U>[] : T extends object ? {
1221
+ [K in keyof T]?: DeepPartial<T[K]>;
1222
+ } : T;
1223
+ /** Deep-partial override for model capabilities — every property at any depth is optional. */
1224
+ export type ModelCapabilitiesOverride = DeepPartial<ModelCapabilities>;
1205
1225
  /**
1206
1226
  * Model policy state
1207
1227
  */
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": "0.2.1",
7
+ "version": "0.2.2",
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.17",
59
+ "@github/copilot": "^1.0.21",
60
60
  "vscode-jsonrpc": "^8.2.1",
61
61
  "zod": "^4.3.6"
62
62
  },