@github/copilot-sdk 0.2.2 → 0.3.0-preview.0

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.
@@ -32,7 +32,9 @@ var import_node = require("vscode-jsonrpc/node.js");
32
32
  var import_rpc = require("./generated/rpc.js");
33
33
  var import_sdkProtocolVersion = require("./sdkProtocolVersion.js");
34
34
  var import_session = require("./session.js");
35
+ var import_sessionFsProvider = require("./sessionFsProvider.js");
35
36
  var import_telemetry = require("./telemetry.js");
37
+ var import_types = require("./types.js");
36
38
  const import_meta = {};
37
39
  const MIN_PROTOCOL_VERSION = 2;
38
40
  function isZodSchema(value) {
@@ -94,6 +96,7 @@ function getBundledCliPath() {
94
96
  );
95
97
  }
96
98
  class CopilotClient {
99
+ cliStartTimeout = null;
97
100
  cliProcess = null;
98
101
  connection = null;
99
102
  socket = null;
@@ -364,6 +367,10 @@ class CopilotClient {
364
367
  }
365
368
  this.cliProcess = null;
366
369
  }
370
+ if (this.cliStartTimeout) {
371
+ clearTimeout(this.cliStartTimeout);
372
+ this.cliStartTimeout = null;
373
+ }
367
374
  this.state = "disconnected";
368
375
  this.actualPort = null;
369
376
  this.stderrBuffer = "";
@@ -421,6 +428,10 @@ class CopilotClient {
421
428
  }
422
429
  this.cliProcess = null;
423
430
  }
431
+ if (this.cliStartTimeout) {
432
+ clearTimeout(this.cliStartTimeout);
433
+ this.cliStartTimeout = null;
434
+ }
424
435
  this.state = "disconnected";
425
436
  this.actualPort = null;
426
437
  this.stderrBuffer = "";
@@ -499,7 +510,9 @@ class CopilotClient {
499
510
  this.sessions.set(sessionId, session);
500
511
  if (this.sessionFsConfig) {
501
512
  if (config.createSessionFsHandler) {
502
- session.clientSessionApis.sessionFs = config.createSessionFsHandler(session);
513
+ session.clientSessionApis.sessionFs = (0, import_sessionFsProvider.createSessionFsAdapter)(
514
+ config.createSessionFsHandler(session)
515
+ );
503
516
  } else {
504
517
  throw new Error(
505
518
  "createSessionFsHandler is required in session config when sessionFs is enabled in client options."
@@ -535,9 +548,11 @@ class CopilotClient {
535
548
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
536
549
  workingDirectory: config.workingDirectory,
537
550
  streaming: config.streaming,
551
+ includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
538
552
  mcpServers: config.mcpServers,
539
553
  envValueMode: "direct",
540
554
  customAgents: config.customAgents,
555
+ defaultAgent: config.defaultAgent,
541
556
  agent: config.agent,
542
557
  configDir: config.configDir,
543
558
  enableConfigDiscovery: config.enableConfigDiscovery,
@@ -621,7 +636,9 @@ class CopilotClient {
621
636
  this.sessions.set(sessionId, session);
622
637
  if (this.sessionFsConfig) {
623
638
  if (config.createSessionFsHandler) {
624
- session.clientSessionApis.sessionFs = config.createSessionFsHandler(session);
639
+ session.clientSessionApis.sessionFs = (0, import_sessionFsProvider.createSessionFsAdapter)(
640
+ config.createSessionFsHandler(session)
641
+ );
625
642
  } else {
626
643
  throw new Error(
627
644
  "createSessionFsHandler is required in session config when sessionFs is enabled in client options."
@@ -651,7 +668,7 @@ class CopilotClient {
651
668
  })),
652
669
  provider: config.provider,
653
670
  modelCapabilities: config.modelCapabilities,
654
- requestPermission: true,
671
+ requestPermission: config.onPermissionRequest !== import_types.defaultJoinSessionPermissionHandler,
655
672
  requestUserInput: !!config.onUserInputRequest,
656
673
  requestElicitation: !!config.onElicitationRequest,
657
674
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
@@ -659,9 +676,11 @@ class CopilotClient {
659
676
  configDir: config.configDir,
660
677
  enableConfigDiscovery: config.enableConfigDiscovery,
661
678
  streaming: config.streaming,
679
+ includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
662
680
  mcpServers: config.mcpServers,
663
681
  envValueMode: "direct",
664
682
  customAgents: config.customAgents,
683
+ defaultAgent: config.defaultAgent,
665
684
  agent: config.agent,
666
685
  skillDirectories: config.skillDirectories,
667
686
  disabledSkills: config.disabledSkills,
@@ -763,6 +782,22 @@ class CopilotClient {
763
782
  const result = await this.connection.sendRequest("models.list", {});
764
783
  const response = result;
765
784
  models = response.models;
785
+ for (const model of models) {
786
+ const m = model;
787
+ if (!m.capabilities) {
788
+ m.capabilities = {
789
+ supports: {},
790
+ limits: { max_context_window_tokens: 0 }
791
+ };
792
+ } else {
793
+ if (!m.capabilities.supports) m.capabilities.supports = {};
794
+ if (!m.capabilities.limits) {
795
+ m.capabilities.limits = { max_context_window_tokens: 0 };
796
+ } else if (m.capabilities.limits.max_context_window_tokens === void 0) {
797
+ m.capabilities.limits.max_context_window_tokens = 0;
798
+ }
799
+ }
800
+ }
766
801
  }
767
802
  this.modelsCache = [...models];
768
803
  return [...models];
@@ -1133,7 +1168,7 @@ stderr: ${stderrOutput}`
1133
1168
  }
1134
1169
  }
1135
1170
  });
1136
- setTimeout(() => {
1171
+ this.cliStartTimeout = setTimeout(() => {
1137
1172
  if (!resolved) {
1138
1173
  resolved = true;
1139
1174
  reject(new Error("Timeout waiting for CLI server to start"));
@@ -22,9 +22,7 @@ __export(extension_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(extension_exports);
24
24
  var import_client = require("./client.js");
25
- const defaultJoinSessionPermissionHandler = () => ({
26
- kind: "no-result"
27
- });
25
+ var import_types = require("./types.js");
28
26
  async function joinSession(config = {}) {
29
27
  const sessionId = process.env.SESSION_ID;
30
28
  if (!sessionId) {
@@ -35,7 +33,7 @@ async function joinSession(config = {}) {
35
33
  const client = new import_client.CopilotClient({ isChildProcess: true });
36
34
  return client.resumeSession(sessionId, {
37
35
  ...config,
38
- onPermissionRequest: config.onPermissionRequest ?? defaultJoinSessionPermissionHandler,
36
+ onPermissionRequest: config.onPermissionRequest ?? import_types.defaultJoinSessionPermissionHandler,
39
37
  disableResume: config.disableResume ?? true
40
38
  });
41
39
  }
@@ -41,7 +41,14 @@ function createServerRpc(connection) {
41
41
  add: async (params) => connection.sendRequest("mcp.config.add", params),
42
42
  update: async (params) => connection.sendRequest("mcp.config.update", params),
43
43
  remove: async (params) => connection.sendRequest("mcp.config.remove", params)
44
- }
44
+ },
45
+ discover: async (params) => connection.sendRequest("mcp.discover", params)
46
+ },
47
+ skills: {
48
+ config: {
49
+ setDisabledSkills: async (params) => connection.sendRequest("skills.config.setDisabledSkills", params)
50
+ },
51
+ discover: async (params) => connection.sendRequest("skills.discover", params)
45
52
  },
46
53
  sessionFs: {
47
54
  setProvider: async (params) => connection.sendRequest("sessionFs.setProvider", params)
@@ -62,15 +69,23 @@ function createSessionRpc(connection, sessionId) {
62
69
  get: async () => connection.sendRequest("session.mode.get", { sessionId }),
63
70
  set: async (params) => connection.sendRequest("session.mode.set", { sessionId, ...params })
64
71
  },
72
+ name: {
73
+ get: async () => connection.sendRequest("session.name.get", { sessionId }),
74
+ set: async (params) => connection.sendRequest("session.name.set", { sessionId, ...params })
75
+ },
65
76
  plan: {
66
77
  read: async () => connection.sendRequest("session.plan.read", { sessionId }),
67
78
  update: async (params) => connection.sendRequest("session.plan.update", { sessionId, ...params }),
68
79
  delete: async () => connection.sendRequest("session.plan.delete", { sessionId })
69
80
  },
70
- workspace: {
71
- listFiles: async () => connection.sendRequest("session.workspace.listFiles", { sessionId }),
72
- readFile: async (params) => connection.sendRequest("session.workspace.readFile", { sessionId, ...params }),
73
- createFile: async (params) => connection.sendRequest("session.workspace.createFile", { sessionId, ...params })
81
+ workspaces: {
82
+ getWorkspace: async () => connection.sendRequest("session.workspaces.getWorkspace", { sessionId }),
83
+ listFiles: async () => connection.sendRequest("session.workspaces.listFiles", { sessionId }),
84
+ readFile: async (params) => connection.sendRequest("session.workspaces.readFile", { sessionId, ...params }),
85
+ createFile: async (params) => connection.sendRequest("session.workspaces.createFile", { sessionId, ...params })
86
+ },
87
+ instructions: {
88
+ getSources: async () => connection.sendRequest("session.instructions.getSources", { sessionId })
74
89
  },
75
90
  /** @experimental */
76
91
  fleet: {
@@ -131,6 +146,10 @@ function createSessionRpc(connection, sessionId) {
131
146
  history: {
132
147
  compact: async () => connection.sendRequest("session.history.compact", { sessionId }),
133
148
  truncate: async (params) => connection.sendRequest("session.history.truncate", { sessionId, ...params })
149
+ },
150
+ /** @experimental */
151
+ usage: {
152
+ getMetrics: async () => connection.sendRequest("session.usage.getMetrics", { sessionId })
134
153
  }
135
154
  };
136
155
  }
package/dist/cjs/index.js CHANGED
@@ -22,6 +22,8 @@ __export(index_exports, {
22
22
  CopilotSession: () => import_session.CopilotSession,
23
23
  SYSTEM_PROMPT_SECTIONS: () => import_types.SYSTEM_PROMPT_SECTIONS,
24
24
  approveAll: () => import_types.approveAll,
25
+ convertMcpCallToolResult: () => import_types.convertMcpCallToolResult,
26
+ createSessionFsAdapter: () => import_types.createSessionFsAdapter,
25
27
  defineTool: () => import_types.defineTool
26
28
  });
27
29
  module.exports = __toCommonJS(index_exports);
@@ -34,5 +36,7 @@ var import_types = require("./types.js");
34
36
  CopilotSession,
35
37
  SYSTEM_PROMPT_SECTIONS,
36
38
  approveAll,
39
+ convertMcpCallToolResult,
40
+ createSessionFsAdapter,
37
41
  defineTool
38
42
  });
@@ -124,7 +124,8 @@ class CopilotSession {
124
124
  sessionId: this.sessionId,
125
125
  prompt: options.prompt,
126
126
  attachments: options.attachments,
127
- mode: options.mode
127
+ mode: options.mode,
128
+ requestHeaders: options.requestHeaders
128
129
  });
129
130
  return response.messageId;
130
131
  }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var sessionFsProvider_exports = {};
20
+ __export(sessionFsProvider_exports, {
21
+ createSessionFsAdapter: () => createSessionFsAdapter
22
+ });
23
+ module.exports = __toCommonJS(sessionFsProvider_exports);
24
+ function createSessionFsAdapter(provider) {
25
+ return {
26
+ readFile: async ({ path }) => {
27
+ try {
28
+ const content = await provider.readFile(path);
29
+ return { content };
30
+ } catch (err) {
31
+ return { content: "", error: toSessionFsError(err) };
32
+ }
33
+ },
34
+ writeFile: async ({ path, content, mode }) => {
35
+ try {
36
+ await provider.writeFile(path, content, mode);
37
+ return void 0;
38
+ } catch (err) {
39
+ return toSessionFsError(err);
40
+ }
41
+ },
42
+ appendFile: async ({ path, content, mode }) => {
43
+ try {
44
+ await provider.appendFile(path, content, mode);
45
+ return void 0;
46
+ } catch (err) {
47
+ return toSessionFsError(err);
48
+ }
49
+ },
50
+ exists: async ({ path }) => {
51
+ try {
52
+ return { exists: await provider.exists(path) };
53
+ } catch {
54
+ return { exists: false };
55
+ }
56
+ },
57
+ stat: async ({ path }) => {
58
+ try {
59
+ return await provider.stat(path);
60
+ } catch (err) {
61
+ return {
62
+ isFile: false,
63
+ isDirectory: false,
64
+ size: 0,
65
+ mtime: (/* @__PURE__ */ new Date()).toISOString(),
66
+ birthtime: (/* @__PURE__ */ new Date()).toISOString(),
67
+ error: toSessionFsError(err)
68
+ };
69
+ }
70
+ },
71
+ mkdir: async ({ path, recursive, mode }) => {
72
+ try {
73
+ await provider.mkdir(path, recursive ?? false, mode);
74
+ return void 0;
75
+ } catch (err) {
76
+ return toSessionFsError(err);
77
+ }
78
+ },
79
+ readdir: async ({ path }) => {
80
+ try {
81
+ const entries = await provider.readdir(path);
82
+ return { entries };
83
+ } catch (err) {
84
+ return { entries: [], error: toSessionFsError(err) };
85
+ }
86
+ },
87
+ readdirWithTypes: async ({ path }) => {
88
+ try {
89
+ const entries = await provider.readdirWithTypes(path);
90
+ return { entries };
91
+ } catch (err) {
92
+ return { entries: [], error: toSessionFsError(err) };
93
+ }
94
+ },
95
+ rm: async ({ path, recursive, force }) => {
96
+ try {
97
+ await provider.rm(path, recursive ?? false, force ?? false);
98
+ return void 0;
99
+ } catch (err) {
100
+ return toSessionFsError(err);
101
+ }
102
+ },
103
+ rename: async ({ src, dest }) => {
104
+ try {
105
+ await provider.rename(src, dest);
106
+ return void 0;
107
+ } catch (err) {
108
+ return toSessionFsError(err);
109
+ }
110
+ }
111
+ };
112
+ }
113
+ function toSessionFsError(err) {
114
+ const e = err;
115
+ const code = e.code === "ENOENT" ? "ENOENT" : "UNKNOWN";
116
+ return { code, message: e.message ?? String(err) };
117
+ }
118
+ // Annotate the CommonJS export names for ESM import in node:
119
+ 0 && (module.exports = {
120
+ createSessionFsAdapter
121
+ });
package/dist/cjs/types.js CHANGED
@@ -20,9 +20,54 @@ var types_exports = {};
20
20
  __export(types_exports, {
21
21
  SYSTEM_PROMPT_SECTIONS: () => SYSTEM_PROMPT_SECTIONS,
22
22
  approveAll: () => approveAll,
23
+ convertMcpCallToolResult: () => convertMcpCallToolResult,
24
+ createSessionFsAdapter: () => import_sessionFsProvider.createSessionFsAdapter,
25
+ defaultJoinSessionPermissionHandler: () => defaultJoinSessionPermissionHandler,
23
26
  defineTool: () => defineTool
24
27
  });
25
28
  module.exports = __toCommonJS(types_exports);
29
+ var import_sessionFsProvider = require("./sessionFsProvider.js");
30
+ function convertMcpCallToolResult(callResult) {
31
+ const textParts = [];
32
+ const binaryResults = [];
33
+ for (const block of callResult.content) {
34
+ switch (block.type) {
35
+ case "text":
36
+ if (typeof block.text === "string") {
37
+ textParts.push(block.text);
38
+ }
39
+ break;
40
+ case "image":
41
+ if (typeof block.data === "string" && block.data && typeof block.mimeType === "string") {
42
+ binaryResults.push({
43
+ data: block.data,
44
+ mimeType: block.mimeType,
45
+ type: "image"
46
+ });
47
+ }
48
+ break;
49
+ case "resource": {
50
+ if (block.resource?.text) {
51
+ textParts.push(block.resource.text);
52
+ }
53
+ if (block.resource?.blob) {
54
+ binaryResults.push({
55
+ data: block.resource.blob,
56
+ mimeType: block.resource.mimeType ?? "application/octet-stream",
57
+ type: "resource",
58
+ description: block.resource.uri
59
+ });
60
+ }
61
+ break;
62
+ }
63
+ }
64
+ }
65
+ return {
66
+ textResultForLlm: textParts.join("\n"),
67
+ resultType: callResult.isError ? "failure" : "success",
68
+ ...binaryResults.length > 0 ? { binaryResultsForLlm: binaryResults } : {}
69
+ };
70
+ }
26
71
  function defineTool(name, config) {
27
72
  return { name, ...config };
28
73
  }
@@ -41,9 +86,15 @@ const SYSTEM_PROMPT_SECTIONS = {
41
86
  }
42
87
  };
43
88
  const approveAll = () => ({ kind: "approved" });
89
+ const defaultJoinSessionPermissionHandler = () => ({
90
+ kind: "no-result"
91
+ });
44
92
  // Annotate the CommonJS export names for ESM import in node:
45
93
  0 && (module.exports = {
46
94
  SYSTEM_PROMPT_SECTIONS,
47
95
  approveAll,
96
+ convertMcpCallToolResult,
97
+ createSessionFsAdapter,
98
+ defaultJoinSessionPermissionHandler,
48
99
  defineTool
49
100
  });
package/dist/client.d.ts CHANGED
@@ -35,6 +35,7 @@ import type { ConnectionState, CopilotClientOptions, GetAuthStatusResponse, GetS
35
35
  * ```
36
36
  */
37
37
  export declare class CopilotClient {
38
+ private cliStartTimeout;
38
39
  private cliProcess;
39
40
  private connection;
40
41
  private socket;
package/dist/client.js CHANGED
@@ -13,7 +13,9 @@ import {
13
13
  import { createServerRpc, registerClientSessionApiHandlers } from "./generated/rpc.js";
14
14
  import { getSdkProtocolVersion } from "./sdkProtocolVersion.js";
15
15
  import { CopilotSession, NO_RESULT_PERMISSION_V2_ERROR } from "./session.js";
16
+ import { createSessionFsAdapter } from "./sessionFsProvider.js";
16
17
  import { getTraceContext } from "./telemetry.js";
18
+ import { defaultJoinSessionPermissionHandler } from "./types.js";
17
19
  const MIN_PROTOCOL_VERSION = 2;
18
20
  function isZodSchema(value) {
19
21
  return value != null && typeof value === "object" && "toJSONSchema" in value && typeof value.toJSONSchema === "function";
@@ -74,6 +76,7 @@ function getBundledCliPath() {
74
76
  );
75
77
  }
76
78
  class CopilotClient {
79
+ cliStartTimeout = null;
77
80
  cliProcess = null;
78
81
  connection = null;
79
82
  socket = null;
@@ -344,6 +347,10 @@ class CopilotClient {
344
347
  }
345
348
  this.cliProcess = null;
346
349
  }
350
+ if (this.cliStartTimeout) {
351
+ clearTimeout(this.cliStartTimeout);
352
+ this.cliStartTimeout = null;
353
+ }
347
354
  this.state = "disconnected";
348
355
  this.actualPort = null;
349
356
  this.stderrBuffer = "";
@@ -401,6 +408,10 @@ class CopilotClient {
401
408
  }
402
409
  this.cliProcess = null;
403
410
  }
411
+ if (this.cliStartTimeout) {
412
+ clearTimeout(this.cliStartTimeout);
413
+ this.cliStartTimeout = null;
414
+ }
404
415
  this.state = "disconnected";
405
416
  this.actualPort = null;
406
417
  this.stderrBuffer = "";
@@ -479,7 +490,9 @@ class CopilotClient {
479
490
  this.sessions.set(sessionId, session);
480
491
  if (this.sessionFsConfig) {
481
492
  if (config.createSessionFsHandler) {
482
- session.clientSessionApis.sessionFs = config.createSessionFsHandler(session);
493
+ session.clientSessionApis.sessionFs = createSessionFsAdapter(
494
+ config.createSessionFsHandler(session)
495
+ );
483
496
  } else {
484
497
  throw new Error(
485
498
  "createSessionFsHandler is required in session config when sessionFs is enabled in client options."
@@ -515,9 +528,11 @@ class CopilotClient {
515
528
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
516
529
  workingDirectory: config.workingDirectory,
517
530
  streaming: config.streaming,
531
+ includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
518
532
  mcpServers: config.mcpServers,
519
533
  envValueMode: "direct",
520
534
  customAgents: config.customAgents,
535
+ defaultAgent: config.defaultAgent,
521
536
  agent: config.agent,
522
537
  configDir: config.configDir,
523
538
  enableConfigDiscovery: config.enableConfigDiscovery,
@@ -601,7 +616,9 @@ class CopilotClient {
601
616
  this.sessions.set(sessionId, session);
602
617
  if (this.sessionFsConfig) {
603
618
  if (config.createSessionFsHandler) {
604
- session.clientSessionApis.sessionFs = config.createSessionFsHandler(session);
619
+ session.clientSessionApis.sessionFs = createSessionFsAdapter(
620
+ config.createSessionFsHandler(session)
621
+ );
605
622
  } else {
606
623
  throw new Error(
607
624
  "createSessionFsHandler is required in session config when sessionFs is enabled in client options."
@@ -631,7 +648,7 @@ class CopilotClient {
631
648
  })),
632
649
  provider: config.provider,
633
650
  modelCapabilities: config.modelCapabilities,
634
- requestPermission: true,
651
+ requestPermission: config.onPermissionRequest !== defaultJoinSessionPermissionHandler,
635
652
  requestUserInput: !!config.onUserInputRequest,
636
653
  requestElicitation: !!config.onElicitationRequest,
637
654
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
@@ -639,9 +656,11 @@ class CopilotClient {
639
656
  configDir: config.configDir,
640
657
  enableConfigDiscovery: config.enableConfigDiscovery,
641
658
  streaming: config.streaming,
659
+ includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
642
660
  mcpServers: config.mcpServers,
643
661
  envValueMode: "direct",
644
662
  customAgents: config.customAgents,
663
+ defaultAgent: config.defaultAgent,
645
664
  agent: config.agent,
646
665
  skillDirectories: config.skillDirectories,
647
666
  disabledSkills: config.disabledSkills,
@@ -743,6 +762,22 @@ class CopilotClient {
743
762
  const result = await this.connection.sendRequest("models.list", {});
744
763
  const response = result;
745
764
  models = response.models;
765
+ for (const model of models) {
766
+ const m = model;
767
+ if (!m.capabilities) {
768
+ m.capabilities = {
769
+ supports: {},
770
+ limits: { max_context_window_tokens: 0 }
771
+ };
772
+ } else {
773
+ if (!m.capabilities.supports) m.capabilities.supports = {};
774
+ if (!m.capabilities.limits) {
775
+ m.capabilities.limits = { max_context_window_tokens: 0 };
776
+ } else if (m.capabilities.limits.max_context_window_tokens === void 0) {
777
+ m.capabilities.limits.max_context_window_tokens = 0;
778
+ }
779
+ }
780
+ }
746
781
  }
747
782
  this.modelsCache = [...models];
748
783
  return [...models];
@@ -1113,7 +1148,7 @@ stderr: ${stderrOutput}`
1113
1148
  }
1114
1149
  }
1115
1150
  });
1116
- setTimeout(() => {
1151
+ this.cliStartTimeout = setTimeout(() => {
1117
1152
  if (!resolved) {
1118
1153
  resolved = true;
1119
1154
  reject(new Error("Timeout waiting for CLI server to start"));
@@ -1,5 +1,5 @@
1
1
  import type { CopilotSession } from "./session.js";
2
- import type { PermissionHandler, ResumeSessionConfig } from "./types.js";
2
+ import { type PermissionHandler, type ResumeSessionConfig } from "./types.js";
3
3
  export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest"> & {
4
4
  onPermissionRequest?: PermissionHandler;
5
5
  };
package/dist/extension.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CopilotClient } from "./client.js";
2
- const defaultJoinSessionPermissionHandler = () => ({
3
- kind: "no-result"
4
- });
2
+ import {
3
+ defaultJoinSessionPermissionHandler
4
+ } from "./types.js";
5
5
  async function joinSession(config = {}) {
6
6
  const sessionId = process.env.SESSION_ID;
7
7
  if (!sessionId) {