@elizaos/cli 1.0.9 → 1.0.10
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/README.md +9 -16
- package/dist/assets/{index-CCyz05Yl.js → index-CmuPnu0u.js} +72 -89
- package/dist/assets/index-CmuPnu0u.js.br +0 -0
- package/dist/assets/index-CmuPnu0u.js.map +1 -0
- package/dist/assets/{index-Cxd2b7is.js → index-DDQnwxzL.js} +1318 -13721
- package/dist/assets/{index-Cxd2b7is.js.map → index-DDQnwxzL.js.map} +1 -1
- package/dist/assets/index-Df1AFSuJ.css +1 -0
- package/dist/assets/index-Df1AFSuJ.css.br +0 -0
- package/dist/assets/vendor-DSdxb8P-.js.map +1 -1
- package/dist/{chunk-Y755OOSP.js → chunk-7HYEGM5V.js} +877 -1550
- package/dist/{chunk-HZQCHL3J.js → chunk-B4KJXECB.js} +13 -18
- package/dist/{chunk-Z6GVELRX.js → chunk-GWQB7PBK.js} +58 -29
- package/dist/{chunk-CVADLFW6.js → chunk-LQ6XHF53.js} +4543 -3043
- package/dist/{chunk-JWONHNLD.js → chunk-RIAWNDYI.js} +2 -9
- package/dist/{chunk-IEKLJDUU.js → chunk-WS4DWCDZ.js} +54 -32
- package/dist/commands/agent/actions/index.d.ts +5 -1
- package/dist/commands/agent/actions/index.js +5 -3
- package/dist/commands/agent/index.js +3 -3
- package/dist/commands/create/actions/index.js +4 -4
- package/dist/commands/create/index.js +5 -5
- package/dist/{fileFromPath-DCRQMDLJ.js → fileFromPath-KB6XMTJ4.js} +1 -0
- package/dist/index.html +2 -2
- package/dist/index.js +9351 -102236
- package/dist/{migrator-KZLCVEIH.js → migrator-JREQPDN3.js} +42 -220
- package/dist/pglite.data +0 -0
- package/dist/pglite.wasm +0 -0
- package/dist/plugin-creator-T4K2673C.js +910 -0
- package/dist/{registry-W7CIK4O2.js → registry-CBMRMYCG.js} +3 -3
- package/dist/templates/plugin-starter/README.md +255 -0
- package/dist/templates/plugin-starter/bunfig.toml +6 -0
- package/dist/templates/plugin-starter/cypress.config.ts +18 -0
- package/dist/templates/plugin-starter/index.html +13 -0
- package/dist/templates/plugin-starter/package.json +95 -0
- package/dist/templates/plugin-starter/postcss.config.js +3 -0
- package/dist/templates/plugin-starter/scripts/test-e2e-manual.js +201 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +404 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +287 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/support/commands.ts +38 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/support/component-index.html +11 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/support/component.ts +33 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/support/e2e.ts +11 -0
- package/dist/templates/plugin-starter/src/__tests__/cypress/tsconfig.json +10 -0
- package/dist/templates/plugin-starter/src/__tests__/e2e/README.md +47 -0
- package/dist/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts +320 -0
- package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/integration.test.ts +22 -17
- package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/plugin.test.ts +8 -8
- package/{templates/plugin-starter → dist/templates/plugin-starter/src}/__tests__/test-utils.ts +17 -17
- package/dist/templates/plugin-starter/src/frontend/index.css +77 -0
- package/dist/templates/plugin-starter/src/frontend/index.tsx +164 -0
- package/dist/templates/plugin-starter/src/frontend/utils.ts +6 -0
- package/dist/templates/plugin-starter/src/index.ts +274 -0
- package/dist/templates/plugin-starter/src/tests.ts +6 -0
- package/dist/templates/plugin-starter/tailwind.config.js +62 -0
- package/dist/templates/plugin-starter/tsconfig.build.json +11 -0
- package/dist/templates/plugin-starter/tsconfig.json +28 -0
- package/dist/templates/plugin-starter/tsup.config.ts +20 -0
- package/dist/templates/plugin-starter/vite.config.ts +20 -0
- package/dist/templates/project-starter/.env.example +153 -0
- package/dist/templates/project-starter/README.md +109 -0
- package/dist/templates/project-starter/bunfig.toml +6 -0
- package/dist/templates/project-starter/cypress.config.ts +31 -0
- package/dist/templates/project-starter/index.html +13 -0
- package/dist/templates/project-starter/package.json +83 -0
- package/dist/templates/project-starter/postcss.config.js +3 -0
- package/dist/templates/project-starter/scripts/test-all.sh +101 -0
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/actions.test.ts +6 -6
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/character.test.ts +3 -3
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/config.test.ts +18 -18
- package/dist/templates/project-starter/src/__tests__/cypress/component/Accessibility.cy.tsx +271 -0
- package/dist/templates/project-starter/src/__tests__/cypress/component/ApiIntegration.cy.tsx +220 -0
- package/dist/templates/project-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +146 -0
- package/dist/templates/project-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +51 -0
- package/dist/templates/project-starter/src/__tests__/cypress/e2e/agent-chat.cy.ts +235 -0
- package/dist/templates/project-starter/src/__tests__/cypress/e2e/dashboard.cy.ts +146 -0
- package/dist/templates/project-starter/src/__tests__/cypress/e2e/user-workflow.cy.ts +257 -0
- package/dist/templates/project-starter/src/__tests__/cypress/support/commands.ts +44 -0
- package/dist/templates/project-starter/src/__tests__/cypress/support/component-index.html +11 -0
- package/dist/templates/project-starter/src/__tests__/cypress/support/component.ts +33 -0
- package/dist/templates/project-starter/src/__tests__/cypress/support/e2e.ts +179 -0
- package/dist/templates/project-starter/src/__tests__/e2e/index.ts +14 -0
- package/dist/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +246 -0
- package/dist/templates/project-starter/src/__tests__/e2e/project.test.ts +155 -0
- package/dist/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +421 -0
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/env.test.ts +2 -2
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/error-handling.test.ts +17 -17
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/events.test.ts +7 -7
- package/dist/templates/project-starter/src/__tests__/file-structure.test.ts +135 -0
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/integration.test.ts +25 -25
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/models.test.ts +6 -6
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/plugin.test.ts +9 -9
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/provider.test.ts +7 -7
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/routes.test.ts +3 -3
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/test-utils.ts +17 -17
- package/{templates/project-starter → dist/templates/project-starter/src}/__tests__/utils/core-test-utils.ts +3 -3
- package/dist/templates/project-starter/src/frontend/index.css +77 -0
- package/dist/templates/project-starter/src/frontend/index.html +19 -0
- package/dist/templates/project-starter/src/frontend/index.tsx +98 -0
- package/dist/templates/project-starter/src/frontend/utils.ts +6 -0
- package/dist/templates/project-starter/src/index.ts +153 -0
- package/dist/templates/project-starter/src/plugin.ts +255 -0
- package/dist/templates/project-starter/tailwind.config.js +62 -0
- package/dist/templates/project-starter/tsconfig.build.json +20 -0
- package/dist/templates/project-starter/tsconfig.json +39 -0
- package/dist/templates/project-starter/tsup.config.ts +19 -0
- package/dist/templates/project-starter/vite.config.ts +39 -0
- package/dist/templates/project-tee-starter/.dockerignore +20 -0
- package/dist/templates/project-tee-starter/.env.example +55 -0
- package/dist/templates/project-tee-starter/Dockerfile +66 -0
- package/dist/templates/project-tee-starter/GUIDE.md +235 -0
- package/dist/templates/project-tee-starter/README.md +173 -0
- package/dist/templates/project-tee-starter/__tests__/actions.test.ts +9 -0
- package/dist/templates/project-tee-starter/__tests__/character.test.ts +86 -0
- package/dist/templates/project-tee-starter/__tests__/config.test.ts +31 -0
- package/dist/templates/project-tee-starter/__tests__/env.test.ts +87 -0
- package/dist/templates/project-tee-starter/__tests__/error-handling.test.ts +30 -0
- package/dist/templates/project-tee-starter/__tests__/events.test.ts +21 -0
- package/{templates/project-starter → dist/templates/project-tee-starter}/__tests__/file-structure.test.ts +6 -6
- package/dist/templates/project-tee-starter/__tests__/integration.test.ts +205 -0
- package/dist/templates/project-tee-starter/__tests__/models.test.ts +22 -0
- package/dist/templates/project-tee-starter/__tests__/plugin.test.ts +38 -0
- package/dist/templates/project-tee-starter/__tests__/provider.test.ts +189 -0
- package/dist/templates/project-tee-starter/__tests__/routes.test.ts +21 -0
- package/dist/templates/project-tee-starter/__tests__/test-utils.ts +121 -0
- package/dist/templates/project-tee-starter/__tests__/utils/core-test-utils.ts +167 -0
- package/dist/templates/project-tee-starter/assets/mr-tee-portrait.jpg +0 -0
- package/dist/templates/project-tee-starter/bunfig.toml +6 -0
- package/dist/templates/project-tee-starter/docker-compose.yaml +57 -0
- package/dist/templates/project-tee-starter/e2e/project.test.ts +38 -0
- package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +92 -0
- package/dist/templates/project-tee-starter/package.json +74 -0
- package/dist/templates/project-tee-starter/src/character.ts +257 -0
- package/dist/templates/project-tee-starter/src/index.ts +33 -0
- package/dist/templates/project-tee-starter/src/plugin.ts +169 -0
- package/dist/templates/project-tee-starter/tsconfig.build.json +13 -0
- package/dist/templates/project-tee-starter/tsconfig.json +30 -0
- package/dist/templates/project-tee-starter/tsup.config.ts +19 -0
- package/dist/{utils-2G2QVMW3.js → utils-TIALZU53.js} +9 -7
- package/package.json +28 -9
- package/templates/plugin-starter/README.md +38 -13
- package/templates/plugin-starter/bunfig.toml +6 -0
- package/templates/plugin-starter/cypress.config.ts +18 -0
- package/templates/plugin-starter/index.html +13 -0
- package/templates/plugin-starter/package.json +19 -7
- package/templates/plugin-starter/postcss.config.js +3 -0
- package/templates/plugin-starter/scripts/test-e2e-manual.js +201 -0
- package/templates/plugin-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +404 -0
- package/templates/plugin-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +287 -0
- package/templates/plugin-starter/src/__tests__/cypress/support/commands.ts +38 -0
- package/templates/plugin-starter/src/__tests__/cypress/support/component-index.html +11 -0
- package/templates/plugin-starter/src/__tests__/cypress/support/component.ts +33 -0
- package/templates/plugin-starter/src/__tests__/cypress/support/e2e.ts +11 -0
- package/templates/plugin-starter/src/__tests__/cypress/tsconfig.json +10 -0
- package/templates/plugin-starter/src/__tests__/e2e/README.md +47 -0
- package/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts +320 -0
- package/templates/plugin-starter/src/__tests__/integration.test.ts +138 -0
- package/templates/plugin-starter/src/__tests__/plugin.test.ts +182 -0
- package/templates/plugin-starter/src/__tests__/test-utils.ts +162 -0
- package/templates/plugin-starter/src/frontend/index.css +77 -0
- package/templates/plugin-starter/src/frontend/index.tsx +164 -0
- package/templates/plugin-starter/src/frontend/utils.ts +6 -0
- package/templates/plugin-starter/src/index.ts +30 -7
- package/templates/plugin-starter/src/tests.ts +6 -0
- package/templates/plugin-starter/tailwind.config.js +62 -0
- package/templates/plugin-starter/tsconfig.json +8 -8
- package/templates/plugin-starter/vite.config.ts +20 -0
- package/templates/project-starter/bunfig.toml +6 -0
- package/templates/project-starter/cypress.config.ts +31 -0
- package/templates/project-starter/index.html +13 -0
- package/templates/project-starter/package.json +37 -14
- package/templates/project-starter/postcss.config.js +3 -0
- package/templates/project-starter/scripts/test-all.sh +101 -0
- package/templates/project-starter/src/__tests__/actions.test.ts +155 -0
- package/templates/project-starter/src/__tests__/character.test.ts +86 -0
- package/templates/project-starter/src/__tests__/config.test.ts +193 -0
- package/templates/project-starter/src/__tests__/cypress/component/Accessibility.cy.tsx +271 -0
- package/templates/project-starter/src/__tests__/cypress/component/ApiIntegration.cy.tsx +220 -0
- package/templates/project-starter/src/__tests__/cypress/component/ExampleRoute.cy.tsx +146 -0
- package/templates/project-starter/src/__tests__/cypress/component/PanelComponent.cy.tsx +51 -0
- package/templates/project-starter/src/__tests__/cypress/e2e/agent-chat.cy.ts +235 -0
- package/templates/project-starter/src/__tests__/cypress/e2e/dashboard.cy.ts +146 -0
- package/templates/project-starter/src/__tests__/cypress/e2e/user-workflow.cy.ts +257 -0
- package/templates/project-starter/src/__tests__/cypress/support/commands.ts +44 -0
- package/templates/project-starter/src/__tests__/cypress/support/component-index.html +11 -0
- package/templates/project-starter/src/__tests__/cypress/support/component.ts +33 -0
- package/templates/project-starter/src/__tests__/cypress/support/e2e.ts +179 -0
- package/templates/project-starter/src/__tests__/e2e/index.ts +14 -0
- package/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +246 -0
- package/templates/project-starter/src/__tests__/e2e/project.test.ts +155 -0
- package/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +421 -0
- package/templates/project-starter/src/__tests__/env.test.ts +87 -0
- package/templates/project-starter/src/__tests__/error-handling.test.ts +177 -0
- package/templates/project-starter/src/__tests__/events.test.ts +144 -0
- package/templates/project-starter/src/__tests__/file-structure.test.ts +135 -0
- package/templates/project-starter/src/__tests__/integration.test.ts +209 -0
- package/templates/project-starter/src/__tests__/models.test.ts +152 -0
- package/templates/project-starter/src/__tests__/plugin.test.ts +393 -0
- package/templates/project-starter/src/__tests__/provider.test.ts +325 -0
- package/templates/project-starter/src/__tests__/routes.test.ts +79 -0
- package/templates/project-starter/src/__tests__/test-utils.ts +121 -0
- package/templates/project-starter/src/__tests__/utils/core-test-utils.ts +180 -0
- package/templates/project-starter/src/frontend/index.css +77 -0
- package/templates/project-starter/src/frontend/index.html +19 -0
- package/templates/project-starter/src/frontend/index.tsx +98 -0
- package/templates/project-starter/src/frontend/utils.ts +6 -0
- package/templates/project-starter/src/index.ts +3 -0
- package/templates/project-starter/tailwind.config.js +62 -0
- package/templates/project-starter/tsconfig.build.json +9 -2
- package/templates/project-starter/tsconfig.json +15 -6
- package/templates/project-starter/tsup.config.ts +1 -1
- package/templates/project-starter/vite.config.ts +39 -0
- package/templates/project-tee-starter/__tests__/actions.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/character.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/config.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/env.test.ts +2 -2
- package/templates/project-tee-starter/__tests__/error-handling.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/events.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/file-structure.test.ts +5 -5
- package/templates/project-tee-starter/__tests__/integration.test.ts +22 -26
- package/templates/project-tee-starter/__tests__/models.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/plugin.test.ts +6 -12
- package/templates/project-tee-starter/__tests__/provider.test.ts +6 -6
- package/templates/project-tee-starter/__tests__/routes.test.ts +1 -1
- package/templates/project-tee-starter/__tests__/test-utils.ts +15 -15
- package/templates/project-tee-starter/__tests__/utils/core-test-utils.ts +3 -3
- package/templates/project-tee-starter/bunfig.toml +6 -0
- package/templates/project-tee-starter/package.json +10 -12
- package/dist/assets/index-CCyz05Yl.js.br +0 -0
- package/dist/assets/index-CCyz05Yl.js.map +0 -1
- package/dist/assets/index-DeXwJbtm.css +0 -1
- package/dist/assets/index-DeXwJbtm.css.br +0 -0
- package/dist/chunk-CEE6RKN5.js +0 -2746
- package/dist/chunk-TUAYJIF2.js +0 -3649
- package/dist/plugin-creator-IK6H4LVZ.js +0 -29165
- package/templates/plugin-starter/e2e/starter-plugin.test.ts +0 -171
- package/templates/plugin-starter/images/README.md +0 -24
- package/templates/plugin-starter/vitest.config.ts +0 -16
- package/templates/project-starter/e2e/project.test.ts +0 -34
- package/templates/project-starter/e2e/starter-plugin.test.ts +0 -217
- package/templates/project-starter/vitest.config.ts +0 -16
- package/templates/project-tee-starter/vitest.config.ts +0 -19
|
@@ -5,11 +5,11 @@ const require = createRequire(import.meta.url);
|
|
|
5
5
|
import {
|
|
6
6
|
displayBunInstallationTipCompact,
|
|
7
7
|
runBunCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RIAWNDYI.js";
|
|
9
9
|
import {
|
|
10
10
|
emoji,
|
|
11
11
|
require_src
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WS4DWCDZ.js";
|
|
13
13
|
import {
|
|
14
14
|
getAgentRuntimeUrl,
|
|
15
15
|
getAgentsBaseUrl
|
|
@@ -94,8 +94,9 @@ var require_package = __commonJS({
|
|
|
94
94
|
// ../../node_modules/dotenv/lib/main.js
|
|
95
95
|
var require_main = __commonJS({
|
|
96
96
|
"../../node_modules/dotenv/lib/main.js"(exports, module) {
|
|
97
|
-
|
|
98
|
-
var
|
|
97
|
+
"use strict";
|
|
98
|
+
var fs11 = __require("fs");
|
|
99
|
+
var path19 = __require("path");
|
|
99
100
|
var os2 = __require("os");
|
|
100
101
|
var crypto = __require("crypto");
|
|
101
102
|
var packageJson = require_package();
|
|
@@ -198,7 +199,7 @@ var require_main = __commonJS({
|
|
|
198
199
|
if (options && options.path && options.path.length > 0) {
|
|
199
200
|
if (Array.isArray(options.path)) {
|
|
200
201
|
for (const filepath of options.path) {
|
|
201
|
-
if (
|
|
202
|
+
if (fs11.existsSync(filepath)) {
|
|
202
203
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
203
204
|
}
|
|
204
205
|
}
|
|
@@ -206,15 +207,15 @@ var require_main = __commonJS({
|
|
|
206
207
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
207
208
|
}
|
|
208
209
|
} else {
|
|
209
|
-
possibleVaultPath =
|
|
210
|
+
possibleVaultPath = path19.resolve(process.cwd(), ".env.vault");
|
|
210
211
|
}
|
|
211
|
-
if (
|
|
212
|
+
if (fs11.existsSync(possibleVaultPath)) {
|
|
212
213
|
return possibleVaultPath;
|
|
213
214
|
}
|
|
214
215
|
return null;
|
|
215
216
|
}
|
|
216
217
|
function _resolveHome(envPath) {
|
|
217
|
-
return envPath[0] === "~" ?
|
|
218
|
+
return envPath[0] === "~" ? path19.join(os2.homedir(), envPath.slice(1)) : envPath;
|
|
218
219
|
}
|
|
219
220
|
function _configVault(options) {
|
|
220
221
|
const debug = Boolean(options && options.debug);
|
|
@@ -230,7 +231,7 @@ var require_main = __commonJS({
|
|
|
230
231
|
return { parsed };
|
|
231
232
|
}
|
|
232
233
|
function configDotenv(options) {
|
|
233
|
-
const dotenvPath =
|
|
234
|
+
const dotenvPath = path19.resolve(process.cwd(), ".env");
|
|
234
235
|
let encoding = "utf8";
|
|
235
236
|
const debug = Boolean(options && options.debug);
|
|
236
237
|
if (options && options.encoding) {
|
|
@@ -253,15 +254,15 @@ var require_main = __commonJS({
|
|
|
253
254
|
}
|
|
254
255
|
let lastError;
|
|
255
256
|
const parsedAll = {};
|
|
256
|
-
for (const
|
|
257
|
+
for (const path20 of optionPaths) {
|
|
257
258
|
try {
|
|
258
|
-
const parsed = DotenvModule.parse(
|
|
259
|
+
const parsed = DotenvModule.parse(fs11.readFileSync(path20, { encoding }));
|
|
259
260
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
260
|
-
} catch (
|
|
261
|
+
} catch (e) {
|
|
261
262
|
if (debug) {
|
|
262
|
-
_debug(`Failed to load ${
|
|
263
|
+
_debug(`Failed to load ${path20} ${e.message}`);
|
|
263
264
|
}
|
|
264
|
-
lastError =
|
|
265
|
+
lastError = e;
|
|
265
266
|
}
|
|
266
267
|
}
|
|
267
268
|
let processEnv = process.env;
|
|
@@ -358,137 +359,10 @@ var require_main = __commonJS({
|
|
|
358
359
|
}
|
|
359
360
|
});
|
|
360
361
|
|
|
361
|
-
// ../../node_modules/sisteransi/src/index.js
|
|
362
|
-
var require_src2 = __commonJS({
|
|
363
|
-
"../../node_modules/sisteransi/src/index.js"(exports, module) {
|
|
364
|
-
"use strict";
|
|
365
|
-
var ESC = "\x1B";
|
|
366
|
-
var CSI = `${ESC}[`;
|
|
367
|
-
var beep = "\x07";
|
|
368
|
-
var cursor = {
|
|
369
|
-
to(x2, y3) {
|
|
370
|
-
if (!y3) return `${CSI}${x2 + 1}G`;
|
|
371
|
-
return `${CSI}${y3 + 1};${x2 + 1}H`;
|
|
372
|
-
},
|
|
373
|
-
move(x2, y3) {
|
|
374
|
-
let ret = "";
|
|
375
|
-
if (x2 < 0) ret += `${CSI}${-x2}D`;
|
|
376
|
-
else if (x2 > 0) ret += `${CSI}${x2}C`;
|
|
377
|
-
if (y3 < 0) ret += `${CSI}${-y3}A`;
|
|
378
|
-
else if (y3 > 0) ret += `${CSI}${y3}B`;
|
|
379
|
-
return ret;
|
|
380
|
-
},
|
|
381
|
-
up: (count = 1) => `${CSI}${count}A`,
|
|
382
|
-
down: (count = 1) => `${CSI}${count}B`,
|
|
383
|
-
forward: (count = 1) => `${CSI}${count}C`,
|
|
384
|
-
backward: (count = 1) => `${CSI}${count}D`,
|
|
385
|
-
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
386
|
-
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
387
|
-
left: `${CSI}G`,
|
|
388
|
-
hide: `${CSI}?25l`,
|
|
389
|
-
show: `${CSI}?25h`,
|
|
390
|
-
save: `${ESC}7`,
|
|
391
|
-
restore: `${ESC}8`
|
|
392
|
-
};
|
|
393
|
-
var scroll = {
|
|
394
|
-
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
395
|
-
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
396
|
-
};
|
|
397
|
-
var erase = {
|
|
398
|
-
screen: `${CSI}2J`,
|
|
399
|
-
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
400
|
-
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
401
|
-
line: `${CSI}2K`,
|
|
402
|
-
lineEnd: `${CSI}K`,
|
|
403
|
-
lineStart: `${CSI}1K`,
|
|
404
|
-
lines(count) {
|
|
405
|
-
let clear = "";
|
|
406
|
-
for (let i = 0; i < count; i++)
|
|
407
|
-
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
408
|
-
if (count)
|
|
409
|
-
clear += cursor.left;
|
|
410
|
-
return clear;
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
// ../../node_modules/picocolors/picocolors.js
|
|
418
|
-
var require_picocolors = __commonJS({
|
|
419
|
-
"../../node_modules/picocolors/picocolors.js"(exports, module) {
|
|
420
|
-
var p2 = process || {};
|
|
421
|
-
var argv = p2.argv || [];
|
|
422
|
-
var env = p2.env || {};
|
|
423
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
424
|
-
var formatter = (open, close, replace = open) => (input) => {
|
|
425
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
426
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
427
|
-
};
|
|
428
|
-
var replaceClose = (string, close, replace, index) => {
|
|
429
|
-
let result = "", cursor = 0;
|
|
430
|
-
do {
|
|
431
|
-
result += string.substring(cursor, index) + replace;
|
|
432
|
-
cursor = index + close.length;
|
|
433
|
-
index = string.indexOf(close, cursor);
|
|
434
|
-
} while (~index);
|
|
435
|
-
return result + string.substring(cursor);
|
|
436
|
-
};
|
|
437
|
-
var createColors = (enabled = isColorSupported) => {
|
|
438
|
-
let f = enabled ? formatter : () => String;
|
|
439
|
-
return {
|
|
440
|
-
isColorSupported: enabled,
|
|
441
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
442
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
443
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
444
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
445
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
446
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
447
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
448
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
449
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
450
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
451
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
452
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
453
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
454
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
455
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
456
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
457
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
458
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
459
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
460
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
461
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
462
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
463
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
464
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
465
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
466
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
467
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
468
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
469
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
470
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
471
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
472
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
473
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
474
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
475
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
476
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
477
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
478
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
479
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
480
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
481
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
482
|
-
};
|
|
483
|
-
};
|
|
484
|
-
module.exports = createColors();
|
|
485
|
-
module.exports.createColors = createColors;
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
|
|
489
362
|
// ../../node_modules/commander/lib/error.js
|
|
490
363
|
var require_error = __commonJS({
|
|
491
364
|
"../../node_modules/commander/lib/error.js"(exports) {
|
|
365
|
+
"use strict";
|
|
492
366
|
var CommanderError2 = class extends Error {
|
|
493
367
|
/**
|
|
494
368
|
* Constructs the CommanderError class
|
|
@@ -526,6 +400,7 @@ var require_error = __commonJS({
|
|
|
526
400
|
// ../../node_modules/commander/lib/argument.js
|
|
527
401
|
var require_argument = __commonJS({
|
|
528
402
|
"../../node_modules/commander/lib/argument.js"(exports) {
|
|
403
|
+
"use strict";
|
|
529
404
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
530
405
|
var Argument2 = class {
|
|
531
406
|
/**
|
|
@@ -647,6 +522,7 @@ var require_argument = __commonJS({
|
|
|
647
522
|
// ../../node_modules/commander/lib/help.js
|
|
648
523
|
var require_help = __commonJS({
|
|
649
524
|
"../../node_modules/commander/lib/help.js"(exports) {
|
|
525
|
+
"use strict";
|
|
650
526
|
var { humanReadableArgName } = require_argument();
|
|
651
527
|
var Help2 = class {
|
|
652
528
|
constructor() {
|
|
@@ -671,8 +547,8 @@ var require_help = __commonJS({
|
|
|
671
547
|
visibleCommands.push(helpCommand);
|
|
672
548
|
}
|
|
673
549
|
if (this.sortSubcommands) {
|
|
674
|
-
visibleCommands.sort((a,
|
|
675
|
-
return a.name().localeCompare(
|
|
550
|
+
visibleCommands.sort((a, b) => {
|
|
551
|
+
return a.name().localeCompare(b.name());
|
|
676
552
|
});
|
|
677
553
|
}
|
|
678
554
|
return visibleCommands;
|
|
@@ -684,11 +560,11 @@ var require_help = __commonJS({
|
|
|
684
560
|
* @param {Option} b
|
|
685
561
|
* @returns number
|
|
686
562
|
*/
|
|
687
|
-
compareOptions(a,
|
|
563
|
+
compareOptions(a, b) {
|
|
688
564
|
const getSortKey = (option) => {
|
|
689
565
|
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
|
|
690
566
|
};
|
|
691
|
-
return getSortKey(a).localeCompare(getSortKey(
|
|
567
|
+
return getSortKey(a).localeCompare(getSortKey(b));
|
|
692
568
|
}
|
|
693
569
|
/**
|
|
694
570
|
* Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.
|
|
@@ -1029,6 +905,7 @@ var require_help = __commonJS({
|
|
|
1029
905
|
// ../../node_modules/commander/lib/option.js
|
|
1030
906
|
var require_option = __commonJS({
|
|
1031
907
|
"../../node_modules/commander/lib/option.js"(exports) {
|
|
908
|
+
"use strict";
|
|
1032
909
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
1033
910
|
var Option2 = class {
|
|
1034
911
|
/**
|
|
@@ -1300,38 +1177,39 @@ var require_option = __commonJS({
|
|
|
1300
1177
|
// ../../node_modules/commander/lib/suggestSimilar.js
|
|
1301
1178
|
var require_suggestSimilar = __commonJS({
|
|
1302
1179
|
"../../node_modules/commander/lib/suggestSimilar.js"(exports) {
|
|
1180
|
+
"use strict";
|
|
1303
1181
|
var maxDistance = 3;
|
|
1304
|
-
function editDistance(a,
|
|
1305
|
-
if (Math.abs(a.length -
|
|
1306
|
-
const
|
|
1182
|
+
function editDistance(a, b) {
|
|
1183
|
+
if (Math.abs(a.length - b.length) > maxDistance) return Math.max(a.length, b.length);
|
|
1184
|
+
const d = [];
|
|
1307
1185
|
for (let i = 0; i <= a.length; i++) {
|
|
1308
|
-
|
|
1186
|
+
d[i] = [i];
|
|
1309
1187
|
}
|
|
1310
|
-
for (let
|
|
1311
|
-
|
|
1188
|
+
for (let j = 0; j <= b.length; j++) {
|
|
1189
|
+
d[0][j] = j;
|
|
1312
1190
|
}
|
|
1313
|
-
for (let
|
|
1191
|
+
for (let j = 1; j <= b.length; j++) {
|
|
1314
1192
|
for (let i = 1; i <= a.length; i++) {
|
|
1315
1193
|
let cost = 1;
|
|
1316
|
-
if (a[i - 1] ===
|
|
1194
|
+
if (a[i - 1] === b[j - 1]) {
|
|
1317
1195
|
cost = 0;
|
|
1318
1196
|
} else {
|
|
1319
1197
|
cost = 1;
|
|
1320
1198
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1199
|
+
d[i][j] = Math.min(
|
|
1200
|
+
d[i - 1][j] + 1,
|
|
1323
1201
|
// deletion
|
|
1324
|
-
|
|
1202
|
+
d[i][j - 1] + 1,
|
|
1325
1203
|
// insertion
|
|
1326
|
-
|
|
1204
|
+
d[i - 1][j - 1] + cost
|
|
1327
1205
|
// substitution
|
|
1328
1206
|
);
|
|
1329
|
-
if (i > 1 &&
|
|
1330
|
-
|
|
1207
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
1208
|
+
d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
|
|
1331
1209
|
}
|
|
1332
1210
|
}
|
|
1333
1211
|
}
|
|
1334
|
-
return
|
|
1212
|
+
return d[a.length][b.length];
|
|
1335
1213
|
}
|
|
1336
1214
|
function suggestSimilar(word, candidates) {
|
|
1337
1215
|
if (!candidates || candidates.length === 0) return "";
|
|
@@ -1358,7 +1236,7 @@ var require_suggestSimilar = __commonJS({
|
|
|
1358
1236
|
}
|
|
1359
1237
|
}
|
|
1360
1238
|
});
|
|
1361
|
-
similar.sort((a,
|
|
1239
|
+
similar.sort((a, b) => a.localeCompare(b));
|
|
1362
1240
|
if (searchingOptions) {
|
|
1363
1241
|
similar = similar.map((candidate) => `--${candidate}`);
|
|
1364
1242
|
}
|
|
@@ -1379,10 +1257,11 @@ var require_suggestSimilar = __commonJS({
|
|
|
1379
1257
|
// ../../node_modules/commander/lib/command.js
|
|
1380
1258
|
var require_command = __commonJS({
|
|
1381
1259
|
"../../node_modules/commander/lib/command.js"(exports) {
|
|
1260
|
+
"use strict";
|
|
1382
1261
|
var EventEmitter = __require("events").EventEmitter;
|
|
1383
1262
|
var childProcess = __require("child_process");
|
|
1384
|
-
var
|
|
1385
|
-
var
|
|
1263
|
+
var path19 = __require("path");
|
|
1264
|
+
var fs11 = __require("fs");
|
|
1386
1265
|
var process2 = __require("process");
|
|
1387
1266
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1388
1267
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1896,8 +1775,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1896
1775
|
} else if (fn instanceof RegExp) {
|
|
1897
1776
|
const regex = fn;
|
|
1898
1777
|
fn = (val, def) => {
|
|
1899
|
-
const
|
|
1900
|
-
return
|
|
1778
|
+
const m = regex.exec(val);
|
|
1779
|
+
return m ? m[0] : def;
|
|
1901
1780
|
};
|
|
1902
1781
|
option.default(defaultValue).argParser(fn);
|
|
1903
1782
|
} else {
|
|
@@ -2209,10 +2088,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2209
2088
|
let launchWithNode = false;
|
|
2210
2089
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2211
2090
|
function findFile(baseDir, baseName) {
|
|
2212
|
-
const localBin =
|
|
2213
|
-
if (
|
|
2214
|
-
if (sourceExt.includes(
|
|
2215
|
-
const foundExt = sourceExt.find((ext) =>
|
|
2091
|
+
const localBin = path19.resolve(baseDir, baseName);
|
|
2092
|
+
if (fs11.existsSync(localBin)) return localBin;
|
|
2093
|
+
if (sourceExt.includes(path19.extname(baseName))) return void 0;
|
|
2094
|
+
const foundExt = sourceExt.find((ext) => fs11.existsSync(`${localBin}${ext}`));
|
|
2216
2095
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2217
2096
|
return void 0;
|
|
2218
2097
|
}
|
|
@@ -2223,23 +2102,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2223
2102
|
if (this._scriptPath) {
|
|
2224
2103
|
let resolvedScriptPath;
|
|
2225
2104
|
try {
|
|
2226
|
-
resolvedScriptPath =
|
|
2105
|
+
resolvedScriptPath = fs11.realpathSync(this._scriptPath);
|
|
2227
2106
|
} catch (err) {
|
|
2228
2107
|
resolvedScriptPath = this._scriptPath;
|
|
2229
2108
|
}
|
|
2230
|
-
executableDir =
|
|
2109
|
+
executableDir = path19.resolve(path19.dirname(resolvedScriptPath), executableDir);
|
|
2231
2110
|
}
|
|
2232
2111
|
if (executableDir) {
|
|
2233
2112
|
let localFile = findFile(executableDir, executableFile);
|
|
2234
2113
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2235
|
-
const legacyName =
|
|
2114
|
+
const legacyName = path19.basename(this._scriptPath, path19.extname(this._scriptPath));
|
|
2236
2115
|
if (legacyName !== this._name) {
|
|
2237
2116
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
2238
2117
|
}
|
|
2239
2118
|
}
|
|
2240
2119
|
executableFile = localFile || executableFile;
|
|
2241
2120
|
}
|
|
2242
|
-
launchWithNode = sourceExt.includes(
|
|
2121
|
+
launchWithNode = sourceExt.includes(path19.extname(executableFile));
|
|
2243
2122
|
let proc;
|
|
2244
2123
|
if (process2.platform !== "win32") {
|
|
2245
2124
|
if (launchWithNode) {
|
|
@@ -2357,8 +2236,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2357
2236
|
if (index < this.args.length) {
|
|
2358
2237
|
value = this.args.slice(index);
|
|
2359
2238
|
if (declaredArg.parseArg) {
|
|
2360
|
-
value = value.reduce((processed,
|
|
2361
|
-
return myParseArg(declaredArg,
|
|
2239
|
+
value = value.reduce((processed, v) => {
|
|
2240
|
+
return myParseArg(declaredArg, v, processed);
|
|
2362
2241
|
}, declaredArg.defaultValue);
|
|
2363
2242
|
}
|
|
2364
2243
|
} else if (value === void 0) {
|
|
@@ -3015,7 +2894,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3015
2894
|
* @return {Command}
|
|
3016
2895
|
*/
|
|
3017
2896
|
nameFromFilename(filename) {
|
|
3018
|
-
this._name =
|
|
2897
|
+
this._name = path19.basename(filename, path19.extname(filename));
|
|
3019
2898
|
return this;
|
|
3020
2899
|
}
|
|
3021
2900
|
/**
|
|
@@ -3029,9 +2908,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3029
2908
|
* @param {string} [path]
|
|
3030
2909
|
* @return {string|Command}
|
|
3031
2910
|
*/
|
|
3032
|
-
executableDir(
|
|
3033
|
-
if (
|
|
3034
|
-
this._executableDir =
|
|
2911
|
+
executableDir(path20) {
|
|
2912
|
+
if (path20 === void 0) return this._executableDir;
|
|
2913
|
+
this._executableDir = path20;
|
|
3035
2914
|
return this;
|
|
3036
2915
|
}
|
|
3037
2916
|
/**
|
|
@@ -3137,7 +3016,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3137
3016
|
* @param {string | Function} text - string to add, or a function returning a string
|
|
3138
3017
|
* @return {Command} `this` command for chaining
|
|
3139
3018
|
*/
|
|
3140
|
-
addHelpText(position,
|
|
3019
|
+
addHelpText(position, text5) {
|
|
3141
3020
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
3142
3021
|
if (!allowedValues.includes(position)) {
|
|
3143
3022
|
throw new Error(`Unexpected value for position to addHelpText.
|
|
@@ -3146,10 +3025,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3146
3025
|
const helpEvent = `${position}Help`;
|
|
3147
3026
|
this.on(helpEvent, (context) => {
|
|
3148
3027
|
let helpStr;
|
|
3149
|
-
if (typeof
|
|
3150
|
-
helpStr =
|
|
3028
|
+
if (typeof text5 === "function") {
|
|
3029
|
+
helpStr = text5({ error: context.error, command: context.command });
|
|
3151
3030
|
} else {
|
|
3152
|
-
helpStr =
|
|
3031
|
+
helpStr = text5;
|
|
3153
3032
|
}
|
|
3154
3033
|
if (helpStr) {
|
|
3155
3034
|
context.write(`${helpStr}
|
|
@@ -3209,6 +3088,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3209
3088
|
// ../../node_modules/commander/index.js
|
|
3210
3089
|
var require_commander = __commonJS({
|
|
3211
3090
|
"../../node_modules/commander/index.js"(exports, module) {
|
|
3091
|
+
"use strict";
|
|
3212
3092
|
var { Argument: Argument2 } = require_argument();
|
|
3213
3093
|
var { Command: Command2 } = require_command();
|
|
3214
3094
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
@@ -3232,13 +3112,13 @@ var require_filesystem = __commonJS({
|
|
|
3232
3112
|
"use strict";
|
|
3233
3113
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3234
3114
|
exports.removeExtension = exports.fileExistsAsync = exports.readJsonFromDiskAsync = exports.readJsonFromDiskSync = exports.fileExistsSync = void 0;
|
|
3235
|
-
var
|
|
3236
|
-
function fileExistsSync(
|
|
3237
|
-
if (!
|
|
3115
|
+
var fs11 = __require("fs");
|
|
3116
|
+
function fileExistsSync(path19) {
|
|
3117
|
+
if (!fs11.existsSync(path19)) {
|
|
3238
3118
|
return false;
|
|
3239
3119
|
}
|
|
3240
3120
|
try {
|
|
3241
|
-
var stats =
|
|
3121
|
+
var stats = fs11.statSync(path19);
|
|
3242
3122
|
return stats.isFile();
|
|
3243
3123
|
} catch (err) {
|
|
3244
3124
|
return false;
|
|
@@ -3246,14 +3126,14 @@ var require_filesystem = __commonJS({
|
|
|
3246
3126
|
}
|
|
3247
3127
|
exports.fileExistsSync = fileExistsSync;
|
|
3248
3128
|
function readJsonFromDiskSync(packageJsonPath) {
|
|
3249
|
-
if (!
|
|
3129
|
+
if (!fs11.existsSync(packageJsonPath)) {
|
|
3250
3130
|
return void 0;
|
|
3251
3131
|
}
|
|
3252
3132
|
return __require(packageJsonPath);
|
|
3253
3133
|
}
|
|
3254
3134
|
exports.readJsonFromDiskSync = readJsonFromDiskSync;
|
|
3255
|
-
function readJsonFromDiskAsync(
|
|
3256
|
-
|
|
3135
|
+
function readJsonFromDiskAsync(path19, callback) {
|
|
3136
|
+
fs11.readFile(path19, "utf8", function(err, result) {
|
|
3257
3137
|
if (err || !result) {
|
|
3258
3138
|
return callback();
|
|
3259
3139
|
}
|
|
@@ -3263,7 +3143,7 @@ var require_filesystem = __commonJS({
|
|
|
3263
3143
|
}
|
|
3264
3144
|
exports.readJsonFromDiskAsync = readJsonFromDiskAsync;
|
|
3265
3145
|
function fileExistsAsync(path22, callback2) {
|
|
3266
|
-
|
|
3146
|
+
fs11.stat(path22, function(err, stats) {
|
|
3267
3147
|
if (err) {
|
|
3268
3148
|
return callback2(void 0, false);
|
|
3269
3149
|
}
|
|
@@ -3271,8 +3151,8 @@ var require_filesystem = __commonJS({
|
|
|
3271
3151
|
});
|
|
3272
3152
|
}
|
|
3273
3153
|
exports.fileExistsAsync = fileExistsAsync;
|
|
3274
|
-
function removeExtension(
|
|
3275
|
-
return
|
|
3154
|
+
function removeExtension(path19) {
|
|
3155
|
+
return path19.substring(0, path19.lastIndexOf(".")) || path19;
|
|
3276
3156
|
}
|
|
3277
3157
|
exports.removeExtension = removeExtension;
|
|
3278
3158
|
}
|
|
@@ -3284,7 +3164,7 @@ var require_mapping_entry = __commonJS({
|
|
|
3284
3164
|
"use strict";
|
|
3285
3165
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3286
3166
|
exports.getAbsoluteMappingEntries = void 0;
|
|
3287
|
-
var
|
|
3167
|
+
var path19 = __require("path");
|
|
3288
3168
|
function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
|
|
3289
3169
|
var sortedKeys = sortByLongestPrefix(Object.keys(paths));
|
|
3290
3170
|
var absolutePaths = [];
|
|
@@ -3293,7 +3173,7 @@ var require_mapping_entry = __commonJS({
|
|
|
3293
3173
|
absolutePaths.push({
|
|
3294
3174
|
pattern: key2,
|
|
3295
3175
|
paths: paths[key2].map(function(pathToResolve) {
|
|
3296
|
-
return
|
|
3176
|
+
return path19.resolve(absoluteBaseUrl, pathToResolve);
|
|
3297
3177
|
})
|
|
3298
3178
|
});
|
|
3299
3179
|
}
|
|
@@ -3307,8 +3187,8 @@ var require_mapping_entry = __commonJS({
|
|
|
3307
3187
|
}
|
|
3308
3188
|
exports.getAbsoluteMappingEntries = getAbsoluteMappingEntries;
|
|
3309
3189
|
function sortByLongestPrefix(arr) {
|
|
3310
|
-
return arr.concat().sort(function(a,
|
|
3311
|
-
return getPrefixLength(
|
|
3190
|
+
return arr.concat().sort(function(a, b) {
|
|
3191
|
+
return getPrefixLength(b) - getPrefixLength(a);
|
|
3312
3192
|
});
|
|
3313
3193
|
}
|
|
3314
3194
|
function getPrefixLength(pattern) {
|
|
@@ -3324,7 +3204,7 @@ var require_try_path = __commonJS({
|
|
|
3324
3204
|
"use strict";
|
|
3325
3205
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3326
3206
|
exports.exhaustiveTypeException = exports.getStrippedPath = exports.getPathsToTry = void 0;
|
|
3327
|
-
var
|
|
3207
|
+
var path19 = __require("path");
|
|
3328
3208
|
var path_1 = __require("path");
|
|
3329
3209
|
var filesystem_1 = require_filesystem();
|
|
3330
3210
|
function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
|
|
@@ -3339,16 +3219,16 @@ var require_try_path = __commonJS({
|
|
|
3339
3219
|
var _loop_1 = function(physicalPathPattern2) {
|
|
3340
3220
|
var physicalPath = physicalPathPattern2.replace("*", starMatch);
|
|
3341
3221
|
pathsToTry.push({ type: "file", path: physicalPath });
|
|
3342
|
-
pathsToTry.push.apply(pathsToTry, extensions.map(function(
|
|
3343
|
-
return { type: "extension", path: physicalPath +
|
|
3222
|
+
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
|
|
3223
|
+
return { type: "extension", path: physicalPath + e };
|
|
3344
3224
|
}));
|
|
3345
3225
|
pathsToTry.push({
|
|
3346
3226
|
type: "package",
|
|
3347
|
-
path:
|
|
3227
|
+
path: path19.join(physicalPath, "/package.json")
|
|
3348
3228
|
});
|
|
3349
|
-
var indexPath =
|
|
3350
|
-
pathsToTry.push.apply(pathsToTry, extensions.map(function(
|
|
3351
|
-
return { type: "index", path: indexPath +
|
|
3229
|
+
var indexPath = path19.join(physicalPath, "/index");
|
|
3230
|
+
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
|
|
3231
|
+
return { type: "index", path: indexPath + e };
|
|
3352
3232
|
}));
|
|
3353
3233
|
};
|
|
3354
3234
|
for (var _a = 0, _b = entry.paths; _a < _b.length; _a++) {
|
|
@@ -3398,7 +3278,7 @@ var require_match_path_sync = __commonJS({
|
|
|
3398
3278
|
"use strict";
|
|
3399
3279
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3400
3280
|
exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
|
|
3401
|
-
var
|
|
3281
|
+
var path19 = __require("path");
|
|
3402
3282
|
var Filesystem = require_filesystem();
|
|
3403
3283
|
var MappingEntry = require_mapping_entry();
|
|
3404
3284
|
var TryPath = require_try_path();
|
|
@@ -3442,7 +3322,7 @@ var require_match_path_sync = __commonJS({
|
|
|
3442
3322
|
return obj[key2];
|
|
3443
3323
|
}, packageJson);
|
|
3444
3324
|
if (candidateMapping && typeof candidateMapping === "string") {
|
|
3445
|
-
var candidateFilePath =
|
|
3325
|
+
var candidateFilePath = path19.join(path19.dirname(packageJsonPath), candidateMapping);
|
|
3446
3326
|
if (fileExists2(candidateFilePath)) {
|
|
3447
3327
|
return candidateFilePath;
|
|
3448
3328
|
}
|
|
@@ -3486,7 +3366,7 @@ var require_match_path_async = __commonJS({
|
|
|
3486
3366
|
"use strict";
|
|
3487
3367
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3488
3368
|
exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = void 0;
|
|
3489
|
-
var
|
|
3369
|
+
var path19 = __require("path");
|
|
3490
3370
|
var TryPath = require_try_path();
|
|
3491
3371
|
var MappingEntry = require_mapping_entry();
|
|
3492
3372
|
var Filesystem = require_filesystem();
|
|
@@ -3540,7 +3420,7 @@ var require_match_path_async = __commonJS({
|
|
|
3540
3420
|
if (typeof mainFieldMapping !== "string") {
|
|
3541
3421
|
return tryNext();
|
|
3542
3422
|
}
|
|
3543
|
-
var mappedFilePath =
|
|
3423
|
+
var mappedFilePath = path19.join(path19.dirname(packageJsonPath), mainFieldMapping);
|
|
3544
3424
|
fileExistsAsync(mappedFilePath, function(err, exists) {
|
|
3545
3425
|
if (err) {
|
|
3546
3426
|
return doneCallback(err);
|
|
@@ -3598,8 +3478,8 @@ var require_match_path_async = __commonJS({
|
|
|
3598
3478
|
});
|
|
3599
3479
|
|
|
3600
3480
|
// ../../node_modules/json5/dist/index.mjs
|
|
3601
|
-
var
|
|
3602
|
-
__export(
|
|
3481
|
+
var dist_exports = {};
|
|
3482
|
+
__export(dist_exports, {
|
|
3603
3483
|
default: () => dist_default
|
|
3604
3484
|
});
|
|
3605
3485
|
function internalize(holder, name, reviver) {
|
|
@@ -3681,8 +3561,8 @@ function newToken(type, value) {
|
|
|
3681
3561
|
}
|
|
3682
3562
|
function literal(s) {
|
|
3683
3563
|
for (const c2 of s) {
|
|
3684
|
-
const
|
|
3685
|
-
if (
|
|
3564
|
+
const p = peek();
|
|
3565
|
+
if (p !== c2) {
|
|
3686
3566
|
throw invalidChar(read());
|
|
3687
3567
|
}
|
|
3688
3568
|
read();
|
|
@@ -3886,6 +3766,7 @@ function syntaxError(message) {
|
|
|
3886
3766
|
var Space_Separator, ID_Start, ID_Continue, unicode, util, source, parseState, stack, pos, line, column, token, key, root, parse, lexState, buffer, doubleQuote, sign, c, lexStates, parseStates, stringify, JSON5, lib, dist_default;
|
|
3887
3767
|
var init_dist = __esm({
|
|
3888
3768
|
"../../node_modules/json5/dist/index.mjs"() {
|
|
3769
|
+
"use strict";
|
|
3889
3770
|
Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
3890
3771
|
ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
|
|
3891
3772
|
ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
|
|
@@ -3911,8 +3792,8 @@ var init_dist = __esm({
|
|
|
3911
3792
|
return typeof c2 === "string" && /[0-9A-Fa-f]/.test(c2);
|
|
3912
3793
|
}
|
|
3913
3794
|
};
|
|
3914
|
-
parse = function parse2(
|
|
3915
|
-
source = String(
|
|
3795
|
+
parse = function parse2(text5, reviver) {
|
|
3796
|
+
source = String(text5);
|
|
3916
3797
|
parseState = "start";
|
|
3917
3798
|
stack = [];
|
|
3918
3799
|
pos = 0;
|
|
@@ -4079,18 +3960,18 @@ var init_dist = __esm({
|
|
|
4079
3960
|
throw invalidChar(read());
|
|
4080
3961
|
}
|
|
4081
3962
|
read();
|
|
4082
|
-
const
|
|
4083
|
-
switch (
|
|
3963
|
+
const u = unicodeEscape();
|
|
3964
|
+
switch (u) {
|
|
4084
3965
|
case "$":
|
|
4085
3966
|
case "_":
|
|
4086
3967
|
break;
|
|
4087
3968
|
default:
|
|
4088
|
-
if (!util.isIdStartChar(
|
|
3969
|
+
if (!util.isIdStartChar(u)) {
|
|
4089
3970
|
throw invalidIdentifier();
|
|
4090
3971
|
}
|
|
4091
3972
|
break;
|
|
4092
3973
|
}
|
|
4093
|
-
buffer +=
|
|
3974
|
+
buffer += u;
|
|
4094
3975
|
lexState = "identifierName";
|
|
4095
3976
|
},
|
|
4096
3977
|
identifierName() {
|
|
@@ -4117,20 +3998,20 @@ var init_dist = __esm({
|
|
|
4117
3998
|
throw invalidChar(read());
|
|
4118
3999
|
}
|
|
4119
4000
|
read();
|
|
4120
|
-
const
|
|
4121
|
-
switch (
|
|
4001
|
+
const u = unicodeEscape();
|
|
4002
|
+
switch (u) {
|
|
4122
4003
|
case "$":
|
|
4123
4004
|
case "_":
|
|
4124
4005
|
case "\u200C":
|
|
4125
4006
|
case "\u200D":
|
|
4126
4007
|
break;
|
|
4127
4008
|
default:
|
|
4128
|
-
if (!util.isIdContinueChar(
|
|
4009
|
+
if (!util.isIdContinueChar(u)) {
|
|
4129
4010
|
throw invalidIdentifier();
|
|
4130
4011
|
}
|
|
4131
4012
|
break;
|
|
4132
4013
|
}
|
|
4133
|
-
buffer +=
|
|
4014
|
+
buffer += u;
|
|
4134
4015
|
lexState = "identifierName";
|
|
4135
4016
|
},
|
|
4136
4017
|
sign() {
|
|
@@ -4472,12 +4353,12 @@ var init_dist = __esm({
|
|
|
4472
4353
|
replacerFunc = replacer;
|
|
4473
4354
|
} else if (Array.isArray(replacer)) {
|
|
4474
4355
|
propertyList = [];
|
|
4475
|
-
for (const
|
|
4356
|
+
for (const v of replacer) {
|
|
4476
4357
|
let item;
|
|
4477
|
-
if (typeof
|
|
4478
|
-
item =
|
|
4479
|
-
} else if (typeof
|
|
4480
|
-
item = String(
|
|
4358
|
+
if (typeof v === "string") {
|
|
4359
|
+
item = v;
|
|
4360
|
+
} else if (typeof v === "number" || v instanceof String || v instanceof Number) {
|
|
4361
|
+
item = String(v);
|
|
4481
4362
|
}
|
|
4482
4363
|
if (item !== void 0 && propertyList.indexOf(item) < 0) {
|
|
4483
4364
|
propertyList.push(item);
|
|
@@ -4581,7 +4462,7 @@ var init_dist = __esm({
|
|
|
4581
4462
|
}
|
|
4582
4463
|
product += c2;
|
|
4583
4464
|
}
|
|
4584
|
-
const quoteChar = quote || Object.keys(quotes).reduce((a,
|
|
4465
|
+
const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
|
|
4585
4466
|
product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
|
|
4586
4467
|
return quoteChar + product + quoteChar;
|
|
4587
4468
|
}
|
|
@@ -4681,14 +4562,14 @@ var init_dist = __esm({
|
|
|
4681
4562
|
var require_strip_bom = __commonJS({
|
|
4682
4563
|
"../../node_modules/strip-bom/index.js"(exports, module) {
|
|
4683
4564
|
"use strict";
|
|
4684
|
-
module.exports = (
|
|
4685
|
-
if (typeof
|
|
4686
|
-
throw new TypeError("Expected a string, got " + typeof
|
|
4565
|
+
module.exports = (x) => {
|
|
4566
|
+
if (typeof x !== "string") {
|
|
4567
|
+
throw new TypeError("Expected a string, got " + typeof x);
|
|
4687
4568
|
}
|
|
4688
|
-
if (
|
|
4689
|
-
return
|
|
4569
|
+
if (x.charCodeAt(0) === 65279) {
|
|
4570
|
+
return x.slice(1);
|
|
4690
4571
|
}
|
|
4691
|
-
return
|
|
4572
|
+
return x;
|
|
4692
4573
|
};
|
|
4693
4574
|
}
|
|
4694
4575
|
});
|
|
@@ -4701,8 +4582,8 @@ var require_tsconfig_loader = __commonJS({
|
|
|
4701
4582
|
__assign = Object.assign || function(t) {
|
|
4702
4583
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4703
4584
|
s = arguments[i];
|
|
4704
|
-
for (var
|
|
4705
|
-
t[
|
|
4585
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
4586
|
+
t[p] = s[p];
|
|
4706
4587
|
}
|
|
4707
4588
|
return t;
|
|
4708
4589
|
};
|
|
@@ -4710,9 +4591,9 @@ var require_tsconfig_loader = __commonJS({
|
|
|
4710
4591
|
};
|
|
4711
4592
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4712
4593
|
exports.loadTsconfig = exports.walkForTsConfig = exports.tsConfigLoader = void 0;
|
|
4713
|
-
var
|
|
4714
|
-
var
|
|
4715
|
-
var JSON52 = (init_dist(), __toCommonJS(
|
|
4594
|
+
var path19 = __require("path");
|
|
4595
|
+
var fs11 = __require("fs");
|
|
4596
|
+
var JSON52 = (init_dist(), __toCommonJS(dist_exports));
|
|
4716
4597
|
var StripBom = require_strip_bom();
|
|
4717
4598
|
function tsConfigLoader(_a) {
|
|
4718
4599
|
var getEnv = _a.getEnv, cwd = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b;
|
|
@@ -4740,83 +4621,83 @@ var require_tsconfig_loader = __commonJS({
|
|
|
4740
4621
|
}
|
|
4741
4622
|
function resolveConfigPath(cwd, filename) {
|
|
4742
4623
|
if (filename) {
|
|
4743
|
-
var absolutePath =
|
|
4624
|
+
var absolutePath = fs11.lstatSync(filename).isDirectory() ? path19.resolve(filename, "./tsconfig.json") : path19.resolve(cwd, filename);
|
|
4744
4625
|
return absolutePath;
|
|
4745
4626
|
}
|
|
4746
|
-
if (
|
|
4747
|
-
return
|
|
4627
|
+
if (fs11.statSync(cwd).isFile()) {
|
|
4628
|
+
return path19.resolve(cwd);
|
|
4748
4629
|
}
|
|
4749
4630
|
var configAbsolutePath = walkForTsConfig(cwd);
|
|
4750
|
-
return configAbsolutePath ?
|
|
4631
|
+
return configAbsolutePath ? path19.resolve(configAbsolutePath) : void 0;
|
|
4751
4632
|
}
|
|
4752
4633
|
function walkForTsConfig(directory, readdirSync3) {
|
|
4753
4634
|
if (readdirSync3 === void 0) {
|
|
4754
|
-
readdirSync3 =
|
|
4635
|
+
readdirSync3 = fs11.readdirSync;
|
|
4755
4636
|
}
|
|
4756
4637
|
var files = readdirSync3(directory);
|
|
4757
4638
|
var filesToCheck = ["tsconfig.json", "jsconfig.json"];
|
|
4758
4639
|
for (var _i = 0, filesToCheck_1 = filesToCheck; _i < filesToCheck_1.length; _i++) {
|
|
4759
4640
|
var fileToCheck = filesToCheck_1[_i];
|
|
4760
4641
|
if (files.indexOf(fileToCheck) !== -1) {
|
|
4761
|
-
return
|
|
4642
|
+
return path19.join(directory, fileToCheck);
|
|
4762
4643
|
}
|
|
4763
4644
|
}
|
|
4764
|
-
var parentDirectory =
|
|
4645
|
+
var parentDirectory = path19.dirname(directory);
|
|
4765
4646
|
if (directory === parentDirectory) {
|
|
4766
4647
|
return void 0;
|
|
4767
4648
|
}
|
|
4768
4649
|
return walkForTsConfig(parentDirectory, readdirSync3);
|
|
4769
4650
|
}
|
|
4770
4651
|
exports.walkForTsConfig = walkForTsConfig;
|
|
4771
|
-
function loadTsconfig(configFilePath,
|
|
4772
|
-
if (
|
|
4773
|
-
|
|
4652
|
+
function loadTsconfig(configFilePath, existsSync16, readFileSync9) {
|
|
4653
|
+
if (existsSync16 === void 0) {
|
|
4654
|
+
existsSync16 = fs11.existsSync;
|
|
4774
4655
|
}
|
|
4775
|
-
if (
|
|
4776
|
-
|
|
4777
|
-
return
|
|
4656
|
+
if (readFileSync9 === void 0) {
|
|
4657
|
+
readFileSync9 = function(filename) {
|
|
4658
|
+
return fs11.readFileSync(filename, "utf8");
|
|
4778
4659
|
};
|
|
4779
4660
|
}
|
|
4780
|
-
if (!
|
|
4661
|
+
if (!existsSync16(configFilePath)) {
|
|
4781
4662
|
return void 0;
|
|
4782
4663
|
}
|
|
4783
|
-
var configString =
|
|
4664
|
+
var configString = readFileSync9(configFilePath);
|
|
4784
4665
|
var cleanedJson = StripBom(configString);
|
|
4785
4666
|
var config;
|
|
4786
4667
|
try {
|
|
4787
4668
|
config = JSON52.parse(cleanedJson);
|
|
4788
|
-
} catch (
|
|
4789
|
-
throw new Error("".concat(configFilePath, " is malformed ").concat(
|
|
4669
|
+
} catch (e) {
|
|
4670
|
+
throw new Error("".concat(configFilePath, " is malformed ").concat(e.message));
|
|
4790
4671
|
}
|
|
4791
4672
|
var extendedConfig = config.extends;
|
|
4792
4673
|
if (extendedConfig) {
|
|
4793
4674
|
var base = void 0;
|
|
4794
4675
|
if (Array.isArray(extendedConfig)) {
|
|
4795
4676
|
base = extendedConfig.reduce(function(currBase, extendedConfigElement) {
|
|
4796
|
-
return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement,
|
|
4677
|
+
return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement, existsSync16, readFileSync9));
|
|
4797
4678
|
}, {});
|
|
4798
4679
|
} else {
|
|
4799
|
-
base = loadTsconfigFromExtends(configFilePath, extendedConfig,
|
|
4680
|
+
base = loadTsconfigFromExtends(configFilePath, extendedConfig, existsSync16, readFileSync9);
|
|
4800
4681
|
}
|
|
4801
4682
|
return mergeTsconfigs(base, config);
|
|
4802
4683
|
}
|
|
4803
4684
|
return config;
|
|
4804
4685
|
}
|
|
4805
4686
|
exports.loadTsconfig = loadTsconfig;
|
|
4806
|
-
function loadTsconfigFromExtends(configFilePath, extendedConfigValue,
|
|
4687
|
+
function loadTsconfigFromExtends(configFilePath, extendedConfigValue, existsSync16, readFileSync9) {
|
|
4807
4688
|
var _a;
|
|
4808
4689
|
if (typeof extendedConfigValue === "string" && extendedConfigValue.indexOf(".json") === -1) {
|
|
4809
4690
|
extendedConfigValue += ".json";
|
|
4810
4691
|
}
|
|
4811
|
-
var currentDir =
|
|
4812
|
-
var extendedConfigPath =
|
|
4813
|
-
if (extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !
|
|
4814
|
-
extendedConfigPath =
|
|
4692
|
+
var currentDir = path19.dirname(configFilePath);
|
|
4693
|
+
var extendedConfigPath = path19.join(currentDir, extendedConfigValue);
|
|
4694
|
+
if (extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !existsSync16(extendedConfigPath)) {
|
|
4695
|
+
extendedConfigPath = path19.join(currentDir, "node_modules", extendedConfigValue);
|
|
4815
4696
|
}
|
|
4816
|
-
var config = loadTsconfig(extendedConfigPath,
|
|
4697
|
+
var config = loadTsconfig(extendedConfigPath, existsSync16, readFileSync9) || {};
|
|
4817
4698
|
if ((_a = config.compilerOptions) === null || _a === void 0 ? void 0 : _a.baseUrl) {
|
|
4818
|
-
var extendsDir =
|
|
4819
|
-
config.compilerOptions.baseUrl =
|
|
4699
|
+
var extendsDir = path19.dirname(extendedConfigValue);
|
|
4700
|
+
config.compilerOptions.baseUrl = path19.join(extendsDir, config.compilerOptions.baseUrl);
|
|
4820
4701
|
}
|
|
4821
4702
|
return config;
|
|
4822
4703
|
}
|
|
@@ -4835,7 +4716,7 @@ var require_config_loader = __commonJS({
|
|
|
4835
4716
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4836
4717
|
exports.configLoader = exports.loadConfig = void 0;
|
|
4837
4718
|
var TsConfigLoader2 = require_tsconfig_loader();
|
|
4838
|
-
var
|
|
4719
|
+
var path19 = __require("path");
|
|
4839
4720
|
function loadConfig2(cwd) {
|
|
4840
4721
|
if (cwd === void 0) {
|
|
4841
4722
|
cwd = process.cwd();
|
|
@@ -4846,7 +4727,7 @@ var require_config_loader = __commonJS({
|
|
|
4846
4727
|
function configLoader(_a) {
|
|
4847
4728
|
var cwd = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader2.tsConfigLoader : _b;
|
|
4848
4729
|
if (explicitParams) {
|
|
4849
|
-
var absoluteBaseUrl =
|
|
4730
|
+
var absoluteBaseUrl = path19.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path19.join(cwd, explicitParams.baseUrl);
|
|
4850
4731
|
return {
|
|
4851
4732
|
resultType: "success",
|
|
4852
4733
|
configFileAbsolutePath: "",
|
|
@@ -4873,7 +4754,7 @@ var require_config_loader = __commonJS({
|
|
|
4873
4754
|
resultType: "success",
|
|
4874
4755
|
configFileAbsolutePath: loadResult.tsConfigPath,
|
|
4875
4756
|
baseUrl: loadResult.baseUrl,
|
|
4876
|
-
absoluteBaseUrl:
|
|
4757
|
+
absoluteBaseUrl: path19.resolve(path19.dirname(loadResult.tsConfigPath), loadResult.baseUrl || ""),
|
|
4877
4758
|
paths: loadResult.paths || {},
|
|
4878
4759
|
addMatchAll: loadResult.baseUrl !== void 0
|
|
4879
4760
|
};
|
|
@@ -4887,21 +4768,21 @@ var require_minimist = __commonJS({
|
|
|
4887
4768
|
"../../node_modules/minimist/index.js"(exports, module) {
|
|
4888
4769
|
"use strict";
|
|
4889
4770
|
function hasKey(obj, keys) {
|
|
4890
|
-
var
|
|
4771
|
+
var o = obj;
|
|
4891
4772
|
keys.slice(0, -1).forEach(function(key3) {
|
|
4892
|
-
|
|
4773
|
+
o = o[key3] || {};
|
|
4893
4774
|
});
|
|
4894
4775
|
var key2 = keys[keys.length - 1];
|
|
4895
|
-
return key2 in
|
|
4776
|
+
return key2 in o;
|
|
4896
4777
|
}
|
|
4897
|
-
function isNumber(
|
|
4898
|
-
if (typeof
|
|
4778
|
+
function isNumber(x) {
|
|
4779
|
+
if (typeof x === "number") {
|
|
4899
4780
|
return true;
|
|
4900
4781
|
}
|
|
4901
|
-
if (/^0x[0-9a-f]+$/i.test(
|
|
4782
|
+
if (/^0x[0-9a-f]+$/i.test(x)) {
|
|
4902
4783
|
return true;
|
|
4903
4784
|
}
|
|
4904
|
-
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(
|
|
4785
|
+
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
4905
4786
|
}
|
|
4906
4787
|
function isConstructorOrProto(obj, key2) {
|
|
4907
4788
|
return key2 === "constructor" && typeof obj[key2] === "function" || key2 === "__proto__";
|
|
@@ -4927,23 +4808,23 @@ var require_minimist = __commonJS({
|
|
|
4927
4808
|
}
|
|
4928
4809
|
var aliases = {};
|
|
4929
4810
|
function aliasIsBoolean(key3) {
|
|
4930
|
-
return aliases[key3].some(function(
|
|
4931
|
-
return flags.bools[
|
|
4811
|
+
return aliases[key3].some(function(x) {
|
|
4812
|
+
return flags.bools[x];
|
|
4932
4813
|
});
|
|
4933
4814
|
}
|
|
4934
4815
|
Object.keys(opts.alias || {}).forEach(function(key3) {
|
|
4935
4816
|
aliases[key3] = [].concat(opts.alias[key3]);
|
|
4936
|
-
aliases[key3].forEach(function(
|
|
4937
|
-
aliases[
|
|
4938
|
-
return
|
|
4817
|
+
aliases[key3].forEach(function(x) {
|
|
4818
|
+
aliases[x] = [key3].concat(aliases[key3].filter(function(y) {
|
|
4819
|
+
return x !== y;
|
|
4939
4820
|
}));
|
|
4940
4821
|
});
|
|
4941
4822
|
});
|
|
4942
4823
|
[].concat(opts.string).filter(Boolean).forEach(function(key3) {
|
|
4943
4824
|
flags.strings[key3] = true;
|
|
4944
4825
|
if (aliases[key3]) {
|
|
4945
|
-
[].concat(aliases[key3]).forEach(function(
|
|
4946
|
-
flags.strings[
|
|
4826
|
+
[].concat(aliases[key3]).forEach(function(k) {
|
|
4827
|
+
flags.strings[k] = true;
|
|
4947
4828
|
});
|
|
4948
4829
|
}
|
|
4949
4830
|
});
|
|
@@ -4953,39 +4834,39 @@ var require_minimist = __commonJS({
|
|
|
4953
4834
|
return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key3] || flags.bools[key3] || aliases[key3];
|
|
4954
4835
|
}
|
|
4955
4836
|
function setKey(obj, keys, value2) {
|
|
4956
|
-
var
|
|
4837
|
+
var o = obj;
|
|
4957
4838
|
for (var i2 = 0; i2 < keys.length - 1; i2++) {
|
|
4958
4839
|
var key3 = keys[i2];
|
|
4959
|
-
if (isConstructorOrProto(
|
|
4840
|
+
if (isConstructorOrProto(o, key3)) {
|
|
4960
4841
|
return;
|
|
4961
4842
|
}
|
|
4962
|
-
if (
|
|
4963
|
-
|
|
4843
|
+
if (o[key3] === void 0) {
|
|
4844
|
+
o[key3] = {};
|
|
4964
4845
|
}
|
|
4965
|
-
if (
|
|
4966
|
-
|
|
4846
|
+
if (o[key3] === Object.prototype || o[key3] === Number.prototype || o[key3] === String.prototype) {
|
|
4847
|
+
o[key3] = {};
|
|
4967
4848
|
}
|
|
4968
|
-
if (
|
|
4969
|
-
|
|
4849
|
+
if (o[key3] === Array.prototype) {
|
|
4850
|
+
o[key3] = [];
|
|
4970
4851
|
}
|
|
4971
|
-
|
|
4852
|
+
o = o[key3];
|
|
4972
4853
|
}
|
|
4973
4854
|
var lastKey = keys[keys.length - 1];
|
|
4974
|
-
if (isConstructorOrProto(
|
|
4855
|
+
if (isConstructorOrProto(o, lastKey)) {
|
|
4975
4856
|
return;
|
|
4976
4857
|
}
|
|
4977
|
-
if (
|
|
4978
|
-
|
|
4858
|
+
if (o === Object.prototype || o === Number.prototype || o === String.prototype) {
|
|
4859
|
+
o = {};
|
|
4979
4860
|
}
|
|
4980
|
-
if (
|
|
4981
|
-
|
|
4861
|
+
if (o === Array.prototype) {
|
|
4862
|
+
o = [];
|
|
4982
4863
|
}
|
|
4983
|
-
if (
|
|
4984
|
-
|
|
4985
|
-
} else if (Array.isArray(
|
|
4986
|
-
|
|
4864
|
+
if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") {
|
|
4865
|
+
o[lastKey] = value2;
|
|
4866
|
+
} else if (Array.isArray(o[lastKey])) {
|
|
4867
|
+
o[lastKey].push(value2);
|
|
4987
4868
|
} else {
|
|
4988
|
-
|
|
4869
|
+
o[lastKey] = [o[lastKey], value2];
|
|
4989
4870
|
}
|
|
4990
4871
|
}
|
|
4991
4872
|
function setArg(key3, val, arg2) {
|
|
@@ -4996,8 +4877,8 @@ var require_minimist = __commonJS({
|
|
|
4996
4877
|
}
|
|
4997
4878
|
var value2 = !flags.strings[key3] && isNumber(val) ? Number(val) : val;
|
|
4998
4879
|
setKey(argv, key3.split("."), value2);
|
|
4999
|
-
(aliases[key3] || []).forEach(function(
|
|
5000
|
-
setKey(argv,
|
|
4880
|
+
(aliases[key3] || []).forEach(function(x) {
|
|
4881
|
+
setKey(argv, x.split("."), value2);
|
|
5001
4882
|
});
|
|
5002
4883
|
}
|
|
5003
4884
|
Object.keys(flags.bools).forEach(function(key3) {
|
|
@@ -5013,9 +4894,9 @@ var require_minimist = __commonJS({
|
|
|
5013
4894
|
var key2;
|
|
5014
4895
|
var next;
|
|
5015
4896
|
if (/^--.+=/.test(arg)) {
|
|
5016
|
-
var
|
|
5017
|
-
key2 =
|
|
5018
|
-
var value =
|
|
4897
|
+
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
|
4898
|
+
key2 = m[1];
|
|
4899
|
+
var value = m[2];
|
|
5019
4900
|
if (flags.bools[key2]) {
|
|
5020
4901
|
value = value !== "false";
|
|
5021
4902
|
}
|
|
@@ -5038,28 +4919,28 @@ var require_minimist = __commonJS({
|
|
|
5038
4919
|
} else if (/^-[^-]+/.test(arg)) {
|
|
5039
4920
|
var letters = arg.slice(1, -1).split("");
|
|
5040
4921
|
var broken = false;
|
|
5041
|
-
for (var
|
|
5042
|
-
next = arg.slice(
|
|
4922
|
+
for (var j = 0; j < letters.length; j++) {
|
|
4923
|
+
next = arg.slice(j + 2);
|
|
5043
4924
|
if (next === "-") {
|
|
5044
|
-
setArg(letters[
|
|
4925
|
+
setArg(letters[j], next, arg);
|
|
5045
4926
|
continue;
|
|
5046
4927
|
}
|
|
5047
|
-
if (/[A-Za-z]/.test(letters[
|
|
5048
|
-
setArg(letters[
|
|
4928
|
+
if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
|
|
4929
|
+
setArg(letters[j], next.slice(1), arg);
|
|
5049
4930
|
broken = true;
|
|
5050
4931
|
break;
|
|
5051
4932
|
}
|
|
5052
|
-
if (/[A-Za-z]/.test(letters[
|
|
5053
|
-
setArg(letters[
|
|
4933
|
+
if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
|
4934
|
+
setArg(letters[j], next, arg);
|
|
5054
4935
|
broken = true;
|
|
5055
4936
|
break;
|
|
5056
4937
|
}
|
|
5057
|
-
if (letters[
|
|
5058
|
-
setArg(letters[
|
|
4938
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
4939
|
+
setArg(letters[j], arg.slice(j + 2), arg);
|
|
5059
4940
|
broken = true;
|
|
5060
4941
|
break;
|
|
5061
4942
|
} else {
|
|
5062
|
-
setArg(letters[
|
|
4943
|
+
setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
|
|
5063
4944
|
}
|
|
5064
4945
|
}
|
|
5065
4946
|
key2 = arg.slice(-1)[0];
|
|
@@ -5084,19 +4965,19 @@ var require_minimist = __commonJS({
|
|
|
5084
4965
|
}
|
|
5085
4966
|
}
|
|
5086
4967
|
}
|
|
5087
|
-
Object.keys(defaults).forEach(function(
|
|
5088
|
-
if (!hasKey(argv,
|
|
5089
|
-
setKey(argv,
|
|
5090
|
-
(aliases[
|
|
5091
|
-
setKey(argv,
|
|
4968
|
+
Object.keys(defaults).forEach(function(k) {
|
|
4969
|
+
if (!hasKey(argv, k.split("."))) {
|
|
4970
|
+
setKey(argv, k.split("."), defaults[k]);
|
|
4971
|
+
(aliases[k] || []).forEach(function(x) {
|
|
4972
|
+
setKey(argv, x.split("."), defaults[k]);
|
|
5092
4973
|
});
|
|
5093
4974
|
}
|
|
5094
4975
|
});
|
|
5095
4976
|
if (opts["--"]) {
|
|
5096
4977
|
argv["--"] = notFlags.slice();
|
|
5097
4978
|
} else {
|
|
5098
|
-
notFlags.forEach(function(
|
|
5099
|
-
argv._.push(
|
|
4979
|
+
notFlags.forEach(function(k) {
|
|
4980
|
+
argv._.push(k);
|
|
5100
4981
|
});
|
|
5101
4982
|
}
|
|
5102
4983
|
return argv;
|
|
@@ -5109,7 +4990,7 @@ var require_register = __commonJS({
|
|
|
5109
4990
|
"../../node_modules/tsconfig-paths/lib/register.js"(exports) {
|
|
5110
4991
|
"use strict";
|
|
5111
4992
|
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
5112
|
-
if (pack || arguments.length === 2) for (var i = 0,
|
|
4993
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
5113
4994
|
if (ar || !(i in from)) {
|
|
5114
4995
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5115
4996
|
ar[i] = from[i];
|
|
@@ -5246,29 +5127,29 @@ var require_lib = __commonJS({
|
|
|
5246
5127
|
var require_helpers = __commonJS({
|
|
5247
5128
|
"../../node_modules/agent-base/dist/helpers.js"(exports) {
|
|
5248
5129
|
"use strict";
|
|
5249
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(
|
|
5250
|
-
if (
|
|
5251
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
5252
|
-
if (!desc || ("get" in desc ? !
|
|
5130
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
5131
|
+
if (k2 === void 0) k2 = k;
|
|
5132
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5133
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5253
5134
|
desc = { enumerable: true, get: function() {
|
|
5254
|
-
return
|
|
5135
|
+
return m[k];
|
|
5255
5136
|
} };
|
|
5256
5137
|
}
|
|
5257
|
-
Object.defineProperty(
|
|
5258
|
-
} : function(
|
|
5259
|
-
if (
|
|
5260
|
-
|
|
5138
|
+
Object.defineProperty(o, k2, desc);
|
|
5139
|
+
} : function(o, m, k, k2) {
|
|
5140
|
+
if (k2 === void 0) k2 = k;
|
|
5141
|
+
o[k2] = m[k];
|
|
5261
5142
|
});
|
|
5262
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(
|
|
5263
|
-
Object.defineProperty(
|
|
5264
|
-
} : function(
|
|
5265
|
-
|
|
5143
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
5144
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
5145
|
+
} : function(o, v) {
|
|
5146
|
+
o["default"] = v;
|
|
5266
5147
|
});
|
|
5267
5148
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
5268
5149
|
if (mod && mod.__esModule) return mod;
|
|
5269
5150
|
var result = {};
|
|
5270
5151
|
if (mod != null) {
|
|
5271
|
-
for (var
|
|
5152
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
5272
5153
|
}
|
|
5273
5154
|
__setModuleDefault(result, mod);
|
|
5274
5155
|
return result;
|
|
@@ -5316,35 +5197,35 @@ var require_helpers = __commonJS({
|
|
|
5316
5197
|
var require_dist = __commonJS({
|
|
5317
5198
|
"../../node_modules/agent-base/dist/index.js"(exports) {
|
|
5318
5199
|
"use strict";
|
|
5319
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(
|
|
5320
|
-
if (
|
|
5321
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
5322
|
-
if (!desc || ("get" in desc ? !
|
|
5200
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
5201
|
+
if (k2 === void 0) k2 = k;
|
|
5202
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5203
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5323
5204
|
desc = { enumerable: true, get: function() {
|
|
5324
|
-
return
|
|
5205
|
+
return m[k];
|
|
5325
5206
|
} };
|
|
5326
5207
|
}
|
|
5327
|
-
Object.defineProperty(
|
|
5328
|
-
} : function(
|
|
5329
|
-
if (
|
|
5330
|
-
|
|
5208
|
+
Object.defineProperty(o, k2, desc);
|
|
5209
|
+
} : function(o, m, k, k2) {
|
|
5210
|
+
if (k2 === void 0) k2 = k;
|
|
5211
|
+
o[k2] = m[k];
|
|
5331
5212
|
});
|
|
5332
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(
|
|
5333
|
-
Object.defineProperty(
|
|
5334
|
-
} : function(
|
|
5335
|
-
|
|
5213
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
5214
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
5215
|
+
} : function(o, v) {
|
|
5216
|
+
o["default"] = v;
|
|
5336
5217
|
});
|
|
5337
5218
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
5338
5219
|
if (mod && mod.__esModule) return mod;
|
|
5339
5220
|
var result = {};
|
|
5340
5221
|
if (mod != null) {
|
|
5341
|
-
for (var
|
|
5222
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
5342
5223
|
}
|
|
5343
5224
|
__setModuleDefault(result, mod);
|
|
5344
5225
|
return result;
|
|
5345
5226
|
};
|
|
5346
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
5347
|
-
for (var
|
|
5227
|
+
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
5228
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
5348
5229
|
};
|
|
5349
5230
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5350
5231
|
exports.Agent = void 0;
|
|
@@ -5373,7 +5254,7 @@ var require_dist = __commonJS({
|
|
|
5373
5254
|
const { stack: stack2 } = new Error();
|
|
5374
5255
|
if (typeof stack2 !== "string")
|
|
5375
5256
|
return false;
|
|
5376
|
-
return stack2.split("\n").some((
|
|
5257
|
+
return stack2.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
|
|
5377
5258
|
}
|
|
5378
5259
|
// In order to support async signatures in `connect()` and Node's native
|
|
5379
5260
|
// connection pooling in `http.Agent`, the array of sockets for each origin
|
|
@@ -5450,17 +5331,17 @@ var require_dist = __commonJS({
|
|
|
5450
5331
|
get defaultPort() {
|
|
5451
5332
|
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
5452
5333
|
}
|
|
5453
|
-
set defaultPort(
|
|
5334
|
+
set defaultPort(v) {
|
|
5454
5335
|
if (this[INTERNAL]) {
|
|
5455
|
-
this[INTERNAL].defaultPort =
|
|
5336
|
+
this[INTERNAL].defaultPort = v;
|
|
5456
5337
|
}
|
|
5457
5338
|
}
|
|
5458
5339
|
get protocol() {
|
|
5459
5340
|
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
5460
5341
|
}
|
|
5461
|
-
set protocol(
|
|
5342
|
+
set protocol(v) {
|
|
5462
5343
|
if (this[INTERNAL]) {
|
|
5463
|
-
this[INTERNAL].protocol =
|
|
5344
|
+
this[INTERNAL].protocol = v;
|
|
5464
5345
|
}
|
|
5465
5346
|
}
|
|
5466
5347
|
};
|
|
@@ -5484,9 +5365,9 @@ var require_parse_proxy_response = __commonJS({
|
|
|
5484
5365
|
let buffersLength = 0;
|
|
5485
5366
|
const buffers = [];
|
|
5486
5367
|
function read2() {
|
|
5487
|
-
const
|
|
5488
|
-
if (
|
|
5489
|
-
ondata(
|
|
5368
|
+
const b = socket.read();
|
|
5369
|
+
if (b)
|
|
5370
|
+
ondata(b);
|
|
5490
5371
|
else
|
|
5491
5372
|
socket.once("readable", read2);
|
|
5492
5373
|
}
|
|
@@ -5505,9 +5386,9 @@ var require_parse_proxy_response = __commonJS({
|
|
|
5505
5386
|
debug("onerror %o", err);
|
|
5506
5387
|
reject(err);
|
|
5507
5388
|
}
|
|
5508
|
-
function ondata(
|
|
5509
|
-
buffers.push(
|
|
5510
|
-
buffersLength +=
|
|
5389
|
+
function ondata(b) {
|
|
5390
|
+
buffers.push(b);
|
|
5391
|
+
buffersLength += b.length;
|
|
5511
5392
|
const buffered = Buffer.concat(buffers, buffersLength);
|
|
5512
5393
|
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
5513
5394
|
if (endOfHeaders === -1) {
|
|
@@ -5568,29 +5449,29 @@ var require_parse_proxy_response = __commonJS({
|
|
|
5568
5449
|
var require_dist2 = __commonJS({
|
|
5569
5450
|
"../../node_modules/https-proxy-agent/dist/index.js"(exports) {
|
|
5570
5451
|
"use strict";
|
|
5571
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(
|
|
5572
|
-
if (
|
|
5573
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
5574
|
-
if (!desc || ("get" in desc ? !
|
|
5452
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
5453
|
+
if (k2 === void 0) k2 = k;
|
|
5454
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5455
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5575
5456
|
desc = { enumerable: true, get: function() {
|
|
5576
|
-
return
|
|
5457
|
+
return m[k];
|
|
5577
5458
|
} };
|
|
5578
5459
|
}
|
|
5579
|
-
Object.defineProperty(
|
|
5580
|
-
} : function(
|
|
5581
|
-
if (
|
|
5582
|
-
|
|
5460
|
+
Object.defineProperty(o, k2, desc);
|
|
5461
|
+
} : function(o, m, k, k2) {
|
|
5462
|
+
if (k2 === void 0) k2 = k;
|
|
5463
|
+
o[k2] = m[k];
|
|
5583
5464
|
});
|
|
5584
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(
|
|
5585
|
-
Object.defineProperty(
|
|
5586
|
-
} : function(
|
|
5587
|
-
|
|
5465
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
5466
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
5467
|
+
} : function(o, v) {
|
|
5468
|
+
o["default"] = v;
|
|
5588
5469
|
});
|
|
5589
5470
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
5590
5471
|
if (mod && mod.__esModule) return mod;
|
|
5591
5472
|
var result = {};
|
|
5592
5473
|
if (mod != null) {
|
|
5593
|
-
for (var
|
|
5474
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
5594
5475
|
}
|
|
5595
5476
|
__setModuleDefault(result, mod);
|
|
5596
5477
|
return result;
|
|
@@ -5712,59 +5593,6 @@ var require_dist2 = __commonJS({
|
|
|
5712
5593
|
}
|
|
5713
5594
|
});
|
|
5714
5595
|
|
|
5715
|
-
// src/utils/audioBuffer.ts
|
|
5716
|
-
import { Readable } from "stream";
|
|
5717
|
-
function getAudioMimeType(audioBuffer) {
|
|
5718
|
-
if (audioBuffer.length >= 12 && audioBuffer.toString("ascii", 0, 4) === "RIFF" && audioBuffer.toString("ascii", 8, 12) === "WAVE") {
|
|
5719
|
-
return "audio/wav";
|
|
5720
|
-
}
|
|
5721
|
-
if (audioBuffer.length >= 3 && audioBuffer.toString("ascii", 0, 3) === "ID3") {
|
|
5722
|
-
return "audio/mpeg";
|
|
5723
|
-
}
|
|
5724
|
-
if (audioBuffer.length >= 2 && audioBuffer[0] === 255 && (audioBuffer[1] & 224) === 224) {
|
|
5725
|
-
return "audio/mpeg";
|
|
5726
|
-
}
|
|
5727
|
-
return "audio/mpeg";
|
|
5728
|
-
}
|
|
5729
|
-
async function convertToAudioBuffer(speechResponse, detectMimeType) {
|
|
5730
|
-
let resultBuffer;
|
|
5731
|
-
if (Buffer.isBuffer(speechResponse)) {
|
|
5732
|
-
resultBuffer = speechResponse;
|
|
5733
|
-
} else if (typeof speechResponse?.getReader === "function") {
|
|
5734
|
-
const reader = speechResponse.getReader();
|
|
5735
|
-
const chunks = [];
|
|
5736
|
-
try {
|
|
5737
|
-
while (true) {
|
|
5738
|
-
const { done, value } = await reader.read();
|
|
5739
|
-
if (done) break;
|
|
5740
|
-
if (value) chunks.push(value);
|
|
5741
|
-
}
|
|
5742
|
-
resultBuffer = Buffer.concat(chunks);
|
|
5743
|
-
} finally {
|
|
5744
|
-
reader.releaseLock();
|
|
5745
|
-
}
|
|
5746
|
-
} else if (speechResponse instanceof Readable || speechResponse && speechResponse.readable === true && typeof speechResponse.pipe === "function" && typeof speechResponse.on === "function") {
|
|
5747
|
-
resultBuffer = await new Promise((resolve2, reject) => {
|
|
5748
|
-
const chunks = [];
|
|
5749
|
-
speechResponse.on(
|
|
5750
|
-
"data",
|
|
5751
|
-
(chunk) => chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
|
|
5752
|
-
);
|
|
5753
|
-
speechResponse.on("end", () => resolve2(Buffer.concat(chunks)));
|
|
5754
|
-
speechResponse.on("error", (err) => reject(err));
|
|
5755
|
-
});
|
|
5756
|
-
} else {
|
|
5757
|
-
throw new Error("Unexpected response type from TEXT_TO_SPEECH model");
|
|
5758
|
-
}
|
|
5759
|
-
if (detectMimeType) {
|
|
5760
|
-
return {
|
|
5761
|
-
buffer: resultBuffer,
|
|
5762
|
-
mimeType: getAudioMimeType(resultBuffer)
|
|
5763
|
-
};
|
|
5764
|
-
}
|
|
5765
|
-
return resultBuffer;
|
|
5766
|
-
}
|
|
5767
|
-
|
|
5768
5596
|
// src/utils/build-project.ts
|
|
5769
5597
|
import * as fs3 from "fs";
|
|
5770
5598
|
import * as path4 from "path";
|
|
@@ -5932,8 +5760,8 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
5932
5760
|
logger2.debug("[UserEnvironment] Getting CLI information");
|
|
5933
5761
|
try {
|
|
5934
5762
|
const __filename = fileURLToPath(import.meta.url);
|
|
5935
|
-
const
|
|
5936
|
-
const packageJsonPath = path2.resolve(
|
|
5763
|
+
const __dirname2 = path2.dirname(__filename);
|
|
5764
|
+
const packageJsonPath = path2.resolve(__dirname2, "../package.json");
|
|
5937
5765
|
if (!existsSync2(packageJsonPath)) {
|
|
5938
5766
|
throw new Error(`CLI package.json not found at ${packageJsonPath}`);
|
|
5939
5767
|
}
|
|
@@ -5957,9 +5785,8 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
5957
5785
|
}
|
|
5958
5786
|
/**
|
|
5959
5787
|
* Detects the active package manager - always returns bun for ElizaOS CLI
|
|
5960
|
-
* @param directory Optional directory to check for lock files. Defaults to process.cwd().
|
|
5961
5788
|
*/
|
|
5962
|
-
async getPackageManagerInfo(
|
|
5789
|
+
async getPackageManagerInfo() {
|
|
5963
5790
|
logger2.debug("[UserEnvironment] Using bun as the package manager for ElizaOS CLI");
|
|
5964
5791
|
const isNpx = process.env.npm_execpath?.includes("npx");
|
|
5965
5792
|
const isBunx = process.argv[0]?.includes("bun");
|
|
@@ -5968,9 +5795,9 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
5968
5795
|
const { stdout } = await import("execa").then(({ execa: execa9 }) => execa9("bun", ["--version"]));
|
|
5969
5796
|
version = stdout.trim();
|
|
5970
5797
|
logger2.debug(`[UserEnvironment] Bun version: ${version}`);
|
|
5971
|
-
} catch (
|
|
5798
|
+
} catch (e) {
|
|
5972
5799
|
logger2.debug(
|
|
5973
|
-
`[UserEnvironment] Could not get bun version: ${
|
|
5800
|
+
`[UserEnvironment] Could not get bun version: ${e instanceof Error ? e.message : String(e)}`
|
|
5974
5801
|
);
|
|
5975
5802
|
if (shouldAutoInstall()) {
|
|
5976
5803
|
logger2.info(`${emoji.info("Attempting to automatically install Bun...")}`);
|
|
@@ -6019,7 +5846,8 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
6019
5846
|
let isGlobalCheck = false;
|
|
6020
5847
|
try {
|
|
6021
5848
|
if (!isNpx && !isBunx) {
|
|
6022
|
-
|
|
5849
|
+
const command = process.platform === "win32" ? `bun pm ls -g | findstr "${packageName}"` : `bun pm ls -g | grep -q "${packageName}"`;
|
|
5850
|
+
execSync(command, { stdio: "ignore" });
|
|
6023
5851
|
isGlobalCheck = true;
|
|
6024
5852
|
}
|
|
6025
5853
|
} catch (error) {
|
|
@@ -6030,7 +5858,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
6030
5858
|
name: "bun",
|
|
6031
5859
|
version,
|
|
6032
5860
|
global: isGlobal,
|
|
6033
|
-
isNpx,
|
|
5861
|
+
isNpx: !!isNpx,
|
|
6034
5862
|
isBunx
|
|
6035
5863
|
};
|
|
6036
5864
|
}
|
|
@@ -6060,7 +5888,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
6060
5888
|
}
|
|
6061
5889
|
}
|
|
6062
5890
|
}
|
|
6063
|
-
} catch (
|
|
5891
|
+
} catch (e) {
|
|
6064
5892
|
}
|
|
6065
5893
|
}
|
|
6066
5894
|
const parentDir = path2.dirname(currentDir);
|
|
@@ -6099,8 +5927,7 @@ var UserEnvironment = class _UserEnvironment {
|
|
|
6099
5927
|
const [os2, cli, packageManager, paths, env] = await Promise.all([
|
|
6100
5928
|
this.getOSInfo(),
|
|
6101
5929
|
this.getCLIInfo(),
|
|
6102
|
-
this.getPackageManagerInfo(
|
|
6103
|
-
// Pass directory here
|
|
5930
|
+
this.getPackageManagerInfo(),
|
|
6104
5931
|
this.getPathInfo(),
|
|
6105
5932
|
this.getEnvInfo()
|
|
6106
5933
|
]);
|
|
@@ -6212,7 +6039,7 @@ function detectDirectoryType(dir) {
|
|
|
6212
6039
|
elizaPackageCount: 0
|
|
6213
6040
|
};
|
|
6214
6041
|
}
|
|
6215
|
-
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(dir);
|
|
6042
|
+
const monorepoRoot = UserEnvironment.getInstance().findMonorepoRoot(dir) ?? void 0;
|
|
6216
6043
|
const packageJsonPath = path3.join(dir, "package.json");
|
|
6217
6044
|
const hasPackageJson = fs2.existsSync(packageJsonPath);
|
|
6218
6045
|
if (monorepoRoot) {
|
|
@@ -6486,7 +6313,9 @@ async function migrateCliToBun(targetVersion) {
|
|
|
6486
6313
|
await removeNpmInstallation();
|
|
6487
6314
|
logger4.info("\u2705 CLI migration completed successfully! You may need to restart your terminal.");
|
|
6488
6315
|
} catch (error) {
|
|
6489
|
-
logger4.error(
|
|
6316
|
+
logger4.error(
|
|
6317
|
+
`\u274C CLI migration failed: ${error instanceof Error ? error.message : String(error)}`
|
|
6318
|
+
);
|
|
6490
6319
|
logger4.error("Your original npm installation is still intact.");
|
|
6491
6320
|
try {
|
|
6492
6321
|
logger4.info("Cleaning up failed bun installation...");
|
|
@@ -6497,753 +6326,14 @@ async function migrateCliToBun(targetVersion) {
|
|
|
6497
6326
|
}
|
|
6498
6327
|
}
|
|
6499
6328
|
|
|
6500
|
-
// ../../node_modules/@clack/prompts/dist/index.mjs
|
|
6501
|
-
import { stripVTControlCharacters as S2 } from "util";
|
|
6502
|
-
|
|
6503
|
-
// ../../node_modules/@clack/core/dist/index.mjs
|
|
6504
|
-
var import_sisteransi = __toESM(require_src2(), 1);
|
|
6505
|
-
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
6506
|
-
import { stdin as j, stdout as M } from "process";
|
|
6507
|
-
import * as g from "readline";
|
|
6508
|
-
import O from "readline";
|
|
6509
|
-
import { Writable as X } from "stream";
|
|
6510
|
-
function DD({ onlyFirst: e2 = false } = {}) {
|
|
6511
|
-
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
6512
|
-
return new RegExp(t, e2 ? void 0 : "g");
|
|
6513
|
-
}
|
|
6514
|
-
var uD = DD();
|
|
6515
|
-
function P(e2) {
|
|
6516
|
-
if (typeof e2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof e2}\``);
|
|
6517
|
-
return e2.replace(uD, "");
|
|
6518
|
-
}
|
|
6519
|
-
function L(e2) {
|
|
6520
|
-
return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
|
|
6521
|
-
}
|
|
6522
|
-
var W = { exports: {} };
|
|
6523
|
-
(function(e2) {
|
|
6524
|
-
var u2 = {};
|
|
6525
|
-
e2.exports = u2, u2.eastAsianWidth = function(F2) {
|
|
6526
|
-
var s = F2.charCodeAt(0), i = F2.length == 2 ? F2.charCodeAt(1) : 0, D2 = s;
|
|
6527
|
-
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D2 = s << 10 | i, D2 += 65536), D2 == 12288 || 65281 <= D2 && D2 <= 65376 || 65504 <= D2 && D2 <= 65510 ? "F" : D2 == 8361 || 65377 <= D2 && D2 <= 65470 || 65474 <= D2 && D2 <= 65479 || 65482 <= D2 && D2 <= 65487 || 65490 <= D2 && D2 <= 65495 || 65498 <= D2 && D2 <= 65500 || 65512 <= D2 && D2 <= 65518 ? "H" : 4352 <= D2 && D2 <= 4447 || 4515 <= D2 && D2 <= 4519 || 4602 <= D2 && D2 <= 4607 || 9001 <= D2 && D2 <= 9002 || 11904 <= D2 && D2 <= 11929 || 11931 <= D2 && D2 <= 12019 || 12032 <= D2 && D2 <= 12245 || 12272 <= D2 && D2 <= 12283 || 12289 <= D2 && D2 <= 12350 || 12353 <= D2 && D2 <= 12438 || 12441 <= D2 && D2 <= 12543 || 12549 <= D2 && D2 <= 12589 || 12593 <= D2 && D2 <= 12686 || 12688 <= D2 && D2 <= 12730 || 12736 <= D2 && D2 <= 12771 || 12784 <= D2 && D2 <= 12830 || 12832 <= D2 && D2 <= 12871 || 12880 <= D2 && D2 <= 13054 || 13056 <= D2 && D2 <= 19903 || 19968 <= D2 && D2 <= 42124 || 42128 <= D2 && D2 <= 42182 || 43360 <= D2 && D2 <= 43388 || 44032 <= D2 && D2 <= 55203 || 55216 <= D2 && D2 <= 55238 || 55243 <= D2 && D2 <= 55291 || 63744 <= D2 && D2 <= 64255 || 65040 <= D2 && D2 <= 65049 || 65072 <= D2 && D2 <= 65106 || 65108 <= D2 && D2 <= 65126 || 65128 <= D2 && D2 <= 65131 || 110592 <= D2 && D2 <= 110593 || 127488 <= D2 && D2 <= 127490 || 127504 <= D2 && D2 <= 127546 || 127552 <= D2 && D2 <= 127560 || 127568 <= D2 && D2 <= 127569 || 131072 <= D2 && D2 <= 194367 || 177984 <= D2 && D2 <= 196605 || 196608 <= D2 && D2 <= 262141 ? "W" : 32 <= D2 && D2 <= 126 || 162 <= D2 && D2 <= 163 || 165 <= D2 && D2 <= 166 || D2 == 172 || D2 == 175 || 10214 <= D2 && D2 <= 10221 || 10629 <= D2 && D2 <= 10630 ? "Na" : D2 == 161 || D2 == 164 || 167 <= D2 && D2 <= 168 || D2 == 170 || 173 <= D2 && D2 <= 174 || 176 <= D2 && D2 <= 180 || 182 <= D2 && D2 <= 186 || 188 <= D2 && D2 <= 191 || D2 == 198 || D2 == 208 || 215 <= D2 && D2 <= 216 || 222 <= D2 && D2 <= 225 || D2 == 230 || 232 <= D2 && D2 <= 234 || 236 <= D2 && D2 <= 237 || D2 == 240 || 242 <= D2 && D2 <= 243 || 247 <= D2 && D2 <= 250 || D2 == 252 || D2 == 254 || D2 == 257 || D2 == 273 || D2 == 275 || D2 == 283 || 294 <= D2 && D2 <= 295 || D2 == 299 || 305 <= D2 && D2 <= 307 || D2 == 312 || 319 <= D2 && D2 <= 322 || D2 == 324 || 328 <= D2 && D2 <= 331 || D2 == 333 || 338 <= D2 && D2 <= 339 || 358 <= D2 && D2 <= 359 || D2 == 363 || D2 == 462 || D2 == 464 || D2 == 466 || D2 == 468 || D2 == 470 || D2 == 472 || D2 == 474 || D2 == 476 || D2 == 593 || D2 == 609 || D2 == 708 || D2 == 711 || 713 <= D2 && D2 <= 715 || D2 == 717 || D2 == 720 || 728 <= D2 && D2 <= 731 || D2 == 733 || D2 == 735 || 768 <= D2 && D2 <= 879 || 913 <= D2 && D2 <= 929 || 931 <= D2 && D2 <= 937 || 945 <= D2 && D2 <= 961 || 963 <= D2 && D2 <= 969 || D2 == 1025 || 1040 <= D2 && D2 <= 1103 || D2 == 1105 || D2 == 8208 || 8211 <= D2 && D2 <= 8214 || 8216 <= D2 && D2 <= 8217 || 8220 <= D2 && D2 <= 8221 || 8224 <= D2 && D2 <= 8226 || 8228 <= D2 && D2 <= 8231 || D2 == 8240 || 8242 <= D2 && D2 <= 8243 || D2 == 8245 || D2 == 8251 || D2 == 8254 || D2 == 8308 || D2 == 8319 || 8321 <= D2 && D2 <= 8324 || D2 == 8364 || D2 == 8451 || D2 == 8453 || D2 == 8457 || D2 == 8467 || D2 == 8470 || 8481 <= D2 && D2 <= 8482 || D2 == 8486 || D2 == 8491 || 8531 <= D2 && D2 <= 8532 || 8539 <= D2 && D2 <= 8542 || 8544 <= D2 && D2 <= 8555 || 8560 <= D2 && D2 <= 8569 || D2 == 8585 || 8592 <= D2 && D2 <= 8601 || 8632 <= D2 && D2 <= 8633 || D2 == 8658 || D2 == 8660 || D2 == 8679 || D2 == 8704 || 8706 <= D2 && D2 <= 8707 || 8711 <= D2 && D2 <= 8712 || D2 == 8715 || D2 == 8719 || D2 == 8721 || D2 == 8725 || D2 == 8730 || 8733 <= D2 && D2 <= 8736 || D2 == 8739 || D2 == 8741 || 8743 <= D2 && D2 <= 8748 || D2 == 8750 || 8756 <= D2 && D2 <= 8759 || 8764 <= D2 && D2 <= 8765 || D2 == 8776 || D2 == 8780 || D2 == 8786 || 8800 <= D2 && D2 <= 8801 || 8804 <= D2 && D2 <= 8807 || 8810 <= D2 && D2 <= 8811 || 8814 <= D2 && D2 <= 8815 || 8834 <= D2 && D2 <= 8835 || 8838 <= D2 && D2 <= 8839 || D2 == 8853 || D2 == 8857 || D2 == 8869 || D2 == 8895 || D2 == 8978 || 9312 <= D2 && D2 <= 9449 || 9451 <= D2 && D2 <= 9547 || 9552 <= D2 && D2 <= 9587 || 9600 <= D2 && D2 <= 9615 || 9618 <= D2 && D2 <= 9621 || 9632 <= D2 && D2 <= 9633 || 9635 <= D2 && D2 <= 9641 || 9650 <= D2 && D2 <= 9651 || 9654 <= D2 && D2 <= 9655 || 9660 <= D2 && D2 <= 9661 || 9664 <= D2 && D2 <= 9665 || 9670 <= D2 && D2 <= 9672 || D2 == 9675 || 9678 <= D2 && D2 <= 9681 || 9698 <= D2 && D2 <= 9701 || D2 == 9711 || 9733 <= D2 && D2 <= 9734 || D2 == 9737 || 9742 <= D2 && D2 <= 9743 || 9748 <= D2 && D2 <= 9749 || D2 == 9756 || D2 == 9758 || D2 == 9792 || D2 == 9794 || 9824 <= D2 && D2 <= 9825 || 9827 <= D2 && D2 <= 9829 || 9831 <= D2 && D2 <= 9834 || 9836 <= D2 && D2 <= 9837 || D2 == 9839 || 9886 <= D2 && D2 <= 9887 || 9918 <= D2 && D2 <= 9919 || 9924 <= D2 && D2 <= 9933 || 9935 <= D2 && D2 <= 9953 || D2 == 9955 || 9960 <= D2 && D2 <= 9983 || D2 == 10045 || D2 == 10071 || 10102 <= D2 && D2 <= 10111 || 11093 <= D2 && D2 <= 11097 || 12872 <= D2 && D2 <= 12879 || 57344 <= D2 && D2 <= 63743 || 65024 <= D2 && D2 <= 65039 || D2 == 65533 || 127232 <= D2 && D2 <= 127242 || 127248 <= D2 && D2 <= 127277 || 127280 <= D2 && D2 <= 127337 || 127344 <= D2 && D2 <= 127386 || 917760 <= D2 && D2 <= 917999 || 983040 <= D2 && D2 <= 1048573 || 1048576 <= D2 && D2 <= 1114109 ? "A" : "N";
|
|
6528
|
-
}, u2.characterLength = function(F2) {
|
|
6529
|
-
var s = this.eastAsianWidth(F2);
|
|
6530
|
-
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
6531
|
-
};
|
|
6532
|
-
function t(F2) {
|
|
6533
|
-
return F2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
6534
|
-
}
|
|
6535
|
-
u2.length = function(F2) {
|
|
6536
|
-
for (var s = t(F2), i = 0, D2 = 0; D2 < s.length; D2++) i = i + this.characterLength(s[D2]);
|
|
6537
|
-
return i;
|
|
6538
|
-
}, u2.slice = function(F2, s, i) {
|
|
6539
|
-
textLen = u2.length(F2), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
6540
|
-
for (var D2 = "", C2 = 0, n = t(F2), E = 0; E < n.length; E++) {
|
|
6541
|
-
var a = n[E], o2 = u2.length(a);
|
|
6542
|
-
if (C2 >= s - (o2 == 2 ? 1 : 0)) if (C2 + o2 <= i) D2 += a;
|
|
6543
|
-
else break;
|
|
6544
|
-
C2 += o2;
|
|
6545
|
-
}
|
|
6546
|
-
return D2;
|
|
6547
|
-
};
|
|
6548
|
-
})(W);
|
|
6549
|
-
var tD = W.exports;
|
|
6550
|
-
var eD = L(tD);
|
|
6551
|
-
var FD = function() {
|
|
6552
|
-
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
6553
|
-
};
|
|
6554
|
-
var sD = L(FD);
|
|
6555
|
-
function p(e2, u2 = {}) {
|
|
6556
|
-
if (typeof e2 != "string" || e2.length === 0 || (u2 = { ambiguousIsNarrow: true, ...u2 }, e2 = P(e2), e2.length === 0)) return 0;
|
|
6557
|
-
e2 = e2.replace(sD(), " ");
|
|
6558
|
-
const t = u2.ambiguousIsNarrow ? 1 : 2;
|
|
6559
|
-
let F2 = 0;
|
|
6560
|
-
for (const s of e2) {
|
|
6561
|
-
const i = s.codePointAt(0);
|
|
6562
|
-
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
|
|
6563
|
-
switch (eD.eastAsianWidth(s)) {
|
|
6564
|
-
case "F":
|
|
6565
|
-
case "W":
|
|
6566
|
-
F2 += 2;
|
|
6567
|
-
break;
|
|
6568
|
-
case "A":
|
|
6569
|
-
F2 += t;
|
|
6570
|
-
break;
|
|
6571
|
-
default:
|
|
6572
|
-
F2 += 1;
|
|
6573
|
-
}
|
|
6574
|
-
}
|
|
6575
|
-
return F2;
|
|
6576
|
-
}
|
|
6577
|
-
var w = 10;
|
|
6578
|
-
var N = (e2 = 0) => (u2) => `\x1B[${u2 + e2}m`;
|
|
6579
|
-
var I = (e2 = 0) => (u2) => `\x1B[${38 + e2};5;${u2}m`;
|
|
6580
|
-
var R = (e2 = 0) => (u2, t, F2) => `\x1B[${38 + e2};2;${u2};${t};${F2}m`;
|
|
6581
|
-
var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
6582
|
-
Object.keys(r.modifier);
|
|
6583
|
-
var iD = Object.keys(r.color);
|
|
6584
|
-
var CD = Object.keys(r.bgColor);
|
|
6585
|
-
[...iD, ...CD];
|
|
6586
|
-
function rD() {
|
|
6587
|
-
const e2 = /* @__PURE__ */ new Map();
|
|
6588
|
-
for (const [u2, t] of Object.entries(r)) {
|
|
6589
|
-
for (const [F2, s] of Object.entries(t)) r[F2] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F2] = r[F2], e2.set(s[0], s[1]);
|
|
6590
|
-
Object.defineProperty(r, u2, { value: t, enumerable: false });
|
|
6591
|
-
}
|
|
6592
|
-
return Object.defineProperty(r, "codes", { value: e2, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u2, t, F2) => u2 === t && t === F2 ? u2 < 8 ? 16 : u2 > 248 ? 231 : Math.round((u2 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u2 / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F2 / 255 * 5), enumerable: false }, hexToRgb: { value: (u2) => {
|
|
6593
|
-
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u2.toString(16));
|
|
6594
|
-
if (!t) return [0, 0, 0];
|
|
6595
|
-
let [F2] = t;
|
|
6596
|
-
F2.length === 3 && (F2 = [...F2].map((i) => i + i).join(""));
|
|
6597
|
-
const s = Number.parseInt(F2, 16);
|
|
6598
|
-
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
6599
|
-
}, enumerable: false }, hexToAnsi256: { value: (u2) => r.rgbToAnsi256(...r.hexToRgb(u2)), enumerable: false }, ansi256ToAnsi: { value: (u2) => {
|
|
6600
|
-
if (u2 < 8) return 30 + u2;
|
|
6601
|
-
if (u2 < 16) return 90 + (u2 - 8);
|
|
6602
|
-
let t, F2, s;
|
|
6603
|
-
if (u2 >= 232) t = ((u2 - 232) * 10 + 8) / 255, F2 = t, s = t;
|
|
6604
|
-
else {
|
|
6605
|
-
u2 -= 16;
|
|
6606
|
-
const C2 = u2 % 36;
|
|
6607
|
-
t = Math.floor(u2 / 36) / 5, F2 = Math.floor(C2 / 6) / 5, s = C2 % 6 / 5;
|
|
6608
|
-
}
|
|
6609
|
-
const i = Math.max(t, F2, s) * 2;
|
|
6610
|
-
if (i === 0) return 30;
|
|
6611
|
-
let D2 = 30 + (Math.round(s) << 2 | Math.round(F2) << 1 | Math.round(t));
|
|
6612
|
-
return i === 2 && (D2 += 60), D2;
|
|
6613
|
-
}, enumerable: false }, rgbToAnsi: { value: (u2, t, F2) => r.ansi256ToAnsi(r.rgbToAnsi256(u2, t, F2)), enumerable: false }, hexToAnsi: { value: (u2) => r.ansi256ToAnsi(r.hexToAnsi256(u2)), enumerable: false } }), r;
|
|
6614
|
-
}
|
|
6615
|
-
var ED = rD();
|
|
6616
|
-
var d = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
|
|
6617
|
-
var oD = 39;
|
|
6618
|
-
var y = "\x07";
|
|
6619
|
-
var V = "[";
|
|
6620
|
-
var nD = "]";
|
|
6621
|
-
var G = "m";
|
|
6622
|
-
var _ = `${nD}8;;`;
|
|
6623
|
-
var z = (e2) => `${d.values().next().value}${V}${e2}${G}`;
|
|
6624
|
-
var K = (e2) => `${d.values().next().value}${_}${e2}${y}`;
|
|
6625
|
-
var aD = (e2) => e2.split(" ").map((u2) => p(u2));
|
|
6626
|
-
var k = (e2, u2, t) => {
|
|
6627
|
-
const F2 = [...u2];
|
|
6628
|
-
let s = false, i = false, D2 = p(P(e2[e2.length - 1]));
|
|
6629
|
-
for (const [C2, n] of F2.entries()) {
|
|
6630
|
-
const E = p(n);
|
|
6631
|
-
if (D2 + E <= t ? e2[e2.length - 1] += n : (e2.push(n), D2 = 0), d.has(n) && (s = true, i = F2.slice(C2 + 1).join("").startsWith(_)), s) {
|
|
6632
|
-
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
6633
|
-
continue;
|
|
6634
|
-
}
|
|
6635
|
-
D2 += E, D2 === t && C2 < F2.length - 1 && (e2.push(""), D2 = 0);
|
|
6636
|
-
}
|
|
6637
|
-
!D2 && e2[e2.length - 1].length > 0 && e2.length > 1 && (e2[e2.length - 2] += e2.pop());
|
|
6638
|
-
};
|
|
6639
|
-
var hD = (e2) => {
|
|
6640
|
-
const u2 = e2.split(" ");
|
|
6641
|
-
let t = u2.length;
|
|
6642
|
-
for (; t > 0 && !(p(u2[t - 1]) > 0); ) t--;
|
|
6643
|
-
return t === u2.length ? e2 : u2.slice(0, t).join(" ") + u2.slice(t).join("");
|
|
6644
|
-
};
|
|
6645
|
-
var lD = (e2, u2, t = {}) => {
|
|
6646
|
-
if (t.trim !== false && e2.trim() === "") return "";
|
|
6647
|
-
let F2 = "", s, i;
|
|
6648
|
-
const D2 = aD(e2);
|
|
6649
|
-
let C2 = [""];
|
|
6650
|
-
for (const [E, a] of e2.split(" ").entries()) {
|
|
6651
|
-
t.trim !== false && (C2[C2.length - 1] = C2[C2.length - 1].trimStart());
|
|
6652
|
-
let o2 = p(C2[C2.length - 1]);
|
|
6653
|
-
if (E !== 0 && (o2 >= u2 && (t.wordWrap === false || t.trim === false) && (C2.push(""), o2 = 0), (o2 > 0 || t.trim === false) && (C2[C2.length - 1] += " ", o2++)), t.hard && D2[E] > u2) {
|
|
6654
|
-
const c2 = u2 - o2, f = 1 + Math.floor((D2[E] - c2 - 1) / u2);
|
|
6655
|
-
Math.floor((D2[E] - 1) / u2) < f && C2.push(""), k(C2, a, u2);
|
|
6656
|
-
continue;
|
|
6657
|
-
}
|
|
6658
|
-
if (o2 + D2[E] > u2 && o2 > 0 && D2[E] > 0) {
|
|
6659
|
-
if (t.wordWrap === false && o2 < u2) {
|
|
6660
|
-
k(C2, a, u2);
|
|
6661
|
-
continue;
|
|
6662
|
-
}
|
|
6663
|
-
C2.push("");
|
|
6664
|
-
}
|
|
6665
|
-
if (o2 + D2[E] > u2 && t.wordWrap === false) {
|
|
6666
|
-
k(C2, a, u2);
|
|
6667
|
-
continue;
|
|
6668
|
-
}
|
|
6669
|
-
C2[C2.length - 1] += a;
|
|
6670
|
-
}
|
|
6671
|
-
t.trim !== false && (C2 = C2.map((E) => hD(E)));
|
|
6672
|
-
const n = [...C2.join(`
|
|
6673
|
-
`)];
|
|
6674
|
-
for (const [E, a] of n.entries()) {
|
|
6675
|
-
if (F2 += a, d.has(a)) {
|
|
6676
|
-
const { groups: c2 } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
6677
|
-
if (c2.code !== void 0) {
|
|
6678
|
-
const f = Number.parseFloat(c2.code);
|
|
6679
|
-
s = f === oD ? void 0 : f;
|
|
6680
|
-
} else c2.uri !== void 0 && (i = c2.uri.length === 0 ? void 0 : c2.uri);
|
|
6681
|
-
}
|
|
6682
|
-
const o2 = ED.codes.get(Number(s));
|
|
6683
|
-
n[E + 1] === `
|
|
6684
|
-
` ? (i && (F2 += K("")), s && o2 && (F2 += z(o2))) : a === `
|
|
6685
|
-
` && (s && o2 && (F2 += z(s)), i && (F2 += K(i)));
|
|
6686
|
-
}
|
|
6687
|
-
return F2;
|
|
6688
|
-
};
|
|
6689
|
-
function Y(e2, u2, t) {
|
|
6690
|
-
return String(e2).normalize().replace(/\r\n/g, `
|
|
6691
|
-
`).split(`
|
|
6692
|
-
`).map((F2) => lD(F2, u2, t)).join(`
|
|
6693
|
-
`);
|
|
6694
|
-
}
|
|
6695
|
-
var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
6696
|
-
var B = { actions: new Set(xD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
|
|
6697
|
-
function $(e2, u2) {
|
|
6698
|
-
if (typeof e2 == "string") return B.aliases.get(e2) === u2;
|
|
6699
|
-
for (const t of e2) if (t !== void 0 && $(t, u2)) return true;
|
|
6700
|
-
return false;
|
|
6701
|
-
}
|
|
6702
|
-
function BD(e2, u2) {
|
|
6703
|
-
if (e2 === u2) return;
|
|
6704
|
-
const t = e2.split(`
|
|
6705
|
-
`), F2 = u2.split(`
|
|
6706
|
-
`), s = [];
|
|
6707
|
-
for (let i = 0; i < Math.max(t.length, F2.length); i++) t[i] !== F2[i] && s.push(i);
|
|
6708
|
-
return s;
|
|
6709
|
-
}
|
|
6710
|
-
var AD = globalThis.process.platform.startsWith("win");
|
|
6711
|
-
var S = Symbol("clack:cancel");
|
|
6712
|
-
function pD(e2) {
|
|
6713
|
-
return e2 === S;
|
|
6714
|
-
}
|
|
6715
|
-
function m(e2, u2) {
|
|
6716
|
-
const t = e2;
|
|
6717
|
-
t.isTTY && t.setRawMode(u2);
|
|
6718
|
-
}
|
|
6719
|
-
function fD({ input: e2 = j, output: u2 = M, overwrite: t = true, hideCursor: F2 = true } = {}) {
|
|
6720
|
-
const s = g.createInterface({ input: e2, output: u2, prompt: "", tabSize: 1 });
|
|
6721
|
-
g.emitKeypressEvents(e2, s), e2.isTTY && e2.setRawMode(true);
|
|
6722
|
-
const i = (D2, { name: C2, sequence: n }) => {
|
|
6723
|
-
const E = String(D2);
|
|
6724
|
-
if ($([E, C2, n], "cancel")) {
|
|
6725
|
-
F2 && u2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
6726
|
-
return;
|
|
6727
|
-
}
|
|
6728
|
-
if (!t) return;
|
|
6729
|
-
const a = C2 === "return" ? 0 : -1, o2 = C2 === "return" ? -1 : 0;
|
|
6730
|
-
g.moveCursor(u2, a, o2, () => {
|
|
6731
|
-
g.clearLine(u2, 1, () => {
|
|
6732
|
-
e2.once("keypress", i);
|
|
6733
|
-
});
|
|
6734
|
-
});
|
|
6735
|
-
};
|
|
6736
|
-
return F2 && u2.write(import_sisteransi.cursor.hide), e2.once("keypress", i), () => {
|
|
6737
|
-
e2.off("keypress", i), F2 && u2.write(import_sisteransi.cursor.show), e2.isTTY && !AD && e2.setRawMode(false), s.terminal = false, s.close();
|
|
6738
|
-
};
|
|
6739
|
-
}
|
|
6740
|
-
var gD = Object.defineProperty;
|
|
6741
|
-
var vD = (e2, u2, t) => u2 in e2 ? gD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
|
|
6742
|
-
var h = (e2, u2, t) => (vD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
|
|
6743
|
-
var x = class {
|
|
6744
|
-
constructor(u2, t = true) {
|
|
6745
|
-
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
6746
|
-
const { input: F2 = j, output: s = M, render: i, signal: D2, ...C2 } = u2;
|
|
6747
|
-
this.opts = C2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D2, this.input = F2, this.output = s;
|
|
6748
|
-
}
|
|
6749
|
-
unsubscribe() {
|
|
6750
|
-
this._subscribers.clear();
|
|
6751
|
-
}
|
|
6752
|
-
setSubscriber(u2, t) {
|
|
6753
|
-
const F2 = this._subscribers.get(u2) ?? [];
|
|
6754
|
-
F2.push(t), this._subscribers.set(u2, F2);
|
|
6755
|
-
}
|
|
6756
|
-
on(u2, t) {
|
|
6757
|
-
this.setSubscriber(u2, { cb: t });
|
|
6758
|
-
}
|
|
6759
|
-
once(u2, t) {
|
|
6760
|
-
this.setSubscriber(u2, { cb: t, once: true });
|
|
6761
|
-
}
|
|
6762
|
-
emit(u2, ...t) {
|
|
6763
|
-
const F2 = this._subscribers.get(u2) ?? [], s = [];
|
|
6764
|
-
for (const i of F2) i.cb(...t), i.once && s.push(() => F2.splice(F2.indexOf(i), 1));
|
|
6765
|
-
for (const i of s) i();
|
|
6766
|
-
}
|
|
6767
|
-
prompt() {
|
|
6768
|
-
return new Promise((u2, t) => {
|
|
6769
|
-
if (this._abortSignal) {
|
|
6770
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u2(S);
|
|
6771
|
-
this._abortSignal.addEventListener("abort", () => {
|
|
6772
|
-
this.state = "cancel", this.close();
|
|
6773
|
-
}, { once: true });
|
|
6774
|
-
}
|
|
6775
|
-
const F2 = new X();
|
|
6776
|
-
F2._write = (s, i, D2) => {
|
|
6777
|
-
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
|
|
6778
|
-
}, this.input.pipe(F2), this.rl = O.createInterface({ input: this.input, output: F2, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
6779
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(this.value);
|
|
6780
|
-
}), this.once("cancel", () => {
|
|
6781
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(S);
|
|
6782
|
-
});
|
|
6783
|
-
});
|
|
6784
|
-
}
|
|
6785
|
-
onKeypress(u2, t) {
|
|
6786
|
-
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u2 && (u2.toLowerCase() === "y" || u2.toLowerCase() === "n") && this.emit("confirm", u2.toLowerCase() === "y"), u2 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u2 && this.emit("key", u2.toLowerCase()), t?.name === "return") {
|
|
6787
|
-
if (this.opts.validate) {
|
|
6788
|
-
const F2 = this.opts.validate(this.value);
|
|
6789
|
-
F2 && (this.error = F2 instanceof Error ? F2.message : F2, this.state = "error", this.rl?.write(this.value));
|
|
6790
|
-
}
|
|
6791
|
-
this.state !== "error" && (this.state = "submit");
|
|
6792
|
-
}
|
|
6793
|
-
$([u2, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
6794
|
-
}
|
|
6795
|
-
close() {
|
|
6796
|
-
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
6797
|
-
`), m(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
6798
|
-
}
|
|
6799
|
-
restoreCursor() {
|
|
6800
|
-
const u2 = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
6801
|
-
`).length - 1;
|
|
6802
|
-
this.output.write(import_sisteransi.cursor.move(-999, u2 * -1));
|
|
6803
|
-
}
|
|
6804
|
-
render() {
|
|
6805
|
-
const u2 = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
6806
|
-
if (u2 !== this._prevFrame) {
|
|
6807
|
-
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
6808
|
-
else {
|
|
6809
|
-
const t = BD(this._prevFrame, u2);
|
|
6810
|
-
if (this.restoreCursor(), t && t?.length === 1) {
|
|
6811
|
-
const F2 = t[0];
|
|
6812
|
-
this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
6813
|
-
const s = u2.split(`
|
|
6814
|
-
`);
|
|
6815
|
-
this.output.write(s[F2]), this._prevFrame = u2, this.output.write(import_sisteransi.cursor.move(0, s.length - F2 - 1));
|
|
6816
|
-
return;
|
|
6817
|
-
}
|
|
6818
|
-
if (t && t?.length > 1) {
|
|
6819
|
-
const F2 = t[0];
|
|
6820
|
-
this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.down());
|
|
6821
|
-
const s = u2.split(`
|
|
6822
|
-
`).slice(F2);
|
|
6823
|
-
this.output.write(s.join(`
|
|
6824
|
-
`)), this._prevFrame = u2;
|
|
6825
|
-
return;
|
|
6826
|
-
}
|
|
6827
|
-
this.output.write(import_sisteransi.erase.down());
|
|
6828
|
-
}
|
|
6829
|
-
this.output.write(u2), this.state === "initial" && (this.state = "active"), this._prevFrame = u2;
|
|
6830
|
-
}
|
|
6831
|
-
}
|
|
6832
|
-
};
|
|
6833
|
-
var dD = class extends x {
|
|
6834
|
-
get cursor() {
|
|
6835
|
-
return this.value ? 0 : 1;
|
|
6836
|
-
}
|
|
6837
|
-
get _value() {
|
|
6838
|
-
return this.cursor === 0;
|
|
6839
|
-
}
|
|
6840
|
-
constructor(u2) {
|
|
6841
|
-
super(u2, false), this.value = !!u2.initialValue, this.on("value", () => {
|
|
6842
|
-
this.value = this._value;
|
|
6843
|
-
}), this.on("confirm", (t) => {
|
|
6844
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
6845
|
-
}), this.on("cursor", () => {
|
|
6846
|
-
this.value = !this.value;
|
|
6847
|
-
});
|
|
6848
|
-
}
|
|
6849
|
-
};
|
|
6850
|
-
var A;
|
|
6851
|
-
A = /* @__PURE__ */ new WeakMap();
|
|
6852
|
-
var kD = Object.defineProperty;
|
|
6853
|
-
var $D = (e2, u2, t) => u2 in e2 ? kD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
|
|
6854
|
-
var H = (e2, u2, t) => ($D(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
|
|
6855
|
-
var SD = class extends x {
|
|
6856
|
-
constructor(u2) {
|
|
6857
|
-
super(u2, false), H(this, "options"), H(this, "cursor", 0), this.options = u2.options, this.value = [...u2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u2.cursorAt), 0), this.on("key", (t) => {
|
|
6858
|
-
t === "a" && this.toggleAll();
|
|
6859
|
-
}), this.on("cursor", (t) => {
|
|
6860
|
-
switch (t) {
|
|
6861
|
-
case "left":
|
|
6862
|
-
case "up":
|
|
6863
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
6864
|
-
break;
|
|
6865
|
-
case "down":
|
|
6866
|
-
case "right":
|
|
6867
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
6868
|
-
break;
|
|
6869
|
-
case "space":
|
|
6870
|
-
this.toggleValue();
|
|
6871
|
-
break;
|
|
6872
|
-
}
|
|
6873
|
-
});
|
|
6874
|
-
}
|
|
6875
|
-
get _value() {
|
|
6876
|
-
return this.options[this.cursor].value;
|
|
6877
|
-
}
|
|
6878
|
-
toggleAll() {
|
|
6879
|
-
const u2 = this.value.length === this.options.length;
|
|
6880
|
-
this.value = u2 ? [] : this.options.map((t) => t.value);
|
|
6881
|
-
}
|
|
6882
|
-
toggleValue() {
|
|
6883
|
-
const u2 = this.value.includes(this._value);
|
|
6884
|
-
this.value = u2 ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
6885
|
-
}
|
|
6886
|
-
};
|
|
6887
|
-
var TD = Object.defineProperty;
|
|
6888
|
-
var jD = (e2, u2, t) => u2 in e2 ? TD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
|
|
6889
|
-
var U = (e2, u2, t) => (jD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
|
|
6890
|
-
var MD = class extends x {
|
|
6891
|
-
constructor({ mask: u2, ...t }) {
|
|
6892
|
-
super(t), U(this, "valueWithCursor", ""), U(this, "_mask", "\u2022"), this._mask = u2 ?? "\u2022", this.on("finalize", () => {
|
|
6893
|
-
this.valueWithCursor = this.masked;
|
|
6894
|
-
}), this.on("value", () => {
|
|
6895
|
-
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
6896
|
-
else {
|
|
6897
|
-
const F2 = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
|
|
6898
|
-
this.valueWithCursor = `${F2}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
|
|
6899
|
-
}
|
|
6900
|
-
});
|
|
6901
|
-
}
|
|
6902
|
-
get cursor() {
|
|
6903
|
-
return this._cursor;
|
|
6904
|
-
}
|
|
6905
|
-
get masked() {
|
|
6906
|
-
return this.value.replaceAll(/./g, this._mask);
|
|
6907
|
-
}
|
|
6908
|
-
};
|
|
6909
|
-
var OD = Object.defineProperty;
|
|
6910
|
-
var PD = (e2, u2, t) => u2 in e2 ? OD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
|
|
6911
|
-
var J = (e2, u2, t) => (PD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
|
|
6912
|
-
var LD = class extends x {
|
|
6913
|
-
constructor(u2) {
|
|
6914
|
-
super(u2, false), J(this, "options"), J(this, "cursor", 0), this.options = u2.options, this.cursor = this.options.findIndex(({ value: t }) => t === u2.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
6915
|
-
switch (t) {
|
|
6916
|
-
case "left":
|
|
6917
|
-
case "up":
|
|
6918
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
6919
|
-
break;
|
|
6920
|
-
case "down":
|
|
6921
|
-
case "right":
|
|
6922
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
6923
|
-
break;
|
|
6924
|
-
}
|
|
6925
|
-
this.changeValue();
|
|
6926
|
-
});
|
|
6927
|
-
}
|
|
6928
|
-
get _value() {
|
|
6929
|
-
return this.options[this.cursor];
|
|
6930
|
-
}
|
|
6931
|
-
changeValue() {
|
|
6932
|
-
this.value = this._value.value;
|
|
6933
|
-
}
|
|
6934
|
-
};
|
|
6935
|
-
var RD = class extends x {
|
|
6936
|
-
get valueWithCursor() {
|
|
6937
|
-
if (this.state === "submit") return this.value;
|
|
6938
|
-
if (this.cursor >= this.value.length) return `${this.value}\u2588`;
|
|
6939
|
-
const u2 = this.value.slice(0, this.cursor), [t, ...F2] = this.value.slice(this.cursor);
|
|
6940
|
-
return `${u2}${import_picocolors.default.inverse(t)}${F2.join("")}`;
|
|
6941
|
-
}
|
|
6942
|
-
get cursor() {
|
|
6943
|
-
return this._cursor;
|
|
6944
|
-
}
|
|
6945
|
-
constructor(u2) {
|
|
6946
|
-
super(u2), this.on("finalize", () => {
|
|
6947
|
-
this.value || (this.value = u2.defaultValue);
|
|
6948
|
-
});
|
|
6949
|
-
}
|
|
6950
|
-
};
|
|
6951
|
-
|
|
6952
|
-
// ../../node_modules/@clack/prompts/dist/index.mjs
|
|
6953
|
-
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
6954
|
-
var import_sisteransi2 = __toESM(require_src2(), 1);
|
|
6955
|
-
import y2 from "process";
|
|
6956
|
-
function ce() {
|
|
6957
|
-
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
6958
|
-
}
|
|
6959
|
-
var V2 = ce();
|
|
6960
|
-
var u = (t, n) => V2 ? t : n;
|
|
6961
|
-
var le = u("\u25C6", "*");
|
|
6962
|
-
var L2 = u("\u25A0", "x");
|
|
6963
|
-
var W2 = u("\u25B2", "x");
|
|
6964
|
-
var C = u("\u25C7", "o");
|
|
6965
|
-
var ue = u("\u250C", "T");
|
|
6966
|
-
var o = u("\u2502", "|");
|
|
6967
|
-
var d2 = u("\u2514", "\u2014");
|
|
6968
|
-
var k2 = u("\u25CF", ">");
|
|
6969
|
-
var P2 = u("\u25CB", " ");
|
|
6970
|
-
var A2 = u("\u25FB", "[\u2022]");
|
|
6971
|
-
var T = u("\u25FC", "[+]");
|
|
6972
|
-
var F = u("\u25FB", "[ ]");
|
|
6973
|
-
var $e = u("\u25AA", "\u2022");
|
|
6974
|
-
var _2 = u("\u2500", "-");
|
|
6975
|
-
var me = u("\u256E", "+");
|
|
6976
|
-
var de = u("\u251C", "+");
|
|
6977
|
-
var pe = u("\u256F", "+");
|
|
6978
|
-
var q = u("\u25CF", "\u2022");
|
|
6979
|
-
var D = u("\u25C6", "*");
|
|
6980
|
-
var U2 = u("\u25B2", "!");
|
|
6981
|
-
var K2 = u("\u25A0", "x");
|
|
6982
|
-
var b2 = (t) => {
|
|
6983
|
-
switch (t) {
|
|
6984
|
-
case "initial":
|
|
6985
|
-
case "active":
|
|
6986
|
-
return import_picocolors2.default.cyan(le);
|
|
6987
|
-
case "cancel":
|
|
6988
|
-
return import_picocolors2.default.red(L2);
|
|
6989
|
-
case "error":
|
|
6990
|
-
return import_picocolors2.default.yellow(W2);
|
|
6991
|
-
case "submit":
|
|
6992
|
-
return import_picocolors2.default.green(C);
|
|
6993
|
-
}
|
|
6994
|
-
};
|
|
6995
|
-
var G2 = (t) => {
|
|
6996
|
-
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c2 = Math.max(process.stdout.rows - 4, 0), a = Math.min(c2, Math.max(s, 5));
|
|
6997
|
-
let l2 = 0;
|
|
6998
|
-
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
6999
|
-
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
|
|
7000
|
-
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
7001
|
-
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
7002
|
-
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
7003
|
-
});
|
|
7004
|
-
};
|
|
7005
|
-
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
7006
|
-
const n = `${import_picocolors2.default.gray(o)}
|
|
7007
|
-
${b2(this.state)} ${t.message}
|
|
7008
|
-
`, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
7009
|
-
switch (this.state) {
|
|
7010
|
-
case "error":
|
|
7011
|
-
return `${n.trim()}
|
|
7012
|
-
${import_picocolors2.default.yellow(o)} ${i}
|
|
7013
|
-
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
7014
|
-
`;
|
|
7015
|
-
case "submit":
|
|
7016
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
7017
|
-
case "cancel":
|
|
7018
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
7019
|
-
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
7020
|
-
default:
|
|
7021
|
-
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
7022
|
-
${import_picocolors2.default.cyan(d2)}
|
|
7023
|
-
`;
|
|
7024
|
-
}
|
|
7025
|
-
} }).prompt();
|
|
7026
|
-
var ge = (t) => new MD({ validate: t.validate, mask: t.mask ?? $e, render() {
|
|
7027
|
-
const n = `${import_picocolors2.default.gray(o)}
|
|
7028
|
-
${b2(this.state)} ${t.message}
|
|
7029
|
-
`, r2 = this.valueWithCursor, i = this.masked;
|
|
7030
|
-
switch (this.state) {
|
|
7031
|
-
case "error":
|
|
7032
|
-
return `${n.trim()}
|
|
7033
|
-
${import_picocolors2.default.yellow(o)} ${i}
|
|
7034
|
-
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
7035
|
-
`;
|
|
7036
|
-
case "submit":
|
|
7037
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(i)}`;
|
|
7038
|
-
case "cancel":
|
|
7039
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(i ?? ""))}${i ? `
|
|
7040
|
-
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
7041
|
-
default:
|
|
7042
|
-
return `${n}${import_picocolors2.default.cyan(o)} ${r2}
|
|
7043
|
-
${import_picocolors2.default.cyan(d2)}
|
|
7044
|
-
`;
|
|
7045
|
-
}
|
|
7046
|
-
} }).prompt();
|
|
7047
|
-
var ye = (t) => {
|
|
7048
|
-
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
7049
|
-
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
7050
|
-
const i = `${import_picocolors2.default.gray(o)}
|
|
7051
|
-
${b2(this.state)} ${t.message}
|
|
7052
|
-
`, s = this.value ? n : r2;
|
|
7053
|
-
switch (this.state) {
|
|
7054
|
-
case "submit":
|
|
7055
|
-
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
7056
|
-
case "cancel":
|
|
7057
|
-
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
7058
|
-
${import_picocolors2.default.gray(o)}`;
|
|
7059
|
-
default:
|
|
7060
|
-
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
|
|
7061
|
-
${import_picocolors2.default.cyan(d2)}
|
|
7062
|
-
`;
|
|
7063
|
-
}
|
|
7064
|
-
} }).prompt();
|
|
7065
|
-
};
|
|
7066
|
-
var ve = (t) => {
|
|
7067
|
-
const n = (r2, i) => {
|
|
7068
|
-
const s = r2.label ?? String(r2.value);
|
|
7069
|
-
switch (i) {
|
|
7070
|
-
case "selected":
|
|
7071
|
-
return `${import_picocolors2.default.dim(s)}`;
|
|
7072
|
-
case "active":
|
|
7073
|
-
return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
|
|
7074
|
-
case "cancelled":
|
|
7075
|
-
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
7076
|
-
default:
|
|
7077
|
-
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
7078
|
-
}
|
|
7079
|
-
};
|
|
7080
|
-
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
7081
|
-
const r2 = `${import_picocolors2.default.gray(o)}
|
|
7082
|
-
${b2(this.state)} ${t.message}
|
|
7083
|
-
`;
|
|
7084
|
-
switch (this.state) {
|
|
7085
|
-
case "submit":
|
|
7086
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
7087
|
-
case "cancel":
|
|
7088
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
7089
|
-
${import_picocolors2.default.gray(o)}`;
|
|
7090
|
-
default:
|
|
7091
|
-
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
7092
|
-
${import_picocolors2.default.cyan(o)} `)}
|
|
7093
|
-
${import_picocolors2.default.cyan(d2)}
|
|
7094
|
-
`;
|
|
7095
|
-
}
|
|
7096
|
-
} }).prompt();
|
|
7097
|
-
};
|
|
7098
|
-
var fe = (t) => {
|
|
7099
|
-
const n = (r2, i) => {
|
|
7100
|
-
const s = r2.label ?? String(r2.value);
|
|
7101
|
-
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
|
|
7102
|
-
};
|
|
7103
|
-
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
7104
|
-
if (this.required && r2.length === 0) return `Please select at least one option.
|
|
7105
|
-
${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
|
|
7106
|
-
}, render() {
|
|
7107
|
-
const r2 = `${import_picocolors2.default.gray(o)}
|
|
7108
|
-
${b2(this.state)} ${t.message}
|
|
7109
|
-
`, i = (s, c2) => {
|
|
7110
|
-
const a = this.value.includes(s.value);
|
|
7111
|
-
return c2 && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c2 ? "active" : "inactive");
|
|
7112
|
-
};
|
|
7113
|
-
switch (this.state) {
|
|
7114
|
-
case "submit":
|
|
7115
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
|
|
7116
|
-
case "cancel": {
|
|
7117
|
-
const s = this.options.filter(({ value: c2 }) => this.value.includes(c2)).map((c2) => n(c2, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
7118
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
|
|
7119
|
-
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
7120
|
-
}
|
|
7121
|
-
case "error": {
|
|
7122
|
-
const s = this.error.split(`
|
|
7123
|
-
`).map((c2, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c2)}` : ` ${c2}`).join(`
|
|
7124
|
-
`);
|
|
7125
|
-
return `${r2 + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
7126
|
-
${import_picocolors2.default.yellow(o)} `)}
|
|
7127
|
-
${s}
|
|
7128
|
-
`;
|
|
7129
|
-
}
|
|
7130
|
-
default:
|
|
7131
|
-
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
7132
|
-
${import_picocolors2.default.cyan(o)} `)}
|
|
7133
|
-
${import_picocolors2.default.cyan(d2)}
|
|
7134
|
-
`;
|
|
7135
|
-
}
|
|
7136
|
-
} }).prompt();
|
|
7137
|
-
};
|
|
7138
|
-
var Me = (t = "", n = "") => {
|
|
7139
|
-
const r2 = `
|
|
7140
|
-
${t}
|
|
7141
|
-
`.split(`
|
|
7142
|
-
`), i = S2(n).length, s = Math.max(r2.reduce((a, l2) => {
|
|
7143
|
-
const $2 = S2(l2);
|
|
7144
|
-
return $2.length > a ? $2.length : a;
|
|
7145
|
-
}, 0), i) + 2, c2 = r2.map((a) => `${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(a)}${" ".repeat(s - S2(a).length)}${import_picocolors2.default.gray(o)}`).join(`
|
|
7146
|
-
`);
|
|
7147
|
-
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
7148
|
-
${import_picocolors2.default.green(C)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(_2.repeat(Math.max(s - i - 1, 1)) + me)}
|
|
7149
|
-
${c2}
|
|
7150
|
-
${import_picocolors2.default.gray(de + _2.repeat(s + 2) + pe)}
|
|
7151
|
-
`);
|
|
7152
|
-
};
|
|
7153
|
-
var xe = (t = "") => {
|
|
7154
|
-
process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(t)}
|
|
7155
|
-
|
|
7156
|
-
`);
|
|
7157
|
-
};
|
|
7158
|
-
var Ie = (t = "") => {
|
|
7159
|
-
process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
|
|
7160
|
-
`);
|
|
7161
|
-
};
|
|
7162
|
-
var Se = (t = "") => {
|
|
7163
|
-
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
7164
|
-
${import_picocolors2.default.gray(d2)} ${t}
|
|
7165
|
-
|
|
7166
|
-
`);
|
|
7167
|
-
};
|
|
7168
|
-
var M2 = { message: (t = "", { symbol: n = import_picocolors2.default.gray(o) } = {}) => {
|
|
7169
|
-
const r2 = [`${import_picocolors2.default.gray(o)}`];
|
|
7170
|
-
if (t) {
|
|
7171
|
-
const [i, ...s] = t.split(`
|
|
7172
|
-
`);
|
|
7173
|
-
r2.push(`${n} ${i}`, ...s.map((c2) => `${import_picocolors2.default.gray(o)} ${c2}`));
|
|
7174
|
-
}
|
|
7175
|
-
process.stdout.write(`${r2.join(`
|
|
7176
|
-
`)}
|
|
7177
|
-
`);
|
|
7178
|
-
}, info: (t) => {
|
|
7179
|
-
M2.message(t, { symbol: import_picocolors2.default.blue(q) });
|
|
7180
|
-
}, success: (t) => {
|
|
7181
|
-
M2.message(t, { symbol: import_picocolors2.default.green(D) });
|
|
7182
|
-
}, step: (t) => {
|
|
7183
|
-
M2.message(t, { symbol: import_picocolors2.default.green(C) });
|
|
7184
|
-
}, warn: (t) => {
|
|
7185
|
-
M2.message(t, { symbol: import_picocolors2.default.yellow(U2) });
|
|
7186
|
-
}, warning: (t) => {
|
|
7187
|
-
M2.warn(t);
|
|
7188
|
-
}, error: (t) => {
|
|
7189
|
-
M2.message(t, { symbol: import_picocolors2.default.red(K2) });
|
|
7190
|
-
} };
|
|
7191
|
-
var J2 = `${import_picocolors2.default.gray(o)} `;
|
|
7192
|
-
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
7193
|
-
const n = V2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
7194
|
-
let s, c2, a = false, l2 = "", $2, g2 = performance.now();
|
|
7195
|
-
const p2 = (m2) => {
|
|
7196
|
-
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
|
|
7197
|
-
a && N2(h2, m2);
|
|
7198
|
-
}, v2 = () => p2(2), f = () => p2(1), j2 = () => {
|
|
7199
|
-
process.on("uncaughtExceptionMonitor", v2), process.on("unhandledRejection", v2), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
|
|
7200
|
-
}, E = () => {
|
|
7201
|
-
process.removeListener("uncaughtExceptionMonitor", v2), process.removeListener("unhandledRejection", v2), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
|
|
7202
|
-
}, B2 = () => {
|
|
7203
|
-
if ($2 === void 0) return;
|
|
7204
|
-
i && process.stdout.write(`
|
|
7205
|
-
`);
|
|
7206
|
-
const m2 = $2.split(`
|
|
7207
|
-
`);
|
|
7208
|
-
process.stdout.write(import_sisteransi2.cursor.move(-999, m2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(m2.length));
|
|
7209
|
-
}, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
|
|
7210
|
-
const h2 = (performance.now() - m2) / 1e3, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
|
|
7211
|
-
return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
|
|
7212
|
-
}, H2 = (m2 = "") => {
|
|
7213
|
-
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
7214
|
-
`);
|
|
7215
|
-
let h2 = 0, w2 = 0;
|
|
7216
|
-
j2(), c2 = setInterval(() => {
|
|
7217
|
-
if (i && l2 === $2) return;
|
|
7218
|
-
B2(), $2 = l2;
|
|
7219
|
-
const I2 = import_picocolors2.default.magenta(n[h2]);
|
|
7220
|
-
if (i) process.stdout.write(`${I2} ${l2}...`);
|
|
7221
|
-
else if (t === "timer") process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
|
|
7222
|
-
else {
|
|
7223
|
-
const z4 = ".".repeat(Math.floor(w2)).slice(0, 3);
|
|
7224
|
-
process.stdout.write(`${I2} ${l2}${z4}`);
|
|
7225
|
-
}
|
|
7226
|
-
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
|
|
7227
|
-
}, r2);
|
|
7228
|
-
}, N2 = (m2 = "", h2 = 0) => {
|
|
7229
|
-
a = false, clearInterval(c2), B2();
|
|
7230
|
-
const w2 = h2 === 0 ? import_picocolors2.default.green(C) : h2 === 1 ? import_picocolors2.default.red(L2) : import_picocolors2.default.red(W2);
|
|
7231
|
-
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
|
|
7232
|
-
`) : process.stdout.write(`${w2} ${l2}
|
|
7233
|
-
`), E(), s();
|
|
7234
|
-
};
|
|
7235
|
-
return { start: H2, stop: N2, message: (m2 = "") => {
|
|
7236
|
-
l2 = R2(m2 ?? l2);
|
|
7237
|
-
} };
|
|
7238
|
-
};
|
|
7239
|
-
|
|
7240
6329
|
// src/utils/cli-prompts.ts
|
|
6330
|
+
import * as clack from "@clack/prompts";
|
|
7241
6331
|
import { logger as logger5 } from "@elizaos/core";
|
|
7242
6332
|
var NAV_BACK = "__back__";
|
|
7243
6333
|
var NAV_NEXT = "__next__";
|
|
7244
6334
|
async function promptWithNav(label, initial = "", validate) {
|
|
7245
6335
|
const msg = `${label}${initial ? ` (current: ${initial})` : ""}`;
|
|
7246
|
-
const input = await
|
|
6336
|
+
const input = await clack.text({
|
|
7247
6337
|
message: msg,
|
|
7248
6338
|
placeholder: initial,
|
|
7249
6339
|
defaultValue: initial,
|
|
@@ -7252,8 +6342,8 @@ async function promptWithNav(label, initial = "", validate) {
|
|
|
7252
6342
|
return typeof result === "string" ? result : void 0;
|
|
7253
6343
|
} : void 0
|
|
7254
6344
|
});
|
|
7255
|
-
if (
|
|
7256
|
-
|
|
6345
|
+
if (clack.isCancel(input)) {
|
|
6346
|
+
clack.cancel("Operation cancelled.");
|
|
7257
6347
|
process.exit(0);
|
|
7258
6348
|
}
|
|
7259
6349
|
const trimmedInput = input.trim();
|
|
@@ -7289,12 +6379,12 @@ ${fieldName}`);
|
|
|
7289
6379
|
return items;
|
|
7290
6380
|
}
|
|
7291
6381
|
async function confirmAction(message) {
|
|
7292
|
-
const response = await
|
|
6382
|
+
const response = await clack.confirm({
|
|
7293
6383
|
message,
|
|
7294
6384
|
initialValue: false
|
|
7295
6385
|
});
|
|
7296
|
-
if (
|
|
7297
|
-
|
|
6386
|
+
if (clack.isCancel(response)) {
|
|
6387
|
+
clack.cancel("Operation cancelled.");
|
|
7298
6388
|
process.exit(0);
|
|
7299
6389
|
}
|
|
7300
6390
|
return Boolean(response);
|
|
@@ -7306,9 +6396,7 @@ import { promises as fs5 } from "fs";
|
|
|
7306
6396
|
import { logger as logger7 } from "@elizaos/core";
|
|
7307
6397
|
|
|
7308
6398
|
// src/utils/env-prompt.ts
|
|
7309
|
-
import
|
|
7310
|
-
import path5 from "path";
|
|
7311
|
-
import { logger as logger6 } from "@elizaos/core";
|
|
6399
|
+
import * as clack2 from "@clack/prompts";
|
|
7312
6400
|
|
|
7313
6401
|
// ../../node_modules/yoctocolors/base.js
|
|
7314
6402
|
var base_exports = {};
|
|
@@ -7423,6 +6511,9 @@ var bgCyanBright = format(106, 49);
|
|
|
7423
6511
|
var bgWhiteBright = format(107, 49);
|
|
7424
6512
|
|
|
7425
6513
|
// src/utils/env-prompt.ts
|
|
6514
|
+
import { promises as fs4 } from "fs";
|
|
6515
|
+
import path5 from "path";
|
|
6516
|
+
import { logger as logger6 } from "@elizaos/core";
|
|
7426
6517
|
var ENV_VAR_CONFIGS = {
|
|
7427
6518
|
openai: [
|
|
7428
6519
|
{
|
|
@@ -7588,7 +6679,7 @@ ${config.name} ${config.required ? "(Required)" : "(Optional - press Enter to sk
|
|
|
7588
6679
|
if (config.url) {
|
|
7589
6680
|
console.log(base_exports.blue(`Get it here: ${config.url}`));
|
|
7590
6681
|
}
|
|
7591
|
-
const value = await (config.secret ?
|
|
6682
|
+
const value = await (config.secret ? clack2.password({
|
|
7592
6683
|
message: `Enter your ${config.name}:`,
|
|
7593
6684
|
validate: (input) => {
|
|
7594
6685
|
if (config.required && (!input || input.trim() === "")) {
|
|
@@ -7596,7 +6687,7 @@ ${config.name} ${config.required ? "(Required)" : "(Optional - press Enter to sk
|
|
|
7596
6687
|
}
|
|
7597
6688
|
return void 0;
|
|
7598
6689
|
}
|
|
7599
|
-
}) :
|
|
6690
|
+
}) : clack2.text({
|
|
7600
6691
|
message: `Enter your ${config.name}:`,
|
|
7601
6692
|
validate: (input) => {
|
|
7602
6693
|
if (config.required && (!input || input.trim() === "")) {
|
|
@@ -7605,8 +6696,8 @@ ${config.name} ${config.required ? "(Required)" : "(Optional - press Enter to sk
|
|
|
7605
6696
|
return void 0;
|
|
7606
6697
|
}
|
|
7607
6698
|
}));
|
|
7608
|
-
if (
|
|
7609
|
-
|
|
6699
|
+
if (clack2.isCancel(value)) {
|
|
6700
|
+
clack2.cancel("Operation cancelled.");
|
|
7610
6701
|
process.exit(0);
|
|
7611
6702
|
}
|
|
7612
6703
|
if (!config.required && (!value || value.trim() === "")) {
|
|
@@ -7662,9 +6753,11 @@ async function promptForEnvVars(pluginName) {
|
|
|
7662
6753
|
}
|
|
7663
6754
|
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
|
7664
6755
|
const value = await promptForEnvVar(config);
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
6756
|
+
if (value !== null) {
|
|
6757
|
+
result[config.key] = value;
|
|
6758
|
+
envVars[config.key] = value;
|
|
6759
|
+
process.env[config.key] = value;
|
|
6760
|
+
}
|
|
7668
6761
|
changes = true;
|
|
7669
6762
|
}
|
|
7670
6763
|
if (changes) {
|
|
@@ -7807,9 +6900,9 @@ async function getConfigFilePath() {
|
|
|
7807
6900
|
const envInfo = await UserEnvironment.getInstanceInfo();
|
|
7808
6901
|
return envInfo.paths.configPath;
|
|
7809
6902
|
}
|
|
7810
|
-
async function fileExists(
|
|
6903
|
+
async function fileExists(p) {
|
|
7811
6904
|
try {
|
|
7812
|
-
await fs5.access(
|
|
6905
|
+
await fs5.access(p);
|
|
7813
6906
|
return true;
|
|
7814
6907
|
} catch {
|
|
7815
6908
|
return false;
|
|
@@ -7874,12 +6967,15 @@ async function getPluginStatus() {
|
|
|
7874
6967
|
}
|
|
7875
6968
|
|
|
7876
6969
|
// src/utils/copy-template.ts
|
|
7877
|
-
import {
|
|
6970
|
+
import { existsSync as existsSync5 } from "fs";
|
|
6971
|
+
import { promises as fs6 } from "fs";
|
|
7878
6972
|
import path7 from "path";
|
|
7879
6973
|
import { logger as logger8 } from "@elizaos/core";
|
|
7880
6974
|
async function copyDir(src, dest, exclude = []) {
|
|
7881
|
-
|
|
7882
|
-
const
|
|
6975
|
+
const resolvedSrc = path7.resolve(src);
|
|
6976
|
+
const resolvedDest = path7.resolve(dest);
|
|
6977
|
+
await fs6.mkdir(resolvedDest, { recursive: true });
|
|
6978
|
+
const entries = await fs6.readdir(resolvedSrc, { withFileTypes: true });
|
|
7883
6979
|
const files = [];
|
|
7884
6980
|
const directories = [];
|
|
7885
6981
|
for (const entry of entries) {
|
|
@@ -7900,16 +6996,16 @@ async function copyDir(src, dest, exclude = []) {
|
|
|
7900
6996
|
for (let i = 0; i < files.length; i += MAX_CONCURRENT_FILES) {
|
|
7901
6997
|
const batch = files.slice(i, i + MAX_CONCURRENT_FILES);
|
|
7902
6998
|
const batchPromises = batch.map(async (entry) => {
|
|
7903
|
-
const srcPath = path7.join(
|
|
7904
|
-
const destPath = path7.join(
|
|
6999
|
+
const srcPath = path7.join(resolvedSrc, entry.name);
|
|
7000
|
+
const destPath = path7.join(resolvedDest, entry.name);
|
|
7905
7001
|
await fs6.copyFile(srcPath, destPath);
|
|
7906
7002
|
});
|
|
7907
7003
|
filePromises.push(...batchPromises);
|
|
7908
7004
|
}
|
|
7909
7005
|
await Promise.all(filePromises);
|
|
7910
7006
|
for (const entry of directories) {
|
|
7911
|
-
const srcPath = path7.join(
|
|
7912
|
-
const destPath = path7.join(
|
|
7007
|
+
const srcPath = path7.join(resolvedSrc, entry.name);
|
|
7008
|
+
const destPath = path7.join(resolvedDest, entry.name);
|
|
7913
7009
|
await copyDir(srcPath, destPath, exclude);
|
|
7914
7010
|
}
|
|
7915
7011
|
}
|
|
@@ -7925,26 +7021,40 @@ function getPackageName(templateType) {
|
|
|
7925
7021
|
return "project-starter";
|
|
7926
7022
|
}
|
|
7927
7023
|
}
|
|
7928
|
-
async function copyTemplate(templateType, targetDir
|
|
7024
|
+
async function copyTemplate(templateType, targetDir) {
|
|
7929
7025
|
const packageName = getPackageName(templateType);
|
|
7930
|
-
const
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
templateDir = path7.resolve(process.cwd(), "packages", packageName);
|
|
7943
|
-
} else {
|
|
7944
|
-
templateDir = path7.resolve(
|
|
7026
|
+
const possibleTemplatePaths = [
|
|
7027
|
+
// 1. Direct path from source directory (for tests and development)
|
|
7028
|
+
path7.resolve(__dirname, "../../templates", packageName),
|
|
7029
|
+
// 2. Production: templates bundled with the CLI dist
|
|
7030
|
+
path7.resolve(
|
|
7031
|
+
path7.dirname(__require.resolve("@elizaos/cli/package.json")),
|
|
7032
|
+
"dist",
|
|
7033
|
+
"templates",
|
|
7034
|
+
packageName
|
|
7035
|
+
),
|
|
7036
|
+
// 3. Development/Test: templates in the CLI package root
|
|
7037
|
+
path7.resolve(
|
|
7945
7038
|
path7.dirname(__require.resolve("@elizaos/cli/package.json")),
|
|
7946
7039
|
"templates",
|
|
7947
7040
|
packageName
|
|
7041
|
+
),
|
|
7042
|
+
// 4. Fallback: relative to current module (for built dist)
|
|
7043
|
+
path7.resolve(__dirname, "..", "templates", packageName),
|
|
7044
|
+
// 5. Additional fallback: relative to dist directory
|
|
7045
|
+
path7.resolve(__dirname, "..", "..", "templates", packageName)
|
|
7046
|
+
];
|
|
7047
|
+
let templateDir = null;
|
|
7048
|
+
for (const possiblePath of possibleTemplatePaths) {
|
|
7049
|
+
if (existsSync5(possiblePath)) {
|
|
7050
|
+
templateDir = possiblePath;
|
|
7051
|
+
break;
|
|
7052
|
+
}
|
|
7053
|
+
}
|
|
7054
|
+
if (!templateDir) {
|
|
7055
|
+
throw new Error(
|
|
7056
|
+
`Template '${packageName}' not found. Searched in:
|
|
7057
|
+
${possibleTemplatePaths.join("\n")}`
|
|
7948
7058
|
);
|
|
7949
7059
|
}
|
|
7950
7060
|
logger8.debug(`Copying ${templateType} template from ${templateDir} to ${targetDir}`);
|
|
@@ -7995,7 +7105,7 @@ async function replacePluginNameInFiles(targetDir, pluginName) {
|
|
|
7995
7105
|
"__tests__/plugin.test.ts",
|
|
7996
7106
|
"e2e/starter-plugin.test.ts",
|
|
7997
7107
|
"README.md"
|
|
7998
|
-
//
|
|
7108
|
+
// package.json name is handled by the publish command
|
|
7999
7109
|
];
|
|
8000
7110
|
const promises2 = filesToProcess.map(async (filePath) => {
|
|
8001
7111
|
const fullPath = path7.join(targetDir, filePath);
|
|
@@ -8007,7 +7117,9 @@ async function replacePluginNameInFiles(targetDir, pluginName) {
|
|
|
8007
7117
|
logger8.debug(`Updated plugin name in ${filePath}`);
|
|
8008
7118
|
}
|
|
8009
7119
|
} catch (error) {
|
|
8010
|
-
logger8.warn(
|
|
7120
|
+
logger8.warn(
|
|
7121
|
+
`Could not update ${filePath}: ${error instanceof Error ? error.message : String(error)}`
|
|
7122
|
+
);
|
|
8011
7123
|
}
|
|
8012
7124
|
});
|
|
8013
7125
|
await Promise.all(promises2);
|
|
@@ -8027,7 +7139,7 @@ async function copyClientDist() {
|
|
|
8027
7139
|
break;
|
|
8028
7140
|
}
|
|
8029
7141
|
logger8.info(`Waiting for client index.html (attempt ${retries + 1}/${maxRetries})\u2026`);
|
|
8030
|
-
await new Promise((
|
|
7142
|
+
await new Promise((r) => setTimeout(r, retryDelay));
|
|
8031
7143
|
retries++;
|
|
8032
7144
|
}
|
|
8033
7145
|
if (!existsSync5(indexSrc)) {
|
|
@@ -8043,20 +7155,20 @@ async function copyClientDist() {
|
|
|
8043
7155
|
}
|
|
8044
7156
|
|
|
8045
7157
|
// src/utils/display-banner.ts
|
|
8046
|
-
import
|
|
7158
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
|
|
8047
7159
|
import path8, { dirname } from "path";
|
|
8048
7160
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
8049
7161
|
import { execa as execa4 } from "execa";
|
|
8050
7162
|
function getVersion() {
|
|
8051
7163
|
const __filename = fileURLToPath2(import.meta.url);
|
|
8052
|
-
const
|
|
8053
|
-
const packageJsonPath = path8.resolve(
|
|
7164
|
+
const __dirname2 = dirname(__filename);
|
|
7165
|
+
const packageJsonPath = path8.resolve(__dirname2, "../package.json");
|
|
8054
7166
|
let version = "0.0.0";
|
|
8055
|
-
if (!
|
|
7167
|
+
if (!existsSync6(packageJsonPath)) {
|
|
8056
7168
|
console.error(`Warning: package.json not found at ${packageJsonPath}`);
|
|
8057
7169
|
} else {
|
|
8058
7170
|
try {
|
|
8059
|
-
const packageJson = JSON.parse(
|
|
7171
|
+
const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf-8"));
|
|
8060
7172
|
version = packageJson.version || "0.0.0";
|
|
8061
7173
|
} catch (error) {
|
|
8062
7174
|
console.error(`Error reading or parsing package.json at ${packageJsonPath}:`, error);
|
|
@@ -8075,8 +7187,8 @@ function getCliInstallTag() {
|
|
|
8075
7187
|
}
|
|
8076
7188
|
function isUtf8Locale() {
|
|
8077
7189
|
for (const key2 of ["LC_ALL", "LC_CTYPE", "LANG", "LANGUAGE"]) {
|
|
8078
|
-
const
|
|
8079
|
-
if (typeof
|
|
7190
|
+
const v = process.env[key2];
|
|
7191
|
+
if (typeof v === "string" && /UTF-?8/i.test(v)) {
|
|
8080
7192
|
return true;
|
|
8081
7193
|
}
|
|
8082
7194
|
}
|
|
@@ -8147,12 +7259,11 @@ async function displayBanner(skipUpdateCheck = false) {
|
|
|
8147
7259
|
if (!isUtf8Locale()) {
|
|
8148
7260
|
return;
|
|
8149
7261
|
}
|
|
8150
|
-
const
|
|
7262
|
+
const b = "\x1B[38;5;27m";
|
|
8151
7263
|
const lightblue = "\x1B[38;5;51m";
|
|
8152
|
-
const
|
|
8153
|
-
const
|
|
7264
|
+
const w = "\x1B[38;5;255m";
|
|
7265
|
+
const r = "\x1B[0m";
|
|
8154
7266
|
const orange = "\x1B[38;5;208m";
|
|
8155
|
-
const green2 = "\x1B[38;5;118m";
|
|
8156
7267
|
let versionColor = lightblue;
|
|
8157
7268
|
const version = getVersion();
|
|
8158
7269
|
if (version?.includes("alpha")) {
|
|
@@ -8191,21 +7302,21 @@ async function displayBanner(skipUpdateCheck = false) {
|
|
|
8191
7302
|
// ${b} #+# #+# #+# #+# #+# #+##${w}+# #+##+# #+# ${r}
|
|
8192
7303
|
// ${b}########################################## #### ${w}####### ######## ${r}`,
|
|
8193
7304
|
`
|
|
8194
|
-
${
|
|
8195
|
-
${
|
|
8196
|
-
${
|
|
8197
|
-
${
|
|
8198
|
-
${
|
|
8199
|
-
${
|
|
8200
|
-
${
|
|
8201
|
-
${
|
|
8202
|
-
${
|
|
7305
|
+
${b}\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2880\u28D0\u28FF\u28FF\u28B0\u2840\u2800\u2800\u2800${w} \u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800${w}\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800${r}
|
|
7306
|
+
${b}\u2800\u2800\u2800\u2800\u2800\u2880\u28F4\u2824\u283E\u281B\u281B\u28FF\u28F6\u28C7\u2800\u2800\u2846${w} \u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800${w}\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800${r}
|
|
7307
|
+
${b}\u28B0\u28CB\u2873\u2844\u2800\u28A8\u28ED\u2840\u2800\u2864\u2800\u28C0\u28DD\u28BF\u28F6\u28FF\u2845${w} \u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800${w}\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800${r}
|
|
7308
|
+
${b}\u28B8\u28EF\u2800\u28C7\u2800\u28FC\u28FF\u28FF\u28C6\u28B7\u28F4\u28FF\u28FF\u284F\u28DB\u2849\u2800${w} \u28B8\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28B8\u28FF\u28FF\u2800\u2800\u2800\u2800\u2800\u28FF\u28FF\u2847\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u2847\u2800\u2800\u2800\u28FE\u28FF\u28FF\u28E7\u2800\u2800\u2800${w}\u28B8\u281F\u2880\u28F4\u28FF\u28FF\u28FF\u28FF\u28E6\u2840\u28E0\u28FE\u28FF\u28FF\u28FF\u28FF\u28E6\u2859\u28BF${r}
|
|
7309
|
+
${b}\u2800\u2819\u28B7\u28EE\u28B8\u28FF\u28FF\u28FF\u28FF\u28F7\u28EF\u28DF\u28CF\u28FC\u28F7\u28C5\u283E${w} \u28B8\u28FF\u28C7\u28C0\u28C0\u28C0\u2800\u28B8\u28FF\u28FF\u2800\u2800\u2800\u2800\u2800\u28FF\u28FF\u2847\u2800\u2800\u2800\u28E0\u28FF\u28FF\u281F\u2801\u2800\u2800\u28FC\u28FF\u285F\u28FF\u28FF\u28C6\u2800\u2800${w}\u2800\u2800\u28FF\u28FF\u280B\u2800\u2808\u283B\u28FF\u2847\u28FF\u28FF\u28C5\u28C0\u28C0\u285B\u281B\u2803\u2800${r}
|
|
7310
|
+
${b}\u2800\u2800\u2800\u2801\u28B8\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u280B\u2800${w} \u28B8\u28FF\u287F\u283F\u283F\u283F\u2800\u28B8\u28FF\u28FF\u2800\u2800\u2800\u2800\u2800\u28FF\u28FF\u2847\u2800\u28E0\u28FE\u28FF\u281F\u2801\u2800\u2800\u2800\u28F0\u28FF\u28FF\u28C1\u28F8\u28FF\u28FF\u2844\u2800${w}\u2800\u2800\u28FF\u28FF \u2800\u2800 \u28FF\u28FF\u2888\u28DB\u283F\u283F\u283F\u28FF\u28F7\u2844\u2800${r}
|
|
7311
|
+
${b}\u2800\u2800\u2800\u2800\u2838\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28C9\u285F\u2800\u2800${w} \u28B8\u28FF\u28E7\u28E4\u28E4\u28E4\u28E4\u28B8\u28FF\u28FF\u28E6\u28E4\u28E4\u28E4\u2844\u28FF\u28FF\u2847\u28FE\u28FF\u28FF\u28E7\u28E4\u28E4\u28E4\u2844\u28B0\u28FF\u28FF\u281F\u281B\u281B\u283B\u28FF\u28FF\u2844${w}\u28A0\u2840\u283B\u28FF\u28FF\u28E6\u28F4\u28FF\u28FF\u2807\u28BF\u28FF\u28E6\u28E4\u28E4\u28FF\u28FF\u2807\u28E0${r}
|
|
7312
|
+
${b}\u2800\u2800\u2800\u2800\u28B0\u2848\u281B\u283F\u28FF\u28FF\u28FF\u28FF\u28FF\u280B\u2800 ${w} \u2818\u281B\u281B\u281B\u281B\u281B\u281B\u2808\u281B\u281B\u281B\u281B\u281B\u281B\u2803\u281B\u281B\u2803\u281B\u281B\u281B\u281B\u281B\u281B\u281B\u2803\u281B\u281B\u2803\u2800\u2800\u2800\u2800\u2819\u281B\u2803${w}\u2818\u281B\u2800\u2808\u281B\u281B\u281B\u281B\u2801\u2800\u2800\u2819\u281B\u281B\u281B\u281B\u2801\u281A\u281B${r}
|
|
7313
|
+
${b}\u2800\u2800\u2800\u2800\u28B8\u28FF\u2866\u2800\u2800\u2809\u281B\u283F\u2803\u2800\u2800\u2800 ${w} \u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800${w}\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800${r}
|
|
8203
7314
|
`
|
|
8204
7315
|
];
|
|
8205
7316
|
const randomBanner = banners[Math.floor(Math.random() * banners.length)];
|
|
8206
7317
|
console.log(randomBanner);
|
|
8207
7318
|
if (version) {
|
|
8208
|
-
console.log(`${versionColor}Version: ${version}${
|
|
7319
|
+
console.log(`${versionColor}Version: ${version}${r}`);
|
|
8209
7320
|
}
|
|
8210
7321
|
if (!skipUpdateCheck) {
|
|
8211
7322
|
try {
|
|
@@ -8219,18 +7330,19 @@ ${b3}\u2800\u2800\u2800\u2800\u28B8\u28FF\u2866\u2800\u2800\u2809\u281B\u283F\u2
|
|
|
8219
7330
|
var import_dotenv2 = __toESM(require_main(), 1);
|
|
8220
7331
|
import { logger as logger9 } from "@elizaos/core";
|
|
8221
7332
|
import path9 from "path";
|
|
8222
|
-
import { existsSync as
|
|
8223
|
-
import
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
7333
|
+
import { existsSync as existsSync7, promises as fs7 } from "fs";
|
|
7334
|
+
import * as clack3 from "@clack/prompts";
|
|
7335
|
+
import { z } from "zod";
|
|
7336
|
+
var postgresConfigSchema = z.object({
|
|
7337
|
+
type: z.literal("postgres"),
|
|
7338
|
+
config: z.object({
|
|
7339
|
+
url: z.string().optional()
|
|
8228
7340
|
})
|
|
8229
7341
|
});
|
|
8230
|
-
var pgliteConfigSchema =
|
|
8231
|
-
type:
|
|
8232
|
-
config:
|
|
8233
|
-
dataDir:
|
|
7342
|
+
var pgliteConfigSchema = z.object({
|
|
7343
|
+
type: z.literal("pglite"),
|
|
7344
|
+
config: z.object({
|
|
7345
|
+
dataDir: z.string()
|
|
8234
7346
|
})
|
|
8235
7347
|
});
|
|
8236
7348
|
var SAMPLE_ENV_TEMPLATE = `### elizaOS Environment Variables ###
|
|
@@ -8425,7 +7537,7 @@ function isValidPostgresUrl(url) {
|
|
|
8425
7537
|
if (!url || typeof url !== "string") return false;
|
|
8426
7538
|
try {
|
|
8427
7539
|
const parsedUrl = new URL(url);
|
|
8428
|
-
return parsedUrl.protocol === "postgresql:" && parsedUrl.hostname && parsedUrl.pathname && parsedUrl.pathname !== "/";
|
|
7540
|
+
return parsedUrl.protocol === "postgresql:" && !!parsedUrl.hostname && !!parsedUrl.pathname && parsedUrl.pathname !== "/";
|
|
8429
7541
|
} catch {
|
|
8430
7542
|
const patterns = [
|
|
8431
7543
|
/^postgresql:\/\/[^:]+:[^@]+@[^:]+:\d+\/\w+$/,
|
|
@@ -8451,18 +7563,18 @@ async function getElizaDirectories(targetProjectDir) {
|
|
|
8451
7563
|
return { elizaDir, elizaDbDir, envFilePath };
|
|
8452
7564
|
}
|
|
8453
7565
|
async function ensureDir(dirPath) {
|
|
8454
|
-
if (!
|
|
8455
|
-
await
|
|
7566
|
+
if (!existsSync7(dirPath)) {
|
|
7567
|
+
await fs7.mkdir(dirPath, { recursive: true });
|
|
8456
7568
|
logger9.debug(`Created directory: ${dirPath}`);
|
|
8457
7569
|
}
|
|
8458
7570
|
}
|
|
8459
7571
|
async function setupEnvFile(envFilePath) {
|
|
8460
7572
|
try {
|
|
8461
|
-
const envExists =
|
|
7573
|
+
const envExists = existsSync7(envFilePath);
|
|
8462
7574
|
if (!envExists) {
|
|
8463
7575
|
const mergedVars = mergeProcessEnvWithTemplate(SAMPLE_ENV_TEMPLATE);
|
|
8464
7576
|
const formattedContent = formatEnvFileWithTemplate(mergedVars, SAMPLE_ENV_TEMPLATE);
|
|
8465
|
-
await
|
|
7577
|
+
await fs7.writeFile(envFilePath, formattedContent, "utf8");
|
|
8466
7578
|
const processEnvCount = Object.keys(process.env).filter(
|
|
8467
7579
|
(key2) => process.env[key2] && process.env[key2].trim() !== ""
|
|
8468
7580
|
).length;
|
|
@@ -8470,12 +7582,12 @@ async function setupEnvFile(envFilePath) {
|
|
|
8470
7582
|
`[Config] Created .env file with ${processEnvCount} variables from process.env merged with example variables at: ${envFilePath}`
|
|
8471
7583
|
);
|
|
8472
7584
|
} else {
|
|
8473
|
-
const content = await
|
|
7585
|
+
const content = await fs7.readFile(envFilePath, "utf8");
|
|
8474
7586
|
const trimmedContent = content.trim();
|
|
8475
7587
|
if (trimmedContent === "") {
|
|
8476
7588
|
const mergedVars = mergeProcessEnvWithTemplate(SAMPLE_ENV_TEMPLATE);
|
|
8477
7589
|
const formattedContent = formatEnvFileWithTemplate(mergedVars, SAMPLE_ENV_TEMPLATE);
|
|
8478
|
-
await
|
|
7590
|
+
await fs7.writeFile(envFilePath, formattedContent, "utf8");
|
|
8479
7591
|
const processEnvCount = Object.keys(process.env).filter(
|
|
8480
7592
|
(key2) => process.env[key2] && process.env[key2].trim() !== ""
|
|
8481
7593
|
).length;
|
|
@@ -8499,19 +7611,19 @@ async function ensureElizaDir(targetProjectDir) {
|
|
|
8499
7611
|
await ensureDir(dirs.elizaDir);
|
|
8500
7612
|
const registryCachePath = path9.join(dirs.elizaDir, "registry-cache.json");
|
|
8501
7613
|
const configPath = path9.join(dirs.elizaDir, "config.json");
|
|
8502
|
-
if (!
|
|
8503
|
-
await
|
|
7614
|
+
if (!existsSync7(registryCachePath)) {
|
|
7615
|
+
await fs7.writeFile(registryCachePath, JSON.stringify({}, null, 2), "utf8");
|
|
8504
7616
|
logger9.debug(`Created registry cache file: ${registryCachePath}`);
|
|
8505
7617
|
}
|
|
8506
|
-
if (!
|
|
8507
|
-
await
|
|
7618
|
+
if (!existsSync7(configPath)) {
|
|
7619
|
+
await fs7.writeFile(configPath, JSON.stringify({ version: "1.0.0" }, null, 2), "utf8");
|
|
8508
7620
|
logger9.debug(`Created config file: ${configPath}`);
|
|
8509
7621
|
}
|
|
8510
7622
|
return dirs;
|
|
8511
7623
|
}
|
|
8512
7624
|
async function setupPgLite(dbDir, envPath, targetProjectDir) {
|
|
8513
7625
|
const dirs = await ensureElizaDir(targetProjectDir);
|
|
8514
|
-
const {
|
|
7626
|
+
const { elizaDbDir, envFilePath } = dirs;
|
|
8515
7627
|
const targetDbDir = dbDir || elizaDbDir;
|
|
8516
7628
|
const targetEnvPath = envPath || envFilePath;
|
|
8517
7629
|
try {
|
|
@@ -8533,12 +7645,12 @@ async function storePostgresUrl(url, envFilePath) {
|
|
|
8533
7645
|
if (!url) return;
|
|
8534
7646
|
try {
|
|
8535
7647
|
let content = "";
|
|
8536
|
-
if (
|
|
8537
|
-
content = await
|
|
7648
|
+
if (existsSync7(envFilePath)) {
|
|
7649
|
+
content = await fs7.readFile(envFilePath, "utf8");
|
|
8538
7650
|
}
|
|
8539
7651
|
const lines = content.split("\n").filter((line2) => !line2.startsWith("POSTGRES_URL="));
|
|
8540
7652
|
lines.push(`POSTGRES_URL=${url}`);
|
|
8541
|
-
await
|
|
7653
|
+
await fs7.writeFile(envFilePath, lines.join("\n"), "utf8");
|
|
8542
7654
|
process.env.POSTGRES_URL = url;
|
|
8543
7655
|
logger9.success("Postgres URL saved to configuration");
|
|
8544
7656
|
} catch (error) {
|
|
@@ -8550,12 +7662,12 @@ async function storePgliteDataDir(dataDir, envFilePath) {
|
|
|
8550
7662
|
if (!dataDir) return;
|
|
8551
7663
|
try {
|
|
8552
7664
|
let content = "";
|
|
8553
|
-
if (
|
|
8554
|
-
content = await
|
|
7665
|
+
if (existsSync7(envFilePath)) {
|
|
7666
|
+
content = await fs7.readFile(envFilePath, "utf8");
|
|
8555
7667
|
}
|
|
8556
7668
|
const lines = content.split("\n").filter((line2) => !line2.startsWith("PGLITE_DATA_DIR="));
|
|
8557
7669
|
lines.push(`PGLITE_DATA_DIR=${dataDir}`);
|
|
8558
|
-
await
|
|
7670
|
+
await fs7.writeFile(envFilePath, lines.join("\n"), "utf8");
|
|
8559
7671
|
process.env.PGLITE_DATA_DIR = dataDir;
|
|
8560
7672
|
logger9.success("PGLite data directory saved to configuration");
|
|
8561
7673
|
} catch (error) {
|
|
@@ -8564,8 +7676,8 @@ async function storePgliteDataDir(dataDir, envFilePath) {
|
|
|
8564
7676
|
}
|
|
8565
7677
|
}
|
|
8566
7678
|
async function promptAndStorePostgresUrl(envFilePath) {
|
|
8567
|
-
|
|
8568
|
-
const response = await
|
|
7679
|
+
clack3.intro("\u{1F5C4}\uFE0F PostgreSQL Configuration");
|
|
7680
|
+
const response = await clack3.text({
|
|
8569
7681
|
message: "Enter your Postgres URL:",
|
|
8570
7682
|
placeholder: "postgresql://user:password@host:port/dbname",
|
|
8571
7683
|
validate: (value) => {
|
|
@@ -8577,20 +7689,20 @@ async function promptAndStorePostgresUrl(envFilePath) {
|
|
|
8577
7689
|
return void 0;
|
|
8578
7690
|
}
|
|
8579
7691
|
});
|
|
8580
|
-
if (
|
|
8581
|
-
|
|
7692
|
+
if (clack3.isCancel(response)) {
|
|
7693
|
+
clack3.cancel("Operation cancelled.");
|
|
8582
7694
|
return null;
|
|
8583
7695
|
}
|
|
8584
|
-
const
|
|
8585
|
-
|
|
7696
|
+
const spinner2 = clack3.spinner();
|
|
7697
|
+
spinner2.start("Saving PostgreSQL configuration...");
|
|
8586
7698
|
try {
|
|
8587
7699
|
await storePostgresUrl(response, envFilePath);
|
|
8588
|
-
|
|
8589
|
-
|
|
7700
|
+
spinner2.stop("PostgreSQL configuration saved successfully!");
|
|
7701
|
+
clack3.outro("\u2713 Database connection configured");
|
|
8590
7702
|
return response;
|
|
8591
7703
|
} catch (error) {
|
|
8592
|
-
|
|
8593
|
-
|
|
7704
|
+
spinner2.stop("Failed to save configuration");
|
|
7705
|
+
clack3.log.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
8594
7706
|
return null;
|
|
8595
7707
|
}
|
|
8596
7708
|
}
|
|
@@ -8606,12 +7718,12 @@ async function storeOpenAIKey(key2, envFilePath) {
|
|
|
8606
7718
|
if (!key2) return;
|
|
8607
7719
|
try {
|
|
8608
7720
|
let content = "";
|
|
8609
|
-
if (
|
|
8610
|
-
content = await
|
|
7721
|
+
if (existsSync7(envFilePath)) {
|
|
7722
|
+
content = await fs7.readFile(envFilePath, "utf8");
|
|
8611
7723
|
}
|
|
8612
7724
|
const lines = content.split("\n").filter((line2) => !line2.startsWith("OPENAI_API_KEY="));
|
|
8613
7725
|
lines.push(`OPENAI_API_KEY=${key2}`);
|
|
8614
|
-
await
|
|
7726
|
+
await fs7.writeFile(envFilePath, lines.join("\n"), "utf8");
|
|
8615
7727
|
process.env.OPENAI_API_KEY = key2;
|
|
8616
7728
|
logger9.success("OpenAI API key saved to configuration");
|
|
8617
7729
|
} catch (error) {
|
|
@@ -8623,12 +7735,12 @@ async function storeAnthropicKey(key2, envFilePath) {
|
|
|
8623
7735
|
if (!key2) return;
|
|
8624
7736
|
try {
|
|
8625
7737
|
let content = "";
|
|
8626
|
-
if (
|
|
8627
|
-
content = await
|
|
7738
|
+
if (existsSync7(envFilePath)) {
|
|
7739
|
+
content = await fs7.readFile(envFilePath, "utf8");
|
|
8628
7740
|
}
|
|
8629
7741
|
const lines = content.split("\n").filter((line2) => !line2.startsWith("ANTHROPIC_API_KEY="));
|
|
8630
7742
|
lines.push(`ANTHROPIC_API_KEY=${key2}`);
|
|
8631
|
-
await
|
|
7743
|
+
await fs7.writeFile(envFilePath, lines.join("\n"), "utf8");
|
|
8632
7744
|
process.env.ANTHROPIC_API_KEY = key2;
|
|
8633
7745
|
logger9.success("Anthropic API key saved to configuration");
|
|
8634
7746
|
} catch (error) {
|
|
@@ -8637,69 +7749,148 @@ async function storeAnthropicKey(key2, envFilePath) {
|
|
|
8637
7749
|
}
|
|
8638
7750
|
}
|
|
8639
7751
|
async function promptAndStoreOpenAIKey(envFilePath) {
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
const response = await
|
|
7752
|
+
clack3.intro("\u{1F916} OpenAI API Configuration");
|
|
7753
|
+
clack3.note("Get your API key from: https://platform.openai.com/api-keys", "API Key Information");
|
|
7754
|
+
const response = await clack3.password({
|
|
8643
7755
|
message: "Enter your OpenAI API key:",
|
|
8644
7756
|
validate: (value) => {
|
|
8645
7757
|
if (value.trim() === "") return "OpenAI API key cannot be empty";
|
|
8646
7758
|
return void 0;
|
|
8647
7759
|
}
|
|
8648
7760
|
});
|
|
8649
|
-
if (
|
|
8650
|
-
|
|
7761
|
+
if (clack3.isCancel(response)) {
|
|
7762
|
+
clack3.cancel("Operation cancelled.");
|
|
8651
7763
|
return null;
|
|
8652
7764
|
}
|
|
8653
7765
|
const isValid = isValidOpenAIKey(response);
|
|
8654
7766
|
if (!isValid) {
|
|
8655
|
-
|
|
8656
|
-
|
|
7767
|
+
clack3.log.warn("Invalid API key format detected. Expected format: sk-...");
|
|
7768
|
+
clack3.log.warn("The key has been saved but may not work correctly.");
|
|
8657
7769
|
}
|
|
8658
|
-
const
|
|
8659
|
-
|
|
7770
|
+
const spinner2 = clack3.spinner();
|
|
7771
|
+
spinner2.start("Saving OpenAI API key...");
|
|
8660
7772
|
try {
|
|
8661
7773
|
await storeOpenAIKey(response, envFilePath);
|
|
8662
|
-
|
|
8663
|
-
|
|
7774
|
+
spinner2.stop("OpenAI API key saved successfully!");
|
|
7775
|
+
clack3.outro("\u2713 OpenAI integration configured");
|
|
8664
7776
|
return response;
|
|
8665
7777
|
} catch (error) {
|
|
8666
|
-
|
|
8667
|
-
|
|
7778
|
+
spinner2.stop("Failed to save API key");
|
|
7779
|
+
clack3.log.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
8668
7780
|
return null;
|
|
8669
7781
|
}
|
|
8670
7782
|
}
|
|
8671
7783
|
async function promptAndStoreAnthropicKey(envFilePath) {
|
|
8672
|
-
|
|
8673
|
-
|
|
7784
|
+
clack3.intro("\u{1F916} Anthropic Claude Configuration");
|
|
7785
|
+
clack3.note(
|
|
8674
7786
|
"Get your API key from: https://console.anthropic.com/settings/keys",
|
|
8675
7787
|
"API Key Information"
|
|
8676
7788
|
);
|
|
8677
|
-
const response = await
|
|
7789
|
+
const response = await clack3.password({
|
|
8678
7790
|
message: "Enter your Anthropic API key:",
|
|
8679
7791
|
validate: (value) => {
|
|
8680
7792
|
if (value.trim() === "") return "Anthropic API key cannot be empty";
|
|
8681
7793
|
return void 0;
|
|
8682
7794
|
}
|
|
8683
7795
|
});
|
|
8684
|
-
if (
|
|
8685
|
-
|
|
7796
|
+
if (clack3.isCancel(response)) {
|
|
7797
|
+
clack3.cancel("Operation cancelled.");
|
|
8686
7798
|
return null;
|
|
8687
7799
|
}
|
|
8688
7800
|
const isValid = isValidAnthropicKey(response);
|
|
8689
7801
|
if (!isValid) {
|
|
8690
|
-
|
|
8691
|
-
|
|
7802
|
+
clack3.log.warn("Invalid API key format detected. Expected format: sk-ant-...");
|
|
7803
|
+
clack3.log.warn("The key has been saved but may not work correctly.");
|
|
8692
7804
|
}
|
|
8693
|
-
const
|
|
8694
|
-
|
|
7805
|
+
const spinner2 = clack3.spinner();
|
|
7806
|
+
spinner2.start("Saving Anthropic API key...");
|
|
8695
7807
|
try {
|
|
8696
7808
|
await storeAnthropicKey(response, envFilePath);
|
|
8697
|
-
|
|
8698
|
-
|
|
7809
|
+
spinner2.stop("Anthropic API key saved successfully!");
|
|
7810
|
+
clack3.outro("\u2713 Claude integration configured");
|
|
8699
7811
|
return response;
|
|
8700
7812
|
} catch (error) {
|
|
8701
|
-
|
|
8702
|
-
|
|
7813
|
+
spinner2.stop("Failed to save API key");
|
|
7814
|
+
clack3.log.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
7815
|
+
return null;
|
|
7816
|
+
}
|
|
7817
|
+
}
|
|
7818
|
+
function isValidOllamaEndpoint(endpoint) {
|
|
7819
|
+
if (!endpoint || typeof endpoint !== "string") return false;
|
|
7820
|
+
try {
|
|
7821
|
+
const url = new URL(endpoint);
|
|
7822
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
7823
|
+
} catch {
|
|
7824
|
+
return false;
|
|
7825
|
+
}
|
|
7826
|
+
}
|
|
7827
|
+
async function storeOllamaConfig(config, envFilePath) {
|
|
7828
|
+
if (!config.endpoint || !config.model) return;
|
|
7829
|
+
try {
|
|
7830
|
+
let content = "";
|
|
7831
|
+
if (existsSync7(envFilePath)) {
|
|
7832
|
+
content = await fs7.readFile(envFilePath, "utf8");
|
|
7833
|
+
}
|
|
7834
|
+
const lines = content.split("\n").filter(
|
|
7835
|
+
(line2) => !line2.startsWith("OLLAMA_API_ENDPOINT=") && !line2.startsWith("OLLAMA_MODEL=") && !line2.startsWith("USE_OLLAMA_TEXT_MODELS=")
|
|
7836
|
+
);
|
|
7837
|
+
lines.push(`OLLAMA_API_ENDPOINT=${config.endpoint}`);
|
|
7838
|
+
lines.push(`OLLAMA_MODEL=${config.model}`);
|
|
7839
|
+
lines.push("USE_OLLAMA_TEXT_MODELS=true");
|
|
7840
|
+
await fs7.writeFile(envFilePath, lines.join("\n"), "utf8");
|
|
7841
|
+
process.env.OLLAMA_API_ENDPOINT = config.endpoint;
|
|
7842
|
+
process.env.OLLAMA_MODEL = config.model;
|
|
7843
|
+
process.env.USE_OLLAMA_TEXT_MODELS = "true";
|
|
7844
|
+
logger9.success("Ollama configuration saved to configuration");
|
|
7845
|
+
} catch (error) {
|
|
7846
|
+
logger9.error("Error saving Ollama configuration:", error);
|
|
7847
|
+
throw error;
|
|
7848
|
+
}
|
|
7849
|
+
}
|
|
7850
|
+
async function promptAndStoreOllamaConfig(envFilePath) {
|
|
7851
|
+
clack3.intro("\u{1F999} Ollama Configuration");
|
|
7852
|
+
clack3.note(
|
|
7853
|
+
"Make sure Ollama is installed and running on your system.\nDefault endpoint: http://localhost:11434\nGet started: https://ollama.ai/",
|
|
7854
|
+
"Ollama Information"
|
|
7855
|
+
);
|
|
7856
|
+
const endpoint = await clack3.text({
|
|
7857
|
+
message: "Enter your Ollama API endpoint:",
|
|
7858
|
+
placeholder: "http://localhost:11434",
|
|
7859
|
+
initialValue: "http://localhost:11434",
|
|
7860
|
+
validate: (value) => {
|
|
7861
|
+
if (value.trim() === "") return "Ollama endpoint cannot be empty";
|
|
7862
|
+
if (!isValidOllamaEndpoint(value)) return "Invalid URL format (http:// or https:// required)";
|
|
7863
|
+
return void 0;
|
|
7864
|
+
}
|
|
7865
|
+
});
|
|
7866
|
+
if (clack3.isCancel(endpoint)) {
|
|
7867
|
+
clack3.cancel("Operation cancelled.");
|
|
7868
|
+
return null;
|
|
7869
|
+
}
|
|
7870
|
+
const model = await clack3.text({
|
|
7871
|
+
message: "Enter your preferred Ollama model:",
|
|
7872
|
+
placeholder: "llama2",
|
|
7873
|
+
initialValue: "llama2",
|
|
7874
|
+
validate: (value) => {
|
|
7875
|
+
if (value.trim() === "") return "Model name cannot be empty";
|
|
7876
|
+
return void 0;
|
|
7877
|
+
}
|
|
7878
|
+
});
|
|
7879
|
+
if (clack3.isCancel(model)) {
|
|
7880
|
+
clack3.cancel("Operation cancelled.");
|
|
7881
|
+
return null;
|
|
7882
|
+
}
|
|
7883
|
+
const config = { endpoint: endpoint.trim(), model: model.trim() };
|
|
7884
|
+
const spinner2 = clack3.spinner();
|
|
7885
|
+
spinner2.start("Saving Ollama configuration...");
|
|
7886
|
+
try {
|
|
7887
|
+
await storeOllamaConfig(config, envFilePath);
|
|
7888
|
+
spinner2.stop("Ollama configuration saved successfully!");
|
|
7889
|
+
clack3.outro("\u2713 Ollama integration configured");
|
|
7890
|
+
return config;
|
|
7891
|
+
} catch (error) {
|
|
7892
|
+
spinner2.stop("Failed to save configuration");
|
|
7893
|
+
clack3.log.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
8703
7894
|
return null;
|
|
8704
7895
|
}
|
|
8705
7896
|
}
|
|
@@ -8725,20 +7916,20 @@ async function configureDatabaseSettings(reconfigure = false) {
|
|
|
8725
7916
|
await setupPgLite(elizaDbDir, envFilePath);
|
|
8726
7917
|
return null;
|
|
8727
7918
|
}
|
|
8728
|
-
var rawConfigSchema =
|
|
8729
|
-
$schema:
|
|
8730
|
-
database:
|
|
8731
|
-
plugins:
|
|
8732
|
-
registry:
|
|
8733
|
-
installed:
|
|
7919
|
+
var rawConfigSchema = z.object({
|
|
7920
|
+
$schema: z.string().optional(),
|
|
7921
|
+
database: z.discriminatedUnion("type", [postgresConfigSchema, pgliteConfigSchema]),
|
|
7922
|
+
plugins: z.object({
|
|
7923
|
+
registry: z.string().url(),
|
|
7924
|
+
installed: z.array(z.string())
|
|
8734
7925
|
}),
|
|
8735
|
-
paths:
|
|
8736
|
-
knowledge:
|
|
7926
|
+
paths: z.object({
|
|
7927
|
+
knowledge: z.string()
|
|
8737
7928
|
})
|
|
8738
7929
|
}).strict();
|
|
8739
7930
|
var configSchema = rawConfigSchema.extend({
|
|
8740
|
-
resolvedPaths:
|
|
8741
|
-
knowledge:
|
|
7931
|
+
resolvedPaths: z.object({
|
|
7932
|
+
knowledge: z.string()
|
|
8742
7933
|
})
|
|
8743
7934
|
});
|
|
8744
7935
|
async function resolveConfigPaths(cwd, config) {
|
|
@@ -8756,7 +7947,7 @@ async function resolveConfigPaths(cwd, config) {
|
|
|
8756
7947
|
}
|
|
8757
7948
|
async function loadEnvironment(projectDir = process.cwd()) {
|
|
8758
7949
|
const envPath = resolveEnvFile(projectDir);
|
|
8759
|
-
if (
|
|
7950
|
+
if (existsSync7(envPath)) {
|
|
8760
7951
|
import_dotenv2.default.config({ path: envPath });
|
|
8761
7952
|
}
|
|
8762
7953
|
}
|
|
@@ -8835,7 +8026,7 @@ async function getPackageInfo() {
|
|
|
8835
8026
|
const { packageJsonPath } = await UserEnvironment.getInstance().getPathInfo();
|
|
8836
8027
|
try {
|
|
8837
8028
|
const fileContent = await import("fs/promises").then(
|
|
8838
|
-
(
|
|
8029
|
+
(fs11) => fs11.readFile(packageJsonPath, "utf8")
|
|
8839
8030
|
);
|
|
8840
8031
|
return JSON.parse(fileContent);
|
|
8841
8032
|
} catch (error) {
|
|
@@ -8859,11 +8050,12 @@ async function getPackageInfo() {
|
|
|
8859
8050
|
}
|
|
8860
8051
|
|
|
8861
8052
|
// src/utils/github.ts
|
|
8862
|
-
import { promises as
|
|
8053
|
+
import { promises as fs8 } from "fs";
|
|
8863
8054
|
import path10 from "path";
|
|
8864
8055
|
import { logger as logger10 } from "@elizaos/core";
|
|
8865
|
-
import { existsSync as
|
|
8056
|
+
import { existsSync as existsSync8 } from "fs";
|
|
8866
8057
|
import { execa as execa5 } from "execa";
|
|
8058
|
+
import * as clack4 from "@clack/prompts";
|
|
8867
8059
|
var GITHUB_API_URL = "https://api.github.com";
|
|
8868
8060
|
async function validateGitHubToken(token2) {
|
|
8869
8061
|
try {
|
|
@@ -8880,11 +8072,13 @@ async function validateGitHubToken(token2) {
|
|
|
8880
8072
|
}
|
|
8881
8073
|
return false;
|
|
8882
8074
|
} catch (error) {
|
|
8883
|
-
logger10.error(
|
|
8075
|
+
logger10.error(
|
|
8076
|
+
`Failed to validate GitHub token: ${error instanceof Error ? error.message : String(error)}`
|
|
8077
|
+
);
|
|
8884
8078
|
return false;
|
|
8885
8079
|
}
|
|
8886
8080
|
}
|
|
8887
|
-
async function forkExists(token2,
|
|
8081
|
+
async function forkExists(token2, repo, username) {
|
|
8888
8082
|
try {
|
|
8889
8083
|
const response = await fetch(`${GITHUB_API_URL}/repos/${username}/${repo}`, {
|
|
8890
8084
|
headers: {
|
|
@@ -8914,7 +8108,9 @@ async function forkRepository(token2, owner, repo) {
|
|
|
8914
8108
|
logger10.error(`Failed to fork repository: ${response.statusText}`);
|
|
8915
8109
|
return null;
|
|
8916
8110
|
} catch (error) {
|
|
8917
|
-
logger10.error(
|
|
8111
|
+
logger10.error(
|
|
8112
|
+
`Failed to fork repository: ${error instanceof Error ? error.message : String(error)}`
|
|
8113
|
+
);
|
|
8918
8114
|
return null;
|
|
8919
8115
|
}
|
|
8920
8116
|
}
|
|
@@ -9083,14 +8279,16 @@ async function createBranch(token2, owner, repo, branch, baseBranch = "main") {
|
|
|
9083
8279
|
logger10.error(`Failed to create branch: ${response.statusText}`);
|
|
9084
8280
|
return false;
|
|
9085
8281
|
} catch (error) {
|
|
9086
|
-
logger10.error(
|
|
8282
|
+
logger10.error(
|
|
8283
|
+
`Failed to create branch: ${error instanceof Error ? error.message : String(error)}`
|
|
8284
|
+
);
|
|
9087
8285
|
return false;
|
|
9088
8286
|
}
|
|
9089
8287
|
}
|
|
9090
|
-
async function getFileContent(token2, owner, repo,
|
|
8288
|
+
async function getFileContent(token2, owner, repo, path19, branch = "main") {
|
|
9091
8289
|
try {
|
|
9092
8290
|
const response = await fetch(
|
|
9093
|
-
`${GITHUB_API_URL}/repos/${owner}/${repo}/contents/${
|
|
8291
|
+
`${GITHUB_API_URL}/repos/${owner}/${repo}/contents/${path19}?ref=${branch}`,
|
|
9094
8292
|
{
|
|
9095
8293
|
headers: {
|
|
9096
8294
|
Authorization: `token ${token2}`,
|
|
@@ -9107,14 +8305,14 @@ async function getFileContent(token2, owner, repo, path20, branch = "main") {
|
|
|
9107
8305
|
return null;
|
|
9108
8306
|
}
|
|
9109
8307
|
}
|
|
9110
|
-
async function updateFile(token2, owner, repo,
|
|
8308
|
+
async function updateFile(token2, owner, repo, path19, content, message, branch = "main") {
|
|
9111
8309
|
try {
|
|
9112
|
-
const existingContent = await getFileContent(token2, owner, repo,
|
|
8310
|
+
const existingContent = await getFileContent(token2, owner, repo, path19, branch);
|
|
9113
8311
|
const method = "PUT";
|
|
9114
8312
|
let sha;
|
|
9115
8313
|
if (existingContent !== null) {
|
|
9116
8314
|
const response2 = await fetch(
|
|
9117
|
-
`${GITHUB_API_URL}/repos/${owner}/${repo}/contents/${
|
|
8315
|
+
`${GITHUB_API_URL}/repos/${owner}/${repo}/contents/${path19}?ref=${branch}`,
|
|
9118
8316
|
{
|
|
9119
8317
|
headers: {
|
|
9120
8318
|
Authorization: `token ${token2}`,
|
|
@@ -9127,7 +8325,7 @@ async function updateFile(token2, owner, repo, path20, content, message, branch
|
|
|
9127
8325
|
sha = data.sha;
|
|
9128
8326
|
}
|
|
9129
8327
|
}
|
|
9130
|
-
const fileUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/contents/${
|
|
8328
|
+
const fileUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/contents/${path19}`;
|
|
9131
8329
|
logger10.info(`Updating file at: ${fileUrl}`);
|
|
9132
8330
|
const requestBody = {
|
|
9133
8331
|
message,
|
|
@@ -9153,7 +8351,7 @@ async function updateFile(token2, owner, repo, path20, content, message, branch
|
|
|
9153
8351
|
logger10.error(`Failed to update file: ${response.status} ${response.statusText}`);
|
|
9154
8352
|
logger10.error(`Response body: ${errorBody}`);
|
|
9155
8353
|
if (response.status === 404) {
|
|
9156
|
-
logger10.error(`Repository or path not found: ${owner}/${repo}/${
|
|
8354
|
+
logger10.error(`Repository or path not found: ${owner}/${repo}/${path19}`);
|
|
9157
8355
|
const repoCheck = await fetch(`${GITHUB_API_URL}/repos/${owner}/${repo}`, {
|
|
9158
8356
|
headers: {
|
|
9159
8357
|
Authorization: `token ${token2}`,
|
|
@@ -9168,7 +8366,7 @@ async function updateFile(token2, owner, repo, path20, content, message, branch
|
|
|
9168
8366
|
}
|
|
9169
8367
|
return false;
|
|
9170
8368
|
} catch (error) {
|
|
9171
|
-
logger10.error(`Error updating file: ${error.message}`);
|
|
8369
|
+
logger10.error(`Error updating file: ${error instanceof Error ? error.message : String(error)}`);
|
|
9172
8370
|
return false;
|
|
9173
8371
|
}
|
|
9174
8372
|
}
|
|
@@ -9196,7 +8394,9 @@ async function createPullRequest(token2, owner, repo, title, body, head, base =
|
|
|
9196
8394
|
logger10.error(`Failed to create pull request: ${response.statusText}`);
|
|
9197
8395
|
return null;
|
|
9198
8396
|
} catch (error) {
|
|
9199
|
-
logger10.error(
|
|
8397
|
+
logger10.error(
|
|
8398
|
+
`Failed to create pull request: ${error instanceof Error ? error.message : String(error)}`
|
|
8399
|
+
);
|
|
9200
8400
|
return null;
|
|
9201
8401
|
}
|
|
9202
8402
|
}
|
|
@@ -9230,8 +8430,8 @@ async function getGitHubCredentials() {
|
|
|
9230
8430
|
}
|
|
9231
8431
|
logger10.warn("Invalid GitHub token found in environment variables");
|
|
9232
8432
|
}
|
|
9233
|
-
const { getGitHubToken:
|
|
9234
|
-
const token2 = await
|
|
8433
|
+
const { getGitHubToken: getGitHubToken2 } = await import("./registry-CBMRMYCG.js");
|
|
8434
|
+
const token2 = await getGitHubToken2() || void 0;
|
|
9235
8435
|
if (token2) {
|
|
9236
8436
|
const isValid2 = await validateGitHubToken(token2);
|
|
9237
8437
|
if (isValid2) {
|
|
@@ -9245,8 +8445,8 @@ async function getGitHubCredentials() {
|
|
|
9245
8445
|
logger10.warn("Stored GitHub token is invalid, will prompt for new credentials");
|
|
9246
8446
|
}
|
|
9247
8447
|
}
|
|
9248
|
-
|
|
9249
|
-
|
|
8448
|
+
clack4.intro("\u{1F510} GitHub Authentication Required");
|
|
8449
|
+
clack4.note(
|
|
9250
8450
|
`To create a GitHub Personal Access Token (Classic):
|
|
9251
8451
|
1. Go to https://github.com/settings/tokens/new
|
|
9252
8452
|
2. Give your token a descriptive name (e.g., "ElizaOS CLI")
|
|
@@ -9261,20 +8461,20 @@ async function getGitHubCredentials() {
|
|
|
9261
8461
|
NOTE: You must use a Classic token, not a Fine-grained token`,
|
|
9262
8462
|
"Setup Instructions"
|
|
9263
8463
|
);
|
|
9264
|
-
const promptedUsername = await
|
|
8464
|
+
const promptedUsername = await clack4.text({
|
|
9265
8465
|
message: "Enter your GitHub username:",
|
|
9266
8466
|
validate: (value) => value ? void 0 : "Username is required"
|
|
9267
8467
|
});
|
|
9268
|
-
if (
|
|
9269
|
-
|
|
8468
|
+
if (clack4.isCancel(promptedUsername)) {
|
|
8469
|
+
clack4.cancel("Operation cancelled.");
|
|
9270
8470
|
return null;
|
|
9271
8471
|
}
|
|
9272
|
-
const promptedToken = await
|
|
8472
|
+
const promptedToken = await clack4.password({
|
|
9273
8473
|
message: "Enter your GitHub Personal Access Token (with repo, read:org, and workflow scopes):",
|
|
9274
8474
|
validate: (value) => value ? void 0 : "Token is required"
|
|
9275
8475
|
});
|
|
9276
|
-
if (
|
|
9277
|
-
|
|
8476
|
+
if (clack4.isCancel(promptedToken)) {
|
|
8477
|
+
clack4.cancel("Operation cancelled.");
|
|
9278
8478
|
return null;
|
|
9279
8479
|
}
|
|
9280
8480
|
const isValid = await validateGitHubToken(promptedToken);
|
|
@@ -9290,13 +8490,13 @@ async function saveGitHubCredentials(username, token2) {
|
|
|
9290
8490
|
const envInfo = await UserEnvironment.getInstanceInfo();
|
|
9291
8491
|
const { elizaDir, envFilePath } = envInfo.paths;
|
|
9292
8492
|
logger10.debug("[GitHub] Saving credentials");
|
|
9293
|
-
if (!
|
|
9294
|
-
await
|
|
8493
|
+
if (!existsSync8(elizaDir)) {
|
|
8494
|
+
await fs8.mkdir(elizaDir, { recursive: true });
|
|
9295
8495
|
}
|
|
9296
|
-
if (!
|
|
9297
|
-
await
|
|
8496
|
+
if (!existsSync8(envFilePath)) {
|
|
8497
|
+
await fs8.writeFile(envFilePath, "", { encoding: "utf8" });
|
|
9298
8498
|
}
|
|
9299
|
-
const currentContent = await
|
|
8499
|
+
const currentContent = await fs8.readFile(envFilePath, "utf8");
|
|
9300
8500
|
const lines = currentContent.split("\n");
|
|
9301
8501
|
const usernameLineIndex = lines.findIndex((line2) => line2.startsWith("GITHUB_USERNAME="));
|
|
9302
8502
|
const usernameLine = `GITHUB_USERNAME=${username}`;
|
|
@@ -9312,16 +8512,16 @@ async function saveGitHubCredentials(username, token2) {
|
|
|
9312
8512
|
} else {
|
|
9313
8513
|
lines.push(tokenLine);
|
|
9314
8514
|
}
|
|
9315
|
-
await
|
|
8515
|
+
await fs8.writeFile(envFilePath, lines.join("\n"));
|
|
9316
8516
|
process.env.GITHUB_USERNAME = username;
|
|
9317
8517
|
process.env.GITHUB_TOKEN = token2;
|
|
9318
8518
|
logger10.success("GitHub credentials saved");
|
|
9319
8519
|
}
|
|
9320
|
-
async function ensureDirectory(token2,
|
|
8520
|
+
async function ensureDirectory(token2, repo, path19, branch) {
|
|
9321
8521
|
try {
|
|
9322
8522
|
try {
|
|
9323
8523
|
const response = await fetch(
|
|
9324
|
-
`${GITHUB_API_URL}/repos/${
|
|
8524
|
+
`${GITHUB_API_URL}/repos/${repo}/contents/${path19}?ref=${branch}`,
|
|
9325
8525
|
{
|
|
9326
8526
|
headers: {
|
|
9327
8527
|
Authorization: `token ${token2}`,
|
|
@@ -9330,31 +8530,32 @@ async function ensureDirectory(token2, owner, repo, directoryPath, branch = "mai
|
|
|
9330
8530
|
}
|
|
9331
8531
|
);
|
|
9332
8532
|
if (response.status === 200) {
|
|
9333
|
-
logger10.info(`Directory ${
|
|
8533
|
+
logger10.info(`Directory ${path19} already exists`);
|
|
9334
8534
|
return true;
|
|
9335
8535
|
}
|
|
9336
8536
|
} catch (error) {
|
|
9337
|
-
logger10.info(`Directory ${
|
|
8537
|
+
logger10.info(`Directory ${path19} doesn't exist, creating it`);
|
|
9338
8538
|
}
|
|
9339
|
-
const placeholderPath = `${
|
|
8539
|
+
const placeholderPath = `${path19}/.gitkeep`;
|
|
9340
8540
|
const result = await updateFile(
|
|
9341
8541
|
token2,
|
|
9342
|
-
owner,
|
|
9343
8542
|
repo,
|
|
9344
8543
|
placeholderPath,
|
|
9345
8544
|
"",
|
|
9346
8545
|
// Empty content for placeholder
|
|
9347
|
-
`Create directory: ${
|
|
8546
|
+
`Create directory: ${path19}`,
|
|
9348
8547
|
branch
|
|
9349
8548
|
);
|
|
9350
8549
|
if (result) {
|
|
9351
|
-
logger10.success(`Created directory: ${
|
|
8550
|
+
logger10.success(`Created directory: ${path19}`);
|
|
9352
8551
|
return true;
|
|
9353
8552
|
}
|
|
9354
|
-
logger10.error(`Failed to create directory: ${
|
|
8553
|
+
logger10.error(`Failed to create directory: ${path19}`);
|
|
9355
8554
|
return false;
|
|
9356
8555
|
} catch (error) {
|
|
9357
|
-
logger10.error(
|
|
8556
|
+
logger10.error(
|
|
8557
|
+
`Error creating directory: ${error instanceof Error ? error.message : String(error)}`
|
|
8558
|
+
);
|
|
9358
8559
|
return false;
|
|
9359
8560
|
}
|
|
9360
8561
|
}
|
|
@@ -9436,12 +8637,15 @@ async function createGitHubRepository(token2, repoName, description, isPrivate =
|
|
|
9436
8637
|
message: `Failed to create repository: ${response.status} ${response.statusText} - ${errorData.message || "Unknown error"}`
|
|
9437
8638
|
};
|
|
9438
8639
|
} catch (error) {
|
|
9439
|
-
return {
|
|
8640
|
+
return {
|
|
8641
|
+
success: false,
|
|
8642
|
+
message: `Error creating repository: ${error instanceof Error ? error.message : String(error)}`
|
|
8643
|
+
};
|
|
9440
8644
|
}
|
|
9441
8645
|
}
|
|
9442
8646
|
async function pushToGitHub(cwd, repoUrl, branch = "main") {
|
|
9443
8647
|
try {
|
|
9444
|
-
const gitDirExists =
|
|
8648
|
+
const gitDirExists = existsSync8(path10.join(cwd, ".git"));
|
|
9445
8649
|
let hasCorrectRemote = false;
|
|
9446
8650
|
if (gitDirExists) {
|
|
9447
8651
|
try {
|
|
@@ -9494,7 +8698,9 @@ async function pushToGitHub(cwd, repoUrl, branch = "main") {
|
|
|
9494
8698
|
logger10.success(`Pushed to GitHub repository: ${repoUrl}`);
|
|
9495
8699
|
return true;
|
|
9496
8700
|
} catch (error) {
|
|
9497
|
-
logger10.error(
|
|
8701
|
+
logger10.error(
|
|
8702
|
+
`Failed to push to GitHub: ${error instanceof Error ? error.message : String(error)}`
|
|
8703
|
+
);
|
|
9498
8704
|
try {
|
|
9499
8705
|
logger10.info("Attempting force push...");
|
|
9500
8706
|
await execa5("git", ["push", "-u", "origin", "main", "--force-with-lease"], {
|
|
@@ -9503,12 +8709,17 @@ async function pushToGitHub(cwd, repoUrl, branch = "main") {
|
|
|
9503
8709
|
});
|
|
9504
8710
|
return true;
|
|
9505
8711
|
} catch (forcePushError) {
|
|
9506
|
-
logger10.error(
|
|
8712
|
+
logger10.error(
|
|
8713
|
+
"Force push also failed:",
|
|
8714
|
+
forcePushError instanceof Error ? forcePushError.message : String(forcePushError)
|
|
8715
|
+
);
|
|
9507
8716
|
return false;
|
|
9508
8717
|
}
|
|
9509
8718
|
}
|
|
9510
8719
|
} catch (error) {
|
|
9511
|
-
logger10.error(
|
|
8720
|
+
logger10.error(
|
|
8721
|
+
`Error in git operations: ${error instanceof Error ? error.message : String(error)}`
|
|
8722
|
+
);
|
|
9512
8723
|
return false;
|
|
9513
8724
|
}
|
|
9514
8725
|
}
|
|
@@ -9535,20 +8746,20 @@ var {
|
|
|
9535
8746
|
|
|
9536
8747
|
// src/commands/agent/actions/crud.ts
|
|
9537
8748
|
import { logger as logger11 } from "@elizaos/core";
|
|
9538
|
-
import
|
|
8749
|
+
import { writeFileSync, readFileSync as readFileSync5 } from "fs";
|
|
9539
8750
|
import path11 from "path";
|
|
9540
8751
|
|
|
9541
8752
|
// src/commands/agent/utils/validation.ts
|
|
9542
|
-
import { z as
|
|
9543
|
-
var AgentBasicSchema =
|
|
9544
|
-
id:
|
|
9545
|
-
name:
|
|
9546
|
-
status:
|
|
8753
|
+
import { z as z2 } from "zod";
|
|
8754
|
+
var AgentBasicSchema = z2.object({
|
|
8755
|
+
id: z2.string(),
|
|
8756
|
+
name: z2.string(),
|
|
8757
|
+
status: z2.string().optional()
|
|
9547
8758
|
}).passthrough();
|
|
9548
|
-
var AgentsListResponseSchema =
|
|
9549
|
-
success:
|
|
9550
|
-
data:
|
|
9551
|
-
agents:
|
|
8759
|
+
var AgentsListResponseSchema = z2.object({
|
|
8760
|
+
success: z2.boolean(),
|
|
8761
|
+
data: z2.object({
|
|
8762
|
+
agents: z2.array(AgentBasicSchema)
|
|
9552
8763
|
}).optional()
|
|
9553
8764
|
});
|
|
9554
8765
|
async function getAgents(opts) {
|
|
@@ -9564,12 +8775,12 @@ async function getAgents(opts) {
|
|
|
9564
8775
|
async function resolveAgentId(idOrNameOrIndex, opts) {
|
|
9565
8776
|
const agents = await getAgents(opts);
|
|
9566
8777
|
const agentByName = agents.find(
|
|
9567
|
-
(
|
|
8778
|
+
(agent2) => agent2.name.toLowerCase() === idOrNameOrIndex.toLowerCase()
|
|
9568
8779
|
);
|
|
9569
8780
|
if (agentByName) {
|
|
9570
8781
|
return agentByName.id;
|
|
9571
8782
|
}
|
|
9572
|
-
const agentById = agents.find((
|
|
8783
|
+
const agentById = agents.find((agent2) => agent2.id === idOrNameOrIndex);
|
|
9573
8784
|
if (agentById) {
|
|
9574
8785
|
return agentById.id;
|
|
9575
8786
|
}
|
|
@@ -9586,10 +8797,10 @@ async function resolveAgentId(idOrNameOrIndex, opts) {
|
|
|
9586
8797
|
async function listAgents(opts) {
|
|
9587
8798
|
try {
|
|
9588
8799
|
const agents = await getAgents(opts);
|
|
9589
|
-
const agentData = agents.map((
|
|
9590
|
-
Name:
|
|
9591
|
-
ID:
|
|
9592
|
-
Status:
|
|
8800
|
+
const agentData = agents.map((agent2) => ({
|
|
8801
|
+
Name: agent2.name,
|
|
8802
|
+
ID: agent2.id,
|
|
8803
|
+
Status: agent2.status || "unknown"
|
|
9593
8804
|
}));
|
|
9594
8805
|
if (opts.json) {
|
|
9595
8806
|
console.info(JSON.stringify(agentData, null, 2));
|
|
@@ -9616,22 +8827,24 @@ async function getAgent(opts) {
|
|
|
9616
8827
|
console.info(`Getting agent ${resolvedAgentId}`);
|
|
9617
8828
|
const response = await fetch(`${baseUrl}/${resolvedAgentId}`);
|
|
9618
8829
|
if (!response.ok) {
|
|
9619
|
-
const errorData = await response.json();
|
|
9620
8830
|
logger11.error(`Failed to get agent`);
|
|
9621
8831
|
process.exit(1);
|
|
9622
8832
|
}
|
|
9623
|
-
const { data:
|
|
8833
|
+
const { data: agent2 } = await response.json();
|
|
8834
|
+
if (!agent2) {
|
|
8835
|
+
throw new Error("No agent data received from server");
|
|
8836
|
+
}
|
|
9624
8837
|
if (opts.output !== void 0) {
|
|
9625
|
-
const { id, createdAt, updatedAt, enabled, ...agentConfig } =
|
|
9626
|
-
const filename = opts.output === true ? `${
|
|
8838
|
+
const { id, createdAt, updatedAt, enabled, ...agentConfig } = agent2;
|
|
8839
|
+
const filename = opts.output === true ? `${agent2.name || "agent"}.json` : `${String(opts.output)}${String(opts.output).endsWith(".json") ? "" : ".json"}`;
|
|
9627
8840
|
const jsonPath = path11.resolve(process.cwd(), filename);
|
|
9628
|
-
|
|
8841
|
+
writeFileSync(jsonPath, JSON.stringify(agentConfig, null, 2));
|
|
9629
8842
|
console.log(`Saved agent configuration to ${jsonPath}`);
|
|
9630
8843
|
return;
|
|
9631
8844
|
}
|
|
9632
|
-
displayAgent(
|
|
8845
|
+
displayAgent(agent2, "Agent Details");
|
|
9633
8846
|
if (opts.json) {
|
|
9634
|
-
const { id, createdAt, updatedAt, enabled, ...agentConfig } =
|
|
8847
|
+
const { id, createdAt, updatedAt, enabled, ...agentConfig } = agent2;
|
|
9635
8848
|
console.log(JSON.stringify(agentConfig, null, 2));
|
|
9636
8849
|
}
|
|
9637
8850
|
return;
|
|
@@ -9659,6 +8872,31 @@ async function removeAgent(opts) {
|
|
|
9659
8872
|
handleError(error);
|
|
9660
8873
|
}
|
|
9661
8874
|
}
|
|
8875
|
+
async function clearAgentMemories(opts) {
|
|
8876
|
+
try {
|
|
8877
|
+
const resolvedAgentId = await resolveAgentId(opts.name, opts);
|
|
8878
|
+
const baseUrl = getAgentsBaseUrl(opts);
|
|
8879
|
+
console.info(`Clearing all memories for agent ${resolvedAgentId}`);
|
|
8880
|
+
const response = await fetch(`${baseUrl}/${resolvedAgentId}/memories`, {
|
|
8881
|
+
method: "DELETE"
|
|
8882
|
+
});
|
|
8883
|
+
if (!response.ok) {
|
|
8884
|
+
const errorData = await response.json();
|
|
8885
|
+
throw new Error(
|
|
8886
|
+
errorData.error?.message || `Failed to clear agent memories: ${response.statusText}`
|
|
8887
|
+
);
|
|
8888
|
+
}
|
|
8889
|
+
const data = await response.json();
|
|
8890
|
+
const result = data.data;
|
|
8891
|
+
console.log(
|
|
8892
|
+
`Successfully cleared ${result?.deletedCount || 0} memories for agent ${opts.name}`
|
|
8893
|
+
);
|
|
8894
|
+
return;
|
|
8895
|
+
} catch (error) {
|
|
8896
|
+
await checkServer(opts);
|
|
8897
|
+
handleError(error);
|
|
8898
|
+
}
|
|
8899
|
+
}
|
|
9662
8900
|
async function setAgentConfig(opts) {
|
|
9663
8901
|
try {
|
|
9664
8902
|
const resolvedAgentId = await resolveAgentId(opts.name, opts);
|
|
@@ -9668,13 +8906,17 @@ async function setAgentConfig(opts) {
|
|
|
9668
8906
|
try {
|
|
9669
8907
|
config = JSON.parse(opts.config);
|
|
9670
8908
|
} catch (error) {
|
|
9671
|
-
throw new Error(
|
|
8909
|
+
throw new Error(
|
|
8910
|
+
`Failed to parse config JSON string: ${error instanceof Error ? error.message : String(error)}`
|
|
8911
|
+
);
|
|
9672
8912
|
}
|
|
9673
8913
|
} else if (opts.file) {
|
|
9674
8914
|
try {
|
|
9675
|
-
config = JSON.parse(
|
|
8915
|
+
config = JSON.parse(readFileSync5(opts.file, "utf8"));
|
|
9676
8916
|
} catch (error) {
|
|
9677
|
-
throw new Error(
|
|
8917
|
+
throw new Error(
|
|
8918
|
+
`Failed to read or parse config file: ${error instanceof Error ? error.message : String(error)}`
|
|
8919
|
+
);
|
|
9678
8920
|
}
|
|
9679
8921
|
} else {
|
|
9680
8922
|
throw new Error("Please provide either a config JSON string (-c) or a config file path (-f)");
|
|
@@ -9701,7 +8943,7 @@ async function setAgentConfig(opts) {
|
|
|
9701
8943
|
|
|
9702
8944
|
// src/commands/agent/actions/lifecycle.ts
|
|
9703
8945
|
import { logger as logger12 } from "@elizaos/core";
|
|
9704
|
-
import
|
|
8946
|
+
import { existsSync as existsSync9, readFileSync as readFileSync6 } from "fs";
|
|
9705
8947
|
import path12 from "path";
|
|
9706
8948
|
async function startAgent(options) {
|
|
9707
8949
|
try {
|
|
@@ -9712,8 +8954,8 @@ async function startAgent(options) {
|
|
|
9712
8954
|
const agents = await getAgents(options);
|
|
9713
8955
|
if (agents.length > 0) {
|
|
9714
8956
|
console.error("\nAvailable agents in your project:");
|
|
9715
|
-
agents.forEach((
|
|
9716
|
-
console.error(` ${index}. ${
|
|
8957
|
+
agents.forEach((agent2, index) => {
|
|
8958
|
+
console.error(` ${index}. ${agent2.name}`);
|
|
9717
8959
|
});
|
|
9718
8960
|
}
|
|
9719
8961
|
} catch (error) {
|
|
@@ -9748,10 +8990,10 @@ async function startAgent(options) {
|
|
|
9748
8990
|
if (options.path) {
|
|
9749
8991
|
try {
|
|
9750
8992
|
const filePath = path12.resolve(process.cwd(), options.path);
|
|
9751
|
-
if (!
|
|
8993
|
+
if (!existsSync9(filePath)) {
|
|
9752
8994
|
throw new Error(`File not found at path: ${filePath}`);
|
|
9753
8995
|
}
|
|
9754
|
-
const fileContent =
|
|
8996
|
+
const fileContent = readFileSync6(filePath, "utf8");
|
|
9755
8997
|
payload.characterJson = JSON.parse(fileContent);
|
|
9756
8998
|
characterName = await createCharacter(payload);
|
|
9757
8999
|
if (!characterName) {
|
|
@@ -9759,7 +9001,9 @@ async function startAgent(options) {
|
|
|
9759
9001
|
}
|
|
9760
9002
|
} catch (error) {
|
|
9761
9003
|
console.error("Error reading or parsing local JSON file:", error);
|
|
9762
|
-
throw new Error(
|
|
9004
|
+
throw new Error(
|
|
9005
|
+
`Failed to read or parse local JSON file: ${error instanceof Error ? error.message : String(error)}`
|
|
9006
|
+
);
|
|
9763
9007
|
}
|
|
9764
9008
|
}
|
|
9765
9009
|
if (options.remoteCharacter) {
|
|
@@ -9825,8 +9069,8 @@ Error: No agent found with name "${agentName}"`);
|
|
|
9825
9069
|
const agents = await getAgents(options);
|
|
9826
9070
|
if (agents.length > 0) {
|
|
9827
9071
|
console.error("\nAvailable agents in your project:");
|
|
9828
|
-
agents.forEach((
|
|
9829
|
-
console.error(` ${index}. ${
|
|
9072
|
+
agents.forEach((agent2, index) => {
|
|
9073
|
+
console.error(` ${index}. ${agent2.name}`);
|
|
9830
9074
|
});
|
|
9831
9075
|
console.error(
|
|
9832
9076
|
`
|
|
@@ -9851,6 +9095,50 @@ You can create a new agent with: elizaos create -t agent ${agentName.toLowerCase
|
|
|
9851
9095
|
}
|
|
9852
9096
|
async function stopAgent(opts) {
|
|
9853
9097
|
try {
|
|
9098
|
+
const hasValidName = opts.name && opts.name !== true && opts.name !== "";
|
|
9099
|
+
if (!hasValidName && !opts.all) {
|
|
9100
|
+
console.error("\nError: Must provide either --name <name> or --all flag");
|
|
9101
|
+
console.error("Examples:");
|
|
9102
|
+
console.error(" elizaos agent stop --name eliza");
|
|
9103
|
+
console.error(" elizaos agent stop --all");
|
|
9104
|
+
process.exit(1);
|
|
9105
|
+
}
|
|
9106
|
+
if (opts.all) {
|
|
9107
|
+
logger12.info("Stopping all ElizaOS agents...");
|
|
9108
|
+
if (process.platform === "win32") {
|
|
9109
|
+
logger12.error("The --all flag requires Unix-like commands (pgrep, kill).");
|
|
9110
|
+
logger12.error("On Windows, please use WSL 2 or stop agents individually with --name.");
|
|
9111
|
+
logger12.error("See: https://learn.microsoft.com/en-us/windows/wsl/install-manual");
|
|
9112
|
+
process.exit(1);
|
|
9113
|
+
}
|
|
9114
|
+
try {
|
|
9115
|
+
const { exec } = await import("child_process");
|
|
9116
|
+
const { promisify } = await import("util");
|
|
9117
|
+
const execAsync = promisify(exec);
|
|
9118
|
+
const patterns = [
|
|
9119
|
+
"(node|bun).*elizaos",
|
|
9120
|
+
"(node|bun).*eliza.*start",
|
|
9121
|
+
"(node|bun).*dist/index.js.*start"
|
|
9122
|
+
];
|
|
9123
|
+
for (const pattern of patterns) {
|
|
9124
|
+
try {
|
|
9125
|
+
const { stdout } = await execAsync(`pgrep -f "${pattern}"`);
|
|
9126
|
+
const pids = stdout.trim().split("\n").filter((pid) => pid && pid !== process.pid.toString());
|
|
9127
|
+
if (pids.length > 0) {
|
|
9128
|
+
await execAsync(`echo "${pids.join(" ")}" | xargs -r kill`);
|
|
9129
|
+
}
|
|
9130
|
+
} catch (pgrepError) {
|
|
9131
|
+
}
|
|
9132
|
+
}
|
|
9133
|
+
logger12.success("All ElizaOS agents stopped successfully!");
|
|
9134
|
+
} catch (error) {
|
|
9135
|
+
logger12.error(
|
|
9136
|
+
`Error stopping processes: ${error instanceof Error ? error.message : String(error)}`
|
|
9137
|
+
);
|
|
9138
|
+
process.exit(1);
|
|
9139
|
+
}
|
|
9140
|
+
return;
|
|
9141
|
+
}
|
|
9854
9142
|
const resolvedAgentId = await resolveAgentId(opts.name, opts);
|
|
9855
9143
|
const baseUrl = getAgentsBaseUrl(opts);
|
|
9856
9144
|
console.info(`Stopping agent ${resolvedAgentId}`);
|
|
@@ -9904,9 +9192,10 @@ Required configuration:
|
|
|
9904
9192
|
throw error;
|
|
9905
9193
|
}
|
|
9906
9194
|
});
|
|
9907
|
-
agent.command("stop").alias("st").description("Stop an agent").
|
|
9195
|
+
agent.command("stop").alias("st").description("Stop an agent").option("-n, --name <name>", "agent id, name, or index number from list").option("--all", "stop all running agents").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(stopAgent);
|
|
9908
9196
|
agent.command("remove").alias("rm").description("Remove an agent").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(removeAgent);
|
|
9909
9197
|
agent.command("set").description("Update agent configuration").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-c, --config <json>", "agent configuration as JSON string").option("-f, --file <path>", "path to agent configuration JSON file").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(setAgentConfig);
|
|
9198
|
+
agent.command("clear-memories").alias("clear").description("Clear all memories for an agent").requiredOption("-n, --name <name>", "agent id, name, or index number from list").option("-r, --remote-url <url>", "URL of the remote agent runtime").option("-p, --port <port>", "Port to listen on", (val) => Number.parseInt(val)).action(clearAgentMemories);
|
|
9910
9199
|
|
|
9911
9200
|
// src/utils/handle-error.ts
|
|
9912
9201
|
function handleError(error) {
|
|
@@ -9951,7 +9240,7 @@ function displayAgent(data, title = "Agent Review") {
|
|
|
9951
9240
|
logHeader(title);
|
|
9952
9241
|
console.log(`Name: ${data.name}`);
|
|
9953
9242
|
console.log(`Username: ${data.username || data.name?.toLowerCase().replace(/\s+/g, "_")}`);
|
|
9954
|
-
displaySection("Bio", Array.isArray(data.bio) ? data.bio : [data.bio]);
|
|
9243
|
+
displaySection("Bio", Array.isArray(data.bio) ? data.bio : data.bio ? [data.bio] : void 0);
|
|
9955
9244
|
displaySection("Adjectives", data.adjectives);
|
|
9956
9245
|
displaySection("Topics", data.topics);
|
|
9957
9246
|
displaySection("Plugins", data.plugins);
|
|
@@ -10005,17 +9294,17 @@ ${bottomBorder}`);
|
|
|
10005
9294
|
|
|
10006
9295
|
// src/utils/install-plugin.ts
|
|
10007
9296
|
import { logger as logger18 } from "@elizaos/core";
|
|
10008
|
-
import
|
|
9297
|
+
import { existsSync as existsSync13 } from "fs";
|
|
10009
9298
|
import path16 from "path";
|
|
10010
9299
|
|
|
10011
9300
|
// src/utils/load-plugin.ts
|
|
10012
9301
|
import { logger as logger15 } from "@elizaos/core";
|
|
10013
|
-
import
|
|
9302
|
+
import { existsSync as existsSync11, readFileSync as readFileSync8 } from "fs";
|
|
10014
9303
|
import path14 from "path";
|
|
10015
9304
|
|
|
10016
9305
|
// src/utils/plugin-context.ts
|
|
10017
9306
|
import { logger as logger14 } from "@elizaos/core";
|
|
10018
|
-
import
|
|
9307
|
+
import { existsSync as existsSync10, readFileSync as readFileSync7 } from "fs";
|
|
10019
9308
|
import path13 from "path";
|
|
10020
9309
|
function normalizeForComparison(name) {
|
|
10021
9310
|
const normalized = normalizePluginName(name)[0] || name;
|
|
@@ -10030,7 +9319,7 @@ function detectPluginContext(pluginName) {
|
|
|
10030
9319
|
const packageJsonPath = path13.join(cwd, "package.json");
|
|
10031
9320
|
let packageInfo;
|
|
10032
9321
|
try {
|
|
10033
|
-
packageInfo = JSON.parse(
|
|
9322
|
+
packageInfo = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
|
|
10034
9323
|
} catch (error) {
|
|
10035
9324
|
logger14.debug(`Failed to parse package.json: ${error}`);
|
|
10036
9325
|
return { isLocalDevelopment: false };
|
|
@@ -10043,7 +9332,7 @@ function detectPluginContext(pluginName) {
|
|
|
10043
9332
|
if (isCurrentPlugin) {
|
|
10044
9333
|
const mainEntry = packageInfo.main || "dist/index.js";
|
|
10045
9334
|
const localPath = path13.resolve(cwd, mainEntry);
|
|
10046
|
-
const needsBuild = !
|
|
9335
|
+
const needsBuild = !existsSync10(localPath);
|
|
10047
9336
|
logger14.debug(`Detected local plugin development: ${pluginName}`);
|
|
10048
9337
|
logger14.debug(`Expected output: ${localPath}`);
|
|
10049
9338
|
logger14.debug(`Needs build: ${needsBuild}`);
|
|
@@ -10065,7 +9354,7 @@ async function ensurePluginBuilt(context) {
|
|
|
10065
9354
|
logger14.info("Plugin not built, attempting to build...");
|
|
10066
9355
|
try {
|
|
10067
9356
|
await buildProject(process.cwd(), true);
|
|
10068
|
-
if (localPath &&
|
|
9357
|
+
if (localPath && existsSync10(localPath)) {
|
|
10069
9358
|
logger14.success("Plugin built successfully");
|
|
10070
9359
|
return true;
|
|
10071
9360
|
} else {
|
|
@@ -10115,8 +9404,8 @@ function resolveNodeModulesPath(repository, ...segments) {
|
|
|
10115
9404
|
async function readPackageJson(repository) {
|
|
10116
9405
|
const packageJsonPath = resolveNodeModulesPath(repository, "package.json");
|
|
10117
9406
|
try {
|
|
10118
|
-
if (
|
|
10119
|
-
return JSON.parse(
|
|
9407
|
+
if (existsSync11(packageJsonPath)) {
|
|
9408
|
+
return JSON.parse(readFileSync8(packageJsonPath, "utf-8"));
|
|
10120
9409
|
}
|
|
10121
9410
|
} catch (error) {
|
|
10122
9411
|
logger15.debug(`Failed to read package.json for '${repository}':`, error);
|
|
@@ -10146,7 +9435,7 @@ var importStrategies = [
|
|
|
10146
9435
|
provideLocalPluginGuidance(repository, context);
|
|
10147
9436
|
return null;
|
|
10148
9437
|
}
|
|
10149
|
-
if (context.localPath &&
|
|
9438
|
+
if (context.localPath && existsSync11(context.localPath)) {
|
|
10150
9439
|
logger15.info(`Loading local development plugin: ${repository}`);
|
|
10151
9440
|
return tryImporting(context.localPath, "local development plugin", repository);
|
|
10152
9441
|
}
|
|
@@ -10164,7 +9453,7 @@ var importStrategies = [
|
|
|
10164
9453
|
if (repository.startsWith("@elizaos/plugin-")) {
|
|
10165
9454
|
const pluginName = repository.replace("@elizaos/", "");
|
|
10166
9455
|
const workspacePath = path14.resolve(process.cwd(), "..", pluginName, "dist", "index.js");
|
|
10167
|
-
if (
|
|
9456
|
+
if (existsSync11(workspacePath)) {
|
|
10168
9457
|
return tryImporting(workspacePath, "workspace dependency", repository);
|
|
10169
9458
|
}
|
|
10170
9459
|
}
|
|
@@ -10183,7 +9472,7 @@ var importStrategies = [
|
|
|
10183
9472
|
name: "global node_modules",
|
|
10184
9473
|
tryImport: async (repository) => {
|
|
10185
9474
|
const globalPath = path14.resolve(getGlobalNodeModulesPath(), repository);
|
|
10186
|
-
if (!
|
|
9475
|
+
if (!existsSync11(path14.dirname(globalPath))) {
|
|
10187
9476
|
logger15.debug(
|
|
10188
9477
|
`Global node_modules directory not found at ${path14.dirname(globalPath)}, skipping for ${repository}`
|
|
10189
9478
|
);
|
|
@@ -10247,7 +9536,7 @@ async function loadPluginModule(repository) {
|
|
|
10247
9536
|
|
|
10248
9537
|
// src/utils/package-manager.ts
|
|
10249
9538
|
import { logger as logger16 } from "@elizaos/core";
|
|
10250
|
-
import
|
|
9539
|
+
import { existsSync as existsSync12 } from "fs";
|
|
10251
9540
|
import path15 from "path";
|
|
10252
9541
|
import { execa as execa6 } from "execa";
|
|
10253
9542
|
async function getPackageManager() {
|
|
@@ -10271,7 +9560,7 @@ function getInstallCommand(isGlobal) {
|
|
|
10271
9560
|
}
|
|
10272
9561
|
async function removeFromBunLock(packageName, directory) {
|
|
10273
9562
|
const lockFilePath = path15.join(directory, "bun.lock");
|
|
10274
|
-
if (!
|
|
9563
|
+
if (!existsSync12(lockFilePath)) {
|
|
10275
9564
|
logger16.debug(`No bun.lock file found at ${lockFilePath}, skipping removal`);
|
|
10276
9565
|
return;
|
|
10277
9566
|
}
|
|
@@ -10358,7 +9647,7 @@ function getCliDirectory() {
|
|
|
10358
9647
|
const cliDir = path16.dirname(
|
|
10359
9648
|
cliPath.split("node_modules/@elizaos/cli")[0] + "node_modules/@elizaos/cli"
|
|
10360
9649
|
);
|
|
10361
|
-
if (
|
|
9650
|
+
if (existsSync13(path16.join(cliDir, "package.json"))) {
|
|
10362
9651
|
return cliDir;
|
|
10363
9652
|
}
|
|
10364
9653
|
}
|
|
@@ -10400,7 +9689,9 @@ async function attemptInstallation(packageName, versionString, directory, contex
|
|
|
10400
9689
|
);
|
|
10401
9690
|
return await verifyPluginImport(installResult.installedIdentifier, context);
|
|
10402
9691
|
} catch (installError) {
|
|
10403
|
-
logger18.warn(
|
|
9692
|
+
logger18.warn(
|
|
9693
|
+
`Error during installation attempt ${context}: ${installError instanceof Error ? installError.message : String(installError)}`
|
|
9694
|
+
);
|
|
10404
9695
|
return false;
|
|
10405
9696
|
}
|
|
10406
9697
|
}
|
|
@@ -10521,10 +9812,8 @@ async function findNextAvailablePort(startPort) {
|
|
|
10521
9812
|
}
|
|
10522
9813
|
|
|
10523
9814
|
// src/utils/publisher.ts
|
|
10524
|
-
import { promises as fs16 } from "fs";
|
|
10525
|
-
import path17 from "path";
|
|
10526
|
-
import { logger as logger19 } from "@elizaos/core";
|
|
10527
9815
|
import { execa as execa7 } from "execa";
|
|
9816
|
+
import { logger as logger19 } from "@elizaos/core";
|
|
10528
9817
|
async function testPublishToNpm(cwd) {
|
|
10529
9818
|
try {
|
|
10530
9819
|
await execa7("npm", ["whoami"]);
|
|
@@ -10532,7 +9821,6 @@ async function testPublishToNpm(cwd) {
|
|
|
10532
9821
|
logger19.info("Testing build...");
|
|
10533
9822
|
await execa7("npm", ["run", "build", "--dry-run"], { cwd });
|
|
10534
9823
|
logger19.info("[\u2713] Build test successful");
|
|
10535
|
-
const pkgJson = JSON.parse(await fs16.readFile(path17.join(cwd, "package.json"), "utf-8"));
|
|
10536
9824
|
await execa7("npm", ["access", "ls-packages"], { cwd });
|
|
10537
9825
|
logger19.info("[\u2713] Have publish permissions");
|
|
10538
9826
|
return true;
|
|
@@ -10545,7 +9833,7 @@ async function testPublishToNpm(cwd) {
|
|
|
10545
9833
|
return false;
|
|
10546
9834
|
}
|
|
10547
9835
|
}
|
|
10548
|
-
async function testPublishToGitHub(
|
|
9836
|
+
async function testPublishToGitHub(packageJson, username) {
|
|
10549
9837
|
try {
|
|
10550
9838
|
const credentials = await getGitHubCredentials();
|
|
10551
9839
|
if (!credentials) {
|
|
@@ -10569,7 +9857,7 @@ async function testPublishToGitHub(cwd, packageJson, username) {
|
|
|
10569
9857
|
const settings = await getRegistrySettings();
|
|
10570
9858
|
const [registryOwner, registryRepo] = settings.defaultRegistry.split("/");
|
|
10571
9859
|
logger19.info(`Testing with registry: ${registryOwner}/${registryRepo}`);
|
|
10572
|
-
const hasFork = await forkExists(token2,
|
|
9860
|
+
const hasFork = await forkExists(token2, registryRepo, username);
|
|
10573
9861
|
logger19.info(hasFork ? "[\u2713] Fork exists" : "[\u2713] Can create fork");
|
|
10574
9862
|
if (!hasFork) {
|
|
10575
9863
|
logger19.info("Creating fork...");
|
|
@@ -10598,8 +9886,7 @@ async function testPublishToGitHub(cwd, packageJson, username) {
|
|
|
10598
9886
|
logger19.info(`Attempting to create test file: ${testPath} in branch: ${branchName}`);
|
|
10599
9887
|
const dirCreated = await ensureDirectory(
|
|
10600
9888
|
token2,
|
|
10601
|
-
username
|
|
10602
|
-
registryRepo,
|
|
9889
|
+
`${username}/${registryRepo}`,
|
|
10603
9890
|
"test-files",
|
|
10604
9891
|
branchName
|
|
10605
9892
|
);
|
|
@@ -10640,7 +9927,7 @@ async function publishToNpm(cwd) {
|
|
|
10640
9927
|
return false;
|
|
10641
9928
|
}
|
|
10642
9929
|
}
|
|
10643
|
-
async function publishToGitHub(cwd, packageJson,
|
|
9930
|
+
async function publishToGitHub(cwd, packageJson, username, skipRegistry = false, isTest = false) {
|
|
10644
9931
|
const credentials = await getGitHubCredentials();
|
|
10645
9932
|
if (!credentials) {
|
|
10646
9933
|
logger19.error("Failed to get GitHub credentials");
|
|
@@ -10708,7 +9995,7 @@ async function publishToGitHub(cwd, packageJson, cliVersion, username, skipRegis
|
|
|
10708
9995
|
}
|
|
10709
9996
|
const settings = await getRegistrySettings();
|
|
10710
9997
|
const [registryOwner, registryRepo] = settings.defaultRegistry.split("/");
|
|
10711
|
-
const hasFork = await forkExists(token2,
|
|
9998
|
+
const hasFork = await forkExists(token2, registryRepo, username);
|
|
10712
9999
|
let forkFullName;
|
|
10713
10000
|
if (!hasFork && !isTest) {
|
|
10714
10001
|
logger19.info(`Creating fork of ${settings.defaultRegistry}...`);
|
|
@@ -10805,7 +10092,9 @@ async function publishToGitHub(cwd, packageJson, cliVersion, username, skipRegis
|
|
|
10805
10092
|
return false;
|
|
10806
10093
|
}
|
|
10807
10094
|
} catch (error) {
|
|
10808
|
-
logger19.error(
|
|
10095
|
+
logger19.error(
|
|
10096
|
+
`Failed to update index.json: ${error instanceof Error ? error.message : String(error)}`
|
|
10097
|
+
);
|
|
10809
10098
|
return false;
|
|
10810
10099
|
}
|
|
10811
10100
|
const prUrl = await createPullRequest(
|
|
@@ -10855,14 +10144,22 @@ async function resolveImport(importPath, config) {
|
|
|
10855
10144
|
import {
|
|
10856
10145
|
logger as logger20
|
|
10857
10146
|
} from "@elizaos/core";
|
|
10858
|
-
import * as
|
|
10859
|
-
import * as
|
|
10147
|
+
import * as fs9 from "fs";
|
|
10148
|
+
import * as path17 from "path";
|
|
10860
10149
|
import { pathToFileURL } from "url";
|
|
10150
|
+
var safeLogger = {
|
|
10151
|
+
debug: logger20?.debug || console.log,
|
|
10152
|
+
info: logger20?.info || console.log,
|
|
10153
|
+
warn: logger20?.warn || console.warn,
|
|
10154
|
+
error: logger20?.error || console.error,
|
|
10155
|
+
success: logger20?.success || console.log
|
|
10156
|
+
};
|
|
10861
10157
|
var TestRunner = class {
|
|
10862
10158
|
runtime;
|
|
10863
10159
|
projectAgent;
|
|
10864
10160
|
stats;
|
|
10865
10161
|
isDirectPluginTest;
|
|
10162
|
+
pluginUnderTest;
|
|
10866
10163
|
constructor(runtime, projectAgent) {
|
|
10867
10164
|
this.runtime = runtime;
|
|
10868
10165
|
this.projectAgent = projectAgent;
|
|
@@ -10873,10 +10170,27 @@ var TestRunner = class {
|
|
|
10873
10170
|
skipped: 0,
|
|
10874
10171
|
hasTests: false
|
|
10875
10172
|
};
|
|
10876
|
-
|
|
10877
|
-
|
|
10173
|
+
const testingPlugin = process.env.ELIZA_TESTING_PLUGIN === "true";
|
|
10174
|
+
if (testingPlugin && projectAgent?.plugins) {
|
|
10175
|
+
const corePlugins = ["@elizaos/plugin-sql"];
|
|
10176
|
+
const nonCorePlugins = projectAgent.plugins.filter(
|
|
10177
|
+
(plugin) => !corePlugins.includes(plugin.name)
|
|
10178
|
+
);
|
|
10179
|
+
if (nonCorePlugins.length > 0) {
|
|
10180
|
+
this.pluginUnderTest = nonCorePlugins[0];
|
|
10181
|
+
this.isDirectPluginTest = true;
|
|
10182
|
+
safeLogger.debug(
|
|
10183
|
+
`Direct plugin test detected - will only run tests for plugin: ${this.pluginUnderTest.name}`
|
|
10184
|
+
);
|
|
10185
|
+
} else {
|
|
10186
|
+
this.isDirectPluginTest = false;
|
|
10187
|
+
}
|
|
10188
|
+
} else if (projectAgent?.plugins?.length === 1 && (projectAgent.character.name.includes(`Test Agent for ${projectAgent.plugins[0].name}`) || projectAgent.character.name.toLowerCase().includes("test") && projectAgent.character.name.toLowerCase().includes(projectAgent.plugins[0].name.toLowerCase()))) {
|
|
10189
|
+
this.pluginUnderTest = projectAgent.plugins[0];
|
|
10878
10190
|
this.isDirectPluginTest = true;
|
|
10879
|
-
|
|
10191
|
+
safeLogger.debug(
|
|
10192
|
+
`Direct plugin test detected - will only run tests for plugin: ${this.pluginUnderTest.name}`
|
|
10193
|
+
);
|
|
10880
10194
|
} else {
|
|
10881
10195
|
this.isDirectPluginTest = false;
|
|
10882
10196
|
}
|
|
@@ -10902,7 +10216,7 @@ var TestRunner = class {
|
|
|
10902
10216
|
* @param suite The test suite to run
|
|
10903
10217
|
*/
|
|
10904
10218
|
async runTestSuite(suite) {
|
|
10905
|
-
|
|
10219
|
+
safeLogger.info(`
|
|
10906
10220
|
Running test suite: ${suite.name}`);
|
|
10907
10221
|
if (suite.tests.length > 0) {
|
|
10908
10222
|
this.stats.hasTests = true;
|
|
@@ -10910,14 +10224,14 @@ Running test suite: ${suite.name}`);
|
|
|
10910
10224
|
for (const test of suite.tests) {
|
|
10911
10225
|
this.stats.total++;
|
|
10912
10226
|
try {
|
|
10913
|
-
|
|
10227
|
+
safeLogger.info(` Running test: ${test.name}`);
|
|
10914
10228
|
await test.fn(this.runtime);
|
|
10915
10229
|
this.stats.passed++;
|
|
10916
|
-
|
|
10230
|
+
safeLogger.success(` [\u2713] ${test.name}`);
|
|
10917
10231
|
} catch (error) {
|
|
10918
10232
|
this.stats.failed++;
|
|
10919
|
-
|
|
10920
|
-
|
|
10233
|
+
safeLogger.error(` [X] ${test.name}`);
|
|
10234
|
+
safeLogger.error(` ${error instanceof Error ? error.message : String(error)}`);
|
|
10921
10235
|
}
|
|
10922
10236
|
}
|
|
10923
10237
|
}
|
|
@@ -10927,18 +10241,18 @@ Running test suite: ${suite.name}`);
|
|
|
10927
10241
|
async runProjectTests(options) {
|
|
10928
10242
|
if (!this.projectAgent?.tests || options.skipProjectTests || this.isDirectPluginTest) {
|
|
10929
10243
|
if (this.isDirectPluginTest) {
|
|
10930
|
-
|
|
10244
|
+
safeLogger.info("Skipping project tests when directly testing a plugin");
|
|
10931
10245
|
}
|
|
10932
10246
|
return;
|
|
10933
10247
|
}
|
|
10934
|
-
|
|
10248
|
+
safeLogger.info("\nRunning project tests...");
|
|
10935
10249
|
const testSuites = Array.isArray(this.projectAgent.tests) ? this.projectAgent.tests : [this.projectAgent.tests];
|
|
10936
10250
|
for (const suite of testSuites) {
|
|
10937
10251
|
if (!suite) {
|
|
10938
10252
|
continue;
|
|
10939
10253
|
}
|
|
10940
10254
|
if (!this.matchesFilter(suite.name, options.filter)) {
|
|
10941
|
-
|
|
10255
|
+
safeLogger.info(
|
|
10942
10256
|
`Skipping test suite "${suite.name}" (doesn't match filter "${options.filter}")`
|
|
10943
10257
|
);
|
|
10944
10258
|
this.stats.skipped++;
|
|
@@ -10955,15 +10269,15 @@ Running test suite: ${suite.name}`);
|
|
|
10955
10269
|
return;
|
|
10956
10270
|
}
|
|
10957
10271
|
if (this.isDirectPluginTest) {
|
|
10958
|
-
|
|
10959
|
-
const plugin = this.
|
|
10272
|
+
safeLogger.info("\nRunning plugin tests...");
|
|
10273
|
+
const plugin = this.pluginUnderTest;
|
|
10960
10274
|
if (!plugin || !plugin.tests) {
|
|
10961
|
-
|
|
10962
|
-
|
|
10275
|
+
safeLogger.info(`No tests found for this plugin (${plugin?.name || "unknown plugin"})`);
|
|
10276
|
+
safeLogger.info(
|
|
10963
10277
|
"To add tests to your plugin, include a 'tests' property with an array of test suites."
|
|
10964
10278
|
);
|
|
10965
|
-
|
|
10966
|
-
|
|
10279
|
+
safeLogger.info("Example:");
|
|
10280
|
+
safeLogger.info(`
|
|
10967
10281
|
export const myPlugin = {
|
|
10968
10282
|
name: "my-plugin",
|
|
10969
10283
|
description: "My awesome plugin",
|
|
@@ -10987,14 +10301,14 @@ export const myPlugin = {
|
|
|
10987
10301
|
`);
|
|
10988
10302
|
return;
|
|
10989
10303
|
}
|
|
10990
|
-
|
|
10304
|
+
safeLogger.info(`Found test suites for plugin: ${plugin.name}`);
|
|
10991
10305
|
const testSuites = Array.isArray(plugin.tests) ? plugin.tests : [plugin.tests];
|
|
10992
10306
|
for (const suite of testSuites) {
|
|
10993
10307
|
if (!suite) {
|
|
10994
10308
|
continue;
|
|
10995
10309
|
}
|
|
10996
10310
|
if (!this.matchesFilter(suite.name, options.filter)) {
|
|
10997
|
-
|
|
10311
|
+
safeLogger.info(
|
|
10998
10312
|
`Skipping test suite "${suite.name}" because it doesn't match filter "${options.filter}"`
|
|
10999
10313
|
);
|
|
11000
10314
|
this.stats.skipped++;
|
|
@@ -11003,7 +10317,7 @@ export const myPlugin = {
|
|
|
11003
10317
|
await this.runTestSuite(suite);
|
|
11004
10318
|
}
|
|
11005
10319
|
} else {
|
|
11006
|
-
|
|
10320
|
+
safeLogger.info("Plugin tests were requested but this is not a direct plugin test");
|
|
11007
10321
|
}
|
|
11008
10322
|
}
|
|
11009
10323
|
/**
|
|
@@ -11011,45 +10325,45 @@ export const myPlugin = {
|
|
|
11011
10325
|
*/
|
|
11012
10326
|
async runE2eTests(options) {
|
|
11013
10327
|
if (options.skipE2eTests) {
|
|
11014
|
-
|
|
10328
|
+
safeLogger.info("Skipping e2e tests (--skip-e2e-tests flag)");
|
|
11015
10329
|
return;
|
|
11016
10330
|
}
|
|
11017
10331
|
try {
|
|
11018
|
-
const e2eDir =
|
|
11019
|
-
if (!
|
|
11020
|
-
|
|
10332
|
+
const e2eDir = path17.join(process.cwd(), "e2e");
|
|
10333
|
+
if (!fs9.existsSync(e2eDir)) {
|
|
10334
|
+
safeLogger.debug("No e2e directory found, skipping e2e tests");
|
|
11021
10335
|
return;
|
|
11022
10336
|
}
|
|
11023
|
-
|
|
11024
|
-
const walk = (dir) =>
|
|
11025
|
-
(entry) => entry.isDirectory() ? walk(
|
|
10337
|
+
safeLogger.info("\nRunning e2e tests...");
|
|
10338
|
+
const walk = (dir) => fs9.readdirSync(dir, { withFileTypes: true }).flatMap(
|
|
10339
|
+
(entry) => entry.isDirectory() ? walk(path17.join(dir, entry.name)) : entry.name.match(/\.test\.(t|j)sx?$/) ? [path17.join(dir, entry.name)] : []
|
|
11026
10340
|
);
|
|
11027
10341
|
const testFiles = walk(e2eDir);
|
|
11028
10342
|
if (testFiles.length === 0) {
|
|
11029
|
-
|
|
10343
|
+
safeLogger.info("No e2e test files found");
|
|
11030
10344
|
return;
|
|
11031
10345
|
}
|
|
11032
|
-
|
|
11033
|
-
const distE2eDir =
|
|
11034
|
-
const hasDistE2e =
|
|
10346
|
+
safeLogger.info(`Found ${testFiles.length} e2e test files`);
|
|
10347
|
+
const distE2eDir = path17.join(process.cwd(), "dist", "e2e");
|
|
10348
|
+
const hasDistE2e = fs9.existsSync(distE2eDir);
|
|
11035
10349
|
for (const testFile of testFiles) {
|
|
11036
10350
|
try {
|
|
11037
|
-
const fileName =
|
|
11038
|
-
const fileNameWithoutExt =
|
|
11039
|
-
|
|
10351
|
+
const fileName = path17.basename(testFile);
|
|
10352
|
+
const fileNameWithoutExt = path17.basename(testFile, ".test.ts");
|
|
10353
|
+
safeLogger.info(`Loading test file: ${fileName}`);
|
|
11040
10354
|
let moduleImportPath = testFile;
|
|
11041
10355
|
if (hasDistE2e) {
|
|
11042
|
-
const distFile =
|
|
11043
|
-
if (
|
|
10356
|
+
const distFile = path17.join(distE2eDir, `${fileNameWithoutExt}.test.js`);
|
|
10357
|
+
if (fs9.existsSync(distFile)) {
|
|
11044
10358
|
moduleImportPath = distFile;
|
|
11045
|
-
|
|
10359
|
+
safeLogger.debug(`Using compiled version from ${distFile}`);
|
|
11046
10360
|
} else {
|
|
11047
|
-
|
|
10361
|
+
safeLogger.warn(
|
|
11048
10362
|
`No compiled version found for ${fileName}, attempting to import TypeScript directly (may fail)`
|
|
11049
10363
|
);
|
|
11050
10364
|
}
|
|
11051
10365
|
} else {
|
|
11052
|
-
|
|
10366
|
+
safeLogger.warn(
|
|
11053
10367
|
`No dist/e2e directory found. E2E tests should be compiled first. Import may fail.`
|
|
11054
10368
|
);
|
|
11055
10369
|
}
|
|
@@ -11057,8 +10371,8 @@ export const myPlugin = {
|
|
|
11057
10371
|
try {
|
|
11058
10372
|
testModule = await import(pathToFileURL(moduleImportPath).href);
|
|
11059
10373
|
} catch (importError) {
|
|
11060
|
-
|
|
11061
|
-
|
|
10374
|
+
safeLogger.error(`Failed to import test file ${fileName}:`, importError);
|
|
10375
|
+
safeLogger.info(
|
|
11062
10376
|
`Make sure your e2e tests are properly compiled with 'npm run build' or 'bun run build'`
|
|
11063
10377
|
);
|
|
11064
10378
|
this.stats.failed++;
|
|
@@ -11066,7 +10380,7 @@ export const myPlugin = {
|
|
|
11066
10380
|
}
|
|
11067
10381
|
const testSuite = testModule.default;
|
|
11068
10382
|
if (!testSuite || !testSuite.tests) {
|
|
11069
|
-
|
|
10383
|
+
safeLogger.warn(`No valid test suite found in ${fileName}`);
|
|
11070
10384
|
continue;
|
|
11071
10385
|
}
|
|
11072
10386
|
if (options.filter) {
|
|
@@ -11074,7 +10388,7 @@ export const myPlugin = {
|
|
|
11074
10388
|
const matchesFileName = fileNameWithoutExt.toLowerCase() === processedFilter.toLowerCase() || fileNameWithoutExt.toLowerCase().includes(processedFilter.toLowerCase());
|
|
11075
10389
|
const matchesSuiteName = testSuite.name ? testSuite.name.toLowerCase().includes(processedFilter.toLowerCase()) : false;
|
|
11076
10390
|
if (!matchesFileName && !matchesSuiteName) {
|
|
11077
|
-
|
|
10391
|
+
safeLogger.info(
|
|
11078
10392
|
`Skipping test suite "${testSuite.name || "unnamed"}" in ${fileName} (doesn't match filter "${options.filter}")`
|
|
11079
10393
|
);
|
|
11080
10394
|
this.stats.skipped++;
|
|
@@ -11083,12 +10397,12 @@ export const myPlugin = {
|
|
|
11083
10397
|
}
|
|
11084
10398
|
await this.runTestSuite(testSuite);
|
|
11085
10399
|
} catch (error) {
|
|
11086
|
-
|
|
10400
|
+
safeLogger.error(`Error running tests from ${testFile}:`, error);
|
|
11087
10401
|
this.stats.failed++;
|
|
11088
10402
|
}
|
|
11089
10403
|
}
|
|
11090
10404
|
} catch (error) {
|
|
11091
|
-
|
|
10405
|
+
safeLogger.error(`Error running e2e tests:`, error);
|
|
11092
10406
|
}
|
|
11093
10407
|
}
|
|
11094
10408
|
/**
|
|
@@ -11100,9 +10414,9 @@ export const myPlugin = {
|
|
|
11100
10414
|
await this.runPluginTests(options);
|
|
11101
10415
|
await this.runE2eTests(options);
|
|
11102
10416
|
if (!this.stats.hasTests) {
|
|
11103
|
-
|
|
10417
|
+
safeLogger.info("\nNo test files found, exiting with code 0");
|
|
11104
10418
|
} else {
|
|
11105
|
-
|
|
10419
|
+
safeLogger.info(
|
|
11106
10420
|
`
|
|
11107
10421
|
Test Summary: ${this.stats.passed} passed, ${this.stats.failed} failed, ${this.stats.skipped} skipped`
|
|
11108
10422
|
);
|
|
@@ -11116,8 +10430,8 @@ var import_dotenv3 = __toESM(require_main(), 1);
|
|
|
11116
10430
|
var import_https_proxy_agent = __toESM(require_dist2(), 1);
|
|
11117
10431
|
import { logger as logger21 } from "@elizaos/core";
|
|
11118
10432
|
import { execa as execa8 } from "execa";
|
|
11119
|
-
import { existsSync as
|
|
11120
|
-
import
|
|
10433
|
+
import { existsSync as existsSync15, promises as fs10 } from "fs";
|
|
10434
|
+
import path18 from "path";
|
|
11121
10435
|
|
|
11122
10436
|
// src/utils/registry/constants.ts
|
|
11123
10437
|
var REGISTRY_ORG = "elizaos-plugins";
|
|
@@ -11128,22 +10442,22 @@ var REGISTRY_GITHUB_URL = `https://github.com/${REGISTRY_REPO}`;
|
|
|
11128
10442
|
var RAW_REGISTRY_URL = REGISTRY_URL;
|
|
11129
10443
|
|
|
11130
10444
|
// src/utils/registry/index.ts
|
|
11131
|
-
var ELIZA_DIR =
|
|
11132
|
-
var REGISTRY_SETTINGS_FILE =
|
|
11133
|
-
var ENV_FILE = resolveEnvFile() ||
|
|
11134
|
-
var REGISTRY_CACHE_FILE =
|
|
10445
|
+
var ELIZA_DIR = path18.join(process.cwd(), ".eliza");
|
|
10446
|
+
var REGISTRY_SETTINGS_FILE = path18.join(ELIZA_DIR, "registrysettings.json");
|
|
10447
|
+
var ENV_FILE = resolveEnvFile() || path18.join(ELIZA_DIR, ".env");
|
|
10448
|
+
var REGISTRY_CACHE_FILE = path18.join(ELIZA_DIR, "registry-cache.json");
|
|
11135
10449
|
var REQUIRED_ENV_VARS = ["GITHUB_TOKEN"];
|
|
11136
10450
|
var REQUIRED_SETTINGS = ["defaultRegistry"];
|
|
11137
10451
|
async function ensureElizaDir2() {
|
|
11138
10452
|
try {
|
|
11139
|
-
await
|
|
10453
|
+
await fs10.mkdir(ELIZA_DIR, { recursive: true });
|
|
11140
10454
|
} catch (error) {
|
|
11141
10455
|
}
|
|
11142
10456
|
}
|
|
11143
10457
|
async function getRegistrySettings() {
|
|
11144
10458
|
await ensureElizaDir2();
|
|
11145
10459
|
try {
|
|
11146
|
-
const content = await
|
|
10460
|
+
const content = await fs10.readFile(REGISTRY_SETTINGS_FILE, "utf-8");
|
|
11147
10461
|
return JSON.parse(content);
|
|
11148
10462
|
} catch (error) {
|
|
11149
10463
|
return {
|
|
@@ -11153,11 +10467,11 @@ async function getRegistrySettings() {
|
|
|
11153
10467
|
}
|
|
11154
10468
|
async function saveRegistrySettings(settings) {
|
|
11155
10469
|
await ensureElizaDir2();
|
|
11156
|
-
await
|
|
10470
|
+
await fs10.writeFile(REGISTRY_SETTINGS_FILE, JSON.stringify(settings, null, 2));
|
|
11157
10471
|
}
|
|
11158
10472
|
async function getEnvVar(key2) {
|
|
11159
10473
|
try {
|
|
11160
|
-
const envContent = await
|
|
10474
|
+
const envContent = await fs10.readFile(ENV_FILE, "utf-8");
|
|
11161
10475
|
const env = import_dotenv3.default.parse(envContent);
|
|
11162
10476
|
return env[key2];
|
|
11163
10477
|
} catch (error) {
|
|
@@ -11168,30 +10482,32 @@ async function setEnvVar(key2, value) {
|
|
|
11168
10482
|
await ensureElizaDir2();
|
|
11169
10483
|
let envContent = "";
|
|
11170
10484
|
try {
|
|
11171
|
-
envContent = await
|
|
10485
|
+
envContent = await fs10.readFile(ENV_FILE, "utf-8");
|
|
11172
10486
|
} catch (error) {
|
|
11173
10487
|
}
|
|
11174
10488
|
const env = import_dotenv3.default.parse(envContent);
|
|
11175
10489
|
env[key2] = value;
|
|
11176
|
-
const newContent = Object.entries(env).map(([
|
|
11177
|
-
await
|
|
10490
|
+
const newContent = Object.entries(env).map(([k, v]) => `${k}=${v}`).join("\n");
|
|
10491
|
+
await fs10.writeFile(ENV_FILE, newContent);
|
|
11178
10492
|
}
|
|
11179
|
-
async function
|
|
10493
|
+
async function getGitHubToken() {
|
|
11180
10494
|
try {
|
|
11181
10495
|
const envPath = resolveEnvFile();
|
|
11182
|
-
if (envPath &&
|
|
11183
|
-
const envContent = await
|
|
10496
|
+
if (envPath && existsSync15(envPath)) {
|
|
10497
|
+
const envContent = await fs10.readFile(envPath, "utf-8");
|
|
11184
10498
|
const env = import_dotenv3.default.parse(envContent);
|
|
11185
10499
|
return env.GITHUB_TOKEN;
|
|
11186
10500
|
}
|
|
11187
|
-
const globalEnvPath =
|
|
11188
|
-
if (
|
|
11189
|
-
const envContent = await
|
|
10501
|
+
const globalEnvPath = path18.join(ELIZA_DIR, ".env");
|
|
10502
|
+
if (existsSync15(globalEnvPath) && globalEnvPath !== envPath) {
|
|
10503
|
+
const envContent = await fs10.readFile(globalEnvPath, "utf-8");
|
|
11190
10504
|
const env = import_dotenv3.default.parse(envContent);
|
|
11191
10505
|
return env.GITHUB_TOKEN;
|
|
11192
10506
|
}
|
|
11193
10507
|
} catch (error) {
|
|
11194
|
-
logger21.debug(
|
|
10508
|
+
logger21.debug(
|
|
10509
|
+
`Error reading GitHub token: ${error instanceof Error ? error.message : String(error)}`
|
|
10510
|
+
);
|
|
11195
10511
|
}
|
|
11196
10512
|
return void 0;
|
|
11197
10513
|
}
|
|
@@ -11200,8 +10516,8 @@ async function setGitHubToken(token2) {
|
|
|
11200
10516
|
try {
|
|
11201
10517
|
let envContent = "";
|
|
11202
10518
|
try {
|
|
11203
|
-
if (
|
|
11204
|
-
envContent = await
|
|
10519
|
+
if (existsSync15(ENV_FILE)) {
|
|
10520
|
+
envContent = await fs10.readFile(ENV_FILE, "utf-8");
|
|
11205
10521
|
}
|
|
11206
10522
|
} catch (error) {
|
|
11207
10523
|
envContent = "# Eliza environment variables\n\n";
|
|
@@ -11213,14 +10529,15 @@ async function setGitHubToken(token2) {
|
|
|
11213
10529
|
newContent += `${key2}=${value}
|
|
11214
10530
|
`;
|
|
11215
10531
|
}
|
|
11216
|
-
await
|
|
10532
|
+
await fs10.writeFile(ENV_FILE, newContent);
|
|
11217
10533
|
process.env.GITHUB_TOKEN = token2;
|
|
11218
10534
|
logger21.debug("GitHub token saved successfully");
|
|
11219
10535
|
} catch (error) {
|
|
11220
|
-
logger21.error(
|
|
10536
|
+
logger21.error(
|
|
10537
|
+
`Failed to save GitHub token: ${error instanceof Error ? error.message : String(error)}`
|
|
10538
|
+
);
|
|
11221
10539
|
}
|
|
11222
10540
|
}
|
|
11223
|
-
var agent2 = process.env.https_proxy ? new import_https_proxy_agent.HttpsProxyAgent(process.env.https_proxy) : void 0;
|
|
11224
10541
|
function normalizePackageName(packageName) {
|
|
11225
10542
|
if (packageName.startsWith(`@${REGISTRY_ORG}/`)) {
|
|
11226
10543
|
return packageName.replace(`@${REGISTRY_ORG}/`, "");
|
|
@@ -11259,10 +10576,12 @@ var DEFAULT_REGISTRY = {
|
|
|
11259
10576
|
async function saveRegistryCache(registry) {
|
|
11260
10577
|
try {
|
|
11261
10578
|
await ensureElizaDir2();
|
|
11262
|
-
await
|
|
10579
|
+
await fs10.writeFile(REGISTRY_CACHE_FILE, JSON.stringify(registry, null, 2));
|
|
11263
10580
|
logger21.debug("Registry cache saved successfully");
|
|
11264
10581
|
} catch (error) {
|
|
11265
|
-
logger21.debug(
|
|
10582
|
+
logger21.debug(
|
|
10583
|
+
`Failed to save registry cache: ${error instanceof Error ? error.message : String(error)}`
|
|
10584
|
+
);
|
|
11266
10585
|
}
|
|
11267
10586
|
}
|
|
11268
10587
|
async function getLocalRegistryIndex() {
|
|
@@ -11284,17 +10603,21 @@ async function getLocalRegistryIndex() {
|
|
|
11284
10603
|
}
|
|
11285
10604
|
}
|
|
11286
10605
|
} catch (error) {
|
|
11287
|
-
logger21.debug(
|
|
10606
|
+
logger21.debug(
|
|
10607
|
+
`Failed to fetch registry from public URL: ${error instanceof Error ? error.message : String(error)}`
|
|
10608
|
+
);
|
|
11288
10609
|
}
|
|
11289
10610
|
try {
|
|
11290
|
-
if (
|
|
11291
|
-
const cacheContent = await
|
|
10611
|
+
if (existsSync15(REGISTRY_CACHE_FILE)) {
|
|
10612
|
+
const cacheContent = await fs10.readFile(REGISTRY_CACHE_FILE, "utf-8");
|
|
11292
10613
|
const cachedRegistry = JSON.parse(cacheContent);
|
|
11293
10614
|
logger21.debug("Using cached registry index");
|
|
11294
10615
|
return cachedRegistry;
|
|
11295
10616
|
}
|
|
11296
10617
|
} catch (error) {
|
|
11297
|
-
logger21.debug(
|
|
10618
|
+
logger21.debug(
|
|
10619
|
+
`Failed to read registry cache: ${error instanceof Error ? error.message : String(error)}`
|
|
10620
|
+
);
|
|
11298
10621
|
}
|
|
11299
10622
|
const directoryInfo = detectDirectoryType(process.cwd());
|
|
11300
10623
|
if (directoryInfo.monorepoRoot) {
|
|
@@ -11309,7 +10632,9 @@ async function getLocalRegistryIndex() {
|
|
|
11309
10632
|
}
|
|
11310
10633
|
return { ...DEFAULT_REGISTRY, ...localRegistry };
|
|
11311
10634
|
} catch (error) {
|
|
11312
|
-
logger21.debug(
|
|
10635
|
+
logger21.debug(
|
|
10636
|
+
`Failed to discover local plugins: ${error instanceof Error ? error.message : String(error)}`
|
|
10637
|
+
);
|
|
11313
10638
|
}
|
|
11314
10639
|
}
|
|
11315
10640
|
return DEFAULT_REGISTRY;
|
|
@@ -11394,7 +10719,9 @@ async function getPluginRepository(pluginName) {
|
|
|
11394
10719
|
}
|
|
11395
10720
|
return null;
|
|
11396
10721
|
} catch (error) {
|
|
11397
|
-
logger21.debug(
|
|
10722
|
+
logger21.debug(
|
|
10723
|
+
`Error getting plugin repository: ${error instanceof Error ? error.message : String(error)}`
|
|
10724
|
+
);
|
|
11398
10725
|
return null;
|
|
11399
10726
|
}
|
|
11400
10727
|
}
|
|
@@ -11403,7 +10730,9 @@ async function repoHasBranch(repoUrl, branchName) {
|
|
|
11403
10730
|
const { stdout } = await execa8("git", ["ls-remote", "--heads", repoUrl, branchName]);
|
|
11404
10731
|
return stdout.includes(branchName);
|
|
11405
10732
|
} catch (error) {
|
|
11406
|
-
logger21.warn(
|
|
10733
|
+
logger21.warn(
|
|
10734
|
+
`Failed to check for branch ${branchName} in ${repoUrl}: ${error instanceof Error ? error.message : String(error)}`
|
|
10735
|
+
);
|
|
11407
10736
|
return false;
|
|
11408
10737
|
}
|
|
11409
10738
|
}
|
|
@@ -11467,7 +10796,9 @@ async function getPluginVersion(pluginName, version) {
|
|
|
11467
10796
|
return packageDetails.latestVersion;
|
|
11468
10797
|
}
|
|
11469
10798
|
} catch (error) {
|
|
11470
|
-
logger21.debug(
|
|
10799
|
+
logger21.debug(
|
|
10800
|
+
`Error getting package details: ${error instanceof Error ? error.message : String(error)}`
|
|
10801
|
+
);
|
|
11471
10802
|
}
|
|
11472
10803
|
return "latest";
|
|
11473
10804
|
}
|
|
@@ -11495,15 +10826,17 @@ async function getPackageDetails(packageName) {
|
|
|
11495
10826
|
if (response.status !== 200) {
|
|
11496
10827
|
return null;
|
|
11497
10828
|
}
|
|
11498
|
-
const
|
|
10829
|
+
const text5 = await response.text();
|
|
11499
10830
|
try {
|
|
11500
|
-
return JSON.parse(
|
|
10831
|
+
return JSON.parse(text5);
|
|
11501
10832
|
} catch {
|
|
11502
|
-
logger21.warn(`Invalid JSON response received from registry for package ${packageName}:`,
|
|
10833
|
+
logger21.warn(`Invalid JSON response received from registry for package ${packageName}:`, text5);
|
|
11503
10834
|
return null;
|
|
11504
10835
|
}
|
|
11505
10836
|
} catch (error) {
|
|
11506
|
-
logger21.warn(
|
|
10837
|
+
logger21.warn(
|
|
10838
|
+
`Failed to fetch package details from registry: ${error instanceof Error ? error.message : String(error)}`
|
|
10839
|
+
);
|
|
11507
10840
|
return null;
|
|
11508
10841
|
}
|
|
11509
10842
|
}
|
|
@@ -11515,8 +10848,8 @@ async function getBestPluginVersion(packageName, runtimeVersion) {
|
|
|
11515
10848
|
if (packageDetails.runtimeVersion === runtimeVersion) {
|
|
11516
10849
|
return packageDetails.latestVersion;
|
|
11517
10850
|
}
|
|
11518
|
-
const [runtimeMajor, runtimeMinor
|
|
11519
|
-
const [packageMajor, packageMinor
|
|
10851
|
+
const [runtimeMajor, runtimeMinor] = runtimeVersion.split(".").map(Number);
|
|
10852
|
+
const [packageMajor, packageMinor] = packageDetails.runtimeVersion.split(".").map(Number);
|
|
11520
10853
|
if (runtimeMajor !== packageMajor) {
|
|
11521
10854
|
logger21.warn(
|
|
11522
10855
|
`Plugin ${packageName} was built for runtime v${packageDetails.runtimeVersion}, but you're using v${runtimeVersion}`
|
|
@@ -11546,13 +10879,13 @@ async function checkDataDir() {
|
|
|
11546
10879
|
}
|
|
11547
10880
|
};
|
|
11548
10881
|
try {
|
|
11549
|
-
await
|
|
10882
|
+
await fs10.access(ELIZA_DIR);
|
|
11550
10883
|
status.exists = true;
|
|
11551
10884
|
} catch {
|
|
11552
10885
|
return status;
|
|
11553
10886
|
}
|
|
11554
10887
|
try {
|
|
11555
|
-
const envContent = await
|
|
10888
|
+
const envContent = await fs10.readFile(ENV_FILE, "utf-8");
|
|
11556
10889
|
const env = import_dotenv3.default.parse(envContent);
|
|
11557
10890
|
status.env.exists = true;
|
|
11558
10891
|
status.env.missingKeys = REQUIRED_ENV_VARS.filter((key2) => !env[key2]);
|
|
@@ -11560,7 +10893,7 @@ async function checkDataDir() {
|
|
|
11560
10893
|
} catch {
|
|
11561
10894
|
}
|
|
11562
10895
|
try {
|
|
11563
|
-
const settingsContent = await
|
|
10896
|
+
const settingsContent = await fs10.readFile(REGISTRY_SETTINGS_FILE, "utf-8");
|
|
11564
10897
|
const settings = JSON.parse(settingsContent);
|
|
11565
10898
|
status.settings.exists = true;
|
|
11566
10899
|
status.settings.missingKeys = REQUIRED_SETTINGS.filter((key2) => !(key2 in settings));
|
|
@@ -11572,12 +10905,12 @@ async function checkDataDir() {
|
|
|
11572
10905
|
async function initializeDataDir() {
|
|
11573
10906
|
await ensureElizaDir2();
|
|
11574
10907
|
try {
|
|
11575
|
-
await
|
|
10908
|
+
await fs10.access(ENV_FILE);
|
|
11576
10909
|
} catch {
|
|
11577
|
-
await
|
|
10910
|
+
await fs10.writeFile(ENV_FILE, "");
|
|
11578
10911
|
}
|
|
11579
10912
|
try {
|
|
11580
|
-
await
|
|
10913
|
+
await fs10.access(REGISTRY_SETTINGS_FILE);
|
|
11581
10914
|
} catch {
|
|
11582
10915
|
await saveRegistrySettings({
|
|
11583
10916
|
defaultRegistry: REGISTRY_REPO
|
|
@@ -11594,7 +10927,7 @@ async function validateDataDir() {
|
|
|
11594
10927
|
let isValid = true;
|
|
11595
10928
|
const envPath = resolveEnvFile();
|
|
11596
10929
|
if (envPath) {
|
|
11597
|
-
const envContent = await
|
|
10930
|
+
const envContent = await fs10.readFile(envPath, "utf-8");
|
|
11598
10931
|
const parsedEnv = import_dotenv3.default.parse(envContent);
|
|
11599
10932
|
if (!parsedEnv.GITHUB_TOKEN) {
|
|
11600
10933
|
logger21.warn("GitHub token not found in environment");
|
|
@@ -11621,8 +10954,6 @@ async function validateDataDir() {
|
|
|
11621
10954
|
export {
|
|
11622
10955
|
Command,
|
|
11623
10956
|
Option,
|
|
11624
|
-
getAudioMimeType,
|
|
11625
|
-
convertToAudioBuffer,
|
|
11626
10957
|
require_main,
|
|
11627
10958
|
expandTildePath,
|
|
11628
10959
|
resolveEnvFile,
|
|
@@ -11634,14 +10965,6 @@ export {
|
|
|
11634
10965
|
isBunAvailable,
|
|
11635
10966
|
isCliInstalledViaNpm,
|
|
11636
10967
|
migrateCliToBun,
|
|
11637
|
-
pD,
|
|
11638
|
-
he,
|
|
11639
|
-
ye,
|
|
11640
|
-
ve,
|
|
11641
|
-
fe,
|
|
11642
|
-
xe,
|
|
11643
|
-
Ie,
|
|
11644
|
-
Se,
|
|
11645
10968
|
NAV_BACK,
|
|
11646
10969
|
NAV_NEXT,
|
|
11647
10970
|
promptWithNav,
|
|
@@ -11684,6 +11007,9 @@ export {
|
|
|
11684
11007
|
storeAnthropicKey,
|
|
11685
11008
|
promptAndStoreOpenAIKey,
|
|
11686
11009
|
promptAndStoreAnthropicKey,
|
|
11010
|
+
isValidOllamaEndpoint,
|
|
11011
|
+
storeOllamaConfig,
|
|
11012
|
+
promptAndStoreOllamaConfig,
|
|
11687
11013
|
configureDatabaseSettings,
|
|
11688
11014
|
rawConfigSchema,
|
|
11689
11015
|
configSchema,
|
|
@@ -11699,7 +11025,7 @@ export {
|
|
|
11699
11025
|
saveRegistrySettings,
|
|
11700
11026
|
getEnvVar,
|
|
11701
11027
|
setEnvVar,
|
|
11702
|
-
|
|
11028
|
+
getGitHubToken,
|
|
11703
11029
|
setGitHubToken,
|
|
11704
11030
|
saveRegistryCache,
|
|
11705
11031
|
getLocalRegistryIndex,
|
|
@@ -11764,6 +11090,7 @@ export {
|
|
|
11764
11090
|
resolveAgentId,
|
|
11765
11091
|
getAgent,
|
|
11766
11092
|
removeAgent,
|
|
11093
|
+
clearAgentMemories,
|
|
11767
11094
|
setAgentConfig,
|
|
11768
11095
|
startAgent,
|
|
11769
11096
|
stopAgent,
|