nexrall-code 0.5.119 → 0.5.121
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 +849 -471
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3079,11 +3079,11 @@ var require_types = __commonJS({
|
|
|
3079
3079
|
"use strict";
|
|
3080
3080
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3081
3081
|
exports2.AgentTurnError = exports2.RUNTIME_CONTEXT_OPEN_TAG = void 0;
|
|
3082
|
-
exports2.isRuntimeContextBlock =
|
|
3082
|
+
exports2.isRuntimeContextBlock = isRuntimeContextBlock2;
|
|
3083
3083
|
exports2.isAgentTurnError = isAgentTurnError;
|
|
3084
3084
|
exports2.salvageHistory = salvageHistory2;
|
|
3085
3085
|
exports2.RUNTIME_CONTEXT_OPEN_TAG = "<runtime_context>";
|
|
3086
|
-
function
|
|
3086
|
+
function isRuntimeContextBlock2(b) {
|
|
3087
3087
|
const x2 = b;
|
|
3088
3088
|
return !!x2 && x2.type === "text" && typeof x2.text === "string" && x2.text.startsWith(exports2.RUNTIME_CONTEXT_OPEN_TAG);
|
|
3089
3089
|
}
|
|
@@ -3493,7 +3493,7 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
3493
3493
|
return new originalPromise(executor);
|
|
3494
3494
|
}
|
|
3495
3495
|
function promiseResolvedWith(value) {
|
|
3496
|
-
return newPromise((
|
|
3496
|
+
return newPromise((resolve5) => resolve5(value));
|
|
3497
3497
|
}
|
|
3498
3498
|
function promiseRejectedWith(reason) {
|
|
3499
3499
|
return originalPromiseReject(reason);
|
|
@@ -3663,8 +3663,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
3663
3663
|
return new TypeError("Cannot " + name + " a stream using a released reader");
|
|
3664
3664
|
}
|
|
3665
3665
|
function defaultReaderClosedPromiseInitialize(reader) {
|
|
3666
|
-
reader._closedPromise = newPromise((
|
|
3667
|
-
reader._closedPromise_resolve =
|
|
3666
|
+
reader._closedPromise = newPromise((resolve5, reject) => {
|
|
3667
|
+
reader._closedPromise_resolve = resolve5;
|
|
3668
3668
|
reader._closedPromise_reject = reject;
|
|
3669
3669
|
});
|
|
3670
3670
|
}
|
|
@@ -3838,8 +3838,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
3838
3838
|
}
|
|
3839
3839
|
let resolvePromise;
|
|
3840
3840
|
let rejectPromise;
|
|
3841
|
-
const promise = newPromise((
|
|
3842
|
-
resolvePromise =
|
|
3841
|
+
const promise = newPromise((resolve5, reject) => {
|
|
3842
|
+
resolvePromise = resolve5;
|
|
3843
3843
|
rejectPromise = reject;
|
|
3844
3844
|
});
|
|
3845
3845
|
const readRequest = {
|
|
@@ -3944,8 +3944,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
3944
3944
|
const reader = this._reader;
|
|
3945
3945
|
let resolvePromise;
|
|
3946
3946
|
let rejectPromise;
|
|
3947
|
-
const promise = newPromise((
|
|
3948
|
-
resolvePromise =
|
|
3947
|
+
const promise = newPromise((resolve5, reject) => {
|
|
3948
|
+
resolvePromise = resolve5;
|
|
3949
3949
|
rejectPromise = reject;
|
|
3950
3950
|
});
|
|
3951
3951
|
const readRequest = {
|
|
@@ -4964,8 +4964,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
4964
4964
|
}
|
|
4965
4965
|
let resolvePromise;
|
|
4966
4966
|
let rejectPromise;
|
|
4967
|
-
const promise = newPromise((
|
|
4968
|
-
resolvePromise =
|
|
4967
|
+
const promise = newPromise((resolve5, reject) => {
|
|
4968
|
+
resolvePromise = resolve5;
|
|
4969
4969
|
rejectPromise = reject;
|
|
4970
4970
|
});
|
|
4971
4971
|
const readIntoRequest = {
|
|
@@ -5277,10 +5277,10 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
5277
5277
|
wasAlreadyErroring = true;
|
|
5278
5278
|
reason = void 0;
|
|
5279
5279
|
}
|
|
5280
|
-
const promise = newPromise((
|
|
5280
|
+
const promise = newPromise((resolve5, reject) => {
|
|
5281
5281
|
stream._pendingAbortRequest = {
|
|
5282
5282
|
_promise: void 0,
|
|
5283
|
-
_resolve:
|
|
5283
|
+
_resolve: resolve5,
|
|
5284
5284
|
_reject: reject,
|
|
5285
5285
|
_reason: reason,
|
|
5286
5286
|
_wasAlreadyErroring: wasAlreadyErroring
|
|
@@ -5297,9 +5297,9 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
5297
5297
|
if (state === "closed" || state === "errored") {
|
|
5298
5298
|
return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));
|
|
5299
5299
|
}
|
|
5300
|
-
const promise = newPromise((
|
|
5300
|
+
const promise = newPromise((resolve5, reject) => {
|
|
5301
5301
|
const closeRequest = {
|
|
5302
|
-
_resolve:
|
|
5302
|
+
_resolve: resolve5,
|
|
5303
5303
|
_reject: reject
|
|
5304
5304
|
};
|
|
5305
5305
|
stream._closeRequest = closeRequest;
|
|
@@ -5312,9 +5312,9 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
5312
5312
|
return promise;
|
|
5313
5313
|
}
|
|
5314
5314
|
function WritableStreamAddWriteRequest(stream) {
|
|
5315
|
-
const promise = newPromise((
|
|
5315
|
+
const promise = newPromise((resolve5, reject) => {
|
|
5316
5316
|
const writeRequest = {
|
|
5317
|
-
_resolve:
|
|
5317
|
+
_resolve: resolve5,
|
|
5318
5318
|
_reject: reject
|
|
5319
5319
|
};
|
|
5320
5320
|
stream._writeRequests.push(writeRequest);
|
|
@@ -5930,8 +5930,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
5930
5930
|
return new TypeError("Cannot " + name + " a stream using a released writer");
|
|
5931
5931
|
}
|
|
5932
5932
|
function defaultWriterClosedPromiseInitialize(writer) {
|
|
5933
|
-
writer._closedPromise = newPromise((
|
|
5934
|
-
writer._closedPromise_resolve =
|
|
5933
|
+
writer._closedPromise = newPromise((resolve5, reject) => {
|
|
5934
|
+
writer._closedPromise_resolve = resolve5;
|
|
5935
5935
|
writer._closedPromise_reject = reject;
|
|
5936
5936
|
writer._closedPromiseState = "pending";
|
|
5937
5937
|
});
|
|
@@ -5967,8 +5967,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
5967
5967
|
writer._closedPromiseState = "resolved";
|
|
5968
5968
|
}
|
|
5969
5969
|
function defaultWriterReadyPromiseInitialize(writer) {
|
|
5970
|
-
writer._readyPromise = newPromise((
|
|
5971
|
-
writer._readyPromise_resolve =
|
|
5970
|
+
writer._readyPromise = newPromise((resolve5, reject) => {
|
|
5971
|
+
writer._readyPromise_resolve = resolve5;
|
|
5972
5972
|
writer._readyPromise_reject = reject;
|
|
5973
5973
|
});
|
|
5974
5974
|
writer._readyPromiseState = "pending";
|
|
@@ -6055,7 +6055,7 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
6055
6055
|
source2._disturbed = true;
|
|
6056
6056
|
let shuttingDown = false;
|
|
6057
6057
|
let currentWrite = promiseResolvedWith(void 0);
|
|
6058
|
-
return newPromise((
|
|
6058
|
+
return newPromise((resolve5, reject) => {
|
|
6059
6059
|
let abortAlgorithm;
|
|
6060
6060
|
if (signal !== void 0) {
|
|
6061
6061
|
abortAlgorithm = () => {
|
|
@@ -6200,7 +6200,7 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
6200
6200
|
if (isError2) {
|
|
6201
6201
|
reject(error);
|
|
6202
6202
|
} else {
|
|
6203
|
-
|
|
6203
|
+
resolve5(void 0);
|
|
6204
6204
|
}
|
|
6205
6205
|
return null;
|
|
6206
6206
|
}
|
|
@@ -6481,8 +6481,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
6481
6481
|
let branch1;
|
|
6482
6482
|
let branch2;
|
|
6483
6483
|
let resolveCancelPromise;
|
|
6484
|
-
const cancelPromise = newPromise((
|
|
6485
|
-
resolveCancelPromise =
|
|
6484
|
+
const cancelPromise = newPromise((resolve5) => {
|
|
6485
|
+
resolveCancelPromise = resolve5;
|
|
6486
6486
|
});
|
|
6487
6487
|
function pullAlgorithm() {
|
|
6488
6488
|
if (reading) {
|
|
@@ -6573,8 +6573,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
6573
6573
|
let branch1;
|
|
6574
6574
|
let branch2;
|
|
6575
6575
|
let resolveCancelPromise;
|
|
6576
|
-
const cancelPromise = newPromise((
|
|
6577
|
-
resolveCancelPromise =
|
|
6576
|
+
const cancelPromise = newPromise((resolve5) => {
|
|
6577
|
+
resolveCancelPromise = resolve5;
|
|
6578
6578
|
});
|
|
6579
6579
|
function forwardReaderError(thisReader) {
|
|
6580
6580
|
uponRejection(thisReader._closedPromise, (r2) => {
|
|
@@ -7354,8 +7354,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7354
7354
|
const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
|
|
7355
7355
|
const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
|
|
7356
7356
|
let startPromise_resolve;
|
|
7357
|
-
const startPromise = newPromise((
|
|
7358
|
-
startPromise_resolve =
|
|
7357
|
+
const startPromise = newPromise((resolve5) => {
|
|
7358
|
+
startPromise_resolve = resolve5;
|
|
7359
7359
|
});
|
|
7360
7360
|
InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
7361
7361
|
SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
|
|
@@ -7448,8 +7448,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7448
7448
|
if (stream._backpressureChangePromise !== void 0) {
|
|
7449
7449
|
stream._backpressureChangePromise_resolve();
|
|
7450
7450
|
}
|
|
7451
|
-
stream._backpressureChangePromise = newPromise((
|
|
7452
|
-
stream._backpressureChangePromise_resolve =
|
|
7451
|
+
stream._backpressureChangePromise = newPromise((resolve5) => {
|
|
7452
|
+
stream._backpressureChangePromise_resolve = resolve5;
|
|
7453
7453
|
});
|
|
7454
7454
|
stream._backpressure = backpressure;
|
|
7455
7455
|
}
|
|
@@ -7617,8 +7617,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7617
7617
|
return controller._finishPromise;
|
|
7618
7618
|
}
|
|
7619
7619
|
const readable = stream._readable;
|
|
7620
|
-
controller._finishPromise = newPromise((
|
|
7621
|
-
controller._finishPromise_resolve =
|
|
7620
|
+
controller._finishPromise = newPromise((resolve5, reject) => {
|
|
7621
|
+
controller._finishPromise_resolve = resolve5;
|
|
7622
7622
|
controller._finishPromise_reject = reject;
|
|
7623
7623
|
});
|
|
7624
7624
|
const cancelPromise = controller._cancelAlgorithm(reason);
|
|
@@ -7644,8 +7644,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7644
7644
|
return controller._finishPromise;
|
|
7645
7645
|
}
|
|
7646
7646
|
const readable = stream._readable;
|
|
7647
|
-
controller._finishPromise = newPromise((
|
|
7648
|
-
controller._finishPromise_resolve =
|
|
7647
|
+
controller._finishPromise = newPromise((resolve5, reject) => {
|
|
7648
|
+
controller._finishPromise_resolve = resolve5;
|
|
7649
7649
|
controller._finishPromise_reject = reject;
|
|
7650
7650
|
});
|
|
7651
7651
|
const flushPromise = controller._flushAlgorithm();
|
|
@@ -7675,8 +7675,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7675
7675
|
return controller._finishPromise;
|
|
7676
7676
|
}
|
|
7677
7677
|
const writable = stream._writable;
|
|
7678
|
-
controller._finishPromise = newPromise((
|
|
7679
|
-
controller._finishPromise_resolve =
|
|
7678
|
+
controller._finishPromise = newPromise((resolve5, reject) => {
|
|
7679
|
+
controller._finishPromise_resolve = resolve5;
|
|
7680
7680
|
controller._finishPromise_reject = reject;
|
|
7681
7681
|
});
|
|
7682
7682
|
const cancelPromise = controller._cancelAlgorithm(reason);
|
|
@@ -9632,7 +9632,7 @@ import zlib from "node:zlib";
|
|
|
9632
9632
|
import Stream2, { PassThrough as PassThrough2, pipeline as pump } from "node:stream";
|
|
9633
9633
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
9634
9634
|
async function fetch2(url, options_) {
|
|
9635
|
-
return new Promise((
|
|
9635
|
+
return new Promise((resolve5, reject) => {
|
|
9636
9636
|
const request = new Request(url, options_);
|
|
9637
9637
|
const { parsedURL, options } = getNodeRequestOptions(request);
|
|
9638
9638
|
if (!supportedSchemas.has(parsedURL.protocol)) {
|
|
@@ -9641,7 +9641,7 @@ async function fetch2(url, options_) {
|
|
|
9641
9641
|
if (parsedURL.protocol === "data:") {
|
|
9642
9642
|
const data = dist_default(request.url);
|
|
9643
9643
|
const response2 = new Response(data, { headers: { "Content-Type": data.typeFull } });
|
|
9644
|
-
|
|
9644
|
+
resolve5(response2);
|
|
9645
9645
|
return;
|
|
9646
9646
|
}
|
|
9647
9647
|
const send = (parsedURL.protocol === "https:" ? https : http2).request;
|
|
@@ -9763,7 +9763,7 @@ async function fetch2(url, options_) {
|
|
|
9763
9763
|
if (responseReferrerPolicy) {
|
|
9764
9764
|
requestOptions.referrerPolicy = responseReferrerPolicy;
|
|
9765
9765
|
}
|
|
9766
|
-
|
|
9766
|
+
resolve5(fetch2(new Request(locationURL, requestOptions)));
|
|
9767
9767
|
finalize();
|
|
9768
9768
|
return;
|
|
9769
9769
|
}
|
|
@@ -9796,7 +9796,7 @@ async function fetch2(url, options_) {
|
|
|
9796
9796
|
const codings = headers.get("Content-Encoding");
|
|
9797
9797
|
if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
|
|
9798
9798
|
response = new Response(body, responseOptions);
|
|
9799
|
-
|
|
9799
|
+
resolve5(response);
|
|
9800
9800
|
return;
|
|
9801
9801
|
}
|
|
9802
9802
|
const zlibOptions = {
|
|
@@ -9810,7 +9810,7 @@ async function fetch2(url, options_) {
|
|
|
9810
9810
|
}
|
|
9811
9811
|
});
|
|
9812
9812
|
response = new Response(body, responseOptions);
|
|
9813
|
-
|
|
9813
|
+
resolve5(response);
|
|
9814
9814
|
return;
|
|
9815
9815
|
}
|
|
9816
9816
|
if (codings === "deflate" || codings === "x-deflate") {
|
|
@@ -9834,12 +9834,12 @@ async function fetch2(url, options_) {
|
|
|
9834
9834
|
});
|
|
9835
9835
|
}
|
|
9836
9836
|
response = new Response(body, responseOptions);
|
|
9837
|
-
|
|
9837
|
+
resolve5(response);
|
|
9838
9838
|
});
|
|
9839
9839
|
raw.once("end", () => {
|
|
9840
9840
|
if (!response) {
|
|
9841
9841
|
response = new Response(body, responseOptions);
|
|
9842
|
-
|
|
9842
|
+
resolve5(response);
|
|
9843
9843
|
}
|
|
9844
9844
|
});
|
|
9845
9845
|
return;
|
|
@@ -9851,11 +9851,11 @@ async function fetch2(url, options_) {
|
|
|
9851
9851
|
}
|
|
9852
9852
|
});
|
|
9853
9853
|
response = new Response(body, responseOptions);
|
|
9854
|
-
|
|
9854
|
+
resolve5(response);
|
|
9855
9855
|
return;
|
|
9856
9856
|
}
|
|
9857
9857
|
response = new Response(body, responseOptions);
|
|
9858
|
-
|
|
9858
|
+
resolve5(response);
|
|
9859
9859
|
});
|
|
9860
9860
|
writeToStream(request_, request).catch(reject);
|
|
9861
9861
|
});
|
|
@@ -9928,9 +9928,9 @@ var require_client = __commonJS({
|
|
|
9928
9928
|
exports2.revokeRefreshToken = revokeRefreshToken2;
|
|
9929
9929
|
exports2.describeAttachment = describeAttachment2;
|
|
9930
9930
|
exports2.getBalance = getBalance3;
|
|
9931
|
-
exports2.billingOverrideFields =
|
|
9932
|
-
exports2.setBillingTarget =
|
|
9933
|
-
exports2.getOrgs =
|
|
9931
|
+
exports2.billingOverrideFields = billingOverrideFields3;
|
|
9932
|
+
exports2.setBillingTarget = setBillingTarget3;
|
|
9933
|
+
exports2.getOrgs = getOrgs3;
|
|
9934
9934
|
exports2.getCodeModels = getCodeModels;
|
|
9935
9935
|
exports2.getUsageDaily = getUsageDaily;
|
|
9936
9936
|
exports2.exchangeVscodeCode = exchangeVscodeCode;
|
|
@@ -10115,7 +10115,7 @@ var require_client = __commonJS({
|
|
|
10115
10115
|
const getChatBody = () => {
|
|
10116
10116
|
if (chatBody && chatBody.turnId === turnId)
|
|
10117
10117
|
return chatBody;
|
|
10118
|
-
const json = JSON.stringify({ messages, model, env: env4, editorContext, nexrallMd, mode, effort, clientType, extraTools, agents, skills, turnId, canWriteSharedMemory, hasOwnAgentStore, canSpawnSubAgents, canBrowseWeb, toolAllowlist, ...
|
|
10118
|
+
const json = JSON.stringify({ messages, model, env: env4, editorContext, nexrallMd, mode, effort, clientType, extraTools, agents, skills, turnId, canWriteSharedMemory, hasOwnAgentStore, canSpawnSubAgents, canBrowseWeb, toolAllowlist, ...billingOverrideFields3() });
|
|
10119
10119
|
chatBody = gzipRequestsEnabled() && json.length >= GZIP_MIN_BYTES ? { data: (0, zlib_1.gzipSync)(json, { level: 5 }), gzip: true, turnId } : { data: json, gzip: false, turnId };
|
|
10120
10120
|
return chatBody;
|
|
10121
10121
|
};
|
|
@@ -10370,7 +10370,7 @@ var require_client = __commonJS({
|
|
|
10370
10370
|
const partialInputs = {};
|
|
10371
10371
|
let heartbeatWatchdog;
|
|
10372
10372
|
try {
|
|
10373
|
-
await new Promise((
|
|
10373
|
+
await new Promise((resolve5, reject) => {
|
|
10374
10374
|
const stream = response.body;
|
|
10375
10375
|
const HEARTBEAT_TIMEOUT_MS = 9e4;
|
|
10376
10376
|
const FIRST_EVENT_TIMEOUT_MS = Number(process.env.NEXRALL_FIRST_EVENT_TIMEOUT_MS) || 3e5;
|
|
@@ -10383,7 +10383,7 @@ var require_client = __commonJS({
|
|
|
10383
10383
|
if (haveCompleteMessage() && now - lastDataAt > HEARTBEAT_TIMEOUT_MS) {
|
|
10384
10384
|
clearInterval(heartbeatWatchdog);
|
|
10385
10385
|
stream.destroy?.();
|
|
10386
|
-
|
|
10386
|
+
resolve5();
|
|
10387
10387
|
return;
|
|
10388
10388
|
}
|
|
10389
10389
|
if (now - lastDataAt > HEARTBEAT_TIMEOUT_MS) {
|
|
@@ -10399,7 +10399,7 @@ var require_client = __commonJS({
|
|
|
10399
10399
|
clearInterval(heartbeatWatchdog);
|
|
10400
10400
|
stream.destroy?.();
|
|
10401
10401
|
if (haveCompleteMessage()) {
|
|
10402
|
-
|
|
10402
|
+
resolve5();
|
|
10403
10403
|
return;
|
|
10404
10404
|
}
|
|
10405
10405
|
reject(tagTransient(new Error(sawModelEvent ? `The model stopped responding mid-stream (no output for ${Math.round(stallLimitMs / 1e3)} s).` : `The model did not start responding within ${Math.round(stallLimitMs / 1e3)} s (large context can take a while to process).`)));
|
|
@@ -10420,7 +10420,7 @@ var require_client = __commonJS({
|
|
|
10420
10420
|
}
|
|
10421
10421
|
const raw = event.data;
|
|
10422
10422
|
if (!raw || raw === "[DONE]") {
|
|
10423
|
-
|
|
10423
|
+
resolve5();
|
|
10424
10424
|
return;
|
|
10425
10425
|
}
|
|
10426
10426
|
let parsed;
|
|
@@ -10523,7 +10523,7 @@ var require_client = __commonJS({
|
|
|
10523
10523
|
drainGuard.unref?.();
|
|
10524
10524
|
stream.once("end", () => clearTimeout(drainGuard));
|
|
10525
10525
|
stream.once("close", () => clearTimeout(drainGuard));
|
|
10526
|
-
|
|
10526
|
+
resolve5();
|
|
10527
10527
|
}
|
|
10528
10528
|
}
|
|
10529
10529
|
break;
|
|
@@ -10583,7 +10583,7 @@ var require_client = __commonJS({
|
|
|
10583
10583
|
}
|
|
10584
10584
|
case "done": {
|
|
10585
10585
|
onEvent({ type: "done" });
|
|
10586
|
-
|
|
10586
|
+
resolve5();
|
|
10587
10587
|
break;
|
|
10588
10588
|
}
|
|
10589
10589
|
case "error": {
|
|
@@ -10593,7 +10593,7 @@ var require_client = __commonJS({
|
|
|
10593
10593
|
if (haveCompleteMessage()) {
|
|
10594
10594
|
clearInterval(heartbeatWatchdog);
|
|
10595
10595
|
onEvent({ type: "error", message });
|
|
10596
|
-
|
|
10596
|
+
resolve5();
|
|
10597
10597
|
} else if (notResumable && (!emittedToCaller || allowRestartAfterRender)) {
|
|
10598
10598
|
clearInterval(heartbeatWatchdog);
|
|
10599
10599
|
stream.destroy?.();
|
|
@@ -10628,16 +10628,16 @@ var require_client = __commonJS({
|
|
|
10628
10628
|
reject(Object.assign(new Error("Connection closed before the model responded. Retrying\u2026"), { retryable: true }));
|
|
10629
10629
|
return;
|
|
10630
10630
|
}
|
|
10631
|
-
|
|
10631
|
+
resolve5();
|
|
10632
10632
|
});
|
|
10633
10633
|
stream.on("error", (err) => {
|
|
10634
10634
|
clearInterval(heartbeatWatchdog);
|
|
10635
10635
|
if (abortSignal?.aborted || controller.signal.aborted) {
|
|
10636
|
-
|
|
10636
|
+
resolve5();
|
|
10637
10637
|
return;
|
|
10638
10638
|
}
|
|
10639
10639
|
if (haveCompleteMessage()) {
|
|
10640
|
-
|
|
10640
|
+
resolve5();
|
|
10641
10641
|
return;
|
|
10642
10642
|
}
|
|
10643
10643
|
reject(tagTransient(err));
|
|
@@ -10734,7 +10734,7 @@ var require_client = __commonJS({
|
|
|
10734
10734
|
const fetchOnce = () => (0, node_fetch_1.default)(`${exports2.API_BASE}/api/code/assets/describe`, {
|
|
10735
10735
|
method: "POST",
|
|
10736
10736
|
headers: { ...authHeaders(), "Content-Type": "application/json" },
|
|
10737
|
-
body: JSON.stringify({ kind, data, media_type: mediaType, name, ...
|
|
10737
|
+
body: JSON.stringify({ kind, data, media_type: mediaType, name, ...billingOverrideFields3() })
|
|
10738
10738
|
});
|
|
10739
10739
|
let response = await fetchOnce();
|
|
10740
10740
|
if (response.status === 401 || response.status === 403) {
|
|
@@ -10779,11 +10779,11 @@ var require_client = __commonJS({
|
|
|
10779
10779
|
const data = await response.json();
|
|
10780
10780
|
return typeof data.balance === "number" ? data.balance : 0;
|
|
10781
10781
|
}
|
|
10782
|
-
function
|
|
10782
|
+
function billingOverrideFields3() {
|
|
10783
10783
|
const override = (0, index_1.getBillingTeamOverride)();
|
|
10784
10784
|
return override === void 0 ? {} : { teamId: override };
|
|
10785
10785
|
}
|
|
10786
|
-
async function
|
|
10786
|
+
async function setBillingTarget3(teamId) {
|
|
10787
10787
|
const response = await (0, node_fetch_1.default)(`${exports2.API_BASE}/api/user/billing-target`, {
|
|
10788
10788
|
method: "PUT",
|
|
10789
10789
|
headers: authHeaders(),
|
|
@@ -10800,7 +10800,7 @@ var require_client = __commonJS({
|
|
|
10800
10800
|
throw new Error(message);
|
|
10801
10801
|
}
|
|
10802
10802
|
}
|
|
10803
|
-
async function
|
|
10803
|
+
async function getOrgs3() {
|
|
10804
10804
|
const fetchOnce = () => (0, node_fetch_1.default)(`${exports2.API_BASE}/api/code/orgs`, { method: "GET", headers: authHeaders() });
|
|
10805
10805
|
let response = await fetchOnce();
|
|
10806
10806
|
if (response.status === 401 || response.status === 403) {
|
|
@@ -14940,37 +14940,37 @@ var require_peerTransport = __commonJS({
|
|
|
14940
14940
|
};
|
|
14941
14941
|
}
|
|
14942
14942
|
function sendPeerMessage(targetSocketPath, message) {
|
|
14943
|
-
return new Promise((
|
|
14943
|
+
return new Promise((resolve5) => {
|
|
14944
14944
|
const safetyError = verifySocketSafety(targetSocketPath);
|
|
14945
14945
|
if (safetyError) {
|
|
14946
|
-
|
|
14946
|
+
resolve5({ ok: false, error: safetyError });
|
|
14947
14947
|
return;
|
|
14948
14948
|
}
|
|
14949
14949
|
const payload = { ...message, text: message.text.slice(0, MAX_MESSAGE_BYTES), sentAt: Date.now() };
|
|
14950
14950
|
const line = JSON.stringify(payload) + "\n";
|
|
14951
14951
|
if (Buffer.byteLength(line, "utf-8") > MAX_MESSAGE_BYTES * 2) {
|
|
14952
|
-
|
|
14952
|
+
resolve5({ ok: false, error: `message too large (max ${MAX_MESSAGE_BYTES} bytes)` });
|
|
14953
14953
|
return;
|
|
14954
14954
|
}
|
|
14955
14955
|
const socket = net.createConnection(targetSocketPath);
|
|
14956
14956
|
const timeout = setTimeout(() => {
|
|
14957
14957
|
socket.destroy();
|
|
14958
|
-
|
|
14958
|
+
resolve5({ ok: false, error: "timed out connecting to peer \u2014 it may be busy or have just exited" });
|
|
14959
14959
|
}, CONNECT_TIMEOUT_MS);
|
|
14960
14960
|
socket.on("connect", () => {
|
|
14961
14961
|
socket.write(line, (err) => {
|
|
14962
14962
|
clearTimeout(timeout);
|
|
14963
14963
|
if (err) {
|
|
14964
|
-
|
|
14964
|
+
resolve5({ ok: false, error: err.message });
|
|
14965
14965
|
return;
|
|
14966
14966
|
}
|
|
14967
14967
|
socket.end();
|
|
14968
|
-
|
|
14968
|
+
resolve5({ ok: true });
|
|
14969
14969
|
});
|
|
14970
14970
|
});
|
|
14971
14971
|
socket.on("error", (err) => {
|
|
14972
14972
|
clearTimeout(timeout);
|
|
14973
|
-
|
|
14973
|
+
resolve5({ ok: false, error: err.message });
|
|
14974
14974
|
});
|
|
14975
14975
|
});
|
|
14976
14976
|
}
|
|
@@ -15570,7 +15570,7 @@ var require_dist2 = __commonJS({
|
|
|
15570
15570
|
return ret2;
|
|
15571
15571
|
}
|
|
15572
15572
|
function once(emitter, name) {
|
|
15573
|
-
return new Promise(function(
|
|
15573
|
+
return new Promise(function(resolve5, reject) {
|
|
15574
15574
|
function errorListener(err) {
|
|
15575
15575
|
emitter.removeListener(name, resolver);
|
|
15576
15576
|
reject(err);
|
|
@@ -15578,7 +15578,7 @@ var require_dist2 = __commonJS({
|
|
|
15578
15578
|
function resolver() {
|
|
15579
15579
|
if (typeof emitter.removeListener === "function")
|
|
15580
15580
|
emitter.removeListener("error", errorListener);
|
|
15581
|
-
|
|
15581
|
+
resolve5([].slice.call(arguments));
|
|
15582
15582
|
}
|
|
15583
15583
|
eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
|
|
15584
15584
|
if (name !== "error")
|
|
@@ -18952,8 +18952,8 @@ var require_dist2 = __commonJS({
|
|
|
18952
18952
|
}
|
|
18953
18953
|
function fn() {
|
|
18954
18954
|
var promiseResolve, promiseReject;
|
|
18955
|
-
var promise = new Promise(function(
|
|
18956
|
-
promiseResolve =
|
|
18955
|
+
var promise = new Promise(function(resolve5, reject) {
|
|
18956
|
+
promiseResolve = resolve5;
|
|
18957
18957
|
promiseReject = reject;
|
|
18958
18958
|
});
|
|
18959
18959
|
var args = [];
|
|
@@ -19155,7 +19155,7 @@ var require_dist2 = __commonJS({
|
|
|
19155
19155
|
},
|
|
19156
19156
|
{
|
|
19157
19157
|
key: "join",
|
|
19158
|
-
value: function
|
|
19158
|
+
value: function join7(s2) {
|
|
19159
19159
|
if (this.length === 0)
|
|
19160
19160
|
return "";
|
|
19161
19161
|
var p = this.head;
|
|
@@ -20492,14 +20492,14 @@ var require_dist2 = __commonJS({
|
|
|
20492
20492
|
};
|
|
20493
20493
|
}
|
|
20494
20494
|
function readAndResolve(iter) {
|
|
20495
|
-
var
|
|
20496
|
-
if (
|
|
20495
|
+
var resolve5 = iter[kLastResolve];
|
|
20496
|
+
if (resolve5 !== null) {
|
|
20497
20497
|
var data = iter[kStream].read();
|
|
20498
20498
|
if (data !== null) {
|
|
20499
20499
|
iter[kLastPromise] = null;
|
|
20500
20500
|
iter[kLastResolve] = null;
|
|
20501
20501
|
iter[kLastReject] = null;
|
|
20502
|
-
|
|
20502
|
+
resolve5(createIterResult(data, false));
|
|
20503
20503
|
}
|
|
20504
20504
|
}
|
|
20505
20505
|
}
|
|
@@ -20507,13 +20507,13 @@ var require_dist2 = __commonJS({
|
|
|
20507
20507
|
process$1.nextTick(readAndResolve, iter);
|
|
20508
20508
|
}
|
|
20509
20509
|
function wrapForNext(lastPromise, iter) {
|
|
20510
|
-
return function(
|
|
20510
|
+
return function(resolve5, reject) {
|
|
20511
20511
|
lastPromise.then(function() {
|
|
20512
20512
|
if (iter[kEnded]) {
|
|
20513
|
-
|
|
20513
|
+
resolve5(createIterResult(void 0, true));
|
|
20514
20514
|
return;
|
|
20515
20515
|
}
|
|
20516
|
-
iter[kHandlePromise](
|
|
20516
|
+
iter[kHandlePromise](resolve5, reject);
|
|
20517
20517
|
}, reject);
|
|
20518
20518
|
};
|
|
20519
20519
|
}
|
|
@@ -20531,12 +20531,12 @@ var require_dist2 = __commonJS({
|
|
|
20531
20531
|
if (this[kEnded])
|
|
20532
20532
|
return Promise.resolve(createIterResult(void 0, true));
|
|
20533
20533
|
if (this[kStream].destroyed)
|
|
20534
|
-
return new Promise(function(
|
|
20534
|
+
return new Promise(function(resolve5, reject) {
|
|
20535
20535
|
process$1.nextTick(function() {
|
|
20536
20536
|
if (_this[kError])
|
|
20537
20537
|
reject(_this[kError]);
|
|
20538
20538
|
else
|
|
20539
|
-
|
|
20539
|
+
resolve5(createIterResult(void 0, true));
|
|
20540
20540
|
});
|
|
20541
20541
|
});
|
|
20542
20542
|
var lastPromise = this[kLastPromise];
|
|
@@ -20556,13 +20556,13 @@ var require_dist2 = __commonJS({
|
|
|
20556
20556
|
return this;
|
|
20557
20557
|
}), _defineProperty2(_Object$setPrototypeO, "return", function _return() {
|
|
20558
20558
|
var _this2 = this;
|
|
20559
|
-
return new Promise(function(
|
|
20559
|
+
return new Promise(function(resolve5, reject) {
|
|
20560
20560
|
_this2[kStream].destroy(null, function(err) {
|
|
20561
20561
|
if (err) {
|
|
20562
20562
|
reject(err);
|
|
20563
20563
|
return;
|
|
20564
20564
|
}
|
|
20565
|
-
|
|
20565
|
+
resolve5(createIterResult(void 0, true));
|
|
20566
20566
|
});
|
|
20567
20567
|
});
|
|
20568
20568
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -20584,15 +20584,15 @@ var require_dist2 = __commonJS({
|
|
|
20584
20584
|
value: stream._readableState.endEmitted,
|
|
20585
20585
|
writable: true
|
|
20586
20586
|
}), _defineProperty2(_Object$create, kHandlePromise, {
|
|
20587
|
-
value: function value(
|
|
20587
|
+
value: function value(resolve5, reject) {
|
|
20588
20588
|
var data = iterator[kStream].read();
|
|
20589
20589
|
if (data) {
|
|
20590
20590
|
iterator[kLastPromise] = null;
|
|
20591
20591
|
iterator[kLastResolve] = null;
|
|
20592
20592
|
iterator[kLastReject] = null;
|
|
20593
|
-
|
|
20593
|
+
resolve5(createIterResult(data, false));
|
|
20594
20594
|
} else {
|
|
20595
|
-
iterator[kLastResolve] =
|
|
20595
|
+
iterator[kLastResolve] = resolve5;
|
|
20596
20596
|
iterator[kLastReject] = reject;
|
|
20597
20597
|
}
|
|
20598
20598
|
},
|
|
@@ -20611,12 +20611,12 @@ var require_dist2 = __commonJS({
|
|
|
20611
20611
|
iterator[kError] = err;
|
|
20612
20612
|
return;
|
|
20613
20613
|
}
|
|
20614
|
-
var
|
|
20615
|
-
if (
|
|
20614
|
+
var resolve5 = iterator[kLastResolve];
|
|
20615
|
+
if (resolve5 !== null) {
|
|
20616
20616
|
iterator[kLastPromise] = null;
|
|
20617
20617
|
iterator[kLastResolve] = null;
|
|
20618
20618
|
iterator[kLastReject] = null;
|
|
20619
|
-
|
|
20619
|
+
resolve5(createIterResult(void 0, true));
|
|
20620
20620
|
}
|
|
20621
20621
|
iterator[kEnded] = true;
|
|
20622
20622
|
});
|
|
@@ -36155,7 +36155,7 @@ var require_dist2 = __commonJS({
|
|
|
36155
36155
|
}
|
|
36156
36156
|
}
|
|
36157
36157
|
function add(value, last) {
|
|
36158
|
-
format(append,
|
|
36158
|
+
format(append, resolve5(value, indent, indent ? 1 : 0), last);
|
|
36159
36159
|
}
|
|
36160
36160
|
function end() {
|
|
36161
36161
|
if (stream) {
|
|
@@ -36199,13 +36199,13 @@ var require_dist2 = __commonJS({
|
|
|
36199
36199
|
return output;
|
|
36200
36200
|
}
|
|
36201
36201
|
function element() {
|
|
36202
|
-
var self2 = { _elem:
|
|
36202
|
+
var self2 = { _elem: resolve5(Array.prototype.slice.call(arguments)) };
|
|
36203
36203
|
self2.push = function(input) {
|
|
36204
36204
|
if (!this.append)
|
|
36205
36205
|
throw new Error("not assigned to a parent!");
|
|
36206
36206
|
var that = this;
|
|
36207
36207
|
var indent = this._elem.indent;
|
|
36208
|
-
format(this.append,
|
|
36208
|
+
format(this.append, resolve5(input, indent, this._elem.icount + (indent ? 1 : 0)), function() {
|
|
36209
36209
|
that.append(true);
|
|
36210
36210
|
});
|
|
36211
36211
|
};
|
|
@@ -36220,7 +36220,7 @@ var require_dist2 = __commonJS({
|
|
|
36220
36220
|
function create_indent(character, count) {
|
|
36221
36221
|
return new Array(count || 0).join(character || "");
|
|
36222
36222
|
}
|
|
36223
|
-
function
|
|
36223
|
+
function resolve5(data, indent, indent_count) {
|
|
36224
36224
|
indent_count = indent_count || 0;
|
|
36225
36225
|
var indent_spaces = create_indent(indent, indent_count);
|
|
36226
36226
|
var name;
|
|
@@ -36261,7 +36261,7 @@ var require_dist2 = __commonJS({
|
|
|
36261
36261
|
if (Object.keys(value)[0] == "_attr")
|
|
36262
36262
|
get_attributes(value._attr);
|
|
36263
36263
|
else
|
|
36264
|
-
content.push(
|
|
36264
|
+
content.push(resolve5(value, indent, indent_count + 1));
|
|
36265
36265
|
else {
|
|
36266
36266
|
content.pop();
|
|
36267
36267
|
isStringContent = true;
|
|
@@ -41340,7 +41340,7 @@ var require_worksheet = __commonJS({
|
|
|
41340
41340
|
// =========================================================================
|
|
41341
41341
|
// Worksheet Protection
|
|
41342
41342
|
protect(password, options) {
|
|
41343
|
-
return new Promise((
|
|
41343
|
+
return new Promise((resolve5) => {
|
|
41344
41344
|
this.sheetProtection = {
|
|
41345
41345
|
sheet: true
|
|
41346
41346
|
};
|
|
@@ -41364,7 +41364,7 @@ var require_worksheet = __commonJS({
|
|
|
41364
41364
|
delete this.sheetProtection.spinCount;
|
|
41365
41365
|
}
|
|
41366
41366
|
}
|
|
41367
|
-
|
|
41367
|
+
resolve5();
|
|
41368
41368
|
});
|
|
41369
41369
|
}
|
|
41370
41370
|
unprotect() {
|
|
@@ -42088,7 +42088,7 @@ var require_BufferList = __commonJS({
|
|
|
42088
42088
|
this.head = this.tail = null;
|
|
42089
42089
|
this.length = 0;
|
|
42090
42090
|
};
|
|
42091
|
-
BufferList.prototype.join = function
|
|
42091
|
+
BufferList.prototype.join = function join7(s2) {
|
|
42092
42092
|
if (this.length === 0)
|
|
42093
42093
|
return "";
|
|
42094
42094
|
var p = this.head;
|
|
@@ -44201,8 +44201,8 @@ var require_lib2 = __commonJS({
|
|
|
44201
44201
|
return this;
|
|
44202
44202
|
}
|
|
44203
44203
|
var p = this.constructor;
|
|
44204
|
-
return this.then(
|
|
44205
|
-
function
|
|
44204
|
+
return this.then(resolve6, reject2);
|
|
44205
|
+
function resolve6(value) {
|
|
44206
44206
|
function yes() {
|
|
44207
44207
|
return value;
|
|
44208
44208
|
}
|
|
@@ -44355,8 +44355,8 @@ var require_lib2 = __commonJS({
|
|
|
44355
44355
|
}
|
|
44356
44356
|
return out;
|
|
44357
44357
|
}
|
|
44358
|
-
Promise2.resolve =
|
|
44359
|
-
function
|
|
44358
|
+
Promise2.resolve = resolve5;
|
|
44359
|
+
function resolve5(value) {
|
|
44360
44360
|
if (value instanceof this) {
|
|
44361
44361
|
return value;
|
|
44362
44362
|
}
|
|
@@ -44887,10 +44887,10 @@ var require_utils = __commonJS({
|
|
|
44887
44887
|
var promise = external.Promise.resolve(inputData).then(function(data) {
|
|
44888
44888
|
var isBlob2 = support.blob && (data instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(data)) !== -1);
|
|
44889
44889
|
if (isBlob2 && typeof FileReader !== "undefined") {
|
|
44890
|
-
return new external.Promise(function(
|
|
44890
|
+
return new external.Promise(function(resolve5, reject) {
|
|
44891
44891
|
var reader = new FileReader();
|
|
44892
44892
|
reader.onload = function(e2) {
|
|
44893
|
-
|
|
44893
|
+
resolve5(e2.target.result);
|
|
44894
44894
|
};
|
|
44895
44895
|
reader.onerror = function(e2) {
|
|
44896
44896
|
reject(e2.target.error);
|
|
@@ -45445,7 +45445,7 @@ var require_StreamHelper = __commonJS({
|
|
|
45445
45445
|
}
|
|
45446
45446
|
}
|
|
45447
45447
|
function accumulate(helper, updateCallback) {
|
|
45448
|
-
return new external.Promise(function(
|
|
45448
|
+
return new external.Promise(function(resolve5, reject) {
|
|
45449
45449
|
var dataArray = [];
|
|
45450
45450
|
var chunkType = helper._internalType, resultType = helper._outputType, mimeType = helper._mimeType;
|
|
45451
45451
|
helper.on("data", function(data, meta) {
|
|
@@ -45459,7 +45459,7 @@ var require_StreamHelper = __commonJS({
|
|
|
45459
45459
|
}).on("end", function() {
|
|
45460
45460
|
try {
|
|
45461
45461
|
var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType);
|
|
45462
|
-
|
|
45462
|
+
resolve5(result);
|
|
45463
45463
|
} catch (e2) {
|
|
45464
45464
|
reject(e2);
|
|
45465
45465
|
}
|
|
@@ -51551,7 +51551,7 @@ var require_load = __commonJS({
|
|
|
51551
51551
|
var Crc32Probe = require_Crc32Probe();
|
|
51552
51552
|
var nodejsUtils = require_nodejsUtils();
|
|
51553
51553
|
function checkEntryCRC32(zipEntry) {
|
|
51554
|
-
return new external.Promise(function(
|
|
51554
|
+
return new external.Promise(function(resolve5, reject) {
|
|
51555
51555
|
var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe());
|
|
51556
51556
|
worker.on("error", function(e2) {
|
|
51557
51557
|
reject(e2);
|
|
@@ -51559,7 +51559,7 @@ var require_load = __commonJS({
|
|
|
51559
51559
|
if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) {
|
|
51560
51560
|
reject(new Error("Corrupted zip : CRC32 mismatch"));
|
|
51561
51561
|
} else {
|
|
51562
|
-
|
|
51562
|
+
resolve5();
|
|
51563
51563
|
}
|
|
51564
51564
|
}).resume();
|
|
51565
51565
|
});
|
|
@@ -51798,7 +51798,7 @@ var require_buffer_list = __commonJS({
|
|
|
51798
51798
|
}
|
|
51799
51799
|
}, {
|
|
51800
51800
|
key: "join",
|
|
51801
|
-
value: function
|
|
51801
|
+
value: function join7(s2) {
|
|
51802
51802
|
if (this.length === 0)
|
|
51803
51803
|
return "";
|
|
51804
51804
|
var p = this.head;
|
|
@@ -53206,14 +53206,14 @@ var require_async_iterator = __commonJS({
|
|
|
53206
53206
|
};
|
|
53207
53207
|
}
|
|
53208
53208
|
function readAndResolve(iter) {
|
|
53209
|
-
var
|
|
53210
|
-
if (
|
|
53209
|
+
var resolve5 = iter[kLastResolve];
|
|
53210
|
+
if (resolve5 !== null) {
|
|
53211
53211
|
var data = iter[kStream].read();
|
|
53212
53212
|
if (data !== null) {
|
|
53213
53213
|
iter[kLastPromise] = null;
|
|
53214
53214
|
iter[kLastResolve] = null;
|
|
53215
53215
|
iter[kLastReject] = null;
|
|
53216
|
-
|
|
53216
|
+
resolve5(createIterResult(data, false));
|
|
53217
53217
|
}
|
|
53218
53218
|
}
|
|
53219
53219
|
}
|
|
@@ -53221,13 +53221,13 @@ var require_async_iterator = __commonJS({
|
|
|
53221
53221
|
process.nextTick(readAndResolve, iter);
|
|
53222
53222
|
}
|
|
53223
53223
|
function wrapForNext(lastPromise, iter) {
|
|
53224
|
-
return function(
|
|
53224
|
+
return function(resolve5, reject) {
|
|
53225
53225
|
lastPromise.then(function() {
|
|
53226
53226
|
if (iter[kEnded]) {
|
|
53227
|
-
|
|
53227
|
+
resolve5(createIterResult(void 0, true));
|
|
53228
53228
|
return;
|
|
53229
53229
|
}
|
|
53230
|
-
iter[kHandlePromise](
|
|
53230
|
+
iter[kHandlePromise](resolve5, reject);
|
|
53231
53231
|
}, reject);
|
|
53232
53232
|
};
|
|
53233
53233
|
}
|
|
@@ -53247,12 +53247,12 @@ var require_async_iterator = __commonJS({
|
|
|
53247
53247
|
return Promise.resolve(createIterResult(void 0, true));
|
|
53248
53248
|
}
|
|
53249
53249
|
if (this[kStream].destroyed) {
|
|
53250
|
-
return new Promise(function(
|
|
53250
|
+
return new Promise(function(resolve5, reject) {
|
|
53251
53251
|
process.nextTick(function() {
|
|
53252
53252
|
if (_this[kError]) {
|
|
53253
53253
|
reject(_this[kError]);
|
|
53254
53254
|
} else {
|
|
53255
|
-
|
|
53255
|
+
resolve5(createIterResult(void 0, true));
|
|
53256
53256
|
}
|
|
53257
53257
|
});
|
|
53258
53258
|
});
|
|
@@ -53275,13 +53275,13 @@ var require_async_iterator = __commonJS({
|
|
|
53275
53275
|
return this;
|
|
53276
53276
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
53277
53277
|
var _this2 = this;
|
|
53278
|
-
return new Promise(function(
|
|
53278
|
+
return new Promise(function(resolve5, reject) {
|
|
53279
53279
|
_this2[kStream].destroy(null, function(err) {
|
|
53280
53280
|
if (err) {
|
|
53281
53281
|
reject(err);
|
|
53282
53282
|
return;
|
|
53283
53283
|
}
|
|
53284
|
-
|
|
53284
|
+
resolve5(createIterResult(void 0, true));
|
|
53285
53285
|
});
|
|
53286
53286
|
});
|
|
53287
53287
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -53303,15 +53303,15 @@ var require_async_iterator = __commonJS({
|
|
|
53303
53303
|
value: stream._readableState.endEmitted,
|
|
53304
53304
|
writable: true
|
|
53305
53305
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
53306
|
-
value: function value(
|
|
53306
|
+
value: function value(resolve5, reject) {
|
|
53307
53307
|
var data = iterator[kStream].read();
|
|
53308
53308
|
if (data) {
|
|
53309
53309
|
iterator[kLastPromise] = null;
|
|
53310
53310
|
iterator[kLastResolve] = null;
|
|
53311
53311
|
iterator[kLastReject] = null;
|
|
53312
|
-
|
|
53312
|
+
resolve5(createIterResult(data, false));
|
|
53313
53313
|
} else {
|
|
53314
|
-
iterator[kLastResolve] =
|
|
53314
|
+
iterator[kLastResolve] = resolve5;
|
|
53315
53315
|
iterator[kLastReject] = reject;
|
|
53316
53316
|
}
|
|
53317
53317
|
},
|
|
@@ -53330,12 +53330,12 @@ var require_async_iterator = __commonJS({
|
|
|
53330
53330
|
iterator[kError] = err;
|
|
53331
53331
|
return;
|
|
53332
53332
|
}
|
|
53333
|
-
var
|
|
53334
|
-
if (
|
|
53333
|
+
var resolve5 = iterator[kLastResolve];
|
|
53334
|
+
if (resolve5 !== null) {
|
|
53335
53335
|
iterator[kLastPromise] = null;
|
|
53336
53336
|
iterator[kLastResolve] = null;
|
|
53337
53337
|
iterator[kLastReject] = null;
|
|
53338
|
-
|
|
53338
|
+
resolve5(createIterResult(void 0, true));
|
|
53339
53339
|
}
|
|
53340
53340
|
iterator[kEnded] = true;
|
|
53341
53341
|
});
|
|
@@ -53350,7 +53350,7 @@ var require_async_iterator = __commonJS({
|
|
|
53350
53350
|
var require_from = __commonJS({
|
|
53351
53351
|
"../../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
|
|
53352
53352
|
"use strict";
|
|
53353
|
-
function asyncGeneratorStep(gen,
|
|
53353
|
+
function asyncGeneratorStep(gen, resolve5, reject, _next, _throw, key, arg) {
|
|
53354
53354
|
try {
|
|
53355
53355
|
var info = gen[key](arg);
|
|
53356
53356
|
var value = info.value;
|
|
@@ -53359,7 +53359,7 @@ var require_from = __commonJS({
|
|
|
53359
53359
|
return;
|
|
53360
53360
|
}
|
|
53361
53361
|
if (info.done) {
|
|
53362
|
-
|
|
53362
|
+
resolve5(value);
|
|
53363
53363
|
} else {
|
|
53364
53364
|
Promise.resolve(value).then(_next, _throw);
|
|
53365
53365
|
}
|
|
@@ -53367,13 +53367,13 @@ var require_from = __commonJS({
|
|
|
53367
53367
|
function _asyncToGenerator(fn) {
|
|
53368
53368
|
return function() {
|
|
53369
53369
|
var self2 = this, args = arguments;
|
|
53370
|
-
return new Promise(function(
|
|
53370
|
+
return new Promise(function(resolve5, reject) {
|
|
53371
53371
|
var gen = fn.apply(self2, args);
|
|
53372
53372
|
function _next(value) {
|
|
53373
|
-
asyncGeneratorStep(gen,
|
|
53373
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "next", value);
|
|
53374
53374
|
}
|
|
53375
53375
|
function _throw(err) {
|
|
53376
|
-
asyncGeneratorStep(gen,
|
|
53376
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "throw", err);
|
|
53377
53377
|
}
|
|
53378
53378
|
_next(void 0);
|
|
53379
53379
|
});
|
|
@@ -54550,14 +54550,14 @@ var require_utils2 = __commonJS({
|
|
|
54550
54550
|
nop() {
|
|
54551
54551
|
},
|
|
54552
54552
|
promiseImmediate(value) {
|
|
54553
|
-
return new Promise((
|
|
54553
|
+
return new Promise((resolve5) => {
|
|
54554
54554
|
if (global.setImmediate) {
|
|
54555
54555
|
setImmediate(() => {
|
|
54556
|
-
|
|
54556
|
+
resolve5(value);
|
|
54557
54557
|
});
|
|
54558
54558
|
} else {
|
|
54559
54559
|
setTimeout(() => {
|
|
54560
|
-
|
|
54560
|
+
resolve5(value);
|
|
54561
54561
|
}, 1);
|
|
54562
54562
|
}
|
|
54563
54563
|
});
|
|
@@ -54661,9 +54661,9 @@ var require_utils2 = __commonJS({
|
|
|
54661
54661
|
},
|
|
54662
54662
|
fs: {
|
|
54663
54663
|
exists(path9) {
|
|
54664
|
-
return new Promise((
|
|
54664
|
+
return new Promise((resolve5) => {
|
|
54665
54665
|
fs10.access(path9, fs10.constants.F_OK, (err) => {
|
|
54666
|
-
|
|
54666
|
+
resolve5(!err);
|
|
54667
54667
|
});
|
|
54668
54668
|
});
|
|
54669
54669
|
}
|
|
@@ -54886,9 +54886,9 @@ var require_stream_buf = __commonJS({
|
|
|
54886
54886
|
},
|
|
54887
54887
|
async _pipe(chunk) {
|
|
54888
54888
|
const write = function(pipe) {
|
|
54889
|
-
return new Promise((
|
|
54889
|
+
return new Promise((resolve5) => {
|
|
54890
54890
|
pipe.write(chunk.toBuffer(), () => {
|
|
54891
|
-
|
|
54891
|
+
resolve5();
|
|
54892
54892
|
});
|
|
54893
54893
|
});
|
|
54894
54894
|
};
|
|
@@ -66768,12 +66768,12 @@ var require_xlsx = __commonJS({
|
|
|
66768
66768
|
var VmlNotesXform = require_vml_notes_xform();
|
|
66769
66769
|
var theme1Xml = require_theme1();
|
|
66770
66770
|
function fsReadFileAsync(filename, options) {
|
|
66771
|
-
return new Promise((
|
|
66771
|
+
return new Promise((resolve5, reject) => {
|
|
66772
66772
|
fs10.readFile(filename, options, (error, data) => {
|
|
66773
66773
|
if (error) {
|
|
66774
66774
|
reject(error);
|
|
66775
66775
|
} else {
|
|
66776
|
-
|
|
66776
|
+
resolve5(data);
|
|
66777
66777
|
}
|
|
66778
66778
|
});
|
|
66779
66779
|
});
|
|
@@ -66900,7 +66900,7 @@ var require_xlsx = __commonJS({
|
|
|
66900
66900
|
if (lastDot >= 1) {
|
|
66901
66901
|
const extension2 = filename.substr(lastDot + 1);
|
|
66902
66902
|
const name = filename.substr(0, lastDot);
|
|
66903
|
-
await new Promise((
|
|
66903
|
+
await new Promise((resolve5, reject) => {
|
|
66904
66904
|
const streamBuf = new StreamBuf();
|
|
66905
66905
|
streamBuf.on("finish", () => {
|
|
66906
66906
|
model.mediaIndex[filename] = model.media.length;
|
|
@@ -66912,7 +66912,7 @@ var require_xlsx = __commonJS({
|
|
|
66912
66912
|
buffer: streamBuf.toBuffer()
|
|
66913
66913
|
};
|
|
66914
66914
|
model.media.push(medium);
|
|
66915
|
-
|
|
66915
|
+
resolve5();
|
|
66916
66916
|
});
|
|
66917
66917
|
entry.on("error", (error) => {
|
|
66918
66918
|
reject(error);
|
|
@@ -66937,13 +66937,13 @@ var require_xlsx = __commonJS({
|
|
|
66937
66937
|
model.vmlDrawings[`../drawings/${name}.vml`] = vmlDrawing;
|
|
66938
66938
|
}
|
|
66939
66939
|
async _processThemeEntry(entry, model, name) {
|
|
66940
|
-
await new Promise((
|
|
66940
|
+
await new Promise((resolve5, reject) => {
|
|
66941
66941
|
const stream = new StreamBuf();
|
|
66942
66942
|
entry.on("error", reject);
|
|
66943
66943
|
stream.on("error", reject);
|
|
66944
66944
|
stream.on("finish", () => {
|
|
66945
66945
|
model.themes[name] = stream.read().toString();
|
|
66946
|
-
|
|
66946
|
+
resolve5();
|
|
66947
66947
|
});
|
|
66948
66948
|
entry.pipe(stream);
|
|
66949
66949
|
});
|
|
@@ -67251,9 +67251,9 @@ var require_xlsx = __commonJS({
|
|
|
67251
67251
|
});
|
|
67252
67252
|
}
|
|
67253
67253
|
_finalize(zip) {
|
|
67254
|
-
return new Promise((
|
|
67254
|
+
return new Promise((resolve5, reject) => {
|
|
67255
67255
|
zip.on("finish", () => {
|
|
67256
|
-
|
|
67256
|
+
resolve5(this);
|
|
67257
67257
|
});
|
|
67258
67258
|
zip.on("error", reject);
|
|
67259
67259
|
zip.finalize();
|
|
@@ -67313,9 +67313,9 @@ var require_xlsx = __commonJS({
|
|
|
67313
67313
|
}
|
|
67314
67314
|
writeFile(filename, options) {
|
|
67315
67315
|
const stream = fs10.createWriteStream(filename);
|
|
67316
|
-
return new Promise((
|
|
67316
|
+
return new Promise((resolve5, reject) => {
|
|
67317
67317
|
stream.on("finish", () => {
|
|
67318
|
-
|
|
67318
|
+
resolve5();
|
|
67319
67319
|
});
|
|
67320
67320
|
stream.on("error", (error) => {
|
|
67321
67321
|
reject(error);
|
|
@@ -71487,7 +71487,7 @@ var require_csv = __commonJS({
|
|
|
71487
71487
|
}
|
|
71488
71488
|
read(stream, options) {
|
|
71489
71489
|
options = options || {};
|
|
71490
|
-
return new Promise((
|
|
71490
|
+
return new Promise((resolve5, reject) => {
|
|
71491
71491
|
const worksheet = this.workbook.addWorksheet(options.sheetName);
|
|
71492
71492
|
const dateFormats = options.dateFormats || [
|
|
71493
71493
|
"YYYY-MM-DD[T]HH:mm:ssZ",
|
|
@@ -71527,7 +71527,7 @@ var require_csv = __commonJS({
|
|
|
71527
71527
|
}).on("end", () => {
|
|
71528
71528
|
csvStream.emit("worksheet", worksheet);
|
|
71529
71529
|
});
|
|
71530
|
-
csvStream.on("worksheet",
|
|
71530
|
+
csvStream.on("worksheet", resolve5).on("error", reject);
|
|
71531
71531
|
stream.pipe(csvStream);
|
|
71532
71532
|
});
|
|
71533
71533
|
}
|
|
@@ -71540,12 +71540,12 @@ var require_csv = __commonJS({
|
|
|
71540
71540
|
);
|
|
71541
71541
|
}
|
|
71542
71542
|
write(stream, options) {
|
|
71543
|
-
return new Promise((
|
|
71543
|
+
return new Promise((resolve5, reject) => {
|
|
71544
71544
|
options = options || {};
|
|
71545
71545
|
const worksheet = this.workbook.getWorksheet(options.sheetName || options.sheetId);
|
|
71546
71546
|
const csvStream = fastCsv.format(options.formatterOptions);
|
|
71547
71547
|
stream.on("finish", () => {
|
|
71548
|
-
|
|
71548
|
+
resolve5();
|
|
71549
71549
|
});
|
|
71550
71550
|
csvStream.on("error", reject);
|
|
71551
71551
|
csvStream.pipe(stream);
|
|
@@ -72792,9 +72792,9 @@ var require_readdir_glob = __commonJS({
|
|
|
72792
72792
|
var fs10 = __require("fs");
|
|
72793
72793
|
var { EventEmitter: EventEmitter4 } = __require("events");
|
|
72794
72794
|
var { Minimatch } = require_minimatch();
|
|
72795
|
-
var { resolve:
|
|
72795
|
+
var { resolve: resolve5 } = __require("path");
|
|
72796
72796
|
function readdir(dir, strict) {
|
|
72797
|
-
return new Promise((
|
|
72797
|
+
return new Promise((resolve6, reject) => {
|
|
72798
72798
|
fs10.readdir(dir, { withFileTypes: true }, (err, files) => {
|
|
72799
72799
|
if (err) {
|
|
72800
72800
|
switch (err.code) {
|
|
@@ -72802,14 +72802,14 @@ var require_readdir_glob = __commonJS({
|
|
|
72802
72802
|
if (strict) {
|
|
72803
72803
|
reject(err);
|
|
72804
72804
|
} else {
|
|
72805
|
-
|
|
72805
|
+
resolve6([]);
|
|
72806
72806
|
}
|
|
72807
72807
|
break;
|
|
72808
72808
|
case "ENOTSUP":
|
|
72809
72809
|
case "ENOENT":
|
|
72810
72810
|
case "ENAMETOOLONG":
|
|
72811
72811
|
case "UNKNOWN":
|
|
72812
|
-
|
|
72812
|
+
resolve6([]);
|
|
72813
72813
|
break;
|
|
72814
72814
|
case "ELOOP":
|
|
72815
72815
|
default:
|
|
@@ -72817,30 +72817,30 @@ var require_readdir_glob = __commonJS({
|
|
|
72817
72817
|
break;
|
|
72818
72818
|
}
|
|
72819
72819
|
} else {
|
|
72820
|
-
|
|
72820
|
+
resolve6(files);
|
|
72821
72821
|
}
|
|
72822
72822
|
});
|
|
72823
72823
|
});
|
|
72824
72824
|
}
|
|
72825
72825
|
function stat2(file, followSymlinks) {
|
|
72826
|
-
return new Promise((
|
|
72826
|
+
return new Promise((resolve6, reject) => {
|
|
72827
72827
|
const statFunc = followSymlinks ? fs10.stat : fs10.lstat;
|
|
72828
72828
|
statFunc(file, (err, stats) => {
|
|
72829
72829
|
if (err) {
|
|
72830
72830
|
switch (err.code) {
|
|
72831
72831
|
case "ENOENT":
|
|
72832
72832
|
if (followSymlinks) {
|
|
72833
|
-
|
|
72833
|
+
resolve6(stat2(file, false));
|
|
72834
72834
|
} else {
|
|
72835
|
-
|
|
72835
|
+
resolve6(null);
|
|
72836
72836
|
}
|
|
72837
72837
|
break;
|
|
72838
72838
|
default:
|
|
72839
|
-
|
|
72839
|
+
resolve6(null);
|
|
72840
72840
|
break;
|
|
72841
72841
|
}
|
|
72842
72842
|
} else {
|
|
72843
|
-
|
|
72843
|
+
resolve6(stats);
|
|
72844
72844
|
}
|
|
72845
72845
|
});
|
|
72846
72846
|
});
|
|
@@ -72930,7 +72930,7 @@ var require_readdir_glob = __commonJS({
|
|
|
72930
72930
|
(skip) => new Minimatch(skip, { dot: true })
|
|
72931
72931
|
);
|
|
72932
72932
|
}
|
|
72933
|
-
this.iterator = explore(
|
|
72933
|
+
this.iterator = explore(resolve5(cwd2 || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
|
|
72934
72934
|
this.paused = false;
|
|
72935
72935
|
this.inactive = false;
|
|
72936
72936
|
this.aborted = false;
|
|
@@ -73100,11 +73100,11 @@ var require_async = __commonJS({
|
|
|
73100
73100
|
if (typeof args[arity - 1] === "function") {
|
|
73101
73101
|
return asyncFn.apply(this, args);
|
|
73102
73102
|
}
|
|
73103
|
-
return new Promise((
|
|
73103
|
+
return new Promise((resolve5, reject2) => {
|
|
73104
73104
|
args[arity - 1] = (err, ...cbArgs) => {
|
|
73105
73105
|
if (err)
|
|
73106
73106
|
return reject2(err);
|
|
73107
|
-
|
|
73107
|
+
resolve5(cbArgs.length > 1 ? cbArgs : cbArgs[0]);
|
|
73108
73108
|
};
|
|
73109
73109
|
asyncFn.apply(this, args);
|
|
73110
73110
|
});
|
|
@@ -73359,14 +73359,14 @@ var require_async = __commonJS({
|
|
|
73359
73359
|
var applyEachSeries = applyEach$1(mapSeries$1);
|
|
73360
73360
|
const PROMISE_SYMBOL = Symbol("promiseCallback");
|
|
73361
73361
|
function promiseCallback() {
|
|
73362
|
-
let
|
|
73362
|
+
let resolve5, reject2;
|
|
73363
73363
|
function callback(err, ...args) {
|
|
73364
73364
|
if (err)
|
|
73365
73365
|
return reject2(err);
|
|
73366
|
-
|
|
73366
|
+
resolve5(args.length > 1 ? args : args[0]);
|
|
73367
73367
|
}
|
|
73368
73368
|
callback[PROMISE_SYMBOL] = new Promise((res, rej) => {
|
|
73369
|
-
|
|
73369
|
+
resolve5 = res, reject2 = rej;
|
|
73370
73370
|
});
|
|
73371
73371
|
return callback;
|
|
73372
73372
|
}
|
|
@@ -73735,8 +73735,8 @@ var require_async = __commonJS({
|
|
|
73735
73735
|
});
|
|
73736
73736
|
}
|
|
73737
73737
|
if (rejectOnError || !callback) {
|
|
73738
|
-
return new Promise((
|
|
73739
|
-
res =
|
|
73738
|
+
return new Promise((resolve5, reject2) => {
|
|
73739
|
+
res = resolve5;
|
|
73740
73740
|
rej = reject2;
|
|
73741
73741
|
});
|
|
73742
73742
|
}
|
|
@@ -73775,11 +73775,11 @@ var require_async = __commonJS({
|
|
|
73775
73775
|
}
|
|
73776
73776
|
const eventMethod = (name) => (handler) => {
|
|
73777
73777
|
if (!handler) {
|
|
73778
|
-
return new Promise((
|
|
73778
|
+
return new Promise((resolve5, reject2) => {
|
|
73779
73779
|
once2(name, (err, data) => {
|
|
73780
73780
|
if (err)
|
|
73781
73781
|
return reject2(err);
|
|
73782
|
-
|
|
73782
|
+
resolve5(data);
|
|
73783
73783
|
});
|
|
73784
73784
|
});
|
|
73785
73785
|
}
|
|
@@ -80065,11 +80065,11 @@ var require_core = __commonJS({
|
|
|
80065
80065
|
this._finalize();
|
|
80066
80066
|
}
|
|
80067
80067
|
var self2 = this;
|
|
80068
|
-
return new Promise(function(
|
|
80068
|
+
return new Promise(function(resolve5, reject) {
|
|
80069
80069
|
var errored;
|
|
80070
80070
|
self2._module.on("end", function() {
|
|
80071
80071
|
if (!errored) {
|
|
80072
|
-
|
|
80072
|
+
resolve5();
|
|
80073
80073
|
}
|
|
80074
80074
|
});
|
|
80075
80075
|
self2._module.on("error", function(err) {
|
|
@@ -83916,7 +83916,7 @@ var require_worksheet_writer = __commonJS({
|
|
|
83916
83916
|
// =========================================================================
|
|
83917
83917
|
// Worksheet Protection
|
|
83918
83918
|
protect(password, options) {
|
|
83919
|
-
return new Promise((
|
|
83919
|
+
return new Promise((resolve5) => {
|
|
83920
83920
|
this.sheetProtection = {
|
|
83921
83921
|
sheet: true
|
|
83922
83922
|
};
|
|
@@ -83940,7 +83940,7 @@ var require_worksheet_writer = __commonJS({
|
|
|
83940
83940
|
delete this.sheetProtection.spinCount;
|
|
83941
83941
|
}
|
|
83942
83942
|
}
|
|
83943
|
-
|
|
83943
|
+
resolve5();
|
|
83944
83944
|
});
|
|
83945
83945
|
}
|
|
83946
83946
|
unprotect() {
|
|
@@ -84158,9 +84158,9 @@ var require_workbook_writer = __commonJS({
|
|
|
84158
84158
|
_commitWorksheets() {
|
|
84159
84159
|
const commitWorksheet = function(worksheet) {
|
|
84160
84160
|
if (!worksheet.committed) {
|
|
84161
|
-
return new Promise((
|
|
84161
|
+
return new Promise((resolve5) => {
|
|
84162
84162
|
worksheet.stream.on("zipped", () => {
|
|
84163
|
-
|
|
84163
|
+
resolve5();
|
|
84164
84164
|
});
|
|
84165
84165
|
worksheet.commit();
|
|
84166
84166
|
});
|
|
@@ -84248,19 +84248,19 @@ var require_workbook_writer = __commonJS({
|
|
|
84248
84248
|
return void 0;
|
|
84249
84249
|
}
|
|
84250
84250
|
addStyles() {
|
|
84251
|
-
return new Promise((
|
|
84251
|
+
return new Promise((resolve5) => {
|
|
84252
84252
|
this.zip.append(this.styles.xml, { name: "xl/styles.xml" });
|
|
84253
|
-
|
|
84253
|
+
resolve5();
|
|
84254
84254
|
});
|
|
84255
84255
|
}
|
|
84256
84256
|
addThemes() {
|
|
84257
|
-
return new Promise((
|
|
84257
|
+
return new Promise((resolve5) => {
|
|
84258
84258
|
this.zip.append(theme1Xml, { name: "xl/theme/theme1.xml" });
|
|
84259
|
-
|
|
84259
|
+
resolve5();
|
|
84260
84260
|
});
|
|
84261
84261
|
}
|
|
84262
84262
|
addOfficeRels() {
|
|
84263
|
-
return new Promise((
|
|
84263
|
+
return new Promise((resolve5) => {
|
|
84264
84264
|
const xform = new RelationshipsXform();
|
|
84265
84265
|
const xml = xform.toXml([
|
|
84266
84266
|
{ Id: "rId1", Type: RelType.OfficeDocument, Target: "xl/workbook.xml" },
|
|
@@ -84268,11 +84268,11 @@ var require_workbook_writer = __commonJS({
|
|
|
84268
84268
|
{ Id: "rId3", Type: RelType.ExtenderProperties, Target: "docProps/app.xml" }
|
|
84269
84269
|
]);
|
|
84270
84270
|
this.zip.append(xml, { name: "/_rels/.rels" });
|
|
84271
|
-
|
|
84271
|
+
resolve5();
|
|
84272
84272
|
});
|
|
84273
84273
|
}
|
|
84274
84274
|
addContentTypes() {
|
|
84275
|
-
return new Promise((
|
|
84275
|
+
return new Promise((resolve5) => {
|
|
84276
84276
|
const model = {
|
|
84277
84277
|
worksheets: this._worksheets.filter(Boolean),
|
|
84278
84278
|
sharedStrings: this.sharedStrings,
|
|
@@ -84282,7 +84282,7 @@ var require_workbook_writer = __commonJS({
|
|
|
84282
84282
|
const xform = new ContentTypesXform();
|
|
84283
84283
|
const xml = xform.toXml(model);
|
|
84284
84284
|
this.zip.append(xml, { name: "[Content_Types].xml" });
|
|
84285
|
-
|
|
84285
|
+
resolve5();
|
|
84286
84286
|
});
|
|
84287
84287
|
}
|
|
84288
84288
|
addMedia() {
|
|
@@ -84307,31 +84307,31 @@ var require_workbook_writer = __commonJS({
|
|
|
84307
84307
|
);
|
|
84308
84308
|
}
|
|
84309
84309
|
addApp() {
|
|
84310
|
-
return new Promise((
|
|
84310
|
+
return new Promise((resolve5) => {
|
|
84311
84311
|
const model = {
|
|
84312
84312
|
worksheets: this._worksheets.filter(Boolean)
|
|
84313
84313
|
};
|
|
84314
84314
|
const xform = new AppXform();
|
|
84315
84315
|
const xml = xform.toXml(model);
|
|
84316
84316
|
this.zip.append(xml, { name: "docProps/app.xml" });
|
|
84317
|
-
|
|
84317
|
+
resolve5();
|
|
84318
84318
|
});
|
|
84319
84319
|
}
|
|
84320
84320
|
addCore() {
|
|
84321
|
-
return new Promise((
|
|
84321
|
+
return new Promise((resolve5) => {
|
|
84322
84322
|
const coreXform = new CoreXform();
|
|
84323
84323
|
const xml = coreXform.toXml(this);
|
|
84324
84324
|
this.zip.append(xml, { name: "docProps/core.xml" });
|
|
84325
|
-
|
|
84325
|
+
resolve5();
|
|
84326
84326
|
});
|
|
84327
84327
|
}
|
|
84328
84328
|
addSharedStrings() {
|
|
84329
84329
|
if (this.sharedStrings.count) {
|
|
84330
|
-
return new Promise((
|
|
84330
|
+
return new Promise((resolve5) => {
|
|
84331
84331
|
const sharedStringsXform = new SharedStringsXform();
|
|
84332
84332
|
const xml = sharedStringsXform.toXml(this.sharedStrings);
|
|
84333
84333
|
this.zip.append(xml, { name: "/xl/sharedStrings.xml" });
|
|
84334
|
-
|
|
84334
|
+
resolve5();
|
|
84335
84335
|
});
|
|
84336
84336
|
}
|
|
84337
84337
|
return Promise.resolve();
|
|
@@ -84359,11 +84359,11 @@ var require_workbook_writer = __commonJS({
|
|
|
84359
84359
|
});
|
|
84360
84360
|
}
|
|
84361
84361
|
});
|
|
84362
|
-
return new Promise((
|
|
84362
|
+
return new Promise((resolve5) => {
|
|
84363
84363
|
const xform = new RelationshipsXform();
|
|
84364
84364
|
const xml = xform.toXml(relationships);
|
|
84365
84365
|
this.zip.append(xml, { name: "/xl/_rels/workbook.xml.rels" });
|
|
84366
|
-
|
|
84366
|
+
resolve5();
|
|
84367
84367
|
});
|
|
84368
84368
|
}
|
|
84369
84369
|
addWorkbook() {
|
|
@@ -84375,18 +84375,18 @@ var require_workbook_writer = __commonJS({
|
|
|
84375
84375
|
properties: {},
|
|
84376
84376
|
calcProperties: {}
|
|
84377
84377
|
};
|
|
84378
|
-
return new Promise((
|
|
84378
|
+
return new Promise((resolve5) => {
|
|
84379
84379
|
const xform = new WorkbookXform();
|
|
84380
84380
|
xform.prepare(model);
|
|
84381
84381
|
zip.append(xform.toXml(model), { name: "/xl/workbook.xml" });
|
|
84382
|
-
|
|
84382
|
+
resolve5();
|
|
84383
84383
|
});
|
|
84384
84384
|
}
|
|
84385
84385
|
_finalize() {
|
|
84386
|
-
return new Promise((
|
|
84386
|
+
return new Promise((resolve5, reject) => {
|
|
84387
84387
|
this.stream.on("error", reject);
|
|
84388
84388
|
this.stream.on("finish", () => {
|
|
84389
|
-
|
|
84389
|
+
resolve5(this);
|
|
84390
84390
|
});
|
|
84391
84391
|
this.zip.on("error", reject);
|
|
84392
84392
|
this.zip.finalize();
|
|
@@ -86369,13 +86369,13 @@ var require_thenables = __commonJS({
|
|
|
86369
86369
|
if (context)
|
|
86370
86370
|
context._popContext();
|
|
86371
86371
|
var synchronous = true;
|
|
86372
|
-
var result = util.tryCatch(then).call(x2,
|
|
86372
|
+
var result = util.tryCatch(then).call(x2, resolve5, reject);
|
|
86373
86373
|
synchronous = false;
|
|
86374
86374
|
if (promise && result === errorObj2) {
|
|
86375
86375
|
promise._rejectCallback(result.e, true, true);
|
|
86376
86376
|
promise = null;
|
|
86377
86377
|
}
|
|
86378
|
-
function
|
|
86378
|
+
function resolve5(value) {
|
|
86379
86379
|
if (!promise)
|
|
86380
86380
|
return;
|
|
86381
86381
|
promise._resolveCallback(value);
|
|
@@ -86919,9 +86919,9 @@ var require_debuggability = __commonJS({
|
|
|
86919
86919
|
return false;
|
|
86920
86920
|
}
|
|
86921
86921
|
Promise2.prototype._fireEvent = defaultFireEvent;
|
|
86922
|
-
Promise2.prototype._execute = function(executor,
|
|
86922
|
+
Promise2.prototype._execute = function(executor, resolve5, reject) {
|
|
86923
86923
|
try {
|
|
86924
|
-
executor(
|
|
86924
|
+
executor(resolve5, reject);
|
|
86925
86925
|
} catch (e2) {
|
|
86926
86926
|
return e2;
|
|
86927
86927
|
}
|
|
@@ -86944,10 +86944,10 @@ var require_debuggability = __commonJS({
|
|
|
86944
86944
|
;
|
|
86945
86945
|
;
|
|
86946
86946
|
};
|
|
86947
|
-
function cancellationExecute(executor,
|
|
86947
|
+
function cancellationExecute(executor, resolve5, reject) {
|
|
86948
86948
|
var promise = this;
|
|
86949
86949
|
try {
|
|
86950
|
-
executor(
|
|
86950
|
+
executor(resolve5, reject, function(onCancel) {
|
|
86951
86951
|
if (typeof onCancel !== "function") {
|
|
86952
86952
|
throw new TypeError("onCancel must be a function, got: " + util.toString(onCancel));
|
|
86953
86953
|
}
|
|
@@ -90770,7 +90770,7 @@ var require_PullStream = __commonJS({
|
|
|
90770
90770
|
};
|
|
90771
90771
|
var rejectHandler;
|
|
90772
90772
|
var pullStreamRejectHandler;
|
|
90773
|
-
return new Promise2(function(
|
|
90773
|
+
return new Promise2(function(resolve5, reject) {
|
|
90774
90774
|
rejectHandler = reject;
|
|
90775
90775
|
pullStreamRejectHandler = function(e2) {
|
|
90776
90776
|
self2.__emittedError = e2;
|
|
@@ -90780,7 +90780,7 @@ var require_PullStream = __commonJS({
|
|
|
90780
90780
|
return reject(new Error("FILE_ENDED"));
|
|
90781
90781
|
self2.once("error", pullStreamRejectHandler);
|
|
90782
90782
|
self2.stream(eof, includeEof).on("error", reject).pipe(concatStream).on("finish", function() {
|
|
90783
|
-
|
|
90783
|
+
resolve5(buffer);
|
|
90784
90784
|
}).on("error", reject);
|
|
90785
90785
|
}).finally(function() {
|
|
90786
90786
|
self2.removeListener("error", rejectHandler);
|
|
@@ -90823,10 +90823,10 @@ var require_BufferStream = __commonJS({
|
|
|
90823
90823
|
if (!Stream4.Writable || !Stream4.Writable.prototype.destroy)
|
|
90824
90824
|
Stream4 = require_readable();
|
|
90825
90825
|
module2.exports = function(entry) {
|
|
90826
|
-
return new Promise2(function(
|
|
90826
|
+
return new Promise2(function(resolve5, reject) {
|
|
90827
90827
|
var chunks = [];
|
|
90828
90828
|
var bufferStream = Stream4.Transform().on("finish", function() {
|
|
90829
|
-
|
|
90829
|
+
resolve5(Buffer4.concat(chunks));
|
|
90830
90830
|
}).on("error", reject);
|
|
90831
90831
|
bufferStream._transform = function(d, e2, cb) {
|
|
90832
90832
|
chunks.push(d);
|
|
@@ -90966,8 +90966,8 @@ var require_parse = __commonJS({
|
|
|
90966
90966
|
__autodraining = true;
|
|
90967
90967
|
var draining = entry.pipe(NoopStream());
|
|
90968
90968
|
draining.promise = function() {
|
|
90969
|
-
return new Promise2(function(
|
|
90970
|
-
draining.on("finish",
|
|
90969
|
+
return new Promise2(function(resolve5, reject) {
|
|
90970
|
+
draining.on("finish", resolve5);
|
|
90971
90971
|
draining.on("error", reject);
|
|
90972
90972
|
});
|
|
90973
90973
|
};
|
|
@@ -91022,11 +91022,11 @@ var require_parse = __commonJS({
|
|
|
91022
91022
|
eof = Buffer4.alloc(4);
|
|
91023
91023
|
eof.writeUInt32LE(134695760, 0);
|
|
91024
91024
|
}
|
|
91025
|
-
return new Promise2(function(
|
|
91025
|
+
return new Promise2(function(resolve5, reject) {
|
|
91026
91026
|
self2.stream(eof).pipe(inflater).on("error", function(err) {
|
|
91027
91027
|
self2.emit("error", err);
|
|
91028
91028
|
}).pipe(entry).on("finish", function() {
|
|
91029
|
-
return fileSizeKnown ? self2._readRecord().then(
|
|
91029
|
+
return fileSizeKnown ? self2._readRecord().then(resolve5).catch(reject) : self2._processDataDescriptor(entry).then(resolve5).catch(reject);
|
|
91030
91030
|
});
|
|
91031
91031
|
});
|
|
91032
91032
|
});
|
|
@@ -91068,8 +91068,8 @@ var require_parse = __commonJS({
|
|
|
91068
91068
|
};
|
|
91069
91069
|
Parse.prototype.promise = function() {
|
|
91070
91070
|
var self2 = this;
|
|
91071
|
-
return new Promise2(function(
|
|
91072
|
-
self2.on("finish",
|
|
91071
|
+
return new Promise2(function(resolve5, reject) {
|
|
91072
|
+
self2.on("finish", resolve5);
|
|
91073
91073
|
self2.on("error", reject);
|
|
91074
91074
|
});
|
|
91075
91075
|
};
|
|
@@ -93150,8 +93150,8 @@ var require_extract2 = __commonJS({
|
|
|
93150
93150
|
extract.emit("close");
|
|
93151
93151
|
});
|
|
93152
93152
|
extract.promise = function() {
|
|
93153
|
-
return new Promise2(function(
|
|
93154
|
-
extract.on("close",
|
|
93153
|
+
return new Promise2(function(resolve5, reject) {
|
|
93154
|
+
extract.on("close", resolve5);
|
|
93155
93155
|
extract.on("error", reject);
|
|
93156
93156
|
});
|
|
93157
93157
|
};
|
|
@@ -94762,8 +94762,8 @@ var require_directory = __commonJS({
|
|
|
94762
94762
|
return;
|
|
94763
94763
|
}
|
|
94764
94764
|
var writer = opts.getWriter ? opts.getWriter({ path: extractPath }) : Writer({ path: extractPath });
|
|
94765
|
-
return new Promise2(function(
|
|
94766
|
-
entry.stream(opts.password).on("error", reject).pipe(writer).on("close",
|
|
94765
|
+
return new Promise2(function(resolve5, reject) {
|
|
94766
|
+
entry.stream(opts.password).on("error", reject).pipe(writer).on("close", resolve5).on("error", reject);
|
|
94767
94767
|
});
|
|
94768
94768
|
}, { concurrency: opts.concurrency > 1 ? opts.concurrency : 1 });
|
|
94769
94769
|
});
|
|
@@ -94829,12 +94829,12 @@ var require_Open = __commonJS({
|
|
|
94829
94829
|
return fs10.createReadStream(filename, { start: offset, end: length && offset + length });
|
|
94830
94830
|
},
|
|
94831
94831
|
size: function() {
|
|
94832
|
-
return new Promise2(function(
|
|
94832
|
+
return new Promise2(function(resolve5, reject) {
|
|
94833
94833
|
fs10.stat(filename, function(err, d) {
|
|
94834
94834
|
if (err)
|
|
94835
94835
|
reject(err);
|
|
94836
94836
|
else
|
|
94837
|
-
|
|
94837
|
+
resolve5(d.size);
|
|
94838
94838
|
});
|
|
94839
94839
|
});
|
|
94840
94840
|
}
|
|
@@ -94855,14 +94855,14 @@ var require_Open = __commonJS({
|
|
|
94855
94855
|
return request(options2);
|
|
94856
94856
|
},
|
|
94857
94857
|
size: function() {
|
|
94858
|
-
return new Promise2(function(
|
|
94858
|
+
return new Promise2(function(resolve5, reject) {
|
|
94859
94859
|
var req = request(params);
|
|
94860
94860
|
req.on("response", function(d) {
|
|
94861
94861
|
req.abort();
|
|
94862
94862
|
if (!d.headers["content-length"])
|
|
94863
94863
|
reject(new Error("Missing content length header"));
|
|
94864
94864
|
else
|
|
94865
|
-
|
|
94865
|
+
resolve5(d.headers["content-length"]);
|
|
94866
94866
|
}).on("error", reject);
|
|
94867
94867
|
});
|
|
94868
94868
|
}
|
|
@@ -94872,12 +94872,12 @@ var require_Open = __commonJS({
|
|
|
94872
94872
|
s3: function(client, params, options) {
|
|
94873
94873
|
var source2 = {
|
|
94874
94874
|
size: function() {
|
|
94875
|
-
return new Promise2(function(
|
|
94875
|
+
return new Promise2(function(resolve5, reject) {
|
|
94876
94876
|
client.headObject(params, function(err, d) {
|
|
94877
94877
|
if (err)
|
|
94878
94878
|
reject(err);
|
|
94879
94879
|
else
|
|
94880
|
-
|
|
94880
|
+
resolve5(d.ContentLength);
|
|
94881
94881
|
});
|
|
94882
94882
|
});
|
|
94883
94883
|
},
|
|
@@ -95315,7 +95315,7 @@ var require_iterate_stream = __commonJS({
|
|
|
95315
95315
|
const contents = [];
|
|
95316
95316
|
stream.on("data", (data) => contents.push(data));
|
|
95317
95317
|
let resolveStreamEndedPromise;
|
|
95318
|
-
const streamEndedPromise = new Promise((
|
|
95318
|
+
const streamEndedPromise = new Promise((resolve5) => resolveStreamEndedPromise = resolve5);
|
|
95319
95319
|
let ended = false;
|
|
95320
95320
|
stream.on("end", () => {
|
|
95321
95321
|
ended = true;
|
|
@@ -95341,13 +95341,13 @@ var require_iterate_stream = __commonJS({
|
|
|
95341
95341
|
resolveStreamEndedPromise();
|
|
95342
95342
|
};
|
|
95343
95343
|
function once(eventEmitter, type) {
|
|
95344
|
-
return new Promise((
|
|
95344
|
+
return new Promise((resolve5) => {
|
|
95345
95345
|
let fired = false;
|
|
95346
95346
|
const handler = () => {
|
|
95347
95347
|
if (!fired) {
|
|
95348
95348
|
fired = true;
|
|
95349
95349
|
eventEmitter.removeListener(type, handler);
|
|
95350
|
-
|
|
95350
|
+
resolve5();
|
|
95351
95351
|
}
|
|
95352
95352
|
};
|
|
95353
95353
|
eventEmitter.addListener(type, handler);
|
|
@@ -95872,7 +95872,7 @@ var require_workbook_reader = __commonJS({
|
|
|
95872
95872
|
if (this.sharedStrings && this.workbookRels) {
|
|
95873
95873
|
yield* this._parseWorksheet(iterateStream(entry), sheetNo);
|
|
95874
95874
|
} else {
|
|
95875
|
-
await new Promise((
|
|
95875
|
+
await new Promise((resolve5, reject) => {
|
|
95876
95876
|
tmp.file((err, path9, fd, tempFileCleanupCallback) => {
|
|
95877
95877
|
if (err) {
|
|
95878
95878
|
return reject(err);
|
|
@@ -95882,7 +95882,7 @@ var require_workbook_reader = __commonJS({
|
|
|
95882
95882
|
tempStream.on("error", reject);
|
|
95883
95883
|
entry.pipe(tempStream);
|
|
95884
95884
|
return tempStream.on("finish", () => {
|
|
95885
|
-
return
|
|
95885
|
+
return resolve5();
|
|
95886
95886
|
});
|
|
95887
95887
|
});
|
|
95888
95888
|
});
|
|
@@ -96116,11 +96116,11 @@ var require_pptxgen_cjs = __commonJS({
|
|
|
96116
96116
|
var JSZip = require_lib3();
|
|
96117
96117
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
96118
96118
|
function adopt(value) {
|
|
96119
|
-
return value instanceof P ? value : new P(function(
|
|
96120
|
-
|
|
96119
|
+
return value instanceof P ? value : new P(function(resolve5) {
|
|
96120
|
+
resolve5(value);
|
|
96121
96121
|
});
|
|
96122
96122
|
}
|
|
96123
|
-
return new (P || (P = Promise))(function(
|
|
96123
|
+
return new (P || (P = Promise))(function(resolve5, reject) {
|
|
96124
96124
|
function fulfilled(value) {
|
|
96125
96125
|
try {
|
|
96126
96126
|
step(generator.next(value));
|
|
@@ -96136,7 +96136,7 @@ var require_pptxgen_cjs = __commonJS({
|
|
|
96136
96136
|
}
|
|
96137
96137
|
}
|
|
96138
96138
|
function step(result) {
|
|
96139
|
-
result.done ?
|
|
96139
|
+
result.done ? resolve5(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
96140
96140
|
}
|
|
96141
96141
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
96142
96142
|
});
|
|
@@ -98297,7 +98297,7 @@ var require_pptxgen_cjs = __commonJS({
|
|
|
98297
98297
|
function createExcelWorksheet(chartObject, zip) {
|
|
98298
98298
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98299
98299
|
const data = chartObject.data;
|
|
98300
|
-
return yield new Promise((
|
|
98300
|
+
return yield new Promise((resolve5, reject) => {
|
|
98301
98301
|
var _a, _b;
|
|
98302
98302
|
const zipExcel = new JSZip();
|
|
98303
98303
|
const intBubbleCols = (data.length - 1) * 2 + 1;
|
|
@@ -98507,7 +98507,7 @@ var require_pptxgen_cjs = __commonJS({
|
|
|
98507
98507
|
zip.file(`ppt/embeddings/Microsoft_Excel_Worksheet${chartObject.globalId}.xlsx`, content, { base64: true });
|
|
98508
98508
|
zip.file("ppt/charts/_rels/" + chartObject.fileName + ".rels", `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package" Target="../embeddings/Microsoft_Excel_Worksheet${chartObject.globalId}.xlsx"/></Relationships>`);
|
|
98509
98509
|
zip.file(`ppt/charts/${chartObject.fileName}`, makeXmlCharts(chartObject));
|
|
98510
|
-
|
|
98510
|
+
resolve5("");
|
|
98511
98511
|
}).catch((strErr) => {
|
|
98512
98512
|
reject(strErr);
|
|
98513
98513
|
});
|
|
@@ -99712,7 +99712,7 @@ ${String(ex)}`);
|
|
|
99712
99712
|
}
|
|
99713
99713
|
}
|
|
99714
99714
|
if (isNode3 && https3 && rel.path.startsWith("http")) {
|
|
99715
|
-
return yield new Promise((
|
|
99715
|
+
return yield new Promise((resolve5, reject) => {
|
|
99716
99716
|
https3.get(rel.path, (res) => {
|
|
99717
99717
|
let raw = "";
|
|
99718
99718
|
res.setEncoding("binary");
|
|
@@ -99720,7 +99720,7 @@ ${String(ex)}`);
|
|
|
99720
99720
|
res.on("end", () => {
|
|
99721
99721
|
rel.data = Buffer.from(raw, "binary").toString("base64");
|
|
99722
99722
|
candidateRels.filter((dupe) => dupe.isDuplicate && dupe.path === rel.path).forEach((dupe) => dupe.data = rel.data);
|
|
99723
|
-
|
|
99723
|
+
resolve5("done");
|
|
99724
99724
|
});
|
|
99725
99725
|
res.on("error", () => {
|
|
99726
99726
|
rel.data = IMG_BROKEN;
|
|
@@ -99730,7 +99730,7 @@ ${String(ex)}`);
|
|
|
99730
99730
|
});
|
|
99731
99731
|
});
|
|
99732
99732
|
}
|
|
99733
|
-
return yield new Promise((
|
|
99733
|
+
return yield new Promise((resolve5, reject) => {
|
|
99734
99734
|
const xhr = new XMLHttpRequest();
|
|
99735
99735
|
xhr.onload = () => {
|
|
99736
99736
|
const reader = new FileReader();
|
|
@@ -99738,9 +99738,9 @@ ${String(ex)}`);
|
|
|
99738
99738
|
rel.data = reader.result;
|
|
99739
99739
|
candidateRels.filter((dupe) => dupe.isDuplicate && dupe.path === rel.path).forEach((dupe) => dupe.data = rel.data);
|
|
99740
99740
|
if (!rel.isSvgPng) {
|
|
99741
|
-
|
|
99741
|
+
resolve5("done");
|
|
99742
99742
|
} else {
|
|
99743
|
-
createSvgPngPreview(rel).then(() =>
|
|
99743
|
+
createSvgPngPreview(rel).then(() => resolve5("done")).catch(reject);
|
|
99744
99744
|
}
|
|
99745
99745
|
};
|
|
99746
99746
|
reader.readAsDataURL(xhr.response);
|
|
@@ -99772,7 +99772,7 @@ ${String(ex)}`);
|
|
|
99772
99772
|
}
|
|
99773
99773
|
function createSvgPngPreview(rel) {
|
|
99774
99774
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99775
|
-
return yield new Promise((
|
|
99775
|
+
return yield new Promise((resolve5, reject) => {
|
|
99776
99776
|
const image2 = new Image();
|
|
99777
99777
|
image2.onload = () => {
|
|
99778
99778
|
if (image2.width + image2.height === 0) {
|
|
@@ -99785,7 +99785,7 @@ ${String(ex)}`);
|
|
|
99785
99785
|
ctx.drawImage(image2, 0, 0);
|
|
99786
99786
|
try {
|
|
99787
99787
|
rel.data = canvas.toDataURL(rel.type);
|
|
99788
|
-
|
|
99788
|
+
resolve5("done");
|
|
99789
99789
|
} catch (ex) {
|
|
99790
99790
|
image2.onerror(ex.toString());
|
|
99791
99791
|
}
|
|
@@ -101620,7 +101620,7 @@ var require_executor = __commonJS({
|
|
|
101620
101620
|
return `${String(offset + indexInKept + 1).padStart(4, " ")} ${line}`;
|
|
101621
101621
|
}
|
|
101622
101622
|
async function readFileWindowed(resolved, offset, requestedLimit) {
|
|
101623
|
-
return new Promise((
|
|
101623
|
+
return new Promise((resolve5) => {
|
|
101624
101624
|
const explicitLimit = requestedLimit > 0;
|
|
101625
101625
|
const lineScanCap = explicitLimit ? Math.min(requestedLimit, MAX_READ_LINES) : MAX_READ_LINES;
|
|
101626
101626
|
const hardEndLine = offset + lineScanCap;
|
|
@@ -101651,7 +101651,7 @@ var require_executor = __commonJS({
|
|
|
101651
101651
|
stopped = true;
|
|
101652
101652
|
stream.destroy();
|
|
101653
101653
|
if (hitTokenCap && explicitLimit) {
|
|
101654
|
-
|
|
101654
|
+
resolve5({
|
|
101655
101655
|
error: `Requested range (offset:${offset}, limit:${requestedLimit}) is too large \u2014 exceeds ${MAX_READ_TOKENS} tokens. Pass a smaller limit, or use search_files to locate the relevant part first.`
|
|
101656
101656
|
});
|
|
101657
101657
|
return;
|
|
@@ -101661,7 +101661,7 @@ var require_executor = __commonJS({
|
|
|
101661
101661
|
const numbered = kept.map((l2, i2) => formatNumberedLine(offset, i2, l2)).join("\n");
|
|
101662
101662
|
const totalNote = sawEof ? `/${lineNo}` : "";
|
|
101663
101663
|
const note = sawEof ? ` (reached end of file at line ${last})` : ` (more lines follow \u2014 pass offset:${last} to continue, or search_files to locate the relevant part)`;
|
|
101664
|
-
|
|
101664
|
+
resolve5({ output: `[File: ${resolved} \u2014 lines ${first}-${last}${totalNote}${note}]
|
|
101665
101665
|
${numbered}` });
|
|
101666
101666
|
};
|
|
101667
101667
|
stream.on("data", (chunk) => {
|
|
@@ -101710,7 +101710,7 @@ ${numbered}` });
|
|
|
101710
101710
|
stream.on("error", (err) => {
|
|
101711
101711
|
if (!stopped) {
|
|
101712
101712
|
stopped = true;
|
|
101713
|
-
|
|
101713
|
+
resolve5({ error: err.message });
|
|
101714
101714
|
}
|
|
101715
101715
|
});
|
|
101716
101716
|
});
|
|
@@ -102133,7 +102133,7 @@ ${fresh || "(no new output)"}${trunc}` };
|
|
|
102133
102133
|
}
|
|
102134
102134
|
if (background)
|
|
102135
102135
|
return startBackgroundShell(effectiveCommand, command, workDir, sandboxNote);
|
|
102136
|
-
return new Promise((
|
|
102136
|
+
return new Promise((resolve5) => {
|
|
102137
102137
|
const prependNote = (r2) => {
|
|
102138
102138
|
if (!sandboxNote)
|
|
102139
102139
|
return r2;
|
|
@@ -102253,15 +102253,15 @@ ${tail}`;
|
|
|
102253
102253
|
settled = true;
|
|
102254
102254
|
const body = collect();
|
|
102255
102255
|
if (timedOut) {
|
|
102256
|
-
|
|
102256
|
+
resolve5(prependNote({ error: `Command timed out after ${timeoutMs}ms`, interrupted: true, output: body ? `Partial output before timeout:
|
|
102257
102257
|
${body}` : void 0 }));
|
|
102258
102258
|
} else if (abortSignal?.aborted) {
|
|
102259
|
-
|
|
102259
|
+
resolve5({ error: "Command stopped by user", interrupted: true, output: body || void 0 });
|
|
102260
102260
|
} else if (code !== 0) {
|
|
102261
|
-
|
|
102261
|
+
resolve5(prependNote({ output: body + `
|
|
102262
102262
|
[Exit code: ${code ?? signal ?? "unknown"}]`, exitCode: code ?? 1 }));
|
|
102263
102263
|
} else {
|
|
102264
|
-
|
|
102264
|
+
resolve5(prependNote({ output: body, exitCode: 0 }));
|
|
102265
102265
|
}
|
|
102266
102266
|
};
|
|
102267
102267
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -102285,7 +102285,7 @@ ${body}` : void 0 }));
|
|
|
102285
102285
|
settled = true;
|
|
102286
102286
|
clearInterval(pollAbort);
|
|
102287
102287
|
clearTimeout(timer);
|
|
102288
|
-
|
|
102288
|
+
resolve5({ error: err.message });
|
|
102289
102289
|
});
|
|
102290
102290
|
const timer = setTimeout(() => {
|
|
102291
102291
|
if (settled)
|
|
@@ -102330,7 +102330,7 @@ ${body}` : void 0 }));
|
|
|
102330
102330
|
${(0, safeSlice_1.sliceSafeStart)(output, output.length - tailLen)}`;
|
|
102331
102331
|
}
|
|
102332
102332
|
function runCapture(cmd, args, opts) {
|
|
102333
|
-
return new Promise((
|
|
102333
|
+
return new Promise((resolve5) => {
|
|
102334
102334
|
let stdout = "";
|
|
102335
102335
|
let stderr = "";
|
|
102336
102336
|
let bytes = 0;
|
|
@@ -102340,7 +102340,7 @@ ${(0, safeSlice_1.sliceSafeStart)(output, output.length - tailLen)}`;
|
|
|
102340
102340
|
try {
|
|
102341
102341
|
child = (0, child_process_1.spawn)(cmd, args, { cwd: opts.cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
102342
102342
|
} catch (e2) {
|
|
102343
|
-
|
|
102343
|
+
resolve5({ stdout: "", stderr: "", status: null, signal: null, error: e2 });
|
|
102344
102344
|
return;
|
|
102345
102345
|
}
|
|
102346
102346
|
const finish = (status, signal) => {
|
|
@@ -102348,7 +102348,7 @@ ${(0, safeSlice_1.sliceSafeStart)(output, output.length - tailLen)}`;
|
|
|
102348
102348
|
return;
|
|
102349
102349
|
settled = true;
|
|
102350
102350
|
clearTimeout(timer);
|
|
102351
|
-
|
|
102351
|
+
resolve5({ stdout, stderr, status, signal, ...error ? { error } : {} });
|
|
102352
102352
|
};
|
|
102353
102353
|
const kill = (code) => {
|
|
102354
102354
|
if (!error)
|
|
@@ -103065,7 +103065,7 @@ ${json.text}
|
|
|
103065
103065
|
if (ssrfError)
|
|
103066
103066
|
return { error: ssrfError };
|
|
103067
103067
|
const allowLocal = ["1", "true", "on"].includes((process.env.NEXRALL_ALLOW_LOCAL_FETCH ?? "").toLowerCase());
|
|
103068
|
-
return new Promise((
|
|
103068
|
+
return new Promise((resolve5) => {
|
|
103069
103069
|
const transport = parsedUrl.protocol === "https:" ? https3 : http3;
|
|
103070
103070
|
const guardedLookup = (hostname, opts, cb) => {
|
|
103071
103071
|
const callback = typeof opts === "function" ? opts : cb;
|
|
@@ -103088,7 +103088,7 @@ ${json.text}
|
|
|
103088
103088
|
settled = true;
|
|
103089
103089
|
if (abortPoll !== void 0)
|
|
103090
103090
|
clearInterval(abortPoll);
|
|
103091
|
-
|
|
103091
|
+
resolve5(result);
|
|
103092
103092
|
};
|
|
103093
103093
|
let abortPoll;
|
|
103094
103094
|
if (abortSignal) {
|
|
@@ -103640,7 +103640,7 @@ ${lines.join("\n")}`;
|
|
|
103640
103640
|
}
|
|
103641
103641
|
var VALID_ASPECT_RATIOS = /* @__PURE__ */ new Set(["1:1", "9:16", "16:9", "3:4", "4:3", "3:2", "2:3", "5:4", "4:5", "21:9", "auto"]);
|
|
103642
103642
|
function _httpsPost(url, body, headers, timeoutMs = 3e4, abortSignal) {
|
|
103643
|
-
return new Promise((
|
|
103643
|
+
return new Promise((resolve5, reject) => {
|
|
103644
103644
|
const u = new URL(url);
|
|
103645
103645
|
const chunks = [];
|
|
103646
103646
|
let settled = false;
|
|
@@ -103656,7 +103656,7 @@ ${lines.join("\n")}`;
|
|
|
103656
103656
|
const mod = u.protocol === "http:" ? http3 : https3;
|
|
103657
103657
|
const req = mod.request({ hostname: u.hostname, ...u.port ? { port: Number(u.port) } : {}, path: u.pathname + u.search, method: "POST", headers: { ...headers, "Content-Length": Buffer.byteLength(body) }, timeout: timeoutMs }, (res) => {
|
|
103658
103658
|
res.on("data", (c) => chunks.push(c));
|
|
103659
|
-
res.on("end", () => done(() =>
|
|
103659
|
+
res.on("end", () => done(() => resolve5({ status: res.statusCode ?? 0, body: Buffer.concat(chunks).toString("utf-8") })));
|
|
103660
103660
|
});
|
|
103661
103661
|
req.on("timeout", () => {
|
|
103662
103662
|
req.destroy();
|
|
@@ -103676,7 +103676,7 @@ ${lines.join("\n")}`;
|
|
|
103676
103676
|
});
|
|
103677
103677
|
}
|
|
103678
103678
|
function _httpsGet(url, headers, timeoutMs = 2e4, abortSignal) {
|
|
103679
|
-
return new Promise((
|
|
103679
|
+
return new Promise((resolve5, reject) => {
|
|
103680
103680
|
const u = new URL(url);
|
|
103681
103681
|
const transport = u.protocol === "https:" ? https3 : http3;
|
|
103682
103682
|
const chunks = [];
|
|
@@ -103694,12 +103694,12 @@ ${lines.join("\n")}`;
|
|
|
103694
103694
|
if ((res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307 || res.statusCode === 308) && res.headers.location) {
|
|
103695
103695
|
req.destroy();
|
|
103696
103696
|
done(() => {
|
|
103697
|
-
_httpsGet(new URL(res.headers.location, url).href, headers, timeoutMs, abortSignal).then(
|
|
103697
|
+
_httpsGet(new URL(res.headers.location, url).href, headers, timeoutMs, abortSignal).then(resolve5, reject);
|
|
103698
103698
|
});
|
|
103699
103699
|
return;
|
|
103700
103700
|
}
|
|
103701
103701
|
res.on("data", (c) => chunks.push(c));
|
|
103702
|
-
res.on("end", () => done(() =>
|
|
103702
|
+
res.on("end", () => done(() => resolve5({ status: res.statusCode ?? 0, body: Buffer.concat(chunks), contentType: res.headers["content-type"] ?? "" })));
|
|
103703
103703
|
});
|
|
103704
103704
|
req.on("timeout", () => {
|
|
103705
103705
|
req.destroy();
|
|
@@ -106496,7 +106496,7 @@ var require_loop = __commonJS({
|
|
|
106496
106496
|
return merged;
|
|
106497
106497
|
}
|
|
106498
106498
|
function spawnHook(command, opts) {
|
|
106499
|
-
return new Promise((
|
|
106499
|
+
return new Promise((resolve5) => {
|
|
106500
106500
|
let stdout = "";
|
|
106501
106501
|
let stderr = "";
|
|
106502
106502
|
let settled = false;
|
|
@@ -106505,13 +106505,13 @@ var require_loop = __commonJS({
|
|
|
106505
106505
|
return;
|
|
106506
106506
|
settled = true;
|
|
106507
106507
|
clearTimeout(timer);
|
|
106508
|
-
|
|
106508
|
+
resolve5({ status, stdout, stderr });
|
|
106509
106509
|
};
|
|
106510
106510
|
let child;
|
|
106511
106511
|
try {
|
|
106512
106512
|
child = (0, child_process_1.spawn)(command, { shell: true, cwd: opts.cwd, env: opts.env ?? process.env, stdio: ["pipe", "pipe", "pipe"] });
|
|
106513
106513
|
} catch {
|
|
106514
|
-
|
|
106514
|
+
resolve5({ status: null, stdout: "", stderr: "" });
|
|
106515
106515
|
return;
|
|
106516
106516
|
}
|
|
106517
106517
|
const timer = setTimeout(() => {
|
|
@@ -106807,7 +106807,7 @@ ${ctx.repeatError}
|
|
|
106807
106807
|
};
|
|
106808
106808
|
return async (fn) => {
|
|
106809
106809
|
if (active >= max)
|
|
106810
|
-
await new Promise((
|
|
106810
|
+
await new Promise((resolve5) => queue.push(resolve5));
|
|
106811
106811
|
active++;
|
|
106812
106812
|
try {
|
|
106813
106813
|
return await fn();
|
|
@@ -107030,10 +107030,10 @@ ${m2.text}`).join("\n\n");
|
|
|
107030
107030
|
exports2.ToolNotAllowedError = ToolNotAllowedError;
|
|
107031
107031
|
function extractSubTaskText(messages, preferLast = true) {
|
|
107032
107032
|
const assistants = messages.filter((m2) => m2.role === "assistant");
|
|
107033
|
-
const
|
|
107033
|
+
const textOf2 = (m2) => (m2?.content ?? []).filter((b) => b.type === "text" && typeof b.text === "string").map((b) => b.text).join("").trim();
|
|
107034
107034
|
if (preferLast)
|
|
107035
|
-
return
|
|
107036
|
-
return assistants.map(
|
|
107035
|
+
return textOf2(assistants[assistants.length - 1]);
|
|
107036
|
+
return assistants.map(textOf2).filter(Boolean).join("\n\n").trim();
|
|
107037
107037
|
}
|
|
107038
107038
|
function capSubTaskText(text, max = SUBTASK_MAX) {
|
|
107039
107039
|
if (text.length <= max)
|
|
@@ -107118,13 +107118,13 @@ ${body}`);
|
|
|
107118
107118
|
return Number.isFinite(v) && v > 0 ? v : 3e4;
|
|
107119
107119
|
}
|
|
107120
107120
|
function raceHardStop(run, abort) {
|
|
107121
|
-
return new Promise((
|
|
107121
|
+
return new Promise((resolve5, reject) => {
|
|
107122
107122
|
let grace = null;
|
|
107123
107123
|
const poll = setInterval(() => {
|
|
107124
107124
|
if (abort.aborted && !grace) {
|
|
107125
107125
|
grace = setTimeout(() => {
|
|
107126
107126
|
clearInterval(poll);
|
|
107127
|
-
|
|
107127
|
+
resolve5(HARD_STOPPED);
|
|
107128
107128
|
}, hardStopGraceMs());
|
|
107129
107129
|
}
|
|
107130
107130
|
}, 250);
|
|
@@ -107135,7 +107135,7 @@ ${body}`);
|
|
|
107135
107135
|
};
|
|
107136
107136
|
run.then((v) => {
|
|
107137
107137
|
settle();
|
|
107138
|
-
|
|
107138
|
+
resolve5(v);
|
|
107139
107139
|
}, (e2) => {
|
|
107140
107140
|
settle();
|
|
107141
107141
|
reject(e2);
|
|
@@ -107150,13 +107150,13 @@ ${body}`);
|
|
|
107150
107150
|
function stopAwaiting(run, abort) {
|
|
107151
107151
|
if (!abort)
|
|
107152
107152
|
return run;
|
|
107153
|
-
return new Promise((
|
|
107153
|
+
return new Promise((resolve5, reject) => {
|
|
107154
107154
|
let grace = null;
|
|
107155
107155
|
const poll = setInterval(() => {
|
|
107156
107156
|
if (abort.aborted && !grace)
|
|
107157
107157
|
grace = setTimeout(() => {
|
|
107158
107158
|
clearInterval(poll);
|
|
107159
|
-
|
|
107159
|
+
resolve5(STOP_TIMEOUT_RESULT);
|
|
107160
107160
|
}, STOP_GRACE_MS);
|
|
107161
107161
|
}, 200);
|
|
107162
107162
|
const settle = () => {
|
|
@@ -107166,7 +107166,7 @@ ${body}`);
|
|
|
107166
107166
|
};
|
|
107167
107167
|
run.then((v) => {
|
|
107168
107168
|
settle();
|
|
107169
|
-
|
|
107169
|
+
resolve5(v);
|
|
107170
107170
|
}, (e2) => {
|
|
107171
107171
|
settle();
|
|
107172
107172
|
reject(e2);
|
|
@@ -108928,9 +108928,9 @@ var require_client2 = __commonJS({
|
|
|
108928
108928
|
}
|
|
108929
108929
|
// ─── Private ────────────────────────────────────────────────────────────────
|
|
108930
108930
|
_request(method, params) {
|
|
108931
|
-
return new Promise((
|
|
108931
|
+
return new Promise((resolve5, reject) => {
|
|
108932
108932
|
const id = this._nextId++;
|
|
108933
|
-
this._pending.set(id, { resolve:
|
|
108933
|
+
this._pending.set(id, { resolve: resolve5, reject });
|
|
108934
108934
|
this._send({ jsonrpc: "2.0", id, method, params });
|
|
108935
108935
|
setTimeout(() => {
|
|
108936
108936
|
if (this._pending.has(id)) {
|
|
@@ -109200,7 +109200,7 @@ var require_sseClient = __commonJS({
|
|
|
109200
109200
|
if (!this._closed)
|
|
109201
109201
|
this._onStreamClosed(err);
|
|
109202
109202
|
});
|
|
109203
|
-
await new Promise((
|
|
109203
|
+
await new Promise((resolve5, reject) => {
|
|
109204
109204
|
const timer = setTimeout(() => {
|
|
109205
109205
|
this._endpointWaiter = null;
|
|
109206
109206
|
reject(new Error("Timed out waiting for SSE endpoint event"));
|
|
@@ -109208,7 +109208,7 @@ var require_sseClient = __commonJS({
|
|
|
109208
109208
|
this._endpointWaiter = {
|
|
109209
109209
|
resolve: () => {
|
|
109210
109210
|
clearTimeout(timer);
|
|
109211
|
-
|
|
109211
|
+
resolve5();
|
|
109212
109212
|
},
|
|
109213
109213
|
reject: (e2) => {
|
|
109214
109214
|
clearTimeout(timer);
|
|
@@ -109277,23 +109277,23 @@ var require_sseClient = __commonJS({
|
|
|
109277
109277
|
return;
|
|
109278
109278
|
}
|
|
109279
109279
|
if (typeof msg.id === "number" && this._pending.has(msg.id)) {
|
|
109280
|
-
const { resolve:
|
|
109280
|
+
const { resolve: resolve5, reject, timer } = this._pending.get(msg.id);
|
|
109281
109281
|
clearTimeout(timer);
|
|
109282
109282
|
this._pending.delete(msg.id);
|
|
109283
109283
|
if (msg.error)
|
|
109284
109284
|
reject(new Error(`MCP error ${msg.error.code}: ${msg.error.message}`));
|
|
109285
109285
|
else
|
|
109286
|
-
|
|
109286
|
+
resolve5(msg.result ?? null);
|
|
109287
109287
|
}
|
|
109288
109288
|
}
|
|
109289
109289
|
_rpc(method, params) {
|
|
109290
109290
|
const id = this._nextId++;
|
|
109291
|
-
const promise = new Promise((
|
|
109291
|
+
const promise = new Promise((resolve5, reject) => {
|
|
109292
109292
|
const timer = setTimeout(() => {
|
|
109293
109293
|
this._pending.delete(id);
|
|
109294
109294
|
reject(new Error(`MCP SSE request "${method}" timed out`));
|
|
109295
109295
|
}, REQUEST_TIMEOUT_MS);
|
|
109296
|
-
this._pending.set(id, { resolve:
|
|
109296
|
+
this._pending.set(id, { resolve: resolve5, reject, timer });
|
|
109297
109297
|
});
|
|
109298
109298
|
this._postMessage({ jsonrpc: "2.0", id, method, params }).catch((err) => {
|
|
109299
109299
|
const entry = this._pending.get(id);
|
|
@@ -111745,14 +111745,14 @@ var require_react_development = __commonJS({
|
|
|
111745
111745
|
);
|
|
111746
111746
|
actScopeDepth = prevActScopeDepth;
|
|
111747
111747
|
}
|
|
111748
|
-
function recursivelyFlushAsyncActWork(returnValue,
|
|
111748
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve5, reject) {
|
|
111749
111749
|
var queue = ReactSharedInternals.actQueue;
|
|
111750
111750
|
if (null !== queue)
|
|
111751
111751
|
if (0 !== queue.length)
|
|
111752
111752
|
try {
|
|
111753
111753
|
flushActQueue(queue);
|
|
111754
111754
|
enqueueTask(function() {
|
|
111755
|
-
return recursivelyFlushAsyncActWork(returnValue,
|
|
111755
|
+
return recursivelyFlushAsyncActWork(returnValue, resolve5, reject);
|
|
111756
111756
|
});
|
|
111757
111757
|
return;
|
|
111758
111758
|
} catch (error) {
|
|
@@ -111760,7 +111760,7 @@ var require_react_development = __commonJS({
|
|
|
111760
111760
|
}
|
|
111761
111761
|
else
|
|
111762
111762
|
ReactSharedInternals.actQueue = null;
|
|
111763
|
-
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) :
|
|
111763
|
+
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve5(returnValue);
|
|
111764
111764
|
}
|
|
111765
111765
|
function flushActQueue(queue) {
|
|
111766
111766
|
if (!isFlushing) {
|
|
@@ -111949,7 +111949,7 @@ var require_react_development = __commonJS({
|
|
|
111949
111949
|
));
|
|
111950
111950
|
});
|
|
111951
111951
|
return {
|
|
111952
|
-
then: function(
|
|
111952
|
+
then: function(resolve5, reject) {
|
|
111953
111953
|
didAwaitActCall = true;
|
|
111954
111954
|
thenable.then(
|
|
111955
111955
|
function(returnValue) {
|
|
@@ -111959,7 +111959,7 @@ var require_react_development = __commonJS({
|
|
|
111959
111959
|
flushActQueue(queue), enqueueTask(function() {
|
|
111960
111960
|
return recursivelyFlushAsyncActWork(
|
|
111961
111961
|
returnValue,
|
|
111962
|
-
|
|
111962
|
+
resolve5,
|
|
111963
111963
|
reject
|
|
111964
111964
|
);
|
|
111965
111965
|
});
|
|
@@ -111974,7 +111974,7 @@ var require_react_development = __commonJS({
|
|
|
111974
111974
|
reject(_thrownError);
|
|
111975
111975
|
}
|
|
111976
111976
|
} else
|
|
111977
|
-
|
|
111977
|
+
resolve5(returnValue);
|
|
111978
111978
|
},
|
|
111979
111979
|
function(error) {
|
|
111980
111980
|
popActScope(prevActQueue, prevActScopeDepth);
|
|
@@ -111996,15 +111996,15 @@ var require_react_development = __commonJS({
|
|
|
111996
111996
|
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
111997
111997
|
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
111998
111998
|
return {
|
|
111999
|
-
then: function(
|
|
111999
|
+
then: function(resolve5, reject) {
|
|
112000
112000
|
didAwaitActCall = true;
|
|
112001
112001
|
0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
112002
112002
|
return recursivelyFlushAsyncActWork(
|
|
112003
112003
|
returnValue$jscomp$0,
|
|
112004
|
-
|
|
112004
|
+
resolve5,
|
|
112005
112005
|
reject
|
|
112006
112006
|
);
|
|
112007
|
-
})) :
|
|
112007
|
+
})) : resolve5(returnValue$jscomp$0);
|
|
112008
112008
|
}
|
|
112009
112009
|
};
|
|
112010
112010
|
};
|
|
@@ -114148,8 +114148,8 @@ var require_react_reconciler_production = __commonJS({
|
|
|
114148
114148
|
currentEntangledActionThenable = {
|
|
114149
114149
|
status: "pending",
|
|
114150
114150
|
value: void 0,
|
|
114151
|
-
then: function(
|
|
114152
|
-
entangledListeners.push(
|
|
114151
|
+
then: function(resolve5) {
|
|
114152
|
+
entangledListeners.push(resolve5);
|
|
114153
114153
|
}
|
|
114154
114154
|
};
|
|
114155
114155
|
}
|
|
@@ -114173,8 +114173,8 @@ var require_react_reconciler_production = __commonJS({
|
|
|
114173
114173
|
status: "pending",
|
|
114174
114174
|
value: null,
|
|
114175
114175
|
reason: null,
|
|
114176
|
-
then: function(
|
|
114177
|
-
listeners.push(
|
|
114176
|
+
then: function(resolve5) {
|
|
114177
|
+
listeners.push(resolve5);
|
|
114178
114178
|
}
|
|
114179
114179
|
};
|
|
114180
114180
|
thenable.then(
|
|
@@ -123937,8 +123937,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
123937
123937
|
currentEntangledActionThenable = {
|
|
123938
123938
|
status: "pending",
|
|
123939
123939
|
value: void 0,
|
|
123940
|
-
then: function(
|
|
123941
|
-
entangledListeners.push(
|
|
123940
|
+
then: function(resolve5) {
|
|
123941
|
+
entangledListeners.push(resolve5);
|
|
123942
123942
|
}
|
|
123943
123943
|
};
|
|
123944
123944
|
}
|
|
@@ -123962,8 +123962,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
123962
123962
|
status: "pending",
|
|
123963
123963
|
value: null,
|
|
123964
123964
|
reason: null,
|
|
123965
|
-
then: function(
|
|
123966
|
-
listeners.push(
|
|
123965
|
+
then: function(resolve5) {
|
|
123966
|
+
listeners.push(resolve5);
|
|
123967
123967
|
}
|
|
123968
123968
|
};
|
|
123969
123969
|
thenable.then(
|
|
@@ -139247,22 +139247,22 @@ var init_devtools = __esm({
|
|
|
139247
139247
|
init_devtools_window_polyfill();
|
|
139248
139248
|
init_wrapper();
|
|
139249
139249
|
init_react_devtools_core_stub();
|
|
139250
|
-
isDevToolsReachable = async () => new Promise((
|
|
139250
|
+
isDevToolsReachable = async () => new Promise((resolve5) => {
|
|
139251
139251
|
const socket = new wrapper_default("ws://localhost:8097");
|
|
139252
139252
|
const timeout = setTimeout(() => {
|
|
139253
139253
|
socket.terminate();
|
|
139254
|
-
|
|
139254
|
+
resolve5(false);
|
|
139255
139255
|
}, 2e3);
|
|
139256
139256
|
timeout.unref();
|
|
139257
139257
|
socket.on("open", () => {
|
|
139258
139258
|
clearTimeout(timeout);
|
|
139259
139259
|
socket.terminate();
|
|
139260
|
-
|
|
139260
|
+
resolve5(true);
|
|
139261
139261
|
});
|
|
139262
139262
|
socket.on("error", () => {
|
|
139263
139263
|
clearTimeout(timeout);
|
|
139264
139264
|
socket.terminate();
|
|
139265
|
-
|
|
139265
|
+
resolve5(false);
|
|
139266
139266
|
});
|
|
139267
139267
|
});
|
|
139268
139268
|
if (await isDevToolsReachable()) {
|
|
@@ -140134,7 +140134,7 @@ var require_prompt = __commonJS({
|
|
|
140134
140134
|
var require_text = __commonJS({
|
|
140135
140135
|
"../../node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/text.js"(exports2, module2) {
|
|
140136
140136
|
"use strict";
|
|
140137
|
-
function asyncGeneratorStep(gen,
|
|
140137
|
+
function asyncGeneratorStep(gen, resolve5, reject, _next, _throw, key, arg) {
|
|
140138
140138
|
try {
|
|
140139
140139
|
var info = gen[key](arg);
|
|
140140
140140
|
var value = info.value;
|
|
@@ -140143,7 +140143,7 @@ var require_text = __commonJS({
|
|
|
140143
140143
|
return;
|
|
140144
140144
|
}
|
|
140145
140145
|
if (info.done) {
|
|
140146
|
-
|
|
140146
|
+
resolve5(value);
|
|
140147
140147
|
} else {
|
|
140148
140148
|
Promise.resolve(value).then(_next, _throw);
|
|
140149
140149
|
}
|
|
@@ -140151,13 +140151,13 @@ var require_text = __commonJS({
|
|
|
140151
140151
|
function _asyncToGenerator(fn) {
|
|
140152
140152
|
return function() {
|
|
140153
140153
|
var self2 = this, args = arguments;
|
|
140154
|
-
return new Promise(function(
|
|
140154
|
+
return new Promise(function(resolve5, reject) {
|
|
140155
140155
|
var gen = fn.apply(self2, args);
|
|
140156
140156
|
function _next(value) {
|
|
140157
|
-
asyncGeneratorStep(gen,
|
|
140157
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "next", value);
|
|
140158
140158
|
}
|
|
140159
140159
|
function _throw(err) {
|
|
140160
|
-
asyncGeneratorStep(gen,
|
|
140160
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "throw", err);
|
|
140161
140161
|
}
|
|
140162
140162
|
_next(void 0);
|
|
140163
140163
|
});
|
|
@@ -140894,7 +140894,7 @@ var require_dateparts = __commonJS({
|
|
|
140894
140894
|
var require_date = __commonJS({
|
|
140895
140895
|
"../../node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/date.js"(exports2, module2) {
|
|
140896
140896
|
"use strict";
|
|
140897
|
-
function asyncGeneratorStep(gen,
|
|
140897
|
+
function asyncGeneratorStep(gen, resolve5, reject, _next, _throw, key, arg) {
|
|
140898
140898
|
try {
|
|
140899
140899
|
var info = gen[key](arg);
|
|
140900
140900
|
var value = info.value;
|
|
@@ -140903,7 +140903,7 @@ var require_date = __commonJS({
|
|
|
140903
140903
|
return;
|
|
140904
140904
|
}
|
|
140905
140905
|
if (info.done) {
|
|
140906
|
-
|
|
140906
|
+
resolve5(value);
|
|
140907
140907
|
} else {
|
|
140908
140908
|
Promise.resolve(value).then(_next, _throw);
|
|
140909
140909
|
}
|
|
@@ -140911,13 +140911,13 @@ var require_date = __commonJS({
|
|
|
140911
140911
|
function _asyncToGenerator(fn) {
|
|
140912
140912
|
return function() {
|
|
140913
140913
|
var self2 = this, args = arguments;
|
|
140914
|
-
return new Promise(function(
|
|
140914
|
+
return new Promise(function(resolve5, reject) {
|
|
140915
140915
|
var gen = fn.apply(self2, args);
|
|
140916
140916
|
function _next(value) {
|
|
140917
|
-
asyncGeneratorStep(gen,
|
|
140917
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "next", value);
|
|
140918
140918
|
}
|
|
140919
140919
|
function _throw(err) {
|
|
140920
|
-
asyncGeneratorStep(gen,
|
|
140920
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "throw", err);
|
|
140921
140921
|
}
|
|
140922
140922
|
_next(void 0);
|
|
140923
140923
|
});
|
|
@@ -141128,7 +141128,7 @@ ${i2 ? ` ` : figures.pointerSmall} ${color.red().italic(l2)}`, ``);
|
|
|
141128
141128
|
var require_number = __commonJS({
|
|
141129
141129
|
"../../node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/number.js"(exports2, module2) {
|
|
141130
141130
|
"use strict";
|
|
141131
|
-
function asyncGeneratorStep(gen,
|
|
141131
|
+
function asyncGeneratorStep(gen, resolve5, reject, _next, _throw, key, arg) {
|
|
141132
141132
|
try {
|
|
141133
141133
|
var info = gen[key](arg);
|
|
141134
141134
|
var value = info.value;
|
|
@@ -141137,7 +141137,7 @@ var require_number = __commonJS({
|
|
|
141137
141137
|
return;
|
|
141138
141138
|
}
|
|
141139
141139
|
if (info.done) {
|
|
141140
|
-
|
|
141140
|
+
resolve5(value);
|
|
141141
141141
|
} else {
|
|
141142
141142
|
Promise.resolve(value).then(_next, _throw);
|
|
141143
141143
|
}
|
|
@@ -141145,13 +141145,13 @@ var require_number = __commonJS({
|
|
|
141145
141145
|
function _asyncToGenerator(fn) {
|
|
141146
141146
|
return function() {
|
|
141147
141147
|
var self2 = this, args = arguments;
|
|
141148
|
-
return new Promise(function(
|
|
141148
|
+
return new Promise(function(resolve5, reject) {
|
|
141149
141149
|
var gen = fn.apply(self2, args);
|
|
141150
141150
|
function _next(value) {
|
|
141151
|
-
asyncGeneratorStep(gen,
|
|
141151
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "next", value);
|
|
141152
141152
|
}
|
|
141153
141153
|
function _throw(err) {
|
|
141154
|
-
asyncGeneratorStep(gen,
|
|
141154
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "throw", err);
|
|
141155
141155
|
}
|
|
141156
141156
|
_next(void 0);
|
|
141157
141157
|
});
|
|
@@ -141588,7 +141588,7 @@ Instructions:
|
|
|
141588
141588
|
var require_autocomplete = __commonJS({
|
|
141589
141589
|
"../../node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/elements/autocomplete.js"(exports2, module2) {
|
|
141590
141590
|
"use strict";
|
|
141591
|
-
function asyncGeneratorStep(gen,
|
|
141591
|
+
function asyncGeneratorStep(gen, resolve5, reject, _next, _throw, key, arg) {
|
|
141592
141592
|
try {
|
|
141593
141593
|
var info = gen[key](arg);
|
|
141594
141594
|
var value = info.value;
|
|
@@ -141597,7 +141597,7 @@ var require_autocomplete = __commonJS({
|
|
|
141597
141597
|
return;
|
|
141598
141598
|
}
|
|
141599
141599
|
if (info.done) {
|
|
141600
|
-
|
|
141600
|
+
resolve5(value);
|
|
141601
141601
|
} else {
|
|
141602
141602
|
Promise.resolve(value).then(_next, _throw);
|
|
141603
141603
|
}
|
|
@@ -141605,13 +141605,13 @@ var require_autocomplete = __commonJS({
|
|
|
141605
141605
|
function _asyncToGenerator(fn) {
|
|
141606
141606
|
return function() {
|
|
141607
141607
|
var self2 = this, args = arguments;
|
|
141608
|
-
return new Promise(function(
|
|
141608
|
+
return new Promise(function(resolve5, reject) {
|
|
141609
141609
|
var gen = fn.apply(self2, args);
|
|
141610
141610
|
function _next(value) {
|
|
141611
|
-
asyncGeneratorStep(gen,
|
|
141611
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "next", value);
|
|
141612
141612
|
}
|
|
141613
141613
|
function _throw(err) {
|
|
141614
|
-
asyncGeneratorStep(gen,
|
|
141614
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "throw", err);
|
|
141615
141615
|
}
|
|
141616
141616
|
_next(void 0);
|
|
141617
141617
|
});
|
|
@@ -142274,7 +142274,7 @@ var require_dist4 = __commonJS({
|
|
|
142274
142274
|
arr2[i2] = arr[i2];
|
|
142275
142275
|
return arr2;
|
|
142276
142276
|
}
|
|
142277
|
-
function asyncGeneratorStep(gen,
|
|
142277
|
+
function asyncGeneratorStep(gen, resolve5, reject, _next, _throw, key, arg) {
|
|
142278
142278
|
try {
|
|
142279
142279
|
var info = gen[key](arg);
|
|
142280
142280
|
var value = info.value;
|
|
@@ -142283,7 +142283,7 @@ var require_dist4 = __commonJS({
|
|
|
142283
142283
|
return;
|
|
142284
142284
|
}
|
|
142285
142285
|
if (info.done) {
|
|
142286
|
-
|
|
142286
|
+
resolve5(value);
|
|
142287
142287
|
} else {
|
|
142288
142288
|
Promise.resolve(value).then(_next, _throw);
|
|
142289
142289
|
}
|
|
@@ -142291,13 +142291,13 @@ var require_dist4 = __commonJS({
|
|
|
142291
142291
|
function _asyncToGenerator(fn) {
|
|
142292
142292
|
return function() {
|
|
142293
142293
|
var self2 = this, args = arguments;
|
|
142294
|
-
return new Promise(function(
|
|
142294
|
+
return new Promise(function(resolve5, reject) {
|
|
142295
142295
|
var gen = fn.apply(self2, args);
|
|
142296
142296
|
function _next(value) {
|
|
142297
|
-
asyncGeneratorStep(gen,
|
|
142297
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "next", value);
|
|
142298
142298
|
}
|
|
142299
142299
|
function _throw(err) {
|
|
142300
|
-
asyncGeneratorStep(gen,
|
|
142300
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "throw", err);
|
|
142301
142301
|
}
|
|
142302
142302
|
_next(void 0);
|
|
142303
142303
|
});
|
|
@@ -145175,13 +145175,13 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
|
145175
145175
|
var source_default = chalk;
|
|
145176
145176
|
|
|
145177
145177
|
// src/index.ts
|
|
145178
|
-
var
|
|
145178
|
+
var import_code_core9 = __toESM(require_dist3(), 1);
|
|
145179
145179
|
|
|
145180
145180
|
// src/commands/auth.ts
|
|
145181
145181
|
import * as readline from "readline";
|
|
145182
145182
|
var import_code_core = __toESM(require_dist3(), 1);
|
|
145183
145183
|
function prompt(question, hidden = false) {
|
|
145184
|
-
return new Promise((
|
|
145184
|
+
return new Promise((resolve5) => {
|
|
145185
145185
|
const rl = readline.createInterface({
|
|
145186
145186
|
input: process.stdin,
|
|
145187
145187
|
output: process.stdout,
|
|
@@ -145205,7 +145205,7 @@ function prompt(question, hidden = false) {
|
|
|
145205
145205
|
if (char === "") {
|
|
145206
145206
|
process.exit(0);
|
|
145207
145207
|
}
|
|
145208
|
-
|
|
145208
|
+
resolve5(value);
|
|
145209
145209
|
} else if (char === "\x7F" || char === "\b") {
|
|
145210
145210
|
if (value.length > 0) {
|
|
145211
145211
|
value = value.slice(0, -1);
|
|
@@ -145218,7 +145218,7 @@ function prompt(question, hidden = false) {
|
|
|
145218
145218
|
} else {
|
|
145219
145219
|
rl.question(question, (answer) => {
|
|
145220
145220
|
rl.close();
|
|
145221
|
-
|
|
145221
|
+
resolve5(answer.trim());
|
|
145222
145222
|
});
|
|
145223
145223
|
}
|
|
145224
145224
|
});
|
|
@@ -145391,8 +145391,8 @@ import * as os6 from "os";
|
|
|
145391
145391
|
import * as crypto4 from "crypto";
|
|
145392
145392
|
import { createRequire } from "module";
|
|
145393
145393
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
145394
|
-
import { execSync, execFileSync as
|
|
145395
|
-
var
|
|
145394
|
+
import { execSync, execFileSync as execFileSync3 } from "child_process";
|
|
145395
|
+
var import_code_core6 = __toESM(require_dist3(), 1);
|
|
145396
145396
|
|
|
145397
145397
|
// ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
145398
145398
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
@@ -146385,15 +146385,15 @@ function serialisePrompt(fn) {
|
|
|
146385
146385
|
function askUserNow(question) {
|
|
146386
146386
|
if (_replInterface) {
|
|
146387
146387
|
const rl = _replInterface;
|
|
146388
|
-
return new Promise((
|
|
146389
|
-
rl.question(question, (answer) =>
|
|
146388
|
+
return new Promise((resolve5) => {
|
|
146389
|
+
rl.question(question, (answer) => resolve5(answer.trim()));
|
|
146390
146390
|
});
|
|
146391
146391
|
}
|
|
146392
|
-
return new Promise((
|
|
146392
|
+
return new Promise((resolve5) => {
|
|
146393
146393
|
const rl = readline2.createInterface({ input: process.stdin, output: process.stderr, terminal: true });
|
|
146394
146394
|
rl.question(question, (answer) => {
|
|
146395
146395
|
rl.close();
|
|
146396
|
-
|
|
146396
|
+
resolve5(answer.trim());
|
|
146397
146397
|
});
|
|
146398
146398
|
});
|
|
146399
146399
|
}
|
|
@@ -146638,7 +146638,7 @@ function currentAudit() {
|
|
|
146638
146638
|
}
|
|
146639
146639
|
|
|
146640
146640
|
// src/commands/chat.ts
|
|
146641
|
-
var
|
|
146641
|
+
var import_code_core7 = __toESM(require_dist3(), 1);
|
|
146642
146642
|
|
|
146643
146643
|
// src/commands/sessions.ts
|
|
146644
146644
|
import * as fs3 from "fs";
|
|
@@ -146932,10 +146932,10 @@ import { fileURLToPath } from "url";
|
|
|
146932
146932
|
var __dirname = path4.dirname(fileURLToPath(import.meta.url));
|
|
146933
146933
|
var NPM_REGISTRY_LATEST = "https://registry.npmjs.org/nexrall-code/latest";
|
|
146934
146934
|
function get2(url) {
|
|
146935
|
-
return new Promise((
|
|
146935
|
+
return new Promise((resolve5, reject) => {
|
|
146936
146936
|
https2.get(url, { headers: { "User-Agent": "nexrall-cli-updater", Accept: "application/json" } }, (res) => {
|
|
146937
146937
|
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
146938
|
-
return get2(res.headers.location).then(
|
|
146938
|
+
return get2(res.headers.location).then(resolve5).catch(reject);
|
|
146939
146939
|
}
|
|
146940
146940
|
if (res.statusCode !== 200) {
|
|
146941
146941
|
res.resume();
|
|
@@ -146943,7 +146943,7 @@ function get2(url) {
|
|
|
146943
146943
|
}
|
|
146944
146944
|
let raw = "";
|
|
146945
146945
|
res.on("data", (c) => raw += c.toString());
|
|
146946
|
-
res.on("end", () =>
|
|
146946
|
+
res.on("end", () => resolve5(raw));
|
|
146947
146947
|
}).on("error", reject);
|
|
146948
146948
|
});
|
|
146949
146949
|
}
|
|
@@ -146971,23 +146971,35 @@ async function fetchLatestVersion() {
|
|
|
146971
146971
|
const meta = JSON.parse(raw);
|
|
146972
146972
|
return meta.version ?? "0.0.0";
|
|
146973
146973
|
}
|
|
146974
|
-
function
|
|
146975
|
-
return
|
|
146974
|
+
function installArgs(version2) {
|
|
146975
|
+
return ["install", "-g", `nexrall-code@${version2}`, "--prefer-online"];
|
|
146976
|
+
}
|
|
146977
|
+
function installedGlobalVersion() {
|
|
146978
|
+
try {
|
|
146979
|
+
const { execFileSync: execFileSync4 } = __require("child_process");
|
|
146980
|
+
const root = execFileSync4("npm", ["root", "-g"], { encoding: "utf-8" }).trim();
|
|
146981
|
+
return JSON.parse(fs4.readFileSync(path4.join(root, "nexrall-code", "package.json"), "utf-8")).version ?? null;
|
|
146982
|
+
} catch {
|
|
146983
|
+
return null;
|
|
146984
|
+
}
|
|
146985
|
+
}
|
|
146986
|
+
function npmInstallGlobal(version2) {
|
|
146987
|
+
return new Promise((resolve5) => {
|
|
146976
146988
|
const { spawn } = __require("child_process");
|
|
146977
|
-
const child = spawn("npm",
|
|
146989
|
+
const child = spawn("npm", installArgs(version2), { stdio: "pipe" });
|
|
146978
146990
|
let stderr = "";
|
|
146979
146991
|
child.stderr?.on("data", (c) => {
|
|
146980
146992
|
stderr += c.toString();
|
|
146981
146993
|
});
|
|
146982
146994
|
child.on("close", (code) => {
|
|
146983
146995
|
if (code === 0)
|
|
146984
|
-
return
|
|
146996
|
+
return resolve5({ ok: true, usedSudo: false });
|
|
146985
146997
|
if (/EACCES|permission denied/i.test(stderr)) {
|
|
146986
|
-
const sudo = spawn("sudo", ["npm",
|
|
146987
|
-
sudo.on("close", (sudoCode) =>
|
|
146998
|
+
const sudo = spawn("sudo", ["npm", ...installArgs(version2)], { stdio: "inherit" });
|
|
146999
|
+
sudo.on("close", (sudoCode) => resolve5({ ok: sudoCode === 0, usedSudo: true }));
|
|
146988
147000
|
} else {
|
|
146989
147001
|
console.error(source_default.dim(stderr.trim()));
|
|
146990
|
-
|
|
147002
|
+
resolve5({ ok: false, usedSudo: false });
|
|
146991
147003
|
}
|
|
146992
147004
|
});
|
|
146993
147005
|
});
|
|
@@ -147027,9 +147039,9 @@ async function updateCommand(opts) {
|
|
|
147027
147039
|
const readline4 = await import("readline");
|
|
147028
147040
|
const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
|
|
147029
147041
|
const answer = await new Promise(
|
|
147030
|
-
(
|
|
147042
|
+
(resolve5) => rl.question(source_default.bold(" Update now?") + source_default.dim(" [y/n] > "), (a) => {
|
|
147031
147043
|
rl.close();
|
|
147032
|
-
|
|
147044
|
+
resolve5(a.trim());
|
|
147033
147045
|
})
|
|
147034
147046
|
);
|
|
147035
147047
|
if (answer !== "y" && answer !== "yes") {
|
|
@@ -147038,12 +147050,18 @@ async function updateCommand(opts) {
|
|
|
147038
147050
|
}
|
|
147039
147051
|
console.log();
|
|
147040
147052
|
}
|
|
147041
|
-
process.stdout.write(source_default.dim(` \u2192 Running npm install -g nexrall-code\u2026`));
|
|
147042
|
-
const { ok, usedSudo } = await npmInstallGlobal();
|
|
147053
|
+
process.stdout.write(source_default.dim(` \u2192 Running npm install -g nexrall-code@${latest}\u2026`));
|
|
147054
|
+
const { ok, usedSudo } = await npmInstallGlobal(latest);
|
|
147043
147055
|
process.stdout.write("\r\x1B[K");
|
|
147044
147056
|
if (!ok) {
|
|
147045
147057
|
console.error(source_default.red(" \u2717 Update failed. Run manually:"));
|
|
147046
|
-
console.error(source_default.dim(
|
|
147058
|
+
console.error(source_default.dim(` npm install -g nexrall-code@${latest} --prefer-online`));
|
|
147059
|
+
process.exit(1);
|
|
147060
|
+
}
|
|
147061
|
+
const now = installedGlobalVersion();
|
|
147062
|
+
if (now !== null && now !== latest) {
|
|
147063
|
+
console.error(source_default.red(` \u2717 npm finished but v${now} is installed, not v${latest}. Run manually:`));
|
|
147064
|
+
console.error(source_default.dim(` npm install -g nexrall-code@${latest} --prefer-online`));
|
|
147047
147065
|
process.exit(1);
|
|
147048
147066
|
}
|
|
147049
147067
|
console.log(source_default.green(` \u2713 Updated \u2192 v${latest}${usedSudo ? " (via sudo)" : ""}`));
|
|
@@ -147053,6 +147071,189 @@ async function updateCommand(opts) {
|
|
|
147053
147071
|
console.log();
|
|
147054
147072
|
}
|
|
147055
147073
|
|
|
147074
|
+
// src/commands/sessionTools.ts
|
|
147075
|
+
var import_code_core5 = __toESM(require_dist3(), 1);
|
|
147076
|
+
import { spawnSync, execFileSync } from "child_process";
|
|
147077
|
+
var UsageTotals = class {
|
|
147078
|
+
input = 0;
|
|
147079
|
+
output = 0;
|
|
147080
|
+
cacheRead = 0;
|
|
147081
|
+
cacheWrite = 0;
|
|
147082
|
+
cost = 0;
|
|
147083
|
+
costReported = false;
|
|
147084
|
+
requests = 0;
|
|
147085
|
+
add(u, partial, cost) {
|
|
147086
|
+
if (!partial) {
|
|
147087
|
+
this.input += u.input_tokens ?? 0;
|
|
147088
|
+
this.output += u.output_tokens ?? 0;
|
|
147089
|
+
this.cacheRead += u.cache_read_input_tokens ?? 0;
|
|
147090
|
+
this.cacheWrite += u.cache_creation_input_tokens ?? 0;
|
|
147091
|
+
this.requests += 1;
|
|
147092
|
+
}
|
|
147093
|
+
if (typeof cost === "number" && Number.isFinite(cost)) {
|
|
147094
|
+
this.cost += cost;
|
|
147095
|
+
this.costReported = true;
|
|
147096
|
+
}
|
|
147097
|
+
}
|
|
147098
|
+
reset() {
|
|
147099
|
+
this.input = 0;
|
|
147100
|
+
this.output = 0;
|
|
147101
|
+
this.cacheRead = 0;
|
|
147102
|
+
this.cacheWrite = 0;
|
|
147103
|
+
this.cost = 0;
|
|
147104
|
+
this.costReported = false;
|
|
147105
|
+
this.requests = 0;
|
|
147106
|
+
}
|
|
147107
|
+
get totalTokens() {
|
|
147108
|
+
return this.input + this.output + this.cacheRead + this.cacheWrite;
|
|
147109
|
+
}
|
|
147110
|
+
};
|
|
147111
|
+
function formatMoney(usd) {
|
|
147112
|
+
if (usd > 0 && usd < 0.01)
|
|
147113
|
+
return "$" + usd.toFixed(4);
|
|
147114
|
+
return "$" + usd.toFixed(2);
|
|
147115
|
+
}
|
|
147116
|
+
function costLines(t2) {
|
|
147117
|
+
if (t2.requests === 0 && !t2.costReported) {
|
|
147118
|
+
return ["No model requests yet in this conversation."];
|
|
147119
|
+
}
|
|
147120
|
+
const lines = [
|
|
147121
|
+
t2.costReported ? `Cost this conversation: ${formatMoney(t2.cost)}` : "Cost this conversation: unavailable (this server does not report per-request cost)",
|
|
147122
|
+
`Model requests: ${t2.requests}`,
|
|
147123
|
+
`Tokens: ${t2.totalTokens.toLocaleString()} total (${t2.input.toLocaleString()} in, ${t2.output.toLocaleString()} out, ${t2.cacheRead.toLocaleString()} cache read, ${t2.cacheWrite.toLocaleString()} cache write)`
|
|
147124
|
+
];
|
|
147125
|
+
return lines;
|
|
147126
|
+
}
|
|
147127
|
+
var MODE_CYCLE = ["ask", "edit", "auto", "plan"];
|
|
147128
|
+
function nextMode(current) {
|
|
147129
|
+
const i2 = MODE_CYCLE.indexOf(current);
|
|
147130
|
+
return MODE_CYCLE[(i2 + 1) % MODE_CYCLE.length];
|
|
147131
|
+
}
|
|
147132
|
+
function textOf(m2) {
|
|
147133
|
+
return m2.content.filter((b) => b.type === "text" && !(0, import_code_core5.isRuntimeContextBlock)(b)).map((b) => b.text).join("\n").trim();
|
|
147134
|
+
}
|
|
147135
|
+
function lastAssistantText(messages) {
|
|
147136
|
+
for (let i2 = messages.length - 1; i2 >= 0; i2--) {
|
|
147137
|
+
const m2 = messages[i2];
|
|
147138
|
+
if (m2.role !== "assistant")
|
|
147139
|
+
continue;
|
|
147140
|
+
const t2 = textOf(m2);
|
|
147141
|
+
if (t2)
|
|
147142
|
+
return t2;
|
|
147143
|
+
}
|
|
147144
|
+
return "";
|
|
147145
|
+
}
|
|
147146
|
+
function exportMarkdown(messages, meta) {
|
|
147147
|
+
const out = [
|
|
147148
|
+
`# ${meta.title || "Nexrall Code session"}`,
|
|
147149
|
+
"",
|
|
147150
|
+
`- Session: ${meta.sessionId}`,
|
|
147151
|
+
`- Model: ${meta.model}`,
|
|
147152
|
+
`- Directory: ${meta.cwd}`,
|
|
147153
|
+
`- Exported: ${meta.exportedAt.toISOString()}`,
|
|
147154
|
+
""
|
|
147155
|
+
];
|
|
147156
|
+
for (const m2 of messages) {
|
|
147157
|
+
const parts = [];
|
|
147158
|
+
for (const b of m2.content) {
|
|
147159
|
+
if ((0, import_code_core5.isRuntimeContextBlock)(b))
|
|
147160
|
+
continue;
|
|
147161
|
+
if (b.type === "text") {
|
|
147162
|
+
if (b.text.trim())
|
|
147163
|
+
parts.push(b.text.trim());
|
|
147164
|
+
} else if (b.type === "tool_use")
|
|
147165
|
+
parts.push(`\`[tool: ${b.name}]\``);
|
|
147166
|
+
else if (b.type === "image")
|
|
147167
|
+
parts.push("_[image]_");
|
|
147168
|
+
else if (b.type === "document")
|
|
147169
|
+
parts.push("_[document]_");
|
|
147170
|
+
}
|
|
147171
|
+
if (!parts.length)
|
|
147172
|
+
continue;
|
|
147173
|
+
out.push(`## ${m2.role === "user" ? "You" : "Assistant"}`, "", parts.join("\n\n"), "");
|
|
147174
|
+
}
|
|
147175
|
+
return out.join("\n");
|
|
147176
|
+
}
|
|
147177
|
+
function copyToClipboard(text, platform3 = process.platform) {
|
|
147178
|
+
const candidates = platform3 === "darwin" ? [["pbcopy", []]] : platform3 === "win32" ? [["clip", []]] : [["wl-copy", []], ["xclip", ["-selection", "clipboard"]], ["xsel", ["--clipboard", "--input"]]];
|
|
147179
|
+
for (const [cmd, args] of candidates) {
|
|
147180
|
+
try {
|
|
147181
|
+
const r2 = spawnSync(cmd, args, { input: text, stdio: ["pipe", "ignore", "ignore"], timeout: 5e3 });
|
|
147182
|
+
if (!r2.error && r2.status === 0)
|
|
147183
|
+
return cmd;
|
|
147184
|
+
} catch {
|
|
147185
|
+
}
|
|
147186
|
+
}
|
|
147187
|
+
return null;
|
|
147188
|
+
}
|
|
147189
|
+
function osc52(text) {
|
|
147190
|
+
return `\x1B]52;c;${Buffer.from(text, "utf8").toString("base64")}\x07`;
|
|
147191
|
+
}
|
|
147192
|
+
function gitChanges(cwd2) {
|
|
147193
|
+
const run = (args) => execFileSync("git", args, { cwd: cwd2, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 1e4 }).trimEnd();
|
|
147194
|
+
try {
|
|
147195
|
+
run(["rev-parse", "--is-inside-work-tree"]);
|
|
147196
|
+
return { status: run(["status", "--short"]), stat: run(["diff", "--stat", "HEAD"]) };
|
|
147197
|
+
} catch {
|
|
147198
|
+
try {
|
|
147199
|
+
return { status: run(["status", "--short"]), stat: "" };
|
|
147200
|
+
} catch {
|
|
147201
|
+
return null;
|
|
147202
|
+
}
|
|
147203
|
+
}
|
|
147204
|
+
}
|
|
147205
|
+
function permissionLines(rules, mode, yolo) {
|
|
147206
|
+
const lines = [`Mode: ${mode}${yolo ? " (auto-approve ALL is on \u2014 /yolo)" : ""}`];
|
|
147207
|
+
const section = (label, list) => {
|
|
147208
|
+
lines.push("", `${label} (${list.length})`);
|
|
147209
|
+
if (!list.length)
|
|
147210
|
+
lines.push(" none");
|
|
147211
|
+
for (const r2 of list)
|
|
147212
|
+
lines.push(` ${r2}`);
|
|
147213
|
+
};
|
|
147214
|
+
section("Always allowed", rules.allow);
|
|
147215
|
+
section("Always ask", rules.ask);
|
|
147216
|
+
section("Denied", rules.deny);
|
|
147217
|
+
lines.push("", "Rules come from .nexrall/settings.json (project) and ~/.nexrall/settings.json (global).");
|
|
147218
|
+
return lines;
|
|
147219
|
+
}
|
|
147220
|
+
function parseTeamTarget(raw) {
|
|
147221
|
+
const s2 = raw.trim();
|
|
147222
|
+
if (/^(personal|null|0)$/i.test(s2))
|
|
147223
|
+
return null;
|
|
147224
|
+
if (/^\d+$/.test(s2))
|
|
147225
|
+
return Number(s2);
|
|
147226
|
+
return void 0;
|
|
147227
|
+
}
|
|
147228
|
+
function billingLines(orgs, pinned) {
|
|
147229
|
+
const targetId = orgs.billingTargetTeamId ?? null;
|
|
147230
|
+
const team = targetId == null ? null : orgs.teams.find((t2) => t2.id === targetId) ?? null;
|
|
147231
|
+
const lines = [];
|
|
147232
|
+
if (team) {
|
|
147233
|
+
lines.push(`Billing to team "${team.name}" \u2014 ${formatMoney(team.remainingUsd)} left this month`);
|
|
147234
|
+
if (team.remainingUsd <= 0)
|
|
147235
|
+
lines.push("! This team has no budget left \u2014 ask a team admin to add funds.");
|
|
147236
|
+
} else if (targetId != null) {
|
|
147237
|
+
lines.push(`Billing to team ${targetId} \u2014 not available to this account, usage falls back to your wallet`);
|
|
147238
|
+
} else {
|
|
147239
|
+
lines.push("Billing to your personal wallet");
|
|
147240
|
+
}
|
|
147241
|
+
lines.push(`Personal wallet: ${formatMoney(orgs.personal.balance)}`);
|
|
147242
|
+
if (orgs.teams.length) {
|
|
147243
|
+
lines.push("", "Teams you can bill to:");
|
|
147244
|
+
for (const t2 of orgs.teams) {
|
|
147245
|
+
const cur = t2.id === targetId ? " <- current" : "";
|
|
147246
|
+
const left = t2.remainingUsd > 0 ? `${formatMoney(t2.remainingUsd)} left` : "no budget left";
|
|
147247
|
+
lines.push(` ${t2.id} ${t2.name} ${left}${cur}`);
|
|
147248
|
+
}
|
|
147249
|
+
lines.push("", "Switch with /team use <id> or /team use personal.");
|
|
147250
|
+
}
|
|
147251
|
+
if (pinned !== void 0) {
|
|
147252
|
+
lines.push("", `Note: NEXRALL_BILLING_TEAM pins this run to ${pinned === null ? "your personal wallet" : `team ${pinned}`}, ignoring the account setting.`);
|
|
147253
|
+
}
|
|
147254
|
+
return lines;
|
|
147255
|
+
}
|
|
147256
|
+
|
|
147056
147257
|
// src/ui/screen.ts
|
|
147057
147258
|
function prepareSessionScreen() {
|
|
147058
147259
|
if (!process.stdout.isTTY)
|
|
@@ -150059,12 +150260,12 @@ function wrapAnsi(string, columns, options) {
|
|
|
150059
150260
|
|
|
150060
150261
|
// ../../node_modules/.pnpm/terminal-size@4.0.1/node_modules/terminal-size/index.js
|
|
150061
150262
|
import process4 from "node:process";
|
|
150062
|
-
import { execFileSync } from "node:child_process";
|
|
150263
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
150063
150264
|
import fs6 from "node:fs";
|
|
150064
150265
|
import tty2 from "node:tty";
|
|
150065
150266
|
var defaultColumns = 80;
|
|
150066
150267
|
var defaultRows = 24;
|
|
150067
|
-
var exec2 = (command, arguments_, { shell, env: env4 } = {}) =>
|
|
150268
|
+
var exec2 = (command, arguments_, { shell, env: env4 } = {}) => execFileSync2(command, arguments_, {
|
|
150068
150269
|
encoding: "utf8",
|
|
150069
150270
|
stdio: ["ignore", "pipe", "ignore"],
|
|
150070
150271
|
timeout: 500,
|
|
@@ -154631,8 +154832,8 @@ var kittyModifiers = {
|
|
|
154631
154832
|
var noop2 = () => {
|
|
154632
154833
|
};
|
|
154633
154834
|
var textEncoder = new TextEncoder();
|
|
154634
|
-
var yieldImmediate = async () => new Promise((
|
|
154635
|
-
setImmediate(
|
|
154835
|
+
var yieldImmediate = async () => new Promise((resolve5) => {
|
|
154836
|
+
setImmediate(resolve5);
|
|
154636
154837
|
});
|
|
154637
154838
|
var kittyQueryEscapeByte = 27;
|
|
154638
154839
|
var kittyQueryOpenBracketByte = 91;
|
|
@@ -154849,8 +155050,8 @@ var Ink = class {
|
|
|
154849
155050
|
};
|
|
154850
155051
|
}
|
|
154851
155052
|
this.initKittyKeyboard();
|
|
154852
|
-
this.exitPromise = new Promise((
|
|
154853
|
-
this.resolveExitPromise =
|
|
155053
|
+
this.exitPromise = new Promise((resolve5, reject) => {
|
|
155054
|
+
this.resolveExitPromise = resolve5;
|
|
154854
155055
|
this.rejectExitPromise = reject;
|
|
154855
155056
|
});
|
|
154856
155057
|
void this.exitPromise.catch(noop2);
|
|
@@ -155161,9 +155362,9 @@ var Ink = class {
|
|
|
155161
155362
|
settleThrottle(this.throttledOnRender, canWriteToStdout);
|
|
155162
155363
|
settleThrottle(this.throttledLog, canWriteToStdout);
|
|
155163
155364
|
if (canWriteToStdout && hasWritableState) {
|
|
155164
|
-
await new Promise((
|
|
155365
|
+
await new Promise((resolve5) => {
|
|
155165
155366
|
this.options.stdout.write("", () => {
|
|
155166
|
-
|
|
155367
|
+
resolve5();
|
|
155167
155368
|
});
|
|
155168
155369
|
});
|
|
155169
155370
|
return;
|
|
@@ -155249,8 +155450,8 @@ var Ink = class {
|
|
|
155249
155450
|
async awaitNextRender() {
|
|
155250
155451
|
if (!this.nextRenderCommit) {
|
|
155251
155452
|
let resolveRender;
|
|
155252
|
-
const promise = new Promise((
|
|
155253
|
-
resolveRender =
|
|
155453
|
+
const promise = new Promise((resolve5) => {
|
|
155454
|
+
resolveRender = resolve5;
|
|
155254
155455
|
});
|
|
155255
155456
|
this.nextRenderCommit = { promise, resolve: resolveRender };
|
|
155256
155457
|
}
|
|
@@ -156193,13 +156394,13 @@ function TrustPrompt({ workDir, signals, onDecide }) {
|
|
|
156193
156394
|
})), /* @__PURE__ */ import_react34.default.createElement(Box_default, { marginTop: 1 }, /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, "Enter to confirm \xB7 Esc to cancel")));
|
|
156194
156395
|
}
|
|
156195
156396
|
function askForTrust(workDir, signals) {
|
|
156196
|
-
return new Promise((
|
|
156397
|
+
return new Promise((resolve5) => {
|
|
156197
156398
|
let decided = false;
|
|
156198
156399
|
const settle = (trusted) => {
|
|
156199
156400
|
if (decided)
|
|
156200
156401
|
return;
|
|
156201
156402
|
decided = true;
|
|
156202
|
-
|
|
156403
|
+
resolve5(trusted);
|
|
156203
156404
|
};
|
|
156204
156405
|
const app = render_default(
|
|
156205
156406
|
/* @__PURE__ */ import_react34.default.createElement(TrustPrompt, { workDir, signals, onDecide: settle }),
|
|
@@ -156548,7 +156749,16 @@ var BUILTIN_SLASH_COMMANDS = [
|
|
|
156548
156749
|
{ name: "effort", description: "Set the thinking effort level", argHint: "[level]", kind: "builtin" },
|
|
156549
156750
|
{ name: "yolo", description: "Auto-approve all permissions", kind: "builtin" },
|
|
156550
156751
|
{ name: "context", description: "Show context window usage", kind: "builtin" },
|
|
156551
|
-
{ name: "balance", description: "Show wallet
|
|
156752
|
+
{ name: "balance", description: "Show what is paying (wallet or team) and what is left", kind: "builtin" },
|
|
156753
|
+
{ name: "team", description: "List your teams, or switch what usage is billed to", argHint: "[use <id|personal>]", kind: "builtin" },
|
|
156754
|
+
{ name: "cost", description: "Tokens and cost of this conversation", kind: "builtin" },
|
|
156755
|
+
{ name: "status", description: "Version, model, mode, directory and session at a glance", kind: "builtin" },
|
|
156756
|
+
{ name: "copy", description: "Copy the last reply to the clipboard", kind: "builtin" },
|
|
156757
|
+
{ name: "export", description: "Write this conversation to a Markdown file", argHint: "[file]", kind: "builtin" },
|
|
156758
|
+
{ name: "rename", description: "Rename this session", argHint: "<title>", requiresArg: true, kind: "builtin" },
|
|
156759
|
+
{ name: "diff", description: "Show uncommitted changes in the working directory", kind: "builtin" },
|
|
156760
|
+
{ name: "plan", description: "Switch to plan mode (read-only)", kind: "builtin" },
|
|
156761
|
+
{ name: "permissions", description: "Show the active permission rules and mode", kind: "builtin" },
|
|
156552
156762
|
{ name: "add", description: "Add a file to the conversation context", argHint: "<filepath>", requiresArg: true, kind: "builtin" },
|
|
156553
156763
|
{ name: "image", description: "Attach an image or PDF and send it", argHint: "<filepath> [caption]", requiresArg: true, kind: "builtin" },
|
|
156554
156764
|
{ name: "init", description: "Generate nexrall.md for this project", kind: "builtin" },
|
|
@@ -156859,10 +157069,10 @@ var App2 = ({ onReady }) => {
|
|
|
156859
157069
|
setPrompt(promptText || DEFAULT_PROMPT);
|
|
156860
157070
|
setLine("");
|
|
156861
157071
|
setCursorPos(0);
|
|
156862
|
-
return new Promise((
|
|
157072
|
+
return new Promise((resolve5) => {
|
|
156863
157073
|
askResolverRef.current = (answer) => {
|
|
156864
157074
|
setPrompt(DEFAULT_PROMPT);
|
|
156865
|
-
|
|
157075
|
+
resolve5(answer);
|
|
156866
157076
|
};
|
|
156867
157077
|
});
|
|
156868
157078
|
}, []);
|
|
@@ -156875,6 +157085,10 @@ var App2 = ({ onReady }) => {
|
|
|
156875
157085
|
const onBusyCommand = (0, import_react35.useCallback)((cb) => {
|
|
156876
157086
|
onBusyCommandRef.current = cb;
|
|
156877
157087
|
}, []);
|
|
157088
|
+
const onCycleModeRef = (0, import_react35.useRef)(null);
|
|
157089
|
+
const onCycleMode = (0, import_react35.useCallback)((cb) => {
|
|
157090
|
+
onCycleModeRef.current = cb;
|
|
157091
|
+
}, []);
|
|
156878
157092
|
const onInterruptRef = (0, import_react35.useRef)(null);
|
|
156879
157093
|
const onInterrupt = (0, import_react35.useCallback)((cb) => {
|
|
156880
157094
|
onInterruptRef.current = cb;
|
|
@@ -156930,6 +157144,16 @@ var App2 = ({ onReady }) => {
|
|
|
156930
157144
|
ctrlDArmedAtRef.current = null;
|
|
156931
157145
|
if (!isEsc && !isCtrlD)
|
|
156932
157146
|
setHintText(null);
|
|
157147
|
+
if (key.tab && key.shift) {
|
|
157148
|
+
if (askResolverRef.current)
|
|
157149
|
+
return;
|
|
157150
|
+
if (busyRef.current) {
|
|
157151
|
+
setHintText("Mode can be changed when the current turn finishes");
|
|
157152
|
+
return;
|
|
157153
|
+
}
|
|
157154
|
+
onCycleModeRef.current?.();
|
|
157155
|
+
return;
|
|
157156
|
+
}
|
|
156933
157157
|
const menu = askResolverRef.current || historyRef.current.browsing ? null : computeMenu(lineRef.current, cursorRef.current, slashEntriesRef.current, menuDismissedRef.current);
|
|
156934
157158
|
if (menu) {
|
|
156935
157159
|
const sel = menuSelRef.current.query === menu.query ? menuSelRef.current.idx : 0;
|
|
@@ -157213,7 +157437,8 @@ var App2 = ({ onReady }) => {
|
|
|
157213
157437
|
close: () => requestExit(false),
|
|
157214
157438
|
collapseStartupPadding,
|
|
157215
157439
|
clearTranscript,
|
|
157216
|
-
onBusyCommand
|
|
157440
|
+
onBusyCommand,
|
|
157441
|
+
onCycleMode
|
|
157217
157442
|
});
|
|
157218
157443
|
}, []);
|
|
157219
157444
|
const slices = renderInputSlices(line, cursorPos);
|
|
@@ -157283,7 +157508,7 @@ var App2 = ({ onReady }) => {
|
|
|
157283
157508
|
function startInkTerminal() {
|
|
157284
157509
|
if (handle)
|
|
157285
157510
|
return Promise.resolve(handle);
|
|
157286
|
-
return new Promise((
|
|
157511
|
+
return new Promise((resolve5) => {
|
|
157287
157512
|
inkInstance = render_default(
|
|
157288
157513
|
/* @__PURE__ */ import_react35.default.createElement(
|
|
157289
157514
|
App2,
|
|
@@ -157291,7 +157516,7 @@ function startInkTerminal() {
|
|
|
157291
157516
|
onReady: (h2) => {
|
|
157292
157517
|
handle = h2;
|
|
157293
157518
|
attachResizeCleanup();
|
|
157294
|
-
|
|
157519
|
+
resolve5(h2);
|
|
157295
157520
|
}
|
|
157296
157521
|
}
|
|
157297
157522
|
),
|
|
@@ -157458,6 +157683,7 @@ var CLI_VERSION = (() => {
|
|
|
157458
157683
|
}
|
|
157459
157684
|
return "unknown";
|
|
157460
157685
|
})();
|
|
157686
|
+
var sessionUsage = new UsageTotals();
|
|
157461
157687
|
var MODEL_LABELS = {
|
|
157462
157688
|
"claude-sonnet-5-5": "Claude Sonnet 5.5",
|
|
157463
157689
|
"claude-opus-5-5": "Claude Opus 5.5",
|
|
@@ -157524,7 +157750,7 @@ var MODEL_COST_MULTIPLIER = {
|
|
|
157524
157750
|
"glm-5.3": 0.6
|
|
157525
157751
|
};
|
|
157526
157752
|
function modelWithCostHint(id) {
|
|
157527
|
-
const mult = (0,
|
|
157753
|
+
const mult = (0, import_code_core6.liveCostMultiplierFor)(id, MODEL_COST_MULTIPLIER[id]);
|
|
157528
157754
|
return mult === void 0 ? id : `${id} (${mult}x)`;
|
|
157529
157755
|
}
|
|
157530
157756
|
var NO_VISION_MODELS = /* @__PURE__ */ new Set(["qwen3.7-max", "glm-5.3"]);
|
|
@@ -157540,13 +157766,13 @@ var NO_PDF_MODELS = /* @__PURE__ */ new Set([
|
|
|
157540
157766
|
...NO_VISION_MODELS
|
|
157541
157767
|
]);
|
|
157542
157768
|
function needsVisionSidecar(model) {
|
|
157543
|
-
return !(0,
|
|
157769
|
+
return !(0, import_code_core6.liveSupportsImageInput)(model, !NO_VISION_MODELS.has(model));
|
|
157544
157770
|
}
|
|
157545
157771
|
function needsPdfSidecar(model) {
|
|
157546
|
-
return !(0,
|
|
157772
|
+
return !(0, import_code_core6.liveSupportsPdfInput)(model, !NO_PDF_MODELS.has(model));
|
|
157547
157773
|
}
|
|
157548
157774
|
function selectableModelIds() {
|
|
157549
|
-
return (0,
|
|
157775
|
+
return (0, import_code_core6.liveSelectableModelIds)() ?? SELECTABLE_MODELS;
|
|
157550
157776
|
}
|
|
157551
157777
|
function normaliseModelId(model) {
|
|
157552
157778
|
const raw = (model ?? "").trim();
|
|
@@ -157607,9 +157833,9 @@ var _BACKEND_STYLE_TO_LOCAL = {
|
|
|
157607
157833
|
};
|
|
157608
157834
|
function effortStyleFor(modelId) {
|
|
157609
157835
|
const id = normaliseModelId(modelId);
|
|
157610
|
-
if ((0,
|
|
157836
|
+
if ((0, import_code_core6.liveVendorFor)(id) === "Anthropic")
|
|
157611
157837
|
return "anthropic";
|
|
157612
|
-
const liveStyle = (0,
|
|
157838
|
+
const liveStyle = (0, import_code_core6.liveReasoningEffortStyle)(id);
|
|
157613
157839
|
if (liveStyle && _BACKEND_STYLE_TO_LOCAL[liveStyle])
|
|
157614
157840
|
return _BACKEND_STYLE_TO_LOCAL[liveStyle];
|
|
157615
157841
|
return MODEL_EFFORT_STYLE[id] ?? "anthropic";
|
|
@@ -157629,7 +157855,7 @@ function defaultEffortForModel(modelId) {
|
|
|
157629
157855
|
}
|
|
157630
157856
|
function resolveModelLabel(alias) {
|
|
157631
157857
|
const id = normaliseModelId(alias);
|
|
157632
|
-
return (0,
|
|
157858
|
+
return (0, import_code_core6.liveLabelFor)(id, MODEL_LABELS[id] ?? id);
|
|
157633
157859
|
}
|
|
157634
157860
|
function tryExec(cmd, cwd2) {
|
|
157635
157861
|
try {
|
|
@@ -157703,7 +157929,7 @@ var tryRead = (p) => {
|
|
|
157703
157929
|
};
|
|
157704
157930
|
function readNexrallMd(workDir) {
|
|
157705
157931
|
const parts = [];
|
|
157706
|
-
const memContent = (0,
|
|
157932
|
+
const memContent = (0, import_code_core6.readAllMemory)(workDir);
|
|
157707
157933
|
if (memContent)
|
|
157708
157934
|
parts.push(memContent);
|
|
157709
157935
|
const globalContent = tryRead(path7.join(os6.homedir(), ".nexrall", "nexrall.md"));
|
|
@@ -157810,24 +158036,24 @@ var Spinner = class {
|
|
|
157810
158036
|
return this.interval !== null;
|
|
157811
158037
|
}
|
|
157812
158038
|
};
|
|
157813
|
-
var cliBackgroundAgents = new
|
|
158039
|
+
var cliBackgroundAgents = new import_code_core6.BackgroundAgentHub();
|
|
157814
158040
|
function nextBackgroundChange() {
|
|
157815
|
-
return new Promise((
|
|
158041
|
+
return new Promise((resolve5) => {
|
|
157816
158042
|
const off = cliBackgroundAgents.onChange(() => {
|
|
157817
158043
|
off();
|
|
157818
|
-
|
|
158044
|
+
resolve5();
|
|
157819
158045
|
});
|
|
157820
158046
|
});
|
|
157821
158047
|
}
|
|
157822
158048
|
var _mcpManager = null;
|
|
157823
158049
|
var _mcpConfig = null;
|
|
157824
158050
|
async function initMcp(workDir) {
|
|
157825
|
-
_mcpConfig =
|
|
158051
|
+
_mcpConfig = import_code_core6.McpManager.loadConfig(workDir);
|
|
157826
158052
|
if (Object.keys(_mcpConfig.mcpServers).length === 0) {
|
|
157827
158053
|
_mcpManager = null;
|
|
157828
158054
|
return;
|
|
157829
158055
|
}
|
|
157830
|
-
const manager = new
|
|
158056
|
+
const manager = new import_code_core6.McpManager();
|
|
157831
158057
|
await manager.connectAll(_mcpConfig);
|
|
157832
158058
|
_mcpManager = manager;
|
|
157833
158059
|
}
|
|
@@ -157848,10 +158074,10 @@ function formatMcpStatus() {
|
|
|
157848
158074
|
return lines.join("\n");
|
|
157849
158075
|
}
|
|
157850
158076
|
function formatContextUsage(messages, modelAlias) {
|
|
157851
|
-
const window2 = (0,
|
|
157852
|
-
const tokens = (0,
|
|
157853
|
-
const bytes = (0,
|
|
157854
|
-
const { prune, compact } = (0,
|
|
158077
|
+
const window2 = (0, import_code_core6.contextWindowFor)(modelAlias);
|
|
158078
|
+
const tokens = (0, import_code_core6.estimateTokensRough)(messages);
|
|
158079
|
+
const bytes = (0, import_code_core6.estimateBodyBytes)(messages);
|
|
158080
|
+
const { prune, compact } = (0, import_code_core6.compactionThresholds)(window2);
|
|
157855
158081
|
const pct = Math.min(100, tokens / window2 * 100);
|
|
157856
158082
|
const barWidth = 30;
|
|
157857
158083
|
const filled = Math.round(pct / 100 * barWidth);
|
|
@@ -157868,7 +158094,7 @@ function formatContextUsage(messages, modelAlias) {
|
|
|
157868
158094
|
return lines.join("\n");
|
|
157869
158095
|
}
|
|
157870
158096
|
function formatAgentsList(workDir) {
|
|
157871
|
-
const { types: types3, warnings } = (0,
|
|
158097
|
+
const { types: types3, warnings } = (0, import_code_core6.loadAgentTypesWithWarnings)(workDir);
|
|
157872
158098
|
if (!types3.length)
|
|
157873
158099
|
return source_default.dim(" No agent types found (this should not happen \u2014 builtins always register).");
|
|
157874
158100
|
const lines = types3.map((t2) => {
|
|
@@ -157917,7 +158143,7 @@ async function runTurn(messages, modelAlias, workDir, abortSignal, env4, nexrall
|
|
|
157917
158143
|
setMode(mode);
|
|
157918
158144
|
console.log();
|
|
157919
158145
|
spinner.start("thinking\u2026", { hint: false });
|
|
157920
|
-
const result = await (0,
|
|
158146
|
+
const result = await (0, import_code_core6.runAgentLoop)(messages, {
|
|
157921
158147
|
workDir,
|
|
157922
158148
|
model: modelAlias,
|
|
157923
158149
|
env: refreshEnvForTurn(env4, workDir),
|
|
@@ -158052,7 +158278,8 @@ async function runTurn(messages, modelAlias, workDir, abortSignal, env4, nexrall
|
|
|
158052
158278
|
// Ignore a `partial` report: it belongs to a cut-short attempt that was restarted,
|
|
158053
158279
|
// and the replacement attempt reports the turn's real totals. Letting it through
|
|
158054
158280
|
// would print a token count for output the user never saw.
|
|
158055
|
-
onUsage: (u, partial,
|
|
158281
|
+
onUsage: (u, partial, cost, isSubTask) => {
|
|
158282
|
+
sessionUsage.add(u, partial, cost);
|
|
158056
158283
|
if (!partial && !isSubTask)
|
|
158057
158284
|
lastUsage = u;
|
|
158058
158285
|
},
|
|
@@ -158126,7 +158353,7 @@ async function runTurnHeadless(messages, modelAlias, workDir, _abortSignal, env4
|
|
|
158126
158353
|
process.stdout.write(JSON.stringify(obj2) + "\n");
|
|
158127
158354
|
};
|
|
158128
158355
|
emit({ type: "start", model: modelAlias, workDir });
|
|
158129
|
-
const result = await (0,
|
|
158356
|
+
const result = await (0, import_code_core6.runAgentLoop)(messages, {
|
|
158130
158357
|
workDir,
|
|
158131
158358
|
model: modelAlias,
|
|
158132
158359
|
env: refreshEnvForTurn(env4, workDir),
|
|
@@ -158224,7 +158451,7 @@ async function runTurnHeadless(messages, modelAlias, workDir, _abortSignal, env4
|
|
|
158224
158451
|
// no human to confirm, they are denied unless NEXRALL_ALLOW_DESTRUCTIVE=1 is
|
|
158225
158452
|
// explicitly set for this CI run.
|
|
158226
158453
|
requestPermission: async ({ tool, input }) => {
|
|
158227
|
-
const d = (0,
|
|
158454
|
+
const d = (0, import_code_core6.isDestructiveBash)(tool, input);
|
|
158228
158455
|
if (d && process.env.NEXRALL_ALLOW_DESTRUCTIVE !== "1") {
|
|
158229
158456
|
emit({ type: "error", error: `Destructive command blocked in headless mode (${d.category}): ${d.reason}. Set NEXRALL_ALLOW_DESTRUCTIVE=1 to permit.` });
|
|
158230
158457
|
return false;
|
|
@@ -158272,7 +158499,16 @@ function printHelp() {
|
|
|
158272
158499
|
["/mode [ask|edit|plan|auto]", "Set agent mode"],
|
|
158273
158500
|
["/effort [level]", "Set thinking effort level (options depend on the current model \u2014 run /effort with no argument to see them)"],
|
|
158274
158501
|
["/yolo", "Auto-approve all permissions"],
|
|
158275
|
-
["/balance", "Show wallet
|
|
158502
|
+
["/balance", "Show what is paying (personal wallet or team) and what is left"],
|
|
158503
|
+
["/team [use <id|personal>]", "List your teams, or switch what usage is billed to"],
|
|
158504
|
+
["/cost", "Tokens and cost of this conversation so far"],
|
|
158505
|
+
["/status", "Version, model, mode, directory, session and cost at a glance"],
|
|
158506
|
+
["/copy", "Copy the last reply to the clipboard"],
|
|
158507
|
+
["/export [file]", "Write this conversation to a Markdown file"],
|
|
158508
|
+
["/rename <title>", "Rename this session"],
|
|
158509
|
+
["/diff", "Show uncommitted changes in the working directory"],
|
|
158510
|
+
["/plan", "Switch to plan mode (read-only)"],
|
|
158511
|
+
["/permissions", "Show the active permission rules and mode"],
|
|
158276
158512
|
["/add <filepath>", "Add a file to conversation context"],
|
|
158277
158513
|
["/image <filepath> [caption]", "Attach an image or PDF (png/jpg/gif/webp/pdf, max 10MB) and send it to the model"],
|
|
158278
158514
|
["/skills", "List skills (.nexrall/skills/<name>/SKILL.md or .nexrall/commands/*.md) \u2014 the model can also auto-invoke these"],
|
|
@@ -158302,6 +158538,7 @@ function printHelp() {
|
|
|
158302
158538
|
["Alt+B / Alt+F", "Move by word (also Alt+\u2190/\u2192 and Ctrl+\u2190/\u2192)"],
|
|
158303
158539
|
["Ctrl+W / Alt+\u232B", "Delete the previous word"],
|
|
158304
158540
|
["Ctrl+U / Ctrl+K", "Delete to the start / end of the line (Ctrl+Y pastes it back)"],
|
|
158541
|
+
["Shift+Tab", "Cycle the mode: ask \u2192 edit \u2192 auto \u2192 plan (when no turn is running)"],
|
|
158305
158542
|
["Ctrl+L", "Redraw the screen"],
|
|
158306
158543
|
["Ctrl+D", "Delete the character under the cursor; press twice on an empty line to exit"],
|
|
158307
158544
|
["(paste)", "Multi-line paste goes into the input box \u2014 it does not send until you press Enter"]
|
|
@@ -158330,7 +158567,7 @@ function printSessions() {
|
|
|
158330
158567
|
console.log();
|
|
158331
158568
|
}
|
|
158332
158569
|
async function startChatSession(options) {
|
|
158333
|
-
(0,
|
|
158570
|
+
(0, import_code_core6.enableAgentTranscriptPersistence)();
|
|
158334
158571
|
const headless = options.outputFormat === "json" || options.outputFormat === "stream-json";
|
|
158335
158572
|
const requestedWorkDir = options.workDir;
|
|
158336
158573
|
let workDir = requestedWorkDir;
|
|
@@ -158339,7 +158576,7 @@ async function startChatSession(options) {
|
|
|
158339
158576
|
let peerInbox;
|
|
158340
158577
|
const peerInboxQueue = [];
|
|
158341
158578
|
let modelAlias = options.model;
|
|
158342
|
-
void (0,
|
|
158579
|
+
void (0, import_code_core6.getModelCatalogue)().catch(() => {
|
|
158343
158580
|
});
|
|
158344
158581
|
const canPrompt = !headless && !options.prompt && !options.stdinText && process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
158345
158582
|
if (!trustGrantedByEnv()) {
|
|
@@ -158361,15 +158598,15 @@ Set ${TRUST_ENV_VAR}=1 to confirm non-interactively, or run \`nex\` interactivel
|
|
|
158361
158598
|
process.stdout.write("Not trusted \u2014 exiting without loading this folder.\n");
|
|
158362
158599
|
process.exit(0);
|
|
158363
158600
|
}
|
|
158364
|
-
await new Promise((
|
|
158601
|
+
await new Promise((resolve5) => setImmediate(resolve5));
|
|
158365
158602
|
if (process.stdin.isTTY)
|
|
158366
158603
|
process.stdin.setRawMode(true);
|
|
158367
158604
|
}
|
|
158368
158605
|
if (options.worktree !== void 0) {
|
|
158369
158606
|
const requestedName = typeof options.worktree === "string" ? options.worktree : void 0;
|
|
158370
|
-
const existing = requestedName ? (0,
|
|
158607
|
+
const existing = requestedName ? (0, import_code_core6.findWorktreeByName)(requestedWorkDir, requestedName) : null;
|
|
158371
158608
|
if (existing) {
|
|
158372
|
-
const entered = (0,
|
|
158609
|
+
const entered = (0, import_code_core6.enterWorktree)(existing);
|
|
158373
158610
|
if (!entered.ok) {
|
|
158374
158611
|
process.stderr.write(`Failed to resume worktree "${requestedName}": ${entered.error}
|
|
158375
158612
|
`);
|
|
@@ -158379,7 +158616,7 @@ Set ${TRUST_ENV_VAR}=1 to confirm non-interactively, or run \`nex\` interactivel
|
|
|
158379
158616
|
if (!headless)
|
|
158380
158617
|
console.log(source_default.dim(` Resumed worktree: ${source_default.bold(existing.name)} (${existing.worktreePath})`));
|
|
158381
158618
|
} else {
|
|
158382
|
-
const created = (0,
|
|
158619
|
+
const created = (0, import_code_core6.createWorktree)(requestedWorkDir, requestedName);
|
|
158383
158620
|
if (!created.ok || !created.state) {
|
|
158384
158621
|
process.stderr.write(`Failed to create worktree: ${created.error ?? "unknown error"}
|
|
158385
158622
|
`);
|
|
@@ -158398,7 +158635,7 @@ Set ${TRUST_ENV_VAR}=1 to confirm non-interactively, or run \`nex\` interactivel
|
|
|
158398
158635
|
process.on("exit", () => {
|
|
158399
158636
|
if (!worktreeState)
|
|
158400
158637
|
return;
|
|
158401
|
-
const hadWork = (0,
|
|
158638
|
+
const hadWork = (0, import_code_core6.worktreeHasWork)(worktreeState);
|
|
158402
158639
|
if (hadWork) {
|
|
158403
158640
|
process.stderr.write(
|
|
158404
158641
|
`
|
|
@@ -158409,7 +158646,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
158409
158646
|
);
|
|
158410
158647
|
return;
|
|
158411
158648
|
}
|
|
158412
|
-
(0,
|
|
158649
|
+
(0, import_code_core6.removeWorktree)(worktreeState);
|
|
158413
158650
|
});
|
|
158414
158651
|
}
|
|
158415
158652
|
const env4 = collectEnv(workDir);
|
|
@@ -158417,8 +158654,8 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
158417
158654
|
const interactive = !headless && !options.prompt && !options.stdinText;
|
|
158418
158655
|
let peerHeartbeatTimer;
|
|
158419
158656
|
if (interactive) {
|
|
158420
|
-
const handle2 = (0,
|
|
158421
|
-
const inbox = (0,
|
|
158657
|
+
const handle2 = (0, import_code_core6.registerPeer)({ clientType: "cli", workDir: requestedWorkDir });
|
|
158658
|
+
const inbox = (0, import_code_core6.startPeerInbox)(handle2.record.id, { onMessage: (m2) => peerInboxQueue.push(m2) });
|
|
158422
158659
|
handle2.record.socketPath = inbox.socketPath;
|
|
158423
158660
|
handle2.heartbeat();
|
|
158424
158661
|
peerHandle = handle2;
|
|
@@ -158488,7 +158725,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
158488
158725
|
const ruleCount = permRules.allow.length + permRules.ask.length + permRules.deny.length;
|
|
158489
158726
|
if (ruleCount && !headless)
|
|
158490
158727
|
console.log(source_default.dim(` ${ruleCount} permission rule(s) loaded`));
|
|
158491
|
-
let skills = (0,
|
|
158728
|
+
let skills = (0, import_code_core6.loadSkills)(workDir);
|
|
158492
158729
|
if (skills.length && !headless)
|
|
158493
158730
|
console.log(source_default.dim(` ${skills.length} skill(s) loaded`));
|
|
158494
158731
|
const mcpStarted = (async () => {
|
|
@@ -158520,7 +158757,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
158520
158757
|
sessionId = stored.id;
|
|
158521
158758
|
sessionTitle = stored.title;
|
|
158522
158759
|
try {
|
|
158523
|
-
const compacted = await (0,
|
|
158760
|
+
const compacted = await (0, import_code_core6.compactMessagesForResume)(messages, {
|
|
158524
158761
|
workDir,
|
|
158525
158762
|
model: modelAlias,
|
|
158526
158763
|
clientType: "cli"
|
|
@@ -158534,7 +158771,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
158534
158771
|
console.log();
|
|
158535
158772
|
}
|
|
158536
158773
|
}
|
|
158537
|
-
const checkpoints = new
|
|
158774
|
+
const checkpoints = new import_code_core6.CheckpointManager(workDir, sessionId);
|
|
158538
158775
|
if (options.audit) {
|
|
158539
158776
|
const auditPath = enableAudit({
|
|
158540
158777
|
filePath: typeof options.audit === "string" ? options.audit : void 0,
|
|
@@ -158552,7 +158789,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
158552
158789
|
sessionTitle = raw.length > 60 ? raw.slice(0, 60) + "\u2026" : raw;
|
|
158553
158790
|
};
|
|
158554
158791
|
const recoverTurn = (err, current) => {
|
|
158555
|
-
const salvaged = (0,
|
|
158792
|
+
const salvaged = (0, import_code_core6.salvageHistory)(err);
|
|
158556
158793
|
console.error("\n" + source_default.red("Error: ") + String(err.message));
|
|
158557
158794
|
if (!salvaged)
|
|
158558
158795
|
return current;
|
|
@@ -158602,7 +158839,7 @@ ${text}` : "");
|
|
|
158602
158839
|
continue;
|
|
158603
158840
|
}
|
|
158604
158841
|
const notes = cliBackgroundAgents.takeNotifications();
|
|
158605
|
-
messages.push({ role: "user", content: [{ type: "text", text: (0,
|
|
158842
|
+
messages.push({ role: "user", content: [{ type: "text", text: (0, import_code_core6.formatBackgroundNotifications)(notes) }] });
|
|
158606
158843
|
result = await runOnce();
|
|
158607
158844
|
messages = result.messages;
|
|
158608
158845
|
}
|
|
@@ -158614,7 +158851,7 @@ ${text}` : "");
|
|
|
158614
158851
|
await new Promise((r2) => setImmediate(r2));
|
|
158615
158852
|
process.exit(0);
|
|
158616
158853
|
} catch (err) {
|
|
158617
|
-
const salvaged = (0,
|
|
158854
|
+
const salvaged = (0, import_code_core6.salvageHistory)(err);
|
|
158618
158855
|
if (salvaged) {
|
|
158619
158856
|
messages = salvaged;
|
|
158620
158857
|
try {
|
|
@@ -158682,9 +158919,15 @@ ${text}` : "");
|
|
|
158682
158919
|
updateFooter();
|
|
158683
158920
|
const syncSlashMenu = () => {
|
|
158684
158921
|
if (interactive)
|
|
158685
|
-
getInkTerminal().setSlashEntries([...BUILTIN_SLASH_COMMANDS, ...skillEntries((0,
|
|
158922
|
+
getInkTerminal().setSlashEntries([...BUILTIN_SLASH_COMMANDS, ...skillEntries((0, import_code_core6.userInvokableSkills)(skills))]);
|
|
158686
158923
|
};
|
|
158687
158924
|
syncSlashMenu();
|
|
158925
|
+
if (interactive) {
|
|
158926
|
+
getInkTerminal().onCycleMode(() => {
|
|
158927
|
+
agentMode = nextMode(agentMode);
|
|
158928
|
+
updateFooter();
|
|
158929
|
+
});
|
|
158930
|
+
}
|
|
158688
158931
|
const takePendingInput = rl instanceof InkReadlineAdapter ? () => rl.takePendingInput() : void 0;
|
|
158689
158932
|
let inputBuffer = "";
|
|
158690
158933
|
rl.on("line", async (rawLine) => {
|
|
@@ -158726,7 +158969,8 @@ ${text}` : "");
|
|
|
158726
158969
|
messages = [];
|
|
158727
158970
|
sessionId = crypto4.randomBytes(8).toString("hex");
|
|
158728
158971
|
sessionTitle = "";
|
|
158729
|
-
(0,
|
|
158972
|
+
(0, import_code_core7.resetSessionSubAgentBudget)();
|
|
158973
|
+
sessionUsage.reset();
|
|
158730
158974
|
cliBackgroundAgents.stopAll({ dropPending: true });
|
|
158731
158975
|
inputBuffer = "";
|
|
158732
158976
|
if (interactive)
|
|
@@ -158763,8 +159007,9 @@ ${text}` : "");
|
|
|
158763
159007
|
messages = stored.messages;
|
|
158764
159008
|
sessionId = stored.id;
|
|
158765
159009
|
sessionTitle = stored.title;
|
|
159010
|
+
sessionUsage.reset();
|
|
158766
159011
|
try {
|
|
158767
|
-
await (0,
|
|
159012
|
+
await (0, import_code_core6.compactMessagesForResume)(messages, {
|
|
158768
159013
|
workDir,
|
|
158769
159014
|
model: modelAlias,
|
|
158770
159015
|
clientType: "cli"
|
|
@@ -158879,7 +159124,7 @@ ${summaryText}` }] },
|
|
|
158879
159124
|
case "/init": {
|
|
158880
159125
|
const nexrallMdPath = path7.join(workDir, "nexrall.md");
|
|
158881
159126
|
if (fs9.existsSync(nexrallMdPath)) {
|
|
158882
|
-
const answer = await new Promise((
|
|
159127
|
+
const answer = await new Promise((resolve5) => rl.question(source_default.yellow(" nexrall.md already exists. Overwrite? [y/n] "), (a) => resolve5(a.trim())));
|
|
158883
159128
|
if (answer !== "y" && answer !== "yes") {
|
|
158884
159129
|
console.log(source_default.dim(" Cancelled."));
|
|
158885
159130
|
rl.prompt();
|
|
@@ -158939,13 +159184,13 @@ ${dirList}`;
|
|
|
158939
159184
|
const sub = arg.trim().toLowerCase();
|
|
158940
159185
|
console.log();
|
|
158941
159186
|
if (sub === "list") {
|
|
158942
|
-
const all = (0,
|
|
159187
|
+
const all = (0, import_code_core6.listWorktrees)(requestedWorkDir);
|
|
158943
159188
|
if (!all.length) {
|
|
158944
159189
|
console.log(source_default.dim(" No worktrees under this project."));
|
|
158945
159190
|
} else {
|
|
158946
159191
|
console.log(source_default.bold(` Worktrees (${all.length})`));
|
|
158947
159192
|
for (const w of all) {
|
|
158948
|
-
const dirty = (0,
|
|
159193
|
+
const dirty = (0, import_code_core6.worktreeHasWork)(w) ? source_default.yellow("dirty") : source_default.dim("clean");
|
|
158949
159194
|
console.log(` ${source_default.cyan(w.name)} ${source_default.dim(w.worktreePath)} [${dirty}]`);
|
|
158950
159195
|
}
|
|
158951
159196
|
console.log();
|
|
@@ -158983,7 +159228,7 @@ ${dirList}`;
|
|
|
158983
159228
|
if (!targetName || !text) {
|
|
158984
159229
|
console.log(source_default.dim(" Usage: /peers send <name> <message>"));
|
|
158985
159230
|
} else {
|
|
158986
|
-
const target = (0,
|
|
159231
|
+
const target = (0, import_code_core6.listPeers)().find((p) => p.name === targetName);
|
|
158987
159232
|
if (!target) {
|
|
158988
159233
|
console.log(source_default.red(` No live session named "${targetName}". Use /peers to list who's reachable.`));
|
|
158989
159234
|
} else if (!target.socketPath) {
|
|
@@ -159000,7 +159245,7 @@ ${dirList}`;
|
|
|
159000
159245
|
console.log(source_default.dim(" Usage: /peers broadcast <message>"));
|
|
159001
159246
|
} else {
|
|
159002
159247
|
const { broadcastPeerMessage } = await Promise.resolve().then(() => __toESM(require_dist3(), 1));
|
|
159003
|
-
const targets = (0,
|
|
159248
|
+
const targets = (0, import_code_core6.listPeers)(peerHandle.record.id).filter((p) => p.id !== peerHandle.record.id && p.socketPath && p.inbound !== "refuse").map((p) => ({ name: p.name, socketPath: p.socketPath }));
|
|
159004
159249
|
if (!targets.length) {
|
|
159005
159250
|
console.log(source_default.dim(" No other reachable Nexrall Code sessions to broadcast to."));
|
|
159006
159251
|
} else {
|
|
@@ -159012,7 +159257,7 @@ ${dirList}`;
|
|
|
159012
159257
|
}
|
|
159013
159258
|
}
|
|
159014
159259
|
} else {
|
|
159015
|
-
const peers = (0,
|
|
159260
|
+
const peers = (0, import_code_core6.listPeers)(peerHandle.record.id);
|
|
159016
159261
|
if (peers.length <= 1) {
|
|
159017
159262
|
console.log(source_default.dim(" No other Nexrall Code sessions are currently discoverable on this machine."));
|
|
159018
159263
|
} else {
|
|
@@ -159040,9 +159285,9 @@ ${dirList}`;
|
|
|
159040
159285
|
const memScope = wantsGlobalOnly ? "global" : "project";
|
|
159041
159286
|
if (wantsClear) {
|
|
159042
159287
|
const label = memScope === "global" ? "GLOBAL" : "this PROJECT's";
|
|
159043
|
-
const answer = await new Promise((
|
|
159288
|
+
const answer = await new Promise((resolve5) => rl.question(source_default.yellow(` Clear ${label} memory? This cannot be undone. [y/n] `), (a) => resolve5(a.trim())));
|
|
159044
159289
|
if (answer === "y" || answer === "yes") {
|
|
159045
|
-
(0,
|
|
159290
|
+
(0, import_code_core6.clearMemory)(memScope, workDir);
|
|
159046
159291
|
console.log(source_default.green(` ${memScope === "global" ? "Global" : "Project"} memory cleared.`));
|
|
159047
159292
|
} else {
|
|
159048
159293
|
console.log(source_default.dim(" Cancelled."));
|
|
@@ -159053,20 +159298,20 @@ ${dirList}`;
|
|
|
159053
159298
|
}
|
|
159054
159299
|
console.log();
|
|
159055
159300
|
if (wantsGlobalOnly) {
|
|
159056
|
-
const stats = (0,
|
|
159057
|
-
const content = (0,
|
|
159301
|
+
const stats = (0, import_code_core6.memoryStats)("global");
|
|
159302
|
+
const content = (0, import_code_core6.readMemory)("global", void 0, { includeArchived: wantsArchived });
|
|
159058
159303
|
const archivedNote = stats.archived > 0 ? `, ${stats.archived} archived` : "";
|
|
159059
159304
|
console.log(source_default.bold(" Global memory ") + source_default.dim(`(${stats.entries} entries${archivedNote}, ${(stats.bytes / 1024).toFixed(1)}KB) \u2014 ${stats.file}`));
|
|
159060
159305
|
console.log();
|
|
159061
159306
|
console.log(content || source_default.dim(" No global memories saved yet."));
|
|
159062
159307
|
} else {
|
|
159063
|
-
const projStats = (0,
|
|
159064
|
-
const globalStats = (0,
|
|
159308
|
+
const projStats = (0, import_code_core6.memoryStats)("project", workDir);
|
|
159309
|
+
const globalStats = (0, import_code_core6.memoryStats)("global");
|
|
159065
159310
|
const projArchived = projStats.archived > 0 ? `+${projStats.archived} archived ` : "";
|
|
159066
159311
|
const globalArchived = globalStats.archived > 0 ? `+${globalStats.archived} archived ` : "";
|
|
159067
159312
|
console.log(source_default.bold(" Memory") + source_default.dim(` \u2014 project: ${projStats.entries} ${projArchived}entries (${(projStats.bytes / 1024).toFixed(1)}KB) \xB7 global: ${globalStats.entries} ${globalArchived}entries (${(globalStats.bytes / 1024).toFixed(1)}KB)`));
|
|
159068
159313
|
console.log();
|
|
159069
|
-
const merged = (0,
|
|
159314
|
+
const merged = (0, import_code_core6.readAllMemory)(workDir, { includeArchived: wantsArchived });
|
|
159070
159315
|
console.log(merged || source_default.dim(" No memories saved yet."));
|
|
159071
159316
|
}
|
|
159072
159317
|
console.log();
|
|
@@ -159105,12 +159350,12 @@ ${dirList}`;
|
|
|
159105
159350
|
console.log(source_default.dim(` Current: ${source_default.cyan(agentMode)}`));
|
|
159106
159351
|
for (const m2 of ["ask", "edit", "auto", "plan"]) {
|
|
159107
159352
|
const marker = m2 === agentMode ? source_default.cyan("\u276F") : " ";
|
|
159108
|
-
console.log(` ${marker} ${source_default.bold(m2.padEnd(5))} ${source_default.dim((0,
|
|
159353
|
+
console.log(` ${marker} ${source_default.bold(m2.padEnd(5))} ${source_default.dim((0, import_code_core7.describeMode)(m2).replace(`${m2} \u2014 `, ""))}`);
|
|
159109
159354
|
}
|
|
159110
159355
|
} else if (["ask", "edit", "plan", "auto"].includes(modeArg)) {
|
|
159111
159356
|
agentMode = modeArg;
|
|
159112
159357
|
updateFooter();
|
|
159113
|
-
console.log(source_default.green(` Mode \u2192 ${source_default.bold(modeArg)}`) + source_default.dim(` ${(0,
|
|
159358
|
+
console.log(source_default.green(` Mode \u2192 ${source_default.bold(modeArg)}`) + source_default.dim(` ${(0, import_code_core7.describeMode)(modeArg).replace(`${modeArg} \u2014 `, "")}`));
|
|
159114
159359
|
} else {
|
|
159115
159360
|
console.log(source_default.red(` Unknown: ${modeArg}`));
|
|
159116
159361
|
}
|
|
@@ -159138,11 +159383,35 @@ ${dirList}`;
|
|
|
159138
159383
|
console.log(source_default.yellow(" Yolo mode: all permissions auto-approved."));
|
|
159139
159384
|
rl.prompt();
|
|
159140
159385
|
return;
|
|
159141
|
-
case "/balance":
|
|
159386
|
+
case "/balance":
|
|
159387
|
+
case "/team": {
|
|
159388
|
+
const sub = arg.split(/\s+/);
|
|
159142
159389
|
rl.pause();
|
|
159143
159390
|
try {
|
|
159144
|
-
|
|
159145
|
-
|
|
159391
|
+
if (cmd === "/team" && sub[0].toLowerCase() === "use") {
|
|
159392
|
+
const target = parseTeamTarget(sub.slice(1).join(" "));
|
|
159393
|
+
if (target === void 0) {
|
|
159394
|
+
console.log(source_default.red(" Usage: /team use <team id|personal> (/team lists the ids)"));
|
|
159395
|
+
} else {
|
|
159396
|
+
await (0, import_code_core6.setBillingTarget)(target);
|
|
159397
|
+
console.log(source_default.green(` \u2713 Usage will now be billed to ${target === null ? "your personal wallet" : `team ${target}`}.`));
|
|
159398
|
+
if (target !== null)
|
|
159399
|
+
console.log(source_default.dim(" This applies to every product and client on this account, not just the CLI."));
|
|
159400
|
+
}
|
|
159401
|
+
} else {
|
|
159402
|
+
try {
|
|
159403
|
+
const orgs = await (0, import_code_core6.getOrgs)();
|
|
159404
|
+
const pin = (0, import_code_core6.billingOverrideFields)();
|
|
159405
|
+
for (const l2 of billingLines(orgs, "teamId" in pin ? pin.teamId : void 0)) {
|
|
159406
|
+
console.log(l2.startsWith("!") ? source_default.yellow(" " + l2) : " " + l2);
|
|
159407
|
+
}
|
|
159408
|
+
} catch (orgErr) {
|
|
159409
|
+
if (cmd === "/team")
|
|
159410
|
+
throw orgErr;
|
|
159411
|
+
const bal = await (0, import_code_core6.getBalance)();
|
|
159412
|
+
console.log(source_default.dim(" Balance: ") + source_default.cyan(`$${bal.toFixed(4)}`));
|
|
159413
|
+
}
|
|
159414
|
+
}
|
|
159146
159415
|
} catch (err) {
|
|
159147
159416
|
console.error(source_default.red(" Failed: ") + String(err.message));
|
|
159148
159417
|
}
|
|
@@ -159150,6 +159419,115 @@ ${dirList}`;
|
|
|
159150
159419
|
rl.prompt();
|
|
159151
159420
|
return;
|
|
159152
159421
|
}
|
|
159422
|
+
case "/cost": {
|
|
159423
|
+
for (const l2 of costLines(sessionUsage))
|
|
159424
|
+
console.log(" " + l2);
|
|
159425
|
+
console.log(source_default.dim(" (/balance shows what is left in your wallet or team)"));
|
|
159426
|
+
rl.prompt();
|
|
159427
|
+
return;
|
|
159428
|
+
}
|
|
159429
|
+
case "/status": {
|
|
159430
|
+
const rows = [
|
|
159431
|
+
["Version", CLI_VERSION],
|
|
159432
|
+
["Model", modelAlias],
|
|
159433
|
+
["Mode", agentMode + (isYoloMode() ? " (auto-approve all)" : "")],
|
|
159434
|
+
["Effort", effortLevel],
|
|
159435
|
+
["Directory", workDir],
|
|
159436
|
+
["Session", `${sessionTitle || "Untitled"} (${sessionId.slice(0, 8)})`],
|
|
159437
|
+
["Messages", String(messages.length)],
|
|
159438
|
+
["Cost", sessionUsage.costReported ? `$${sessionUsage.cost.toFixed(4)}` : "n/a"]
|
|
159439
|
+
];
|
|
159440
|
+
for (const [k, v] of rows)
|
|
159441
|
+
console.log(" " + source_default.cyan(k.padEnd(10)) + v);
|
|
159442
|
+
rl.prompt();
|
|
159443
|
+
return;
|
|
159444
|
+
}
|
|
159445
|
+
case "/copy": {
|
|
159446
|
+
const text = lastAssistantText(messages);
|
|
159447
|
+
if (!text) {
|
|
159448
|
+
console.log(source_default.dim(" Nothing to copy yet."));
|
|
159449
|
+
rl.prompt();
|
|
159450
|
+
return;
|
|
159451
|
+
}
|
|
159452
|
+
const via = copyToClipboard(text);
|
|
159453
|
+
if (via) {
|
|
159454
|
+
console.log(source_default.green(` Copied last reply (${text.length.toLocaleString()} chars).`));
|
|
159455
|
+
} else {
|
|
159456
|
+
process.stdout.write(osc52(text));
|
|
159457
|
+
console.log(source_default.yellow(" No clipboard tool found \u2014 sent it via the terminal (OSC 52); if nothing was copied, use /export."));
|
|
159458
|
+
}
|
|
159459
|
+
rl.prompt();
|
|
159460
|
+
return;
|
|
159461
|
+
}
|
|
159462
|
+
case "/export": {
|
|
159463
|
+
if (!messages.length) {
|
|
159464
|
+
console.log(source_default.dim(" Nothing to export yet."));
|
|
159465
|
+
rl.prompt();
|
|
159466
|
+
return;
|
|
159467
|
+
}
|
|
159468
|
+
const file = path7.resolve(workDir, arg || `nexrall-session-${sessionId.slice(0, 8)}.md`);
|
|
159469
|
+
if (fs9.existsSync(file)) {
|
|
159470
|
+
console.log(source_default.red(` ${file} already exists \u2014 pick another name: /export <file>`));
|
|
159471
|
+
} else {
|
|
159472
|
+
try {
|
|
159473
|
+
fs9.writeFileSync(file, exportMarkdown(messages, {
|
|
159474
|
+
title: sessionTitle,
|
|
159475
|
+
sessionId,
|
|
159476
|
+
model: modelAlias,
|
|
159477
|
+
cwd: workDir,
|
|
159478
|
+
exportedAt: /* @__PURE__ */ new Date()
|
|
159479
|
+
}), "utf8");
|
|
159480
|
+
console.log(source_default.green(` Exported ${messages.length} messages \u2192 ${file}`));
|
|
159481
|
+
} catch (err) {
|
|
159482
|
+
console.log(source_default.red(" Export failed: ") + String(err.message));
|
|
159483
|
+
}
|
|
159484
|
+
}
|
|
159485
|
+
rl.prompt();
|
|
159486
|
+
return;
|
|
159487
|
+
}
|
|
159488
|
+
case "/rename": {
|
|
159489
|
+
if (!arg.trim()) {
|
|
159490
|
+
console.log(source_default.dim(` Current title: ${sessionTitle || "(none yet)"} Usage: /rename <new title>`));
|
|
159491
|
+
} else {
|
|
159492
|
+
sessionTitle = arg.trim().slice(0, 80);
|
|
159493
|
+
saveSession(sessionId, sessionTitle, workDir, messages);
|
|
159494
|
+
console.log(source_default.green(` Session renamed: ${source_default.bold(sessionTitle)}`));
|
|
159495
|
+
}
|
|
159496
|
+
rl.prompt();
|
|
159497
|
+
return;
|
|
159498
|
+
}
|
|
159499
|
+
case "/diff": {
|
|
159500
|
+
const ch = gitChanges(workDir);
|
|
159501
|
+
if (!ch)
|
|
159502
|
+
console.log(source_default.dim(" Not a git repository."));
|
|
159503
|
+
else if (!ch.status)
|
|
159504
|
+
console.log(source_default.dim(" No uncommitted changes."));
|
|
159505
|
+
else {
|
|
159506
|
+
console.log(source_default.bold(" Changed files"));
|
|
159507
|
+
for (const l2 of ch.status.split("\n"))
|
|
159508
|
+
console.log(" " + l2);
|
|
159509
|
+
if (ch.stat) {
|
|
159510
|
+
console.log();
|
|
159511
|
+
for (const l2 of ch.stat.split("\n"))
|
|
159512
|
+
console.log(source_default.dim(" " + l2));
|
|
159513
|
+
}
|
|
159514
|
+
}
|
|
159515
|
+
rl.prompt();
|
|
159516
|
+
return;
|
|
159517
|
+
}
|
|
159518
|
+
case "/plan": {
|
|
159519
|
+
agentMode = "plan";
|
|
159520
|
+
updateFooter();
|
|
159521
|
+
console.log(source_default.green(` Mode \u2192 ${source_default.bold("plan")}`) + source_default.dim(` ${(0, import_code_core7.describeMode)("plan").replace("plan \u2014 ", "")} (/mode auto to leave)`));
|
|
159522
|
+
rl.prompt();
|
|
159523
|
+
return;
|
|
159524
|
+
}
|
|
159525
|
+
case "/permissions": {
|
|
159526
|
+
for (const l2 of permissionLines(permRules, agentMode, isYoloMode()))
|
|
159527
|
+
console.log(" " + l2);
|
|
159528
|
+
rl.prompt();
|
|
159529
|
+
return;
|
|
159530
|
+
}
|
|
159153
159531
|
case "/add": {
|
|
159154
159532
|
if (!arg) {
|
|
159155
159533
|
console.log(source_default.red(" Usage: /add <filepath>"));
|
|
@@ -159227,7 +159605,7 @@ ${caption}` : `[Attached: ${rel}]`;
|
|
|
159227
159605
|
if (needsSidecar) {
|
|
159228
159606
|
console.log(source_default.dim(` ${resolveModelLabel(modelAlias)} can't read ${isPdf ? "PDFs" : "images"} directly \u2014 describing ${rel} with Claude Sonnet 5.5 first\u2026`));
|
|
159229
159607
|
try {
|
|
159230
|
-
const { text } = await (0,
|
|
159608
|
+
const { text } = await (0, import_code_core6.describeAttachment)(isPdf ? "pdf" : "image", data, mimeType, rel);
|
|
159231
159609
|
content.push({ type: "text", text: `<attachment_description>
|
|
159232
159610
|
${text}
|
|
159233
159611
|
</attachment_description>` });
|
|
@@ -159271,7 +159649,7 @@ ${text}
|
|
|
159271
159649
|
process.exit(0);
|
|
159272
159650
|
}
|
|
159273
159651
|
case "/plugins": {
|
|
159274
|
-
const plugins = (0,
|
|
159652
|
+
const plugins = (0, import_code_core6.loadPlugins)(workDir);
|
|
159275
159653
|
if (!plugins.length) {
|
|
159276
159654
|
console.log(source_default.dim(" No plugins installed. Install one: nex plugin install owner/repo"));
|
|
159277
159655
|
} else {
|
|
@@ -159284,7 +159662,7 @@ ${text}
|
|
|
159284
159662
|
}
|
|
159285
159663
|
console.log();
|
|
159286
159664
|
}
|
|
159287
|
-
skills = (0,
|
|
159665
|
+
skills = (0, import_code_core6.loadSkills)(workDir);
|
|
159288
159666
|
syncSlashMenu();
|
|
159289
159667
|
rl.prompt();
|
|
159290
159668
|
return;
|
|
@@ -159366,7 +159744,7 @@ ${text}
|
|
|
159366
159744
|
const res = await enableAppleTerminalOptionAsMeta({
|
|
159367
159745
|
run: async (cmd2, args) => {
|
|
159368
159746
|
try {
|
|
159369
|
-
const stdout =
|
|
159747
|
+
const stdout = execFileSync3(cmd2, args, { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
|
|
159370
159748
|
return { code: 0, stdout };
|
|
159371
159749
|
} catch (err) {
|
|
159372
159750
|
const e2 = err;
|
|
@@ -159420,9 +159798,9 @@ ${text}
|
|
|
159420
159798
|
}
|
|
159421
159799
|
case "/skills":
|
|
159422
159800
|
case "/commands": {
|
|
159423
|
-
skills = (0,
|
|
159801
|
+
skills = (0, import_code_core6.loadSkills)(workDir);
|
|
159424
159802
|
syncSlashMenu();
|
|
159425
|
-
const invocable = (0,
|
|
159803
|
+
const invocable = (0, import_code_core6.userInvokableSkills)(skills);
|
|
159426
159804
|
if (!invocable.length) {
|
|
159427
159805
|
console.log(source_default.dim(" No skills. Add .nexrall/skills/<name>/SKILL.md (or .nexrall/commands/<name>.md) to create one."));
|
|
159428
159806
|
} else {
|
|
@@ -159439,15 +159817,15 @@ ${text}
|
|
|
159439
159817
|
return;
|
|
159440
159818
|
}
|
|
159441
159819
|
default: {
|
|
159442
|
-
const custom = (0,
|
|
159820
|
+
const custom = (0, import_code_core6.findSkill)(skills, cmd);
|
|
159443
159821
|
if (!custom) {
|
|
159444
159822
|
console.log(source_default.red(` Unknown command: ${cmd}`));
|
|
159445
159823
|
console.log(source_default.dim(" Type /help for built-ins or /skills for custom ones."));
|
|
159446
159824
|
rl.prompt();
|
|
159447
159825
|
return;
|
|
159448
159826
|
}
|
|
159449
|
-
const expanded = (0,
|
|
159450
|
-
const turnModel = (0,
|
|
159827
|
+
const expanded = (0, import_code_core6.expandSkill)(custom, arg, workDir);
|
|
159828
|
+
const turnModel = (0, import_code_core6.resolveSubAgentModel)(custom.model, modelAlias) ?? modelAlias;
|
|
159451
159829
|
const turnMode = custom.mode ?? agentMode;
|
|
159452
159830
|
console.log(source_default.dim(` Running /${custom.name}\u2026`));
|
|
159453
159831
|
checkpoints.beginTurn(`/${custom.name} ${arg}`.trim(), messages.length);
|
|
@@ -159509,7 +159887,7 @@ ${text}
|
|
|
159509
159887
|
return;
|
|
159510
159888
|
const notes = cliBackgroundAgents.takeNotifications();
|
|
159511
159889
|
console.log(source_default.dim(` \u2699 background agent${notes.length > 1 ? "s" : ""} ${notes.map((n) => `"${n.description}"`).join(", ")} finished \u2014 continuing`));
|
|
159512
|
-
rl.emit("line", (0,
|
|
159890
|
+
rl.emit("line", (0, import_code_core6.formatBackgroundNotifications)(notes));
|
|
159513
159891
|
}, 400);
|
|
159514
159892
|
}
|
|
159515
159893
|
cliBackgroundAgents.onChange(() => {
|
|
@@ -159530,7 +159908,7 @@ ${text}
|
|
|
159530
159908
|
|
|
159531
159909
|
// src/commands/plugin.ts
|
|
159532
159910
|
var import_prompts = __toESM(require_prompts3(), 1);
|
|
159533
|
-
var
|
|
159911
|
+
var import_code_core8 = __toESM(require_dist3(), 1);
|
|
159534
159912
|
function describeInspection(i2, name, ctx) {
|
|
159535
159913
|
console.log();
|
|
159536
159914
|
console.log(source_default.bold(` Plugin: ${name}`) + (i2.meta.version ? source_default.dim(` v${i2.meta.version}`) : ""));
|
|
@@ -159606,14 +159984,14 @@ async function pluginInstallCommand(spec, opts) {
|
|
|
159606
159984
|
let registryName;
|
|
159607
159985
|
const isShortName = /^[\w.-]+$/.test(spec.trim()) && !spec.includes("/");
|
|
159608
159986
|
if (isShortName) {
|
|
159609
|
-
const alias = (0,
|
|
159987
|
+
const alias = (0, import_code_core8.resolveSourceAlias)(spec.trim(), process.cwd(), { includeProject: true });
|
|
159610
159988
|
if (alias) {
|
|
159611
159989
|
source2 = alias.spec;
|
|
159612
159990
|
console.log(source_default.dim(` Source: ${alias.name} (${alias.tier}) \u2190 ${alias.spec}`));
|
|
159613
159991
|
}
|
|
159614
159992
|
}
|
|
159615
159993
|
if (isShortName && source2 === spec) {
|
|
159616
|
-
const entry = await (0,
|
|
159994
|
+
const entry = await (0, import_code_core8.getRegistryPlugin)(spec.trim()).catch(() => null);
|
|
159617
159995
|
if (entry) {
|
|
159618
159996
|
source2 = entry.source;
|
|
159619
159997
|
registryName = entry.name;
|
|
@@ -159628,7 +160006,7 @@ async function pluginInstallCommand(spec, opts) {
|
|
|
159628
160006
|
return;
|
|
159629
160007
|
}
|
|
159630
160008
|
}
|
|
159631
|
-
const res = await (0,
|
|
160009
|
+
const res = await (0, import_code_core8.installPlugin)(source2, {
|
|
159632
160010
|
scope,
|
|
159633
160011
|
workDir: process.cwd(),
|
|
159634
160012
|
name: opts.name ?? registryName,
|
|
@@ -159636,7 +160014,7 @@ async function pluginInstallCommand(spec, opts) {
|
|
|
159636
160014
|
confirm: (i2, name, ctx) => confirmInstall(i2, name, opts.yes === true, ctx)
|
|
159637
160015
|
});
|
|
159638
160016
|
if (registryName)
|
|
159639
|
-
(0,
|
|
160017
|
+
(0, import_code_core8.reportInstall)(registryName);
|
|
159640
160018
|
console.log();
|
|
159641
160019
|
console.log(source_default.green(` \u2713 Installed "${res.name}" (${res.scope}) \u2192 ${res.dir}`) + (res.sha ? source_default.dim(` @ ${res.sha.slice(0, 7)}`) : ""));
|
|
159642
160020
|
if (res.inspection.commands.length) {
|
|
@@ -159650,7 +160028,7 @@ async function pluginInstallCommand(spec, opts) {
|
|
|
159650
160028
|
}
|
|
159651
160029
|
function pluginRemoveCommand(name, opts) {
|
|
159652
160030
|
try {
|
|
159653
|
-
const dir = (0,
|
|
160031
|
+
const dir = (0, import_code_core8.removePlugin)(name, {
|
|
159654
160032
|
scope: opts.project ? "project" : void 0,
|
|
159655
160033
|
// no flag → search both scopes
|
|
159656
160034
|
workDir: process.cwd()
|
|
@@ -159663,14 +160041,14 @@ function pluginRemoveCommand(name, opts) {
|
|
|
159663
160041
|
}
|
|
159664
160042
|
async function pluginUpdateCommand(name, opts) {
|
|
159665
160043
|
const workDir = process.cwd();
|
|
159666
|
-
const targets = name ? [name] : (0,
|
|
160044
|
+
const targets = name ? [name] : (0, import_code_core8.loadPlugins)(workDir).filter((p) => (0, import_code_core8.readReceipt)(p.dir)?.kind === "github").map((p) => p.name);
|
|
159667
160045
|
if (!targets.length) {
|
|
159668
160046
|
console.log(source_default.dim(" No updatable plugins (only GitHub-installed plugins with receipts can update)."));
|
|
159669
160047
|
return;
|
|
159670
160048
|
}
|
|
159671
160049
|
for (const t2 of targets) {
|
|
159672
160050
|
try {
|
|
159673
|
-
const res = await (0,
|
|
160051
|
+
const res = await (0, import_code_core8.updatePlugin)(t2, {
|
|
159674
160052
|
workDir,
|
|
159675
160053
|
confirm: (i2, n, ctx) => confirmInstall(i2, n, opts.yes === true, ctx)
|
|
159676
160054
|
});
|
|
@@ -159687,7 +160065,7 @@ function badgeFor(p) {
|
|
|
159687
160065
|
}
|
|
159688
160066
|
async function pluginSearchCommand(query) {
|
|
159689
160067
|
try {
|
|
159690
|
-
const results = await (0,
|
|
160068
|
+
const results = await (0, import_code_core8.searchRegistry)(query);
|
|
159691
160069
|
if (!results.length) {
|
|
159692
160070
|
console.log(source_default.dim(query ? ` No plugins matching "${query}".` : " Registry is empty."));
|
|
159693
160071
|
return;
|
|
@@ -159710,7 +160088,7 @@ async function pluginSearchCommand(query) {
|
|
|
159710
160088
|
}
|
|
159711
160089
|
async function pluginInfoCommand(name) {
|
|
159712
160090
|
try {
|
|
159713
|
-
const p = await (0,
|
|
160091
|
+
const p = await (0, import_code_core8.getRegistryPlugin)(name);
|
|
159714
160092
|
if (!p) {
|
|
159715
160093
|
console.error(source_default.red(` \u2717 "${name}" not found in the registry.`));
|
|
159716
160094
|
process.exitCode = 1;
|
|
@@ -159746,7 +160124,7 @@ async function pluginInfoCommand(name) {
|
|
|
159746
160124
|
}
|
|
159747
160125
|
}
|
|
159748
160126
|
function pluginListCommand() {
|
|
159749
|
-
const plugins = (0,
|
|
160127
|
+
const plugins = (0, import_code_core8.loadPlugins)(process.cwd());
|
|
159750
160128
|
if (!plugins.length) {
|
|
159751
160129
|
console.log(source_default.dim(" No plugins installed."));
|
|
159752
160130
|
console.log(source_default.dim(" Install one: nex plugin install owner/repo"));
|
|
@@ -159755,10 +160133,10 @@ function pluginListCommand() {
|
|
|
159755
160133
|
console.log();
|
|
159756
160134
|
console.log(source_default.bold(" Installed plugins:"));
|
|
159757
160135
|
for (const p of plugins) {
|
|
159758
|
-
const receipt = (0,
|
|
160136
|
+
const receipt = (0, import_code_core8.readReceipt)(p.dir);
|
|
159759
160137
|
const src = receipt ? source_default.dim(` \u2190 ${receipt.source}`) : source_default.dim(" (manual)");
|
|
159760
160138
|
const at = receipt?.sha ? source_default.dim(` @ ${receipt.sha.slice(0, 7)}`) : "";
|
|
159761
|
-
const insp = (0,
|
|
160139
|
+
const insp = (0, import_code_core8.inspectPluginDir)(p.dir);
|
|
159762
160140
|
const runs = insp.hasHooks || insp.hasMcp ? source_default.yellow(` \u26A0 ${[insp.hasHooks && "hooks", insp.hasMcp && "mcp"].filter(Boolean).join("+")}`) : "";
|
|
159763
160141
|
console.log(
|
|
159764
160142
|
" " + source_default.cyan(p.name.padEnd(24)) + source_default.dim(`${(p.version ?? "").padEnd(10)}${p.scope.padEnd(9)}`) + src + at + runs
|
|
@@ -159768,8 +160146,8 @@ function pluginListCommand() {
|
|
|
159768
160146
|
}
|
|
159769
160147
|
function pluginSourceListCommand() {
|
|
159770
160148
|
const workDir = process.cwd();
|
|
159771
|
-
const sources = (0,
|
|
159772
|
-
const patterns = (0,
|
|
160149
|
+
const sources = (0, import_code_core8.loadDeclaredSources)(workDir, { includeProject: true });
|
|
160150
|
+
const patterns = (0, import_code_core8.allowedSourcePatterns)();
|
|
159773
160151
|
if (patterns) {
|
|
159774
160152
|
console.log();
|
|
159775
160153
|
console.log(source_default.bold(" Organisation policy: ") + source_default.dim(`installs restricted to ${patterns.join(", ")}`));
|
|
@@ -159784,7 +160162,7 @@ function pluginSourceListCommand() {
|
|
|
159784
160162
|
console.log(source_default.bold(" Declared plugin sources:"));
|
|
159785
160163
|
for (const s2 of sources) {
|
|
159786
160164
|
const tier = s2.tier === "project" ? source_default.yellow(s2.tier.padEnd(9)) : source_default.dim(s2.tier.padEnd(9));
|
|
159787
|
-
const blocked = !(0,
|
|
160165
|
+
const blocked = !(0, import_code_core8.isSourceAllowed)(s2.spec, patterns) ? source_default.red(" \u2717 blocked by policy") : "";
|
|
159788
160166
|
console.log(" " + source_default.cyan(s2.name.padEnd(20)) + tier + source_default.white(s2.spec) + blocked);
|
|
159789
160167
|
}
|
|
159790
160168
|
console.log();
|
|
@@ -159794,17 +160172,17 @@ function pluginSourceListCommand() {
|
|
|
159794
160172
|
}
|
|
159795
160173
|
function pluginSourceAddCommand(name, spec, opts) {
|
|
159796
160174
|
try {
|
|
159797
|
-
(0,
|
|
159798
|
-
const patterns = (0,
|
|
159799
|
-
if (patterns && !(0,
|
|
160175
|
+
(0, import_code_core8.parsePluginSource)(spec);
|
|
160176
|
+
const patterns = (0, import_code_core8.allowedSourcePatterns)();
|
|
160177
|
+
if (patterns && !(0, import_code_core8.isSourceAllowed)(spec, patterns)) {
|
|
159800
160178
|
console.error(source_default.red(` \u2717 "${spec}" is not permitted by your organisation's policy.`));
|
|
159801
160179
|
console.error(source_default.dim(` Allowed: ${patterns.join(", ")}`));
|
|
159802
160180
|
process.exitCode = 1;
|
|
159803
160181
|
return;
|
|
159804
160182
|
}
|
|
159805
160183
|
const scope = opts.project ? "project" : "user";
|
|
159806
|
-
const file = (0,
|
|
159807
|
-
(0,
|
|
160184
|
+
const file = (0, import_code_core8.sourcesFileFor)(scope, process.cwd());
|
|
160185
|
+
(0, import_code_core8.writeDeclaredSource)(file, name, spec);
|
|
159808
160186
|
console.log();
|
|
159809
160187
|
console.log(source_default.green(` \u2713 Declared "${name}" \u2192 ${spec}`) + source_default.dim(` (${scope})`));
|
|
159810
160188
|
console.log(source_default.dim(` ${file}`));
|
|
@@ -159818,13 +160196,13 @@ function pluginSourceAddCommand(name, spec, opts) {
|
|
|
159818
160196
|
function pluginSourceRemoveCommand(name, opts) {
|
|
159819
160197
|
const workDir = process.cwd();
|
|
159820
160198
|
const scope = opts.project ? "project" : "user";
|
|
159821
|
-
const file = (0,
|
|
159822
|
-
if ((0,
|
|
160199
|
+
const file = (0, import_code_core8.sourcesFileFor)(scope, workDir);
|
|
160200
|
+
if ((0, import_code_core8.removeDeclaredSource)(file, name)) {
|
|
159823
160201
|
console.log(source_default.green(` \u2713 Removed source "${name}" (${scope})`));
|
|
159824
160202
|
console.log(source_default.dim(" Plugins already installed from it are untouched \u2014 remove them with nex plugin remove <name>"));
|
|
159825
160203
|
return;
|
|
159826
160204
|
}
|
|
159827
|
-
const found = (0,
|
|
160205
|
+
const found = (0, import_code_core8.resolveSourceAlias)(name, workDir, { includeProject: true });
|
|
159828
160206
|
if (found) {
|
|
159829
160207
|
console.error(source_default.red(` \u2717 "${name}" is declared in the ${found.tier} tier, not ${scope}.`));
|
|
159830
160208
|
console.error(source_default.dim(` ${found.file}`));
|
|
@@ -159921,7 +160299,7 @@ program2.command("sessions").description("List or delete saved chat sessions").o
|
|
|
159921
160299
|
console.log();
|
|
159922
160300
|
});
|
|
159923
160301
|
program2.option("-p, --pro", "Use Claude Opus 5.5 (most capable)").option("-t, --turbo", "Use Claude Sonnet 5.5 (fast)").option("-u, --ultra", "Use Claude Fable 5.1 (most powerful)").option("-y, --yolo", "Auto-approve all tool calls (no permission prompts)").option("-d, --dir <path>", "Set working directory (default: current directory)").option("-m, --model <name>", "Explicit model, e.g. claude-opus-5-5 | gpt-5.4 | gpt-4.1").option("-r, --resume [id]", "Resume last session, or a specific session id").option("-w, --worktree [name]", "Isolate this session in its own worktree \u2014 a separate directory (and, in a git repo, its own branch) so it can never overwrite files another session (or you) are touching in the main checkout. Omit a name for an auto-generated one; pass an existing name to resume that same worktree.").option("-e, --effort <level>", "Thinking effort \u2014 real levels depend on the model (e.g. DeepSeek: low|high|max, Qwen: low|high); run `nex --model <id>` then `/effort` with no argument to see a model's scale").option("--no-banner", "Skip the ASCII banner (useful in scripts/pipes)").option("--output-format <fmt>", "One-shot output format: text | json | stream-json (implies auto-approve)").option("--audit [path]", "Log every tool call (and refusal) to a JSONL trail (default: .nexrall/audit/<session>.jsonl)").argument("[prompt...]", "One-shot prompt \u2014 if omitted, starts interactive mode").action(async (promptParts, options) => {
|
|
159924
|
-
if (!(0,
|
|
160302
|
+
if (!(0, import_code_core9.isAuthenticated)()) {
|
|
159925
160303
|
console.error("Not logged in. Run: nex auth");
|
|
159926
160304
|
process.exit(1);
|
|
159927
160305
|
}
|
|
@@ -159933,10 +160311,10 @@ program2.option("-p, --pro", "Use Claude Opus 5.5 (most capable)").option("-t, -
|
|
|
159933
160311
|
const worktree = options.worktree === true ? true : typeof options.worktree === "string" ? options.worktree : void 0;
|
|
159934
160312
|
let stdinText;
|
|
159935
160313
|
if (!process.stdin.isTTY) {
|
|
159936
|
-
stdinText = await new Promise((
|
|
160314
|
+
stdinText = await new Promise((resolve5, reject) => {
|
|
159937
160315
|
const chunks = [];
|
|
159938
160316
|
process.stdin.on("data", (chunk) => chunks.push(chunk));
|
|
159939
|
-
process.stdin.on("end", () =>
|
|
160317
|
+
process.stdin.on("end", () => resolve5(Buffer.concat(chunks).toString("utf-8").trim()));
|
|
159940
160318
|
process.stdin.on("error", reject);
|
|
159941
160319
|
});
|
|
159942
160320
|
if (!stdinText)
|