@tenex-chat/backend 0.9.7 → 0.9.9
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 +318 -2096
- package/package.json +3 -1
- package/src/llm/providers/registry/ProviderRegistry.ts +1 -1
- package/src/prompts/utils/systemPromptBuilder.ts +2 -2
- package/src/services/dispatch/AgentDispatchService.ts +1 -1
- package/src/services/image/ImageGenerationService.ts +2 -4
- package/src/services/rag/EmbeddingProviderFactory.ts +1 -2
- package/src/tools/implementations/shell.ts +1 -2
package/dist/index.js
CHANGED
|
@@ -1,42 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
4
|
var __esm = (fn, res) => function __init() {
|
|
15
5
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
6
|
};
|
|
17
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
-
};
|
|
20
7
|
var __export = (target, all) => {
|
|
21
8
|
for (var name in all)
|
|
22
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
10
|
};
|
|
24
|
-
var __copyProps = (to, from, except, desc) => {
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
-
for (let key of __getOwnPropNames(from))
|
|
27
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
-
}
|
|
30
|
-
return to;
|
|
31
|
-
};
|
|
32
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
-
mod
|
|
39
|
-
));
|
|
40
11
|
|
|
41
12
|
// src/telemetry/LLMSpanRegistry.ts
|
|
42
13
|
function setLLMSpanId(traceId, spanId) {
|
|
@@ -414,14 +385,6 @@ async function directoryExists(dirPath) {
|
|
|
414
385
|
throw err;
|
|
415
386
|
}
|
|
416
387
|
}
|
|
417
|
-
async function pathExists(filePath) {
|
|
418
|
-
try {
|
|
419
|
-
await fsPromises.access(filePath);
|
|
420
|
-
return true;
|
|
421
|
-
} catch {
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
388
|
async function fileExists(filePath) {
|
|
426
389
|
try {
|
|
427
390
|
const stat11 = await fsPromises.stat(filePath);
|
|
@@ -469,19 +432,6 @@ var init_filesystem = __esm({
|
|
|
469
432
|
});
|
|
470
433
|
|
|
471
434
|
// src/lib/fs/index.ts
|
|
472
|
-
var fs_exports = {};
|
|
473
|
-
__export(fs_exports, {
|
|
474
|
-
directoryExists: () => directoryExists,
|
|
475
|
-
ensureDirectory: () => ensureDirectory,
|
|
476
|
-
expandHome: () => expandHome,
|
|
477
|
-
fileExists: () => fileExists,
|
|
478
|
-
getFileStats: () => getFileStats,
|
|
479
|
-
pathExists: () => pathExists,
|
|
480
|
-
readFile: () => readFile2,
|
|
481
|
-
readJsonFile: () => readJsonFile,
|
|
482
|
-
resolvePath: () => resolvePath,
|
|
483
|
-
writeJsonFile: () => writeJsonFile
|
|
484
|
-
});
|
|
485
435
|
var init_fs = __esm({
|
|
486
436
|
"src/lib/fs/index.ts"() {
|
|
487
437
|
"use strict";
|
|
@@ -3239,155 +3189,6 @@ var init_base = __esm({
|
|
|
3239
3189
|
}
|
|
3240
3190
|
});
|
|
3241
3191
|
|
|
3242
|
-
// src/llm/providers/key-manager.ts
|
|
3243
|
-
function resolveApiKey(apiKey) {
|
|
3244
|
-
if (!apiKey) return void 0;
|
|
3245
|
-
if (Array.isArray(apiKey)) return apiKey[0];
|
|
3246
|
-
return apiKey;
|
|
3247
|
-
}
|
|
3248
|
-
function hasApiKey(apiKey) {
|
|
3249
|
-
if (!apiKey) return false;
|
|
3250
|
-
if (Array.isArray(apiKey)) return apiKey.some((k) => k.length > 0);
|
|
3251
|
-
return apiKey.length > 0 && apiKey !== "none";
|
|
3252
|
-
}
|
|
3253
|
-
var systemClock, DEFAULT_CONFIG, KeyManager, keyManager;
|
|
3254
|
-
var init_key_manager = __esm({
|
|
3255
|
-
"src/llm/providers/key-manager.ts"() {
|
|
3256
|
-
"use strict";
|
|
3257
|
-
init_logger();
|
|
3258
|
-
systemClock = { now: () => Date.now() };
|
|
3259
|
-
DEFAULT_CONFIG = {
|
|
3260
|
-
failureWindowMs: 6e4,
|
|
3261
|
-
failureThreshold: 3,
|
|
3262
|
-
disableDurationMs: 3e5
|
|
3263
|
-
};
|
|
3264
|
-
KeyManager = class {
|
|
3265
|
-
keys = /* @__PURE__ */ new Map();
|
|
3266
|
-
health = /* @__PURE__ */ new Map();
|
|
3267
|
-
config;
|
|
3268
|
-
clock;
|
|
3269
|
-
constructor(config2) {
|
|
3270
|
-
this.config = { ...DEFAULT_CONFIG, ...config2 };
|
|
3271
|
-
this.clock = config2?.clock ?? systemClock;
|
|
3272
|
-
}
|
|
3273
|
-
/**
|
|
3274
|
-
* Register API keys for a provider.
|
|
3275
|
-
* Normalizes single keys to arrays for uniform handling.
|
|
3276
|
-
*/
|
|
3277
|
-
registerKeys(providerId, apiKey) {
|
|
3278
|
-
const keys = Array.isArray(apiKey) ? [...apiKey] : [apiKey];
|
|
3279
|
-
if (keys.length === 0) {
|
|
3280
|
-
return;
|
|
3281
|
-
}
|
|
3282
|
-
this.keys.set(providerId, keys);
|
|
3283
|
-
for (const key of keys) {
|
|
3284
|
-
const healthKey = this.healthKey(providerId, key);
|
|
3285
|
-
if (!this.health.has(healthKey)) {
|
|
3286
|
-
this.health.set(healthKey, { failures: [], disabledUntil: 0 });
|
|
3287
|
-
}
|
|
3288
|
-
}
|
|
3289
|
-
if (keys.length > 1) {
|
|
3290
|
-
logger.debug(`[KeyManager] Registered ${keys.length} keys for provider "${providerId}"`);
|
|
3291
|
-
}
|
|
3292
|
-
}
|
|
3293
|
-
/**
|
|
3294
|
-
* Select a random healthy key for a provider.
|
|
3295
|
-
* Returns undefined if no healthy keys are available.
|
|
3296
|
-
*/
|
|
3297
|
-
selectKey(providerId) {
|
|
3298
|
-
const keys = this.keys.get(providerId);
|
|
3299
|
-
if (!keys || keys.length === 0) {
|
|
3300
|
-
return void 0;
|
|
3301
|
-
}
|
|
3302
|
-
const healthy = keys.filter((key) => this.isKeyHealthy(providerId, key));
|
|
3303
|
-
if (healthy.length === 0) {
|
|
3304
|
-
logger.warn(`[KeyManager] No healthy keys available for provider "${providerId}", trying all keys`);
|
|
3305
|
-
return keys[Math.floor(Math.random() * keys.length)];
|
|
3306
|
-
}
|
|
3307
|
-
return healthy[Math.floor(Math.random() * healthy.length)];
|
|
3308
|
-
}
|
|
3309
|
-
/**
|
|
3310
|
-
* Report a key failure. If the failure threshold is reached within the
|
|
3311
|
-
* configured window, the key is temporarily disabled.
|
|
3312
|
-
*/
|
|
3313
|
-
reportFailure(providerId, apiKey) {
|
|
3314
|
-
const hKey = this.healthKey(providerId, apiKey);
|
|
3315
|
-
const health = this.health.get(hKey);
|
|
3316
|
-
if (!health) {
|
|
3317
|
-
return;
|
|
3318
|
-
}
|
|
3319
|
-
const now = this.clock.now();
|
|
3320
|
-
health.failures.push(now);
|
|
3321
|
-
this.pruneFailures(health, now);
|
|
3322
|
-
if (health.failures.length >= this.config.failureThreshold) {
|
|
3323
|
-
health.disabledUntil = now + this.config.disableDurationMs;
|
|
3324
|
-
const keyPreview = apiKey.slice(0, 8) + "...";
|
|
3325
|
-
logger.warn(
|
|
3326
|
-
`[KeyManager] Key ${keyPreview} for "${providerId}" temporarily disabled (${health.failures.length} failures in ${this.config.failureWindowMs}ms window). Re-enables in ${this.config.disableDurationMs / 1e3}s`
|
|
3327
|
-
);
|
|
3328
|
-
}
|
|
3329
|
-
}
|
|
3330
|
-
/**
|
|
3331
|
-
* Check whether a provider has multiple keys registered
|
|
3332
|
-
*/
|
|
3333
|
-
hasMultipleKeys(providerId) {
|
|
3334
|
-
const keys = this.keys.get(providerId);
|
|
3335
|
-
return !!keys && keys.length > 1;
|
|
3336
|
-
}
|
|
3337
|
-
/**
|
|
3338
|
-
* Get the number of currently healthy keys for a provider
|
|
3339
|
-
*/
|
|
3340
|
-
getHealthyKeyCount(providerId) {
|
|
3341
|
-
const keys = this.keys.get(providerId);
|
|
3342
|
-
if (!keys) return 0;
|
|
3343
|
-
return keys.filter((key) => this.isKeyHealthy(providerId, key)).length;
|
|
3344
|
-
}
|
|
3345
|
-
/**
|
|
3346
|
-
* Get all registered provider IDs
|
|
3347
|
-
*/
|
|
3348
|
-
getRegisteredProviders() {
|
|
3349
|
-
return Array.from(this.keys.keys());
|
|
3350
|
-
}
|
|
3351
|
-
/**
|
|
3352
|
-
* Reset all state (for testing)
|
|
3353
|
-
*/
|
|
3354
|
-
reset() {
|
|
3355
|
-
this.keys.clear();
|
|
3356
|
-
this.health.clear();
|
|
3357
|
-
}
|
|
3358
|
-
/**
|
|
3359
|
-
* Check if a specific key is currently healthy (not temporarily disabled)
|
|
3360
|
-
*/
|
|
3361
|
-
isKeyHealthy(providerId, apiKey) {
|
|
3362
|
-
const hKey = this.healthKey(providerId, apiKey);
|
|
3363
|
-
const health = this.health.get(hKey);
|
|
3364
|
-
if (!health) return true;
|
|
3365
|
-
const now = this.clock.now();
|
|
3366
|
-
if (health.disabledUntil > 0 && now >= health.disabledUntil) {
|
|
3367
|
-
health.disabledUntil = 0;
|
|
3368
|
-
health.failures = [];
|
|
3369
|
-
return true;
|
|
3370
|
-
}
|
|
3371
|
-
return health.disabledUntil === 0;
|
|
3372
|
-
}
|
|
3373
|
-
/**
|
|
3374
|
-
* Remove failures outside the tracking window
|
|
3375
|
-
*/
|
|
3376
|
-
pruneFailures(health, now) {
|
|
3377
|
-
const cutoff = now - this.config.failureWindowMs;
|
|
3378
|
-
health.failures = health.failures.filter((ts) => ts > cutoff);
|
|
3379
|
-
}
|
|
3380
|
-
/**
|
|
3381
|
-
* Create a composite key for the health map
|
|
3382
|
-
*/
|
|
3383
|
-
healthKey(providerId, apiKey) {
|
|
3384
|
-
return `${providerId}:${apiKey}`;
|
|
3385
|
-
}
|
|
3386
|
-
};
|
|
3387
|
-
keyManager = new KeyManager();
|
|
3388
|
-
}
|
|
3389
|
-
});
|
|
3390
|
-
|
|
3391
3192
|
// src/test-utils/conversational-logger.ts
|
|
3392
3193
|
var ConversationalLogger, conversationalLogger;
|
|
3393
3194
|
var init_conversational_logger = __esm({
|
|
@@ -3651,7 +3452,7 @@ var init_MockLLMService = __esm({
|
|
|
3651
3452
|
throw response.error;
|
|
3652
3453
|
}
|
|
3653
3454
|
if (response.streamDelay) {
|
|
3654
|
-
await new Promise((
|
|
3455
|
+
await new Promise((resolve15) => setTimeout(resolve15, response.streamDelay));
|
|
3655
3456
|
}
|
|
3656
3457
|
const toolCallsInfo = response.toolCalls ? response.toolCalls.map((tc) => {
|
|
3657
3458
|
let functionName;
|
|
@@ -3702,7 +3503,7 @@ var init_MockLLMService = __esm({
|
|
|
3702
3503
|
yield { type: "content", content: `${word} ` };
|
|
3703
3504
|
if (response.streamDelay) {
|
|
3704
3505
|
await new Promise(
|
|
3705
|
-
(
|
|
3506
|
+
(resolve15) => setTimeout(resolve15, (response.streamDelay || 0) / words.length)
|
|
3706
3507
|
);
|
|
3707
3508
|
}
|
|
3708
3509
|
}
|
|
@@ -3927,12 +3728,6 @@ var init_MockLLMService = __esm({
|
|
|
3927
3728
|
});
|
|
3928
3729
|
|
|
3929
3730
|
// src/llm/providers/MockProvider.ts
|
|
3930
|
-
var MockProvider_exports = {};
|
|
3931
|
-
__export(MockProvider_exports, {
|
|
3932
|
-
createMockProvider: () => createMockProvider,
|
|
3933
|
-
getGlobalMockService: () => getGlobalMockService,
|
|
3934
|
-
resetGlobalMockService: () => resetGlobalMockService
|
|
3935
|
-
});
|
|
3936
3731
|
import { MockLanguageModelV3 } from "ai/test";
|
|
3937
3732
|
function createMockProvider(config2) {
|
|
3938
3733
|
const mockService = new MockLLMService(config2);
|
|
@@ -4132,16 +3927,7 @@ function createMockProvider(config2) {
|
|
|
4132
3927
|
};
|
|
4133
3928
|
return provider;
|
|
4134
3929
|
}
|
|
4135
|
-
|
|
4136
|
-
if (!globalMockService) {
|
|
4137
|
-
globalMockService = new MockLLMService(config2);
|
|
4138
|
-
}
|
|
4139
|
-
return globalMockService;
|
|
4140
|
-
}
|
|
4141
|
-
function resetGlobalMockService() {
|
|
4142
|
-
globalMockService = null;
|
|
4143
|
-
}
|
|
4144
|
-
var buildUsage, buildFinishReason, formatToolInput, formatToolName, formatMessageContent, toMockMessages, globalMockService;
|
|
3930
|
+
var buildUsage, buildFinishReason, formatToolInput, formatToolName, formatMessageContent, toMockMessages;
|
|
4145
3931
|
var init_MockProvider = __esm({
|
|
4146
3932
|
"src/llm/providers/MockProvider.ts"() {
|
|
4147
3933
|
"use strict";
|
|
@@ -4191,7 +3977,155 @@ var init_MockProvider = __esm({
|
|
|
4191
3977
|
content: formatMessageContent(message.content)
|
|
4192
3978
|
}));
|
|
4193
3979
|
};
|
|
4194
|
-
|
|
3980
|
+
}
|
|
3981
|
+
});
|
|
3982
|
+
|
|
3983
|
+
// src/llm/providers/key-manager.ts
|
|
3984
|
+
function resolveApiKey(apiKey) {
|
|
3985
|
+
if (!apiKey) return void 0;
|
|
3986
|
+
if (Array.isArray(apiKey)) return apiKey[0];
|
|
3987
|
+
return apiKey;
|
|
3988
|
+
}
|
|
3989
|
+
function hasApiKey(apiKey) {
|
|
3990
|
+
if (!apiKey) return false;
|
|
3991
|
+
if (Array.isArray(apiKey)) return apiKey.some((k) => k.length > 0);
|
|
3992
|
+
return apiKey.length > 0 && apiKey !== "none";
|
|
3993
|
+
}
|
|
3994
|
+
var systemClock, DEFAULT_CONFIG, KeyManager, keyManager;
|
|
3995
|
+
var init_key_manager = __esm({
|
|
3996
|
+
"src/llm/providers/key-manager.ts"() {
|
|
3997
|
+
"use strict";
|
|
3998
|
+
init_logger();
|
|
3999
|
+
systemClock = { now: () => Date.now() };
|
|
4000
|
+
DEFAULT_CONFIG = {
|
|
4001
|
+
failureWindowMs: 6e4,
|
|
4002
|
+
failureThreshold: 3,
|
|
4003
|
+
disableDurationMs: 3e5
|
|
4004
|
+
};
|
|
4005
|
+
KeyManager = class {
|
|
4006
|
+
keys = /* @__PURE__ */ new Map();
|
|
4007
|
+
health = /* @__PURE__ */ new Map();
|
|
4008
|
+
config;
|
|
4009
|
+
clock;
|
|
4010
|
+
constructor(config2) {
|
|
4011
|
+
this.config = { ...DEFAULT_CONFIG, ...config2 };
|
|
4012
|
+
this.clock = config2?.clock ?? systemClock;
|
|
4013
|
+
}
|
|
4014
|
+
/**
|
|
4015
|
+
* Register API keys for a provider.
|
|
4016
|
+
* Normalizes single keys to arrays for uniform handling.
|
|
4017
|
+
*/
|
|
4018
|
+
registerKeys(providerId, apiKey) {
|
|
4019
|
+
const keys = Array.isArray(apiKey) ? [...apiKey] : [apiKey];
|
|
4020
|
+
if (keys.length === 0) {
|
|
4021
|
+
return;
|
|
4022
|
+
}
|
|
4023
|
+
this.keys.set(providerId, keys);
|
|
4024
|
+
for (const key of keys) {
|
|
4025
|
+
const healthKey = this.healthKey(providerId, key);
|
|
4026
|
+
if (!this.health.has(healthKey)) {
|
|
4027
|
+
this.health.set(healthKey, { failures: [], disabledUntil: 0 });
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
if (keys.length > 1) {
|
|
4031
|
+
logger.debug(`[KeyManager] Registered ${keys.length} keys for provider "${providerId}"`);
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
/**
|
|
4035
|
+
* Select a random healthy key for a provider.
|
|
4036
|
+
* Returns undefined if no healthy keys are available.
|
|
4037
|
+
*/
|
|
4038
|
+
selectKey(providerId) {
|
|
4039
|
+
const keys = this.keys.get(providerId);
|
|
4040
|
+
if (!keys || keys.length === 0) {
|
|
4041
|
+
return void 0;
|
|
4042
|
+
}
|
|
4043
|
+
const healthy = keys.filter((key) => this.isKeyHealthy(providerId, key));
|
|
4044
|
+
if (healthy.length === 0) {
|
|
4045
|
+
logger.warn(`[KeyManager] No healthy keys available for provider "${providerId}", trying all keys`);
|
|
4046
|
+
return keys[Math.floor(Math.random() * keys.length)];
|
|
4047
|
+
}
|
|
4048
|
+
return healthy[Math.floor(Math.random() * healthy.length)];
|
|
4049
|
+
}
|
|
4050
|
+
/**
|
|
4051
|
+
* Report a key failure. If the failure threshold is reached within the
|
|
4052
|
+
* configured window, the key is temporarily disabled.
|
|
4053
|
+
*/
|
|
4054
|
+
reportFailure(providerId, apiKey) {
|
|
4055
|
+
const hKey = this.healthKey(providerId, apiKey);
|
|
4056
|
+
const health = this.health.get(hKey);
|
|
4057
|
+
if (!health) {
|
|
4058
|
+
return;
|
|
4059
|
+
}
|
|
4060
|
+
const now = this.clock.now();
|
|
4061
|
+
health.failures.push(now);
|
|
4062
|
+
this.pruneFailures(health, now);
|
|
4063
|
+
if (health.failures.length >= this.config.failureThreshold) {
|
|
4064
|
+
health.disabledUntil = now + this.config.disableDurationMs;
|
|
4065
|
+
const keyPreview = apiKey.slice(0, 8) + "...";
|
|
4066
|
+
logger.warn(
|
|
4067
|
+
`[KeyManager] Key ${keyPreview} for "${providerId}" temporarily disabled (${health.failures.length} failures in ${this.config.failureWindowMs}ms window). Re-enables in ${this.config.disableDurationMs / 1e3}s`
|
|
4068
|
+
);
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
/**
|
|
4072
|
+
* Check whether a provider has multiple keys registered
|
|
4073
|
+
*/
|
|
4074
|
+
hasMultipleKeys(providerId) {
|
|
4075
|
+
const keys = this.keys.get(providerId);
|
|
4076
|
+
return !!keys && keys.length > 1;
|
|
4077
|
+
}
|
|
4078
|
+
/**
|
|
4079
|
+
* Get the number of currently healthy keys for a provider
|
|
4080
|
+
*/
|
|
4081
|
+
getHealthyKeyCount(providerId) {
|
|
4082
|
+
const keys = this.keys.get(providerId);
|
|
4083
|
+
if (!keys) return 0;
|
|
4084
|
+
return keys.filter((key) => this.isKeyHealthy(providerId, key)).length;
|
|
4085
|
+
}
|
|
4086
|
+
/**
|
|
4087
|
+
* Get all registered provider IDs
|
|
4088
|
+
*/
|
|
4089
|
+
getRegisteredProviders() {
|
|
4090
|
+
return Array.from(this.keys.keys());
|
|
4091
|
+
}
|
|
4092
|
+
/**
|
|
4093
|
+
* Reset all state (for testing)
|
|
4094
|
+
*/
|
|
4095
|
+
reset() {
|
|
4096
|
+
this.keys.clear();
|
|
4097
|
+
this.health.clear();
|
|
4098
|
+
}
|
|
4099
|
+
/**
|
|
4100
|
+
* Check if a specific key is currently healthy (not temporarily disabled)
|
|
4101
|
+
*/
|
|
4102
|
+
isKeyHealthy(providerId, apiKey) {
|
|
4103
|
+
const hKey = this.healthKey(providerId, apiKey);
|
|
4104
|
+
const health = this.health.get(hKey);
|
|
4105
|
+
if (!health) return true;
|
|
4106
|
+
const now = this.clock.now();
|
|
4107
|
+
if (health.disabledUntil > 0 && now >= health.disabledUntil) {
|
|
4108
|
+
health.disabledUntil = 0;
|
|
4109
|
+
health.failures = [];
|
|
4110
|
+
return true;
|
|
4111
|
+
}
|
|
4112
|
+
return health.disabledUntil === 0;
|
|
4113
|
+
}
|
|
4114
|
+
/**
|
|
4115
|
+
* Remove failures outside the tracking window
|
|
4116
|
+
*/
|
|
4117
|
+
pruneFailures(health, now) {
|
|
4118
|
+
const cutoff = now - this.config.failureWindowMs;
|
|
4119
|
+
health.failures = health.failures.filter((ts) => ts > cutoff);
|
|
4120
|
+
}
|
|
4121
|
+
/**
|
|
4122
|
+
* Create a composite key for the health map
|
|
4123
|
+
*/
|
|
4124
|
+
healthKey(providerId, apiKey) {
|
|
4125
|
+
return `${providerId}:${apiKey}`;
|
|
4126
|
+
}
|
|
4127
|
+
};
|
|
4128
|
+
keyManager = new KeyManager();
|
|
4195
4129
|
}
|
|
4196
4130
|
});
|
|
4197
4131
|
|
|
@@ -4201,6 +4135,7 @@ var ProviderRegistry, providerRegistry;
|
|
|
4201
4135
|
var init_ProviderRegistry = __esm({
|
|
4202
4136
|
"src/llm/providers/registry/ProviderRegistry.ts"() {
|
|
4203
4137
|
"use strict";
|
|
4138
|
+
init_MockProvider();
|
|
4204
4139
|
init_logger();
|
|
4205
4140
|
init_key_manager();
|
|
4206
4141
|
ProviderRegistry = class _ProviderRegistry {
|
|
@@ -4365,8 +4300,7 @@ var init_ProviderRegistry = __esm({
|
|
|
4365
4300
|
*/
|
|
4366
4301
|
async initializeMockProvider() {
|
|
4367
4302
|
try {
|
|
4368
|
-
const
|
|
4369
|
-
const mockProvider = createMockProvider2();
|
|
4303
|
+
const mockProvider = createMockProvider();
|
|
4370
4304
|
const mockWrapper = {
|
|
4371
4305
|
metadata: {
|
|
4372
4306
|
id: "mock",
|
|
@@ -8342,14 +8276,14 @@ var init_Nip46SigningService = __esm({
|
|
|
8342
8276
|
*/
|
|
8343
8277
|
async withOwnerLock(ownerPubkey, fn) {
|
|
8344
8278
|
const existing = this.ownerLocks.get(ownerPubkey) ?? Promise.resolve();
|
|
8345
|
-
let
|
|
8346
|
-
const next = new Promise((r) =>
|
|
8279
|
+
let resolve15;
|
|
8280
|
+
const next = new Promise((r) => resolve15 = r);
|
|
8347
8281
|
this.ownerLocks.set(ownerPubkey, next);
|
|
8348
8282
|
await existing;
|
|
8349
8283
|
try {
|
|
8350
8284
|
return await fn();
|
|
8351
8285
|
} finally {
|
|
8352
|
-
|
|
8286
|
+
resolve15();
|
|
8353
8287
|
if (this.ownerLocks.get(ownerPubkey) === next) {
|
|
8354
8288
|
this.ownerLocks.delete(ownerPubkey);
|
|
8355
8289
|
}
|
|
@@ -10578,16 +10512,6 @@ var init_SystemReminderInjector = __esm({
|
|
|
10578
10512
|
});
|
|
10579
10513
|
|
|
10580
10514
|
// src/services/agents-md/index.ts
|
|
10581
|
-
var agents_md_exports = {};
|
|
10582
|
-
__export(agents_md_exports, {
|
|
10583
|
-
agentsMdService: () => agentsMdService,
|
|
10584
|
-
appendSystemReminderToOutput: () => appendSystemReminderToOutput,
|
|
10585
|
-
createAgentsMdVisibilityTracker: () => createAgentsMdVisibilityTracker,
|
|
10586
|
-
extractPathFromToolInput: () => extractPathFromToolInput,
|
|
10587
|
-
formatSystemReminder: () => formatSystemReminder,
|
|
10588
|
-
getSystemRemindersForPath: () => getSystemRemindersForPath,
|
|
10589
|
-
shouldInjectForTool: () => shouldInjectForTool
|
|
10590
|
-
});
|
|
10591
10515
|
var init_agents_md = __esm({
|
|
10592
10516
|
"src/services/agents-md/index.ts"() {
|
|
10593
10517
|
"use strict";
|
|
@@ -10622,19 +10546,19 @@ async function resolveDisplayName(pubkey) {
|
|
|
10622
10546
|
}
|
|
10623
10547
|
}
|
|
10624
10548
|
function computeAttributionPrefix(entry, viewingAgentPubkey, agentPubkeys, resolveDisplayName2) {
|
|
10625
|
-
const
|
|
10549
|
+
const resolve15 = resolveDisplayName2 ?? ((pk) => getPubkeyService().getNameSync(pk));
|
|
10626
10550
|
const senderPubkey = entry.senderPubkey ?? entry.pubkey;
|
|
10627
10551
|
if (senderPubkey === viewingAgentPubkey) return "";
|
|
10628
10552
|
if (entry.messageType !== "text") return "";
|
|
10629
10553
|
if (entry.role) return "";
|
|
10630
10554
|
const targetedPubkeys = entry.targetedPubkeys ?? [];
|
|
10631
10555
|
if (targetedPubkeys.length > 0 && !targetedPubkeys.includes(viewingAgentPubkey)) {
|
|
10632
|
-
const senderName =
|
|
10633
|
-
const recipientName =
|
|
10556
|
+
const senderName = resolve15(senderPubkey);
|
|
10557
|
+
const recipientName = resolve15(targetedPubkeys[0]);
|
|
10634
10558
|
return `[@${senderName} -> @${recipientName}] `;
|
|
10635
10559
|
}
|
|
10636
10560
|
if (agentPubkeys.has(senderPubkey)) {
|
|
10637
|
-
const senderName =
|
|
10561
|
+
const senderName = resolve15(senderPubkey);
|
|
10638
10562
|
return `[@${senderName}] `;
|
|
10639
10563
|
}
|
|
10640
10564
|
return "";
|
|
@@ -12005,9 +11929,8 @@ var init_EmbeddingProviderFactory = __esm({
|
|
|
12005
11929
|
if (embeddingConfig.baseUrl && embeddingConfig.baseUrl !== defaultBaseUrl) {
|
|
12006
11930
|
configToSave.baseUrl = embeddingConfig.baseUrl;
|
|
12007
11931
|
}
|
|
12008
|
-
|
|
12009
|
-
await
|
|
12010
|
-
await writeJsonFile2(configPath, configToSave);
|
|
11932
|
+
await ensureDirectory(basePath);
|
|
11933
|
+
await writeJsonFile(configPath, configToSave);
|
|
12011
11934
|
logger.info(
|
|
12012
11935
|
`Embedding configuration saved to ${scope} config: ${embeddingConfig.provider}/${embeddingConfig.model}`
|
|
12013
11936
|
);
|
|
@@ -12751,13 +12674,6 @@ var init_RAGOperations = __esm({
|
|
|
12751
12674
|
});
|
|
12752
12675
|
|
|
12753
12676
|
// src/services/rag/RAGService.ts
|
|
12754
|
-
var RAGService_exports = {};
|
|
12755
|
-
__export(RAGService_exports, {
|
|
12756
|
-
RAGDatabaseError: () => RAGDatabaseError,
|
|
12757
|
-
RAGOperationError: () => RAGOperationError,
|
|
12758
|
-
RAGService: () => RAGService,
|
|
12759
|
-
RAGValidationError: () => RAGValidationError
|
|
12760
|
-
});
|
|
12761
12677
|
var RAGService;
|
|
12762
12678
|
var init_RAGService = __esm({
|
|
12763
12679
|
"src/services/rag/RAGService.ts"() {
|
|
@@ -17724,7 +17640,7 @@ var init_InterventionPublisher = __esm({
|
|
|
17724
17640
|
function collectEvents(ndk2, filter, options = {}) {
|
|
17725
17641
|
const { subOpts = {}, timeoutMs = DEFAULT_TIMEOUT_MS } = options;
|
|
17726
17642
|
const seen = /* @__PURE__ */ new Map();
|
|
17727
|
-
return new Promise((
|
|
17643
|
+
return new Promise((resolve15) => {
|
|
17728
17644
|
let settled = false;
|
|
17729
17645
|
let eoseReceived = false;
|
|
17730
17646
|
let timer;
|
|
@@ -17732,7 +17648,7 @@ function collectEvents(ndk2, filter, options = {}) {
|
|
|
17732
17648
|
if (settled) return;
|
|
17733
17649
|
settled = true;
|
|
17734
17650
|
if (timer) clearTimeout(timer);
|
|
17735
|
-
|
|
17651
|
+
resolve15(Array.from(seen.values()));
|
|
17736
17652
|
};
|
|
17737
17653
|
const sub = ndk2.subscribe(
|
|
17738
17654
|
filter,
|
|
@@ -21516,8 +21432,8 @@ var init_prompt_compiler_service = __esm({
|
|
|
21516
21432
|
}
|
|
21517
21433
|
this.eoseReceived = false;
|
|
21518
21434
|
this.eoseResolve = null;
|
|
21519
|
-
this.eosePromise = new Promise((
|
|
21520
|
-
this.eoseResolve =
|
|
21435
|
+
this.eosePromise = new Promise((resolve15) => {
|
|
21436
|
+
this.eoseResolve = resolve15;
|
|
21521
21437
|
});
|
|
21522
21438
|
const filter = {
|
|
21523
21439
|
kinds: [NDKKind.Comment],
|
|
@@ -26626,7 +26542,7 @@ import { exec as exec2, spawn } from "node:child_process";
|
|
|
26626
26542
|
import { createWriteStream } from "node:fs";
|
|
26627
26543
|
import { mkdir as mkdir6 } from "node:fs/promises";
|
|
26628
26544
|
import { tmpdir } from "node:os";
|
|
26629
|
-
import { join as join27 } from "node:path";
|
|
26545
|
+
import { isAbsolute as isAbsolute3, join as join27, resolve as resolve9 } from "node:path";
|
|
26630
26546
|
import { promisify as promisify2 } from "node:util";
|
|
26631
26547
|
import { trace as trace22 } from "@opentelemetry/api";
|
|
26632
26548
|
import { tool as tool21 } from "ai";
|
|
@@ -26652,8 +26568,7 @@ async function executeShell(input, context2) {
|
|
|
26652
26568
|
const { command, description, cwd, timeout = 30, run_in_background } = input;
|
|
26653
26569
|
let workingDir;
|
|
26654
26570
|
if (cwd) {
|
|
26655
|
-
|
|
26656
|
-
workingDir = isAbsolute4(cwd) ? cwd : resolve14(context2.workingDirectory, cwd);
|
|
26571
|
+
workingDir = isAbsolute3(cwd) ? cwd : resolve9(context2.workingDirectory, cwd);
|
|
26657
26572
|
} else {
|
|
26658
26573
|
workingDir = context2.workingDirectory;
|
|
26659
26574
|
}
|
|
@@ -26989,10 +26904,6 @@ var init_shell = __esm({
|
|
|
26989
26904
|
});
|
|
26990
26905
|
|
|
26991
26906
|
// src/services/CooldownRegistry.ts
|
|
26992
|
-
var CooldownRegistry_exports = {};
|
|
26993
|
-
__export(CooldownRegistry_exports, {
|
|
26994
|
-
CooldownRegistry: () => CooldownRegistry
|
|
26995
|
-
});
|
|
26996
26907
|
import { trace as trace23 } from "@opentelemetry/api";
|
|
26997
26908
|
var COOLDOWN_DURATION_MS, CLEANUP_INTERVAL_MS, CooldownRegistry;
|
|
26998
26909
|
var init_CooldownRegistry = __esm({
|
|
@@ -31212,7 +31123,7 @@ var init_SchedulerService = __esm({
|
|
|
31212
31123
|
logger.info("Catch-up execution completed");
|
|
31213
31124
|
}
|
|
31214
31125
|
delay(ms) {
|
|
31215
|
-
return new Promise((
|
|
31126
|
+
return new Promise((resolve15) => setTimeout(resolve15, ms));
|
|
31216
31127
|
}
|
|
31217
31128
|
/**
|
|
31218
31129
|
* Ensure the project for a scheduled task is running before execution.
|
|
@@ -33506,6 +33417,8 @@ var init_rag_search = __esm({
|
|
|
33506
33417
|
|
|
33507
33418
|
// src/services/image/ImageGenerationService.ts
|
|
33508
33419
|
import * as path22 from "node:path";
|
|
33420
|
+
import { createOpenRouter as createOpenRouter2 } from "@openrouter/ai-sdk-provider";
|
|
33421
|
+
import { generateText as generateText3 } from "ai";
|
|
33509
33422
|
var OPENROUTER_IMAGE_MODELS, ASPECT_RATIOS, IMAGE_SIZES, IMAGE_CONFIG_FILE, DEFAULT_CONFIG2, ImageGenerationService;
|
|
33510
33423
|
var init_ImageGenerationService = __esm({
|
|
33511
33424
|
"src/services/image/ImageGenerationService.ts"() {
|
|
@@ -33586,8 +33499,6 @@ var init_ImageGenerationService = __esm({
|
|
|
33586
33499
|
aspectRatio,
|
|
33587
33500
|
imageSize
|
|
33588
33501
|
});
|
|
33589
|
-
const { createOpenRouter: createOpenRouter2 } = await import("@openrouter/ai-sdk-provider");
|
|
33590
|
-
const { generateText: generateText3 } = await import("ai");
|
|
33591
33502
|
const openrouter = createOpenRouter2({
|
|
33592
33503
|
apiKey: this.apiKey,
|
|
33593
33504
|
headers: {
|
|
@@ -38831,8 +38742,7 @@ async function addCoreAgentFragments(builder, agent, conversation, mcpManager) {
|
|
|
38831
38742
|
}
|
|
38832
38743
|
}
|
|
38833
38744
|
try {
|
|
38834
|
-
const
|
|
38835
|
-
const ragService = RAGService2.getInstance();
|
|
38745
|
+
const ragService = RAGService.getInstance();
|
|
38836
38746
|
const collections = await ragService.getAllCollectionStats(agent.pubkey);
|
|
38837
38747
|
if (collections.length > 0) {
|
|
38838
38748
|
builder.add("rag-collections", {
|
|
@@ -39087,9 +38997,8 @@ async function buildMainSystemPrompt(options) {
|
|
|
39087
38997
|
}
|
|
39088
38998
|
if (projectBasePath) {
|
|
39089
38999
|
try {
|
|
39090
|
-
const
|
|
39091
|
-
const
|
|
39092
|
-
const rootContent = hasRootAgentsMd ? await agentsMdService2.getRootAgentsMdContent(projectBasePath) : null;
|
|
39000
|
+
const hasRootAgentsMd = await agentsMdService.hasRootAgentsMd(projectBasePath);
|
|
39001
|
+
const rootContent = hasRootAgentsMd ? await agentsMdService.getRootAgentsMdContent(projectBasePath) : null;
|
|
39093
39002
|
systemPromptBuilder.add("agents-md-guidance", {
|
|
39094
39003
|
hasRootAgentsMd,
|
|
39095
39004
|
rootAgentsMdContent: rootContent || void 0
|
|
@@ -39133,6 +39042,8 @@ var init_systemPromptBuilder = __esm({
|
|
|
39133
39042
|
init_reports();
|
|
39134
39043
|
init_scheduling();
|
|
39135
39044
|
init_lessonFormatter();
|
|
39045
|
+
init_agents_md();
|
|
39046
|
+
init_RAGService();
|
|
39136
39047
|
init_logger();
|
|
39137
39048
|
init_fragments();
|
|
39138
39049
|
init_mcp_resources();
|
|
@@ -45198,6 +45109,7 @@ var init_AgentDispatchService = __esm({
|
|
|
45198
45109
|
init_provider_ids();
|
|
45199
45110
|
init_LLMOperationsRegistry();
|
|
45200
45111
|
init_projects();
|
|
45112
|
+
init_CooldownRegistry();
|
|
45201
45113
|
init_ral();
|
|
45202
45114
|
init_logger();
|
|
45203
45115
|
init_AgentRouter();
|
|
@@ -45678,8 +45590,8 @@ var init_AgentDispatchService = __esm({
|
|
|
45678
45590
|
let state = this.delegationDebounceState.get(key);
|
|
45679
45591
|
if (!state) {
|
|
45680
45592
|
let resolveFn;
|
|
45681
|
-
const promise = new Promise((
|
|
45682
|
-
resolveFn =
|
|
45593
|
+
const promise = new Promise((resolve15) => {
|
|
45594
|
+
resolveFn = resolve15;
|
|
45683
45595
|
});
|
|
45684
45596
|
const timeout = setTimeout(() => {
|
|
45685
45597
|
this.delegationDebounceState.delete(key);
|
|
@@ -45850,8 +45762,7 @@ var init_AgentDispatchService = __esm({
|
|
|
45850
45762
|
* This helper consolidates the cooldown check logic used in multiple dispatch paths.
|
|
45851
45763
|
*/
|
|
45852
45764
|
async checkAndBlockIfCooldown(projectId, conversationId, agentPubkey, agentSlug, span, eventType) {
|
|
45853
|
-
const
|
|
45854
|
-
const cooldownRegistry = CooldownRegistry2.getInstance();
|
|
45765
|
+
const cooldownRegistry = CooldownRegistry.getInstance();
|
|
45855
45766
|
if (cooldownRegistry.isInCooldown(projectId, conversationId, agentPubkey)) {
|
|
45856
45767
|
logger.info(`[dispatch] ${eventType === "delegation_completion" ? "Delegation completion routing" : "Routing"} blocked due to cooldown`, {
|
|
45857
45768
|
projectId: projectId.substring(0, 12),
|
|
@@ -50396,7 +50307,7 @@ var init_InterventionService = __esm({
|
|
|
50396
50307
|
await this.writeStateAtomically();
|
|
50397
50308
|
}
|
|
50398
50309
|
while (this.writeQueue.length > 0 || this.isWriting) {
|
|
50399
|
-
await new Promise((
|
|
50310
|
+
await new Promise((resolve15) => setTimeout(resolve15, 10));
|
|
50400
50311
|
}
|
|
50401
50312
|
}
|
|
50402
50313
|
/**
|
|
@@ -53008,1727 +52919,6 @@ var init_EventLoopMonitor = __esm({
|
|
|
53008
52919
|
}
|
|
53009
52920
|
});
|
|
53010
52921
|
|
|
53011
|
-
// node_modules/@inquirer/core/dist/lib/key.js
|
|
53012
|
-
var isUpKey, isDownKey, isSpaceKey, isBackspaceKey, isTabKey, isEnterKey;
|
|
53013
|
-
var init_key = __esm({
|
|
53014
|
-
"node_modules/@inquirer/core/dist/lib/key.js"() {
|
|
53015
|
-
"use strict";
|
|
53016
|
-
isUpKey = (key, keybindings = []) => (
|
|
53017
|
-
// The up key
|
|
53018
|
-
key.name === "up" || // Vim keybinding: hjkl keys map to left/down/up/right
|
|
53019
|
-
keybindings.includes("vim") && key.name === "k" || // Emacs keybinding: Ctrl+P means "previous" in Emacs navigation conventions
|
|
53020
|
-
keybindings.includes("emacs") && key.ctrl && key.name === "p"
|
|
53021
|
-
);
|
|
53022
|
-
isDownKey = (key, keybindings = []) => (
|
|
53023
|
-
// The down key
|
|
53024
|
-
key.name === "down" || // Vim keybinding: hjkl keys map to left/down/up/right
|
|
53025
|
-
keybindings.includes("vim") && key.name === "j" || // Emacs keybinding: Ctrl+N means "next" in Emacs navigation conventions
|
|
53026
|
-
keybindings.includes("emacs") && key.ctrl && key.name === "n"
|
|
53027
|
-
);
|
|
53028
|
-
isSpaceKey = (key) => key.name === "space";
|
|
53029
|
-
isBackspaceKey = (key) => key.name === "backspace";
|
|
53030
|
-
isTabKey = (key) => key.name === "tab";
|
|
53031
|
-
isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
53032
|
-
}
|
|
53033
|
-
});
|
|
53034
|
-
|
|
53035
|
-
// node_modules/@inquirer/core/dist/lib/errors.js
|
|
53036
|
-
var AbortPromptError, CancelPromptError, ExitPromptError, HookError, ValidationError;
|
|
53037
|
-
var init_errors3 = __esm({
|
|
53038
|
-
"node_modules/@inquirer/core/dist/lib/errors.js"() {
|
|
53039
|
-
"use strict";
|
|
53040
|
-
AbortPromptError = class extends Error {
|
|
53041
|
-
name = "AbortPromptError";
|
|
53042
|
-
message = "Prompt was aborted";
|
|
53043
|
-
constructor(options) {
|
|
53044
|
-
super();
|
|
53045
|
-
this.cause = options?.cause;
|
|
53046
|
-
}
|
|
53047
|
-
};
|
|
53048
|
-
CancelPromptError = class extends Error {
|
|
53049
|
-
name = "CancelPromptError";
|
|
53050
|
-
message = "Prompt was canceled";
|
|
53051
|
-
};
|
|
53052
|
-
ExitPromptError = class extends Error {
|
|
53053
|
-
name = "ExitPromptError";
|
|
53054
|
-
};
|
|
53055
|
-
HookError = class extends Error {
|
|
53056
|
-
name = "HookError";
|
|
53057
|
-
};
|
|
53058
|
-
ValidationError = class extends Error {
|
|
53059
|
-
name = "ValidationError";
|
|
53060
|
-
};
|
|
53061
|
-
}
|
|
53062
|
-
});
|
|
53063
|
-
|
|
53064
|
-
// node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
53065
|
-
import { AsyncLocalStorage as AsyncLocalStorage2, AsyncResource } from "node:async_hooks";
|
|
53066
|
-
function createStore(rl) {
|
|
53067
|
-
const store = {
|
|
53068
|
-
rl,
|
|
53069
|
-
hooks: [],
|
|
53070
|
-
hooksCleanup: [],
|
|
53071
|
-
hooksEffect: [],
|
|
53072
|
-
index: 0,
|
|
53073
|
-
handleChange() {
|
|
53074
|
-
}
|
|
53075
|
-
};
|
|
53076
|
-
return store;
|
|
53077
|
-
}
|
|
53078
|
-
function withHooks(rl, cb) {
|
|
53079
|
-
const store = createStore(rl);
|
|
53080
|
-
return hookStorage.run(store, () => {
|
|
53081
|
-
function cycle(render) {
|
|
53082
|
-
store.handleChange = () => {
|
|
53083
|
-
store.index = 0;
|
|
53084
|
-
render();
|
|
53085
|
-
};
|
|
53086
|
-
store.handleChange();
|
|
53087
|
-
}
|
|
53088
|
-
return cb(cycle);
|
|
53089
|
-
});
|
|
53090
|
-
}
|
|
53091
|
-
function getStore() {
|
|
53092
|
-
const store = hookStorage.getStore();
|
|
53093
|
-
if (!store) {
|
|
53094
|
-
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
53095
|
-
}
|
|
53096
|
-
return store;
|
|
53097
|
-
}
|
|
53098
|
-
function readline() {
|
|
53099
|
-
return getStore().rl;
|
|
53100
|
-
}
|
|
53101
|
-
function withUpdates(fn) {
|
|
53102
|
-
const wrapped = (...args) => {
|
|
53103
|
-
const store = getStore();
|
|
53104
|
-
let shouldUpdate = false;
|
|
53105
|
-
const oldHandleChange = store.handleChange;
|
|
53106
|
-
store.handleChange = () => {
|
|
53107
|
-
shouldUpdate = true;
|
|
53108
|
-
};
|
|
53109
|
-
const returnValue = fn(...args);
|
|
53110
|
-
if (shouldUpdate) {
|
|
53111
|
-
oldHandleChange();
|
|
53112
|
-
}
|
|
53113
|
-
store.handleChange = oldHandleChange;
|
|
53114
|
-
return returnValue;
|
|
53115
|
-
};
|
|
53116
|
-
return AsyncResource.bind(wrapped);
|
|
53117
|
-
}
|
|
53118
|
-
function withPointer(cb) {
|
|
53119
|
-
const store = getStore();
|
|
53120
|
-
const { index } = store;
|
|
53121
|
-
const pointer = {
|
|
53122
|
-
get() {
|
|
53123
|
-
return store.hooks[index];
|
|
53124
|
-
},
|
|
53125
|
-
set(value) {
|
|
53126
|
-
store.hooks[index] = value;
|
|
53127
|
-
},
|
|
53128
|
-
initialized: index in store.hooks
|
|
53129
|
-
};
|
|
53130
|
-
const returnValue = cb(pointer);
|
|
53131
|
-
store.index++;
|
|
53132
|
-
return returnValue;
|
|
53133
|
-
}
|
|
53134
|
-
function handleChange() {
|
|
53135
|
-
getStore().handleChange();
|
|
53136
|
-
}
|
|
53137
|
-
var hookStorage, effectScheduler;
|
|
53138
|
-
var init_hook_engine = __esm({
|
|
53139
|
-
"node_modules/@inquirer/core/dist/lib/hook-engine.js"() {
|
|
53140
|
-
"use strict";
|
|
53141
|
-
init_errors3();
|
|
53142
|
-
hookStorage = new AsyncLocalStorage2();
|
|
53143
|
-
effectScheduler = {
|
|
53144
|
-
queue(cb) {
|
|
53145
|
-
const store = getStore();
|
|
53146
|
-
const { index } = store;
|
|
53147
|
-
store.hooksEffect.push(() => {
|
|
53148
|
-
store.hooksCleanup[index]?.();
|
|
53149
|
-
const cleanFn = cb(readline());
|
|
53150
|
-
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
53151
|
-
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
53152
|
-
}
|
|
53153
|
-
store.hooksCleanup[index] = cleanFn;
|
|
53154
|
-
});
|
|
53155
|
-
},
|
|
53156
|
-
run() {
|
|
53157
|
-
const store = getStore();
|
|
53158
|
-
withUpdates(() => {
|
|
53159
|
-
store.hooksEffect.forEach((effect) => {
|
|
53160
|
-
effect();
|
|
53161
|
-
});
|
|
53162
|
-
store.hooksEffect.length = 0;
|
|
53163
|
-
})();
|
|
53164
|
-
},
|
|
53165
|
-
clearAll() {
|
|
53166
|
-
const store = getStore();
|
|
53167
|
-
store.hooksCleanup.forEach((cleanFn) => {
|
|
53168
|
-
cleanFn?.();
|
|
53169
|
-
});
|
|
53170
|
-
store.hooksEffect.length = 0;
|
|
53171
|
-
store.hooksCleanup.length = 0;
|
|
53172
|
-
}
|
|
53173
|
-
};
|
|
53174
|
-
}
|
|
53175
|
-
});
|
|
53176
|
-
|
|
53177
|
-
// node_modules/@inquirer/core/dist/lib/use-state.js
|
|
53178
|
-
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
53179
|
-
function useState(defaultValue) {
|
|
53180
|
-
return withPointer((pointer) => {
|
|
53181
|
-
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
53182
|
-
if (pointer.get() !== newValue) {
|
|
53183
|
-
pointer.set(newValue);
|
|
53184
|
-
handleChange();
|
|
53185
|
-
}
|
|
53186
|
-
});
|
|
53187
|
-
if (pointer.initialized) {
|
|
53188
|
-
return [pointer.get(), setState];
|
|
53189
|
-
}
|
|
53190
|
-
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
53191
|
-
pointer.set(value);
|
|
53192
|
-
return [value, setState];
|
|
53193
|
-
});
|
|
53194
|
-
}
|
|
53195
|
-
var init_use_state = __esm({
|
|
53196
|
-
"node_modules/@inquirer/core/dist/lib/use-state.js"() {
|
|
53197
|
-
"use strict";
|
|
53198
|
-
init_hook_engine();
|
|
53199
|
-
}
|
|
53200
|
-
});
|
|
53201
|
-
|
|
53202
|
-
// node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
53203
|
-
function useEffect(cb, depArray) {
|
|
53204
|
-
withPointer((pointer) => {
|
|
53205
|
-
const oldDeps = pointer.get();
|
|
53206
|
-
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
53207
|
-
if (hasChanged) {
|
|
53208
|
-
effectScheduler.queue(cb);
|
|
53209
|
-
}
|
|
53210
|
-
pointer.set(depArray);
|
|
53211
|
-
});
|
|
53212
|
-
}
|
|
53213
|
-
var init_use_effect = __esm({
|
|
53214
|
-
"node_modules/@inquirer/core/dist/lib/use-effect.js"() {
|
|
53215
|
-
"use strict";
|
|
53216
|
-
init_hook_engine();
|
|
53217
|
-
}
|
|
53218
|
-
});
|
|
53219
|
-
|
|
53220
|
-
// node_modules/@inquirer/figures/dist/index.js
|
|
53221
|
-
import process2 from "node:process";
|
|
53222
|
-
function isUnicodeSupported() {
|
|
53223
|
-
if (process2.platform !== "win32") {
|
|
53224
|
-
return process2.env["TERM"] !== "linux";
|
|
53225
|
-
}
|
|
53226
|
-
return Boolean(process2.env["WT_SESSION"]) || // Windows Terminal
|
|
53227
|
-
Boolean(process2.env["TERMINUS_SUBLIME"]) || // Terminus (<0.2.27)
|
|
53228
|
-
process2.env["ConEmuTask"] === "{cmd::Cmder}" || // ConEmu and cmder
|
|
53229
|
-
process2.env["TERM_PROGRAM"] === "Terminus-Sublime" || process2.env["TERM_PROGRAM"] === "vscode" || process2.env["TERM"] === "xterm-256color" || process2.env["TERM"] === "alacritty" || process2.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
53230
|
-
}
|
|
53231
|
-
var common, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, dist_default, replacements;
|
|
53232
|
-
var init_dist = __esm({
|
|
53233
|
-
"node_modules/@inquirer/figures/dist/index.js"() {
|
|
53234
|
-
"use strict";
|
|
53235
|
-
common = {
|
|
53236
|
-
circleQuestionMark: "(?)",
|
|
53237
|
-
questionMarkPrefix: "(?)",
|
|
53238
|
-
square: "\u2588",
|
|
53239
|
-
squareDarkShade: "\u2593",
|
|
53240
|
-
squareMediumShade: "\u2592",
|
|
53241
|
-
squareLightShade: "\u2591",
|
|
53242
|
-
squareTop: "\u2580",
|
|
53243
|
-
squareBottom: "\u2584",
|
|
53244
|
-
squareLeft: "\u258C",
|
|
53245
|
-
squareRight: "\u2590",
|
|
53246
|
-
squareCenter: "\u25A0",
|
|
53247
|
-
bullet: "\u25CF",
|
|
53248
|
-
dot: "\u2024",
|
|
53249
|
-
ellipsis: "\u2026",
|
|
53250
|
-
pointerSmall: "\u203A",
|
|
53251
|
-
triangleUp: "\u25B2",
|
|
53252
|
-
triangleUpSmall: "\u25B4",
|
|
53253
|
-
triangleDown: "\u25BC",
|
|
53254
|
-
triangleDownSmall: "\u25BE",
|
|
53255
|
-
triangleLeftSmall: "\u25C2",
|
|
53256
|
-
triangleRightSmall: "\u25B8",
|
|
53257
|
-
home: "\u2302",
|
|
53258
|
-
heart: "\u2665",
|
|
53259
|
-
musicNote: "\u266A",
|
|
53260
|
-
musicNoteBeamed: "\u266B",
|
|
53261
|
-
arrowUp: "\u2191",
|
|
53262
|
-
arrowDown: "\u2193",
|
|
53263
|
-
arrowLeft: "\u2190",
|
|
53264
|
-
arrowRight: "\u2192",
|
|
53265
|
-
arrowLeftRight: "\u2194",
|
|
53266
|
-
arrowUpDown: "\u2195",
|
|
53267
|
-
almostEqual: "\u2248",
|
|
53268
|
-
notEqual: "\u2260",
|
|
53269
|
-
lessOrEqual: "\u2264",
|
|
53270
|
-
greaterOrEqual: "\u2265",
|
|
53271
|
-
identical: "\u2261",
|
|
53272
|
-
infinity: "\u221E",
|
|
53273
|
-
subscriptZero: "\u2080",
|
|
53274
|
-
subscriptOne: "\u2081",
|
|
53275
|
-
subscriptTwo: "\u2082",
|
|
53276
|
-
subscriptThree: "\u2083",
|
|
53277
|
-
subscriptFour: "\u2084",
|
|
53278
|
-
subscriptFive: "\u2085",
|
|
53279
|
-
subscriptSix: "\u2086",
|
|
53280
|
-
subscriptSeven: "\u2087",
|
|
53281
|
-
subscriptEight: "\u2088",
|
|
53282
|
-
subscriptNine: "\u2089",
|
|
53283
|
-
oneHalf: "\xBD",
|
|
53284
|
-
oneThird: "\u2153",
|
|
53285
|
-
oneQuarter: "\xBC",
|
|
53286
|
-
oneFifth: "\u2155",
|
|
53287
|
-
oneSixth: "\u2159",
|
|
53288
|
-
oneEighth: "\u215B",
|
|
53289
|
-
twoThirds: "\u2154",
|
|
53290
|
-
twoFifths: "\u2156",
|
|
53291
|
-
threeQuarters: "\xBE",
|
|
53292
|
-
threeFifths: "\u2157",
|
|
53293
|
-
threeEighths: "\u215C",
|
|
53294
|
-
fourFifths: "\u2158",
|
|
53295
|
-
fiveSixths: "\u215A",
|
|
53296
|
-
fiveEighths: "\u215D",
|
|
53297
|
-
sevenEighths: "\u215E",
|
|
53298
|
-
line: "\u2500",
|
|
53299
|
-
lineBold: "\u2501",
|
|
53300
|
-
lineDouble: "\u2550",
|
|
53301
|
-
lineDashed0: "\u2504",
|
|
53302
|
-
lineDashed1: "\u2505",
|
|
53303
|
-
lineDashed2: "\u2508",
|
|
53304
|
-
lineDashed3: "\u2509",
|
|
53305
|
-
lineDashed4: "\u254C",
|
|
53306
|
-
lineDashed5: "\u254D",
|
|
53307
|
-
lineDashed6: "\u2574",
|
|
53308
|
-
lineDashed7: "\u2576",
|
|
53309
|
-
lineDashed8: "\u2578",
|
|
53310
|
-
lineDashed9: "\u257A",
|
|
53311
|
-
lineDashed10: "\u257C",
|
|
53312
|
-
lineDashed11: "\u257E",
|
|
53313
|
-
lineDashed12: "\u2212",
|
|
53314
|
-
lineDashed13: "\u2013",
|
|
53315
|
-
lineDashed14: "\u2010",
|
|
53316
|
-
lineDashed15: "\u2043",
|
|
53317
|
-
lineVertical: "\u2502",
|
|
53318
|
-
lineVerticalBold: "\u2503",
|
|
53319
|
-
lineVerticalDouble: "\u2551",
|
|
53320
|
-
lineVerticalDashed0: "\u2506",
|
|
53321
|
-
lineVerticalDashed1: "\u2507",
|
|
53322
|
-
lineVerticalDashed2: "\u250A",
|
|
53323
|
-
lineVerticalDashed3: "\u250B",
|
|
53324
|
-
lineVerticalDashed4: "\u254E",
|
|
53325
|
-
lineVerticalDashed5: "\u254F",
|
|
53326
|
-
lineVerticalDashed6: "\u2575",
|
|
53327
|
-
lineVerticalDashed7: "\u2577",
|
|
53328
|
-
lineVerticalDashed8: "\u2579",
|
|
53329
|
-
lineVerticalDashed9: "\u257B",
|
|
53330
|
-
lineVerticalDashed10: "\u257D",
|
|
53331
|
-
lineVerticalDashed11: "\u257F",
|
|
53332
|
-
lineDownLeft: "\u2510",
|
|
53333
|
-
lineDownLeftArc: "\u256E",
|
|
53334
|
-
lineDownBoldLeftBold: "\u2513",
|
|
53335
|
-
lineDownBoldLeft: "\u2512",
|
|
53336
|
-
lineDownLeftBold: "\u2511",
|
|
53337
|
-
lineDownDoubleLeftDouble: "\u2557",
|
|
53338
|
-
lineDownDoubleLeft: "\u2556",
|
|
53339
|
-
lineDownLeftDouble: "\u2555",
|
|
53340
|
-
lineDownRight: "\u250C",
|
|
53341
|
-
lineDownRightArc: "\u256D",
|
|
53342
|
-
lineDownBoldRightBold: "\u250F",
|
|
53343
|
-
lineDownBoldRight: "\u250E",
|
|
53344
|
-
lineDownRightBold: "\u250D",
|
|
53345
|
-
lineDownDoubleRightDouble: "\u2554",
|
|
53346
|
-
lineDownDoubleRight: "\u2553",
|
|
53347
|
-
lineDownRightDouble: "\u2552",
|
|
53348
|
-
lineUpLeft: "\u2518",
|
|
53349
|
-
lineUpLeftArc: "\u256F",
|
|
53350
|
-
lineUpBoldLeftBold: "\u251B",
|
|
53351
|
-
lineUpBoldLeft: "\u251A",
|
|
53352
|
-
lineUpLeftBold: "\u2519",
|
|
53353
|
-
lineUpDoubleLeftDouble: "\u255D",
|
|
53354
|
-
lineUpDoubleLeft: "\u255C",
|
|
53355
|
-
lineUpLeftDouble: "\u255B",
|
|
53356
|
-
lineUpRight: "\u2514",
|
|
53357
|
-
lineUpRightArc: "\u2570",
|
|
53358
|
-
lineUpBoldRightBold: "\u2517",
|
|
53359
|
-
lineUpBoldRight: "\u2516",
|
|
53360
|
-
lineUpRightBold: "\u2515",
|
|
53361
|
-
lineUpDoubleRightDouble: "\u255A",
|
|
53362
|
-
lineUpDoubleRight: "\u2559",
|
|
53363
|
-
lineUpRightDouble: "\u2558",
|
|
53364
|
-
lineUpDownLeft: "\u2524",
|
|
53365
|
-
lineUpBoldDownBoldLeftBold: "\u252B",
|
|
53366
|
-
lineUpBoldDownBoldLeft: "\u2528",
|
|
53367
|
-
lineUpDownLeftBold: "\u2525",
|
|
53368
|
-
lineUpBoldDownLeftBold: "\u2529",
|
|
53369
|
-
lineUpDownBoldLeftBold: "\u252A",
|
|
53370
|
-
lineUpDownBoldLeft: "\u2527",
|
|
53371
|
-
lineUpBoldDownLeft: "\u2526",
|
|
53372
|
-
lineUpDoubleDownDoubleLeftDouble: "\u2563",
|
|
53373
|
-
lineUpDoubleDownDoubleLeft: "\u2562",
|
|
53374
|
-
lineUpDownLeftDouble: "\u2561",
|
|
53375
|
-
lineUpDownRight: "\u251C",
|
|
53376
|
-
lineUpBoldDownBoldRightBold: "\u2523",
|
|
53377
|
-
lineUpBoldDownBoldRight: "\u2520",
|
|
53378
|
-
lineUpDownRightBold: "\u251D",
|
|
53379
|
-
lineUpBoldDownRightBold: "\u2521",
|
|
53380
|
-
lineUpDownBoldRightBold: "\u2522",
|
|
53381
|
-
lineUpDownBoldRight: "\u251F",
|
|
53382
|
-
lineUpBoldDownRight: "\u251E",
|
|
53383
|
-
lineUpDoubleDownDoubleRightDouble: "\u2560",
|
|
53384
|
-
lineUpDoubleDownDoubleRight: "\u255F",
|
|
53385
|
-
lineUpDownRightDouble: "\u255E",
|
|
53386
|
-
lineDownLeftRight: "\u252C",
|
|
53387
|
-
lineDownBoldLeftBoldRightBold: "\u2533",
|
|
53388
|
-
lineDownLeftBoldRightBold: "\u252F",
|
|
53389
|
-
lineDownBoldLeftRight: "\u2530",
|
|
53390
|
-
lineDownBoldLeftBoldRight: "\u2531",
|
|
53391
|
-
lineDownBoldLeftRightBold: "\u2532",
|
|
53392
|
-
lineDownLeftRightBold: "\u252E",
|
|
53393
|
-
lineDownLeftBoldRight: "\u252D",
|
|
53394
|
-
lineDownDoubleLeftDoubleRightDouble: "\u2566",
|
|
53395
|
-
lineDownDoubleLeftRight: "\u2565",
|
|
53396
|
-
lineDownLeftDoubleRightDouble: "\u2564",
|
|
53397
|
-
lineUpLeftRight: "\u2534",
|
|
53398
|
-
lineUpBoldLeftBoldRightBold: "\u253B",
|
|
53399
|
-
lineUpLeftBoldRightBold: "\u2537",
|
|
53400
|
-
lineUpBoldLeftRight: "\u2538",
|
|
53401
|
-
lineUpBoldLeftBoldRight: "\u2539",
|
|
53402
|
-
lineUpBoldLeftRightBold: "\u253A",
|
|
53403
|
-
lineUpLeftRightBold: "\u2536",
|
|
53404
|
-
lineUpLeftBoldRight: "\u2535",
|
|
53405
|
-
lineUpDoubleLeftDoubleRightDouble: "\u2569",
|
|
53406
|
-
lineUpDoubleLeftRight: "\u2568",
|
|
53407
|
-
lineUpLeftDoubleRightDouble: "\u2567",
|
|
53408
|
-
lineUpDownLeftRight: "\u253C",
|
|
53409
|
-
lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
|
|
53410
|
-
lineUpDownBoldLeftBoldRightBold: "\u2548",
|
|
53411
|
-
lineUpBoldDownLeftBoldRightBold: "\u2547",
|
|
53412
|
-
lineUpBoldDownBoldLeftRightBold: "\u254A",
|
|
53413
|
-
lineUpBoldDownBoldLeftBoldRight: "\u2549",
|
|
53414
|
-
lineUpBoldDownLeftRight: "\u2540",
|
|
53415
|
-
lineUpDownBoldLeftRight: "\u2541",
|
|
53416
|
-
lineUpDownLeftBoldRight: "\u253D",
|
|
53417
|
-
lineUpDownLeftRightBold: "\u253E",
|
|
53418
|
-
lineUpBoldDownBoldLeftRight: "\u2542",
|
|
53419
|
-
lineUpDownLeftBoldRightBold: "\u253F",
|
|
53420
|
-
lineUpBoldDownLeftBoldRight: "\u2543",
|
|
53421
|
-
lineUpBoldDownLeftRightBold: "\u2544",
|
|
53422
|
-
lineUpDownBoldLeftBoldRight: "\u2545",
|
|
53423
|
-
lineUpDownBoldLeftRightBold: "\u2546",
|
|
53424
|
-
lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
|
|
53425
|
-
lineUpDoubleDownDoubleLeftRight: "\u256B",
|
|
53426
|
-
lineUpDownLeftDoubleRightDouble: "\u256A",
|
|
53427
|
-
lineCross: "\u2573",
|
|
53428
|
-
lineBackslash: "\u2572",
|
|
53429
|
-
lineSlash: "\u2571"
|
|
53430
|
-
};
|
|
53431
|
-
specialMainSymbols = {
|
|
53432
|
-
tick: "\u2714",
|
|
53433
|
-
info: "\u2139",
|
|
53434
|
-
warning: "\u26A0",
|
|
53435
|
-
cross: "\u2718",
|
|
53436
|
-
squareSmall: "\u25FB",
|
|
53437
|
-
squareSmallFilled: "\u25FC",
|
|
53438
|
-
circle: "\u25EF",
|
|
53439
|
-
circleFilled: "\u25C9",
|
|
53440
|
-
circleDotted: "\u25CC",
|
|
53441
|
-
circleDouble: "\u25CE",
|
|
53442
|
-
circleCircle: "\u24DE",
|
|
53443
|
-
circleCross: "\u24E7",
|
|
53444
|
-
circlePipe: "\u24BE",
|
|
53445
|
-
radioOn: "\u25C9",
|
|
53446
|
-
radioOff: "\u25EF",
|
|
53447
|
-
checkboxOn: "\u2612",
|
|
53448
|
-
checkboxOff: "\u2610",
|
|
53449
|
-
checkboxCircleOn: "\u24E7",
|
|
53450
|
-
checkboxCircleOff: "\u24BE",
|
|
53451
|
-
pointer: "\u276F",
|
|
53452
|
-
triangleUpOutline: "\u25B3",
|
|
53453
|
-
triangleLeft: "\u25C0",
|
|
53454
|
-
triangleRight: "\u25B6",
|
|
53455
|
-
lozenge: "\u25C6",
|
|
53456
|
-
lozengeOutline: "\u25C7",
|
|
53457
|
-
hamburger: "\u2630",
|
|
53458
|
-
smiley: "\u32E1",
|
|
53459
|
-
mustache: "\u0DF4",
|
|
53460
|
-
star: "\u2605",
|
|
53461
|
-
play: "\u25B6",
|
|
53462
|
-
nodejs: "\u2B22",
|
|
53463
|
-
oneSeventh: "\u2150",
|
|
53464
|
-
oneNinth: "\u2151",
|
|
53465
|
-
oneTenth: "\u2152"
|
|
53466
|
-
};
|
|
53467
|
-
specialFallbackSymbols = {
|
|
53468
|
-
tick: "\u221A",
|
|
53469
|
-
info: "i",
|
|
53470
|
-
warning: "\u203C",
|
|
53471
|
-
cross: "\xD7",
|
|
53472
|
-
squareSmall: "\u25A1",
|
|
53473
|
-
squareSmallFilled: "\u25A0",
|
|
53474
|
-
circle: "( )",
|
|
53475
|
-
circleFilled: "(*)",
|
|
53476
|
-
circleDotted: "( )",
|
|
53477
|
-
circleDouble: "( )",
|
|
53478
|
-
circleCircle: "(\u25CB)",
|
|
53479
|
-
circleCross: "(\xD7)",
|
|
53480
|
-
circlePipe: "(\u2502)",
|
|
53481
|
-
radioOn: "(*)",
|
|
53482
|
-
radioOff: "( )",
|
|
53483
|
-
checkboxOn: "[\xD7]",
|
|
53484
|
-
checkboxOff: "[ ]",
|
|
53485
|
-
checkboxCircleOn: "(\xD7)",
|
|
53486
|
-
checkboxCircleOff: "( )",
|
|
53487
|
-
pointer: ">",
|
|
53488
|
-
triangleUpOutline: "\u2206",
|
|
53489
|
-
triangleLeft: "\u25C4",
|
|
53490
|
-
triangleRight: "\u25BA",
|
|
53491
|
-
lozenge: "\u2666",
|
|
53492
|
-
lozengeOutline: "\u25CA",
|
|
53493
|
-
hamburger: "\u2261",
|
|
53494
|
-
smiley: "\u263A",
|
|
53495
|
-
mustache: "\u250C\u2500\u2510",
|
|
53496
|
-
star: "\u2736",
|
|
53497
|
-
play: "\u25BA",
|
|
53498
|
-
nodejs: "\u2666",
|
|
53499
|
-
oneSeventh: "1/7",
|
|
53500
|
-
oneNinth: "1/9",
|
|
53501
|
-
oneTenth: "1/10"
|
|
53502
|
-
};
|
|
53503
|
-
mainSymbols = {
|
|
53504
|
-
...common,
|
|
53505
|
-
...specialMainSymbols
|
|
53506
|
-
};
|
|
53507
|
-
fallbackSymbols = {
|
|
53508
|
-
...common,
|
|
53509
|
-
...specialFallbackSymbols
|
|
53510
|
-
};
|
|
53511
|
-
shouldUseMain = isUnicodeSupported();
|
|
53512
|
-
figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
53513
|
-
dist_default = figures;
|
|
53514
|
-
replacements = Object.entries(specialMainSymbols);
|
|
53515
|
-
}
|
|
53516
|
-
});
|
|
53517
|
-
|
|
53518
|
-
// node_modules/@inquirer/core/dist/lib/theme.js
|
|
53519
|
-
import { styleText } from "node:util";
|
|
53520
|
-
var defaultTheme;
|
|
53521
|
-
var init_theme = __esm({
|
|
53522
|
-
"node_modules/@inquirer/core/dist/lib/theme.js"() {
|
|
53523
|
-
"use strict";
|
|
53524
|
-
init_dist();
|
|
53525
|
-
defaultTheme = {
|
|
53526
|
-
prefix: {
|
|
53527
|
-
idle: styleText("blue", "?"),
|
|
53528
|
-
done: styleText("green", dist_default.tick)
|
|
53529
|
-
},
|
|
53530
|
-
spinner: {
|
|
53531
|
-
interval: 80,
|
|
53532
|
-
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"].map((frame) => styleText("yellow", frame))
|
|
53533
|
-
},
|
|
53534
|
-
style: {
|
|
53535
|
-
answer: (text) => styleText("cyan", text),
|
|
53536
|
-
message: (text) => styleText("bold", text),
|
|
53537
|
-
error: (text) => styleText("red", `> ${text}`),
|
|
53538
|
-
defaultAnswer: (text) => styleText("dim", `(${text})`),
|
|
53539
|
-
help: (text) => styleText("dim", text),
|
|
53540
|
-
highlight: (text) => styleText("cyan", text),
|
|
53541
|
-
key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
|
|
53542
|
-
}
|
|
53543
|
-
};
|
|
53544
|
-
}
|
|
53545
|
-
});
|
|
53546
|
-
|
|
53547
|
-
// node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
53548
|
-
function isPlainObject(value) {
|
|
53549
|
-
if (typeof value !== "object" || value === null)
|
|
53550
|
-
return false;
|
|
53551
|
-
let proto = value;
|
|
53552
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
53553
|
-
proto = Object.getPrototypeOf(proto);
|
|
53554
|
-
}
|
|
53555
|
-
return Object.getPrototypeOf(value) === proto;
|
|
53556
|
-
}
|
|
53557
|
-
function deepMerge(...objects) {
|
|
53558
|
-
const output = {};
|
|
53559
|
-
for (const obj of objects) {
|
|
53560
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
53561
|
-
const prevValue = output[key];
|
|
53562
|
-
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
53563
|
-
}
|
|
53564
|
-
}
|
|
53565
|
-
return output;
|
|
53566
|
-
}
|
|
53567
|
-
function makeTheme(...themes) {
|
|
53568
|
-
const themesToMerge = [
|
|
53569
|
-
defaultTheme,
|
|
53570
|
-
...themes.filter((theme) => theme != null)
|
|
53571
|
-
];
|
|
53572
|
-
return deepMerge(...themesToMerge);
|
|
53573
|
-
}
|
|
53574
|
-
var init_make_theme = __esm({
|
|
53575
|
-
"node_modules/@inquirer/core/dist/lib/make-theme.js"() {
|
|
53576
|
-
"use strict";
|
|
53577
|
-
init_theme();
|
|
53578
|
-
}
|
|
53579
|
-
});
|
|
53580
|
-
|
|
53581
|
-
// node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
53582
|
-
function usePrefix({ status = "idle", theme }) {
|
|
53583
|
-
const [showLoader, setShowLoader] = useState(false);
|
|
53584
|
-
const [tick, setTick] = useState(0);
|
|
53585
|
-
const { prefix, spinner } = makeTheme(theme);
|
|
53586
|
-
useEffect(() => {
|
|
53587
|
-
if (status === "loading") {
|
|
53588
|
-
let tickInterval;
|
|
53589
|
-
let inc = -1;
|
|
53590
|
-
const delayTimeout = setTimeout(() => {
|
|
53591
|
-
setShowLoader(true);
|
|
53592
|
-
tickInterval = setInterval(() => {
|
|
53593
|
-
inc = inc + 1;
|
|
53594
|
-
setTick(inc % spinner.frames.length);
|
|
53595
|
-
}, spinner.interval);
|
|
53596
|
-
}, 300);
|
|
53597
|
-
return () => {
|
|
53598
|
-
clearTimeout(delayTimeout);
|
|
53599
|
-
clearInterval(tickInterval);
|
|
53600
|
-
};
|
|
53601
|
-
} else {
|
|
53602
|
-
setShowLoader(false);
|
|
53603
|
-
}
|
|
53604
|
-
}, [status]);
|
|
53605
|
-
if (showLoader) {
|
|
53606
|
-
return spinner.frames[tick];
|
|
53607
|
-
}
|
|
53608
|
-
const iconName = status === "loading" ? "idle" : status;
|
|
53609
|
-
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
53610
|
-
}
|
|
53611
|
-
var init_use_prefix = __esm({
|
|
53612
|
-
"node_modules/@inquirer/core/dist/lib/use-prefix.js"() {
|
|
53613
|
-
"use strict";
|
|
53614
|
-
init_use_state();
|
|
53615
|
-
init_use_effect();
|
|
53616
|
-
init_make_theme();
|
|
53617
|
-
}
|
|
53618
|
-
});
|
|
53619
|
-
|
|
53620
|
-
// node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
53621
|
-
function useMemo(fn, dependencies) {
|
|
53622
|
-
return withPointer((pointer) => {
|
|
53623
|
-
const prev = pointer.get();
|
|
53624
|
-
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
53625
|
-
const value = fn();
|
|
53626
|
-
pointer.set({ value, dependencies });
|
|
53627
|
-
return value;
|
|
53628
|
-
}
|
|
53629
|
-
return prev.value;
|
|
53630
|
-
});
|
|
53631
|
-
}
|
|
53632
|
-
var init_use_memo = __esm({
|
|
53633
|
-
"node_modules/@inquirer/core/dist/lib/use-memo.js"() {
|
|
53634
|
-
"use strict";
|
|
53635
|
-
init_hook_engine();
|
|
53636
|
-
}
|
|
53637
|
-
});
|
|
53638
|
-
|
|
53639
|
-
// node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
53640
|
-
function useRef(val) {
|
|
53641
|
-
return useState({ current: val })[0];
|
|
53642
|
-
}
|
|
53643
|
-
var init_use_ref = __esm({
|
|
53644
|
-
"node_modules/@inquirer/core/dist/lib/use-ref.js"() {
|
|
53645
|
-
"use strict";
|
|
53646
|
-
init_use_state();
|
|
53647
|
-
}
|
|
53648
|
-
});
|
|
53649
|
-
|
|
53650
|
-
// node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
53651
|
-
function useKeypress(userHandler) {
|
|
53652
|
-
const signal = useRef(userHandler);
|
|
53653
|
-
signal.current = userHandler;
|
|
53654
|
-
useEffect((rl) => {
|
|
53655
|
-
let ignore = false;
|
|
53656
|
-
const handler = withUpdates((_input, event) => {
|
|
53657
|
-
if (ignore)
|
|
53658
|
-
return;
|
|
53659
|
-
void signal.current(event, rl);
|
|
53660
|
-
});
|
|
53661
|
-
rl.input.on("keypress", handler);
|
|
53662
|
-
return () => {
|
|
53663
|
-
ignore = true;
|
|
53664
|
-
rl.input.removeListener("keypress", handler);
|
|
53665
|
-
};
|
|
53666
|
-
}, []);
|
|
53667
|
-
}
|
|
53668
|
-
var init_use_keypress = __esm({
|
|
53669
|
-
"node_modules/@inquirer/core/dist/lib/use-keypress.js"() {
|
|
53670
|
-
"use strict";
|
|
53671
|
-
init_use_ref();
|
|
53672
|
-
init_use_effect();
|
|
53673
|
-
init_hook_engine();
|
|
53674
|
-
}
|
|
53675
|
-
});
|
|
53676
|
-
|
|
53677
|
-
// node_modules/cli-width/index.js
|
|
53678
|
-
var require_cli_width = __commonJS({
|
|
53679
|
-
"node_modules/cli-width/index.js"(exports, module) {
|
|
53680
|
-
"use strict";
|
|
53681
|
-
module.exports = cliWidth2;
|
|
53682
|
-
function normalizeOpts(options) {
|
|
53683
|
-
const defaultOpts = {
|
|
53684
|
-
defaultWidth: 0,
|
|
53685
|
-
output: process.stdout,
|
|
53686
|
-
tty: __require("tty")
|
|
53687
|
-
};
|
|
53688
|
-
if (!options) {
|
|
53689
|
-
return defaultOpts;
|
|
53690
|
-
}
|
|
53691
|
-
Object.keys(defaultOpts).forEach(function(key) {
|
|
53692
|
-
if (!options[key]) {
|
|
53693
|
-
options[key] = defaultOpts[key];
|
|
53694
|
-
}
|
|
53695
|
-
});
|
|
53696
|
-
return options;
|
|
53697
|
-
}
|
|
53698
|
-
function cliWidth2(options) {
|
|
53699
|
-
const opts = normalizeOpts(options);
|
|
53700
|
-
if (opts.output.getWindowSize) {
|
|
53701
|
-
return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
|
53702
|
-
}
|
|
53703
|
-
if (opts.tty.getWindowSize) {
|
|
53704
|
-
return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
|
53705
|
-
}
|
|
53706
|
-
if (opts.output.columns) {
|
|
53707
|
-
return opts.output.columns;
|
|
53708
|
-
}
|
|
53709
|
-
if (process.env.CLI_WIDTH) {
|
|
53710
|
-
const width = parseInt(process.env.CLI_WIDTH, 10);
|
|
53711
|
-
if (!isNaN(width) && width !== 0) {
|
|
53712
|
-
return width;
|
|
53713
|
-
}
|
|
53714
|
-
}
|
|
53715
|
-
return opts.defaultWidth;
|
|
53716
|
-
}
|
|
53717
|
-
}
|
|
53718
|
-
});
|
|
53719
|
-
|
|
53720
|
-
// node_modules/fast-string-truncated-width/dist/utils.js
|
|
53721
|
-
var getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji;
|
|
53722
|
-
var init_utils5 = __esm({
|
|
53723
|
-
"node_modules/fast-string-truncated-width/dist/utils.js"() {
|
|
53724
|
-
"use strict";
|
|
53725
|
-
getCodePointsLength = /* @__PURE__ */ (() => {
|
|
53726
|
-
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
53727
|
-
return (input) => {
|
|
53728
|
-
let surrogatePairsNr = 0;
|
|
53729
|
-
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
53730
|
-
while (SURROGATE_PAIR_RE.test(input)) {
|
|
53731
|
-
surrogatePairsNr += 1;
|
|
53732
|
-
}
|
|
53733
|
-
return input.length - surrogatePairsNr;
|
|
53734
|
-
};
|
|
53735
|
-
})();
|
|
53736
|
-
isFullWidth = (x) => {
|
|
53737
|
-
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
53738
|
-
};
|
|
53739
|
-
isWideNotCJKTNotEmoji = (x) => {
|
|
53740
|
-
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
53741
|
-
};
|
|
53742
|
-
}
|
|
53743
|
-
});
|
|
53744
|
-
|
|
53745
|
-
// node_modules/fast-string-truncated-width/dist/index.js
|
|
53746
|
-
var ANSI_RE, CONTROL_RE, CJKT_WIDE_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default2;
|
|
53747
|
-
var init_dist2 = __esm({
|
|
53748
|
-
"node_modules/fast-string-truncated-width/dist/index.js"() {
|
|
53749
|
-
"use strict";
|
|
53750
|
-
init_utils5();
|
|
53751
|
-
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
53752
|
-
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
53753
|
-
CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
53754
|
-
TAB_RE = /\t{1,1000}/y;
|
|
53755
|
-
EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
53756
|
-
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
53757
|
-
MODIFIER_RE = new RegExp("\\p{M}+", "gu");
|
|
53758
|
-
NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
53759
|
-
getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
53760
|
-
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
53761
|
-
const ELLIPSIS4 = truncationOptions.ellipsis ?? "";
|
|
53762
|
-
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS4 ? getStringTruncatedWidth(ELLIPSIS4, NO_TRUNCATION, widthOptions).width : 0);
|
|
53763
|
-
const ANSI_WIDTH = 0;
|
|
53764
|
-
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
53765
|
-
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
53766
|
-
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
53767
|
-
const FULL_WIDTH_WIDTH = 2;
|
|
53768
|
-
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
53769
|
-
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
53770
|
-
const PARSE_BLOCKS = [
|
|
53771
|
-
[LATIN_RE, REGULAR_WIDTH],
|
|
53772
|
-
[ANSI_RE, ANSI_WIDTH],
|
|
53773
|
-
[CONTROL_RE, CONTROL_WIDTH],
|
|
53774
|
-
[TAB_RE, TAB_WIDTH],
|
|
53775
|
-
[EMOJI_RE, EMOJI_WIDTH],
|
|
53776
|
-
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
53777
|
-
];
|
|
53778
|
-
let indexPrev = 0;
|
|
53779
|
-
let index = 0;
|
|
53780
|
-
let length = input.length;
|
|
53781
|
-
let lengthExtra = 0;
|
|
53782
|
-
let truncationEnabled = false;
|
|
53783
|
-
let truncationIndex = length;
|
|
53784
|
-
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
53785
|
-
let unmatchedStart = 0;
|
|
53786
|
-
let unmatchedEnd = 0;
|
|
53787
|
-
let width = 0;
|
|
53788
|
-
let widthExtra = 0;
|
|
53789
|
-
outer: while (true) {
|
|
53790
|
-
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
53791
|
-
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
53792
|
-
lengthExtra = 0;
|
|
53793
|
-
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
53794
|
-
const codePoint = char.codePointAt(0) || 0;
|
|
53795
|
-
if (isFullWidth(codePoint)) {
|
|
53796
|
-
widthExtra = FULL_WIDTH_WIDTH;
|
|
53797
|
-
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
53798
|
-
widthExtra = WIDE_WIDTH;
|
|
53799
|
-
} else {
|
|
53800
|
-
widthExtra = REGULAR_WIDTH;
|
|
53801
|
-
}
|
|
53802
|
-
if (width + widthExtra > truncationLimit) {
|
|
53803
|
-
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
53804
|
-
}
|
|
53805
|
-
if (width + widthExtra > LIMIT) {
|
|
53806
|
-
truncationEnabled = true;
|
|
53807
|
-
break outer;
|
|
53808
|
-
}
|
|
53809
|
-
lengthExtra += char.length;
|
|
53810
|
-
width += widthExtra;
|
|
53811
|
-
}
|
|
53812
|
-
unmatchedStart = unmatchedEnd = 0;
|
|
53813
|
-
}
|
|
53814
|
-
if (index >= length) {
|
|
53815
|
-
break outer;
|
|
53816
|
-
}
|
|
53817
|
-
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
53818
|
-
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
53819
|
-
BLOCK_RE.lastIndex = index;
|
|
53820
|
-
if (BLOCK_RE.test(input)) {
|
|
53821
|
-
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
53822
|
-
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
53823
|
-
if (width + widthExtra > truncationLimit) {
|
|
53824
|
-
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
53825
|
-
}
|
|
53826
|
-
if (width + widthExtra > LIMIT) {
|
|
53827
|
-
truncationEnabled = true;
|
|
53828
|
-
break outer;
|
|
53829
|
-
}
|
|
53830
|
-
width += widthExtra;
|
|
53831
|
-
unmatchedStart = indexPrev;
|
|
53832
|
-
unmatchedEnd = index;
|
|
53833
|
-
index = indexPrev = BLOCK_RE.lastIndex;
|
|
53834
|
-
continue outer;
|
|
53835
|
-
}
|
|
53836
|
-
}
|
|
53837
|
-
index += 1;
|
|
53838
|
-
}
|
|
53839
|
-
return {
|
|
53840
|
-
width: truncationEnabled ? truncationLimit : width,
|
|
53841
|
-
index: truncationEnabled ? truncationIndex : length,
|
|
53842
|
-
truncated: truncationEnabled,
|
|
53843
|
-
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
53844
|
-
};
|
|
53845
|
-
};
|
|
53846
|
-
dist_default2 = getStringTruncatedWidth;
|
|
53847
|
-
}
|
|
53848
|
-
});
|
|
53849
|
-
|
|
53850
|
-
// node_modules/fast-string-width/dist/index.js
|
|
53851
|
-
var NO_TRUNCATION2, fastStringWidth, dist_default3;
|
|
53852
|
-
var init_dist3 = __esm({
|
|
53853
|
-
"node_modules/fast-string-width/dist/index.js"() {
|
|
53854
|
-
"use strict";
|
|
53855
|
-
init_dist2();
|
|
53856
|
-
NO_TRUNCATION2 = {
|
|
53857
|
-
limit: Infinity,
|
|
53858
|
-
ellipsis: "",
|
|
53859
|
-
ellipsisWidth: 0
|
|
53860
|
-
};
|
|
53861
|
-
fastStringWidth = (input, options = {}) => {
|
|
53862
|
-
return dist_default2(input, NO_TRUNCATION2, options).width;
|
|
53863
|
-
};
|
|
53864
|
-
dist_default3 = fastStringWidth;
|
|
53865
|
-
}
|
|
53866
|
-
});
|
|
53867
|
-
|
|
53868
|
-
// node_modules/fast-wrap-ansi/lib/main.js
|
|
53869
|
-
function wrapAnsi(string, columns, options) {
|
|
53870
|
-
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec6(line, columns, options)).join("\n");
|
|
53871
|
-
}
|
|
53872
|
-
var ESC, CSI, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode, wrapAnsiCode, wrapAnsiHyperlink, wrapWord, stringVisibleTrimSpacesRight, exec6, CRLF_OR_LF;
|
|
53873
|
-
var init_main = __esm({
|
|
53874
|
-
"node_modules/fast-wrap-ansi/lib/main.js"() {
|
|
53875
|
-
"use strict";
|
|
53876
|
-
init_dist3();
|
|
53877
|
-
ESC = "\x1B";
|
|
53878
|
-
CSI = "\x9B";
|
|
53879
|
-
END_CODE = 39;
|
|
53880
|
-
ANSI_ESCAPE_BELL = "\x07";
|
|
53881
|
-
ANSI_CSI = "[";
|
|
53882
|
-
ANSI_OSC = "]";
|
|
53883
|
-
ANSI_SGR_TERMINATOR = "m";
|
|
53884
|
-
ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
53885
|
-
GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
53886
|
-
getClosingCode = (openingCode) => {
|
|
53887
|
-
if (openingCode >= 30 && openingCode <= 37)
|
|
53888
|
-
return 39;
|
|
53889
|
-
if (openingCode >= 90 && openingCode <= 97)
|
|
53890
|
-
return 39;
|
|
53891
|
-
if (openingCode >= 40 && openingCode <= 47)
|
|
53892
|
-
return 49;
|
|
53893
|
-
if (openingCode >= 100 && openingCode <= 107)
|
|
53894
|
-
return 49;
|
|
53895
|
-
if (openingCode === 1 || openingCode === 2)
|
|
53896
|
-
return 22;
|
|
53897
|
-
if (openingCode === 3)
|
|
53898
|
-
return 23;
|
|
53899
|
-
if (openingCode === 4)
|
|
53900
|
-
return 24;
|
|
53901
|
-
if (openingCode === 7)
|
|
53902
|
-
return 27;
|
|
53903
|
-
if (openingCode === 8)
|
|
53904
|
-
return 28;
|
|
53905
|
-
if (openingCode === 9)
|
|
53906
|
-
return 29;
|
|
53907
|
-
if (openingCode === 0)
|
|
53908
|
-
return 0;
|
|
53909
|
-
return void 0;
|
|
53910
|
-
};
|
|
53911
|
-
wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
53912
|
-
wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
53913
|
-
wrapWord = (rows, word, columns) => {
|
|
53914
|
-
const characters = word[Symbol.iterator]();
|
|
53915
|
-
let isInsideEscape = false;
|
|
53916
|
-
let isInsideLinkEscape = false;
|
|
53917
|
-
let lastRow = rows.at(-1);
|
|
53918
|
-
let visible = lastRow === void 0 ? 0 : dist_default3(lastRow);
|
|
53919
|
-
let currentCharacter = characters.next();
|
|
53920
|
-
let nextCharacter = characters.next();
|
|
53921
|
-
let rawCharacterIndex = 0;
|
|
53922
|
-
while (!currentCharacter.done) {
|
|
53923
|
-
const character = currentCharacter.value;
|
|
53924
|
-
const characterLength = dist_default3(character);
|
|
53925
|
-
if (visible + characterLength <= columns) {
|
|
53926
|
-
rows[rows.length - 1] += character;
|
|
53927
|
-
} else {
|
|
53928
|
-
rows.push(character);
|
|
53929
|
-
visible = 0;
|
|
53930
|
-
}
|
|
53931
|
-
if (character === ESC || character === CSI) {
|
|
53932
|
-
isInsideEscape = true;
|
|
53933
|
-
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
53934
|
-
}
|
|
53935
|
-
if (isInsideEscape) {
|
|
53936
|
-
if (isInsideLinkEscape) {
|
|
53937
|
-
if (character === ANSI_ESCAPE_BELL) {
|
|
53938
|
-
isInsideEscape = false;
|
|
53939
|
-
isInsideLinkEscape = false;
|
|
53940
|
-
}
|
|
53941
|
-
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
53942
|
-
isInsideEscape = false;
|
|
53943
|
-
}
|
|
53944
|
-
} else {
|
|
53945
|
-
visible += characterLength;
|
|
53946
|
-
if (visible === columns && !nextCharacter.done) {
|
|
53947
|
-
rows.push("");
|
|
53948
|
-
visible = 0;
|
|
53949
|
-
}
|
|
53950
|
-
}
|
|
53951
|
-
currentCharacter = nextCharacter;
|
|
53952
|
-
nextCharacter = characters.next();
|
|
53953
|
-
rawCharacterIndex += character.length;
|
|
53954
|
-
}
|
|
53955
|
-
lastRow = rows.at(-1);
|
|
53956
|
-
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
53957
|
-
rows[rows.length - 2] += rows.pop();
|
|
53958
|
-
}
|
|
53959
|
-
};
|
|
53960
|
-
stringVisibleTrimSpacesRight = (string) => {
|
|
53961
|
-
const words = string.split(" ");
|
|
53962
|
-
let last = words.length;
|
|
53963
|
-
while (last) {
|
|
53964
|
-
if (dist_default3(words[last - 1])) {
|
|
53965
|
-
break;
|
|
53966
|
-
}
|
|
53967
|
-
last--;
|
|
53968
|
-
}
|
|
53969
|
-
if (last === words.length) {
|
|
53970
|
-
return string;
|
|
53971
|
-
}
|
|
53972
|
-
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
53973
|
-
};
|
|
53974
|
-
exec6 = (string, columns, options = {}) => {
|
|
53975
|
-
if (options.trim !== false && string.trim() === "") {
|
|
53976
|
-
return "";
|
|
53977
|
-
}
|
|
53978
|
-
let returnValue = "";
|
|
53979
|
-
let escapeCode;
|
|
53980
|
-
let escapeUrl;
|
|
53981
|
-
const words = string.split(" ");
|
|
53982
|
-
let rows = [""];
|
|
53983
|
-
let rowLength = 0;
|
|
53984
|
-
for (let index = 0; index < words.length; index++) {
|
|
53985
|
-
const word = words[index];
|
|
53986
|
-
if (options.trim !== false) {
|
|
53987
|
-
const row = rows.at(-1) ?? "";
|
|
53988
|
-
const trimmed = row.trimStart();
|
|
53989
|
-
if (row.length !== trimmed.length) {
|
|
53990
|
-
rows[rows.length - 1] = trimmed;
|
|
53991
|
-
rowLength = dist_default3(trimmed);
|
|
53992
|
-
}
|
|
53993
|
-
}
|
|
53994
|
-
if (index !== 0) {
|
|
53995
|
-
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
53996
|
-
rows.push("");
|
|
53997
|
-
rowLength = 0;
|
|
53998
|
-
}
|
|
53999
|
-
if (rowLength || options.trim === false) {
|
|
54000
|
-
rows[rows.length - 1] += " ";
|
|
54001
|
-
rowLength++;
|
|
54002
|
-
}
|
|
54003
|
-
}
|
|
54004
|
-
const wordLength = dist_default3(word);
|
|
54005
|
-
if (options.hard && wordLength > columns) {
|
|
54006
|
-
const remainingColumns = columns - rowLength;
|
|
54007
|
-
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
54008
|
-
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
54009
|
-
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
54010
|
-
rows.push("");
|
|
54011
|
-
}
|
|
54012
|
-
wrapWord(rows, word, columns);
|
|
54013
|
-
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
54014
|
-
continue;
|
|
54015
|
-
}
|
|
54016
|
-
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
54017
|
-
if (options.wordWrap === false && rowLength < columns) {
|
|
54018
|
-
wrapWord(rows, word, columns);
|
|
54019
|
-
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
54020
|
-
continue;
|
|
54021
|
-
}
|
|
54022
|
-
rows.push("");
|
|
54023
|
-
rowLength = 0;
|
|
54024
|
-
}
|
|
54025
|
-
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
54026
|
-
wrapWord(rows, word, columns);
|
|
54027
|
-
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
54028
|
-
continue;
|
|
54029
|
-
}
|
|
54030
|
-
rows[rows.length - 1] += word;
|
|
54031
|
-
rowLength += wordLength;
|
|
54032
|
-
}
|
|
54033
|
-
if (options.trim !== false) {
|
|
54034
|
-
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
54035
|
-
}
|
|
54036
|
-
const preString = rows.join("\n");
|
|
54037
|
-
let inSurrogate = false;
|
|
54038
|
-
for (let i = 0; i < preString.length; i++) {
|
|
54039
|
-
const character = preString[i];
|
|
54040
|
-
returnValue += character;
|
|
54041
|
-
if (!inSurrogate) {
|
|
54042
|
-
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
54043
|
-
if (inSurrogate) {
|
|
54044
|
-
continue;
|
|
54045
|
-
}
|
|
54046
|
-
} else {
|
|
54047
|
-
inSurrogate = false;
|
|
54048
|
-
}
|
|
54049
|
-
if (character === ESC || character === CSI) {
|
|
54050
|
-
GROUP_REGEX.lastIndex = i + 1;
|
|
54051
|
-
const groupsResult = GROUP_REGEX.exec(preString);
|
|
54052
|
-
const groups = groupsResult?.groups;
|
|
54053
|
-
if (groups?.code !== void 0) {
|
|
54054
|
-
const code = Number.parseFloat(groups.code);
|
|
54055
|
-
escapeCode = code === END_CODE ? void 0 : code;
|
|
54056
|
-
} else if (groups?.uri !== void 0) {
|
|
54057
|
-
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
54058
|
-
}
|
|
54059
|
-
}
|
|
54060
|
-
if (preString[i + 1] === "\n") {
|
|
54061
|
-
if (escapeUrl) {
|
|
54062
|
-
returnValue += wrapAnsiHyperlink("");
|
|
54063
|
-
}
|
|
54064
|
-
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
54065
|
-
if (escapeCode && closingCode) {
|
|
54066
|
-
returnValue += wrapAnsiCode(closingCode);
|
|
54067
|
-
}
|
|
54068
|
-
} else if (character === "\n") {
|
|
54069
|
-
if (escapeCode && getClosingCode(escapeCode)) {
|
|
54070
|
-
returnValue += wrapAnsiCode(escapeCode);
|
|
54071
|
-
}
|
|
54072
|
-
if (escapeUrl) {
|
|
54073
|
-
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
54074
|
-
}
|
|
54075
|
-
}
|
|
54076
|
-
}
|
|
54077
|
-
return returnValue;
|
|
54078
|
-
};
|
|
54079
|
-
CRLF_OR_LF = /\r?\n/;
|
|
54080
|
-
}
|
|
54081
|
-
});
|
|
54082
|
-
|
|
54083
|
-
// node_modules/@inquirer/core/dist/lib/utils.js
|
|
54084
|
-
function breakLines(content, width) {
|
|
54085
|
-
return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split("\n").map((str) => str.trimEnd())).join("\n");
|
|
54086
|
-
}
|
|
54087
|
-
function readlineWidth() {
|
|
54088
|
-
return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
|
|
54089
|
-
}
|
|
54090
|
-
var import_cli_width;
|
|
54091
|
-
var init_utils6 = __esm({
|
|
54092
|
-
"node_modules/@inquirer/core/dist/lib/utils.js"() {
|
|
54093
|
-
"use strict";
|
|
54094
|
-
import_cli_width = __toESM(require_cli_width(), 1);
|
|
54095
|
-
init_main();
|
|
54096
|
-
init_hook_engine();
|
|
54097
|
-
}
|
|
54098
|
-
});
|
|
54099
|
-
|
|
54100
|
-
// node_modules/mute-stream/lib/index.js
|
|
54101
|
-
var require_lib = __commonJS({
|
|
54102
|
-
"node_modules/mute-stream/lib/index.js"(exports, module) {
|
|
54103
|
-
"use strict";
|
|
54104
|
-
var Stream = __require("stream");
|
|
54105
|
-
var MuteStream2 = class extends Stream {
|
|
54106
|
-
#isTTY = null;
|
|
54107
|
-
constructor(opts = {}) {
|
|
54108
|
-
super(opts);
|
|
54109
|
-
this.writable = this.readable = true;
|
|
54110
|
-
this.muted = false;
|
|
54111
|
-
this.on("pipe", this._onpipe);
|
|
54112
|
-
this.replace = opts.replace;
|
|
54113
|
-
this._prompt = opts.prompt || null;
|
|
54114
|
-
this._hadControl = false;
|
|
54115
|
-
}
|
|
54116
|
-
#destSrc(key, def) {
|
|
54117
|
-
if (this._dest) {
|
|
54118
|
-
return this._dest[key];
|
|
54119
|
-
}
|
|
54120
|
-
if (this._src) {
|
|
54121
|
-
return this._src[key];
|
|
54122
|
-
}
|
|
54123
|
-
return def;
|
|
54124
|
-
}
|
|
54125
|
-
#proxy(method, ...args) {
|
|
54126
|
-
if (typeof this._dest?.[method] === "function") {
|
|
54127
|
-
this._dest[method](...args);
|
|
54128
|
-
}
|
|
54129
|
-
if (typeof this._src?.[method] === "function") {
|
|
54130
|
-
this._src[method](...args);
|
|
54131
|
-
}
|
|
54132
|
-
}
|
|
54133
|
-
get isTTY() {
|
|
54134
|
-
if (this.#isTTY !== null) {
|
|
54135
|
-
return this.#isTTY;
|
|
54136
|
-
}
|
|
54137
|
-
return this.#destSrc("isTTY", false);
|
|
54138
|
-
}
|
|
54139
|
-
// basically just get replace the getter/setter with a regular value
|
|
54140
|
-
set isTTY(val) {
|
|
54141
|
-
this.#isTTY = val;
|
|
54142
|
-
}
|
|
54143
|
-
get rows() {
|
|
54144
|
-
return this.#destSrc("rows");
|
|
54145
|
-
}
|
|
54146
|
-
get columns() {
|
|
54147
|
-
return this.#destSrc("columns");
|
|
54148
|
-
}
|
|
54149
|
-
mute() {
|
|
54150
|
-
this.muted = true;
|
|
54151
|
-
}
|
|
54152
|
-
unmute() {
|
|
54153
|
-
this.muted = false;
|
|
54154
|
-
}
|
|
54155
|
-
_onpipe(src) {
|
|
54156
|
-
this._src = src;
|
|
54157
|
-
}
|
|
54158
|
-
pipe(dest, options) {
|
|
54159
|
-
this._dest = dest;
|
|
54160
|
-
return super.pipe(dest, options);
|
|
54161
|
-
}
|
|
54162
|
-
pause() {
|
|
54163
|
-
if (this._src) {
|
|
54164
|
-
return this._src.pause();
|
|
54165
|
-
}
|
|
54166
|
-
}
|
|
54167
|
-
resume() {
|
|
54168
|
-
if (this._src) {
|
|
54169
|
-
return this._src.resume();
|
|
54170
|
-
}
|
|
54171
|
-
}
|
|
54172
|
-
write(c) {
|
|
54173
|
-
if (this.muted) {
|
|
54174
|
-
if (!this.replace) {
|
|
54175
|
-
return true;
|
|
54176
|
-
}
|
|
54177
|
-
if (c.match(/^\u001b/)) {
|
|
54178
|
-
if (c.indexOf(this._prompt) === 0) {
|
|
54179
|
-
c = c.slice(this._prompt.length);
|
|
54180
|
-
c = c.replace(/./g, this.replace);
|
|
54181
|
-
c = this._prompt + c;
|
|
54182
|
-
}
|
|
54183
|
-
this._hadControl = true;
|
|
54184
|
-
return this.emit("data", c);
|
|
54185
|
-
} else {
|
|
54186
|
-
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
54187
|
-
this._hadControl = false;
|
|
54188
|
-
this.emit("data", this._prompt);
|
|
54189
|
-
c = c.slice(this._prompt.length);
|
|
54190
|
-
}
|
|
54191
|
-
c = c.toString().replace(/./g, this.replace);
|
|
54192
|
-
}
|
|
54193
|
-
}
|
|
54194
|
-
this.emit("data", c);
|
|
54195
|
-
}
|
|
54196
|
-
end(c) {
|
|
54197
|
-
if (this.muted) {
|
|
54198
|
-
if (c && this.replace) {
|
|
54199
|
-
c = c.toString().replace(/./g, this.replace);
|
|
54200
|
-
} else {
|
|
54201
|
-
c = null;
|
|
54202
|
-
}
|
|
54203
|
-
}
|
|
54204
|
-
if (c) {
|
|
54205
|
-
this.emit("data", c);
|
|
54206
|
-
}
|
|
54207
|
-
this.emit("end");
|
|
54208
|
-
}
|
|
54209
|
-
destroy(...args) {
|
|
54210
|
-
return this.#proxy("destroy", ...args);
|
|
54211
|
-
}
|
|
54212
|
-
destroySoon(...args) {
|
|
54213
|
-
return this.#proxy("destroySoon", ...args);
|
|
54214
|
-
}
|
|
54215
|
-
close(...args) {
|
|
54216
|
-
return this.#proxy("close", ...args);
|
|
54217
|
-
}
|
|
54218
|
-
};
|
|
54219
|
-
module.exports = MuteStream2;
|
|
54220
|
-
}
|
|
54221
|
-
});
|
|
54222
|
-
|
|
54223
|
-
// node_modules/signal-exit/dist/mjs/signals.js
|
|
54224
|
-
var signals;
|
|
54225
|
-
var init_signals = __esm({
|
|
54226
|
-
"node_modules/signal-exit/dist/mjs/signals.js"() {
|
|
54227
|
-
"use strict";
|
|
54228
|
-
signals = [];
|
|
54229
|
-
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
54230
|
-
if (process.platform !== "win32") {
|
|
54231
|
-
signals.push(
|
|
54232
|
-
"SIGALRM",
|
|
54233
|
-
"SIGABRT",
|
|
54234
|
-
"SIGVTALRM",
|
|
54235
|
-
"SIGXCPU",
|
|
54236
|
-
"SIGXFSZ",
|
|
54237
|
-
"SIGUSR2",
|
|
54238
|
-
"SIGTRAP",
|
|
54239
|
-
"SIGSYS",
|
|
54240
|
-
"SIGQUIT",
|
|
54241
|
-
"SIGIOT"
|
|
54242
|
-
// should detect profiler and enable/disable accordingly.
|
|
54243
|
-
// see #21
|
|
54244
|
-
// 'SIGPROF'
|
|
54245
|
-
);
|
|
54246
|
-
}
|
|
54247
|
-
if (process.platform === "linux") {
|
|
54248
|
-
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
54249
|
-
}
|
|
54250
|
-
}
|
|
54251
|
-
});
|
|
54252
|
-
|
|
54253
|
-
// node_modules/signal-exit/dist/mjs/index.js
|
|
54254
|
-
var processOk, kExitEmitter, global, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, SignalExit, process3, onExit, load, unload;
|
|
54255
|
-
var init_mjs = __esm({
|
|
54256
|
-
"node_modules/signal-exit/dist/mjs/index.js"() {
|
|
54257
|
-
"use strict";
|
|
54258
|
-
init_signals();
|
|
54259
|
-
processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
|
|
54260
|
-
kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
|
|
54261
|
-
global = globalThis;
|
|
54262
|
-
ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
54263
|
-
Emitter = class {
|
|
54264
|
-
emitted = {
|
|
54265
|
-
afterExit: false,
|
|
54266
|
-
exit: false
|
|
54267
|
-
};
|
|
54268
|
-
listeners = {
|
|
54269
|
-
afterExit: [],
|
|
54270
|
-
exit: []
|
|
54271
|
-
};
|
|
54272
|
-
count = 0;
|
|
54273
|
-
id = Math.random();
|
|
54274
|
-
constructor() {
|
|
54275
|
-
if (global[kExitEmitter]) {
|
|
54276
|
-
return global[kExitEmitter];
|
|
54277
|
-
}
|
|
54278
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
54279
|
-
value: this,
|
|
54280
|
-
writable: false,
|
|
54281
|
-
enumerable: false,
|
|
54282
|
-
configurable: false
|
|
54283
|
-
});
|
|
54284
|
-
}
|
|
54285
|
-
on(ev, fn) {
|
|
54286
|
-
this.listeners[ev].push(fn);
|
|
54287
|
-
}
|
|
54288
|
-
removeListener(ev, fn) {
|
|
54289
|
-
const list = this.listeners[ev];
|
|
54290
|
-
const i = list.indexOf(fn);
|
|
54291
|
-
if (i === -1) {
|
|
54292
|
-
return;
|
|
54293
|
-
}
|
|
54294
|
-
if (i === 0 && list.length === 1) {
|
|
54295
|
-
list.length = 0;
|
|
54296
|
-
} else {
|
|
54297
|
-
list.splice(i, 1);
|
|
54298
|
-
}
|
|
54299
|
-
}
|
|
54300
|
-
emit(ev, code, signal) {
|
|
54301
|
-
if (this.emitted[ev]) {
|
|
54302
|
-
return false;
|
|
54303
|
-
}
|
|
54304
|
-
this.emitted[ev] = true;
|
|
54305
|
-
let ret = false;
|
|
54306
|
-
for (const fn of this.listeners[ev]) {
|
|
54307
|
-
ret = fn(code, signal) === true || ret;
|
|
54308
|
-
}
|
|
54309
|
-
if (ev === "exit") {
|
|
54310
|
-
ret = this.emit("afterExit", code, signal) || ret;
|
|
54311
|
-
}
|
|
54312
|
-
return ret;
|
|
54313
|
-
}
|
|
54314
|
-
};
|
|
54315
|
-
SignalExitBase = class {
|
|
54316
|
-
};
|
|
54317
|
-
signalExitWrap = (handler) => {
|
|
54318
|
-
return {
|
|
54319
|
-
onExit(cb, opts) {
|
|
54320
|
-
return handler.onExit(cb, opts);
|
|
54321
|
-
},
|
|
54322
|
-
load() {
|
|
54323
|
-
return handler.load();
|
|
54324
|
-
},
|
|
54325
|
-
unload() {
|
|
54326
|
-
return handler.unload();
|
|
54327
|
-
}
|
|
54328
|
-
};
|
|
54329
|
-
};
|
|
54330
|
-
SignalExitFallback = class extends SignalExitBase {
|
|
54331
|
-
onExit() {
|
|
54332
|
-
return () => {
|
|
54333
|
-
};
|
|
54334
|
-
}
|
|
54335
|
-
load() {
|
|
54336
|
-
}
|
|
54337
|
-
unload() {
|
|
54338
|
-
}
|
|
54339
|
-
};
|
|
54340
|
-
SignalExit = class extends SignalExitBase {
|
|
54341
|
-
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
54342
|
-
// so use a supported signal instead
|
|
54343
|
-
/* c8 ignore start */
|
|
54344
|
-
#hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
54345
|
-
/* c8 ignore stop */
|
|
54346
|
-
#emitter = new Emitter();
|
|
54347
|
-
#process;
|
|
54348
|
-
#originalProcessEmit;
|
|
54349
|
-
#originalProcessReallyExit;
|
|
54350
|
-
#sigListeners = {};
|
|
54351
|
-
#loaded = false;
|
|
54352
|
-
constructor(process4) {
|
|
54353
|
-
super();
|
|
54354
|
-
this.#process = process4;
|
|
54355
|
-
this.#sigListeners = {};
|
|
54356
|
-
for (const sig of signals) {
|
|
54357
|
-
this.#sigListeners[sig] = () => {
|
|
54358
|
-
const listeners = this.#process.listeners(sig);
|
|
54359
|
-
let { count } = this.#emitter;
|
|
54360
|
-
const p = process4;
|
|
54361
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
54362
|
-
count += p.__signal_exit_emitter__.count;
|
|
54363
|
-
}
|
|
54364
|
-
if (listeners.length === count) {
|
|
54365
|
-
this.unload();
|
|
54366
|
-
const ret = this.#emitter.emit("exit", null, sig);
|
|
54367
|
-
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
54368
|
-
if (!ret)
|
|
54369
|
-
process4.kill(process4.pid, s);
|
|
54370
|
-
}
|
|
54371
|
-
};
|
|
54372
|
-
}
|
|
54373
|
-
this.#originalProcessReallyExit = process4.reallyExit;
|
|
54374
|
-
this.#originalProcessEmit = process4.emit;
|
|
54375
|
-
}
|
|
54376
|
-
onExit(cb, opts) {
|
|
54377
|
-
if (!processOk(this.#process)) {
|
|
54378
|
-
return () => {
|
|
54379
|
-
};
|
|
54380
|
-
}
|
|
54381
|
-
if (this.#loaded === false) {
|
|
54382
|
-
this.load();
|
|
54383
|
-
}
|
|
54384
|
-
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
54385
|
-
this.#emitter.on(ev, cb);
|
|
54386
|
-
return () => {
|
|
54387
|
-
this.#emitter.removeListener(ev, cb);
|
|
54388
|
-
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
54389
|
-
this.unload();
|
|
54390
|
-
}
|
|
54391
|
-
};
|
|
54392
|
-
}
|
|
54393
|
-
load() {
|
|
54394
|
-
if (this.#loaded) {
|
|
54395
|
-
return;
|
|
54396
|
-
}
|
|
54397
|
-
this.#loaded = true;
|
|
54398
|
-
this.#emitter.count += 1;
|
|
54399
|
-
for (const sig of signals) {
|
|
54400
|
-
try {
|
|
54401
|
-
const fn = this.#sigListeners[sig];
|
|
54402
|
-
if (fn)
|
|
54403
|
-
this.#process.on(sig, fn);
|
|
54404
|
-
} catch (_) {
|
|
54405
|
-
}
|
|
54406
|
-
}
|
|
54407
|
-
this.#process.emit = (ev, ...a) => {
|
|
54408
|
-
return this.#processEmit(ev, ...a);
|
|
54409
|
-
};
|
|
54410
|
-
this.#process.reallyExit = (code) => {
|
|
54411
|
-
return this.#processReallyExit(code);
|
|
54412
|
-
};
|
|
54413
|
-
}
|
|
54414
|
-
unload() {
|
|
54415
|
-
if (!this.#loaded) {
|
|
54416
|
-
return;
|
|
54417
|
-
}
|
|
54418
|
-
this.#loaded = false;
|
|
54419
|
-
signals.forEach((sig) => {
|
|
54420
|
-
const listener = this.#sigListeners[sig];
|
|
54421
|
-
if (!listener) {
|
|
54422
|
-
throw new Error("Listener not defined for signal: " + sig);
|
|
54423
|
-
}
|
|
54424
|
-
try {
|
|
54425
|
-
this.#process.removeListener(sig, listener);
|
|
54426
|
-
} catch (_) {
|
|
54427
|
-
}
|
|
54428
|
-
});
|
|
54429
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
54430
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
54431
|
-
this.#emitter.count -= 1;
|
|
54432
|
-
}
|
|
54433
|
-
#processReallyExit(code) {
|
|
54434
|
-
if (!processOk(this.#process)) {
|
|
54435
|
-
return 0;
|
|
54436
|
-
}
|
|
54437
|
-
this.#process.exitCode = code || 0;
|
|
54438
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
54439
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
54440
|
-
}
|
|
54441
|
-
#processEmit(ev, ...args) {
|
|
54442
|
-
const og = this.#originalProcessEmit;
|
|
54443
|
-
if (ev === "exit" && processOk(this.#process)) {
|
|
54444
|
-
if (typeof args[0] === "number") {
|
|
54445
|
-
this.#process.exitCode = args[0];
|
|
54446
|
-
}
|
|
54447
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
54448
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
54449
|
-
return ret;
|
|
54450
|
-
} else {
|
|
54451
|
-
return og.call(this.#process, ev, ...args);
|
|
54452
|
-
}
|
|
54453
|
-
}
|
|
54454
|
-
};
|
|
54455
|
-
process3 = globalThis.process;
|
|
54456
|
-
({
|
|
54457
|
-
onExit: (
|
|
54458
|
-
/**
|
|
54459
|
-
* Called when the process is exiting, whether via signal, explicit
|
|
54460
|
-
* exit, or running out of stuff to do.
|
|
54461
|
-
*
|
|
54462
|
-
* If the global process object is not suitable for instrumentation,
|
|
54463
|
-
* then this will be a no-op.
|
|
54464
|
-
*
|
|
54465
|
-
* Returns a function that may be used to unload signal-exit.
|
|
54466
|
-
*/
|
|
54467
|
-
onExit
|
|
54468
|
-
),
|
|
54469
|
-
load: (
|
|
54470
|
-
/**
|
|
54471
|
-
* Load the listeners. Likely you never need to call this, unless
|
|
54472
|
-
* doing a rather deep integration with signal-exit functionality.
|
|
54473
|
-
* Mostly exposed for the benefit of testing.
|
|
54474
|
-
*
|
|
54475
|
-
* @internal
|
|
54476
|
-
*/
|
|
54477
|
-
load
|
|
54478
|
-
),
|
|
54479
|
-
unload: (
|
|
54480
|
-
/**
|
|
54481
|
-
* Unload the listeners. Likely you never need to call this, unless
|
|
54482
|
-
* doing a rather deep integration with signal-exit functionality.
|
|
54483
|
-
* Mostly exposed for the benefit of testing.
|
|
54484
|
-
*
|
|
54485
|
-
* @internal
|
|
54486
|
-
*/
|
|
54487
|
-
unload
|
|
54488
|
-
)
|
|
54489
|
-
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback()));
|
|
54490
|
-
}
|
|
54491
|
-
});
|
|
54492
|
-
|
|
54493
|
-
// node_modules/@inquirer/ansi/dist/index.js
|
|
54494
|
-
var ESC2, cursorLeft, cursorHide, cursorShow, cursorUp, cursorDown, cursorTo, eraseLine, eraseLines;
|
|
54495
|
-
var init_dist4 = __esm({
|
|
54496
|
-
"node_modules/@inquirer/ansi/dist/index.js"() {
|
|
54497
|
-
"use strict";
|
|
54498
|
-
ESC2 = "\x1B[";
|
|
54499
|
-
cursorLeft = ESC2 + "G";
|
|
54500
|
-
cursorHide = ESC2 + "?25l";
|
|
54501
|
-
cursorShow = ESC2 + "?25h";
|
|
54502
|
-
cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
|
|
54503
|
-
cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
|
|
54504
|
-
cursorTo = (x, y) => {
|
|
54505
|
-
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
54506
|
-
return `${ESC2}${y + 1};${x + 1}H`;
|
|
54507
|
-
}
|
|
54508
|
-
return `${ESC2}${x + 1}G`;
|
|
54509
|
-
};
|
|
54510
|
-
eraseLine = ESC2 + "2K";
|
|
54511
|
-
eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
54512
|
-
}
|
|
54513
|
-
});
|
|
54514
|
-
|
|
54515
|
-
// node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
54516
|
-
import { stripVTControlCharacters } from "node:util";
|
|
54517
|
-
var height, lastLine, ScreenManager;
|
|
54518
|
-
var init_screen_manager = __esm({
|
|
54519
|
-
"node_modules/@inquirer/core/dist/lib/screen-manager.js"() {
|
|
54520
|
-
"use strict";
|
|
54521
|
-
init_utils6();
|
|
54522
|
-
init_dist4();
|
|
54523
|
-
height = (content) => content.split("\n").length;
|
|
54524
|
-
lastLine = (content) => content.split("\n").pop() ?? "";
|
|
54525
|
-
ScreenManager = class {
|
|
54526
|
-
// These variables are keeping information to allow correct prompt re-rendering
|
|
54527
|
-
height = 0;
|
|
54528
|
-
extraLinesUnderPrompt = 0;
|
|
54529
|
-
cursorPos;
|
|
54530
|
-
rl;
|
|
54531
|
-
constructor(rl) {
|
|
54532
|
-
this.rl = rl;
|
|
54533
|
-
this.cursorPos = rl.getCursorPos();
|
|
54534
|
-
}
|
|
54535
|
-
write(content) {
|
|
54536
|
-
this.rl.output.unmute();
|
|
54537
|
-
this.rl.output.write(content);
|
|
54538
|
-
this.rl.output.mute();
|
|
54539
|
-
}
|
|
54540
|
-
render(content, bottomContent = "") {
|
|
54541
|
-
const promptLine = lastLine(content);
|
|
54542
|
-
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
54543
|
-
let prompt = rawPromptLine;
|
|
54544
|
-
if (this.rl.line.length > 0) {
|
|
54545
|
-
prompt = prompt.slice(0, -this.rl.line.length);
|
|
54546
|
-
}
|
|
54547
|
-
this.rl.setPrompt(prompt);
|
|
54548
|
-
this.cursorPos = this.rl.getCursorPos();
|
|
54549
|
-
const width = readlineWidth();
|
|
54550
|
-
content = breakLines(content, width);
|
|
54551
|
-
bottomContent = breakLines(bottomContent, width);
|
|
54552
|
-
if (rawPromptLine.length % width === 0) {
|
|
54553
|
-
content += "\n";
|
|
54554
|
-
}
|
|
54555
|
-
let output = content + (bottomContent ? "\n" + bottomContent : "");
|
|
54556
|
-
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
54557
|
-
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
54558
|
-
if (bottomContentHeight > 0)
|
|
54559
|
-
output += cursorUp(bottomContentHeight);
|
|
54560
|
-
output += cursorTo(this.cursorPos.cols);
|
|
54561
|
-
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
54562
|
-
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
54563
|
-
this.height = height(output);
|
|
54564
|
-
}
|
|
54565
|
-
checkCursorPos() {
|
|
54566
|
-
const cursorPos = this.rl.getCursorPos();
|
|
54567
|
-
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
54568
|
-
this.write(cursorTo(cursorPos.cols));
|
|
54569
|
-
this.cursorPos = cursorPos;
|
|
54570
|
-
}
|
|
54571
|
-
}
|
|
54572
|
-
done({ clearContent }) {
|
|
54573
|
-
this.rl.setPrompt("");
|
|
54574
|
-
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
54575
|
-
output += clearContent ? eraseLines(this.height) : "\n";
|
|
54576
|
-
output += cursorShow;
|
|
54577
|
-
this.write(output);
|
|
54578
|
-
this.rl.close();
|
|
54579
|
-
}
|
|
54580
|
-
};
|
|
54581
|
-
}
|
|
54582
|
-
});
|
|
54583
|
-
|
|
54584
|
-
// node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
54585
|
-
var PromisePolyfill;
|
|
54586
|
-
var init_promise_polyfill = __esm({
|
|
54587
|
-
"node_modules/@inquirer/core/dist/lib/promise-polyfill.js"() {
|
|
54588
|
-
"use strict";
|
|
54589
|
-
PromisePolyfill = class extends Promise {
|
|
54590
|
-
// Available starting from Node 22
|
|
54591
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
54592
|
-
static withResolver() {
|
|
54593
|
-
let resolve14;
|
|
54594
|
-
let reject;
|
|
54595
|
-
const promise = new Promise((res, rej) => {
|
|
54596
|
-
resolve14 = res;
|
|
54597
|
-
reject = rej;
|
|
54598
|
-
});
|
|
54599
|
-
return { promise, resolve: resolve14, reject };
|
|
54600
|
-
}
|
|
54601
|
-
};
|
|
54602
|
-
}
|
|
54603
|
-
});
|
|
54604
|
-
|
|
54605
|
-
// node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
54606
|
-
import * as readline2 from "node:readline";
|
|
54607
|
-
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
54608
|
-
function getCallSites() {
|
|
54609
|
-
const _prepareStackTrace = Error.prepareStackTrace;
|
|
54610
|
-
let result = [];
|
|
54611
|
-
try {
|
|
54612
|
-
Error.prepareStackTrace = (_, callSites) => {
|
|
54613
|
-
const callSitesWithoutCurrent = callSites.slice(1);
|
|
54614
|
-
result = callSitesWithoutCurrent;
|
|
54615
|
-
return callSitesWithoutCurrent;
|
|
54616
|
-
};
|
|
54617
|
-
new Error().stack;
|
|
54618
|
-
} catch {
|
|
54619
|
-
return result;
|
|
54620
|
-
}
|
|
54621
|
-
Error.prepareStackTrace = _prepareStackTrace;
|
|
54622
|
-
return result;
|
|
54623
|
-
}
|
|
54624
|
-
function createPrompt(view) {
|
|
54625
|
-
const callSites = getCallSites();
|
|
54626
|
-
const prompt = (config2, context2 = {}) => {
|
|
54627
|
-
const { input = process.stdin, signal } = context2;
|
|
54628
|
-
const cleanups = /* @__PURE__ */ new Set();
|
|
54629
|
-
const output = new import_mute_stream.default();
|
|
54630
|
-
output.pipe(context2.output ?? process.stdout);
|
|
54631
|
-
output.mute();
|
|
54632
|
-
const rl = readline2.createInterface({
|
|
54633
|
-
terminal: true,
|
|
54634
|
-
input,
|
|
54635
|
-
output
|
|
54636
|
-
});
|
|
54637
|
-
const screen = new ScreenManager(rl);
|
|
54638
|
-
const { promise, resolve: resolve14, reject } = PromisePolyfill.withResolver();
|
|
54639
|
-
const cancel = () => reject(new CancelPromptError());
|
|
54640
|
-
if (signal) {
|
|
54641
|
-
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
54642
|
-
if (signal.aborted) {
|
|
54643
|
-
abort();
|
|
54644
|
-
return Object.assign(promise, { cancel });
|
|
54645
|
-
}
|
|
54646
|
-
signal.addEventListener("abort", abort);
|
|
54647
|
-
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
54648
|
-
}
|
|
54649
|
-
cleanups.add(onExit((code, signal2) => {
|
|
54650
|
-
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
54651
|
-
}));
|
|
54652
|
-
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
54653
|
-
rl.on("SIGINT", sigint);
|
|
54654
|
-
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
54655
|
-
return withHooks(rl, (cycle) => {
|
|
54656
|
-
const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
54657
|
-
rl.on("close", hooksCleanup);
|
|
54658
|
-
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
54659
|
-
const startCycle = () => {
|
|
54660
|
-
const checkCursorPos = () => screen.checkCursorPos();
|
|
54661
|
-
rl.input.on("keypress", checkCursorPos);
|
|
54662
|
-
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
54663
|
-
cycle(() => {
|
|
54664
|
-
try {
|
|
54665
|
-
const nextView = view(config2, (value) => {
|
|
54666
|
-
setImmediate(() => resolve14(value));
|
|
54667
|
-
});
|
|
54668
|
-
if (nextView === void 0) {
|
|
54669
|
-
const callerFilename = callSites[1]?.getFileName();
|
|
54670
|
-
throw new Error(`Prompt functions must return a string.
|
|
54671
|
-
at ${callerFilename}`);
|
|
54672
|
-
}
|
|
54673
|
-
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
54674
|
-
screen.render(content, bottomContent);
|
|
54675
|
-
effectScheduler.run();
|
|
54676
|
-
} catch (error) {
|
|
54677
|
-
reject(error);
|
|
54678
|
-
}
|
|
54679
|
-
});
|
|
54680
|
-
};
|
|
54681
|
-
if ("readableFlowing" in input) {
|
|
54682
|
-
nativeSetImmediate(startCycle);
|
|
54683
|
-
} else {
|
|
54684
|
-
startCycle();
|
|
54685
|
-
}
|
|
54686
|
-
return Object.assign(promise.then((answer) => {
|
|
54687
|
-
effectScheduler.clearAll();
|
|
54688
|
-
return answer;
|
|
54689
|
-
}, (error) => {
|
|
54690
|
-
effectScheduler.clearAll();
|
|
54691
|
-
throw error;
|
|
54692
|
-
}).finally(() => {
|
|
54693
|
-
cleanups.forEach((cleanup) => cleanup());
|
|
54694
|
-
screen.done({ clearContent: Boolean(context2.clearPromptOnDone) });
|
|
54695
|
-
output.end();
|
|
54696
|
-
}).then(() => promise), { cancel });
|
|
54697
|
-
});
|
|
54698
|
-
};
|
|
54699
|
-
return prompt;
|
|
54700
|
-
}
|
|
54701
|
-
var import_mute_stream, nativeSetImmediate;
|
|
54702
|
-
var init_create_prompt = __esm({
|
|
54703
|
-
"node_modules/@inquirer/core/dist/lib/create-prompt.js"() {
|
|
54704
|
-
"use strict";
|
|
54705
|
-
import_mute_stream = __toESM(require_lib(), 1);
|
|
54706
|
-
init_mjs();
|
|
54707
|
-
init_screen_manager();
|
|
54708
|
-
init_promise_polyfill();
|
|
54709
|
-
init_hook_engine();
|
|
54710
|
-
init_errors3();
|
|
54711
|
-
nativeSetImmediate = globalThis.setImmediate;
|
|
54712
|
-
}
|
|
54713
|
-
});
|
|
54714
|
-
|
|
54715
|
-
// node_modules/@inquirer/core/dist/index.js
|
|
54716
|
-
var init_dist5 = __esm({
|
|
54717
|
-
"node_modules/@inquirer/core/dist/index.js"() {
|
|
54718
|
-
"use strict";
|
|
54719
|
-
init_key();
|
|
54720
|
-
init_errors3();
|
|
54721
|
-
init_use_prefix();
|
|
54722
|
-
init_use_state();
|
|
54723
|
-
init_use_effect();
|
|
54724
|
-
init_use_memo();
|
|
54725
|
-
init_use_ref();
|
|
54726
|
-
init_use_keypress();
|
|
54727
|
-
init_make_theme();
|
|
54728
|
-
init_create_prompt();
|
|
54729
|
-
}
|
|
54730
|
-
});
|
|
54731
|
-
|
|
54732
52922
|
// src/utils/cli-theme.ts
|
|
54733
52923
|
import chalk7 from "chalk";
|
|
54734
52924
|
var amber, amberBold, inquirerTheme;
|
|
@@ -55242,6 +53432,18 @@ var init_codex_models = __esm({
|
|
|
55242
53432
|
});
|
|
55243
53433
|
|
|
55244
53434
|
// src/llm/utils/variant-list-prompt.ts
|
|
53435
|
+
import {
|
|
53436
|
+
createPrompt,
|
|
53437
|
+
useState,
|
|
53438
|
+
useKeypress,
|
|
53439
|
+
usePrefix,
|
|
53440
|
+
isUpKey,
|
|
53441
|
+
isDownKey,
|
|
53442
|
+
isEnterKey,
|
|
53443
|
+
isBackspaceKey,
|
|
53444
|
+
makeTheme
|
|
53445
|
+
} from "@inquirer/core";
|
|
53446
|
+
import { cursorHide } from "@inquirer/ansi";
|
|
55245
53447
|
import chalk11 from "chalk";
|
|
55246
53448
|
import inquirer2 from "inquirer";
|
|
55247
53449
|
async function editVariantDetail(variantName, state, standardConfigs) {
|
|
@@ -55412,8 +53614,6 @@ var variantListRawPrompt;
|
|
|
55412
53614
|
var init_variant_list_prompt = __esm({
|
|
55413
53615
|
"src/llm/utils/variant-list-prompt.ts"() {
|
|
55414
53616
|
"use strict";
|
|
55415
|
-
init_dist5();
|
|
55416
|
-
init_dist4();
|
|
55417
53617
|
init_cli_theme();
|
|
55418
53618
|
init_display();
|
|
55419
53619
|
variantListRawPrompt = createPrompt(
|
|
@@ -55788,8 +53988,8 @@ var init_ConfigurationTester = __esm({
|
|
|
55788
53988
|
const service = llmServiceFactory.createService(llmConfig);
|
|
55789
53989
|
service.on("content", (_event) => {
|
|
55790
53990
|
});
|
|
55791
|
-
const completePromise = new Promise((
|
|
55792
|
-
service.once("complete",
|
|
53991
|
+
const completePromise = new Promise((resolve15) => {
|
|
53992
|
+
service.once("complete", resolve15);
|
|
55793
53993
|
});
|
|
55794
53994
|
const errorPromise = new Promise((_resolve, reject) => {
|
|
55795
53995
|
service.once("stream-error", (event) => {
|
|
@@ -55816,7 +54016,7 @@ var init_ConfigurationTester = __esm({
|
|
|
55816
54016
|
}
|
|
55817
54017
|
return { success: false, error: hint2 };
|
|
55818
54018
|
} finally {
|
|
55819
|
-
await new Promise((
|
|
54019
|
+
await new Promise((resolve15) => setTimeout(resolve15, 200));
|
|
55820
54020
|
restoreConsole();
|
|
55821
54021
|
}
|
|
55822
54022
|
}
|
|
@@ -55825,14 +54025,25 @@ var init_ConfigurationTester = __esm({
|
|
|
55825
54025
|
});
|
|
55826
54026
|
|
|
55827
54027
|
// src/llm/LLMConfigEditor.ts
|
|
54028
|
+
import {
|
|
54029
|
+
createPrompt as createPrompt2,
|
|
54030
|
+
useState as useState2,
|
|
54031
|
+
useEffect,
|
|
54032
|
+
useRef,
|
|
54033
|
+
useKeypress as useKeypress2,
|
|
54034
|
+
usePrefix as usePrefix2,
|
|
54035
|
+
isEnterKey as isEnterKey2,
|
|
54036
|
+
isUpKey as isUpKey2,
|
|
54037
|
+
isDownKey as isDownKey2,
|
|
54038
|
+
makeTheme as makeTheme2
|
|
54039
|
+
} from "@inquirer/core";
|
|
54040
|
+
import { cursorHide as cursorHide2 } from "@inquirer/ansi";
|
|
55828
54041
|
import chalk13 from "chalk";
|
|
55829
54042
|
var SPINNER_FRAMES, menuTheme, selectWithFooter, LLMConfigEditor;
|
|
55830
54043
|
var init_LLMConfigEditor = __esm({
|
|
55831
54044
|
"src/llm/LLMConfigEditor.ts"() {
|
|
55832
54045
|
"use strict";
|
|
55833
54046
|
init_ConfigService();
|
|
55834
|
-
init_dist5();
|
|
55835
|
-
init_dist4();
|
|
55836
54047
|
init_cli_theme();
|
|
55837
54048
|
init_display();
|
|
55838
54049
|
init_LLMServiceFactory();
|
|
@@ -55846,16 +54057,16 @@ var init_LLMConfigEditor = __esm({
|
|
|
55846
54057
|
highlight: inquirerTheme.style.highlight
|
|
55847
54058
|
}
|
|
55848
54059
|
};
|
|
55849
|
-
selectWithFooter =
|
|
54060
|
+
selectWithFooter = createPrompt2((config2, done) => {
|
|
55850
54061
|
const { items, actions } = config2;
|
|
55851
|
-
const theme =
|
|
54062
|
+
const theme = makeTheme2(menuTheme);
|
|
55852
54063
|
const doneIndex = items.length + actions.length;
|
|
55853
54064
|
const totalNavigable = doneIndex + 1;
|
|
55854
|
-
const [active, setActive] =
|
|
54065
|
+
const [active, setActive] = useState2(0);
|
|
55855
54066
|
const resultsRef = useRef({});
|
|
55856
|
-
const [testing, setTesting] =
|
|
55857
|
-
const [spinnerFrame, setSpinnerFrame] =
|
|
55858
|
-
const prefix =
|
|
54067
|
+
const [testing, setTesting] = useState2(null);
|
|
54068
|
+
const [spinnerFrame, setSpinnerFrame] = useState2(0);
|
|
54069
|
+
const prefix = usePrefix2({ status: "idle", theme });
|
|
55859
54070
|
const timerRef = useRef(null);
|
|
55860
54071
|
useEffect(() => {
|
|
55861
54072
|
if (testing && !timerRef.current) {
|
|
@@ -55874,9 +54085,9 @@ var init_LLMConfigEditor = __esm({
|
|
|
55874
54085
|
}
|
|
55875
54086
|
};
|
|
55876
54087
|
}, [testing != null, spinnerFrame]);
|
|
55877
|
-
|
|
54088
|
+
useKeypress2((key, rl) => {
|
|
55878
54089
|
if (testing) return;
|
|
55879
|
-
if (
|
|
54090
|
+
if (isEnterKey2(key)) {
|
|
55880
54091
|
if (active < items.length) {
|
|
55881
54092
|
done(items[active].value);
|
|
55882
54093
|
} else if (active < doneIndex) {
|
|
@@ -55884,9 +54095,9 @@ var init_LLMConfigEditor = __esm({
|
|
|
55884
54095
|
} else {
|
|
55885
54096
|
done("done");
|
|
55886
54097
|
}
|
|
55887
|
-
} else if (
|
|
54098
|
+
} else if (isUpKey2(key) || isDownKey2(key)) {
|
|
55888
54099
|
rl.clearLine(0);
|
|
55889
|
-
const offset =
|
|
54100
|
+
const offset = isUpKey2(key) ? -1 : 1;
|
|
55890
54101
|
setActive((active + offset + totalNavigable) % totalNavigable);
|
|
55891
54102
|
} else if (key.name === "t" && active < items.length) {
|
|
55892
54103
|
const item = items[active];
|
|
@@ -55956,7 +54167,7 @@ var init_LLMConfigEditor = __esm({
|
|
|
55956
54167
|
`${chalk13.bold("d")} ${chalk13.dim("delete")}`
|
|
55957
54168
|
];
|
|
55958
54169
|
lines.push(chalk13.dim(` ${helpParts.join(chalk13.dim(" \u2022 "))}`));
|
|
55959
|
-
return `${lines.join("\n")}${
|
|
54170
|
+
return `${lines.join("\n")}${cursorHide2}`;
|
|
55960
54171
|
});
|
|
55961
54172
|
LLMConfigEditor = class {
|
|
55962
54173
|
advanced;
|
|
@@ -56034,29 +54245,29 @@ var init_LLMConfigEditor = __esm({
|
|
|
56034
54245
|
});
|
|
56035
54246
|
|
|
56036
54247
|
// node_modules/@inquirer/password/dist/index.js
|
|
56037
|
-
|
|
56038
|
-
|
|
54248
|
+
import { createPrompt as createPrompt3, useState as useState3, useKeypress as useKeypress3, usePrefix as usePrefix3, isEnterKey as isEnterKey3, makeTheme as makeTheme3 } from "@inquirer/core";
|
|
54249
|
+
import { cursorHide as cursorHide3 } from "@inquirer/ansi";
|
|
54250
|
+
var passwordTheme, dist_default;
|
|
54251
|
+
var init_dist = __esm({
|
|
56039
54252
|
"node_modules/@inquirer/password/dist/index.js"() {
|
|
56040
54253
|
"use strict";
|
|
56041
|
-
init_dist5();
|
|
56042
|
-
init_dist4();
|
|
56043
54254
|
passwordTheme = {
|
|
56044
54255
|
style: {
|
|
56045
54256
|
maskedText: "[input is masked]"
|
|
56046
54257
|
}
|
|
56047
54258
|
};
|
|
56048
|
-
|
|
54259
|
+
dist_default = createPrompt3((config2, done) => {
|
|
56049
54260
|
const { validate: validate3 = () => true } = config2;
|
|
56050
|
-
const theme =
|
|
56051
|
-
const [status, setStatus] =
|
|
56052
|
-
const [errorMsg, setError] =
|
|
56053
|
-
const [value, setValue] =
|
|
56054
|
-
const prefix =
|
|
56055
|
-
|
|
54261
|
+
const theme = makeTheme3(passwordTheme, config2.theme);
|
|
54262
|
+
const [status, setStatus] = useState3("idle");
|
|
54263
|
+
const [errorMsg, setError] = useState3();
|
|
54264
|
+
const [value, setValue] = useState3("");
|
|
54265
|
+
const prefix = usePrefix3({ status, theme });
|
|
54266
|
+
useKeypress3(async (key, rl) => {
|
|
56056
54267
|
if (status !== "idle") {
|
|
56057
54268
|
return;
|
|
56058
54269
|
}
|
|
56059
|
-
if (
|
|
54270
|
+
if (isEnterKey3(key)) {
|
|
56060
54271
|
const answer = value;
|
|
56061
54272
|
setStatus("loading");
|
|
56062
54273
|
const isValid = await validate3(answer);
|
|
@@ -56081,7 +54292,7 @@ var init_dist6 = __esm({
|
|
|
56081
54292
|
const maskChar = typeof config2.mask === "string" ? config2.mask : "*";
|
|
56082
54293
|
formattedValue = maskChar.repeat(value.length);
|
|
56083
54294
|
} else if (status !== "done") {
|
|
56084
|
-
helpTip = `${theme.style.help(theme.style.maskedText)}${
|
|
54295
|
+
helpTip = `${theme.style.help(theme.style.maskedText)}${cursorHide3}`;
|
|
56085
54296
|
}
|
|
56086
54297
|
if (status === "done") {
|
|
56087
54298
|
formattedValue = theme.style.answer(formattedValue);
|
|
@@ -56096,22 +54307,22 @@ var init_dist6 = __esm({
|
|
|
56096
54307
|
});
|
|
56097
54308
|
|
|
56098
54309
|
// node_modules/@inquirer/input/dist/index.js
|
|
56099
|
-
|
|
56100
|
-
var
|
|
54310
|
+
import { createPrompt as createPrompt4, useState as useState4, useKeypress as useKeypress4, useEffect as useEffect2, usePrefix as usePrefix4, isBackspaceKey as isBackspaceKey2, isEnterKey as isEnterKey4, isTabKey, makeTheme as makeTheme4 } from "@inquirer/core";
|
|
54311
|
+
var inputTheme, dist_default2;
|
|
54312
|
+
var init_dist2 = __esm({
|
|
56101
54313
|
"node_modules/@inquirer/input/dist/index.js"() {
|
|
56102
54314
|
"use strict";
|
|
56103
|
-
init_dist5();
|
|
56104
54315
|
inputTheme = {
|
|
56105
54316
|
validationFailureMode: "keep"
|
|
56106
54317
|
};
|
|
56107
|
-
|
|
54318
|
+
dist_default2 = createPrompt4((config2, done) => {
|
|
56108
54319
|
const { prefill = "tab" } = config2;
|
|
56109
|
-
const theme =
|
|
56110
|
-
const [status, setStatus] =
|
|
56111
|
-
const [defaultValue, setDefaultValue] =
|
|
56112
|
-
const [errorMsg, setError] =
|
|
56113
|
-
const [value, setValue] =
|
|
56114
|
-
const prefix =
|
|
54320
|
+
const theme = makeTheme4(inputTheme, config2.theme);
|
|
54321
|
+
const [status, setStatus] = useState4("idle");
|
|
54322
|
+
const [defaultValue, setDefaultValue] = useState4(String(config2.default ?? ""));
|
|
54323
|
+
const [errorMsg, setError] = useState4();
|
|
54324
|
+
const [value, setValue] = useState4("");
|
|
54325
|
+
const prefix = usePrefix4({ status, theme });
|
|
56115
54326
|
async function validate3(value2) {
|
|
56116
54327
|
const { required, pattern, patternError = "Invalid input" } = config2;
|
|
56117
54328
|
if (required && !value2) {
|
|
@@ -56125,11 +54336,11 @@ var init_dist7 = __esm({
|
|
|
56125
54336
|
}
|
|
56126
54337
|
return true;
|
|
56127
54338
|
}
|
|
56128
|
-
|
|
54339
|
+
useKeypress4(async (key, rl) => {
|
|
56129
54340
|
if (status !== "idle") {
|
|
56130
54341
|
return;
|
|
56131
54342
|
}
|
|
56132
|
-
if (
|
|
54343
|
+
if (isEnterKey4(key)) {
|
|
56133
54344
|
const answer = value || defaultValue;
|
|
56134
54345
|
setStatus("loading");
|
|
56135
54346
|
const isValid = await validate3(answer);
|
|
@@ -56146,7 +54357,7 @@ var init_dist7 = __esm({
|
|
|
56146
54357
|
setError(isValid);
|
|
56147
54358
|
setStatus("idle");
|
|
56148
54359
|
}
|
|
56149
|
-
} else if (
|
|
54360
|
+
} else if (isBackspaceKey2(key) && !value) {
|
|
56150
54361
|
setDefaultValue("");
|
|
56151
54362
|
} else if (isTabKey(key) && !value) {
|
|
56152
54363
|
setDefaultValue("");
|
|
@@ -56158,7 +54369,7 @@ var init_dist7 = __esm({
|
|
|
56158
54369
|
setError(void 0);
|
|
56159
54370
|
}
|
|
56160
54371
|
});
|
|
56161
|
-
|
|
54372
|
+
useEffect2((rl) => {
|
|
56162
54373
|
if (prefill === "editable" && defaultValue) {
|
|
56163
54374
|
rl.write(defaultValue);
|
|
56164
54375
|
setValue(defaultValue);
|
|
@@ -56188,6 +54399,19 @@ var init_dist7 = __esm({
|
|
|
56188
54399
|
});
|
|
56189
54400
|
|
|
56190
54401
|
// src/llm/utils/provider-select-prompt.ts
|
|
54402
|
+
import {
|
|
54403
|
+
createPrompt as createPrompt5,
|
|
54404
|
+
useState as useState5,
|
|
54405
|
+
useKeypress as useKeypress5,
|
|
54406
|
+
usePrefix as usePrefix5,
|
|
54407
|
+
useMemo,
|
|
54408
|
+
isUpKey as isUpKey3,
|
|
54409
|
+
isDownKey as isDownKey3,
|
|
54410
|
+
isSpaceKey,
|
|
54411
|
+
isEnterKey as isEnterKey5,
|
|
54412
|
+
makeTheme as makeTheme5
|
|
54413
|
+
} from "@inquirer/core";
|
|
54414
|
+
import { cursorHide as cursorHide4 } from "@inquirer/ansi";
|
|
56191
54415
|
import chalk14 from "chalk";
|
|
56192
54416
|
function getKeys(apiKey) {
|
|
56193
54417
|
if (!apiKey) return [];
|
|
@@ -56214,28 +54438,26 @@ var CURSOR, RULE_WIDTH, provider_select_prompt_default;
|
|
|
56214
54438
|
var init_provider_select_prompt = __esm({
|
|
56215
54439
|
"src/llm/utils/provider-select-prompt.ts"() {
|
|
56216
54440
|
"use strict";
|
|
56217
|
-
init_dist5();
|
|
56218
|
-
init_dist4();
|
|
56219
54441
|
init_provider_ids();
|
|
56220
54442
|
init_ProviderConfigUI();
|
|
56221
54443
|
init_display();
|
|
56222
54444
|
CURSOR = chalk14.hex("#FFC107")("\u203A");
|
|
56223
54445
|
RULE_WIDTH = 30;
|
|
56224
|
-
provider_select_prompt_default =
|
|
54446
|
+
provider_select_prompt_default = createPrompt5((config2, done) => {
|
|
56225
54447
|
const { providerIds, message, resumeState } = config2;
|
|
56226
|
-
const theme =
|
|
56227
|
-
const prefix =
|
|
54448
|
+
const theme = makeTheme5(config2.theme);
|
|
54449
|
+
const prefix = usePrefix5({ status: "idle", theme });
|
|
56228
54450
|
const doneIndex = providerIds.length;
|
|
56229
|
-
const [active, setActive] =
|
|
56230
|
-
const [providers, setProviders] =
|
|
54451
|
+
const [active, setActive] = useState5(resumeState?.active ?? 0);
|
|
54452
|
+
const [providers, setProviders] = useState5(
|
|
56231
54453
|
() => resumeState?.providers ?? { ...config2.initialProviders }
|
|
56232
54454
|
);
|
|
56233
|
-
const [stash, setStash] =
|
|
54455
|
+
const [stash, setStash] = useState5(
|
|
56234
54456
|
() => resumeState?.stash ?? {}
|
|
56235
54457
|
);
|
|
56236
|
-
const [mode, setMode] =
|
|
56237
|
-
const [keysTarget, setKeysTarget] =
|
|
56238
|
-
const [keysActive, setKeysActive] =
|
|
54458
|
+
const [mode, setMode] = useState5(resumeState?.mode ?? "browse");
|
|
54459
|
+
const [keysTarget, setKeysTarget] = useState5(resumeState?.keysTarget ?? null);
|
|
54460
|
+
const [keysActive, setKeysActive] = useState5(resumeState?.keysActive ?? 0);
|
|
56239
54461
|
const activeProviderId = useMemo(
|
|
56240
54462
|
() => active < providerIds.length ? providerIds[active] : null,
|
|
56241
54463
|
[active]
|
|
@@ -56246,7 +54468,7 @@ var init_provider_select_prompt = __esm({
|
|
|
56246
54468
|
function requestAddKey(providerId, returnTo) {
|
|
56247
54469
|
done({ action: "add-key", providerId, returnTo, state: currentState() });
|
|
56248
54470
|
}
|
|
56249
|
-
|
|
54471
|
+
useKeypress5((key, rl) => {
|
|
56250
54472
|
rl.clearLine(0);
|
|
56251
54473
|
if (mode === "browse") {
|
|
56252
54474
|
handleBrowse(key);
|
|
@@ -56255,13 +54477,13 @@ var init_provider_select_prompt = __esm({
|
|
|
56255
54477
|
}
|
|
56256
54478
|
});
|
|
56257
54479
|
function handleBrowse(key) {
|
|
56258
|
-
if (
|
|
54480
|
+
if (isUpKey3(key)) {
|
|
56259
54481
|
setActive(Math.max(0, active - 1));
|
|
56260
|
-
} else if (
|
|
54482
|
+
} else if (isDownKey3(key)) {
|
|
56261
54483
|
setActive(Math.min(doneIndex, active + 1));
|
|
56262
54484
|
} else if (isSpaceKey(key) && activeProviderId) {
|
|
56263
54485
|
toggleProvider(activeProviderId);
|
|
56264
|
-
} else if (
|
|
54486
|
+
} else if (isEnterKey5(key)) {
|
|
56265
54487
|
if (active === doneIndex) {
|
|
56266
54488
|
done({ action: "done", providers });
|
|
56267
54489
|
} else if (activeProviderId && activeProviderId in providers && needsApiKey(activeProviderId)) {
|
|
@@ -56305,13 +54527,13 @@ var init_provider_select_prompt = __esm({
|
|
|
56305
54527
|
const keys = getKeys(providers[keysTarget]?.apiKey);
|
|
56306
54528
|
const addIndex = keys.length;
|
|
56307
54529
|
const backIndex = keys.length + 1;
|
|
56308
|
-
if (
|
|
54530
|
+
if (isUpKey3(key)) {
|
|
56309
54531
|
setKeysActive(Math.max(0, keysActive - 1));
|
|
56310
|
-
} else if (
|
|
54532
|
+
} else if (isDownKey3(key)) {
|
|
56311
54533
|
setKeysActive(Math.min(backIndex, keysActive + 1));
|
|
56312
54534
|
} else if (key.name === "d" && keysActive < keys.length) {
|
|
56313
54535
|
deleteKey(keysTarget, keysActive, keys);
|
|
56314
|
-
} else if (
|
|
54536
|
+
} else if (isEnterKey5(key)) {
|
|
56315
54537
|
if (keysActive === addIndex) {
|
|
56316
54538
|
requestAddKey(keysTarget, "keys");
|
|
56317
54539
|
} else if (keysActive === backIndex) {
|
|
@@ -56343,7 +54565,7 @@ var init_provider_select_prompt = __esm({
|
|
|
56343
54565
|
} else {
|
|
56344
54566
|
renderBrowseView(lines);
|
|
56345
54567
|
}
|
|
56346
|
-
return `${lines.join("\n")}${
|
|
54568
|
+
return `${lines.join("\n")}${cursorHide4}`;
|
|
56347
54569
|
function renderBrowseView(out) {
|
|
56348
54570
|
for (let i = 0; i < providerIds.length; i++) {
|
|
56349
54571
|
const pid = providerIds[i];
|
|
@@ -56440,7 +54662,7 @@ async function runProviderSetup(existingProviders, options = {}) {
|
|
|
56440
54662
|
}
|
|
56441
54663
|
async function askForKey(providerId, displayName, hint2) {
|
|
56442
54664
|
if (isOllama(providerId)) {
|
|
56443
|
-
const url = await
|
|
54665
|
+
const url = await dist_default2({
|
|
56444
54666
|
message: `${displayName} URL:`,
|
|
56445
54667
|
default: "http://localhost:11434",
|
|
56446
54668
|
theme: inquirerTheme
|
|
@@ -56450,7 +54672,7 @@ async function askForKey(providerId, displayName, hint2) {
|
|
|
56450
54672
|
if (hint2) {
|
|
56451
54673
|
console.log(chalk15.dim(` Run ${chalk15.bold("claude setup-token")} in another terminal, then paste the key (sk-ant-...) here.`));
|
|
56452
54674
|
}
|
|
56453
|
-
const key = await
|
|
54675
|
+
const key = await dist_default({
|
|
56454
54676
|
message: `${displayName} API key:`,
|
|
56455
54677
|
mask: "*",
|
|
56456
54678
|
theme: inquirerTheme
|
|
@@ -56460,8 +54682,8 @@ async function askForKey(providerId, displayName, hint2) {
|
|
|
56460
54682
|
var init_provider_setup = __esm({
|
|
56461
54683
|
"src/llm/utils/provider-setup.ts"() {
|
|
56462
54684
|
"use strict";
|
|
56463
|
-
|
|
56464
|
-
|
|
54685
|
+
init_dist();
|
|
54686
|
+
init_dist2();
|
|
56465
54687
|
init_types6();
|
|
56466
54688
|
init_provider_ids();
|
|
56467
54689
|
init_provider_select_prompt();
|
|
@@ -56903,7 +55125,7 @@ function getEditor() {
|
|
|
56903
55125
|
}
|
|
56904
55126
|
async function openInEditor(filePath) {
|
|
56905
55127
|
const editor = getEditor();
|
|
56906
|
-
return new Promise((
|
|
55128
|
+
return new Promise((resolve15, reject) => {
|
|
56907
55129
|
const fullCommand = `${editor} "${filePath}"`;
|
|
56908
55130
|
logger.debug(`Opening editor with command: ${fullCommand}`);
|
|
56909
55131
|
const child = spawn2(fullCommand, [], {
|
|
@@ -56915,7 +55137,7 @@ async function openInEditor(filePath) {
|
|
|
56915
55137
|
});
|
|
56916
55138
|
child.on("close", (code) => {
|
|
56917
55139
|
if (code === 0 || code === null) {
|
|
56918
|
-
|
|
55140
|
+
resolve15();
|
|
56919
55141
|
} else {
|
|
56920
55142
|
reject(new Error(`Editor exited with code ${code}`));
|
|
56921
55143
|
}
|
|
@@ -57363,6 +55585,8 @@ var init_openclaw_reader = __esm({
|
|
|
57363
55585
|
import { execFile, spawn as spawn3 } from "node:child_process";
|
|
57364
55586
|
import * as os6 from "node:os";
|
|
57365
55587
|
import * as path35 from "node:path";
|
|
55588
|
+
import { createPrompt as createPrompt6, useState as useState6, useKeypress as useKeypress6, usePrefix as usePrefix6, makeTheme as makeTheme6, isUpKey as isUpKey4, isDownKey as isDownKey4, isEnterKey as isEnterKey6, isBackspaceKey as isBackspaceKey3 } from "@inquirer/core";
|
|
55589
|
+
import { cursorHide as cursorHide5 } from "@inquirer/ansi";
|
|
57366
55590
|
import NDK2, {
|
|
57367
55591
|
NDKEvent as NDKEvent17,
|
|
57368
55592
|
NDKPrivateKeySigner as NDKPrivateKeySigner18,
|
|
@@ -57473,18 +55697,18 @@ async function runRoleAssignment() {
|
|
|
57473
55697
|
});
|
|
57474
55698
|
const roleCount = MODEL_ROLES.length;
|
|
57475
55699
|
const doneIndex = roleCount;
|
|
57476
|
-
const roleMenuPrompt =
|
|
57477
|
-
const theme =
|
|
57478
|
-
const prefix =
|
|
57479
|
-
const [active, setActive] =
|
|
55700
|
+
const roleMenuPrompt = createPrompt6((promptConfig, done) => {
|
|
55701
|
+
const theme = makeTheme6(inquirerTheme);
|
|
55702
|
+
const prefix = usePrefix6({ status: "idle", theme });
|
|
55703
|
+
const [active, setActive] = useState6(0);
|
|
57480
55704
|
const itemCount = roleCount + 1;
|
|
57481
|
-
|
|
55705
|
+
useKeypress6((key, rl) => {
|
|
57482
55706
|
rl.clearLine(0);
|
|
57483
|
-
if (
|
|
55707
|
+
if (isUpKey4(key)) {
|
|
57484
55708
|
setActive(Math.max(0, active - 1));
|
|
57485
|
-
} else if (
|
|
55709
|
+
} else if (isDownKey4(key)) {
|
|
57486
55710
|
setActive(Math.min(itemCount - 1, active + 1));
|
|
57487
|
-
} else if (
|
|
55711
|
+
} else if (isEnterKey6(key)) {
|
|
57488
55712
|
if (active < roleCount) {
|
|
57489
55713
|
const role = promptConfig.roles[active];
|
|
57490
55714
|
done({ action: "edit", roleKey: role.key });
|
|
@@ -57515,7 +55739,7 @@ async function runRoleAssignment() {
|
|
|
57515
55739
|
`${chalk21.bold("\u23CE")} ${chalk21.dim("change")}`
|
|
57516
55740
|
];
|
|
57517
55741
|
lines.push(chalk21.dim(` ${helpParts.join(chalk21.dim(" \u2022 "))}`));
|
|
57518
|
-
return `${lines.join("\n")}${
|
|
55742
|
+
return `${lines.join("\n")}${cursorHide5}`;
|
|
57519
55743
|
});
|
|
57520
55744
|
while (true) {
|
|
57521
55745
|
const assignments = {};
|
|
@@ -57755,9 +55979,9 @@ async function seedDefaultLLMConfigs(providers) {
|
|
|
57755
55979
|
}
|
|
57756
55980
|
}
|
|
57757
55981
|
function commandExists(cmd) {
|
|
57758
|
-
return new Promise((
|
|
55982
|
+
return new Promise((resolve15) => {
|
|
57759
55983
|
execFile("/bin/sh", ["-c", `command -v ${cmd}`], (err) => {
|
|
57760
|
-
|
|
55984
|
+
resolve15(!err);
|
|
57761
55985
|
});
|
|
57762
55986
|
});
|
|
57763
55987
|
}
|
|
@@ -57836,8 +56060,8 @@ function startAgentDiscovery(relays, signer) {
|
|
|
57836
56060
|
const TEAM_KIND = 34199;
|
|
57837
56061
|
let initialSyncResolved = false;
|
|
57838
56062
|
let resolveInitialSync = null;
|
|
57839
|
-
const initialSync = new Promise((
|
|
57840
|
-
resolveInitialSync =
|
|
56063
|
+
const initialSync = new Promise((resolve15) => {
|
|
56064
|
+
resolveInitialSync = resolve15;
|
|
57841
56065
|
});
|
|
57842
56066
|
const markInitialSyncComplete = () => {
|
|
57843
56067
|
if (initialSyncResolved) return;
|
|
@@ -57869,7 +56093,7 @@ async function waitForAgentDiscovery(discovery, timeoutMs = 3e3) {
|
|
|
57869
56093
|
if (remainingMs === 0) return;
|
|
57870
56094
|
await Promise.race([
|
|
57871
56095
|
discovery.initialSync,
|
|
57872
|
-
new Promise((
|
|
56096
|
+
new Promise((resolve15) => setTimeout(resolve15, remainingMs))
|
|
57873
56097
|
]);
|
|
57874
56098
|
}
|
|
57875
56099
|
function resolveAgentDiscovery(discovery) {
|
|
@@ -57962,11 +56186,11 @@ async function runProjectAndAgentsStep(discovery, userPrivateKeyHex, openClawSta
|
|
|
57962
56186
|
blank();
|
|
57963
56187
|
const slugsArg = selected.join(",");
|
|
57964
56188
|
openClawImportInFlight = true;
|
|
57965
|
-
openClawImportPromise = new Promise((
|
|
56189
|
+
openClawImportPromise = new Promise((resolve15) => {
|
|
57966
56190
|
const selectedCount = selected.length;
|
|
57967
56191
|
const binPath = process.argv[1];
|
|
57968
56192
|
execFile(process.argv[0], [binPath, "agent", "import", "openclaw", "--slugs", slugsArg], (err, stdout, stderr) => {
|
|
57969
|
-
|
|
56193
|
+
resolve15({
|
|
57970
56194
|
importedCount: err ? 0 : selectedCount,
|
|
57971
56195
|
stdout: stdout ?? "",
|
|
57972
56196
|
stderr: stderr ?? "",
|
|
@@ -58151,9 +56375,9 @@ async function startDaemonFromSetup(metaProjectCreated) {
|
|
|
58151
56375
|
stdio: "inherit",
|
|
58152
56376
|
env: process.env
|
|
58153
56377
|
});
|
|
58154
|
-
const exitCode = await new Promise((
|
|
56378
|
+
const exitCode = await new Promise((resolve15, reject) => {
|
|
58155
56379
|
child.on("error", reject);
|
|
58156
|
-
child.on("close", (code) =>
|
|
56380
|
+
child.on("close", (code) => resolve15(code ?? 1));
|
|
58157
56381
|
});
|
|
58158
56382
|
process.exit(exitCode);
|
|
58159
56383
|
}
|
|
@@ -58449,19 +56673,17 @@ var init_onboarding = __esm({
|
|
|
58449
56673
|
init_ImageGenerationService();
|
|
58450
56674
|
init_cli_theme();
|
|
58451
56675
|
init_display();
|
|
58452
|
-
|
|
58453
|
-
init_dist4();
|
|
58454
|
-
relayPrompt = createPrompt((config2, done) => {
|
|
56676
|
+
relayPrompt = createPrompt6((config2, done) => {
|
|
58455
56677
|
const { items, inputPrefix = "wss://", inputPlaceholder = "Type a relay URL", validate: validate3 } = config2;
|
|
58456
|
-
const theme =
|
|
58457
|
-
const [active, setActive] =
|
|
58458
|
-
const [inputValue, setInputValue] =
|
|
58459
|
-
const [status, setStatus] =
|
|
58460
|
-
const [error, setError] =
|
|
58461
|
-
const prefix =
|
|
58462
|
-
|
|
56678
|
+
const theme = makeTheme6(inquirerTheme);
|
|
56679
|
+
const [active, setActive] = useState6(0);
|
|
56680
|
+
const [inputValue, setInputValue] = useState6("");
|
|
56681
|
+
const [status, setStatus] = useState6("idle");
|
|
56682
|
+
const [error, setError] = useState6();
|
|
56683
|
+
const prefix = usePrefix6({ status, theme });
|
|
56684
|
+
useKeypress6((key, rl) => {
|
|
58463
56685
|
rl.clearLine(0);
|
|
58464
|
-
if (
|
|
56686
|
+
if (isEnterKey6(key)) {
|
|
58465
56687
|
const item = items[active];
|
|
58466
56688
|
if (item.type === "input") {
|
|
58467
56689
|
const fullUrl = inputPrefix + inputValue;
|
|
@@ -58478,16 +56700,16 @@ var init_onboarding = __esm({
|
|
|
58478
56700
|
setStatus("done");
|
|
58479
56701
|
done(item.value);
|
|
58480
56702
|
}
|
|
58481
|
-
} else if (
|
|
56703
|
+
} else if (isUpKey4(key) || isDownKey4(key)) {
|
|
58482
56704
|
setError(void 0);
|
|
58483
|
-
const offset =
|
|
56705
|
+
const offset = isUpKey4(key) ? -1 : 1;
|
|
58484
56706
|
let next = active + offset;
|
|
58485
56707
|
if (next < 0) next = 0;
|
|
58486
56708
|
if (next >= items.length) next = items.length - 1;
|
|
58487
56709
|
setActive(next);
|
|
58488
56710
|
} else if (items[active].type === "input") {
|
|
58489
56711
|
setError(void 0);
|
|
58490
|
-
if (
|
|
56712
|
+
if (isBackspaceKey3(key)) {
|
|
58491
56713
|
setInputValue(inputValue.slice(0, -1));
|
|
58492
56714
|
} else {
|
|
58493
56715
|
const ch = key.sequence;
|
|
@@ -59090,13 +57312,13 @@ import { Command as Command12 } from "commander";
|
|
|
59090
57312
|
import chalk25 from "chalk";
|
|
59091
57313
|
import { NDKPrivateKeySigner as NDKPrivateKeySigner21, NDKEvent as NDKEvent18 } from "@nostr-dev-kit/ndk";
|
|
59092
57314
|
async function readStdin() {
|
|
59093
|
-
return new Promise((
|
|
57315
|
+
return new Promise((resolve15, reject) => {
|
|
59094
57316
|
let data = "";
|
|
59095
57317
|
process.stdin.setEncoding("utf-8");
|
|
59096
57318
|
process.stdin.on("data", (chunk) => {
|
|
59097
57319
|
data += chunk;
|
|
59098
57320
|
});
|
|
59099
|
-
process.stdin.on("end", () =>
|
|
57321
|
+
process.stdin.on("end", () => resolve15(data.trim()));
|
|
59100
57322
|
process.stdin.on("error", reject);
|
|
59101
57323
|
});
|
|
59102
57324
|
}
|