@github/copilot-sdk 1.0.17-preview.2 → 1.0.17-preview.4

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/cjs/types.js CHANGED
@@ -26,6 +26,7 @@ __export(types_exports, {
26
26
  RuntimeConnection: () => RuntimeConnection,
27
27
  SYSTEM_MESSAGE_SECTIONS: () => SYSTEM_MESSAGE_SECTIONS,
28
28
  SessionFsSqliteTransactionFailure: () => import_sessionFsProvider2.SessionFsSqliteTransactionFailure,
29
+ SessionFsWriteFailure: () => import_sessionFsProvider3.SessionFsWriteFailure,
29
30
  approveAll: () => approveAll,
30
31
  convertMcpCallToolResult: () => convertMcpCallToolResult,
31
32
  createAttributedPermissionResult: () => createAttributedPermissionResult,
@@ -37,6 +38,7 @@ __export(types_exports, {
37
38
  module.exports = __toCommonJS(types_exports);
38
39
  var import_sessionFsProvider = require("./sessionFsProvider.js");
39
40
  var import_sessionFsProvider2 = require("./sessionFsProvider.js");
41
+ var import_sessionFsProvider3 = require("./sessionFsProvider.js");
40
42
  var import_copilotRequestHandler = require("./copilotRequestHandler.js");
41
43
  const RuntimeConnection = {
42
44
  /**
@@ -138,10 +140,10 @@ const SYSTEM_MESSAGE_SECTIONS = {
138
140
  tool_instructions: { description: "Per-tool usage instructions" },
139
141
  custom_instructions: { description: "Repository and organization custom instructions" },
140
142
  runtime_instructions: {
141
- description: "Runtime-provided context and instructions (e.g. system notifications, memories, workspace context, mode-specific instructions, content-exclusion policy)"
143
+ description: "Runtime-provided system-prompt context and instructions, such as system notifications, memories, workspace context, and content-exclusion policy. Mode-specific instructions can travel in transition messages instead."
142
144
  },
143
145
  last_instructions: {
144
- description: "End-of-prompt instructions: parallel tool calling, persistence, task completion"
146
+ description: "End-of-prompt instructions: parallel tool calling, persistence, task completion, and configured subagent-model guidance when the task tool is available"
145
147
  }
146
148
  };
147
149
  function isAttributedPermissionResult(result) {
@@ -182,6 +184,7 @@ const DisableBypassPermissionsModes = {
182
184
  RuntimeConnection,
183
185
  SYSTEM_MESSAGE_SECTIONS,
184
186
  SessionFsSqliteTransactionFailure,
187
+ SessionFsWriteFailure,
185
188
  approveAll,
186
189
  convertMcpCallToolResult,
187
190
  createAttributedPermissionResult,
@@ -1,2 +1,2 @@
1
- export declare const COPILOT_CLI_VERSION = "1.0.92-2";
1
+ export declare const COPILOT_CLI_VERSION = "1.0.92-4";
2
2
  export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
@@ -1,4 +1,4 @@
1
- const COPILOT_CLI_VERSION = "1.0.92-2";
1
+ const COPILOT_CLI_VERSION = "1.0.92-4";
2
2
  const COPILOT_CLI_USE_NPM_PACKAGE = false;
3
3
  export {
4
4
  COPILOT_CLI_USE_NPM_PACKAGE,
package/dist/client.js CHANGED
@@ -32,6 +32,7 @@ import { ToolSet } from "./toolSet.js";
32
32
  import { defaultJoinSessionPermissionHandler } from "./types.js";
33
33
  const MIN_PROTOCOL_VERSION = 3;
34
34
  const RUNTIME_SHUTDOWN_TIMEOUT_MS = 1e4;
35
+ const CLOUD_SESSION_CLEANUP_TIMEOUT_MS = 1e4;
35
36
  function createMessageConnection(reader, writer) {
36
37
  let dispatch;
37
38
  let finishDrain;
@@ -560,6 +561,11 @@ class CopilotClient {
560
561
  "SessionFsConfig declares capabilities.sqlite but the provider does not implement sqlite."
561
562
  );
562
563
  }
564
+ if (this.sessionFsConfig.capabilities?.binary && (!provider.readFileBytes || !provider.writeFileBytes)) {
565
+ throw new Error(
566
+ "SessionFsConfig declares capabilities.binary but the provider does not implement readFileBytes and writeFileBytes."
567
+ );
568
+ }
563
569
  session.clientSessionApis.sessionFs = createSessionFsAdapter(provider);
564
570
  }
565
571
  setupClientGlobalHandlers() {
@@ -1243,12 +1249,13 @@ class CopilotClient {
1243
1249
  if (config.onEvent) {
1244
1250
  s.on(config.onEvent);
1245
1251
  }
1246
- this.sessions.set(sessionId, s);
1247
1252
  this.setupSessionFs(s, config);
1253
+ this.sessions.set(sessionId, s);
1248
1254
  return s;
1249
1255
  };
1250
1256
  let session;
1251
1257
  let registeredId;
1258
+ let uninitializedCloudSessionId;
1252
1259
  if (localSessionId !== void 0) {
1253
1260
  try {
1254
1261
  session = initializeSession(localSessionId);
@@ -1371,7 +1378,9 @@ class CopilotClient {
1371
1378
  );
1372
1379
  }
1373
1380
  if (session === void 0) {
1381
+ uninitializedCloudSessionId = returnedSessionId;
1374
1382
  session = initializeSession(returnedSessionId);
1383
+ uninitializedCloudSessionId = void 0;
1375
1384
  registeredId = returnedSessionId;
1376
1385
  }
1377
1386
  this.assignGitHubTokenProvider(gitHubTokenProviderRegistrationId, returnedSessionId);
@@ -1393,6 +1402,20 @@ class CopilotClient {
1393
1402
  if (gitHubTokenProviderRegistrationId !== void 0) {
1394
1403
  this.githubTokenProviders.delete(gitHubTokenProviderRegistrationId);
1395
1404
  }
1405
+ if (uninitializedCloudSessionId !== void 0) {
1406
+ try {
1407
+ await withTimeout(
1408
+ this.deleteSession(uninitializedCloudSessionId),
1409
+ CLOUD_SESSION_CLEANUP_TIMEOUT_MS,
1410
+ `session.delete timed out after ${CLOUD_SESSION_CLEANUP_TIMEOUT_MS}ms`
1411
+ );
1412
+ } catch (cleanupError) {
1413
+ throw new AggregateError(
1414
+ [e, cleanupError],
1415
+ "Failed to initialize and delete cloud session"
1416
+ );
1417
+ }
1418
+ }
1396
1419
  throw e;
1397
1420
  }
1398
1421
  for (const entry of this.hostHandoffs.values()) {
@@ -1492,8 +1515,8 @@ class CopilotClient {
1492
1515
  if (config.onEvent) {
1493
1516
  session.on(config.onEvent);
1494
1517
  }
1495
- this.sessions.set(sessionId, session);
1496
1518
  this.setupSessionFs(session, config);
1519
+ this.sessions.set(sessionId, session);
1497
1520
  const toolFilterOptions = this.resolveToolFilterOptions(config);
1498
1521
  const gitHubTokenProviderRegistrationId = this.registerGitHubTokenProvider(
1499
1522
  config.gitHubTokenProvider,