@kevisual/cli 0.1.8 → 0.1.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/dist/assistant.js CHANGED
@@ -28809,7 +28809,7 @@ class AssistantConfig {
28809
28809
  home: "/root/home",
28810
28810
  proxy: [],
28811
28811
  share: {
28812
- enabled: false,
28812
+ enabled: true,
28813
28813
  url: "https://kevisual.cn/ws/proxy"
28814
28814
  }
28815
28815
  };
@@ -37099,7 +37099,7 @@ class Query {
37099
37099
  }
37100
37100
  }
37101
37101
 
37102
- // ../node_modules/.pnpm/@kevisual+router@0.0.83/node_modules/@kevisual/router/dist/router-browser.js
37102
+ // ../node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/dist/router-browser.js
37103
37103
  var __create3 = Object.create;
37104
37104
  var __getProtoOf3 = Object.getPrototypeOf;
37105
37105
  var __defProp3 = Object.defineProperty;
@@ -51106,7 +51106,7 @@ function filter(data, query) {
51106
51106
  return executor.execute(ast, data);
51107
51107
  }
51108
51108
 
51109
- // ../node_modules/.pnpm/@kevisual+api@0.0.58_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
51109
+ // ../node_modules/.pnpm/@kevisual+api@0.0.59_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
51110
51110
  var initApi = async (opts) => {
51111
51111
  const router = opts?.router;
51112
51112
  const item = opts?.item;
@@ -51291,7 +51291,7 @@ var getStringHash = (str) => {
51291
51291
  return crypto2.createHash("md5").update(str).digest("hex");
51292
51292
  };
51293
51293
 
51294
- // ../node_modules/.pnpm/@kevisual+router@0.0.83/node_modules/@kevisual/router/dist/router.js
51294
+ // ../node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/dist/router.js
51295
51295
  import { createRequire as createRequire3 } from "node:module";
51296
51296
  import { webcrypto as crypto3 } from "node:crypto";
51297
51297
  import http from "node:http";
@@ -68195,6 +68195,7 @@ class QueryRouter {
68195
68195
  const maxNextRoute = this.maxNextRoute;
68196
68196
  ctx = ctx || {};
68197
68197
  ctx.currentPath = path7;
68198
+ ctx.currentId = route?.id;
68198
68199
  ctx.currentKey = key;
68199
68200
  ctx.currentRoute = route;
68200
68201
  ctx.index = (ctx.index || 0) + 1;
@@ -68208,7 +68209,7 @@ class QueryRouter {
68208
68209
  ctx.code = 500;
68209
68210
  ctx.message = "Too many nextRoute";
68210
68211
  ctx.body = null;
68211
- return;
68212
+ return ctx;
68212
68213
  }
68213
68214
  if (route && route.middleware && route.middleware.length > 0) {
68214
68215
  const errorMiddleware = [];
@@ -68283,7 +68284,9 @@ class QueryRouter {
68283
68284
  }
68284
68285
  return ctx;
68285
68286
  }
68286
- if (ctx.end) {}
68287
+ if (ctx.end) {
68288
+ return ctx;
68289
+ }
68287
68290
  }
68288
68291
  }
68289
68292
  }
@@ -68477,7 +68480,7 @@ class QueryRouter {
68477
68480
  description: "列出当前应用下的所有的路由信息",
68478
68481
  middleware: opts?.middleware || [],
68479
68482
  run: async (ctx) => {
68480
- const tokenUser = ctx.state.tokenUser;
68483
+ const tokenUser = ctx.state;
68481
68484
  let isUser = !!tokenUser;
68482
68485
  const list4 = this.getList(opts?.filter).filter((item) => {
68483
68486
  if (item.id === "auth" || item.id === "auth-can" || item.id === "check-auth-admin" || item.id === "auth-admin") {
@@ -68507,6 +68510,56 @@ class QueryRouter {
68507
68510
  toJSONSchema = toJSONSchema32;
68508
68511
  fromJSONSchema = fromJSONSchema32;
68509
68512
  }
68513
+
68514
+ class QueryRouterServer2 extends QueryRouter {
68515
+ handle;
68516
+ constructor(opts) {
68517
+ super();
68518
+ const initHandle = opts?.initHandle ?? true;
68519
+ if (initHandle || opts?.handleFn) {
68520
+ this.handle = this.getHandle(this, opts?.handleFn, opts?.context);
68521
+ }
68522
+ this.setContext({ needSerialize: false, ...opts?.context });
68523
+ if (opts?.appId) {
68524
+ this.appId = opts.appId;
68525
+ } else {
68526
+ this.appId = randomId2(16);
68527
+ }
68528
+ }
68529
+ setHandle(wrapperFn, ctx) {
68530
+ this.handle = this.getHandle(this, wrapperFn, ctx);
68531
+ }
68532
+ addRoute(route, opts) {
68533
+ this.add(route, opts);
68534
+ }
68535
+ Route = Route;
68536
+ route(...args2) {
68537
+ const [path7, key, opts] = args2;
68538
+ if (typeof path7 === "object") {
68539
+ return new Route(path7.path, path7.key, path7);
68540
+ }
68541
+ if (typeof path7 === "string") {
68542
+ if (opts) {
68543
+ return new Route(path7, key, opts);
68544
+ }
68545
+ if (key && typeof key === "object") {
68546
+ return new Route(path7, key?.key || "", key);
68547
+ }
68548
+ return new Route(path7, key);
68549
+ }
68550
+ return new Route(path7, key, opts);
68551
+ }
68552
+ prompt(description) {
68553
+ return new Route(undefined, undefined, { description });
68554
+ }
68555
+ async run(msg, ctx) {
68556
+ const handle = this.handle;
68557
+ if (handle) {
68558
+ return handle(msg, ctx);
68559
+ }
68560
+ return super.run(msg, ctx);
68561
+ }
68562
+ }
68510
68563
  var isNode2 = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
68511
68564
  var isBrowser3 = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
68512
68565
  var isDeno2 = typeof Deno !== "undefined" && typeof Deno.version === "object" && typeof Deno.version.deno === "string";
@@ -69374,11 +69427,11 @@ class BunServer extends ServerBase {
69374
69427
  }
69375
69428
  }
69376
69429
 
69377
- class App extends QueryRouter {
69430
+ class App extends QueryRouterServer2 {
69378
69431
  router;
69379
69432
  server;
69380
69433
  constructor(opts) {
69381
- super();
69434
+ super({ initHandle: false, context: { needSerialize: true, ...opts?.routerContext } });
69382
69435
  const router = this;
69383
69436
  let server = opts?.server;
69384
69437
  if (!server) {
@@ -69390,7 +69443,6 @@ class App extends QueryRouter {
69390
69443
  }
69391
69444
  }
69392
69445
  server.setHandle(router.getHandle(router, opts?.routerHandle, opts?.routerContext));
69393
- router.setContext({ needSerialize: true, ...opts?.routerContext });
69394
69446
  this.router = router;
69395
69447
  this.server = server;
69396
69448
  if (opts?.appId) {
@@ -69403,42 +69455,7 @@ class App extends QueryRouter {
69403
69455
  listen(...args2) {
69404
69456
  this.server.listen(...args2);
69405
69457
  }
69406
- addRoute(route, opts) {
69407
- super.add(route, opts);
69408
- }
69409
69458
  Route = Route;
69410
- route(...args2) {
69411
- const [path7, key, opts] = args2;
69412
- if (typeof path7 === "object") {
69413
- return new Route(path7.path, path7.key, path7);
69414
- }
69415
- if (typeof path7 === "string") {
69416
- if (opts) {
69417
- return new Route(path7, key, opts);
69418
- }
69419
- if (key && typeof key === "object") {
69420
- return new Route(path7, key?.key || "", key);
69421
- }
69422
- return new Route(path7, key);
69423
- }
69424
- return new Route(path7, key, opts);
69425
- }
69426
- prompt(...args2) {
69427
- const [desc] = args2;
69428
- let description = "";
69429
- if (typeof desc === "string") {
69430
- description = desc;
69431
- } else if (typeof desc === "function") {
69432
- description = desc() || "";
69433
- }
69434
- return new Route("", "", { description });
69435
- }
69436
- async call(message, ctx) {
69437
- return await super.call(message, ctx);
69438
- }
69439
- async run(msg, ctx) {
69440
- return await super.run(msg, ctx);
69441
- }
69442
69459
  static handleRequest(req, res) {
69443
69460
  return handleServer(req, res);
69444
69461
  }
@@ -69453,7 +69470,7 @@ class App extends QueryRouter {
69453
69470
  }
69454
69471
  }
69455
69472
 
69456
- // ../node_modules/.pnpm/@kevisual+router@0.0.83/node_modules/@kevisual/router/dist/router-simple.js
69473
+ // ../node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/dist/router-simple.js
69457
69474
  import url5 from "node:url";
69458
69475
  var __create5 = Object.create;
69459
69476
  var __getProtoOf5 = Object.getPrototypeOf;
@@ -71237,7 +71254,7 @@ ${line}`;
71237
71254
  }
71238
71255
  }
71239
71256
 
71240
- // ../node_modules/.pnpm/@kevisual+api@0.0.58_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
71257
+ // ../node_modules/.pnpm/@kevisual+api@0.0.59_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
71241
71258
  import { homedir as homedir2 } from "node:os";
71242
71259
  import { join, dirname } from "node:path";
71243
71260
  import fs12 from "node:fs";
@@ -72250,18 +72267,26 @@ class QueryLogin extends BaseQuery {
72250
72267
  message: "登录失败"
72251
72268
  };
72252
72269
  }
72253
- async refreshLoginUser(refreshToken) {
72254
- const res = await this.queryRefreshToken(refreshToken);
72270
+ async refreshLoginUser(opts) {
72271
+ const res = await this.queryRefreshToken(opts);
72255
72272
  if (res.code === 200) {
72256
- const { accessToken, refreshToken: refreshToken2, accessTokenExpiresIn } = res?.data || {};
72273
+ const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
72257
72274
  this.storage.setItem("token", accessToken || "");
72258
- await this.beforeSetLoginUser({ accessToken, refreshToken: refreshToken2, accessTokenExpiresIn, check401: false });
72275
+ await this.beforeSetLoginUser({ accessToken, refreshToken, accessTokenExpiresIn, check401: false });
72259
72276
  }
72260
72277
  return res;
72261
72278
  }
72262
- async queryRefreshToken(refreshToken) {
72279
+ async queryRefreshToken(opts) {
72280
+ const refreshToken = opts?.refreshToken;
72281
+ let accessToken = opts?.accessToken;
72263
72282
  const _refreshToken = refreshToken || await this.cacheStore.getRefreshToken();
72264
- let data = { refreshToken: _refreshToken };
72283
+ let data = {};
72284
+ if (accessToken) {
72285
+ data.accessToken = accessToken;
72286
+ }
72287
+ if (_refreshToken) {
72288
+ data.refreshToken = _refreshToken;
72289
+ }
72265
72290
  if (!_refreshToken) {
72266
72291
  await this.cacheStore.clearCurrentUser();
72267
72292
  return {
@@ -72281,7 +72306,7 @@ class QueryLogin extends BaseQuery {
72281
72306
  if (response?.code === 401) {
72282
72307
  const hasRefreshToken = await that.cacheStore.getRefreshToken();
72283
72308
  if (hasRefreshToken) {
72284
- const res = await that.queryRefreshToken(hasRefreshToken);
72309
+ const res = await that.queryRefreshToken({ refreshToken: hasRefreshToken });
72285
72310
  if (res.code === 200) {
72286
72311
  const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
72287
72312
  that.storage.setItem("token", accessToken || "");
@@ -72699,11 +72724,6 @@ class AssistantQuery {
72699
72724
  }
72700
72725
  async getToken() {
72701
72726
  const token = await this.queryLogin.getToken();
72702
- if (!token)
72703
- return "";
72704
- const isExpired = await this.queryLogin.checkTokenValid();
72705
- console.log("Token 是否过期", isExpired, token);
72706
- console.log("info", this.queryLogin.cacheStore.cacheData);
72707
72727
  return token;
72708
72728
  }
72709
72729
  }
@@ -72757,14 +72777,18 @@ app.createRouteList();
72757
72777
 
72758
72778
  // src/module/light-code/index.ts
72759
72779
  var initLightCode = async (opts) => {
72760
- console.log("初始化 light-code 路由");
72780
+ const token = await assistantQuery.getToken();
72781
+ if (!token) {
72782
+ logger.error("[light-code] 当前未登录,无法初始化 light-code");
72783
+ return;
72784
+ }
72761
72785
  const config4 = opts.config;
72762
72786
  const app2 = opts.router;
72763
- const token = await assistantQuery.getToken();
72787
+ logger.log("[light-code] 初始化 light-code 路由");
72764
72788
  const query = config4.query;
72765
72789
  const sync2 = opts.sync ?? "remote";
72766
72790
  if (!config4 || !app2) {
72767
- console.error("[light-code] initLightCode 缺少必要参数, config 或 app");
72791
+ logger.error("[light-code] initLightCode 缺少必要参数, config 或 app");
72768
72792
  return;
72769
72793
  }
72770
72794
  const lightcodeDir = opts.rootPath;
@@ -87113,6 +87137,23 @@ class AssistantApp extends Manager2 {
87113
87137
  this.config = config5;
87114
87138
  this.resolver = new ModuleResolver(config5.configPath.configDir);
87115
87139
  }
87140
+ async init(opts) {
87141
+ const manager = this;
87142
+ await manager.load({ runtime: "client" });
87143
+ console.log("Assistant App Loaded");
87144
+ await manager.checkLocalUser();
87145
+ const token = await assistantQuery.getToken();
87146
+ if (token) {
87147
+ console.log("用户已登录,正在初始化远程应用连接...");
87148
+ await manager.initRemoteApp({ token });
87149
+ await manager.initRemoteApp();
87150
+ await manager.initRouterProxyLightApp();
87151
+ }
87152
+ await manager.initRouterProxyApp();
87153
+ if (opts?.isServer) {
87154
+ await manager.initRoutes();
87155
+ }
87156
+ }
87116
87157
  async pageList() {
87117
87158
  const pages = await import_fast_glob3.default(["*/*/package.json"], {
87118
87159
  cwd: this.pagesPath,
@@ -87168,7 +87209,11 @@ class AssistantApp extends Manager2 {
87168
87209
  }
87169
87210
  let token = opts?.token;
87170
87211
  if (!token) {
87171
- token = await assistantQuery.queryLogin.getToken();
87212
+ token = await assistantQuery.getToken();
87213
+ }
87214
+ if (!token) {
87215
+ logger.error("[remote-app] cli当前未登录,无法连接远程app");
87216
+ return;
87172
87217
  }
87173
87218
  let shareUrl = share?.url;
87174
87219
  if (!shareUrl) {
@@ -87218,11 +87263,10 @@ class AssistantApp extends Manager2 {
87218
87263
  }
87219
87264
  }
87220
87265
  }
87221
- async initRouterApp() {
87266
+ async initRouterProxyApp() {
87222
87267
  const config5 = this.config.getConfig();
87223
- const routerProxy = config5?.router?.proxy || [];
87268
+ let routerProxy = config5?.router?.proxy || [];
87224
87269
  const base = config5.router?.base ?? false;
87225
- const lightcode = config5.router?.lightcode ?? true;
87226
87270
  if (base) {
87227
87271
  routerProxy.push({
87228
87272
  type: "router",
@@ -87231,41 +87275,13 @@ class AssistantApp extends Manager2 {
87231
87275
  }
87232
87276
  });
87233
87277
  }
87234
- if (lightcode) {
87235
- routerProxy.push({
87236
- type: "lightcode",
87237
- lightcode: {
87238
- id: "main",
87239
- sync: "remote",
87240
- rootPath: path12.join(this.config.configPath.appsDir, "light-code", "code")
87241
- }
87242
- });
87243
- }
87278
+ routerProxy = routerProxy.filter((item) => item.type === "router");
87244
87279
  if (routerProxy.length === 0) {
87245
87280
  return;
87246
87281
  }
87247
87282
  for (const proxyInfo of routerProxy) {
87248
- if (proxyInfo.type !== "router" && proxyInfo.type !== "lightcode") {
87249
- console.warn('路由的type必须是"router", 或者lightcode');
87250
- continue;
87251
- }
87252
- if (proxyInfo.type === "lightcode") {
87253
- const schema = zod_default.object({
87254
- rootPath: zod_default.string().describe("light-code 代码存放路径"),
87255
- sync: zod_default.enum(["remote", "local", "both"]).describe("同步方式,remote: 仅从远程拉取,local: 仅上传本地代码,both: 双向同步").default("remote")
87256
- });
87257
- const parseRes = schema.safeParse(proxyInfo.lightcode);
87258
- if (!parseRes.success) {
87259
- console.warn("lightcode 配置错误", parseRes.error);
87260
- continue;
87261
- }
87262
- const lightcodeConfig = parseRes.data;
87263
- initLightCode({
87264
- router: this.mainApp,
87265
- config: this.config,
87266
- sync: lightcodeConfig.sync,
87267
- rootPath: lightcodeConfig.rootPath
87268
- });
87283
+ if (proxyInfo.type !== "router") {
87284
+ console.warn('路由的type必须是"router"');
87269
87285
  continue;
87270
87286
  }
87271
87287
  const url4 = proxyInfo.router.url;
@@ -87292,6 +87308,47 @@ class AssistantApp extends Manager2 {
87292
87308
  }
87293
87309
  }
87294
87310
  }
87311
+ async initRouterProxyLightApp() {
87312
+ const config5 = this.config.getConfig();
87313
+ let routerProxy = config5?.router?.proxy || [];
87314
+ const lightcode = config5.router?.lightcode ?? true;
87315
+ if (lightcode) {
87316
+ routerProxy.push({
87317
+ type: "lightcode",
87318
+ lightcode: {
87319
+ id: "main",
87320
+ sync: "remote",
87321
+ rootPath: path12.join(this.config.configPath.appsDir, "light-code", "code")
87322
+ }
87323
+ });
87324
+ }
87325
+ routerProxy = routerProxy.filter((item) => item.type === "lightcode");
87326
+ if (routerProxy.length === 0) {
87327
+ return;
87328
+ }
87329
+ for (const proxyInfo of routerProxy) {
87330
+ if (proxyInfo.type !== "lightcode") {
87331
+ console.warn('路由的type必须是"lightcode"');
87332
+ continue;
87333
+ }
87334
+ const schema = zod_default.object({
87335
+ rootPath: zod_default.string().describe("light-code 代码存放路径"),
87336
+ sync: zod_default.enum(["remote", "local", "both"]).describe("同步方式,remote: 仅从远程拉取,local: 仅上传本地代码,both: 双向同步").default("remote")
87337
+ });
87338
+ const parseRes = schema.safeParse(proxyInfo.lightcode);
87339
+ if (!parseRes.success) {
87340
+ console.warn("lightcode 配置错误", parseRes.error);
87341
+ continue;
87342
+ }
87343
+ const lightcodeConfig = parseRes.data;
87344
+ await initLightCode({
87345
+ router: this.mainApp,
87346
+ config: this.config,
87347
+ sync: lightcodeConfig.sync,
87348
+ rootPath: lightcodeConfig.rootPath
87349
+ });
87350
+ }
87351
+ }
87295
87352
  async initRoutes() {
87296
87353
  const routes = this.config.getConfig().routes || [];
87297
87354
  for (const route of routes) {
@@ -87312,32 +87369,51 @@ class AssistantApp extends Manager2 {
87312
87369
  var checkLocalUser = async (opts) => {
87313
87370
  const { assistantApp } = opts;
87314
87371
  const config5 = assistantApp.config.getConfig();
87315
- const auth = config5?.auth;
87316
- let checkCNB = false;
87317
- if (!auth?.username) {
87318
- checkCNB = true;
87319
- } else {
87320
- let temp = await assistantQuery.getToken();
87321
- logger.info("[assistant] 当前登录用户", auth.username, "token有效性检查结果", !!temp);
87372
+ const auth = config5?.auth || {};
87373
+ const isLogin = await assistantQuery.queryLogin.getToken();
87374
+ logger.log("[assistant] 正在检查本地用户登录状态...", "user", auth.username, "是否已登录", !!isLogin);
87375
+ const saveAuth = (auth2, opts2) => {
87376
+ auth2.username = auth2.username ?? opts2.username;
87377
+ auth2.share = auth2.share ?? opts2.share;
87378
+ const app2 = config5?.app || {};
87379
+ if (!app2?.id) {
87380
+ app2.id = opts2.appId || "dev-cnb";
87381
+ }
87382
+ assistantApp.config.setConfig({
87383
+ auth: auth2,
87384
+ app: app2
87385
+ });
87386
+ };
87387
+ if (!auth?.username && isLogin) {
87388
+ const userInfo = await assistantQuery.queryLogin.checkLocalUser();
87389
+ saveAuth(auth, { username: userInfo.username, share: "protected" });
87390
+ return;
87322
87391
  }
87323
- const cnbToken = useKey2("CNB_TOKEN");
87324
- if (!checkCNB && cnbToken) {
87392
+ if (isLogin)
87393
+ return;
87394
+ const cnbToken = useKey2("CNB_API_KEY");
87395
+ if (cnbToken) {
87396
+ logger.info("[cnb]检测到 CNB_API_KEY,正在尝试使用 CNB_API_KEY 登录...");
87325
87397
  const res = await assistantQuery.queryLogin.loginByCnb({ cnbToken });
87326
87398
  if (res.code === 200) {
87327
- logger.info("CNB登录成功,用户信息已更新");
87328
87399
  const userInfo = await assistantQuery.queryLogin.checkLocalUser();
87329
- auth.username = userInfo.username;
87330
- auth.share = "protected";
87331
- const app2 = config5?.app || {};
87332
- if (!app2?.id) {
87333
- app2.id = "dev-cnb";
87334
- }
87335
- assistantApp.config.setConfig({
87336
- auth,
87337
- app: app2
87338
- });
87400
+ if (!userInfo.username) {
87401
+ saveAuth(auth, { username: userInfo.username, share: "protected" });
87402
+ }
87403
+ return;
87339
87404
  } else {
87340
- console.error("CNB登录失败,无法获取用户信息", res);
87405
+ logger.error("CNB登录失败,无法获取用户信息", res);
87406
+ }
87407
+ }
87408
+ const accessToken = useKey2("KEVISUAL_TOKEN");
87409
+ if (accessToken) {
87410
+ logger.info("[cnb]检测到 KEVISUAL_TOKEN,正在尝试使用 KEVISUAL_TOKEN 登录...");
87411
+ const res = await assistantQuery.queryLogin.refreshLoginUser({ accessToken, refreshToken: "" });
87412
+ if (res.code === 200) {
87413
+ if (!auth.username) {
87414
+ const userInfo = await assistantQuery.queryLogin.checkLocalUser();
87415
+ saveAuth(auth, { username: userInfo.username, share: "protected" });
87416
+ }
87341
87417
  }
87342
87418
  }
87343
87419
  };
@@ -87371,10 +87447,10 @@ var runProgram = (args2) => {
87371
87447
  import path13 from "node:path";
87372
87448
  import fs17 from "node:fs";
87373
87449
 
87374
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/key.js
87450
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/key.js
87375
87451
  var isTabKey = (key) => key.name === "tab";
87376
87452
  var isEnterKey = (key) => key.name === "enter" || key.name === "return";
87377
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/errors.js
87453
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/errors.js
87378
87454
  class AbortPromptError extends Error {
87379
87455
  name = "AbortPromptError";
87380
87456
  message = "Prompt was aborted";
@@ -87400,10 +87476,10 @@ class HookError extends Error {
87400
87476
  class ValidationError extends Error {
87401
87477
  name = "ValidationError";
87402
87478
  }
87403
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
87479
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
87404
87480
  import { AsyncResource as AsyncResource2 } from "node:async_hooks";
87405
87481
 
87406
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
87482
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
87407
87483
  import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
87408
87484
  var hookStorage = new AsyncLocalStorage;
87409
87485
  function createStore(rl) {
@@ -87508,7 +87584,7 @@ var effectScheduler = {
87508
87584
  }
87509
87585
  };
87510
87586
 
87511
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
87587
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
87512
87588
  function useState(defaultValue) {
87513
87589
  return withPointer((pointer) => {
87514
87590
  const setState = AsyncResource2.bind(function setState2(newValue) {
@@ -87526,7 +87602,7 @@ function useState(defaultValue) {
87526
87602
  });
87527
87603
  }
87528
87604
 
87529
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-effect.js
87605
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-effect.js
87530
87606
  function useEffect(cb, depArray) {
87531
87607
  withPointer((pointer) => {
87532
87608
  const oldDeps = pointer.get();
@@ -87538,7 +87614,7 @@ function useEffect(cb, depArray) {
87538
87614
  });
87539
87615
  }
87540
87616
 
87541
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
87617
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
87542
87618
  import { styleText } from "node:util";
87543
87619
 
87544
87620
  // ../node_modules/.pnpm/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
@@ -87830,7 +87906,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
87830
87906
  var dist_default = figures;
87831
87907
  var replacements = Object.entries(specialMainSymbols);
87832
87908
 
87833
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
87909
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
87834
87910
  var defaultTheme = {
87835
87911
  prefix: {
87836
87912
  idle: styleText("blue", "?"),
@@ -87851,7 +87927,7 @@ var defaultTheme = {
87851
87927
  }
87852
87928
  };
87853
87929
 
87854
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/make-theme.js
87930
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/make-theme.js
87855
87931
  function isPlainObject5(value) {
87856
87932
  if (typeof value !== "object" || value === null)
87857
87933
  return false;
@@ -87879,7 +87955,7 @@ function makeTheme(...themes) {
87879
87955
  return deepMerge(...themesToMerge);
87880
87956
  }
87881
87957
 
87882
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-prefix.js
87958
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-prefix.js
87883
87959
  function usePrefix({ status = "idle", theme }) {
87884
87960
  const [showLoader, setShowLoader] = useState(false);
87885
87961
  const [tick, setTick] = useState(0);
@@ -87909,12 +87985,12 @@ function usePrefix({ status = "idle", theme }) {
87909
87985
  const iconName = status === "loading" ? "idle" : status;
87910
87986
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
87911
87987
  }
87912
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-ref.js
87988
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-ref.js
87913
87989
  function useRef(val) {
87914
87990
  return useState({ current: val })[0];
87915
87991
  }
87916
87992
 
87917
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
87993
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
87918
87994
  function useKeypress(userHandler) {
87919
87995
  const signal = useRef(userHandler);
87920
87996
  signal.current = userHandler;
@@ -87932,7 +88008,7 @@ function useKeypress(userHandler) {
87932
88008
  };
87933
88009
  }, []);
87934
88010
  }
87935
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
88011
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
87936
88012
  var import_cli_width = __toESM(require_cli_width(), 1);
87937
88013
 
87938
88014
  // ../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
@@ -88276,7 +88352,7 @@ function wrapAnsi(string5, columns, options) {
88276
88352
  `);
88277
88353
  }
88278
88354
 
88279
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
88355
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
88280
88356
  function breakLines(content, width) {
88281
88357
  return content.split(`
88282
88358
  `).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
@@ -88287,7 +88363,7 @@ function readlineWidth() {
88287
88363
  return import_cli_width.default({ defaultWidth: 80, output: readline().output });
88288
88364
  }
88289
88365
 
88290
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88366
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88291
88367
  var import_mute_stream = __toESM(require_lib(), 1);
88292
88368
  import * as readline2 from "node:readline";
88293
88369
  import { AsyncResource as AsyncResource3 } from "node:async_hooks";
@@ -88500,7 +88576,7 @@ var {
88500
88576
  unload
88501
88577
  } = signalExitWrap(processOk(process8) ? new SignalExit(process8) : new SignalExitFallback);
88502
88578
 
88503
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88579
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88504
88580
  import { stripVTControlCharacters } from "node:util";
88505
88581
 
88506
88582
  // ../node_modules/.pnpm/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
@@ -88519,7 +88595,7 @@ var cursorTo = (x, y) => {
88519
88595
  var eraseLine = ESC2 + "2K";
88520
88596
  var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
88521
88597
 
88522
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88598
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88523
88599
  var height = (content) => content.split(`
88524
88600
  `).length;
88525
88601
  var lastLine = (content) => content.split(`
@@ -88584,7 +88660,7 @@ class ScreenManager {
88584
88660
  }
88585
88661
  }
88586
88662
 
88587
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
88663
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
88588
88664
  class PromisePolyfill extends Promise {
88589
88665
  static withResolver() {
88590
88666
  let resolve;
@@ -88597,7 +88673,8 @@ class PromisePolyfill extends Promise {
88597
88673
  }
88598
88674
  }
88599
88675
 
88600
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88676
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88677
+ var nativeSetImmediate = globalThis.setImmediate;
88601
88678
  function getCallSites() {
88602
88679
  const _prepareStackTrace = Error.prepareStackTrace;
88603
88680
  let result = [];
@@ -88621,6 +88698,7 @@ function createPrompt(view) {
88621
88698
  const cleanups = new Set;
88622
88699
  const output = new import_mute_stream.default;
88623
88700
  output.pipe(context.output ?? process.stdout);
88701
+ output.mute();
88624
88702
  const rl = readline2.createInterface({
88625
88703
  terminal: true,
88626
88704
  input,
@@ -88644,30 +88722,37 @@ function createPrompt(view) {
88644
88722
  const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
88645
88723
  rl.on("SIGINT", sigint);
88646
88724
  cleanups.add(() => rl.removeListener("SIGINT", sigint));
88647
- const checkCursorPos = () => screen.checkCursorPos();
88648
- rl.input.on("keypress", checkCursorPos);
88649
- cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
88650
88725
  return withHooks(rl, (cycle) => {
88651
88726
  const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
88652
88727
  rl.on("close", hooksCleanup);
88653
88728
  cleanups.add(() => rl.removeListener("close", hooksCleanup));
88654
- cycle(() => {
88655
- try {
88656
- const nextView = view(config6, (value) => {
88657
- setImmediate(() => resolve(value));
88658
- });
88659
- if (nextView === undefined) {
88660
- const callerFilename = callSites[1]?.getFileName();
88661
- throw new Error(`Prompt functions must return a string.
88729
+ const startCycle = () => {
88730
+ const checkCursorPos = () => screen.checkCursorPos();
88731
+ rl.input.on("keypress", checkCursorPos);
88732
+ cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
88733
+ cycle(() => {
88734
+ try {
88735
+ const nextView = view(config6, (value) => {
88736
+ setImmediate(() => resolve(value));
88737
+ });
88738
+ if (nextView === undefined) {
88739
+ const callerFilename = callSites[1]?.getFileName();
88740
+ throw new Error(`Prompt functions must return a string.
88662
88741
  at ${callerFilename}`);
88742
+ }
88743
+ const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
88744
+ screen.render(content, bottomContent);
88745
+ effectScheduler.run();
88746
+ } catch (error54) {
88747
+ reject(error54);
88663
88748
  }
88664
- const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
88665
- screen.render(content, bottomContent);
88666
- effectScheduler.run();
88667
- } catch (error54) {
88668
- reject(error54);
88669
- }
88670
- });
88749
+ });
88750
+ };
88751
+ if ("readableFlowing" in input) {
88752
+ nativeSetImmediate(startCycle);
88753
+ } else {
88754
+ startCycle();
88755
+ }
88671
88756
  return Object.assign(promise4.then((answer) => {
88672
88757
  effectScheduler.clearAll();
88673
88758
  return answer;
@@ -88683,7 +88768,7 @@ function createPrompt(view) {
88683
88768
  };
88684
88769
  return prompt;
88685
88770
  }
88686
- // ../node_modules/.pnpm/@inquirer+confirm@6.0.6_@types+node@25.3.0/node_modules/@inquirer/confirm/dist/index.js
88771
+ // ../node_modules/.pnpm/@inquirer+confirm@6.0.8_@types+node@25.3.0/node_modules/@inquirer/confirm/dist/index.js
88687
88772
  function getBooleanValue(value, defaultValue) {
88688
88773
  let answer = defaultValue !== false;
88689
88774
  if (/^(y|yes)/i.test(value))