@github/copilot-language-server 1.551.1 → 1.551.3
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/main.js +748 -748
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/cliVersion.js +1 -1
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/client.js +499 -36
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/copilotRequestHandler.js +156 -20
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/extension.js +11 -9
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/ffiRuntimeHost.js +14 -3
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/generated/rpc.js +1305 -304
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/host.js +67 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/index.js +12 -7
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/installationConfirmation.js +98 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/runtimeArtifacts.js +1 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/schema.js +40 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/session.js +474 -151
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/sessionFsProvider.js +57 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/types.js +5 -2
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/{factory.js → workflow.js} +33 -33
- package/dist/node_modules/@github/copilot-sdk/package.json +27 -16
- package/dist/node_modules/zod/locales/package.json +1 -2
- package/dist/node_modules/zod/mini/package.json +1 -2
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/node_modules/zod/v3/package.json +1 -2
- package/dist/node_modules/zod/v4/classic/errors.js +2 -2
- package/dist/node_modules/zod/v4/classic/from-json-schema.cjs +16 -31
- package/dist/node_modules/zod/v4/classic/from-json-schema.js +16 -31
- package/dist/node_modules/zod/v4/classic/package.json +1 -2
- package/dist/node_modules/zod/v4/classic/schemas.cjs +119 -358
- package/dist/node_modules/zod/v4/classic/schemas.js +118 -356
- package/dist/node_modules/zod/v4/core/api.cjs +2 -7
- package/dist/node_modules/zod/v4/core/api.js +2 -7
- package/dist/node_modules/zod/v4/core/core.cjs +1 -3
- package/dist/node_modules/zod/v4/core/core.js +2 -4
- package/dist/node_modules/zod/v4/core/errors.cjs +23 -26
- package/dist/node_modules/zod/v4/core/errors.js +23 -26
- package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +20 -16
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +20 -16
- package/dist/node_modules/zod/v4/core/package.json +1 -2
- package/dist/node_modules/zod/v4/core/parse.cjs +7 -7
- package/dist/node_modules/zod/v4/core/parse.js +7 -7
- package/dist/node_modules/zod/v4/core/regexes.cjs +3 -9
- package/dist/node_modules/zod/v4/core/regexes.js +1 -7
- package/dist/node_modules/zod/v4/core/schemas.cjs +65 -211
- package/dist/node_modules/zod/v4/core/schemas.js +64 -210
- package/dist/node_modules/zod/v4/core/to-json-schema.cjs +1 -12
- package/dist/node_modules/zod/v4/core/to-json-schema.js +1 -12
- package/dist/node_modules/zod/v4/core/util.cjs +30 -54
- package/dist/node_modules/zod/v4/core/util.js +32 -55
- package/dist/node_modules/zod/v4/core/versions.cjs +2 -2
- package/dist/node_modules/zod/v4/core/versions.js +2 -2
- package/dist/node_modules/zod/v4/locales/en.cjs +0 -4
- package/dist/node_modules/zod/v4/locales/en.js +0 -4
- package/dist/node_modules/zod/v4/locales/fr.cjs +7 -24
- package/dist/node_modules/zod/v4/locales/fr.js +7 -24
- package/dist/node_modules/zod/v4/locales/index.cjs +1 -8
- package/dist/node_modules/zod/v4/locales/index.js +0 -3
- package/dist/node_modules/zod/v4/locales/it.cjs +1 -1
- package/dist/node_modules/zod/v4/locales/it.js +1 -1
- package/dist/node_modules/zod/v4/locales/ka.cjs +8 -8
- package/dist/node_modules/zod/v4/locales/ka.js +8 -8
- package/dist/node_modules/zod/v4/locales/package.json +1 -2
- package/dist/node_modules/zod/v4/locales/uz.cjs +0 -1
- package/dist/node_modules/zod/v4/locales/uz.js +0 -1
- package/dist/node_modules/zod/v4/mini/package.json +1 -2
- package/dist/node_modules/zod/v4/mini/schemas.cjs +4 -41
- package/dist/node_modules/zod/v4/mini/schemas.js +4 -40
- package/dist/node_modules/zod/v4/package.json +1 -2
- package/dist/node_modules/zod/v4-mini/package.json +1 -2
- package/package.json +20 -20
- package/dist/node_modules/zod/v4/locales/el.cjs +0 -136
- package/dist/node_modules/zod/v4/locales/el.js +0 -109
- package/dist/node_modules/zod/v4/locales/hr.cjs +0 -149
- package/dist/node_modules/zod/v4/locales/hr.js +0 -122
- package/dist/node_modules/zod/v4/locales/ro.cjs +0 -146
- package/dist/node_modules/zod/v4/locales/ro.js +0 -119
|
@@ -27,6 +27,7 @@ __export(copilotRequestHandler_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(copilotRequestHandler_exports);
|
|
28
28
|
const sharedTextDecoder = new TextDecoder("utf-8", { fatal: false });
|
|
29
29
|
const sharedTextEncoder = new TextEncoder();
|
|
30
|
+
const HTTP_RESPONSE_READ_AHEAD_BYTES = 32 * 1024;
|
|
30
31
|
const kBridge = /* @__PURE__ */ Symbol("copilotWebSocketResponseBridge");
|
|
31
32
|
const kCompletion = /* @__PURE__ */ Symbol("copilotWebSocketCompletion");
|
|
32
33
|
const kOpen = /* @__PURE__ */ Symbol("copilotWebSocketOpen");
|
|
@@ -265,7 +266,9 @@ function createCopilotRequestAdapter(handler, getServerRpc) {
|
|
|
265
266
|
const message = err instanceof Error ? err.message : String(err);
|
|
266
267
|
await finalize(exchange, 502, message);
|
|
267
268
|
} finally {
|
|
268
|
-
pending.
|
|
269
|
+
if (pending.get(exchange.requestId) === exchange) {
|
|
270
|
+
pending.delete(exchange.requestId);
|
|
271
|
+
}
|
|
269
272
|
}
|
|
270
273
|
}
|
|
271
274
|
return {
|
|
@@ -278,6 +281,13 @@ function createCopilotRequestAdapter(handler, getServerRpc) {
|
|
|
278
281
|
async httpRequestChunk(params) {
|
|
279
282
|
routeChunk(getOrCreate(params.requestId), params);
|
|
280
283
|
return {};
|
|
284
|
+
},
|
|
285
|
+
cancelPending() {
|
|
286
|
+
const exchanges = [...pending.values()];
|
|
287
|
+
pending.clear();
|
|
288
|
+
for (const exchange of exchanges) {
|
|
289
|
+
exchange.pushCancel("RPC connection closed");
|
|
290
|
+
}
|
|
281
291
|
}
|
|
282
292
|
};
|
|
283
293
|
}
|
|
@@ -526,30 +536,156 @@ async function drainAsync(stream) {
|
|
|
526
536
|
return out;
|
|
527
537
|
}
|
|
528
538
|
async function streamResponse(response, exchange) {
|
|
529
|
-
|
|
530
|
-
status: response.status,
|
|
531
|
-
statusText: response.statusText || void 0,
|
|
532
|
-
headers: headersToMultiMap(response.headers)
|
|
533
|
-
});
|
|
534
|
-
const body = response.body;
|
|
535
|
-
if (!body) {
|
|
536
|
-
await exchange.endResponse();
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
|
-
const reader = body.getReader();
|
|
539
|
+
const reader = response.body ? new HttpResponseReader(response.body, exchange.signal) : void 0;
|
|
540
540
|
try {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
541
|
+
await exchange.startResponse({
|
|
542
|
+
status: response.status,
|
|
543
|
+
statusText: response.statusText || void 0,
|
|
544
|
+
headers: headersToMultiMap(response.headers)
|
|
545
|
+
});
|
|
546
|
+
if (reader) {
|
|
547
|
+
for (; ; ) {
|
|
548
|
+
const chunk = await reader.nextChunk();
|
|
549
|
+
if (!chunk) {
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
await exchange.writeResponse(chunk);
|
|
548
553
|
}
|
|
549
554
|
}
|
|
550
555
|
await exchange.endResponse();
|
|
551
556
|
} finally {
|
|
552
|
-
reader
|
|
557
|
+
await reader?.dispose();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
class HttpResponseReader {
|
|
561
|
+
#reader;
|
|
562
|
+
#signal;
|
|
563
|
+
#frames = [];
|
|
564
|
+
#pump;
|
|
565
|
+
#onAbort;
|
|
566
|
+
#queued = 0;
|
|
567
|
+
#done = false;
|
|
568
|
+
#cancelled = false;
|
|
569
|
+
#hasError = false;
|
|
570
|
+
#error;
|
|
571
|
+
#dataWaker;
|
|
572
|
+
#spaceWaker;
|
|
573
|
+
#cancelPromise;
|
|
574
|
+
constructor(body, signal) {
|
|
575
|
+
this.#reader = body.getReader();
|
|
576
|
+
this.#signal = signal;
|
|
577
|
+
this.#onAbort = () => {
|
|
578
|
+
void this.cancel(signal.reason);
|
|
579
|
+
};
|
|
580
|
+
signal.addEventListener("abort", this.#onAbort, { once: true });
|
|
581
|
+
this.#pump = this.#pumpSource();
|
|
582
|
+
if (signal.aborted) {
|
|
583
|
+
this.#onAbort();
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
async nextChunk() {
|
|
587
|
+
while (this.#frames.length === 0 && !this.#done && !this.#hasError) {
|
|
588
|
+
await new Promise((resolve) => {
|
|
589
|
+
this.#dataWaker = resolve;
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
if (this.#frames.length > 0) {
|
|
593
|
+
const chunk = this.#takeQueued();
|
|
594
|
+
this.#wakeSpace();
|
|
595
|
+
return chunk;
|
|
596
|
+
}
|
|
597
|
+
if (this.#hasError) {
|
|
598
|
+
this.#hasError = false;
|
|
599
|
+
throw this.#error;
|
|
600
|
+
}
|
|
601
|
+
return void 0;
|
|
602
|
+
}
|
|
603
|
+
#takeQueued() {
|
|
604
|
+
const frames = this.#frames;
|
|
605
|
+
const total = this.#queued;
|
|
606
|
+
this.#queued = 0;
|
|
607
|
+
if (frames.length === 1) {
|
|
608
|
+
return frames.pop();
|
|
609
|
+
}
|
|
610
|
+
const chunk = new Uint8Array(total);
|
|
611
|
+
let offset = 0;
|
|
612
|
+
for (const frame of frames) {
|
|
613
|
+
chunk.set(frame, offset);
|
|
614
|
+
offset += frame.byteLength;
|
|
615
|
+
}
|
|
616
|
+
frames.length = 0;
|
|
617
|
+
return chunk;
|
|
618
|
+
}
|
|
619
|
+
async dispose() {
|
|
620
|
+
this.#signal.removeEventListener("abort", this.#onAbort);
|
|
621
|
+
if (!this.#done) {
|
|
622
|
+
await this.cancel();
|
|
623
|
+
} else if (this.#cancelPromise) {
|
|
624
|
+
await this.#cancelPromise;
|
|
625
|
+
}
|
|
626
|
+
await this.#pump;
|
|
627
|
+
}
|
|
628
|
+
cancel(reason) {
|
|
629
|
+
if (this.#done) {
|
|
630
|
+
return Promise.resolve();
|
|
631
|
+
}
|
|
632
|
+
if (!this.#cancelPromise) {
|
|
633
|
+
this.#cancelled = true;
|
|
634
|
+
this.#done = true;
|
|
635
|
+
this.#hasError = true;
|
|
636
|
+
this.#error = reason instanceof Error ? reason : new Error("HTTP response body cancelled.");
|
|
637
|
+
this.#frames.length = 0;
|
|
638
|
+
this.#queued = 0;
|
|
639
|
+
this.#wakeData();
|
|
640
|
+
this.#wakeSpace();
|
|
641
|
+
this.#cancelPromise = this.#reader.cancel(reason).catch(() => void 0);
|
|
642
|
+
}
|
|
643
|
+
return this.#cancelPromise;
|
|
644
|
+
}
|
|
645
|
+
async #pumpSource() {
|
|
646
|
+
try {
|
|
647
|
+
while (!this.#cancelled) {
|
|
648
|
+
while (this.#queued >= HTTP_RESPONSE_READ_AHEAD_BYTES && !this.#cancelled) {
|
|
649
|
+
await new Promise((resolve) => {
|
|
650
|
+
this.#spaceWaker = resolve;
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
if (this.#cancelled) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
const { value, done } = await this.#reader.read();
|
|
657
|
+
if (done) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
if (value.byteLength > 0) {
|
|
661
|
+
this.#frames.push(value);
|
|
662
|
+
this.#queued += value.byteLength;
|
|
663
|
+
this.#wakeData();
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
667
|
+
}
|
|
668
|
+
} catch (error) {
|
|
669
|
+
if (!this.#cancelled) {
|
|
670
|
+
this.#hasError = true;
|
|
671
|
+
this.#error = error;
|
|
672
|
+
}
|
|
673
|
+
} finally {
|
|
674
|
+
this.#done = true;
|
|
675
|
+
this.#wakeData();
|
|
676
|
+
this.#wakeSpace();
|
|
677
|
+
this.#reader.releaseLock();
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
#wakeData() {
|
|
681
|
+
const waker = this.#dataWaker;
|
|
682
|
+
this.#dataWaker = void 0;
|
|
683
|
+
waker?.();
|
|
684
|
+
}
|
|
685
|
+
#wakeSpace() {
|
|
686
|
+
const waker = this.#spaceWaker;
|
|
687
|
+
this.#spaceWaker = void 0;
|
|
688
|
+
waker?.();
|
|
553
689
|
}
|
|
554
690
|
}
|
|
555
691
|
function headersToMultiMap(headers) {
|
|
@@ -20,17 +20,17 @@ var extension_exports = {};
|
|
|
20
20
|
__export(extension_exports, {
|
|
21
21
|
Canvas: () => import_canvas.Canvas,
|
|
22
22
|
CanvasError: () => import_canvas.CanvasError,
|
|
23
|
-
|
|
23
|
+
WorkflowResumeError: () => import_workflow.WorkflowResumeError,
|
|
24
24
|
createCanvas: () => import_canvas.createCanvas,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
defineWorkflow: () => import_workflow.defineWorkflow,
|
|
26
|
+
isWorkflowRunTerminal: () => import_workflow.isWorkflowRunTerminal,
|
|
27
27
|
joinSession: () => joinSession
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(extension_exports);
|
|
30
30
|
var import_client = require("./client.js");
|
|
31
31
|
var import_types = require("./types.js");
|
|
32
32
|
var import_canvas = require("./canvas.js");
|
|
33
|
-
var
|
|
33
|
+
var import_workflow = require("./workflow.js");
|
|
34
34
|
async function joinSession(config = {}) {
|
|
35
35
|
const sessionId = process.env.SESSION_ID;
|
|
36
36
|
if (!sessionId) {
|
|
@@ -41,11 +41,13 @@ async function joinSession(config = {}) {
|
|
|
41
41
|
const client = new import_client.CopilotClient({ _internalConnection: { kind: "parent-process" } });
|
|
42
42
|
const {
|
|
43
43
|
extensionSdkPath: _stripped,
|
|
44
|
-
|
|
44
|
+
skillProvider: _strippedSkillProvider,
|
|
45
|
+
workflows,
|
|
45
46
|
requestedEnvironmentVariables,
|
|
46
47
|
...rest
|
|
47
48
|
} = config;
|
|
48
49
|
void _stripped;
|
|
50
|
+
void _strippedSkillProvider;
|
|
49
51
|
return client.resumeSessionForExtension(
|
|
50
52
|
sessionId,
|
|
51
53
|
{
|
|
@@ -53,7 +55,7 @@ async function joinSession(config = {}) {
|
|
|
53
55
|
onPermissionRequest: config.onPermissionRequest ?? import_types.defaultJoinSessionPermissionHandler,
|
|
54
56
|
suppressResumeEvent: config.suppressResumeEvent ?? true
|
|
55
57
|
},
|
|
56
|
-
|
|
58
|
+
{ workflows },
|
|
57
59
|
requestedEnvironmentVariables?.length ? { requestedEnvironmentVariables } : void 0
|
|
58
60
|
);
|
|
59
61
|
}
|
|
@@ -61,9 +63,9 @@ async function joinSession(config = {}) {
|
|
|
61
63
|
0 && (module.exports = {
|
|
62
64
|
Canvas,
|
|
63
65
|
CanvasError,
|
|
64
|
-
|
|
66
|
+
WorkflowResumeError,
|
|
65
67
|
createCanvas,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
defineWorkflow,
|
|
69
|
+
isWorkflowRunTerminal,
|
|
68
70
|
joinSession
|
|
69
71
|
});
|
|
@@ -208,7 +208,7 @@ class FfiRuntimeHost {
|
|
|
208
208
|
);
|
|
209
209
|
if (!this.connectionId) {
|
|
210
210
|
this.unregisterCallback();
|
|
211
|
-
this.
|
|
211
|
+
await this.shutdownHost();
|
|
212
212
|
this.serverId = 0;
|
|
213
213
|
throw new Error("copilot_runtime_connection_open failed.");
|
|
214
214
|
}
|
|
@@ -217,7 +217,7 @@ class FfiRuntimeHost {
|
|
|
217
217
|
} finally {
|
|
218
218
|
this.starting = false;
|
|
219
219
|
if (this.disposed) {
|
|
220
|
-
|
|
220
|
+
await this.tryFinalizeCleanup();
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -256,6 +256,17 @@ class FfiRuntimeHost {
|
|
|
256
256
|
);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
+
shutdownHost() {
|
|
260
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
261
|
+
this.lib.hostShutdown.async(this.serverId, (error, result) => {
|
|
262
|
+
if (error) {
|
|
263
|
+
rejectPromise(error);
|
|
264
|
+
} else {
|
|
265
|
+
resolvePromise(result);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}
|
|
259
270
|
unregisterCallback() {
|
|
260
271
|
if (this.outboundCallback === void 0) {
|
|
261
272
|
return true;
|
|
@@ -328,7 +339,7 @@ class FfiRuntimeHost {
|
|
|
328
339
|
}
|
|
329
340
|
if (this.serverId) {
|
|
330
341
|
try {
|
|
331
|
-
if (!this.
|
|
342
|
+
if (!await this.shutdownHost()) {
|
|
332
343
|
console.error(
|
|
333
344
|
`In-process FFI host shutdown did not recognize server ${this.serverId}.`
|
|
334
345
|
);
|