llm-party-cli 0.3.1 → 0.3.7
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 +26 -417
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -34,411 +34,6 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
|
|
|
34
34
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
35
35
|
var __require = import.meta.require;
|
|
36
36
|
|
|
37
|
-
// node_modules/dotenv/package.json
|
|
38
|
-
var require_package = __commonJS((exports, module) => {
|
|
39
|
-
module.exports = {
|
|
40
|
-
name: "dotenv",
|
|
41
|
-
version: "16.6.1",
|
|
42
|
-
description: "Loads environment variables from .env file",
|
|
43
|
-
main: "lib/main.js",
|
|
44
|
-
types: "lib/main.d.ts",
|
|
45
|
-
exports: {
|
|
46
|
-
".": {
|
|
47
|
-
types: "./lib/main.d.ts",
|
|
48
|
-
require: "./lib/main.js",
|
|
49
|
-
default: "./lib/main.js"
|
|
50
|
-
},
|
|
51
|
-
"./config": "./config.js",
|
|
52
|
-
"./config.js": "./config.js",
|
|
53
|
-
"./lib/env-options": "./lib/env-options.js",
|
|
54
|
-
"./lib/env-options.js": "./lib/env-options.js",
|
|
55
|
-
"./lib/cli-options": "./lib/cli-options.js",
|
|
56
|
-
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
57
|
-
"./package.json": "./package.json"
|
|
58
|
-
},
|
|
59
|
-
scripts: {
|
|
60
|
-
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
61
|
-
lint: "standard",
|
|
62
|
-
pretest: "npm run lint && npm run dts-check",
|
|
63
|
-
test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
64
|
-
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
|
65
|
-
prerelease: "npm test",
|
|
66
|
-
release: "standard-version"
|
|
67
|
-
},
|
|
68
|
-
repository: {
|
|
69
|
-
type: "git",
|
|
70
|
-
url: "git://github.com/motdotla/dotenv.git"
|
|
71
|
-
},
|
|
72
|
-
homepage: "https://github.com/motdotla/dotenv#readme",
|
|
73
|
-
funding: "https://dotenvx.com",
|
|
74
|
-
keywords: [
|
|
75
|
-
"dotenv",
|
|
76
|
-
"env",
|
|
77
|
-
".env",
|
|
78
|
-
"environment",
|
|
79
|
-
"variables",
|
|
80
|
-
"config",
|
|
81
|
-
"settings"
|
|
82
|
-
],
|
|
83
|
-
readmeFilename: "README.md",
|
|
84
|
-
license: "BSD-2-Clause",
|
|
85
|
-
devDependencies: {
|
|
86
|
-
"@types/node": "^18.11.3",
|
|
87
|
-
decache: "^4.6.2",
|
|
88
|
-
sinon: "^14.0.1",
|
|
89
|
-
standard: "^17.0.0",
|
|
90
|
-
"standard-version": "^9.5.0",
|
|
91
|
-
tap: "^19.2.0",
|
|
92
|
-
typescript: "^4.8.4"
|
|
93
|
-
},
|
|
94
|
-
engines: {
|
|
95
|
-
node: ">=12"
|
|
96
|
-
},
|
|
97
|
-
browser: {
|
|
98
|
-
fs: false
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// node_modules/dotenv/lib/main.js
|
|
104
|
-
var require_main = __commonJS((exports, module) => {
|
|
105
|
-
var fs = __require("fs");
|
|
106
|
-
var path = __require("path");
|
|
107
|
-
var os = __require("os");
|
|
108
|
-
var crypto = __require("crypto");
|
|
109
|
-
var packageJson = require_package();
|
|
110
|
-
var version = packageJson.version;
|
|
111
|
-
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
112
|
-
function parse(src) {
|
|
113
|
-
const obj = {};
|
|
114
|
-
let lines = src.toString();
|
|
115
|
-
lines = lines.replace(/\r\n?/mg, `
|
|
116
|
-
`);
|
|
117
|
-
let match;
|
|
118
|
-
while ((match = LINE.exec(lines)) != null) {
|
|
119
|
-
const key = match[1];
|
|
120
|
-
let value = match[2] || "";
|
|
121
|
-
value = value.trim();
|
|
122
|
-
const maybeQuote = value[0];
|
|
123
|
-
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
124
|
-
if (maybeQuote === '"') {
|
|
125
|
-
value = value.replace(/\\n/g, `
|
|
126
|
-
`);
|
|
127
|
-
value = value.replace(/\\r/g, "\r");
|
|
128
|
-
}
|
|
129
|
-
obj[key] = value;
|
|
130
|
-
}
|
|
131
|
-
return obj;
|
|
132
|
-
}
|
|
133
|
-
function _parseVault(options) {
|
|
134
|
-
options = options || {};
|
|
135
|
-
const vaultPath = _vaultPath(options);
|
|
136
|
-
options.path = vaultPath;
|
|
137
|
-
const result = DotenvModule.configDotenv(options);
|
|
138
|
-
if (!result.parsed) {
|
|
139
|
-
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
140
|
-
err.code = "MISSING_DATA";
|
|
141
|
-
throw err;
|
|
142
|
-
}
|
|
143
|
-
const keys = _dotenvKey(options).split(",");
|
|
144
|
-
const length = keys.length;
|
|
145
|
-
let decrypted;
|
|
146
|
-
for (let i = 0;i < length; i++) {
|
|
147
|
-
try {
|
|
148
|
-
const key = keys[i].trim();
|
|
149
|
-
const attrs = _instructions(result, key);
|
|
150
|
-
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
151
|
-
break;
|
|
152
|
-
} catch (error) {
|
|
153
|
-
if (i + 1 >= length) {
|
|
154
|
-
throw error;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return DotenvModule.parse(decrypted);
|
|
159
|
-
}
|
|
160
|
-
function _warn(message) {
|
|
161
|
-
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
162
|
-
}
|
|
163
|
-
function _debug(message) {
|
|
164
|
-
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
165
|
-
}
|
|
166
|
-
function _log(message) {
|
|
167
|
-
console.log(`[dotenv@${version}] ${message}`);
|
|
168
|
-
}
|
|
169
|
-
function _dotenvKey(options) {
|
|
170
|
-
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
171
|
-
return options.DOTENV_KEY;
|
|
172
|
-
}
|
|
173
|
-
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
174
|
-
return process.env.DOTENV_KEY;
|
|
175
|
-
}
|
|
176
|
-
return "";
|
|
177
|
-
}
|
|
178
|
-
function _instructions(result, dotenvKey) {
|
|
179
|
-
let uri;
|
|
180
|
-
try {
|
|
181
|
-
uri = new URL(dotenvKey);
|
|
182
|
-
} catch (error) {
|
|
183
|
-
if (error.code === "ERR_INVALID_URL") {
|
|
184
|
-
const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
185
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
186
|
-
throw err;
|
|
187
|
-
}
|
|
188
|
-
throw error;
|
|
189
|
-
}
|
|
190
|
-
const key = uri.password;
|
|
191
|
-
if (!key) {
|
|
192
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
193
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
194
|
-
throw err;
|
|
195
|
-
}
|
|
196
|
-
const environment = uri.searchParams.get("environment");
|
|
197
|
-
if (!environment) {
|
|
198
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
199
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
200
|
-
throw err;
|
|
201
|
-
}
|
|
202
|
-
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
203
|
-
const ciphertext = result.parsed[environmentKey];
|
|
204
|
-
if (!ciphertext) {
|
|
205
|
-
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
206
|
-
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
207
|
-
throw err;
|
|
208
|
-
}
|
|
209
|
-
return { ciphertext, key };
|
|
210
|
-
}
|
|
211
|
-
function _vaultPath(options) {
|
|
212
|
-
let possibleVaultPath = null;
|
|
213
|
-
if (options && options.path && options.path.length > 0) {
|
|
214
|
-
if (Array.isArray(options.path)) {
|
|
215
|
-
for (const filepath of options.path) {
|
|
216
|
-
if (fs.existsSync(filepath)) {
|
|
217
|
-
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
222
|
-
}
|
|
223
|
-
} else {
|
|
224
|
-
possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
|
|
225
|
-
}
|
|
226
|
-
if (fs.existsSync(possibleVaultPath)) {
|
|
227
|
-
return possibleVaultPath;
|
|
228
|
-
}
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
function _resolveHome(envPath) {
|
|
232
|
-
return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
233
|
-
}
|
|
234
|
-
function _configVault(options) {
|
|
235
|
-
const debug = Boolean(options && options.debug);
|
|
236
|
-
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
237
|
-
if (debug || !quiet) {
|
|
238
|
-
_log("Loading env from encrypted .env.vault");
|
|
239
|
-
}
|
|
240
|
-
const parsed = DotenvModule._parseVault(options);
|
|
241
|
-
let processEnv = process.env;
|
|
242
|
-
if (options && options.processEnv != null) {
|
|
243
|
-
processEnv = options.processEnv;
|
|
244
|
-
}
|
|
245
|
-
DotenvModule.populate(processEnv, parsed, options);
|
|
246
|
-
return { parsed };
|
|
247
|
-
}
|
|
248
|
-
function configDotenv(options) {
|
|
249
|
-
const dotenvPath = path.resolve(process.cwd(), ".env");
|
|
250
|
-
let encoding = "utf8";
|
|
251
|
-
const debug = Boolean(options && options.debug);
|
|
252
|
-
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
253
|
-
if (options && options.encoding) {
|
|
254
|
-
encoding = options.encoding;
|
|
255
|
-
} else {
|
|
256
|
-
if (debug) {
|
|
257
|
-
_debug("No encoding is specified. UTF-8 is used by default");
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
let optionPaths = [dotenvPath];
|
|
261
|
-
if (options && options.path) {
|
|
262
|
-
if (!Array.isArray(options.path)) {
|
|
263
|
-
optionPaths = [_resolveHome(options.path)];
|
|
264
|
-
} else {
|
|
265
|
-
optionPaths = [];
|
|
266
|
-
for (const filepath of options.path) {
|
|
267
|
-
optionPaths.push(_resolveHome(filepath));
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
let lastError;
|
|
272
|
-
const parsedAll = {};
|
|
273
|
-
for (const path2 of optionPaths) {
|
|
274
|
-
try {
|
|
275
|
-
const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
|
|
276
|
-
DotenvModule.populate(parsedAll, parsed, options);
|
|
277
|
-
} catch (e) {
|
|
278
|
-
if (debug) {
|
|
279
|
-
_debug(`Failed to load ${path2} ${e.message}`);
|
|
280
|
-
}
|
|
281
|
-
lastError = e;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
let processEnv = process.env;
|
|
285
|
-
if (options && options.processEnv != null) {
|
|
286
|
-
processEnv = options.processEnv;
|
|
287
|
-
}
|
|
288
|
-
DotenvModule.populate(processEnv, parsedAll, options);
|
|
289
|
-
if (debug || !quiet) {
|
|
290
|
-
const keysCount = Object.keys(parsedAll).length;
|
|
291
|
-
const shortPaths = [];
|
|
292
|
-
for (const filePath of optionPaths) {
|
|
293
|
-
try {
|
|
294
|
-
const relative = path.relative(process.cwd(), filePath);
|
|
295
|
-
shortPaths.push(relative);
|
|
296
|
-
} catch (e) {
|
|
297
|
-
if (debug) {
|
|
298
|
-
_debug(`Failed to load ${filePath} ${e.message}`);
|
|
299
|
-
}
|
|
300
|
-
lastError = e;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
_log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
|
|
304
|
-
}
|
|
305
|
-
if (lastError) {
|
|
306
|
-
return { parsed: parsedAll, error: lastError };
|
|
307
|
-
} else {
|
|
308
|
-
return { parsed: parsedAll };
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
function config(options) {
|
|
312
|
-
if (_dotenvKey(options).length === 0) {
|
|
313
|
-
return DotenvModule.configDotenv(options);
|
|
314
|
-
}
|
|
315
|
-
const vaultPath = _vaultPath(options);
|
|
316
|
-
if (!vaultPath) {
|
|
317
|
-
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
318
|
-
return DotenvModule.configDotenv(options);
|
|
319
|
-
}
|
|
320
|
-
return DotenvModule._configVault(options);
|
|
321
|
-
}
|
|
322
|
-
function decrypt(encrypted, keyStr) {
|
|
323
|
-
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
324
|
-
let ciphertext = Buffer.from(encrypted, "base64");
|
|
325
|
-
const nonce = ciphertext.subarray(0, 12);
|
|
326
|
-
const authTag = ciphertext.subarray(-16);
|
|
327
|
-
ciphertext = ciphertext.subarray(12, -16);
|
|
328
|
-
try {
|
|
329
|
-
const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
|
|
330
|
-
aesgcm.setAuthTag(authTag);
|
|
331
|
-
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
332
|
-
} catch (error) {
|
|
333
|
-
const isRange = error instanceof RangeError;
|
|
334
|
-
const invalidKeyLength = error.message === "Invalid key length";
|
|
335
|
-
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
336
|
-
if (isRange || invalidKeyLength) {
|
|
337
|
-
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
338
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
339
|
-
throw err;
|
|
340
|
-
} else if (decryptionFailed) {
|
|
341
|
-
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
342
|
-
err.code = "DECRYPTION_FAILED";
|
|
343
|
-
throw err;
|
|
344
|
-
} else {
|
|
345
|
-
throw error;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
function populate(processEnv, parsed, options = {}) {
|
|
350
|
-
const debug = Boolean(options && options.debug);
|
|
351
|
-
const override = Boolean(options && options.override);
|
|
352
|
-
if (typeof parsed !== "object") {
|
|
353
|
-
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
354
|
-
err.code = "OBJECT_REQUIRED";
|
|
355
|
-
throw err;
|
|
356
|
-
}
|
|
357
|
-
for (const key of Object.keys(parsed)) {
|
|
358
|
-
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
359
|
-
if (override === true) {
|
|
360
|
-
processEnv[key] = parsed[key];
|
|
361
|
-
}
|
|
362
|
-
if (debug) {
|
|
363
|
-
if (override === true) {
|
|
364
|
-
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
365
|
-
} else {
|
|
366
|
-
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
} else {
|
|
370
|
-
processEnv[key] = parsed[key];
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
var DotenvModule = {
|
|
375
|
-
configDotenv,
|
|
376
|
-
_configVault,
|
|
377
|
-
_parseVault,
|
|
378
|
-
config,
|
|
379
|
-
decrypt,
|
|
380
|
-
parse,
|
|
381
|
-
populate
|
|
382
|
-
};
|
|
383
|
-
exports.configDotenv = DotenvModule.configDotenv;
|
|
384
|
-
exports._configVault = DotenvModule._configVault;
|
|
385
|
-
exports._parseVault = DotenvModule._parseVault;
|
|
386
|
-
exports.config = DotenvModule.config;
|
|
387
|
-
exports.decrypt = DotenvModule.decrypt;
|
|
388
|
-
exports.parse = DotenvModule.parse;
|
|
389
|
-
exports.populate = DotenvModule.populate;
|
|
390
|
-
module.exports = DotenvModule;
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
// node_modules/dotenv/lib/env-options.js
|
|
394
|
-
var require_env_options = __commonJS((exports, module) => {
|
|
395
|
-
var options = {};
|
|
396
|
-
if (process.env.DOTENV_CONFIG_ENCODING != null) {
|
|
397
|
-
options.encoding = process.env.DOTENV_CONFIG_ENCODING;
|
|
398
|
-
}
|
|
399
|
-
if (process.env.DOTENV_CONFIG_PATH != null) {
|
|
400
|
-
options.path = process.env.DOTENV_CONFIG_PATH;
|
|
401
|
-
}
|
|
402
|
-
if (process.env.DOTENV_CONFIG_QUIET != null) {
|
|
403
|
-
options.quiet = process.env.DOTENV_CONFIG_QUIET;
|
|
404
|
-
}
|
|
405
|
-
if (process.env.DOTENV_CONFIG_DEBUG != null) {
|
|
406
|
-
options.debug = process.env.DOTENV_CONFIG_DEBUG;
|
|
407
|
-
}
|
|
408
|
-
if (process.env.DOTENV_CONFIG_OVERRIDE != null) {
|
|
409
|
-
options.override = process.env.DOTENV_CONFIG_OVERRIDE;
|
|
410
|
-
}
|
|
411
|
-
if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
|
|
412
|
-
options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
|
|
413
|
-
}
|
|
414
|
-
module.exports = options;
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
// node_modules/dotenv/lib/cli-options.js
|
|
418
|
-
var require_cli_options = __commonJS((exports, module) => {
|
|
419
|
-
var re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
|
|
420
|
-
module.exports = function optionMatcher(args) {
|
|
421
|
-
const options = args.reduce(function(acc, cur) {
|
|
422
|
-
const matches = cur.match(re);
|
|
423
|
-
if (matches) {
|
|
424
|
-
acc[matches[1]] = matches[2];
|
|
425
|
-
}
|
|
426
|
-
return acc;
|
|
427
|
-
}, {});
|
|
428
|
-
if (!("quiet" in options)) {
|
|
429
|
-
options.quiet = "true";
|
|
430
|
-
}
|
|
431
|
-
return options;
|
|
432
|
-
};
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
// node_modules/dotenv/config.js
|
|
436
|
-
var require_config = __commonJS(() => {
|
|
437
|
-
(function() {
|
|
438
|
-
require_main().config(Object.assign({}, require_env_options(), require_cli_options()(process.argv)));
|
|
439
|
-
})();
|
|
440
|
-
});
|
|
441
|
-
|
|
442
37
|
// node_modules/react/cjs/react.development.js
|
|
443
38
|
var require_react_development = __commonJS((exports, module) => {
|
|
444
39
|
(function() {
|
|
@@ -1496,7 +1091,7 @@ var require_jsx_dev_runtime = __commonJS((exports, module2) => {
|
|
|
1496
1091
|
}
|
|
1497
1092
|
});
|
|
1498
1093
|
|
|
1499
|
-
// node_modules/
|
|
1094
|
+
// node_modules/scheduler/cjs/scheduler.development.js
|
|
1500
1095
|
var require_scheduler_development = __commonJS((exports) => {
|
|
1501
1096
|
(function() {
|
|
1502
1097
|
function performWorkUntilDeadline() {
|
|
@@ -1751,7 +1346,7 @@ var require_scheduler_development = __commonJS((exports) => {
|
|
|
1751
1346
|
})();
|
|
1752
1347
|
});
|
|
1753
1348
|
|
|
1754
|
-
// node_modules/
|
|
1349
|
+
// node_modules/scheduler/index.js
|
|
1755
1350
|
var require_scheduler = __commonJS((exports, module2) => {
|
|
1756
1351
|
var scheduler_development = __toESM(require_scheduler_development());
|
|
1757
1352
|
if (false) {} else {
|
|
@@ -31036,7 +30631,7 @@ var require_ril = __commonJS((exports) => {
|
|
|
31036
30631
|
});
|
|
31037
30632
|
|
|
31038
30633
|
// node_modules/vscode-jsonrpc/lib/node/main.js
|
|
31039
|
-
var
|
|
30634
|
+
var require_main = __commonJS((exports) => {
|
|
31040
30635
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m3, k3, k22) {
|
|
31041
30636
|
if (k22 === undefined)
|
|
31042
30637
|
k22 = k3;
|
|
@@ -31303,7 +30898,6 @@ var require_main2 = __commonJS((exports) => {
|
|
|
31303
30898
|
});
|
|
31304
30899
|
|
|
31305
30900
|
// src/index.ts
|
|
31306
|
-
var import_config = __toESM(require_config(), 1);
|
|
31307
30901
|
var import_react24 = __toESM(require_react(), 1);
|
|
31308
30902
|
import { readFile as readFile5 } from "fs/promises";
|
|
31309
30903
|
import path11 from "path";
|
|
@@ -73669,13 +73263,13 @@ class ClaudeBaseAdapter {
|
|
|
73669
73263
|
async buildEnv(config) {
|
|
73670
73264
|
return { ...process.env, ...config.env ?? {} };
|
|
73671
73265
|
}
|
|
73672
|
-
async send(messages) {
|
|
73673
|
-
return await this.querySDK(formatTranscript(messages));
|
|
73266
|
+
async send(messages, signal) {
|
|
73267
|
+
return await this.querySDK(formatTranscript(messages), signal);
|
|
73674
73268
|
}
|
|
73675
73269
|
async destroy() {
|
|
73676
73270
|
return;
|
|
73677
73271
|
}
|
|
73678
|
-
async querySDK(transcript) {
|
|
73272
|
+
async querySDK(transcript, signal) {
|
|
73679
73273
|
const executableOpt = this.claudeExecutable ? { pathToClaudeCodeExecutable: this.claudeExecutable } : {};
|
|
73680
73274
|
const options = {
|
|
73681
73275
|
cwd: process.cwd(),
|
|
@@ -73690,6 +73284,9 @@ class ClaudeBaseAdapter {
|
|
|
73690
73284
|
...executableOpt
|
|
73691
73285
|
};
|
|
73692
73286
|
for await (const message of Eg({ prompt: transcript, options })) {
|
|
73287
|
+
if (signal?.aborted) {
|
|
73288
|
+
return `[Aborted] ${this.name} was cancelled`;
|
|
73289
|
+
}
|
|
73693
73290
|
if (message && typeof message === "object" && "type" in message && "subtype" in message && "session_id" in message && message.type === "system" && message.subtype === "init" && typeof message.session_id === "string") {
|
|
73694
73291
|
this.sessionId = message.session_id;
|
|
73695
73292
|
}
|
|
@@ -74166,10 +73763,13 @@ class CodexAdapter {
|
|
|
74166
73763
|
approvalPolicy: "never"
|
|
74167
73764
|
});
|
|
74168
73765
|
}
|
|
74169
|
-
async send(messages) {
|
|
73766
|
+
async send(messages, signal) {
|
|
74170
73767
|
if (!this.thread) {
|
|
74171
73768
|
return "[Codex thread not initialized]";
|
|
74172
73769
|
}
|
|
73770
|
+
if (signal?.aborted) {
|
|
73771
|
+
return "[Aborted] Codex was cancelled";
|
|
73772
|
+
}
|
|
74173
73773
|
const turn = await this.thread.run(formatTranscript(messages));
|
|
74174
73774
|
if (turn.finalResponse && turn.finalResponse.length > 0) {
|
|
74175
73775
|
return turn.finalResponse;
|
|
@@ -74183,7 +73783,7 @@ class CodexAdapter {
|
|
|
74183
73783
|
}
|
|
74184
73784
|
|
|
74185
73785
|
// node_modules/@github/copilot-sdk/dist/client.js
|
|
74186
|
-
var import_node2 = __toESM(
|
|
73786
|
+
var import_node2 = __toESM(require_main(), 1);
|
|
74187
73787
|
import { spawn as spawn2 } from "child_process";
|
|
74188
73788
|
import { randomUUID } from "crypto";
|
|
74189
73789
|
import { existsSync as existsSync5 } from "fs";
|
|
@@ -74259,7 +73859,7 @@ function getSdkProtocolVersion() {
|
|
|
74259
73859
|
}
|
|
74260
73860
|
|
|
74261
73861
|
// node_modules/@github/copilot-sdk/dist/session.js
|
|
74262
|
-
var import_node = __toESM(
|
|
73862
|
+
var import_node = __toESM(require_main(), 1);
|
|
74263
73863
|
var NO_RESULT_PERMISSION_V2_ERROR = "Permission handlers cannot return 'no-result' when connected to a protocol v2 server.";
|
|
74264
73864
|
|
|
74265
73865
|
class CopilotSession {
|
|
@@ -75369,10 +74969,13 @@ class CopilotAdapter {
|
|
|
75369
74969
|
this.cliPath = config.executablePath ?? process.env.COPILOT_CLI_EXECUTABLE;
|
|
75370
74970
|
await this.createSession();
|
|
75371
74971
|
}
|
|
75372
|
-
async send(messages) {
|
|
74972
|
+
async send(messages, signal) {
|
|
75373
74973
|
if (!this.session) {
|
|
75374
74974
|
return "[Copilot session not initialized]";
|
|
75375
74975
|
}
|
|
74976
|
+
if (signal?.aborted) {
|
|
74977
|
+
return "[Aborted] Copilot was cancelled";
|
|
74978
|
+
}
|
|
75376
74979
|
const transcript = formatTranscript(messages);
|
|
75377
74980
|
try {
|
|
75378
74981
|
return await this.sendToSession(transcript);
|
|
@@ -75834,14 +75437,16 @@ class Orchestrator {
|
|
|
75834
75437
|
await writeFile5(targetPath, JSON.stringify(this.conversation, null, 2), "utf8");
|
|
75835
75438
|
}
|
|
75836
75439
|
async sendWithTimeout(agent, messages, timeoutMs) {
|
|
75440
|
+
const controller = new AbortController;
|
|
75837
75441
|
let timer;
|
|
75838
75442
|
const timeoutPromise = new Promise((resolve4) => {
|
|
75839
75443
|
timer = setTimeout(() => {
|
|
75444
|
+
controller.abort();
|
|
75840
75445
|
resolve4(`[Timeout] ${agent.name} exceeded ${Math.floor(timeoutMs / 1000)}s`);
|
|
75841
75446
|
}, timeoutMs);
|
|
75842
75447
|
});
|
|
75843
75448
|
try {
|
|
75844
|
-
return await Promise.race([agent.send(messages), timeoutPromise]);
|
|
75449
|
+
return await Promise.race([agent.send(messages, controller.signal), timeoutPromise]);
|
|
75845
75450
|
} finally {
|
|
75846
75451
|
if (timer) {
|
|
75847
75452
|
clearTimeout(timer);
|
|
@@ -76918,6 +76523,10 @@ function ConfigWizard({ isFirstRun, onComplete, onCancel, existingConfig }) {
|
|
|
76918
76523
|
}
|
|
76919
76524
|
}, [selectedIds, existingConfig]);
|
|
76920
76525
|
useKeyboard((key) => {
|
|
76526
|
+
if (key.ctrl && key.name === "c") {
|
|
76527
|
+
process.kill(process.pid, "SIGINT");
|
|
76528
|
+
return;
|
|
76529
|
+
}
|
|
76921
76530
|
if (step !== "configure") {
|
|
76922
76531
|
if (step === "detect") {
|
|
76923
76532
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llm-party-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"llm-party": "dist/index.js"
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"@opentui/core": "^0.1.89",
|
|
55
55
|
"@opentui/react": "^0.1.89",
|
|
56
56
|
"chalk": "^5.3.0",
|
|
57
|
-
"dotenv": "^16.4.5",
|
|
58
57
|
"react": "^19.2.4"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|