@github/copilot-sdk 0.2.2-preview.0 → 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.
@@ -540,6 +540,7 @@ class CopilotClient {
540
540
  customAgents: config.customAgents,
541
541
  agent: config.agent,
542
542
  configDir: config.configDir,
543
+ enableConfigDiscovery: config.enableConfigDiscovery,
543
544
  skillDirectories: config.skillDirectories,
544
545
  disabledSkills: config.disabledSkills,
545
546
  infiniteSessions: config.infiniteSessions
@@ -656,6 +657,7 @@ class CopilotClient {
656
657
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
657
658
  workingDirectory: config.workingDirectory,
658
659
  configDir: config.configDir,
660
+ enableConfigDiscovery: config.enableConfigDiscovery,
659
661
  streaming: config.streaming,
660
662
  mcpServers: config.mcpServers,
661
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.js CHANGED
@@ -520,6 +520,7 @@ class CopilotClient {
520
520
  customAgents: config.customAgents,
521
521
  agent: config.agent,
522
522
  configDir: config.configDir,
523
+ enableConfigDiscovery: config.enableConfigDiscovery,
523
524
  skillDirectories: config.skillDirectories,
524
525
  disabledSkills: config.disabledSkills,
525
526
  infiniteSessions: config.infiniteSessions
@@ -636,6 +637,7 @@ class CopilotClient {
636
637
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
637
638
  workingDirectory: config.workingDirectory,
638
639
  configDir: config.configDir,
640
+ enableConfigDiscovery: config.enableConfigDiscovery,
639
641
  streaming: config.streaming,
640
642
  mcpServers: config.mcpServers,
641
643
  envValueMode: "direct",
@@ -351,6 +351,24 @@ export interface SessionFsSetProviderParams {
351
351
  */
352
352
  conventions: "windows" | "posix";
353
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
+ }
354
372
  export interface SessionModelGetCurrentResult {
355
373
  /**
356
374
  * Currently active model identifier
@@ -926,28 +944,6 @@ export interface SessionExtensionsReloadParams {
926
944
  */
927
945
  sessionId: string;
928
946
  }
929
- /** @experimental */
930
- export interface SessionCompactionCompactResult {
931
- /**
932
- * Whether compaction completed successfully
933
- */
934
- success: boolean;
935
- /**
936
- * Number of tokens freed by compaction
937
- */
938
- tokensRemoved: number;
939
- /**
940
- * Number of messages removed during compaction
941
- */
942
- messagesRemoved: number;
943
- }
944
- /** @experimental */
945
- export interface SessionCompactionCompactParams {
946
- /**
947
- * Target session identifier
948
- */
949
- sessionId: string;
950
- }
951
947
  export interface SessionToolsHandlePendingToolCallResult {
952
948
  /**
953
949
  * Whether the tool call result was handled successfully
@@ -1223,6 +1219,46 @@ export interface SessionShellKillParams {
1223
1219
  */
1224
1220
  signal?: "SIGTERM" | "SIGKILL" | "SIGINT";
1225
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
+ }
1226
1262
  export interface SessionFsReadFileResult {
1227
1263
  /**
1228
1264
  * File content as UTF-8 string
@@ -1437,6 +1473,10 @@ export declare function createServerRpc(connection: MessageConnection): {
1437
1473
  sessionFs: {
1438
1474
  setProvider: (params: SessionFsSetProviderParams) => Promise<SessionFsSetProviderResult>;
1439
1475
  };
1476
+ /** @experimental */
1477
+ sessions: {
1478
+ fork: (params: SessionsForkParams) => Promise<SessionsForkResult>;
1479
+ };
1440
1480
  };
1441
1481
  /** Create typed session-scoped RPC methods. */
1442
1482
  export declare function createSessionRpc(connection: MessageConnection, sessionId: string): {
@@ -1495,10 +1535,6 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
1495
1535
  disable: (params: Omit<SessionExtensionsDisableParams, "sessionId">) => Promise<SessionExtensionsDisableResult>;
1496
1536
  reload: () => Promise<SessionExtensionsReloadResult>;
1497
1537
  };
1498
- /** @experimental */
1499
- compaction: {
1500
- compact: () => Promise<SessionCompactionCompactResult>;
1501
- };
1502
1538
  tools: {
1503
1539
  handlePendingToolCall: (params: Omit<SessionToolsHandlePendingToolCallParams, "sessionId">) => Promise<SessionToolsHandlePendingToolCallResult>;
1504
1540
  };
@@ -1517,6 +1553,11 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
1517
1553
  exec: (params: Omit<SessionShellExecParams, "sessionId">) => Promise<SessionShellExecResult>;
1518
1554
  kill: (params: Omit<SessionShellKillParams, "sessionId">) => Promise<SessionShellKillResult>;
1519
1555
  };
1556
+ /** @experimental */
1557
+ history: {
1558
+ compact: () => Promise<SessionHistoryCompactResult>;
1559
+ truncate: (params: Omit<SessionHistoryTruncateParams, "sessionId">) => Promise<SessionHistoryTruncateResult>;
1560
+ };
1520
1561
  };
1521
1562
  /** Handler for `sessionFs` client session API methods. */
1522
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,7 +264,7 @@ export type SessionEvent = {
264
264
  ephemeral: true;
265
265
  type: "session.idle";
266
266
  /**
267
- * Payload indicating the session is fully idle with no background tasks in flight
267
+ * Payload indicating the session is idle with no background agents in flight
268
268
  */
269
269
  data: {
270
270
  /**
@@ -633,7 +633,7 @@ export type SessionEvent = {
633
633
  */
634
634
  data: {
635
635
  /**
636
- * 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
637
637
  */
638
638
  upToEventId: string;
639
639
  /**
@@ -1442,6 +1442,10 @@ export type SessionEvent = {
1442
1442
  * CAPI interaction ID for correlating this message with upstream telemetry
1443
1443
  */
1444
1444
  interactionId?: string;
1445
+ /**
1446
+ * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
1447
+ */
1448
+ requestId?: string;
1445
1449
  /**
1446
1450
  * Tool call ID of the parent tool invocation when this event originates from a sub-agent
1447
1451
  */
package/dist/types.d.ts CHANGED
@@ -887,6 +887,18 @@ export interface SessionConfig {
887
887
  * When specified, the session will use this directory for storing config and state.
888
888
  */
889
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;
890
902
  /**
891
903
  * Tools exposed to the CLI server
892
904
  */
@@ -992,7 +1004,7 @@ export interface SessionConfig {
992
1004
  /**
993
1005
  * Configuration for resuming a session
994
1006
  */
995
- export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "modelCapabilities" | "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"> & {
996
1008
  /**
997
1009
  * When true, skips emitting the session.resume event.
998
1010
  * Useful for reconnecting to a session without triggering resume-related side effects.
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.2-preview.0",
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.20-1",
59
+ "@github/copilot": "^1.0.21",
60
60
  "vscode-jsonrpc": "^8.2.1",
61
61
  "zod": "^4.3.6"
62
62
  },