@github/copilot-language-server 1.528.0 → 1.530.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.
@@ -18,9 +18,19 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var sessionFsProvider_exports = {};
20
20
  __export(sessionFsProvider_exports, {
21
+ SessionFsSqliteTransactionFailure: () => SessionFsSqliteTransactionFailure,
21
22
  createSessionFsAdapter: () => createSessionFsAdapter
22
23
  });
23
24
  module.exports = __toCommonJS(sessionFsProvider_exports);
25
+ class SessionFsSqliteTransactionFailure extends Error {
26
+ /** Failure classification reported to the runtime. */
27
+ errorClass;
28
+ constructor(message, errorClass = "fatal") {
29
+ super(message);
30
+ this.name = "SessionFsSqliteTransactionFailure";
31
+ this.errorClass = errorClass;
32
+ }
33
+ }
24
34
  function normalizeSqliteParams(params) {
25
35
  if (!params) {
26
36
  return void 0;
@@ -136,6 +146,29 @@ function createSessionFsAdapter(provider) {
136
146
  );
137
147
  return result ?? { rows: [], columns: [], rowsAffected: 0 };
138
148
  },
149
+ sqliteTransaction: async ({ statements }) => {
150
+ if (!provider.sqlite?.transaction) {
151
+ return {
152
+ results: [],
153
+ error: {
154
+ errorClass: "fatal",
155
+ message: "SQLite transactions are not supported by this provider"
156
+ }
157
+ };
158
+ }
159
+ try {
160
+ const results = await provider.sqlite.transaction(
161
+ statements.map((statement) => ({
162
+ queryType: statement.queryType,
163
+ query: statement.query,
164
+ params: normalizeSqliteParams(statement.params)
165
+ }))
166
+ );
167
+ return { results: results.map((result) => ({ ...result })) };
168
+ } catch (err) {
169
+ return { results: [], error: toSqliteTransactionError(err) };
170
+ }
171
+ },
139
172
  sqliteExists: async () => {
140
173
  if (!provider.sqlite) {
141
174
  throw new Error("SQLite is not supported by this provider");
@@ -149,7 +182,17 @@ function toSessionFsError(err) {
149
182
  const code = e.code === "ENOENT" ? "ENOENT" : "UNKNOWN";
150
183
  return { code, message: e.message ?? String(err) };
151
184
  }
185
+ function toSqliteTransactionError(err) {
186
+ if (err instanceof SessionFsSqliteTransactionFailure) {
187
+ return { errorClass: err.errorClass, message: err.message };
188
+ }
189
+ return {
190
+ errorClass: "fatal",
191
+ message: err instanceof Error ? err.message : String(err)
192
+ };
193
+ }
152
194
  // Annotate the CommonJS export names for ESM import in node:
153
195
  0 && (module.exports = {
196
+ SessionFsSqliteTransactionFailure,
154
197
  createSessionFsAdapter
155
198
  });
@@ -24,6 +24,7 @@ __export(types_exports, {
24
24
  CopilotWebSocketHandler: () => import_copilotRequestHandler.CopilotWebSocketHandler,
25
25
  RuntimeConnection: () => RuntimeConnection,
26
26
  SYSTEM_MESSAGE_SECTIONS: () => SYSTEM_MESSAGE_SECTIONS,
27
+ SessionFsSqliteTransactionFailure: () => import_sessionFsProvider2.SessionFsSqliteTransactionFailure,
27
28
  approveAll: () => approveAll,
28
29
  convertMcpCallToolResult: () => convertMcpCallToolResult,
29
30
  createSessionFsAdapter: () => import_sessionFsProvider.createSessionFsAdapter,
@@ -32,6 +33,7 @@ __export(types_exports, {
32
33
  });
33
34
  module.exports = __toCommonJS(types_exports);
34
35
  var import_sessionFsProvider = require("./sessionFsProvider.js");
36
+ var import_sessionFsProvider2 = require("./sessionFsProvider.js");
35
37
  var import_copilotRequestHandler = require("./copilotRequestHandler.js");
36
38
  const RuntimeConnection = {
37
39
  /**
@@ -39,7 +41,7 @@ const RuntimeConnection = {
39
41
  * This is the default if no {@link CopilotClientOptions.connection} is set.
40
42
  */
41
43
  forStdio(opts = {}) {
42
- return { kind: "stdio", path: opts.path, args: opts.args };
44
+ return { kind: "stdio", path: opts.path, args: opts.args, env: opts.env };
43
45
  },
44
46
  /**
45
47
  * Spawn a runtime child process that listens on a TCP socket and connect to it.
@@ -50,7 +52,8 @@ const RuntimeConnection = {
50
52
  port: opts.port,
51
53
  connectionToken: opts.connectionToken,
52
54
  path: opts.path,
53
- args: opts.args
55
+ args: opts.args,
56
+ env: opts.env
54
57
  };
55
58
  },
56
59
  /**
@@ -59,6 +62,18 @@ const RuntimeConnection = {
59
62
  */
60
63
  forUri(url, opts = {}) {
61
64
  return { kind: "uri", url, connectionToken: opts.connectionToken };
65
+ },
66
+ /**
67
+ * Host the runtime in-process over the native runtime library's C ABI (FFI).
68
+ *
69
+ * @experimental Per-client options lowered to environment variables (`env`,
70
+ * `telemetry`, `gitHubToken`, `baseDirectory`) are **not** honored in-process;
71
+ * the worker inherits the host process's ambient environment. Set the
72
+ * corresponding environment variables on the host process instead. See
73
+ * https://github.com/github/copilot-sdk/issues/1934.
74
+ */
75
+ forInProcess() {
76
+ return { kind: "inprocess" };
62
77
  }
63
78
  };
64
79
  function convertMcpCallToolResult(callResult) {
@@ -126,7 +141,18 @@ const SYSTEM_MESSAGE_SECTIONS = {
126
141
  description: "End-of-prompt instructions: parallel tool calling, persistence, task completion"
127
142
  }
128
143
  };
129
- const approveAll = () => ({ kind: "approve-once" });
144
+ const approveAll = (request, invocation) => {
145
+ if (invocation.managedSettingsEnabled) {
146
+ throw new Error("approveAll cannot be used when managed settings are enabled");
147
+ }
148
+ if ("managedApprovalRequired" in request) {
149
+ const managedApprovalRequired = request.managedApprovalRequired;
150
+ if (managedApprovalRequired !== void 0 && managedApprovalRequired !== false) {
151
+ return { kind: "no-result" };
152
+ }
153
+ }
154
+ return { kind: "approve-once" };
155
+ };
130
156
  const defaultJoinSessionPermissionHandler = () => ({
131
157
  kind: "no-result"
132
158
  });
@@ -138,6 +164,7 @@ const defaultJoinSessionPermissionHandler = () => ({
138
164
  CopilotWebSocketHandler,
139
165
  RuntimeConnection,
140
166
  SYSTEM_MESSAGE_SECTIONS,
167
+ SessionFsSqliteTransactionFailure,
141
168
  approveAll,
142
169
  convertMcpCallToolResult,
143
170
  createSessionFsAdapter,
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/github/copilot-sdk.git"
6
6
  },
7
- "version": "1.0.6-preview.1",
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,8 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.69-0",
59
+ "@github/copilot": "^1.0.78",
60
+ "koffi": "^3.1.0",
60
61
  "vscode-jsonrpc": "^8.2.1",
61
62
  "zod": "^4.3.6"
62
63
  },
@@ -1079,13 +1079,15 @@ function createMessageConnection(messageReader, messageWriter, _logger, options)
1079
1079
  };
1080
1080
  const responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
1081
1081
  try {
1082
- await messageWriter.write(requestMessage);
1083
1082
  responsePromises.set(id, responsePromise);
1083
+ await messageWriter.write(requestMessage);
1084
1084
  }
1085
1085
  catch (error) {
1086
- logger.error(`Sending request failed.`);
1087
- // Writing the message failed. So we need to reject the promise.
1086
+ // Writing the message failed. So we need to delete it from the response promises and
1087
+ // reject it.
1088
+ responsePromises.delete(id);
1088
1089
  responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error.message ? error.message : 'Unknown reason'));
1090
+ logger.error(`Sending request failed.`);
1089
1091
  throw error;
1090
1092
  }
1091
1093
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vscode-jsonrpc",
3
3
  "description": "A json rpc implementation over streams",
4
- "version": "8.2.0",
4
+ "version": "8.2.1",
5
5
  "author": "Microsoft Corporation",
6
6
  "license": "MIT",
7
7
  "repository": {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "git+https://github.com/github/copilot-language-server-release.git"
12
12
  },
13
13
  "license": "MIT",
14
- "version": "1.528.0",
14
+ "version": "1.530.0",
15
15
  "bin": {
16
16
  "copilot-language-server": "../dist/language-server.js"
17
17
  },
@@ -42,19 +42,19 @@
42
42
  "vscode-languageserver-protocol": "^3.17.5"
43
43
  },
44
44
  "optionalDependencies": {
45
- "@github/copilot-language-server-win32-x64": "1.528.0",
46
- "@github/copilot-language-server-win32-arm64": "1.528.0",
47
- "@github/copilot-language-server-linux-x64": "1.528.0",
48
- "@github/copilot-language-server-linux-arm64": "1.528.0",
49
- "@github/copilot-language-server-darwin-x64": "1.528.0",
50
- "@github/copilot-language-server-darwin-arm64": "1.528.0",
51
- "@github/copilot-win32-x64": "1.0.70",
52
- "@github/copilot-win32-arm64": "1.0.70",
53
- "@github/copilot-linux-x64": "1.0.70",
54
- "@github/copilot-linux-arm64": "1.0.70",
55
- "@github/copilot-darwin-x64": "1.0.70",
56
- "@github/copilot-darwin-arm64": "1.0.70"
45
+ "@github/copilot-language-server-win32-x64": "1.530.0",
46
+ "@github/copilot-language-server-win32-arm64": "1.530.0",
47
+ "@github/copilot-language-server-linux-x64": "1.530.0",
48
+ "@github/copilot-language-server-linux-arm64": "1.530.0",
49
+ "@github/copilot-language-server-darwin-x64": "1.530.0",
50
+ "@github/copilot-language-server-darwin-arm64": "1.530.0",
51
+ "@github/copilot-win32-x64": "1.0.78",
52
+ "@github/copilot-win32-arm64": "1.0.78",
53
+ "@github/copilot-linux-x64": "1.0.78",
54
+ "@github/copilot-linux-arm64": "1.0.78",
55
+ "@github/copilot-darwin-x64": "1.0.78",
56
+ "@github/copilot-darwin-arm64": "1.0.78"
57
57
  },
58
58
  "buildType": "prod",
59
- "build": "91"
59
+ "build": "93"
60
60
  }