@agentclientprotocol/codex-acp 1.0.2 → 1.1.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.
- package/dist/index.js +1159 -483
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -45,35 +45,34 @@ var require_is = __commonJS({
|
|
|
45
45
|
"node_modules/vscode-jsonrpc/lib/common/is.js"(exports) {
|
|
46
46
|
"use strict";
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.
|
|
48
|
+
exports.boolean = boolean4;
|
|
49
|
+
exports.string = string4;
|
|
50
|
+
exports.number = number4;
|
|
51
|
+
exports.error = error51;
|
|
52
|
+
exports.func = func;
|
|
53
|
+
exports.array = array2;
|
|
54
|
+
exports.stringArray = stringArray;
|
|
49
55
|
function boolean4(value) {
|
|
50
56
|
return value === true || value === false;
|
|
51
57
|
}
|
|
52
|
-
exports.boolean = boolean4;
|
|
53
58
|
function string4(value) {
|
|
54
59
|
return typeof value === "string" || value instanceof String;
|
|
55
60
|
}
|
|
56
|
-
exports.string = string4;
|
|
57
61
|
function number4(value) {
|
|
58
62
|
return typeof value === "number" || value instanceof Number;
|
|
59
63
|
}
|
|
60
|
-
exports.number = number4;
|
|
61
64
|
function error51(value) {
|
|
62
65
|
return value instanceof Error;
|
|
63
66
|
}
|
|
64
|
-
exports.error = error51;
|
|
65
67
|
function func(value) {
|
|
66
68
|
return typeof value === "function";
|
|
67
69
|
}
|
|
68
|
-
exports.func = func;
|
|
69
70
|
function array2(value) {
|
|
70
71
|
return Array.isArray(value);
|
|
71
72
|
}
|
|
72
|
-
exports.array = array2;
|
|
73
73
|
function stringArray(value) {
|
|
74
74
|
return array2(value) && value.every((elem) => string4(elem));
|
|
75
75
|
}
|
|
76
|
-
exports.stringArray = stringArray;
|
|
77
76
|
}
|
|
78
77
|
});
|
|
79
78
|
|
|
@@ -81,9 +80,46 @@ var require_is = __commonJS({
|
|
|
81
80
|
var require_messages = __commonJS({
|
|
82
81
|
"node_modules/vscode-jsonrpc/lib/common/messages.js"(exports) {
|
|
83
82
|
"use strict";
|
|
83
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
84
|
+
if (k2 === void 0) k2 = k;
|
|
85
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
86
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
87
|
+
desc = { enumerable: true, get: function() {
|
|
88
|
+
return m[k];
|
|
89
|
+
} };
|
|
90
|
+
}
|
|
91
|
+
Object.defineProperty(o, k2, desc);
|
|
92
|
+
}) : (function(o, m, k, k2) {
|
|
93
|
+
if (k2 === void 0) k2 = k;
|
|
94
|
+
o[k2] = m[k];
|
|
95
|
+
}));
|
|
96
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
97
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
98
|
+
}) : function(o, v) {
|
|
99
|
+
o["default"] = v;
|
|
100
|
+
});
|
|
101
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
102
|
+
var ownKeys = function(o) {
|
|
103
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
104
|
+
var ar = [];
|
|
105
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
106
|
+
return ar;
|
|
107
|
+
};
|
|
108
|
+
return ownKeys(o);
|
|
109
|
+
};
|
|
110
|
+
return function(mod) {
|
|
111
|
+
if (mod && mod.__esModule) return mod;
|
|
112
|
+
var result = {};
|
|
113
|
+
if (mod != null) {
|
|
114
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
115
|
+
}
|
|
116
|
+
__setModuleDefault(result, mod);
|
|
117
|
+
return result;
|
|
118
|
+
};
|
|
119
|
+
})();
|
|
84
120
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
121
|
exports.Message = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0;
|
|
86
|
-
var is = require_is();
|
|
122
|
+
var is = __importStar(require_is());
|
|
87
123
|
var ErrorCodes;
|
|
88
124
|
(function(ErrorCodes2) {
|
|
89
125
|
ErrorCodes2.ParseError = -32700;
|
|
@@ -103,6 +139,8 @@ var require_messages = __commonJS({
|
|
|
103
139
|
ErrorCodes2.serverErrorEnd = -32e3;
|
|
104
140
|
})(ErrorCodes || (exports.ErrorCodes = ErrorCodes = {}));
|
|
105
141
|
var ResponseError = class _ResponseError extends Error {
|
|
142
|
+
code;
|
|
143
|
+
data;
|
|
106
144
|
constructor(code, message, data) {
|
|
107
145
|
super(message);
|
|
108
146
|
this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
|
|
@@ -122,6 +160,23 @@ var require_messages = __commonJS({
|
|
|
122
160
|
};
|
|
123
161
|
exports.ResponseError = ResponseError;
|
|
124
162
|
var ParameterStructures = class _ParameterStructures {
|
|
163
|
+
kind;
|
|
164
|
+
/**
|
|
165
|
+
* The parameter structure is automatically inferred on the number of parameters
|
|
166
|
+
* and the parameter type in case of a single param.
|
|
167
|
+
*/
|
|
168
|
+
static auto = new _ParameterStructures("auto");
|
|
169
|
+
/**
|
|
170
|
+
* Forces `byPosition` parameter structure. This is useful if you have a single
|
|
171
|
+
* parameter which has a literal type.
|
|
172
|
+
*/
|
|
173
|
+
static byPosition = new _ParameterStructures("byPosition");
|
|
174
|
+
/**
|
|
175
|
+
* Forces `byName` parameter structure. This is only useful when having a single
|
|
176
|
+
* parameter. The library will report errors if used with a different number of
|
|
177
|
+
* parameters.
|
|
178
|
+
*/
|
|
179
|
+
static byName = new _ParameterStructures("byName");
|
|
125
180
|
constructor(kind) {
|
|
126
181
|
this.kind = kind;
|
|
127
182
|
}
|
|
@@ -133,10 +188,9 @@ var require_messages = __commonJS({
|
|
|
133
188
|
}
|
|
134
189
|
};
|
|
135
190
|
exports.ParameterStructures = ParameterStructures;
|
|
136
|
-
ParameterStructures.auto = new ParameterStructures("auto");
|
|
137
|
-
ParameterStructures.byPosition = new ParameterStructures("byPosition");
|
|
138
|
-
ParameterStructures.byName = new ParameterStructures("byName");
|
|
139
191
|
var AbstractMessageSignature = class {
|
|
192
|
+
method;
|
|
193
|
+
numberOfParams;
|
|
140
194
|
constructor(method, numberOfParams) {
|
|
141
195
|
this.method = method;
|
|
142
196
|
this.numberOfParams = numberOfParams;
|
|
@@ -147,12 +201,21 @@ var require_messages = __commonJS({
|
|
|
147
201
|
};
|
|
148
202
|
exports.AbstractMessageSignature = AbstractMessageSignature;
|
|
149
203
|
var RequestType0 = class extends AbstractMessageSignature {
|
|
204
|
+
/**
|
|
205
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
206
|
+
*/
|
|
207
|
+
_;
|
|
150
208
|
constructor(method) {
|
|
151
209
|
super(method, 0);
|
|
152
210
|
}
|
|
153
211
|
};
|
|
154
212
|
exports.RequestType0 = RequestType0;
|
|
155
213
|
var RequestType2 = class extends AbstractMessageSignature {
|
|
214
|
+
_parameterStructures;
|
|
215
|
+
/**
|
|
216
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
217
|
+
*/
|
|
218
|
+
_;
|
|
156
219
|
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
|
157
220
|
super(method, 1);
|
|
158
221
|
this._parameterStructures = _parameterStructures;
|
|
@@ -163,6 +226,11 @@ var require_messages = __commonJS({
|
|
|
163
226
|
};
|
|
164
227
|
exports.RequestType = RequestType2;
|
|
165
228
|
var RequestType1 = class extends AbstractMessageSignature {
|
|
229
|
+
_parameterStructures;
|
|
230
|
+
/**
|
|
231
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
232
|
+
*/
|
|
233
|
+
_;
|
|
166
234
|
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
|
167
235
|
super(method, 1);
|
|
168
236
|
this._parameterStructures = _parameterStructures;
|
|
@@ -173,54 +241,91 @@ var require_messages = __commonJS({
|
|
|
173
241
|
};
|
|
174
242
|
exports.RequestType1 = RequestType1;
|
|
175
243
|
var RequestType22 = class extends AbstractMessageSignature {
|
|
244
|
+
/**
|
|
245
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
246
|
+
*/
|
|
247
|
+
_;
|
|
176
248
|
constructor(method) {
|
|
177
249
|
super(method, 2);
|
|
178
250
|
}
|
|
179
251
|
};
|
|
180
252
|
exports.RequestType2 = RequestType22;
|
|
181
253
|
var RequestType3 = class extends AbstractMessageSignature {
|
|
254
|
+
/**
|
|
255
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
256
|
+
*/
|
|
257
|
+
_;
|
|
182
258
|
constructor(method) {
|
|
183
259
|
super(method, 3);
|
|
184
260
|
}
|
|
185
261
|
};
|
|
186
262
|
exports.RequestType3 = RequestType3;
|
|
187
263
|
var RequestType4 = class extends AbstractMessageSignature {
|
|
264
|
+
/**
|
|
265
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
266
|
+
*/
|
|
267
|
+
_;
|
|
188
268
|
constructor(method) {
|
|
189
269
|
super(method, 4);
|
|
190
270
|
}
|
|
191
271
|
};
|
|
192
272
|
exports.RequestType4 = RequestType4;
|
|
193
273
|
var RequestType5 = class extends AbstractMessageSignature {
|
|
274
|
+
/**
|
|
275
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
276
|
+
*/
|
|
277
|
+
_;
|
|
194
278
|
constructor(method) {
|
|
195
279
|
super(method, 5);
|
|
196
280
|
}
|
|
197
281
|
};
|
|
198
282
|
exports.RequestType5 = RequestType5;
|
|
199
283
|
var RequestType6 = class extends AbstractMessageSignature {
|
|
284
|
+
/**
|
|
285
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
286
|
+
*/
|
|
287
|
+
_;
|
|
200
288
|
constructor(method) {
|
|
201
289
|
super(method, 6);
|
|
202
290
|
}
|
|
203
291
|
};
|
|
204
292
|
exports.RequestType6 = RequestType6;
|
|
205
293
|
var RequestType7 = class extends AbstractMessageSignature {
|
|
294
|
+
/**
|
|
295
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
296
|
+
*/
|
|
297
|
+
_;
|
|
206
298
|
constructor(method) {
|
|
207
299
|
super(method, 7);
|
|
208
300
|
}
|
|
209
301
|
};
|
|
210
302
|
exports.RequestType7 = RequestType7;
|
|
211
303
|
var RequestType8 = class extends AbstractMessageSignature {
|
|
304
|
+
/**
|
|
305
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
306
|
+
*/
|
|
307
|
+
_;
|
|
212
308
|
constructor(method) {
|
|
213
309
|
super(method, 8);
|
|
214
310
|
}
|
|
215
311
|
};
|
|
216
312
|
exports.RequestType8 = RequestType8;
|
|
217
313
|
var RequestType9 = class extends AbstractMessageSignature {
|
|
314
|
+
/**
|
|
315
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
316
|
+
*/
|
|
317
|
+
_;
|
|
218
318
|
constructor(method) {
|
|
219
319
|
super(method, 9);
|
|
220
320
|
}
|
|
221
321
|
};
|
|
222
322
|
exports.RequestType9 = RequestType9;
|
|
223
323
|
var NotificationType = class extends AbstractMessageSignature {
|
|
324
|
+
_parameterStructures;
|
|
325
|
+
/**
|
|
326
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
327
|
+
*/
|
|
328
|
+
_;
|
|
224
329
|
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
|
225
330
|
super(method, 1);
|
|
226
331
|
this._parameterStructures = _parameterStructures;
|
|
@@ -231,12 +336,21 @@ var require_messages = __commonJS({
|
|
|
231
336
|
};
|
|
232
337
|
exports.NotificationType = NotificationType;
|
|
233
338
|
var NotificationType0 = class extends AbstractMessageSignature {
|
|
339
|
+
/**
|
|
340
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
341
|
+
*/
|
|
342
|
+
_;
|
|
234
343
|
constructor(method) {
|
|
235
344
|
super(method, 0);
|
|
236
345
|
}
|
|
237
346
|
};
|
|
238
347
|
exports.NotificationType0 = NotificationType0;
|
|
239
348
|
var NotificationType1 = class extends AbstractMessageSignature {
|
|
349
|
+
_parameterStructures;
|
|
350
|
+
/**
|
|
351
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
352
|
+
*/
|
|
353
|
+
_;
|
|
240
354
|
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
|
241
355
|
super(method, 1);
|
|
242
356
|
this._parameterStructures = _parameterStructures;
|
|
@@ -247,71 +361,103 @@ var require_messages = __commonJS({
|
|
|
247
361
|
};
|
|
248
362
|
exports.NotificationType1 = NotificationType1;
|
|
249
363
|
var NotificationType2 = class extends AbstractMessageSignature {
|
|
364
|
+
/**
|
|
365
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
366
|
+
*/
|
|
367
|
+
_;
|
|
250
368
|
constructor(method) {
|
|
251
369
|
super(method, 2);
|
|
252
370
|
}
|
|
253
371
|
};
|
|
254
372
|
exports.NotificationType2 = NotificationType2;
|
|
255
373
|
var NotificationType3 = class extends AbstractMessageSignature {
|
|
374
|
+
/**
|
|
375
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
376
|
+
*/
|
|
377
|
+
_;
|
|
256
378
|
constructor(method) {
|
|
257
379
|
super(method, 3);
|
|
258
380
|
}
|
|
259
381
|
};
|
|
260
382
|
exports.NotificationType3 = NotificationType3;
|
|
261
383
|
var NotificationType4 = class extends AbstractMessageSignature {
|
|
384
|
+
/**
|
|
385
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
386
|
+
*/
|
|
387
|
+
_;
|
|
262
388
|
constructor(method) {
|
|
263
389
|
super(method, 4);
|
|
264
390
|
}
|
|
265
391
|
};
|
|
266
392
|
exports.NotificationType4 = NotificationType4;
|
|
267
393
|
var NotificationType5 = class extends AbstractMessageSignature {
|
|
394
|
+
/**
|
|
395
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
396
|
+
*/
|
|
397
|
+
_;
|
|
268
398
|
constructor(method) {
|
|
269
399
|
super(method, 5);
|
|
270
400
|
}
|
|
271
401
|
};
|
|
272
402
|
exports.NotificationType5 = NotificationType5;
|
|
273
403
|
var NotificationType6 = class extends AbstractMessageSignature {
|
|
404
|
+
/**
|
|
405
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
406
|
+
*/
|
|
407
|
+
_;
|
|
274
408
|
constructor(method) {
|
|
275
409
|
super(method, 6);
|
|
276
410
|
}
|
|
277
411
|
};
|
|
278
412
|
exports.NotificationType6 = NotificationType6;
|
|
279
413
|
var NotificationType7 = class extends AbstractMessageSignature {
|
|
414
|
+
/**
|
|
415
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
416
|
+
*/
|
|
417
|
+
_;
|
|
280
418
|
constructor(method) {
|
|
281
419
|
super(method, 7);
|
|
282
420
|
}
|
|
283
421
|
};
|
|
284
422
|
exports.NotificationType7 = NotificationType7;
|
|
285
423
|
var NotificationType8 = class extends AbstractMessageSignature {
|
|
424
|
+
/**
|
|
425
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
426
|
+
*/
|
|
427
|
+
_;
|
|
286
428
|
constructor(method) {
|
|
287
429
|
super(method, 8);
|
|
288
430
|
}
|
|
289
431
|
};
|
|
290
432
|
exports.NotificationType8 = NotificationType8;
|
|
291
433
|
var NotificationType9 = class extends AbstractMessageSignature {
|
|
434
|
+
/**
|
|
435
|
+
* Clients must not use this property. It is here to ensure correct typing.
|
|
436
|
+
*/
|
|
437
|
+
_;
|
|
292
438
|
constructor(method) {
|
|
293
439
|
super(method, 9);
|
|
294
440
|
}
|
|
295
441
|
};
|
|
296
442
|
exports.NotificationType9 = NotificationType9;
|
|
297
|
-
var
|
|
298
|
-
(function(
|
|
443
|
+
var Message;
|
|
444
|
+
(function(Message2) {
|
|
299
445
|
function isRequest(message) {
|
|
300
446
|
const candidate = message;
|
|
301
447
|
return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
|
|
302
448
|
}
|
|
303
|
-
|
|
449
|
+
Message2.isRequest = isRequest;
|
|
304
450
|
function isNotification(message) {
|
|
305
451
|
const candidate = message;
|
|
306
452
|
return candidate && is.string(candidate.method) && message.id === void 0;
|
|
307
453
|
}
|
|
308
|
-
|
|
454
|
+
Message2.isNotification = isNotification;
|
|
309
455
|
function isResponse(message) {
|
|
310
456
|
const candidate = message;
|
|
311
457
|
return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
|
|
312
458
|
}
|
|
313
|
-
|
|
314
|
-
})(
|
|
459
|
+
Message2.isResponse = isResponse;
|
|
460
|
+
})(Message || (exports.Message = Message = {}));
|
|
315
461
|
}
|
|
316
462
|
});
|
|
317
463
|
|
|
@@ -319,7 +465,6 @@ var require_messages = __commonJS({
|
|
|
319
465
|
var require_linkedMap = __commonJS({
|
|
320
466
|
"node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports) {
|
|
321
467
|
"use strict";
|
|
322
|
-
var _a3;
|
|
323
468
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
324
469
|
exports.LRUCache = exports.LinkedMap = exports.Touch = void 0;
|
|
325
470
|
var Touch;
|
|
@@ -331,8 +476,13 @@ var require_linkedMap = __commonJS({
|
|
|
331
476
|
Touch2.AsNew = Touch2.Last;
|
|
332
477
|
})(Touch || (exports.Touch = Touch = {}));
|
|
333
478
|
var LinkedMap = class {
|
|
479
|
+
[Symbol.toStringTag] = "LinkedMap";
|
|
480
|
+
_map;
|
|
481
|
+
_head;
|
|
482
|
+
_tail;
|
|
483
|
+
_size;
|
|
484
|
+
_state;
|
|
334
485
|
constructor() {
|
|
335
|
-
this[_a3] = "LinkedMap";
|
|
336
486
|
this._map = /* @__PURE__ */ new Map();
|
|
337
487
|
this._head = void 0;
|
|
338
488
|
this._tail = void 0;
|
|
@@ -358,6 +508,14 @@ var require_linkedMap = __commonJS({
|
|
|
358
508
|
get last() {
|
|
359
509
|
return this._tail?.value;
|
|
360
510
|
}
|
|
511
|
+
before(key) {
|
|
512
|
+
const item = this._map.get(key);
|
|
513
|
+
return item ? item.previous?.value : void 0;
|
|
514
|
+
}
|
|
515
|
+
after(key) {
|
|
516
|
+
const item = this._map.get(key);
|
|
517
|
+
return item ? item.next?.value : void 0;
|
|
518
|
+
}
|
|
361
519
|
has(key) {
|
|
362
520
|
return this._map.has(key);
|
|
363
521
|
}
|
|
@@ -506,7 +664,7 @@ var require_linkedMap = __commonJS({
|
|
|
506
664
|
};
|
|
507
665
|
return iterator;
|
|
508
666
|
}
|
|
509
|
-
[
|
|
667
|
+
[Symbol.iterator]() {
|
|
510
668
|
return this.entries();
|
|
511
669
|
}
|
|
512
670
|
trimOld(newSize) {
|
|
@@ -645,6 +803,8 @@ var require_linkedMap = __commonJS({
|
|
|
645
803
|
};
|
|
646
804
|
exports.LinkedMap = LinkedMap;
|
|
647
805
|
var LRUCache = class extends LinkedMap {
|
|
806
|
+
_limit;
|
|
807
|
+
_ratio;
|
|
648
808
|
constructor(limit, ratio = 1) {
|
|
649
809
|
super();
|
|
650
810
|
this._limit = limit;
|
|
@@ -691,15 +851,15 @@ var require_disposable = __commonJS({
|
|
|
691
851
|
"use strict";
|
|
692
852
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
693
853
|
exports.Disposable = void 0;
|
|
694
|
-
var
|
|
695
|
-
(function(
|
|
854
|
+
var Disposable;
|
|
855
|
+
(function(Disposable2) {
|
|
696
856
|
function create(func) {
|
|
697
857
|
return {
|
|
698
858
|
dispose: func
|
|
699
859
|
};
|
|
700
860
|
}
|
|
701
|
-
|
|
702
|
-
})(
|
|
861
|
+
Disposable2.create = create;
|
|
862
|
+
})(Disposable || (exports.Disposable = Disposable = {}));
|
|
703
863
|
}
|
|
704
864
|
});
|
|
705
865
|
|
|
@@ -732,9 +892,12 @@ var require_ral = __commonJS({
|
|
|
732
892
|
var require_events = __commonJS({
|
|
733
893
|
"node_modules/vscode-jsonrpc/lib/common/events.js"(exports) {
|
|
734
894
|
"use strict";
|
|
895
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
896
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
897
|
+
};
|
|
735
898
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
736
899
|
exports.Emitter = exports.Event = void 0;
|
|
737
|
-
var ral_1 = require_ral();
|
|
900
|
+
var ral_1 = __importDefault(require_ral());
|
|
738
901
|
var Event;
|
|
739
902
|
(function(Event2) {
|
|
740
903
|
const _disposable = { dispose() {
|
|
@@ -744,6 +907,8 @@ var require_events = __commonJS({
|
|
|
744
907
|
};
|
|
745
908
|
})(Event || (exports.Event = Event = {}));
|
|
746
909
|
var CallbackList = class {
|
|
910
|
+
_callbacks;
|
|
911
|
+
_contexts;
|
|
747
912
|
add(callback, context = null, bucket) {
|
|
748
913
|
if (!this._callbacks) {
|
|
749
914
|
this._callbacks = [];
|
|
@@ -798,6 +963,11 @@ var require_events = __commonJS({
|
|
|
798
963
|
}
|
|
799
964
|
};
|
|
800
965
|
var Emitter2 = class _Emitter {
|
|
966
|
+
_options;
|
|
967
|
+
static _noop = function() {
|
|
968
|
+
};
|
|
969
|
+
_event;
|
|
970
|
+
_callbacks;
|
|
801
971
|
constructor(_options) {
|
|
802
972
|
this._options = _options;
|
|
803
973
|
}
|
|
@@ -852,8 +1022,6 @@ var require_events = __commonJS({
|
|
|
852
1022
|
}
|
|
853
1023
|
};
|
|
854
1024
|
exports.Emitter = Emitter2;
|
|
855
|
-
Emitter2._noop = function() {
|
|
856
|
-
};
|
|
857
1025
|
}
|
|
858
1026
|
});
|
|
859
1027
|
|
|
@@ -861,10 +1029,50 @@ var require_events = __commonJS({
|
|
|
861
1029
|
var require_cancellation = __commonJS({
|
|
862
1030
|
"node_modules/vscode-jsonrpc/lib/common/cancellation.js"(exports) {
|
|
863
1031
|
"use strict";
|
|
1032
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1033
|
+
if (k2 === void 0) k2 = k;
|
|
1034
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1035
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1036
|
+
desc = { enumerable: true, get: function() {
|
|
1037
|
+
return m[k];
|
|
1038
|
+
} };
|
|
1039
|
+
}
|
|
1040
|
+
Object.defineProperty(o, k2, desc);
|
|
1041
|
+
}) : (function(o, m, k, k2) {
|
|
1042
|
+
if (k2 === void 0) k2 = k;
|
|
1043
|
+
o[k2] = m[k];
|
|
1044
|
+
}));
|
|
1045
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
1046
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1047
|
+
}) : function(o, v) {
|
|
1048
|
+
o["default"] = v;
|
|
1049
|
+
});
|
|
1050
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
1051
|
+
var ownKeys = function(o) {
|
|
1052
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
1053
|
+
var ar = [];
|
|
1054
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
1055
|
+
return ar;
|
|
1056
|
+
};
|
|
1057
|
+
return ownKeys(o);
|
|
1058
|
+
};
|
|
1059
|
+
return function(mod) {
|
|
1060
|
+
if (mod && mod.__esModule) return mod;
|
|
1061
|
+
var result = {};
|
|
1062
|
+
if (mod != null) {
|
|
1063
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
1064
|
+
}
|
|
1065
|
+
__setModuleDefault(result, mod);
|
|
1066
|
+
return result;
|
|
1067
|
+
};
|
|
1068
|
+
})();
|
|
1069
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1070
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1071
|
+
};
|
|
864
1072
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
865
1073
|
exports.CancellationTokenSource = exports.CancellationToken = void 0;
|
|
866
|
-
var ral_1 = require_ral();
|
|
867
|
-
var Is = require_is();
|
|
1074
|
+
var ral_1 = __importDefault(require_ral());
|
|
1075
|
+
var Is = __importStar(require_is());
|
|
868
1076
|
var events_1 = require_events();
|
|
869
1077
|
var CancellationToken;
|
|
870
1078
|
(function(CancellationToken2) {
|
|
@@ -889,9 +1097,8 @@ var require_cancellation = __commonJS({
|
|
|
889
1097
|
} };
|
|
890
1098
|
});
|
|
891
1099
|
var MutableToken = class {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
}
|
|
1100
|
+
_isCancelled = false;
|
|
1101
|
+
_emitter;
|
|
895
1102
|
cancel() {
|
|
896
1103
|
if (!this._isCancelled) {
|
|
897
1104
|
this._isCancelled = true;
|
|
@@ -921,6 +1128,7 @@ var require_cancellation = __commonJS({
|
|
|
921
1128
|
}
|
|
922
1129
|
};
|
|
923
1130
|
var CancellationTokenSource = class {
|
|
1131
|
+
_token;
|
|
924
1132
|
get token() {
|
|
925
1133
|
if (!this._token) {
|
|
926
1134
|
this._token = new MutableToken();
|
|
@@ -959,6 +1167,7 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
959
1167
|
CancellationState2.Cancelled = 1;
|
|
960
1168
|
})(CancellationState || (CancellationState = {}));
|
|
961
1169
|
var SharedArraySenderStrategy = class {
|
|
1170
|
+
buffers;
|
|
962
1171
|
constructor() {
|
|
963
1172
|
this.buffers = /* @__PURE__ */ new Map();
|
|
964
1173
|
}
|
|
@@ -989,6 +1198,7 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
989
1198
|
};
|
|
990
1199
|
exports.SharedArraySenderStrategy = SharedArraySenderStrategy;
|
|
991
1200
|
var SharedArrayBufferCancellationToken = class {
|
|
1201
|
+
data;
|
|
992
1202
|
constructor(buffer) {
|
|
993
1203
|
this.data = new Int32Array(buffer, 0, 1);
|
|
994
1204
|
}
|
|
@@ -1000,6 +1210,7 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
1000
1210
|
}
|
|
1001
1211
|
};
|
|
1002
1212
|
var SharedArrayBufferCancellationTokenSource = class {
|
|
1213
|
+
token;
|
|
1003
1214
|
constructor(buffer) {
|
|
1004
1215
|
this.token = new SharedArrayBufferCancellationToken(buffer);
|
|
1005
1216
|
}
|
|
@@ -1009,9 +1220,7 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
1009
1220
|
}
|
|
1010
1221
|
};
|
|
1011
1222
|
var SharedArrayReceiverStrategy = class {
|
|
1012
|
-
|
|
1013
|
-
this.kind = "request";
|
|
1014
|
-
}
|
|
1223
|
+
kind = "request";
|
|
1015
1224
|
createCancellationTokenSource(request) {
|
|
1016
1225
|
const buffer = request.$cancellationData;
|
|
1017
1226
|
if (buffer === void 0) {
|
|
@@ -1028,10 +1237,16 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
1028
1237
|
var require_semaphore = __commonJS({
|
|
1029
1238
|
"node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports) {
|
|
1030
1239
|
"use strict";
|
|
1240
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1241
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1242
|
+
};
|
|
1031
1243
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1032
1244
|
exports.Semaphore = void 0;
|
|
1033
|
-
var ral_1 = require_ral();
|
|
1245
|
+
var ral_1 = __importDefault(require_ral());
|
|
1034
1246
|
var Semaphore = class {
|
|
1247
|
+
_capacity;
|
|
1248
|
+
_active;
|
|
1249
|
+
_waiting;
|
|
1035
1250
|
constructor(capacity = 1) {
|
|
1036
1251
|
if (capacity <= 0) {
|
|
1037
1252
|
throw new Error("Capacity must be greater than 0");
|
|
@@ -1062,7 +1277,7 @@ var require_semaphore = __commonJS({
|
|
|
1062
1277
|
const next = this._waiting.shift();
|
|
1063
1278
|
this._active++;
|
|
1064
1279
|
if (this._active > this._capacity) {
|
|
1065
|
-
throw new Error(`
|
|
1280
|
+
throw new Error(`Too many thunks active`);
|
|
1066
1281
|
}
|
|
1067
1282
|
try {
|
|
1068
1283
|
const result = next.thunk();
|
|
@@ -1096,21 +1311,64 @@ var require_semaphore = __commonJS({
|
|
|
1096
1311
|
var require_messageReader = __commonJS({
|
|
1097
1312
|
"node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports) {
|
|
1098
1313
|
"use strict";
|
|
1314
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1315
|
+
if (k2 === void 0) k2 = k;
|
|
1316
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1317
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1318
|
+
desc = { enumerable: true, get: function() {
|
|
1319
|
+
return m[k];
|
|
1320
|
+
} };
|
|
1321
|
+
}
|
|
1322
|
+
Object.defineProperty(o, k2, desc);
|
|
1323
|
+
}) : (function(o, m, k, k2) {
|
|
1324
|
+
if (k2 === void 0) k2 = k;
|
|
1325
|
+
o[k2] = m[k];
|
|
1326
|
+
}));
|
|
1327
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
1328
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1329
|
+
}) : function(o, v) {
|
|
1330
|
+
o["default"] = v;
|
|
1331
|
+
});
|
|
1332
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
1333
|
+
var ownKeys = function(o) {
|
|
1334
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
1335
|
+
var ar = [];
|
|
1336
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
1337
|
+
return ar;
|
|
1338
|
+
};
|
|
1339
|
+
return ownKeys(o);
|
|
1340
|
+
};
|
|
1341
|
+
return function(mod) {
|
|
1342
|
+
if (mod && mod.__esModule) return mod;
|
|
1343
|
+
var result = {};
|
|
1344
|
+
if (mod != null) {
|
|
1345
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
1346
|
+
}
|
|
1347
|
+
__setModuleDefault(result, mod);
|
|
1348
|
+
return result;
|
|
1349
|
+
};
|
|
1350
|
+
})();
|
|
1351
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1352
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1353
|
+
};
|
|
1099
1354
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1100
1355
|
exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0;
|
|
1101
|
-
var ral_1 = require_ral();
|
|
1102
|
-
var Is = require_is();
|
|
1356
|
+
var ral_1 = __importDefault(require_ral());
|
|
1357
|
+
var Is = __importStar(require_is());
|
|
1103
1358
|
var events_1 = require_events();
|
|
1104
1359
|
var semaphore_1 = require_semaphore();
|
|
1105
|
-
var
|
|
1106
|
-
(function(
|
|
1360
|
+
var MessageReader;
|
|
1361
|
+
(function(MessageReader2) {
|
|
1107
1362
|
function is(value) {
|
|
1108
|
-
|
|
1363
|
+
const candidate = value;
|
|
1109
1364
|
return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) && Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
|
|
1110
1365
|
}
|
|
1111
|
-
|
|
1112
|
-
})(
|
|
1366
|
+
MessageReader2.is = is;
|
|
1367
|
+
})(MessageReader || (exports.MessageReader = MessageReader = {}));
|
|
1113
1368
|
var AbstractMessageReader = class {
|
|
1369
|
+
errorEmitter;
|
|
1370
|
+
closeEmitter;
|
|
1371
|
+
partialMessageEmitter;
|
|
1114
1372
|
constructor() {
|
|
1115
1373
|
this.errorEmitter = new events_1.Emitter();
|
|
1116
1374
|
this.closeEmitter = new events_1.Emitter();
|
|
@@ -1119,6 +1377,7 @@ var require_messageReader = __commonJS({
|
|
|
1119
1377
|
dispose() {
|
|
1120
1378
|
this.errorEmitter.dispose();
|
|
1121
1379
|
this.closeEmitter.dispose();
|
|
1380
|
+
this.partialMessageEmitter.dispose();
|
|
1122
1381
|
}
|
|
1123
1382
|
get onError() {
|
|
1124
1383
|
return this.errorEmitter.event;
|
|
@@ -1188,6 +1447,15 @@ var require_messageReader = __commonJS({
|
|
|
1188
1447
|
ResolvedMessageReaderOptions2.fromOptions = fromOptions;
|
|
1189
1448
|
})(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
|
|
1190
1449
|
var ReadableStreamMessageReader = class extends AbstractMessageReader {
|
|
1450
|
+
readable;
|
|
1451
|
+
options;
|
|
1452
|
+
callback;
|
|
1453
|
+
nextMessageLength;
|
|
1454
|
+
messageToken;
|
|
1455
|
+
buffer;
|
|
1456
|
+
partialMessageTimer;
|
|
1457
|
+
_partialMessageTimeout;
|
|
1458
|
+
readSemaphore;
|
|
1191
1459
|
constructor(readable, options) {
|
|
1192
1460
|
super();
|
|
1193
1461
|
this.readable = readable;
|
|
@@ -1285,23 +1553,65 @@ ${JSON.stringify(Object.fromEntries(headers))}`));
|
|
|
1285
1553
|
var require_messageWriter = __commonJS({
|
|
1286
1554
|
"node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports) {
|
|
1287
1555
|
"use strict";
|
|
1556
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1557
|
+
if (k2 === void 0) k2 = k;
|
|
1558
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1559
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1560
|
+
desc = { enumerable: true, get: function() {
|
|
1561
|
+
return m[k];
|
|
1562
|
+
} };
|
|
1563
|
+
}
|
|
1564
|
+
Object.defineProperty(o, k2, desc);
|
|
1565
|
+
}) : (function(o, m, k, k2) {
|
|
1566
|
+
if (k2 === void 0) k2 = k;
|
|
1567
|
+
o[k2] = m[k];
|
|
1568
|
+
}));
|
|
1569
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
1570
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1571
|
+
}) : function(o, v) {
|
|
1572
|
+
o["default"] = v;
|
|
1573
|
+
});
|
|
1574
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
1575
|
+
var ownKeys = function(o) {
|
|
1576
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
1577
|
+
var ar = [];
|
|
1578
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
1579
|
+
return ar;
|
|
1580
|
+
};
|
|
1581
|
+
return ownKeys(o);
|
|
1582
|
+
};
|
|
1583
|
+
return function(mod) {
|
|
1584
|
+
if (mod && mod.__esModule) return mod;
|
|
1585
|
+
var result = {};
|
|
1586
|
+
if (mod != null) {
|
|
1587
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
1588
|
+
}
|
|
1589
|
+
__setModuleDefault(result, mod);
|
|
1590
|
+
return result;
|
|
1591
|
+
};
|
|
1592
|
+
})();
|
|
1593
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1594
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1595
|
+
};
|
|
1288
1596
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1289
1597
|
exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0;
|
|
1290
|
-
var ral_1 = require_ral();
|
|
1291
|
-
var Is = require_is();
|
|
1598
|
+
var ral_1 = __importDefault(require_ral());
|
|
1599
|
+
var Is = __importStar(require_is());
|
|
1292
1600
|
var semaphore_1 = require_semaphore();
|
|
1293
1601
|
var events_1 = require_events();
|
|
1294
1602
|
var ContentLength = "Content-Length: ";
|
|
1295
1603
|
var CRLF = "\r\n";
|
|
1296
|
-
var
|
|
1297
|
-
(function(
|
|
1604
|
+
var MessageWriter;
|
|
1605
|
+
(function(MessageWriter2) {
|
|
1298
1606
|
function is(value) {
|
|
1299
|
-
|
|
1607
|
+
const candidate = value;
|
|
1300
1608
|
return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) && Is.func(candidate.onError) && Is.func(candidate.write);
|
|
1301
1609
|
}
|
|
1302
|
-
|
|
1303
|
-
})(
|
|
1610
|
+
MessageWriter2.is = is;
|
|
1611
|
+
})(MessageWriter || (exports.MessageWriter = MessageWriter = {}));
|
|
1304
1612
|
var AbstractMessageWriter = class {
|
|
1613
|
+
errorEmitter;
|
|
1614
|
+
closeEmitter;
|
|
1305
1615
|
constructor() {
|
|
1306
1616
|
this.errorEmitter = new events_1.Emitter();
|
|
1307
1617
|
this.closeEmitter = new events_1.Emitter();
|
|
@@ -1343,6 +1653,10 @@ var require_messageWriter = __commonJS({
|
|
|
1343
1653
|
ResolvedMessageWriterOptions2.fromOptions = fromOptions;
|
|
1344
1654
|
})(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
|
|
1345
1655
|
var WriteableStreamMessageWriter = class extends AbstractMessageWriter {
|
|
1656
|
+
writable;
|
|
1657
|
+
options;
|
|
1658
|
+
errorCount;
|
|
1659
|
+
writeSemaphore;
|
|
1346
1660
|
constructor(writable, options) {
|
|
1347
1661
|
super();
|
|
1348
1662
|
this.writable = writable;
|
|
@@ -1403,6 +1717,9 @@ var require_messageBuffer = __commonJS({
|
|
|
1403
1717
|
var LF = 10;
|
|
1404
1718
|
var CRLF = "\r\n";
|
|
1405
1719
|
var AbstractMessageBuffer = class {
|
|
1720
|
+
_encoding;
|
|
1721
|
+
_chunks;
|
|
1722
|
+
_totalLength;
|
|
1406
1723
|
constructor(encoding = "utf-8") {
|
|
1407
1724
|
this._encoding = encoding;
|
|
1408
1725
|
this._chunks = [];
|
|
@@ -1427,7 +1744,7 @@ var require_messageBuffer = __commonJS({
|
|
|
1427
1744
|
row: while (chunkIndex < this._chunks.length) {
|
|
1428
1745
|
const chunk = this._chunks[chunkIndex];
|
|
1429
1746
|
offset = 0;
|
|
1430
|
-
|
|
1747
|
+
while (offset < chunk.length) {
|
|
1431
1748
|
const value = chunk[offset];
|
|
1432
1749
|
switch (value) {
|
|
1433
1750
|
case CR:
|
|
@@ -1516,7 +1833,7 @@ ${header}`);
|
|
|
1516
1833
|
}
|
|
1517
1834
|
const result = this.allocNative(byteCount);
|
|
1518
1835
|
let resultOffset = 0;
|
|
1519
|
-
|
|
1836
|
+
const chunkIndex = 0;
|
|
1520
1837
|
while (byteCount > 0) {
|
|
1521
1838
|
const chunk = this._chunks[chunkIndex];
|
|
1522
1839
|
if (chunk.byteLength > byteCount) {
|
|
@@ -1545,10 +1862,51 @@ ${header}`);
|
|
|
1545
1862
|
var require_connection = __commonJS({
|
|
1546
1863
|
"node_modules/vscode-jsonrpc/lib/common/connection.js"(exports) {
|
|
1547
1864
|
"use strict";
|
|
1865
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1866
|
+
if (k2 === void 0) k2 = k;
|
|
1867
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1868
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1869
|
+
desc = { enumerable: true, get: function() {
|
|
1870
|
+
return m[k];
|
|
1871
|
+
} };
|
|
1872
|
+
}
|
|
1873
|
+
Object.defineProperty(o, k2, desc);
|
|
1874
|
+
}) : (function(o, m, k, k2) {
|
|
1875
|
+
if (k2 === void 0) k2 = k;
|
|
1876
|
+
o[k2] = m[k];
|
|
1877
|
+
}));
|
|
1878
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
1879
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1880
|
+
}) : function(o, v) {
|
|
1881
|
+
o["default"] = v;
|
|
1882
|
+
});
|
|
1883
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
1884
|
+
var ownKeys = function(o) {
|
|
1885
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
1886
|
+
var ar = [];
|
|
1887
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
1888
|
+
return ar;
|
|
1889
|
+
};
|
|
1890
|
+
return ownKeys(o);
|
|
1891
|
+
};
|
|
1892
|
+
return function(mod) {
|
|
1893
|
+
if (mod && mod.__esModule) return mod;
|
|
1894
|
+
var result = {};
|
|
1895
|
+
if (mod != null) {
|
|
1896
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
1897
|
+
}
|
|
1898
|
+
__setModuleDefault(result, mod);
|
|
1899
|
+
return result;
|
|
1900
|
+
};
|
|
1901
|
+
})();
|
|
1902
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1903
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1904
|
+
};
|
|
1548
1905
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1549
|
-
exports.
|
|
1550
|
-
|
|
1551
|
-
var
|
|
1906
|
+
exports.ConnectionOptions = exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.RequestCancellationReceiverStrategy = exports.IdCancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.TraceValue = exports.Trace = exports.NullLogger = exports.ProgressType = exports.ProgressToken = void 0;
|
|
1907
|
+
exports.createMessageConnection = createMessageConnection2;
|
|
1908
|
+
var ral_1 = __importDefault(require_ral());
|
|
1909
|
+
var Is = __importStar(require_is());
|
|
1552
1910
|
var messages_1 = require_messages();
|
|
1553
1911
|
var linkedMap_1 = require_linkedMap();
|
|
1554
1912
|
var events_1 = require_events();
|
|
@@ -1569,6 +1927,12 @@ var require_connection = __commonJS({
|
|
|
1569
1927
|
ProgressNotification2.type = new messages_1.NotificationType("$/progress");
|
|
1570
1928
|
})(ProgressNotification || (ProgressNotification = {}));
|
|
1571
1929
|
var ProgressType = class {
|
|
1930
|
+
/**
|
|
1931
|
+
* Clients must not use these properties. They are here to ensure correct typing.
|
|
1932
|
+
* in TypeScript
|
|
1933
|
+
*/
|
|
1934
|
+
__;
|
|
1935
|
+
_pr;
|
|
1572
1936
|
constructor() {
|
|
1573
1937
|
}
|
|
1574
1938
|
};
|
|
@@ -1597,13 +1961,14 @@ var require_connection = __commonJS({
|
|
|
1597
1961
|
Trace2[Trace2["Compact"] = 2] = "Compact";
|
|
1598
1962
|
Trace2[Trace2["Verbose"] = 3] = "Verbose";
|
|
1599
1963
|
})(Trace || (exports.Trace = Trace = {}));
|
|
1600
|
-
var
|
|
1601
|
-
(function(
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
})(
|
|
1964
|
+
var TraceValue;
|
|
1965
|
+
(function(TraceValue2) {
|
|
1966
|
+
TraceValue2.Off = "off";
|
|
1967
|
+
TraceValue2.Messages = "messages";
|
|
1968
|
+
TraceValue2.Compact = "compact";
|
|
1969
|
+
TraceValue2.Verbose = "verbose";
|
|
1970
|
+
})(TraceValue || (exports.TraceValue = TraceValue = {}));
|
|
1971
|
+
exports.TraceValues = TraceValue;
|
|
1607
1972
|
(function(Trace2) {
|
|
1608
1973
|
function fromString(value) {
|
|
1609
1974
|
if (!Is.string(value)) {
|
|
@@ -1674,6 +2039,7 @@ var require_connection = __commonJS({
|
|
|
1674
2039
|
ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening";
|
|
1675
2040
|
})(ConnectionErrors || (exports.ConnectionErrors = ConnectionErrors = {}));
|
|
1676
2041
|
var ConnectionError = class _ConnectionError extends Error {
|
|
2042
|
+
code;
|
|
1677
2043
|
constructor(code, message) {
|
|
1678
2044
|
super(message);
|
|
1679
2045
|
this.code = code;
|
|
@@ -1756,7 +2122,7 @@ var require_connection = __commonJS({
|
|
|
1756
2122
|
(function(ConnectionOptions2) {
|
|
1757
2123
|
function is(value) {
|
|
1758
2124
|
const candidate = value;
|
|
1759
|
-
return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy));
|
|
2125
|
+
return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy) || Is.number(candidate.maxParallelism));
|
|
1760
2126
|
}
|
|
1761
2127
|
ConnectionOptions2.is = is;
|
|
1762
2128
|
})(ConnectionOptions || (exports.ConnectionOptions = ConnectionOptions = {}));
|
|
@@ -1773,6 +2139,8 @@ var require_connection = __commonJS({
|
|
|
1773
2139
|
let notificationSequenceNumber = 0;
|
|
1774
2140
|
let unknownResponseSequenceNumber = 0;
|
|
1775
2141
|
const version2 = "2.0";
|
|
2142
|
+
const maxParallelism = options?.maxParallelism ?? -1;
|
|
2143
|
+
let inFlight = 0;
|
|
1776
2144
|
let starRequestHandler = void 0;
|
|
1777
2145
|
const requestHandlers = /* @__PURE__ */ new Map();
|
|
1778
2146
|
let starNotificationHandler = void 0;
|
|
@@ -1793,31 +2161,6 @@ var require_connection = __commonJS({
|
|
|
1793
2161
|
const unhandledProgressEmitter = new events_1.Emitter();
|
|
1794
2162
|
const disposeEmitter = new events_1.Emitter();
|
|
1795
2163
|
const cancellationStrategy = options && options.cancellationStrategy ? options.cancellationStrategy : CancellationStrategy.Message;
|
|
1796
|
-
function createRequestQueueKey(id) {
|
|
1797
|
-
if (id === null) {
|
|
1798
|
-
throw new Error(`Can't send requests with id null since the response can't be correlated.`);
|
|
1799
|
-
}
|
|
1800
|
-
return "req-" + id.toString();
|
|
1801
|
-
}
|
|
1802
|
-
function createResponseQueueKey(id) {
|
|
1803
|
-
if (id === null) {
|
|
1804
|
-
return "res-unknown-" + (++unknownResponseSequenceNumber).toString();
|
|
1805
|
-
} else {
|
|
1806
|
-
return "res-" + id.toString();
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
function createNotificationQueueKey() {
|
|
1810
|
-
return "not-" + (++notificationSequenceNumber).toString();
|
|
1811
|
-
}
|
|
1812
|
-
function addMessageToQueue(queue, message) {
|
|
1813
|
-
if (messages_1.Message.isRequest(message)) {
|
|
1814
|
-
queue.set(createRequestQueueKey(message.id), message);
|
|
1815
|
-
} else if (messages_1.Message.isResponse(message)) {
|
|
1816
|
-
queue.set(createResponseQueueKey(message.id), message);
|
|
1817
|
-
} else {
|
|
1818
|
-
queue.set(createNotificationQueueKey(), message);
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
2164
|
function cancelUndispatched(_message) {
|
|
1822
2165
|
return void 0;
|
|
1823
2166
|
}
|
|
@@ -1846,40 +2189,86 @@ var require_connection = __commonJS({
|
|
|
1846
2189
|
messageReader.onError(readErrorHandler);
|
|
1847
2190
|
messageWriter.onClose(closeHandler);
|
|
1848
2191
|
messageWriter.onError(writeErrorHandler);
|
|
2192
|
+
function createRequestQueueKey(id) {
|
|
2193
|
+
if (id === null) {
|
|
2194
|
+
throw new Error(`Can't send requests with id null since the response can't be correlated.`);
|
|
2195
|
+
}
|
|
2196
|
+
return "req-" + id.toString();
|
|
2197
|
+
}
|
|
2198
|
+
function createResponseQueueKey(id) {
|
|
2199
|
+
if (id === null) {
|
|
2200
|
+
return "res-unknown-" + (++unknownResponseSequenceNumber).toString();
|
|
2201
|
+
} else {
|
|
2202
|
+
return "res-" + id.toString();
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
function createNotificationQueueKey() {
|
|
2206
|
+
return "not-" + (++notificationSequenceNumber).toString();
|
|
2207
|
+
}
|
|
2208
|
+
function addMessageToQueue(queue, message) {
|
|
2209
|
+
if (messages_1.Message.isRequest(message)) {
|
|
2210
|
+
queue.set(createRequestQueueKey(message.id), message);
|
|
2211
|
+
} else if (messages_1.Message.isResponse(message)) {
|
|
2212
|
+
if (maxParallelism === -1) {
|
|
2213
|
+
queue.set(createResponseQueueKey(message.id), message);
|
|
2214
|
+
} else {
|
|
2215
|
+
handleResponse(message);
|
|
2216
|
+
}
|
|
2217
|
+
} else {
|
|
2218
|
+
queue.set(createNotificationQueueKey(), message);
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
1849
2221
|
function triggerMessageQueue() {
|
|
1850
2222
|
if (timer || messageQueue.size === 0) {
|
|
1851
2223
|
return;
|
|
1852
2224
|
}
|
|
1853
|
-
|
|
2225
|
+
if (maxParallelism !== -1 && inFlight >= maxParallelism) {
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
timer = (0, ral_1.default)().timer.setImmediate(async () => {
|
|
1854
2229
|
timer = void 0;
|
|
1855
|
-
|
|
2230
|
+
if (messageQueue.size === 0) {
|
|
2231
|
+
return;
|
|
2232
|
+
}
|
|
2233
|
+
if (maxParallelism !== -1 && inFlight >= maxParallelism) {
|
|
2234
|
+
return;
|
|
2235
|
+
}
|
|
2236
|
+
const message = messageQueue.shift();
|
|
2237
|
+
let result;
|
|
2238
|
+
try {
|
|
2239
|
+
inFlight++;
|
|
2240
|
+
const messageStrategy = options?.messageStrategy;
|
|
2241
|
+
if (MessageStrategy.is(messageStrategy)) {
|
|
2242
|
+
result = messageStrategy.handleMessage(message, handleMessage);
|
|
2243
|
+
} else {
|
|
2244
|
+
result = handleMessage(message);
|
|
2245
|
+
}
|
|
2246
|
+
} catch (error51) {
|
|
2247
|
+
logger2.error(`Processing message queue failed: ${error51.toString()}`);
|
|
2248
|
+
} finally {
|
|
2249
|
+
if (result instanceof Promise) {
|
|
2250
|
+
result.then(() => {
|
|
2251
|
+
inFlight--;
|
|
2252
|
+
triggerMessageQueue();
|
|
2253
|
+
}).catch((error51) => {
|
|
2254
|
+
logger2.error(`Processing message queue failed: ${error51.toString()}`);
|
|
2255
|
+
});
|
|
2256
|
+
} else {
|
|
2257
|
+
inFlight--;
|
|
2258
|
+
}
|
|
2259
|
+
triggerMessageQueue();
|
|
2260
|
+
}
|
|
1856
2261
|
});
|
|
1857
2262
|
}
|
|
1858
|
-
function handleMessage(message) {
|
|
2263
|
+
async function handleMessage(message) {
|
|
1859
2264
|
if (messages_1.Message.isRequest(message)) {
|
|
1860
|
-
handleRequest(message);
|
|
2265
|
+
return handleRequest(message);
|
|
1861
2266
|
} else if (messages_1.Message.isNotification(message)) {
|
|
1862
|
-
handleNotification(message);
|
|
2267
|
+
return handleNotification(message);
|
|
1863
2268
|
} else if (messages_1.Message.isResponse(message)) {
|
|
1864
|
-
handleResponse(message);
|
|
2269
|
+
return handleResponse(message);
|
|
1865
2270
|
} else {
|
|
1866
|
-
handleInvalidMessage(message);
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
function processMessageQueue() {
|
|
1870
|
-
if (messageQueue.size === 0) {
|
|
1871
|
-
return;
|
|
1872
|
-
}
|
|
1873
|
-
const message = messageQueue.shift();
|
|
1874
|
-
try {
|
|
1875
|
-
const messageStrategy = options?.messageStrategy;
|
|
1876
|
-
if (MessageStrategy.is(messageStrategy)) {
|
|
1877
|
-
messageStrategy.handleMessage(message, handleMessage);
|
|
1878
|
-
} else {
|
|
1879
|
-
handleMessage(message);
|
|
1880
|
-
}
|
|
1881
|
-
} finally {
|
|
1882
|
-
triggerMessageQueue();
|
|
2271
|
+
return handleInvalidMessage(message);
|
|
1883
2272
|
}
|
|
1884
2273
|
}
|
|
1885
2274
|
const callback = (message) => {
|
|
@@ -1914,9 +2303,9 @@ var require_connection = __commonJS({
|
|
|
1914
2303
|
triggerMessageQueue();
|
|
1915
2304
|
}
|
|
1916
2305
|
};
|
|
1917
|
-
function handleRequest(requestMessage) {
|
|
2306
|
+
async function handleRequest(requestMessage) {
|
|
1918
2307
|
if (isDisposed()) {
|
|
1919
|
-
return;
|
|
2308
|
+
return Promise.resolve();
|
|
1920
2309
|
}
|
|
1921
2310
|
function reply(resultOrError, method, startTime2) {
|
|
1922
2311
|
const message = {
|
|
@@ -1929,7 +2318,7 @@ var require_connection = __commonJS({
|
|
|
1929
2318
|
message.result = resultOrError === void 0 ? null : resultOrError;
|
|
1930
2319
|
}
|
|
1931
2320
|
traceSendingResponse(message, method, startTime2);
|
|
1932
|
-
messageWriter.write(message)
|
|
2321
|
+
return messageWriter.write(message);
|
|
1933
2322
|
}
|
|
1934
2323
|
function replyError(error51, method, startTime2) {
|
|
1935
2324
|
const message = {
|
|
@@ -1938,19 +2327,7 @@ var require_connection = __commonJS({
|
|
|
1938
2327
|
error: error51.toJson()
|
|
1939
2328
|
};
|
|
1940
2329
|
traceSendingResponse(message, method, startTime2);
|
|
1941
|
-
messageWriter.write(message)
|
|
1942
|
-
}
|
|
1943
|
-
function replySuccess(result, method, startTime2) {
|
|
1944
|
-
if (result === void 0) {
|
|
1945
|
-
result = null;
|
|
1946
|
-
}
|
|
1947
|
-
const message = {
|
|
1948
|
-
jsonrpc: version2,
|
|
1949
|
-
id: requestMessage.id,
|
|
1950
|
-
result
|
|
1951
|
-
};
|
|
1952
|
-
traceSendingResponse(message, method, startTime2);
|
|
1953
|
-
messageWriter.write(message).catch(() => logger2.error(`Sending response failed.`));
|
|
2330
|
+
return messageWriter.write(message);
|
|
1954
2331
|
}
|
|
1955
2332
|
traceReceivedRequest(requestMessage);
|
|
1956
2333
|
const element = requestHandlers.get(requestMessage.method);
|
|
@@ -1975,60 +2352,38 @@ var require_connection = __commonJS({
|
|
|
1975
2352
|
if (requestHandler) {
|
|
1976
2353
|
if (requestMessage.params === void 0) {
|
|
1977
2354
|
if (type !== void 0 && type.numberOfParams !== 0) {
|
|
1978
|
-
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime);
|
|
1979
|
-
return;
|
|
2355
|
+
return replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime);
|
|
1980
2356
|
}
|
|
1981
2357
|
handlerResult = requestHandler(cancellationSource.token);
|
|
1982
2358
|
} else if (Array.isArray(requestMessage.params)) {
|
|
1983
2359
|
if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) {
|
|
1984
|
-
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
|
|
1985
|
-
return;
|
|
2360
|
+
return replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
|
|
1986
2361
|
}
|
|
1987
2362
|
handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);
|
|
1988
2363
|
} else {
|
|
1989
2364
|
if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
|
|
1990
|
-
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
|
|
1991
|
-
return;
|
|
2365
|
+
return replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
|
|
1992
2366
|
}
|
|
1993
2367
|
handlerResult = requestHandler(requestMessage.params, cancellationSource.token);
|
|
1994
2368
|
}
|
|
1995
2369
|
} else if (starRequestHandler) {
|
|
1996
2370
|
handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
|
|
1997
2371
|
}
|
|
1998
|
-
const
|
|
1999
|
-
|
|
2000
|
-
requestTokens.delete(tokenKey);
|
|
2001
|
-
replySuccess(handlerResult, requestMessage.method, startTime);
|
|
2002
|
-
} else if (promise2.then) {
|
|
2003
|
-
promise2.then((resultOrError) => {
|
|
2004
|
-
requestTokens.delete(tokenKey);
|
|
2005
|
-
reply(resultOrError, requestMessage.method, startTime);
|
|
2006
|
-
}, (error51) => {
|
|
2007
|
-
requestTokens.delete(tokenKey);
|
|
2008
|
-
if (error51 instanceof messages_1.ResponseError) {
|
|
2009
|
-
replyError(error51, requestMessage.method, startTime);
|
|
2010
|
-
} else if (error51 && Is.string(error51.message)) {
|
|
2011
|
-
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error51.message}`), requestMessage.method, startTime);
|
|
2012
|
-
} else {
|
|
2013
|
-
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
|
|
2014
|
-
}
|
|
2015
|
-
});
|
|
2016
|
-
} else {
|
|
2017
|
-
requestTokens.delete(tokenKey);
|
|
2018
|
-
reply(handlerResult, requestMessage.method, startTime);
|
|
2019
|
-
}
|
|
2372
|
+
const resultOrError = await handlerResult;
|
|
2373
|
+
await reply(resultOrError, requestMessage.method, startTime);
|
|
2020
2374
|
} catch (error51) {
|
|
2021
|
-
requestTokens.delete(tokenKey);
|
|
2022
2375
|
if (error51 instanceof messages_1.ResponseError) {
|
|
2023
|
-
reply(error51, requestMessage.method, startTime);
|
|
2376
|
+
await reply(error51, requestMessage.method, startTime);
|
|
2024
2377
|
} else if (error51 && Is.string(error51.message)) {
|
|
2025
|
-
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error51.message}`), requestMessage.method, startTime);
|
|
2378
|
+
await replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error51.message}`), requestMessage.method, startTime);
|
|
2026
2379
|
} else {
|
|
2027
|
-
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
|
|
2380
|
+
await replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
|
|
2028
2381
|
}
|
|
2382
|
+
} finally {
|
|
2383
|
+
requestTokens.delete(tokenKey);
|
|
2029
2384
|
}
|
|
2030
2385
|
} else {
|
|
2031
|
-
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
|
|
2386
|
+
await replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
|
|
2032
2387
|
}
|
|
2033
2388
|
}
|
|
2034
2389
|
function handleResponse(responseMessage) {
|
|
@@ -2067,7 +2422,7 @@ ${JSON.stringify(responseMessage.error, void 0, 4)}`);
|
|
|
2067
2422
|
}
|
|
2068
2423
|
}
|
|
2069
2424
|
}
|
|
2070
|
-
function handleNotification(message) {
|
|
2425
|
+
async function handleNotification(message) {
|
|
2071
2426
|
if (isDisposed()) {
|
|
2072
2427
|
return;
|
|
2073
2428
|
}
|
|
@@ -2095,11 +2450,11 @@ ${JSON.stringify(responseMessage.error, void 0, 4)}`);
|
|
|
2095
2450
|
logger2.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`);
|
|
2096
2451
|
}
|
|
2097
2452
|
}
|
|
2098
|
-
notificationHandler();
|
|
2453
|
+
await notificationHandler();
|
|
2099
2454
|
} else if (Array.isArray(message.params)) {
|
|
2100
2455
|
const params = message.params;
|
|
2101
2456
|
if (message.method === ProgressNotification.type.method && params.length === 2 && ProgressToken.is(params[0])) {
|
|
2102
|
-
notificationHandler({ token: params[0], value: params[1] });
|
|
2457
|
+
await notificationHandler({ token: params[0], value: params[1] });
|
|
2103
2458
|
} else {
|
|
2104
2459
|
if (type !== void 0) {
|
|
2105
2460
|
if (type.parameterStructures === messages_1.ParameterStructures.byName) {
|
|
@@ -2109,16 +2464,16 @@ ${JSON.stringify(responseMessage.error, void 0, 4)}`);
|
|
|
2109
2464
|
logger2.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${params.length} arguments`);
|
|
2110
2465
|
}
|
|
2111
2466
|
}
|
|
2112
|
-
notificationHandler(...params);
|
|
2467
|
+
await notificationHandler(...params);
|
|
2113
2468
|
}
|
|
2114
2469
|
} else {
|
|
2115
2470
|
if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
|
|
2116
2471
|
logger2.error(`Notification ${message.method} defines parameters by position but received parameters by name`);
|
|
2117
2472
|
}
|
|
2118
|
-
notificationHandler(message.params);
|
|
2473
|
+
await notificationHandler(message.params);
|
|
2119
2474
|
}
|
|
2120
2475
|
} else if (starNotificationHandler) {
|
|
2121
|
-
starNotificationHandler(message.method, message.params);
|
|
2476
|
+
await starNotificationHandler(message.method, message.params);
|
|
2122
2477
|
}
|
|
2123
2478
|
} catch (error51) {
|
|
2124
2479
|
if (error51.message) {
|
|
@@ -2167,9 +2522,7 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2167
2522
|
if (traceFormat === TraceFormat.Text) {
|
|
2168
2523
|
let data = void 0;
|
|
2169
2524
|
if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) {
|
|
2170
|
-
data = `Params: ${stringifyTrace(message.params)}
|
|
2171
|
-
|
|
2172
|
-
`;
|
|
2525
|
+
data = `Params: ${stringifyTrace(message.params)}`;
|
|
2173
2526
|
}
|
|
2174
2527
|
tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
|
|
2175
2528
|
} else {
|
|
@@ -2184,11 +2537,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2184
2537
|
let data = void 0;
|
|
2185
2538
|
if (trace === Trace.Verbose || trace === Trace.Compact) {
|
|
2186
2539
|
if (message.params) {
|
|
2187
|
-
data = `Params: ${stringifyTrace(message.params)}
|
|
2188
|
-
|
|
2189
|
-
`;
|
|
2540
|
+
data = `Params: ${stringifyTrace(message.params)}`;
|
|
2190
2541
|
} else {
|
|
2191
|
-
data = "No parameters provided
|
|
2542
|
+
data = "No parameters provided.";
|
|
2192
2543
|
}
|
|
2193
2544
|
}
|
|
2194
2545
|
tracer.log(`Sending notification '${message.method}'.`, data);
|
|
@@ -2204,16 +2555,12 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2204
2555
|
let data = void 0;
|
|
2205
2556
|
if (trace === Trace.Verbose || trace === Trace.Compact) {
|
|
2206
2557
|
if (message.error && message.error.data) {
|
|
2207
|
-
data = `Error data: ${stringifyTrace(message.error.data)}
|
|
2208
|
-
|
|
2209
|
-
`;
|
|
2558
|
+
data = `Error data: ${stringifyTrace(message.error.data)}`;
|
|
2210
2559
|
} else {
|
|
2211
2560
|
if (message.result) {
|
|
2212
|
-
data = `Result: ${stringifyTrace(message.result)}
|
|
2213
|
-
|
|
2214
|
-
`;
|
|
2561
|
+
data = `Result: ${stringifyTrace(message.result)}`;
|
|
2215
2562
|
} else if (message.error === void 0) {
|
|
2216
|
-
data = "No result returned
|
|
2563
|
+
data = "No result returned.";
|
|
2217
2564
|
}
|
|
2218
2565
|
}
|
|
2219
2566
|
}
|
|
@@ -2229,9 +2576,7 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2229
2576
|
if (traceFormat === TraceFormat.Text) {
|
|
2230
2577
|
let data = void 0;
|
|
2231
2578
|
if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) {
|
|
2232
|
-
data = `Params: ${stringifyTrace(message.params)}
|
|
2233
|
-
|
|
2234
|
-
`;
|
|
2579
|
+
data = `Params: ${stringifyTrace(message.params)}`;
|
|
2235
2580
|
}
|
|
2236
2581
|
tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
|
|
2237
2582
|
} else {
|
|
@@ -2246,11 +2591,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2246
2591
|
let data = void 0;
|
|
2247
2592
|
if (trace === Trace.Verbose || trace === Trace.Compact) {
|
|
2248
2593
|
if (message.params) {
|
|
2249
|
-
data = `Params: ${stringifyTrace(message.params)}
|
|
2250
|
-
|
|
2251
|
-
`;
|
|
2594
|
+
data = `Params: ${stringifyTrace(message.params)}`;
|
|
2252
2595
|
} else {
|
|
2253
|
-
data = "No parameters provided
|
|
2596
|
+
data = "No parameters provided.";
|
|
2254
2597
|
}
|
|
2255
2598
|
}
|
|
2256
2599
|
tracer.log(`Received notification '${message.method}'.`, data);
|
|
@@ -2266,16 +2609,12 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2266
2609
|
let data = void 0;
|
|
2267
2610
|
if (trace === Trace.Verbose || trace === Trace.Compact) {
|
|
2268
2611
|
if (message.error && message.error.data) {
|
|
2269
|
-
data = `Error data: ${stringifyTrace(message.error.data)}
|
|
2270
|
-
|
|
2271
|
-
`;
|
|
2612
|
+
data = `Error data: ${stringifyTrace(message.error.data)}`;
|
|
2272
2613
|
} else {
|
|
2273
2614
|
if (message.result) {
|
|
2274
|
-
data = `Result: ${stringifyTrace(message.result)}
|
|
2275
|
-
|
|
2276
|
-
`;
|
|
2615
|
+
data = `Result: ${stringifyTrace(message.result)}`;
|
|
2277
2616
|
} else if (message.error === void 0) {
|
|
2278
|
-
data = "No result returned
|
|
2617
|
+
data = "No result returned.";
|
|
2279
2618
|
}
|
|
2280
2619
|
}
|
|
2281
2620
|
}
|
|
@@ -2393,7 +2732,7 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2393
2732
|
paramStart = 1;
|
|
2394
2733
|
parameterStructures = first;
|
|
2395
2734
|
}
|
|
2396
|
-
|
|
2735
|
+
const paramEnd = args.length;
|
|
2397
2736
|
const numberOfParams = paramEnd - paramStart;
|
|
2398
2737
|
switch (numberOfParams) {
|
|
2399
2738
|
case 0:
|
|
@@ -2442,8 +2781,10 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2442
2781
|
return {
|
|
2443
2782
|
dispose: () => {
|
|
2444
2783
|
if (method !== void 0) {
|
|
2445
|
-
notificationHandlers.
|
|
2446
|
-
|
|
2784
|
+
if (notificationHandlers.get(method)?.handler === handler) {
|
|
2785
|
+
notificationHandlers.delete(method);
|
|
2786
|
+
}
|
|
2787
|
+
} else if (starNotificationHandler === type) {
|
|
2447
2788
|
starNotificationHandler = void 0;
|
|
2448
2789
|
}
|
|
2449
2790
|
}
|
|
@@ -2456,7 +2797,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2456
2797
|
progressHandlers.set(token, handler);
|
|
2457
2798
|
return {
|
|
2458
2799
|
dispose: () => {
|
|
2459
|
-
progressHandlers.
|
|
2800
|
+
if (progressHandlers.get(token) === handler) {
|
|
2801
|
+
progressHandlers.delete(token);
|
|
2802
|
+
}
|
|
2460
2803
|
}
|
|
2461
2804
|
};
|
|
2462
2805
|
},
|
|
@@ -2467,6 +2810,16 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2467
2810
|
sendRequest: (type, ...args) => {
|
|
2468
2811
|
throwIfClosedOrDisposed();
|
|
2469
2812
|
throwIfNotListening();
|
|
2813
|
+
function sendCancellation(connection2, id2) {
|
|
2814
|
+
const p = cancellationStrategy.sender.sendCancellation(connection2, id2);
|
|
2815
|
+
if (p === void 0) {
|
|
2816
|
+
logger2.log(`Received no promise from cancellation strategy when cancelling id ${id2}`);
|
|
2817
|
+
} else {
|
|
2818
|
+
p.catch(() => {
|
|
2819
|
+
logger2.log(`Sending cancellation messages for id ${id2} failed.`);
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2470
2823
|
let method;
|
|
2471
2824
|
let messageParams;
|
|
2472
2825
|
let token = void 0;
|
|
@@ -2509,18 +2862,15 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2509
2862
|
}
|
|
2510
2863
|
const id = sequenceNumber++;
|
|
2511
2864
|
let disposable;
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
});
|
|
2522
|
-
}
|
|
2523
|
-
});
|
|
2865
|
+
let tokenWasCancelled = false;
|
|
2866
|
+
if (token !== void 0) {
|
|
2867
|
+
if (token.isCancellationRequested) {
|
|
2868
|
+
tokenWasCancelled = true;
|
|
2869
|
+
} else {
|
|
2870
|
+
disposable = token.onCancellationRequested(() => {
|
|
2871
|
+
sendCancellation(connection, id);
|
|
2872
|
+
});
|
|
2873
|
+
}
|
|
2524
2874
|
}
|
|
2525
2875
|
const requestMessage = {
|
|
2526
2876
|
jsonrpc: version2,
|
|
@@ -2547,6 +2897,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2547
2897
|
try {
|
|
2548
2898
|
responsePromises.set(id, responsePromise);
|
|
2549
2899
|
await messageWriter.write(requestMessage);
|
|
2900
|
+
if (tokenWasCancelled) {
|
|
2901
|
+
sendCancellation(connection, id);
|
|
2902
|
+
}
|
|
2550
2903
|
} catch (error51) {
|
|
2551
2904
|
responsePromises.delete(id);
|
|
2552
2905
|
responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error51.message ? error51.message : "Unknown reason"));
|
|
@@ -2579,8 +2932,10 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2579
2932
|
return;
|
|
2580
2933
|
}
|
|
2581
2934
|
if (method !== void 0) {
|
|
2582
|
-
requestHandlers.
|
|
2583
|
-
|
|
2935
|
+
if (requestHandlers.get(method)?.handler === handler) {
|
|
2936
|
+
requestHandlers.delete(method);
|
|
2937
|
+
}
|
|
2938
|
+
} else if (starRequestHandler === type) {
|
|
2584
2939
|
starRequestHandler = void 0;
|
|
2585
2940
|
}
|
|
2586
2941
|
}
|
|
@@ -2656,17 +3011,16 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2656
3011
|
const verbose = trace === Trace.Verbose || trace === Trace.Compact;
|
|
2657
3012
|
tracer.log(params.message, verbose ? params.verbose : void 0);
|
|
2658
3013
|
});
|
|
2659
|
-
connection.onNotification(ProgressNotification.type, (params) => {
|
|
3014
|
+
connection.onNotification(ProgressNotification.type, async (params) => {
|
|
2660
3015
|
const handler = progressHandlers.get(params.token);
|
|
2661
3016
|
if (handler) {
|
|
2662
|
-
handler(params.value);
|
|
3017
|
+
await handler(params.value);
|
|
2663
3018
|
} else {
|
|
2664
3019
|
unhandledProgressEmitter.fire(params);
|
|
2665
3020
|
}
|
|
2666
3021
|
});
|
|
2667
3022
|
return connection;
|
|
2668
3023
|
}
|
|
2669
|
-
exports.createMessageConnection = createMessageConnection2;
|
|
2670
3024
|
}
|
|
2671
3025
|
});
|
|
2672
3026
|
|
|
@@ -2674,9 +3028,12 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
2674
3028
|
var require_api = __commonJS({
|
|
2675
3029
|
"node_modules/vscode-jsonrpc/lib/common/api.js"(exports) {
|
|
2676
3030
|
"use strict";
|
|
3031
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
3032
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3033
|
+
};
|
|
2677
3034
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2678
3035
|
exports.ProgressType = exports.ProgressToken = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.AbstractMessageBuffer = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.LRUCache = exports.Touch = exports.LinkedMap = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.Message = exports.RAL = void 0;
|
|
2679
|
-
exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = void 0;
|
|
3036
|
+
exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.RequestCancellationReceiverStrategy = exports.IdCancellationReceiverStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.TraceValue = exports.Trace = void 0;
|
|
2680
3037
|
var messages_1 = require_messages();
|
|
2681
3038
|
Object.defineProperty(exports, "Message", { enumerable: true, get: function() {
|
|
2682
3039
|
return messages_1.Message;
|
|
@@ -2837,8 +3194,8 @@ var require_api = __commonJS({
|
|
|
2837
3194
|
Object.defineProperty(exports, "Trace", { enumerable: true, get: function() {
|
|
2838
3195
|
return connection_1.Trace;
|
|
2839
3196
|
} });
|
|
2840
|
-
Object.defineProperty(exports, "
|
|
2841
|
-
return connection_1.
|
|
3197
|
+
Object.defineProperty(exports, "TraceValue", { enumerable: true, get: function() {
|
|
3198
|
+
return connection_1.TraceValue;
|
|
2842
3199
|
} });
|
|
2843
3200
|
Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function() {
|
|
2844
3201
|
return connection_1.TraceFormat;
|
|
@@ -2858,6 +3215,12 @@ var require_api = __commonJS({
|
|
|
2858
3215
|
Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function() {
|
|
2859
3216
|
return connection_1.CancellationReceiverStrategy;
|
|
2860
3217
|
} });
|
|
3218
|
+
Object.defineProperty(exports, "IdCancellationReceiverStrategy", { enumerable: true, get: function() {
|
|
3219
|
+
return connection_1.IdCancellationReceiverStrategy;
|
|
3220
|
+
} });
|
|
3221
|
+
Object.defineProperty(exports, "RequestCancellationReceiverStrategy", { enumerable: true, get: function() {
|
|
3222
|
+
return connection_1.RequestCancellationReceiverStrategy;
|
|
3223
|
+
} });
|
|
2861
3224
|
Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function() {
|
|
2862
3225
|
return connection_1.CancellationSenderStrategy;
|
|
2863
3226
|
} });
|
|
@@ -2867,7 +3230,10 @@ var require_api = __commonJS({
|
|
|
2867
3230
|
Object.defineProperty(exports, "MessageStrategy", { enumerable: true, get: function() {
|
|
2868
3231
|
return connection_1.MessageStrategy;
|
|
2869
3232
|
} });
|
|
2870
|
-
|
|
3233
|
+
Object.defineProperty(exports, "TraceValues", { enumerable: true, get: function() {
|
|
3234
|
+
return connection_1.TraceValues;
|
|
3235
|
+
} });
|
|
3236
|
+
var ral_1 = __importDefault(require_ral());
|
|
2871
3237
|
exports.RAL = ral_1.default;
|
|
2872
3238
|
}
|
|
2873
3239
|
});
|
|
@@ -2880,6 +3246,7 @@ var require_ril = __commonJS({
|
|
|
2880
3246
|
var util_1 = __require("util");
|
|
2881
3247
|
var api_1 = require_api();
|
|
2882
3248
|
var MessageBuffer = class _MessageBuffer extends api_1.AbstractMessageBuffer {
|
|
3249
|
+
static emptyBuffer = Buffer.allocUnsafe(0);
|
|
2883
3250
|
constructor(encoding = "utf-8") {
|
|
2884
3251
|
super(encoding);
|
|
2885
3252
|
}
|
|
@@ -2907,8 +3274,8 @@ var require_ril = __commonJS({
|
|
|
2907
3274
|
return Buffer.allocUnsafe(length);
|
|
2908
3275
|
}
|
|
2909
3276
|
};
|
|
2910
|
-
MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
|
|
2911
3277
|
var ReadableStreamWrapper = class {
|
|
3278
|
+
stream;
|
|
2912
3279
|
constructor(stream) {
|
|
2913
3280
|
this.stream = stream;
|
|
2914
3281
|
}
|
|
@@ -2930,6 +3297,7 @@ var require_ril = __commonJS({
|
|
|
2930
3297
|
}
|
|
2931
3298
|
};
|
|
2932
3299
|
var WritableStreamWrapper = class {
|
|
3300
|
+
stream;
|
|
2933
3301
|
constructor(stream) {
|
|
2934
3302
|
this.stream = stream;
|
|
2935
3303
|
}
|
|
@@ -3045,24 +3413,59 @@ var require_main = __commonJS({
|
|
|
3045
3413
|
if (k2 === void 0) k2 = k;
|
|
3046
3414
|
o[k2] = m[k];
|
|
3047
3415
|
}));
|
|
3416
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
3417
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3418
|
+
}) : function(o, v) {
|
|
3419
|
+
o["default"] = v;
|
|
3420
|
+
});
|
|
3421
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
3422
|
+
var ownKeys = function(o) {
|
|
3423
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
3424
|
+
var ar = [];
|
|
3425
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
3426
|
+
return ar;
|
|
3427
|
+
};
|
|
3428
|
+
return ownKeys(o);
|
|
3429
|
+
};
|
|
3430
|
+
return function(mod) {
|
|
3431
|
+
if (mod && mod.__esModule) return mod;
|
|
3432
|
+
var result = {};
|
|
3433
|
+
if (mod != null) {
|
|
3434
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
3435
|
+
}
|
|
3436
|
+
__setModuleDefault(result, mod);
|
|
3437
|
+
return result;
|
|
3438
|
+
};
|
|
3439
|
+
})();
|
|
3048
3440
|
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
3049
3441
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
3050
3442
|
};
|
|
3443
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
3444
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3445
|
+
};
|
|
3051
3446
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3052
|
-
exports.
|
|
3053
|
-
|
|
3447
|
+
exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.PortMessageWriter = exports.PortMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0;
|
|
3448
|
+
exports.generateRandomPipeName = generateRandomPipeName;
|
|
3449
|
+
exports.createClientPipeTransport = createClientPipeTransport;
|
|
3450
|
+
exports.createServerPipeTransport = createServerPipeTransport;
|
|
3451
|
+
exports.createClientSocketTransport = createClientSocketTransport;
|
|
3452
|
+
exports.createServerSocketTransport = createServerSocketTransport;
|
|
3453
|
+
exports.createMessageConnection = createMessageConnection2;
|
|
3454
|
+
var ril_1 = __importDefault(require_ril());
|
|
3054
3455
|
ril_1.default.install();
|
|
3055
|
-
var path6 = __require("path");
|
|
3056
|
-
var os2 = __require("os");
|
|
3456
|
+
var path6 = __importStar(__require("path"));
|
|
3457
|
+
var os2 = __importStar(__require("os"));
|
|
3458
|
+
var fs7 = __importStar(__require("fs"));
|
|
3057
3459
|
var crypto_1 = __require("crypto");
|
|
3058
3460
|
var net_1 = __require("net");
|
|
3059
3461
|
var api_1 = require_api();
|
|
3060
3462
|
__exportStar(require_api(), exports);
|
|
3061
3463
|
var IPCMessageReader = class extends api_1.AbstractMessageReader {
|
|
3464
|
+
process;
|
|
3062
3465
|
constructor(process10) {
|
|
3063
3466
|
super();
|
|
3064
3467
|
this.process = process10;
|
|
3065
|
-
|
|
3468
|
+
const eventEmitter = this.process;
|
|
3066
3469
|
eventEmitter.on("error", (error51) => this.fireError(error51));
|
|
3067
3470
|
eventEmitter.on("close", () => this.fireClose());
|
|
3068
3471
|
}
|
|
@@ -3073,6 +3476,8 @@ var require_main = __commonJS({
|
|
|
3073
3476
|
};
|
|
3074
3477
|
exports.IPCMessageReader = IPCMessageReader;
|
|
3075
3478
|
var IPCMessageWriter = class extends api_1.AbstractMessageWriter {
|
|
3479
|
+
process;
|
|
3480
|
+
errorCount;
|
|
3076
3481
|
constructor(process10) {
|
|
3077
3482
|
super();
|
|
3078
3483
|
this.process = process10;
|
|
@@ -3108,6 +3513,7 @@ var require_main = __commonJS({
|
|
|
3108
3513
|
};
|
|
3109
3514
|
exports.IPCMessageWriter = IPCMessageWriter;
|
|
3110
3515
|
var PortMessageReader = class extends api_1.AbstractMessageReader {
|
|
3516
|
+
onData;
|
|
3111
3517
|
constructor(port) {
|
|
3112
3518
|
super();
|
|
3113
3519
|
this.onData = new api_1.Emitter();
|
|
@@ -3123,6 +3529,8 @@ var require_main = __commonJS({
|
|
|
3123
3529
|
};
|
|
3124
3530
|
exports.PortMessageReader = PortMessageReader;
|
|
3125
3531
|
var PortMessageWriter = class extends api_1.AbstractMessageWriter {
|
|
3532
|
+
port;
|
|
3533
|
+
errorCount;
|
|
3126
3534
|
constructor(port) {
|
|
3127
3535
|
super();
|
|
3128
3536
|
this.port = port;
|
|
@@ -3154,6 +3562,7 @@ var require_main = __commonJS({
|
|
|
3154
3562
|
};
|
|
3155
3563
|
exports.SocketMessageReader = SocketMessageReader;
|
|
3156
3564
|
var SocketMessageWriter = class extends api_1.WriteableStreamMessageWriter {
|
|
3565
|
+
socket;
|
|
3157
3566
|
constructor(socket, options) {
|
|
3158
3567
|
super((0, ril_1.default)().stream.asWritableStream(socket), options);
|
|
3159
3568
|
this.socket = socket;
|
|
@@ -3179,33 +3588,32 @@ var require_main = __commonJS({
|
|
|
3179
3588
|
var XDG_RUNTIME_DIR = process.env["XDG_RUNTIME_DIR"];
|
|
3180
3589
|
var safeIpcPathLengths = /* @__PURE__ */ new Map([
|
|
3181
3590
|
["linux", 107],
|
|
3182
|
-
["darwin",
|
|
3591
|
+
["darwin", 102]
|
|
3183
3592
|
]);
|
|
3184
3593
|
function generateRandomPipeName() {
|
|
3185
|
-
const randomSuffix = (0, crypto_1.randomBytes)(21).toString("hex");
|
|
3186
3594
|
if (process.platform === "win32") {
|
|
3187
|
-
return `\\\\.\\pipe\\
|
|
3188
|
-
}
|
|
3189
|
-
let result;
|
|
3190
|
-
if (XDG_RUNTIME_DIR) {
|
|
3191
|
-
result = path6.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
|
|
3192
|
-
} else {
|
|
3193
|
-
result = path6.join(os2.tmpdir(), `vscode-${randomSuffix}.sock`);
|
|
3595
|
+
return `\\\\.\\pipe\\lsp-${(0, crypto_1.randomBytes)(16).toString("hex")}-sock`;
|
|
3194
3596
|
}
|
|
3597
|
+
let randomLength = 32;
|
|
3598
|
+
const fixedLength = "/lsp-.sock".length;
|
|
3599
|
+
const tmpDir = fs7.realpathSync(XDG_RUNTIME_DIR ?? os2.tmpdir());
|
|
3195
3600
|
const limit = safeIpcPathLengths.get(process.platform);
|
|
3196
|
-
if (limit !== void 0
|
|
3197
|
-
|
|
3601
|
+
if (limit !== void 0) {
|
|
3602
|
+
randomLength = Math.min(limit - tmpDir.length - fixedLength, randomLength);
|
|
3198
3603
|
}
|
|
3199
|
-
|
|
3604
|
+
if (randomLength < 16) {
|
|
3605
|
+
throw new Error(`Unable to generate a random pipe name with ${randomLength} characters.`);
|
|
3606
|
+
}
|
|
3607
|
+
const randomSuffix = (0, crypto_1.randomBytes)(Math.floor(randomLength / 2)).toString("hex");
|
|
3608
|
+
return path6.join(tmpDir, `lsp-${randomSuffix}.sock`);
|
|
3200
3609
|
}
|
|
3201
|
-
exports.generateRandomPipeName = generateRandomPipeName;
|
|
3202
3610
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
3203
3611
|
let connectResolve;
|
|
3204
3612
|
const connected = new Promise((resolve, _reject) => {
|
|
3205
3613
|
connectResolve = resolve;
|
|
3206
3614
|
});
|
|
3207
3615
|
return new Promise((resolve, reject) => {
|
|
3208
|
-
|
|
3616
|
+
const server = (0, net_1.createServer)((socket) => {
|
|
3209
3617
|
server.close();
|
|
3210
3618
|
connectResolve([
|
|
3211
3619
|
new SocketMessageReader(socket, encoding),
|
|
@@ -3223,7 +3631,6 @@ var require_main = __commonJS({
|
|
|
3223
3631
|
});
|
|
3224
3632
|
});
|
|
3225
3633
|
}
|
|
3226
|
-
exports.createClientPipeTransport = createClientPipeTransport;
|
|
3227
3634
|
function createServerPipeTransport(pipeName, encoding = "utf-8") {
|
|
3228
3635
|
const socket = (0, net_1.createConnection)(pipeName);
|
|
3229
3636
|
return [
|
|
@@ -3231,7 +3638,6 @@ var require_main = __commonJS({
|
|
|
3231
3638
|
new SocketMessageWriter(socket, encoding)
|
|
3232
3639
|
];
|
|
3233
3640
|
}
|
|
3234
|
-
exports.createServerPipeTransport = createServerPipeTransport;
|
|
3235
3641
|
function createClientSocketTransport(port, encoding = "utf-8") {
|
|
3236
3642
|
let connectResolve;
|
|
3237
3643
|
const connected = new Promise((resolve, _reject) => {
|
|
@@ -3256,7 +3662,6 @@ var require_main = __commonJS({
|
|
|
3256
3662
|
});
|
|
3257
3663
|
});
|
|
3258
3664
|
}
|
|
3259
|
-
exports.createClientSocketTransport = createClientSocketTransport;
|
|
3260
3665
|
function createServerSocketTransport(port, encoding = "utf-8") {
|
|
3261
3666
|
const socket = (0, net_1.createConnection)(port, "127.0.0.1");
|
|
3262
3667
|
return [
|
|
@@ -3264,7 +3669,6 @@ var require_main = __commonJS({
|
|
|
3264
3669
|
new SocketMessageWriter(socket, encoding)
|
|
3265
3670
|
];
|
|
3266
3671
|
}
|
|
3267
|
-
exports.createServerSocketTransport = createServerSocketTransport;
|
|
3268
3672
|
function isReadableStream(value) {
|
|
3269
3673
|
const candidate = value;
|
|
3270
3674
|
return candidate.read !== void 0 && candidate.addListener !== void 0;
|
|
@@ -3284,15 +3688,6 @@ var require_main = __commonJS({
|
|
|
3284
3688
|
}
|
|
3285
3689
|
return (0, api_1.createMessageConnection)(reader, writer, logger2, options);
|
|
3286
3690
|
}
|
|
3287
|
-
exports.createMessageConnection = createMessageConnection2;
|
|
3288
|
-
}
|
|
3289
|
-
});
|
|
3290
|
-
|
|
3291
|
-
// node_modules/vscode-jsonrpc/node.js
|
|
3292
|
-
var require_node = __commonJS({
|
|
3293
|
-
"node_modules/vscode-jsonrpc/node.js"(exports, module) {
|
|
3294
|
-
"use strict";
|
|
3295
|
-
module.exports = require_main();
|
|
3296
3691
|
}
|
|
3297
3692
|
});
|
|
3298
3693
|
|
|
@@ -20352,9 +20747,20 @@ var methods = {
|
|
|
20352
20747
|
var startActiveSession = /* @__PURE__ */ Symbol("startActiveSession");
|
|
20353
20748
|
var AcpContext = class {
|
|
20354
20749
|
cx;
|
|
20750
|
+
currentRequestId;
|
|
20355
20751
|
/** @internal */
|
|
20356
|
-
constructor(cx) {
|
|
20752
|
+
constructor(cx, currentRequestId) {
|
|
20357
20753
|
this.cx = cx;
|
|
20754
|
+
this.currentRequestId = currentRequestId;
|
|
20755
|
+
}
|
|
20756
|
+
/**
|
|
20757
|
+
* JSON-RPC id of the request currently being handled.
|
|
20758
|
+
*
|
|
20759
|
+
* This is `undefined` for notification handlers and for contexts created
|
|
20760
|
+
* outside an inbound request, such as `connect(...)` and `connectWith(...)`.
|
|
20761
|
+
*/
|
|
20762
|
+
get requestId() {
|
|
20763
|
+
return this.currentRequestId;
|
|
20358
20764
|
}
|
|
20359
20765
|
/** @internal */
|
|
20360
20766
|
get connectionContext() {
|
|
@@ -20374,12 +20780,12 @@ var AcpContext = class {
|
|
|
20374
20780
|
}
|
|
20375
20781
|
};
|
|
20376
20782
|
var AgentContext = class _AgentContext extends AcpContext {
|
|
20377
|
-
constructor(cx) {
|
|
20378
|
-
super(cx);
|
|
20783
|
+
constructor(cx, requestId) {
|
|
20784
|
+
super(cx, requestId);
|
|
20379
20785
|
}
|
|
20380
20786
|
/** @internal */
|
|
20381
|
-
static create(cx) {
|
|
20382
|
-
return new _AgentContext(cx);
|
|
20787
|
+
static create(cx, requestId) {
|
|
20788
|
+
return new _AgentContext(cx, requestId);
|
|
20383
20789
|
}
|
|
20384
20790
|
request(method, params, options) {
|
|
20385
20791
|
const spec = clientRequestSpecsByMethod[method];
|
|
@@ -20390,12 +20796,12 @@ var AgentContext = class _AgentContext extends AcpContext {
|
|
|
20390
20796
|
}
|
|
20391
20797
|
};
|
|
20392
20798
|
var ClientContext = class _ClientContext extends AcpContext {
|
|
20393
|
-
constructor(cx) {
|
|
20394
|
-
super(cx);
|
|
20799
|
+
constructor(cx, requestId) {
|
|
20800
|
+
super(cx, requestId);
|
|
20395
20801
|
}
|
|
20396
20802
|
/** @internal */
|
|
20397
|
-
static create(cx) {
|
|
20398
|
-
return new _ClientContext(cx);
|
|
20803
|
+
static create(cx, requestId) {
|
|
20804
|
+
return new _ClientContext(cx, requestId);
|
|
20399
20805
|
}
|
|
20400
20806
|
/** @internal */
|
|
20401
20807
|
[startActiveSession](params, options) {
|
|
@@ -20764,7 +21170,7 @@ function notificationSpec(method, params) {
|
|
|
20764
21170
|
}
|
|
20765
21171
|
function registerAppRequest(builder, spec, context, handler) {
|
|
20766
21172
|
builder.onReceiveRequest(spec.method, (params) => parseParams(spec.params, params), async (params, responder, cx) => {
|
|
20767
|
-
const response = await handler(context(params, cx, responder.signal));
|
|
21173
|
+
const response = await handler(context(params, cx, responder.signal, responder.id));
|
|
20768
21174
|
await responder.respond(spec.mapResponse ? spec.mapResponse(response) : response);
|
|
20769
21175
|
});
|
|
20770
21176
|
}
|
|
@@ -20828,14 +21234,30 @@ var agentRequestSpecsByMethod = specsByMethod(agentRequestSpecs);
|
|
|
20828
21234
|
var agentNotificationSpecsByMethod = specsByMethod(agentNotificationSpecs);
|
|
20829
21235
|
var clientRequestSpecsByMethod = specsByMethod(clientRequestSpecs);
|
|
20830
21236
|
var clientNotificationSpecsByMethod = specsByMethod(clientNotificationSpecs);
|
|
20831
|
-
function
|
|
21237
|
+
function agentRequestContext(params, client, signal, requestId) {
|
|
20832
21238
|
return {
|
|
20833
21239
|
params,
|
|
21240
|
+
requestId,
|
|
20834
21241
|
signal,
|
|
20835
21242
|
client
|
|
20836
21243
|
};
|
|
20837
21244
|
}
|
|
20838
|
-
function
|
|
21245
|
+
function agentNotificationContext(params, client, signal) {
|
|
21246
|
+
return {
|
|
21247
|
+
params,
|
|
21248
|
+
signal,
|
|
21249
|
+
client
|
|
21250
|
+
};
|
|
21251
|
+
}
|
|
21252
|
+
function clientRequestContext(params, agent2, signal, requestId) {
|
|
21253
|
+
return {
|
|
21254
|
+
params,
|
|
21255
|
+
requestId,
|
|
21256
|
+
signal,
|
|
21257
|
+
agent: agent2
|
|
21258
|
+
};
|
|
21259
|
+
}
|
|
21260
|
+
function clientNotificationContext(params, agent2, signal) {
|
|
20839
21261
|
return {
|
|
20840
21262
|
params,
|
|
20841
21263
|
signal,
|
|
@@ -20957,11 +21379,11 @@ var AgentApp = class {
|
|
|
20957
21379
|
return this.notification(spec, handlerOrParams);
|
|
20958
21380
|
}
|
|
20959
21381
|
request(spec, handler) {
|
|
20960
|
-
registerAppRequest(this.builder, spec, (params, cx, signal) =>
|
|
21382
|
+
registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => agentRequestContext(params, AgentContext.create(cx, requestId), signal, requestId), handler);
|
|
20961
21383
|
return this;
|
|
20962
21384
|
}
|
|
20963
21385
|
notification(spec, handler) {
|
|
20964
|
-
registerAppNotification(this.builder, spec, (params, cx, signal) =>
|
|
21386
|
+
registerAppNotification(this.builder, spec, (params, cx, signal) => agentNotificationContext(params, AgentContext.create(cx), signal), handler);
|
|
20965
21387
|
return this;
|
|
20966
21388
|
}
|
|
20967
21389
|
connectConnection(target, options = {}) {
|
|
@@ -21054,11 +21476,11 @@ var ClientApp = class {
|
|
|
21054
21476
|
return this.notification(spec, handlerOrParams);
|
|
21055
21477
|
}
|
|
21056
21478
|
request(spec, handler) {
|
|
21057
|
-
registerAppRequest(this.builder, spec, (params, cx, signal) =>
|
|
21479
|
+
registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => clientRequestContext(params, ClientContext.create(cx, requestId), signal, requestId), handler);
|
|
21058
21480
|
return this;
|
|
21059
21481
|
}
|
|
21060
21482
|
notification(spec, handler) {
|
|
21061
|
-
registerAppNotification(this.builder, spec, (params, cx, signal) =>
|
|
21483
|
+
registerAppNotification(this.builder, spec, (params, cx, signal) => clientNotificationContext(params, ClientContext.create(cx), signal), handler);
|
|
21062
21484
|
return this;
|
|
21063
21485
|
}
|
|
21064
21486
|
connectConnection(target) {
|
|
@@ -21139,13 +21561,12 @@ var legacyClientNotificationMethods = /* @__PURE__ */ new Set([
|
|
|
21139
21561
|
]);
|
|
21140
21562
|
|
|
21141
21563
|
// src/CodexJsonRpcConnection.ts
|
|
21142
|
-
var rpc = __toESM(
|
|
21564
|
+
var rpc = __toESM(require_main(), 1);
|
|
21143
21565
|
import { spawn } from "node:child_process";
|
|
21144
21566
|
import { createRequire } from "node:module";
|
|
21145
21567
|
|
|
21146
21568
|
// src/StdUtils.ts
|
|
21147
|
-
var
|
|
21148
|
-
var import_node = __toESM(require_node(), 1);
|
|
21569
|
+
var import_node = __toESM(require_main(), 1);
|
|
21149
21570
|
import { Readable, Writable } from "node:stream";
|
|
21150
21571
|
function createJSONRPCWriter(writable) {
|
|
21151
21572
|
return {
|
|
@@ -21391,43 +21812,271 @@ function isWin(patch) {
|
|
|
21391
21812
|
function parsePatch(uniDiff) {
|
|
21392
21813
|
const diffstr = uniDiff.split(/\n/), list = [];
|
|
21393
21814
|
let i = 0;
|
|
21815
|
+
function isGitDiffHeader(line) {
|
|
21816
|
+
return /^diff --git /.test(line);
|
|
21817
|
+
}
|
|
21818
|
+
function isDiffHeader(line) {
|
|
21819
|
+
return isGitDiffHeader(line) || /^Index:\s/.test(line) || /^diff(?: -r \w+)+\s/.test(line);
|
|
21820
|
+
}
|
|
21821
|
+
function isFileHeader(line) {
|
|
21822
|
+
return /^(---|\+\+\+)\s/.test(line);
|
|
21823
|
+
}
|
|
21824
|
+
function isHunkHeader(line) {
|
|
21825
|
+
return /^@@\s/.test(line);
|
|
21826
|
+
}
|
|
21394
21827
|
function parseIndex() {
|
|
21828
|
+
var _a3;
|
|
21395
21829
|
const index = {};
|
|
21830
|
+
index.hunks = [];
|
|
21396
21831
|
list.push(index);
|
|
21832
|
+
let seenDiffHeader = false;
|
|
21397
21833
|
while (i < diffstr.length) {
|
|
21398
21834
|
const line = diffstr[i];
|
|
21399
|
-
if (
|
|
21835
|
+
if (isFileHeader(line) || isHunkHeader(line)) {
|
|
21400
21836
|
break;
|
|
21401
21837
|
}
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
|
|
21838
|
+
if (isGitDiffHeader(line)) {
|
|
21839
|
+
if (seenDiffHeader) {
|
|
21840
|
+
return;
|
|
21841
|
+
}
|
|
21842
|
+
seenDiffHeader = true;
|
|
21843
|
+
index.isGit = true;
|
|
21844
|
+
const paths = parseGitDiffHeader(line);
|
|
21845
|
+
if (paths) {
|
|
21846
|
+
index.oldFileName = paths.oldFileName;
|
|
21847
|
+
index.newFileName = paths.newFileName;
|
|
21848
|
+
}
|
|
21849
|
+
i++;
|
|
21850
|
+
while (i < diffstr.length) {
|
|
21851
|
+
const extLine = diffstr[i];
|
|
21852
|
+
if (isFileHeader(extLine) || isHunkHeader(extLine) || isDiffHeader(extLine)) {
|
|
21853
|
+
break;
|
|
21854
|
+
}
|
|
21855
|
+
const renameFromMatch = /^rename from (.*)/.exec(extLine);
|
|
21856
|
+
if (renameFromMatch) {
|
|
21857
|
+
index.oldFileName = "a/" + unquoteIfQuoted(renameFromMatch[1]);
|
|
21858
|
+
index.isRename = true;
|
|
21859
|
+
}
|
|
21860
|
+
const renameToMatch = /^rename to (.*)/.exec(extLine);
|
|
21861
|
+
if (renameToMatch) {
|
|
21862
|
+
index.newFileName = "b/" + unquoteIfQuoted(renameToMatch[1]);
|
|
21863
|
+
index.isRename = true;
|
|
21864
|
+
}
|
|
21865
|
+
const copyFromMatch = /^copy from (.*)/.exec(extLine);
|
|
21866
|
+
if (copyFromMatch) {
|
|
21867
|
+
index.oldFileName = "a/" + unquoteIfQuoted(copyFromMatch[1]);
|
|
21868
|
+
index.isCopy = true;
|
|
21869
|
+
}
|
|
21870
|
+
const copyToMatch = /^copy to (.*)/.exec(extLine);
|
|
21871
|
+
if (copyToMatch) {
|
|
21872
|
+
index.newFileName = "b/" + unquoteIfQuoted(copyToMatch[1]);
|
|
21873
|
+
index.isCopy = true;
|
|
21874
|
+
}
|
|
21875
|
+
const newFileModeMatch = /^new file mode (\d+)/.exec(extLine);
|
|
21876
|
+
if (newFileModeMatch) {
|
|
21877
|
+
index.isCreate = true;
|
|
21878
|
+
index.newMode = newFileModeMatch[1];
|
|
21879
|
+
}
|
|
21880
|
+
const deletedFileModeMatch = /^deleted file mode (\d+)/.exec(extLine);
|
|
21881
|
+
if (deletedFileModeMatch) {
|
|
21882
|
+
index.isDelete = true;
|
|
21883
|
+
index.oldMode = deletedFileModeMatch[1];
|
|
21884
|
+
}
|
|
21885
|
+
const oldModeMatch = /^old mode (\d+)/.exec(extLine);
|
|
21886
|
+
if (oldModeMatch) {
|
|
21887
|
+
index.oldMode = oldModeMatch[1];
|
|
21888
|
+
}
|
|
21889
|
+
const newModeMatch = /^new mode (\d+)/.exec(extLine);
|
|
21890
|
+
if (newModeMatch) {
|
|
21891
|
+
index.newMode = newModeMatch[1];
|
|
21892
|
+
}
|
|
21893
|
+
if (/^Binary files /.test(extLine)) {
|
|
21894
|
+
index.isBinary = true;
|
|
21895
|
+
}
|
|
21896
|
+
i++;
|
|
21897
|
+
}
|
|
21898
|
+
continue;
|
|
21899
|
+
} else if (isDiffHeader(line)) {
|
|
21900
|
+
if (seenDiffHeader) {
|
|
21901
|
+
return;
|
|
21902
|
+
}
|
|
21903
|
+
seenDiffHeader = true;
|
|
21904
|
+
const headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line);
|
|
21905
|
+
if (headerMatch) {
|
|
21906
|
+
index.index = line.substring(headerMatch[0].length).trim();
|
|
21907
|
+
}
|
|
21405
21908
|
}
|
|
21406
21909
|
i++;
|
|
21407
21910
|
}
|
|
21408
21911
|
parseFileHeader(index);
|
|
21409
21912
|
parseFileHeader(index);
|
|
21410
|
-
index.
|
|
21913
|
+
if (index.oldFileName === void 0 !== (index.newFileName === void 0)) {
|
|
21914
|
+
throw new Error("Missing " + (index.oldFileName !== void 0 ? '"+++ ..."' : '"--- ..."') + " file header for " + ((_a3 = index.oldFileName) !== null && _a3 !== void 0 ? _a3 : index.newFileName));
|
|
21915
|
+
}
|
|
21411
21916
|
while (i < diffstr.length) {
|
|
21412
21917
|
const line = diffstr[i];
|
|
21413
|
-
if (
|
|
21918
|
+
if (isDiffHeader(line) || isFileHeader(line) || /^===================================================================/.test(line)) {
|
|
21414
21919
|
break;
|
|
21415
|
-
} else if (
|
|
21920
|
+
} else if (isHunkHeader(line)) {
|
|
21416
21921
|
index.hunks.push(parseHunk());
|
|
21417
|
-
} else if (line) {
|
|
21418
|
-
throw new Error("Unknown line " + (i + 1) + " " + JSON.stringify(line));
|
|
21419
21922
|
} else {
|
|
21420
21923
|
i++;
|
|
21421
21924
|
}
|
|
21422
21925
|
}
|
|
21423
21926
|
}
|
|
21927
|
+
function parseGitDiffHeader(line) {
|
|
21928
|
+
const rest = line.substring("diff --git ".length);
|
|
21929
|
+
if (rest.startsWith('"')) {
|
|
21930
|
+
const oldPath = parseQuotedFileName(rest);
|
|
21931
|
+
if (oldPath === null) {
|
|
21932
|
+
return null;
|
|
21933
|
+
}
|
|
21934
|
+
const afterOld = rest.substring(oldPath.rawLength + 1);
|
|
21935
|
+
let newFileName;
|
|
21936
|
+
if (afterOld.startsWith('"')) {
|
|
21937
|
+
const newPath = parseQuotedFileName(afterOld);
|
|
21938
|
+
if (newPath === null) {
|
|
21939
|
+
return null;
|
|
21940
|
+
}
|
|
21941
|
+
newFileName = newPath.fileName;
|
|
21942
|
+
} else {
|
|
21943
|
+
newFileName = afterOld;
|
|
21944
|
+
}
|
|
21945
|
+
return {
|
|
21946
|
+
oldFileName: oldPath.fileName,
|
|
21947
|
+
newFileName
|
|
21948
|
+
};
|
|
21949
|
+
}
|
|
21950
|
+
const quoteIdx = rest.indexOf('"');
|
|
21951
|
+
if (quoteIdx > 0) {
|
|
21952
|
+
const oldFileName = rest.substring(0, quoteIdx - 1);
|
|
21953
|
+
const newPath = parseQuotedFileName(rest.substring(quoteIdx));
|
|
21954
|
+
if (newPath === null) {
|
|
21955
|
+
return null;
|
|
21956
|
+
}
|
|
21957
|
+
return {
|
|
21958
|
+
oldFileName,
|
|
21959
|
+
newFileName: newPath.fileName
|
|
21960
|
+
};
|
|
21961
|
+
}
|
|
21962
|
+
if (rest.startsWith("a/")) {
|
|
21963
|
+
const splits = [];
|
|
21964
|
+
let idx = 0;
|
|
21965
|
+
while (true) {
|
|
21966
|
+
idx = rest.indexOf(" b/", idx + 1);
|
|
21967
|
+
if (idx === -1) {
|
|
21968
|
+
break;
|
|
21969
|
+
}
|
|
21970
|
+
splits.push(idx);
|
|
21971
|
+
}
|
|
21972
|
+
if (splits.length > 0) {
|
|
21973
|
+
const mid = splits[Math.floor(splits.length / 2)];
|
|
21974
|
+
return {
|
|
21975
|
+
oldFileName: rest.substring(0, mid),
|
|
21976
|
+
newFileName: rest.substring(mid + 1)
|
|
21977
|
+
};
|
|
21978
|
+
}
|
|
21979
|
+
}
|
|
21980
|
+
return null;
|
|
21981
|
+
}
|
|
21982
|
+
function unquoteIfQuoted(s) {
|
|
21983
|
+
if (s.startsWith('"')) {
|
|
21984
|
+
const parsed = parseQuotedFileName(s);
|
|
21985
|
+
if (parsed) {
|
|
21986
|
+
return parsed.fileName;
|
|
21987
|
+
}
|
|
21988
|
+
}
|
|
21989
|
+
return s;
|
|
21990
|
+
}
|
|
21991
|
+
function parseQuotedFileName(s) {
|
|
21992
|
+
if (!s.startsWith('"')) {
|
|
21993
|
+
return null;
|
|
21994
|
+
}
|
|
21995
|
+
let result = "";
|
|
21996
|
+
let j = 1;
|
|
21997
|
+
while (j < s.length) {
|
|
21998
|
+
if (s[j] === '"') {
|
|
21999
|
+
return { fileName: result, rawLength: j + 1 };
|
|
22000
|
+
}
|
|
22001
|
+
if (s[j] === "\\" && j + 1 < s.length) {
|
|
22002
|
+
j++;
|
|
22003
|
+
switch (s[j]) {
|
|
22004
|
+
case "a":
|
|
22005
|
+
result += "\x07";
|
|
22006
|
+
break;
|
|
22007
|
+
case "b":
|
|
22008
|
+
result += "\b";
|
|
22009
|
+
break;
|
|
22010
|
+
case "f":
|
|
22011
|
+
result += "\f";
|
|
22012
|
+
break;
|
|
22013
|
+
case "n":
|
|
22014
|
+
result += "\n";
|
|
22015
|
+
break;
|
|
22016
|
+
case "r":
|
|
22017
|
+
result += "\r";
|
|
22018
|
+
break;
|
|
22019
|
+
case "t":
|
|
22020
|
+
result += " ";
|
|
22021
|
+
break;
|
|
22022
|
+
case "v":
|
|
22023
|
+
result += "\v";
|
|
22024
|
+
break;
|
|
22025
|
+
case "\\":
|
|
22026
|
+
result += "\\";
|
|
22027
|
+
break;
|
|
22028
|
+
case '"':
|
|
22029
|
+
result += '"';
|
|
22030
|
+
break;
|
|
22031
|
+
case "0":
|
|
22032
|
+
case "1":
|
|
22033
|
+
case "2":
|
|
22034
|
+
case "3":
|
|
22035
|
+
case "4":
|
|
22036
|
+
case "5":
|
|
22037
|
+
case "6":
|
|
22038
|
+
case "7": {
|
|
22039
|
+
if (j + 2 >= s.length || s[j + 1] < "0" || s[j + 1] > "7" || s[j + 2] < "0" || s[j + 2] > "7") {
|
|
22040
|
+
return null;
|
|
22041
|
+
}
|
|
22042
|
+
const bytes = [parseInt(s.substring(j, j + 3), 8)];
|
|
22043
|
+
j += 3;
|
|
22044
|
+
while (s[j] === "\\" && s[j + 1] >= "0" && s[j + 1] <= "7") {
|
|
22045
|
+
if (j + 3 >= s.length || s[j + 2] < "0" || s[j + 2] > "7" || s[j + 3] < "0" || s[j + 3] > "7") {
|
|
22046
|
+
return null;
|
|
22047
|
+
}
|
|
22048
|
+
bytes.push(parseInt(s.substring(j + 1, j + 4), 8));
|
|
22049
|
+
j += 4;
|
|
22050
|
+
}
|
|
22051
|
+
result += new TextDecoder("utf-8").decode(new Uint8Array(bytes));
|
|
22052
|
+
continue;
|
|
22053
|
+
}
|
|
22054
|
+
// Note that in C, there are also three kinds of hex escape sequences:
|
|
22055
|
+
// - \xhh
|
|
22056
|
+
// - \uhhhh
|
|
22057
|
+
// - \Uhhhhhhhh
|
|
22058
|
+
// We do not bother to parse them here because, so far as we know,
|
|
22059
|
+
// they are never emitted by any tools that generate unified diff
|
|
22060
|
+
// format diffs, and so for now jsdiff does not consider them legal.
|
|
22061
|
+
default:
|
|
22062
|
+
return null;
|
|
22063
|
+
}
|
|
22064
|
+
} else {
|
|
22065
|
+
result += s[j];
|
|
22066
|
+
}
|
|
22067
|
+
j++;
|
|
22068
|
+
}
|
|
22069
|
+
return null;
|
|
22070
|
+
}
|
|
21424
22071
|
function parseFileHeader(index) {
|
|
21425
22072
|
const fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]);
|
|
21426
22073
|
if (fileHeaderMatch) {
|
|
21427
22074
|
const prefix = fileHeaderMatch[1], data = diffstr[i].substring(3).trim().split(" ", 2), header = (data[1] || "").trim();
|
|
21428
|
-
let fileName = data[0]
|
|
21429
|
-
if (fileName.startsWith('"')
|
|
21430
|
-
fileName =
|
|
22075
|
+
let fileName = data[0];
|
|
22076
|
+
if (fileName.startsWith('"')) {
|
|
22077
|
+
fileName = unquoteIfQuoted(fileName);
|
|
22078
|
+
} else {
|
|
22079
|
+
fileName = fileName.replace(/\\\\/g, "\\");
|
|
21431
22080
|
}
|
|
21432
22081
|
if (prefix === "---") {
|
|
21433
22082
|
index.oldFileName = fileName;
|
|
@@ -21484,6 +22133,9 @@ function parsePatch(uniDiff) {
|
|
|
21484
22133
|
if (removeCount !== hunk.oldLines) {
|
|
21485
22134
|
throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
|
|
21486
22135
|
}
|
|
22136
|
+
if (i < diffstr.length && diffstr[i] && /^[+ -]/.test(diffstr[i]) && !isFileHeader(diffstr[i])) {
|
|
22137
|
+
throw new Error("Hunk at line " + (chunkHeaderIndex + 1) + " has more lines than expected (expected " + hunk.oldLines + " old lines and " + hunk.newLines + " new lines)");
|
|
22138
|
+
}
|
|
21487
22139
|
return hunk;
|
|
21488
22140
|
}
|
|
21489
22141
|
while (i < diffstr.length) {
|
|
@@ -21671,11 +22323,23 @@ function applyStructuredPatch(source, patch, options = {}) {
|
|
|
21671
22323
|
}
|
|
21672
22324
|
|
|
21673
22325
|
// node_modules/diff/libesm/patch/reverse.js
|
|
22326
|
+
function swapPrefix(fileName) {
|
|
22327
|
+
if (fileName === void 0 || fileName === "/dev/null") {
|
|
22328
|
+
return fileName;
|
|
22329
|
+
}
|
|
22330
|
+
if (fileName.startsWith("a/")) {
|
|
22331
|
+
return "b/" + fileName.slice(2);
|
|
22332
|
+
}
|
|
22333
|
+
if (fileName.startsWith("b/")) {
|
|
22334
|
+
return "a/" + fileName.slice(2);
|
|
22335
|
+
}
|
|
22336
|
+
return fileName;
|
|
22337
|
+
}
|
|
21674
22338
|
function reversePatch(structuredPatch) {
|
|
21675
22339
|
if (Array.isArray(structuredPatch)) {
|
|
21676
22340
|
return structuredPatch.map((patch) => reversePatch(patch)).reverse();
|
|
21677
22341
|
}
|
|
21678
|
-
|
|
22342
|
+
const reversed = Object.assign(Object.assign({}, structuredPatch), { oldFileName: structuredPatch.isGit ? swapPrefix(structuredPatch.newFileName) : structuredPatch.newFileName, oldHeader: structuredPatch.newHeader, newFileName: structuredPatch.isGit ? swapPrefix(structuredPatch.oldFileName) : structuredPatch.oldFileName, newHeader: structuredPatch.oldHeader, oldMode: structuredPatch.newMode, newMode: structuredPatch.oldMode, isCreate: structuredPatch.isDelete, isDelete: structuredPatch.isCreate, hunks: structuredPatch.hunks.map((hunk) => {
|
|
21679
22343
|
return {
|
|
21680
22344
|
oldLines: hunk.newLines,
|
|
21681
22345
|
oldStart: hunk.newStart,
|
|
@@ -21692,6 +22356,16 @@ function reversePatch(structuredPatch) {
|
|
|
21692
22356
|
})
|
|
21693
22357
|
};
|
|
21694
22358
|
}) });
|
|
22359
|
+
if (structuredPatch.isCopy) {
|
|
22360
|
+
reversed.newFileName = "/dev/null";
|
|
22361
|
+
reversed.newHeader = void 0;
|
|
22362
|
+
reversed.isDelete = true;
|
|
22363
|
+
delete reversed.isCreate;
|
|
22364
|
+
delete reversed.isCopy;
|
|
22365
|
+
delete reversed.isRename;
|
|
22366
|
+
reversed.hunks = [];
|
|
22367
|
+
}
|
|
22368
|
+
return reversed;
|
|
21695
22369
|
}
|
|
21696
22370
|
|
|
21697
22371
|
// src/CodexToolCallMapper.ts
|
|
@@ -21861,18 +22535,18 @@ function createImageGenerationCompleteUpdate(item) {
|
|
|
21861
22535
|
return {
|
|
21862
22536
|
sessionUpdate: "tool_call_update",
|
|
21863
22537
|
toolCallId: item.id,
|
|
21864
|
-
status:
|
|
22538
|
+
status: imageGenerationTerminalStatus(item.status),
|
|
21865
22539
|
content: imageGenerationContent(item),
|
|
21866
22540
|
rawOutput: imageGenerationRawOutput(item)
|
|
21867
22541
|
};
|
|
21868
22542
|
}
|
|
21869
|
-
function createImageGenerationUpdate(item) {
|
|
22543
|
+
function createImageGenerationUpdate(item, options) {
|
|
21870
22544
|
return {
|
|
21871
22545
|
sessionUpdate: "tool_call",
|
|
21872
22546
|
toolCallId: item.id,
|
|
21873
22547
|
kind: "other",
|
|
21874
22548
|
title: "Image generation",
|
|
21875
|
-
status: imageGenerationToolStatus(item.status),
|
|
22549
|
+
status: options?.terminalStatus ? imageGenerationTerminalStatus(item.status) : imageGenerationToolStatus(item.status),
|
|
21876
22550
|
content: imageGenerationContent(item),
|
|
21877
22551
|
rawOutput: imageGenerationRawOutput(item)
|
|
21878
22552
|
};
|
|
@@ -22214,6 +22888,19 @@ function imageGenerationToolStatus(status) {
|
|
|
22214
22888
|
return "completed";
|
|
22215
22889
|
}
|
|
22216
22890
|
}
|
|
22891
|
+
function imageGenerationTerminalStatus(status) {
|
|
22892
|
+
switch (status) {
|
|
22893
|
+
case "failed":
|
|
22894
|
+
return "failed";
|
|
22895
|
+
case "completed":
|
|
22896
|
+
case "generating":
|
|
22897
|
+
case "in_progress":
|
|
22898
|
+
case "inProgress":
|
|
22899
|
+
case "incomplete":
|
|
22900
|
+
default:
|
|
22901
|
+
return "completed";
|
|
22902
|
+
}
|
|
22903
|
+
}
|
|
22217
22904
|
function imageGenerationContent(item) {
|
|
22218
22905
|
const content = [];
|
|
22219
22906
|
if (item.revisedPrompt && item.revisedPrompt.trim() !== "") {
|
|
@@ -22344,6 +23031,53 @@ function recoverCorruptedDiff(diff) {
|
|
|
22344
23031
|
return diff.replace(/\n\nMoved to: .*$/, "");
|
|
22345
23032
|
}
|
|
22346
23033
|
|
|
23034
|
+
// src/ContentChunks.ts
|
|
23035
|
+
function createUserMessageChunk(content, messageId) {
|
|
23036
|
+
if (messageId) {
|
|
23037
|
+
return {
|
|
23038
|
+
sessionUpdate: "user_message_chunk",
|
|
23039
|
+
messageId,
|
|
23040
|
+
content
|
|
23041
|
+
};
|
|
23042
|
+
}
|
|
23043
|
+
return {
|
|
23044
|
+
sessionUpdate: "user_message_chunk",
|
|
23045
|
+
content
|
|
23046
|
+
};
|
|
23047
|
+
}
|
|
23048
|
+
function createAgentMessageChunk(content, messageId) {
|
|
23049
|
+
if (messageId) {
|
|
23050
|
+
return {
|
|
23051
|
+
sessionUpdate: "agent_message_chunk",
|
|
23052
|
+
messageId,
|
|
23053
|
+
content
|
|
23054
|
+
};
|
|
23055
|
+
}
|
|
23056
|
+
return {
|
|
23057
|
+
sessionUpdate: "agent_message_chunk",
|
|
23058
|
+
content
|
|
23059
|
+
};
|
|
23060
|
+
}
|
|
23061
|
+
function createAgentThoughtChunk(content, messageId) {
|
|
23062
|
+
if (messageId) {
|
|
23063
|
+
return {
|
|
23064
|
+
sessionUpdate: "agent_thought_chunk",
|
|
23065
|
+
messageId,
|
|
23066
|
+
content
|
|
23067
|
+
};
|
|
23068
|
+
}
|
|
23069
|
+
return {
|
|
23070
|
+
sessionUpdate: "agent_thought_chunk",
|
|
23071
|
+
content
|
|
23072
|
+
};
|
|
23073
|
+
}
|
|
23074
|
+
function createAgentTextMessageChunk(text, messageId) {
|
|
23075
|
+
return createAgentMessageChunk({ type: "text", text }, messageId);
|
|
23076
|
+
}
|
|
23077
|
+
function createAgentTextThoughtChunk(text, messageId) {
|
|
23078
|
+
return createAgentThoughtChunk({ type: "text", text }, messageId);
|
|
23079
|
+
}
|
|
23080
|
+
|
|
22347
23081
|
// src/CodexEventHandler.ts
|
|
22348
23082
|
var CodexEventHandler = class {
|
|
22349
23083
|
connection;
|
|
@@ -22499,49 +23233,25 @@ var CodexEventHandler = class {
|
|
|
22499
23233
|
};
|
|
22500
23234
|
}
|
|
22501
23235
|
async createTextEvent(event) {
|
|
22502
|
-
return
|
|
22503
|
-
sessionUpdate: "agent_message_chunk",
|
|
22504
|
-
content: {
|
|
22505
|
-
type: "text",
|
|
22506
|
-
text: event.delta
|
|
22507
|
-
}
|
|
22508
|
-
};
|
|
23236
|
+
return createAgentTextMessageChunk(event.delta, event.itemId);
|
|
22509
23237
|
}
|
|
22510
23238
|
async createConfigWarningEvent(event) {
|
|
22511
23239
|
const detailsText = event.details ? `
|
|
22512
23240
|
|
|
22513
23241
|
${event.details}` : "";
|
|
22514
|
-
return {
|
|
22515
|
-
sessionUpdate: "agent_message_chunk",
|
|
22516
|
-
content: {
|
|
22517
|
-
type: "text",
|
|
22518
|
-
text: `Config warning: ${event.summary}${detailsText}
|
|
23242
|
+
return createAgentTextMessageChunk(`Config warning: ${event.summary}${detailsText}
|
|
22519
23243
|
|
|
22520
|
-
`
|
|
22521
|
-
}
|
|
22522
|
-
};
|
|
23244
|
+
`);
|
|
22523
23245
|
}
|
|
22524
23246
|
createWarningEvent(event) {
|
|
22525
|
-
return {
|
|
22526
|
-
sessionUpdate: "agent_message_chunk",
|
|
22527
|
-
content: {
|
|
22528
|
-
type: "text",
|
|
22529
|
-
text: `Warning: ${event.message}
|
|
23247
|
+
return createAgentTextMessageChunk(`Warning: ${event.message}
|
|
22530
23248
|
|
|
22531
|
-
`
|
|
22532
|
-
}
|
|
22533
|
-
};
|
|
23249
|
+
`);
|
|
22534
23250
|
}
|
|
22535
23251
|
createModelReroutedEvent(event) {
|
|
22536
|
-
return {
|
|
22537
|
-
sessionUpdate: "agent_thought_chunk",
|
|
22538
|
-
content: {
|
|
22539
|
-
type: "text",
|
|
22540
|
-
text: `Model rerouted from ${event.fromModel} to ${event.toModel} (${event.reason}).
|
|
23252
|
+
return createAgentTextThoughtChunk(`Model rerouted from ${event.fromModel} to ${event.toModel} (${event.reason}).
|
|
22541
23253
|
|
|
22542
|
-
`
|
|
22543
|
-
}
|
|
22544
|
-
};
|
|
23254
|
+
`);
|
|
22545
23255
|
}
|
|
22546
23256
|
createThreadGoalUpdatedEvent(event) {
|
|
22547
23257
|
const goalSnapshot = this.createThreadGoalSnapshot(event);
|
|
@@ -22549,50 +23259,18 @@ ${event.details}` : "";
|
|
|
22549
23259
|
return null;
|
|
22550
23260
|
}
|
|
22551
23261
|
this.sessionState.currentGoal = goalSnapshot;
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
${objective}` : `Goal updated (${status}): ${objective}`;
|
|
22556
|
-
return {
|
|
22557
|
-
sessionUpdate: "agent_message_chunk",
|
|
22558
|
-
content: {
|
|
22559
|
-
type: "text",
|
|
22560
|
-
text: `
|
|
22561
|
-
|
|
22562
|
-
${text}
|
|
22563
|
-
|
|
22564
|
-
`
|
|
22565
|
-
}
|
|
22566
|
-
};
|
|
22567
|
-
}
|
|
22568
|
-
formatThreadGoalStatus(status) {
|
|
22569
|
-
switch (status) {
|
|
22570
|
-
case "active":
|
|
22571
|
-
return "active";
|
|
22572
|
-
case "paused":
|
|
22573
|
-
return "paused";
|
|
22574
|
-
case "budgetLimited":
|
|
22575
|
-
return "budget limited";
|
|
22576
|
-
case "blocked":
|
|
22577
|
-
return "blocked";
|
|
22578
|
-
case "usageLimited":
|
|
22579
|
-
return "usage limited";
|
|
22580
|
-
case "complete":
|
|
22581
|
-
return "complete";
|
|
22582
|
-
}
|
|
23262
|
+
return this.createCodexSessionInfoUpdate({
|
|
23263
|
+
goal: goalSnapshot
|
|
23264
|
+
});
|
|
22583
23265
|
}
|
|
22584
23266
|
createThreadGoalClearedEvent(_event) {
|
|
22585
23267
|
if (this.sessionState.currentGoal === null) {
|
|
22586
23268
|
return null;
|
|
22587
23269
|
}
|
|
22588
23270
|
this.sessionState.currentGoal = null;
|
|
22589
|
-
return {
|
|
22590
|
-
|
|
22591
|
-
|
|
22592
|
-
type: "text",
|
|
22593
|
-
text: "\n\nGoal cleared.\n\n"
|
|
22594
|
-
}
|
|
22595
|
-
};
|
|
23271
|
+
return this.createCodexSessionInfoUpdate({
|
|
23272
|
+
goal: null
|
|
23273
|
+
});
|
|
22596
23274
|
}
|
|
22597
23275
|
createThreadGoalSnapshot(event) {
|
|
22598
23276
|
return {
|
|
@@ -22606,20 +23284,14 @@ ${text}
|
|
|
22606
23284
|
}
|
|
22607
23285
|
createReasoningDeltaEvent(event) {
|
|
22608
23286
|
this.seenReasoningDeltaItemIds.add(event.itemId);
|
|
22609
|
-
return this.createAgentThoughtEvent(event.delta);
|
|
23287
|
+
return this.createAgentThoughtEvent(event.delta, event.itemId);
|
|
22610
23288
|
}
|
|
22611
23289
|
createReasoningSectionBreakEvent(event) {
|
|
22612
23290
|
this.seenReasoningDeltaItemIds.add(event.itemId);
|
|
22613
|
-
return this.createAgentThoughtEvent("\n\n");
|
|
23291
|
+
return this.createAgentThoughtEvent("\n\n", event.itemId);
|
|
22614
23292
|
}
|
|
22615
|
-
createAgentThoughtEvent(text) {
|
|
22616
|
-
return
|
|
22617
|
-
sessionUpdate: "agent_thought_chunk",
|
|
22618
|
-
content: {
|
|
22619
|
-
type: "text",
|
|
22620
|
-
text
|
|
22621
|
-
}
|
|
22622
|
-
};
|
|
23293
|
+
createAgentThoughtEvent(text, messageId) {
|
|
23294
|
+
return createAgentTextThoughtChunk(text, messageId);
|
|
22623
23295
|
}
|
|
22624
23296
|
async createItemEvent(event) {
|
|
22625
23297
|
switch (event.item.type) {
|
|
@@ -22689,7 +23361,7 @@ ${text}
|
|
|
22689
23361
|
if (this.activeImageGenerationItems.delete(event.item.id)) {
|
|
22690
23362
|
return createImageGenerationCompleteUpdate(event.item);
|
|
22691
23363
|
}
|
|
22692
|
-
return createImageGenerationUpdate(event.item);
|
|
23364
|
+
return createImageGenerationUpdate(event.item, { terminalStatus: true });
|
|
22693
23365
|
case "reasoning":
|
|
22694
23366
|
if (this.seenReasoningDeltaItemIds.delete(event.item.id)) {
|
|
22695
23367
|
return null;
|
|
@@ -22720,29 +23392,17 @@ ${text}
|
|
|
22720
23392
|
if (text.length === 0) {
|
|
22721
23393
|
return null;
|
|
22722
23394
|
}
|
|
22723
|
-
return this.createAgentThoughtEvent(text);
|
|
23395
|
+
return this.createAgentThoughtEvent(text, item.id);
|
|
22724
23396
|
}
|
|
22725
23397
|
createExitedReviewModeEvent(item) {
|
|
22726
23398
|
const text = item.review.trim();
|
|
22727
23399
|
if (text.length === 0) {
|
|
22728
23400
|
return null;
|
|
22729
23401
|
}
|
|
22730
|
-
return
|
|
22731
|
-
sessionUpdate: "agent_message_chunk",
|
|
22732
|
-
content: {
|
|
22733
|
-
type: "text",
|
|
22734
|
-
text
|
|
22735
|
-
}
|
|
22736
|
-
};
|
|
23402
|
+
return createAgentTextMessageChunk(text);
|
|
22737
23403
|
}
|
|
22738
23404
|
createContextCompactedEvent() {
|
|
22739
|
-
return
|
|
22740
|
-
sessionUpdate: "agent_message_chunk",
|
|
22741
|
-
content: {
|
|
22742
|
-
type: "text",
|
|
22743
|
-
text: "*Context compacted to fit the model's context window.*\n\n"
|
|
22744
|
-
}
|
|
22745
|
-
};
|
|
23405
|
+
return createAgentTextMessageChunk("*Context compacted to fit the model's context window.*\n\n");
|
|
22746
23406
|
}
|
|
22747
23407
|
createCommandOutputDeltaEvent(event) {
|
|
22748
23408
|
if (this.terminalCommandIds.has(event.itemId) && event.delta.length > 0) {
|
|
@@ -22869,15 +23529,9 @@ ${event.stdin}
|
|
|
22869
23529
|
} else if (this.isAuthenticationRequiredError(error51)) {
|
|
22870
23530
|
this.failure = this.sessionState.authConfigured ? RequestError.internalError(this.createTurnErrorData(params.error)) : RequestError.authRequired(this.createTurnErrorData(params.error), params.error.message);
|
|
22871
23531
|
}
|
|
22872
|
-
return {
|
|
22873
|
-
sessionUpdate: "agent_message_chunk",
|
|
22874
|
-
content: {
|
|
22875
|
-
type: "text",
|
|
22876
|
-
text: `${params.error.message}
|
|
23532
|
+
return createAgentTextMessageChunk(`${params.error.message}
|
|
22877
23533
|
|
|
22878
|
-
`
|
|
22879
|
-
}
|
|
22880
|
-
};
|
|
23534
|
+
`);
|
|
22881
23535
|
}
|
|
22882
23536
|
isAuthenticationRequiredError(error51) {
|
|
22883
23537
|
return error51 === "unauthorized" || this.getHttpStatusCode(error51) === 401;
|
|
@@ -23615,10 +24269,15 @@ var isWsl = () => {
|
|
|
23615
24269
|
return true;
|
|
23616
24270
|
}
|
|
23617
24271
|
try {
|
|
23618
|
-
|
|
24272
|
+
if (fs4.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
24273
|
+
return !isInsideContainer();
|
|
24274
|
+
}
|
|
23619
24275
|
} catch {
|
|
23620
|
-
return false;
|
|
23621
24276
|
}
|
|
24277
|
+
if (fs4.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs4.existsSync("/run/WSL")) {
|
|
24278
|
+
return !isInsideContainer();
|
|
24279
|
+
}
|
|
24280
|
+
return false;
|
|
23622
24281
|
};
|
|
23623
24282
|
var is_wsl_default = process3.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
23624
24283
|
|
|
@@ -23657,6 +24316,20 @@ executePowerShell.argumentsPrefix = [
|
|
|
23657
24316
|
executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
|
|
23658
24317
|
executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
|
|
23659
24318
|
|
|
24319
|
+
// node_modules/wsl-utils/utilities.js
|
|
24320
|
+
function parseMountPointFromConfig(content) {
|
|
24321
|
+
for (const line of content.split("\n")) {
|
|
24322
|
+
if (/^\s*#/.test(line)) {
|
|
24323
|
+
continue;
|
|
24324
|
+
}
|
|
24325
|
+
const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
|
|
24326
|
+
if (!match) {
|
|
24327
|
+
continue;
|
|
24328
|
+
}
|
|
24329
|
+
return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
|
|
24330
|
+
}
|
|
24331
|
+
}
|
|
24332
|
+
|
|
23660
24333
|
// node_modules/wsl-utils/index.js
|
|
23661
24334
|
var execFile2 = promisify2(childProcess2.execFile);
|
|
23662
24335
|
var wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
@@ -23677,11 +24350,11 @@ var wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
|
23677
24350
|
return defaultMountPoint;
|
|
23678
24351
|
}
|
|
23679
24352
|
const configContent = await fs5.readFile(configFilePath, { encoding: "utf8" });
|
|
23680
|
-
const
|
|
23681
|
-
if (
|
|
24353
|
+
const parsedMountPoint = parseMountPointFromConfig(configContent);
|
|
24354
|
+
if (parsedMountPoint === void 0) {
|
|
23682
24355
|
return defaultMountPoint;
|
|
23683
24356
|
}
|
|
23684
|
-
mountPoint =
|
|
24357
|
+
mountPoint = parsedMountPoint;
|
|
23685
24358
|
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
23686
24359
|
return mountPoint;
|
|
23687
24360
|
};
|
|
@@ -23825,11 +24498,11 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
|
23825
24498
|
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
23826
24499
|
}
|
|
23827
24500
|
const { id } = match.groups;
|
|
23828
|
-
const
|
|
23829
|
-
|
|
23830
|
-
|
|
23831
|
-
|
|
23832
|
-
return
|
|
24501
|
+
const dotIndex = id.lastIndexOf(".");
|
|
24502
|
+
const hyphenIndex = id.lastIndexOf("-");
|
|
24503
|
+
const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
|
|
24504
|
+
const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
|
|
24505
|
+
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
23833
24506
|
}
|
|
23834
24507
|
|
|
23835
24508
|
// node_modules/default-browser/index.js
|
|
@@ -24282,7 +24955,7 @@ var package_default = {
|
|
|
24282
24955
|
publishConfig: {
|
|
24283
24956
|
access: "public"
|
|
24284
24957
|
},
|
|
24285
|
-
version: "1.0
|
|
24958
|
+
version: "1.1.0",
|
|
24286
24959
|
description: "",
|
|
24287
24960
|
main: "dist/index.js",
|
|
24288
24961
|
bin: {
|
|
@@ -24332,19 +25005,19 @@ var package_default = {
|
|
|
24332
25005
|
license: "Apache-2.0",
|
|
24333
25006
|
type: "module",
|
|
24334
25007
|
devDependencies: {
|
|
24335
|
-
"@types/node": "^
|
|
25008
|
+
"@types/node": "^26.0.1",
|
|
24336
25009
|
esbuild: "^0.28.1",
|
|
24337
25010
|
"mcp-hello-world": "^1.1.2",
|
|
24338
25011
|
tsx: "^4.20.6",
|
|
24339
|
-
typescript: "^
|
|
24340
|
-
vitest: "^4.
|
|
25012
|
+
typescript: "^6.0.3",
|
|
25013
|
+
vitest: "^4.1.9"
|
|
24341
25014
|
},
|
|
24342
25015
|
dependencies: {
|
|
24343
|
-
"@agentclientprotocol/sdk": "^1.
|
|
24344
|
-
"@openai/codex": "^0.142.
|
|
24345
|
-
diff: "^
|
|
25016
|
+
"@agentclientprotocol/sdk": "^1.1.0",
|
|
25017
|
+
"@openai/codex": "^0.142.5",
|
|
25018
|
+
diff: "^9.0.0",
|
|
24346
25019
|
open: "^11.0.0",
|
|
24347
|
-
"vscode-jsonrpc": "^
|
|
25020
|
+
"vscode-jsonrpc": "^9.0.1",
|
|
24348
25021
|
zod: "^4.0.0"
|
|
24349
25022
|
}
|
|
24350
25023
|
};
|
|
@@ -25284,20 +25957,14 @@ var CodexCommands = class {
|
|
|
25284
25957
|
case "status": {
|
|
25285
25958
|
const session = new ACPSessionConnection(this.connection, sessionId);
|
|
25286
25959
|
const message = this.buildStatusMessage(sessionState);
|
|
25287
|
-
await session.update(
|
|
25288
|
-
sessionUpdate: "agent_message_chunk",
|
|
25289
|
-
content: { type: "text", text: message }
|
|
25290
|
-
});
|
|
25960
|
+
await session.update(createAgentTextMessageChunk(message));
|
|
25291
25961
|
return { handled: true };
|
|
25292
25962
|
}
|
|
25293
25963
|
case "logout": {
|
|
25294
25964
|
await this.runWithProcessCheck(() => this.codexAcpClient.logout());
|
|
25295
25965
|
await this.onLogout();
|
|
25296
25966
|
const session = new ACPSessionConnection(this.connection, sessionId);
|
|
25297
|
-
await session.update(
|
|
25298
|
-
sessionUpdate: "agent_message_chunk",
|
|
25299
|
-
content: { type: "text", text: "Logged out from Codex account." }
|
|
25300
|
-
});
|
|
25967
|
+
await session.update(createAgentTextMessageChunk("Logged out from Codex account."));
|
|
25301
25968
|
return { handled: true };
|
|
25302
25969
|
}
|
|
25303
25970
|
case "skills": {
|
|
@@ -25309,10 +25976,7 @@ var CodexCommands = class {
|
|
|
25309
25976
|
});
|
|
25310
25977
|
const text = lines.length > 0 ? ["Available skills:", ...lines].join("\n") : "No skills configured.";
|
|
25311
25978
|
const session = new ACPSessionConnection(this.connection, sessionId);
|
|
25312
|
-
await session.update(
|
|
25313
|
-
sessionUpdate: "agent_message_chunk",
|
|
25314
|
-
content: { type: "text", text }
|
|
25315
|
-
});
|
|
25979
|
+
await session.update(createAgentTextMessageChunk(text));
|
|
25316
25980
|
return { handled: true };
|
|
25317
25981
|
}
|
|
25318
25982
|
case "mcp": {
|
|
@@ -25326,10 +25990,7 @@ var CodexCommands = class {
|
|
|
25326
25990
|
const lines = [...configuredServers, ...sessionServers];
|
|
25327
25991
|
const text = lines.length > 0 ? ["Configured MCP servers:", ...lines].join("\n") : "No MCP servers configured.";
|
|
25328
25992
|
const session = new ACPSessionConnection(this.connection, sessionId);
|
|
25329
|
-
await session.update(
|
|
25330
|
-
sessionUpdate: "agent_message_chunk",
|
|
25331
|
-
content: { type: "text", text }
|
|
25332
|
-
});
|
|
25993
|
+
await session.update(createAgentTextMessageChunk(text));
|
|
25333
25994
|
return { handled: true };
|
|
25334
25995
|
}
|
|
25335
25996
|
default:
|
|
@@ -25372,13 +26033,7 @@ var CodexCommands = class {
|
|
|
25372
26033
|
}
|
|
25373
26034
|
if (argument.length > 4e3) {
|
|
25374
26035
|
const session = new ACPSessionConnection(this.connection, sessionId);
|
|
25375
|
-
await session.update(
|
|
25376
|
-
sessionUpdate: "agent_message_chunk",
|
|
25377
|
-
content: {
|
|
25378
|
-
type: "text",
|
|
25379
|
-
text: 'Command "/goal" requires goal text of at most 4000 characters.'
|
|
25380
|
-
}
|
|
25381
|
-
});
|
|
26036
|
+
await session.update(createAgentTextMessageChunk('Command "/goal" requires goal text of at most 4000 characters.'));
|
|
25382
26037
|
return { handled: true };
|
|
25383
26038
|
}
|
|
25384
26039
|
options.onTurnStartPending?.();
|
|
@@ -25417,13 +26072,7 @@ var CodexCommands = class {
|
|
|
25417
26072
|
}
|
|
25418
26073
|
async sendCommandUsageMessage(name, inputHint, sessionId) {
|
|
25419
26074
|
const session = new ACPSessionConnection(this.connection, sessionId);
|
|
25420
|
-
await session.update({
|
|
25421
|
-
sessionUpdate: "agent_message_chunk",
|
|
25422
|
-
content: {
|
|
25423
|
-
type: "text",
|
|
25424
|
-
text: `Command "/${name}" requires ${inputHint}.`
|
|
25425
|
-
}
|
|
25426
|
-
});
|
|
26075
|
+
await session.update(createAgentTextMessageChunk(`Command "/${name}" requires ${inputHint}.`));
|
|
25427
26076
|
}
|
|
25428
26077
|
async sendUnknownCommandMessage(name, sessionId) {
|
|
25429
26078
|
const lines = this.getBuiltinCommands().map((command) => `- /${command.name}: ${command.description}`);
|
|
@@ -25435,10 +26084,7 @@ var CodexCommands = class {
|
|
|
25435
26084
|
text.push(...lines);
|
|
25436
26085
|
}
|
|
25437
26086
|
const session = new ACPSessionConnection(this.connection, sessionId);
|
|
25438
|
-
await session.update(
|
|
25439
|
-
sessionUpdate: "agent_message_chunk",
|
|
25440
|
-
content: { type: "text", text: text.join("\n") }
|
|
25441
|
-
});
|
|
26087
|
+
await session.update(createAgentTextMessageChunk(text.join("\n")));
|
|
25442
26088
|
}
|
|
25443
26089
|
buildStatusMessage(sessionState) {
|
|
25444
26090
|
const agentMode = sessionState.agentMode;
|
|
@@ -25581,7 +26227,7 @@ function historyFallbackUpdateKey(update) {
|
|
|
25581
26227
|
case "user_message_chunk":
|
|
25582
26228
|
case "agent_message_chunk":
|
|
25583
26229
|
case "agent_thought_chunk":
|
|
25584
|
-
return `${update.sessionUpdate}:${JSON.stringify(update.content)}`;
|
|
26230
|
+
return `${update.sessionUpdate}:${update.messageId ?? ""}:${JSON.stringify(update.content)}`;
|
|
25585
26231
|
case "tool_call":
|
|
25586
26232
|
return `tool_call:${update.toolCallId}:start`;
|
|
25587
26233
|
case "tool_call_update":
|
|
@@ -26545,6 +27191,7 @@ function isExtMethodRequest(request) {
|
|
|
26545
27191
|
|
|
26546
27192
|
// src/FastModeConfig.ts
|
|
26547
27193
|
var FAST_MODE_CONFIG_ID = "fast-mode";
|
|
27194
|
+
var FAST_MODE_CATEGORY = "model_config";
|
|
26548
27195
|
var FAST_MODE_ON = "on";
|
|
26549
27196
|
var FAST_MODE_OFF = "off";
|
|
26550
27197
|
var FAST_MODE_DESCRIPTION = "1.5x speed, increased usage";
|
|
@@ -26554,12 +27201,25 @@ function modelSupportsFast(model) {
|
|
|
26554
27201
|
function resolveFastServiceTier(fastModeEnabled, currentModelSupportsFast) {
|
|
26555
27202
|
return fastModeEnabled && currentModelSupportsFast ? "fast" : null;
|
|
26556
27203
|
}
|
|
26557
|
-
function
|
|
27204
|
+
function clientSupportsBooleanConfigOptions(clientCapabilities) {
|
|
27205
|
+
return clientCapabilities?.session?.configOptions?.boolean != null;
|
|
27206
|
+
}
|
|
27207
|
+
function createFastModeConfigOption(fastModeEnabled, useBooleanConfigOption = false) {
|
|
27208
|
+
if (useBooleanConfigOption) {
|
|
27209
|
+
return {
|
|
27210
|
+
id: FAST_MODE_CONFIG_ID,
|
|
27211
|
+
name: "Fast mode",
|
|
27212
|
+
description: FAST_MODE_DESCRIPTION,
|
|
27213
|
+
category: FAST_MODE_CATEGORY,
|
|
27214
|
+
type: "boolean",
|
|
27215
|
+
currentValue: fastModeEnabled
|
|
27216
|
+
};
|
|
27217
|
+
}
|
|
26558
27218
|
return {
|
|
26559
27219
|
id: FAST_MODE_CONFIG_ID,
|
|
26560
27220
|
name: "Fast mode",
|
|
26561
27221
|
description: FAST_MODE_DESCRIPTION,
|
|
26562
|
-
category:
|
|
27222
|
+
category: FAST_MODE_CATEGORY,
|
|
26563
27223
|
type: "select",
|
|
26564
27224
|
currentValue: fastModeEnabled ? FAST_MODE_ON : FAST_MODE_OFF,
|
|
26565
27225
|
options: [
|
|
@@ -26603,6 +27263,7 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
26603
27263
|
availableCommands;
|
|
26604
27264
|
clientInfo;
|
|
26605
27265
|
terminalOutputMode;
|
|
27266
|
+
booleanConfigOptionsSupported;
|
|
26606
27267
|
sessions;
|
|
26607
27268
|
pendingMcpStartupSessions;
|
|
26608
27269
|
pendingTurnStarts;
|
|
@@ -26625,6 +27286,7 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
26625
27286
|
this.getRecentStderr = getRecentStderr ?? (() => "");
|
|
26626
27287
|
this.clientInfo = null;
|
|
26627
27288
|
this.terminalOutputMode = "terminal_output_delta";
|
|
27289
|
+
this.booleanConfigOptionsSupported = false;
|
|
26628
27290
|
this.availableCommands = new CodexCommands(
|
|
26629
27291
|
connection,
|
|
26630
27292
|
codexAcpClient,
|
|
@@ -26636,6 +27298,7 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
26636
27298
|
logger.log("Initialize request received");
|
|
26637
27299
|
this.clientInfo = _params.clientInfo ?? null;
|
|
26638
27300
|
this.terminalOutputMode = resolveTerminalOutputMode(_params.clientCapabilities);
|
|
27301
|
+
this.booleanConfigOptionsSupported = clientSupportsBooleanConfigOptions(_params.clientCapabilities);
|
|
26639
27302
|
await this.runWithProcessCheck(() => this.codexAcpClient.initialize(_params));
|
|
26640
27303
|
return {
|
|
26641
27304
|
protocolVersion: PROTOCOL_VERSION,
|
|
@@ -27045,22 +27708,18 @@ You have been logged out. Please try again.`);
|
|
|
27045
27708
|
});
|
|
27046
27709
|
const sessionState = this.sessions.get(params.sessionId);
|
|
27047
27710
|
if (!sessionState) throw new Error(`Session ${params.sessionId} not found`);
|
|
27048
|
-
if (typeof params.value !== "string") {
|
|
27049
|
-
throw RequestError.invalidParams();
|
|
27050
|
-
}
|
|
27051
|
-
const value = params.value;
|
|
27052
27711
|
switch (params.configId) {
|
|
27053
27712
|
case FAST_MODE_CONFIG_ID:
|
|
27054
|
-
this.applyFastModeChange(sessionState,
|
|
27713
|
+
this.applyFastModeChange(sessionState, params);
|
|
27055
27714
|
break;
|
|
27056
27715
|
case MODE_CONFIG_ID:
|
|
27057
|
-
this.applyModeChange(sessionState,
|
|
27716
|
+
this.applyModeChange(sessionState, this.stringConfigValue(params));
|
|
27058
27717
|
break;
|
|
27059
27718
|
case MODEL_CONFIG_ID:
|
|
27060
|
-
this.applyModelChange(sessionState,
|
|
27719
|
+
this.applyModelChange(sessionState, this.stringConfigValue(params));
|
|
27061
27720
|
break;
|
|
27062
27721
|
case REASONING_EFFORT_CONFIG_ID:
|
|
27063
|
-
this.applyReasoningEffortChange(sessionState,
|
|
27722
|
+
this.applyReasoningEffortChange(sessionState, this.stringConfigValue(params));
|
|
27064
27723
|
break;
|
|
27065
27724
|
default:
|
|
27066
27725
|
throw RequestError.invalidParams();
|
|
@@ -27069,12 +27728,23 @@ You have been logged out. Please try again.`);
|
|
|
27069
27728
|
configOptions: this.createSessionConfigOptions(sessionState)
|
|
27070
27729
|
};
|
|
27071
27730
|
}
|
|
27072
|
-
applyFastModeChange(sessionState,
|
|
27731
|
+
applyFastModeChange(sessionState, params) {
|
|
27732
|
+
const value = params.value;
|
|
27733
|
+
if (typeof value === "boolean") {
|
|
27734
|
+
sessionState.fastModeEnabled = value;
|
|
27735
|
+
return;
|
|
27736
|
+
}
|
|
27073
27737
|
if (value !== FAST_MODE_ON && value !== FAST_MODE_OFF) {
|
|
27074
27738
|
throw RequestError.invalidParams();
|
|
27075
27739
|
}
|
|
27076
27740
|
sessionState.fastModeEnabled = value === FAST_MODE_ON;
|
|
27077
27741
|
}
|
|
27742
|
+
stringConfigValue(params) {
|
|
27743
|
+
if (typeof params.value !== "string") {
|
|
27744
|
+
throw RequestError.invalidParams();
|
|
27745
|
+
}
|
|
27746
|
+
return params.value;
|
|
27747
|
+
}
|
|
27078
27748
|
applyModeChange(sessionState, value) {
|
|
27079
27749
|
const newMode = AgentMode.find(value);
|
|
27080
27750
|
if (!newMode) {
|
|
@@ -27157,7 +27827,10 @@ You have been logged out. Please try again.`);
|
|
|
27157
27827
|
);
|
|
27158
27828
|
}
|
|
27159
27829
|
if (sessionState.currentModelSupportsFast) {
|
|
27160
|
-
configOptions.push(createFastModeConfigOption(
|
|
27830
|
+
configOptions.push(createFastModeConfigOption(
|
|
27831
|
+
sessionState.fastModeEnabled,
|
|
27832
|
+
this.booleanConfigOptionsSupported
|
|
27833
|
+
));
|
|
27161
27834
|
}
|
|
27162
27835
|
return configOptions;
|
|
27163
27836
|
}
|
|
@@ -27304,6 +27977,7 @@ You have been logged out. Please try again.`);
|
|
|
27304
27977
|
case "agentMessage":
|
|
27305
27978
|
return [{
|
|
27306
27979
|
sessionUpdate: "agent_message_chunk",
|
|
27980
|
+
messageId: item.id,
|
|
27307
27981
|
content: { type: "text", text: item.text }
|
|
27308
27982
|
}];
|
|
27309
27983
|
case "reasoning":
|
|
@@ -27342,23 +28016,19 @@ You have been logged out. Please try again.`);
|
|
|
27342
28016
|
}
|
|
27343
28017
|
createUserMessageUpdates(item) {
|
|
27344
28018
|
const updates = [];
|
|
28019
|
+
const messageId = item.id;
|
|
27345
28020
|
for (const input of item.content) {
|
|
27346
28021
|
const blocks = this.userInputToContentBlocks(input);
|
|
27347
28022
|
for (const block of blocks) {
|
|
27348
|
-
updates.push(
|
|
27349
|
-
sessionUpdate: "user_message_chunk",
|
|
27350
|
-
content: block
|
|
27351
|
-
});
|
|
28023
|
+
updates.push(createUserMessageChunk(block, messageId));
|
|
27352
28024
|
}
|
|
27353
28025
|
}
|
|
27354
28026
|
return updates;
|
|
27355
28027
|
}
|
|
27356
28028
|
createReasoningUpdates(item) {
|
|
27357
28029
|
const parts = item.summary.length > 0 ? item.summary : item.content;
|
|
27358
|
-
|
|
27359
|
-
|
|
27360
|
-
content: { type: "text", text }
|
|
27361
|
-
}));
|
|
28030
|
+
const messageId = item.id;
|
|
28031
|
+
return parts.map((text) => createAgentTextThoughtChunk(text, messageId));
|
|
27362
28032
|
}
|
|
27363
28033
|
createWebSearchUpdate(item) {
|
|
27364
28034
|
return {
|
|
@@ -27846,13 +28516,7 @@ ${item.text}`
|
|
|
27846
28516
|
}
|
|
27847
28517
|
await this.connection.notify(methods.client.session.update, {
|
|
27848
28518
|
sessionId,
|
|
27849
|
-
update:
|
|
27850
|
-
sessionUpdate: "agent_message_chunk",
|
|
27851
|
-
content: {
|
|
27852
|
-
type: "text",
|
|
27853
|
-
text: "*Conversation interrupted*"
|
|
27854
|
-
}
|
|
27855
|
-
}
|
|
28519
|
+
update: createAgentTextMessageChunk("*Conversation interrupted*")
|
|
27856
28520
|
});
|
|
27857
28521
|
}
|
|
27858
28522
|
buildQuotaMeta(sessionState) {
|
|
@@ -27913,22 +28577,24 @@ function mergeHistoryUpdates(responseItemFallbackUpdates, threadUpdates) {
|
|
|
27913
28577
|
}
|
|
27914
28578
|
merged.push(update);
|
|
27915
28579
|
};
|
|
27916
|
-
const
|
|
27917
|
-
const
|
|
28580
|
+
const flushFallbackBeforeMatchingDuplicate = (targetUpdate) => {
|
|
28581
|
+
const targetKey = historyUpdateKey(targetUpdate);
|
|
28582
|
+
const targetContentKey = historyUpdateContentKey(targetUpdate);
|
|
28583
|
+
if (!targetKey && !targetContentKey) {
|
|
28584
|
+
return;
|
|
28585
|
+
}
|
|
28586
|
+
const matchIndex = responseItemFallbackUpdates.findIndex((update, index) => index >= fallbackIndex && (targetKey !== null && historyUpdateKey(update) === targetKey || targetContentKey !== null && historyUpdateContentKey(update) === targetContentKey));
|
|
27918
28587
|
if (matchIndex === -1) {
|
|
27919
|
-
return
|
|
28588
|
+
return;
|
|
27920
28589
|
}
|
|
27921
|
-
while (fallbackIndex
|
|
28590
|
+
while (fallbackIndex < matchIndex) {
|
|
27922
28591
|
pushUpdate(responseItemFallbackUpdates[fallbackIndex]);
|
|
27923
28592
|
fallbackIndex += 1;
|
|
27924
28593
|
}
|
|
27925
|
-
|
|
28594
|
+
fallbackIndex += 1;
|
|
27926
28595
|
};
|
|
27927
28596
|
for (const update of threadUpdates) {
|
|
27928
|
-
|
|
27929
|
-
if (key && flushFallbackThrough(key)) {
|
|
27930
|
-
continue;
|
|
27931
|
-
}
|
|
28597
|
+
flushFallbackBeforeMatchingDuplicate(update);
|
|
27932
28598
|
pushUpdate(update);
|
|
27933
28599
|
}
|
|
27934
28600
|
while (fallbackIndex < responseItemFallbackUpdates.length) {
|
|
@@ -27942,7 +28608,7 @@ function historyUpdateKey(update) {
|
|
|
27942
28608
|
case "user_message_chunk":
|
|
27943
28609
|
case "agent_message_chunk":
|
|
27944
28610
|
case "agent_thought_chunk":
|
|
27945
|
-
return `${update.sessionUpdate}:${JSON.stringify(update.content)}`;
|
|
28611
|
+
return `${update.sessionUpdate}:${update.messageId ?? ""}:${JSON.stringify(update.content)}`;
|
|
27946
28612
|
case "tool_call":
|
|
27947
28613
|
return `tool_call:${update.toolCallId}:start`;
|
|
27948
28614
|
case "tool_call_update":
|
|
@@ -27951,12 +28617,22 @@ function historyUpdateKey(update) {
|
|
|
27951
28617
|
return null;
|
|
27952
28618
|
}
|
|
27953
28619
|
}
|
|
28620
|
+
function historyUpdateContentKey(update) {
|
|
28621
|
+
switch (update.sessionUpdate) {
|
|
28622
|
+
case "user_message_chunk":
|
|
28623
|
+
case "agent_message_chunk":
|
|
28624
|
+
case "agent_thought_chunk":
|
|
28625
|
+
return `${update.sessionUpdate}:${JSON.stringify(update.content)}`;
|
|
28626
|
+
default:
|
|
28627
|
+
return historyUpdateKey(update);
|
|
28628
|
+
}
|
|
28629
|
+
}
|
|
27954
28630
|
function getRequestedMcpServerNames(mcpServers) {
|
|
27955
28631
|
return Array.from(new Set(mcpServers.map((server) => sanitizeMcpServerName(server.name))));
|
|
27956
28632
|
}
|
|
27957
28633
|
|
|
27958
28634
|
// src/CodexAppServerClient.ts
|
|
27959
|
-
var import_node2 = __toESM(
|
|
28635
|
+
var import_node2 = __toESM(require_main(), 1);
|
|
27960
28636
|
var CommandExecutionApprovalRequest = new import_node2.RequestType("item/commandExecution/requestApproval");
|
|
27961
28637
|
var FileChangeApprovalRequest = new import_node2.RequestType("item/fileChange/requestApproval");
|
|
27962
28638
|
var PermissionsApprovalRequest = new import_node2.RequestType("item/permissions/requestApproval");
|