@kevisual/cli 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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
  };
@@ -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.57_@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;
@@ -71237,7 +71237,7 @@ ${line}`;
71237
71237
  }
71238
71238
  }
71239
71239
 
71240
- // ../node_modules/.pnpm/@kevisual+api@0.0.57_@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
71240
+ // ../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
71241
  import { homedir as homedir2 } from "node:os";
71242
71242
  import { join, dirname } from "node:path";
71243
71243
  import fs12 from "node:fs";
@@ -72196,6 +72196,21 @@ class QueryLogin extends BaseQuery {
72196
72196
  }
72197
72197
  return res;
72198
72198
  }
72199
+ async loginByCnb(data) {
72200
+ const res = await this.post({
72201
+ path: "user",
72202
+ key: "cnb-login",
72203
+ payload: {
72204
+ data
72205
+ }
72206
+ });
72207
+ if (res.code === 200) {
72208
+ const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
72209
+ this.storage.setItem("token", accessToken || "");
72210
+ await this.beforeSetLoginUser({ accessToken, refreshToken, accessTokenExpiresIn });
72211
+ }
72212
+ return res;
72213
+ }
72199
72214
  async checkWechat({ onSuccess, onError }) {
72200
72215
  const url4 = new URL(window.location.href);
72201
72216
  const code = url4.searchParams.get("code");
@@ -72235,9 +72250,26 @@ class QueryLogin extends BaseQuery {
72235
72250
  message: "登录失败"
72236
72251
  };
72237
72252
  }
72238
- async queryRefreshToken(refreshToken) {
72239
- const _refreshToken = refreshToken || this.cacheStore.getRefreshToken();
72240
- let data = { refreshToken: _refreshToken };
72253
+ async refreshLoginUser(opts) {
72254
+ const res = await this.queryRefreshToken(opts);
72255
+ if (res.code === 200) {
72256
+ const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
72257
+ this.storage.setItem("token", accessToken || "");
72258
+ await this.beforeSetLoginUser({ accessToken, refreshToken, accessTokenExpiresIn, check401: false });
72259
+ }
72260
+ return res;
72261
+ }
72262
+ async queryRefreshToken(opts) {
72263
+ const refreshToken = opts?.refreshToken;
72264
+ let accessToken = opts?.accessToken;
72265
+ const _refreshToken = refreshToken || await this.cacheStore.getRefreshToken();
72266
+ let data = {};
72267
+ if (accessToken) {
72268
+ data.accessToken = accessToken;
72269
+ }
72270
+ if (_refreshToken) {
72271
+ data.refreshToken = _refreshToken;
72272
+ }
72241
72273
  if (!_refreshToken) {
72242
72274
  await this.cacheStore.clearCurrentUser();
72243
72275
  return {
@@ -72257,7 +72289,7 @@ class QueryLogin extends BaseQuery {
72257
72289
  if (response?.code === 401) {
72258
72290
  const hasRefreshToken = await that.cacheStore.getRefreshToken();
72259
72291
  if (hasRefreshToken) {
72260
- const res = await that.queryRefreshToken(hasRefreshToken);
72292
+ const res = await that.queryRefreshToken({ refreshToken: hasRefreshToken });
72261
72293
  if (res.code === 200) {
72262
72294
  const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
72263
72295
  that.storage.setItem("token", accessToken || "");
@@ -72335,7 +72367,19 @@ class QueryLogin extends BaseQuery {
72335
72367
  return !!token;
72336
72368
  }
72337
72369
  async checkTokenValid() {
72338
- return this.cacheStore.getIsExpired();
72370
+ const token = this.storage.getItem("token");
72371
+ if (!token) {
72372
+ return null;
72373
+ }
72374
+ const isExpired = await this.cacheStore.getIsExpired();
72375
+ if (isExpired) {
72376
+ const res = await this.refreshLoginUser();
72377
+ if (res.code === 200) {
72378
+ return res.data?.accessToken || null;
72379
+ }
72380
+ return null;
72381
+ }
72382
+ return token;
72339
72383
  }
72340
72384
  async getToken() {
72341
72385
  const token = this.storage.getItem("token");
@@ -72661,8 +72705,9 @@ class AssistantQuery {
72661
72705
  get(body, options) {
72662
72706
  return this.query.get(body, options);
72663
72707
  }
72664
- getToken() {
72665
- return this.queryLogin.getToken();
72708
+ async getToken() {
72709
+ const token = await this.queryLogin.getToken();
72710
+ return token;
72666
72711
  }
72667
72712
  }
72668
72713
 
@@ -72715,14 +72760,18 @@ app.createRouteList();
72715
72760
 
72716
72761
  // src/module/light-code/index.ts
72717
72762
  var initLightCode = async (opts) => {
72718
- console.log("初始化 light-code 路由");
72763
+ const token = await assistantQuery.getToken();
72764
+ if (!token) {
72765
+ logger.error("[light-code] 当前未登录,无法初始化 light-code");
72766
+ return;
72767
+ }
72719
72768
  const config4 = opts.config;
72720
72769
  const app2 = opts.router;
72721
- const token = await assistantQuery.getToken();
72770
+ logger.log("[light-code] 初始化 light-code 路由");
72722
72771
  const query = config4.query;
72723
72772
  const sync2 = opts.sync ?? "remote";
72724
72773
  if (!config4 || !app2) {
72725
- console.error("[light-code] initLightCode 缺少必要参数, config 或 app");
72774
+ logger.error("[light-code] initLightCode 缺少必要参数, config 或 app");
72726
72775
  return;
72727
72776
  }
72728
72777
  const lightcodeDir = opts.rootPath;
@@ -87071,6 +87120,23 @@ class AssistantApp extends Manager2 {
87071
87120
  this.config = config5;
87072
87121
  this.resolver = new ModuleResolver(config5.configPath.configDir);
87073
87122
  }
87123
+ async init(opts) {
87124
+ const manager = this;
87125
+ await manager.load({ runtime: "client" });
87126
+ console.log("Assistant App Loaded");
87127
+ await manager.checkLocalUser();
87128
+ const token = await assistantQuery.getToken();
87129
+ if (token) {
87130
+ console.log("用户已登录,正在初始化远程应用连接...");
87131
+ await manager.initRemoteApp({ token });
87132
+ await manager.initRemoteApp();
87133
+ await manager.initRouterProxyLightApp();
87134
+ }
87135
+ await manager.initRouterProxyApp();
87136
+ if (opts?.isServer) {
87137
+ await manager.initRoutes();
87138
+ }
87139
+ }
87074
87140
  async pageList() {
87075
87141
  const pages = await import_fast_glob3.default(["*/*/package.json"], {
87076
87142
  cwd: this.pagesPath,
@@ -87126,7 +87192,11 @@ class AssistantApp extends Manager2 {
87126
87192
  }
87127
87193
  let token = opts?.token;
87128
87194
  if (!token) {
87129
- token = await assistantQuery.queryLogin.getToken();
87195
+ token = await assistantQuery.getToken();
87196
+ }
87197
+ if (!token) {
87198
+ logger.error("[remote-app] cli当前未登录,无法连接远程app");
87199
+ return;
87130
87200
  }
87131
87201
  let shareUrl = share?.url;
87132
87202
  if (!shareUrl) {
@@ -87176,11 +87246,10 @@ class AssistantApp extends Manager2 {
87176
87246
  }
87177
87247
  }
87178
87248
  }
87179
- async initRouterApp() {
87249
+ async initRouterProxyApp() {
87180
87250
  const config5 = this.config.getConfig();
87181
- const routerProxy = config5?.router?.proxy || [];
87251
+ let routerProxy = config5?.router?.proxy || [];
87182
87252
  const base = config5.router?.base ?? false;
87183
- const lightcode = config5.router?.lightcode ?? true;
87184
87253
  if (base) {
87185
87254
  routerProxy.push({
87186
87255
  type: "router",
@@ -87189,41 +87258,13 @@ class AssistantApp extends Manager2 {
87189
87258
  }
87190
87259
  });
87191
87260
  }
87192
- if (lightcode) {
87193
- routerProxy.push({
87194
- type: "lightcode",
87195
- lightcode: {
87196
- id: "main",
87197
- sync: "remote",
87198
- rootPath: path12.join(this.config.configPath.appsDir, "light-code", "code")
87199
- }
87200
- });
87201
- }
87261
+ routerProxy = routerProxy.filter((item) => item.type === "router");
87202
87262
  if (routerProxy.length === 0) {
87203
87263
  return;
87204
87264
  }
87205
87265
  for (const proxyInfo of routerProxy) {
87206
- if (proxyInfo.type !== "router" && proxyInfo.type !== "lightcode") {
87207
- console.warn('路由的type必须是"router", 或者lightcode');
87208
- continue;
87209
- }
87210
- if (proxyInfo.type === "lightcode") {
87211
- const schema = zod_default.object({
87212
- rootPath: zod_default.string().describe("light-code 代码存放路径"),
87213
- sync: zod_default.enum(["remote", "local", "both"]).describe("同步方式,remote: 仅从远程拉取,local: 仅上传本地代码,both: 双向同步").default("remote")
87214
- });
87215
- const parseRes = schema.safeParse(proxyInfo.lightcode);
87216
- if (!parseRes.success) {
87217
- console.warn("lightcode 配置错误", parseRes.error);
87218
- continue;
87219
- }
87220
- const lightcodeConfig = parseRes.data;
87221
- initLightCode({
87222
- router: this.mainApp,
87223
- config: this.config,
87224
- sync: lightcodeConfig.sync,
87225
- rootPath: lightcodeConfig.rootPath
87226
- });
87266
+ if (proxyInfo.type !== "router") {
87267
+ console.warn('路由的type必须是"router"');
87227
87268
  continue;
87228
87269
  }
87229
87270
  const url4 = proxyInfo.router.url;
@@ -87250,6 +87291,47 @@ class AssistantApp extends Manager2 {
87250
87291
  }
87251
87292
  }
87252
87293
  }
87294
+ async initRouterProxyLightApp() {
87295
+ const config5 = this.config.getConfig();
87296
+ let routerProxy = config5?.router?.proxy || [];
87297
+ const lightcode = config5.router?.lightcode ?? true;
87298
+ if (lightcode) {
87299
+ routerProxy.push({
87300
+ type: "lightcode",
87301
+ lightcode: {
87302
+ id: "main",
87303
+ sync: "remote",
87304
+ rootPath: path12.join(this.config.configPath.appsDir, "light-code", "code")
87305
+ }
87306
+ });
87307
+ }
87308
+ routerProxy = routerProxy.filter((item) => item.type === "lightcode");
87309
+ if (routerProxy.length === 0) {
87310
+ return;
87311
+ }
87312
+ for (const proxyInfo of routerProxy) {
87313
+ if (proxyInfo.type !== "lightcode") {
87314
+ console.warn('路由的type必须是"lightcode"');
87315
+ continue;
87316
+ }
87317
+ const schema = zod_default.object({
87318
+ rootPath: zod_default.string().describe("light-code 代码存放路径"),
87319
+ sync: zod_default.enum(["remote", "local", "both"]).describe("同步方式,remote: 仅从远程拉取,local: 仅上传本地代码,both: 双向同步").default("remote")
87320
+ });
87321
+ const parseRes = schema.safeParse(proxyInfo.lightcode);
87322
+ if (!parseRes.success) {
87323
+ console.warn("lightcode 配置错误", parseRes.error);
87324
+ continue;
87325
+ }
87326
+ const lightcodeConfig = parseRes.data;
87327
+ await initLightCode({
87328
+ router: this.mainApp,
87329
+ config: this.config,
87330
+ sync: lightcodeConfig.sync,
87331
+ rootPath: lightcodeConfig.rootPath
87332
+ });
87333
+ }
87334
+ }
87253
87335
  async initRoutes() {
87254
87336
  const routes = this.config.getConfig().routes || [];
87255
87337
  for (const route of routes) {
@@ -87264,52 +87346,60 @@ class AssistantApp extends Manager2 {
87264
87346
  }
87265
87347
  }
87266
87348
  async checkLocalUser() {
87267
- const config5 = this.config.getConfig();
87268
- const auth = config5?.auth;
87269
- let checkCNB = false;
87270
- if (!auth?.username) {
87271
- checkCNB = true;
87349
+ return checkLocalUser({ assistantApp: this });
87350
+ }
87351
+ }
87352
+ var checkLocalUser = async (opts) => {
87353
+ const { assistantApp } = opts;
87354
+ const config5 = assistantApp.config.getConfig();
87355
+ const auth = config5?.auth || {};
87356
+ const isLogin = await assistantQuery.queryLogin.getToken();
87357
+ logger.log("[assistant] 正在检查本地用户登录状态...", "user", auth.username, "是否已登录", !!isLogin);
87358
+ const saveAuth = (auth2, opts2) => {
87359
+ auth2.username = auth2.username ?? opts2.username;
87360
+ auth2.share = auth2.share ?? opts2.share;
87361
+ const app2 = config5?.app || {};
87362
+ if (!app2?.id) {
87363
+ app2.id = opts2.appId || "dev-cnb";
87364
+ }
87365
+ assistantApp.config.setConfig({
87366
+ auth: auth2,
87367
+ app: app2
87368
+ });
87369
+ };
87370
+ if (!auth?.username && isLogin) {
87371
+ const userInfo = await assistantQuery.queryLogin.checkLocalUser();
87372
+ saveAuth(auth, { username: userInfo.username, share: "protected" });
87373
+ return;
87374
+ }
87375
+ if (isLogin)
87376
+ return;
87377
+ const cnbToken = useKey2("CNB_API_KEY");
87378
+ if (cnbToken) {
87379
+ logger.info("[cnb]检测到 CNB_API_KEY,正在尝试使用 CNB_API_KEY 登录...");
87380
+ const res = await assistantQuery.queryLogin.loginByCnb({ cnbToken });
87381
+ if (res.code === 200) {
87382
+ const userInfo = await assistantQuery.queryLogin.checkLocalUser();
87383
+ if (!userInfo.username) {
87384
+ saveAuth(auth, { username: userInfo.username, share: "protected" });
87385
+ }
87386
+ return;
87272
87387
  } else {
87273
- let temp = await assistantQuery.queryLogin.getToken();
87274
- if (temp) {
87275
- const isExpired = await assistantQuery.queryLogin.checkTokenValid();
87276
- console.log("Token 是否过期", isExpired);
87277
- }
87278
- logger.info("[assistant] 当前登录用户", auth.username, "token有效性检查结果", !!temp);
87279
- }
87280
- const cnbToken = useKey2("CNB_TOKEN");
87281
- if (!checkCNB && cnbToken) {
87282
- const res = await assistantQuery.query.post({
87283
- path: "user",
87284
- key: "cnb-login",
87285
- payload: {
87286
- data: {
87287
- cnbToken
87288
- }
87289
- }
87290
- });
87291
- if (res.code === 200) {
87292
- logger.info("CNB登录成功,用户信息已更新");
87293
- const resUser = await assistantQuery.queryLogin.beforeSetLoginUser(res.data);
87294
- if (resUser.code === 200) {
87295
- const userInfo = resUser.data;
87296
- auth.username = userInfo.username;
87297
- auth.share = "protected";
87298
- const app2 = config5?.app || {};
87299
- if (!app2?.id) {
87300
- app2.id = "dev-cnb";
87301
- }
87302
- this.config.setConfig({
87303
- auth,
87304
- app: app2
87305
- });
87306
- } else {
87307
- console.error("CNB登录失败,无法获取用户信息", resUser);
87308
- }
87388
+ logger.error("CNB登录失败,无法获取用户信息", res);
87389
+ }
87390
+ }
87391
+ const accessToken = useKey2("KEVISUAL_TOKEN");
87392
+ if (accessToken) {
87393
+ logger.info("[cnb]检测到 KEVISUAL_TOKEN,正在尝试使用 KEVISUAL_TOKEN 登录...");
87394
+ const res = await assistantQuery.queryLogin.refreshLoginUser({ accessToken, refreshToken: "" });
87395
+ if (res.code === 200) {
87396
+ if (!auth.username) {
87397
+ const userInfo = await assistantQuery.queryLogin.checkLocalUser();
87398
+ saveAuth(auth, { username: userInfo.username, share: "protected" });
87309
87399
  }
87310
87400
  }
87311
87401
  }
87312
- }
87402
+ };
87313
87403
  // src/config.ts
87314
87404
  var _configDir2 = parseHomeArg(configDir).configDir;
87315
87405
  var configDir3 = AssistantConfig.detectConfigDir(_configDir2);
@@ -87340,10 +87430,10 @@ var runProgram = (args2) => {
87340
87430
  import path13 from "node:path";
87341
87431
  import fs17 from "node:fs";
87342
87432
 
87343
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/key.js
87433
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/key.js
87344
87434
  var isTabKey = (key) => key.name === "tab";
87345
87435
  var isEnterKey = (key) => key.name === "enter" || key.name === "return";
87346
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/errors.js
87436
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/errors.js
87347
87437
  class AbortPromptError extends Error {
87348
87438
  name = "AbortPromptError";
87349
87439
  message = "Prompt was aborted";
@@ -87369,10 +87459,10 @@ class HookError extends Error {
87369
87459
  class ValidationError extends Error {
87370
87460
  name = "ValidationError";
87371
87461
  }
87372
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
87462
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
87373
87463
  import { AsyncResource as AsyncResource2 } from "node:async_hooks";
87374
87464
 
87375
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
87465
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
87376
87466
  import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
87377
87467
  var hookStorage = new AsyncLocalStorage;
87378
87468
  function createStore(rl) {
@@ -87477,7 +87567,7 @@ var effectScheduler = {
87477
87567
  }
87478
87568
  };
87479
87569
 
87480
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
87570
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
87481
87571
  function useState(defaultValue) {
87482
87572
  return withPointer((pointer) => {
87483
87573
  const setState = AsyncResource2.bind(function setState2(newValue) {
@@ -87495,7 +87585,7 @@ function useState(defaultValue) {
87495
87585
  });
87496
87586
  }
87497
87587
 
87498
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-effect.js
87588
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-effect.js
87499
87589
  function useEffect(cb, depArray) {
87500
87590
  withPointer((pointer) => {
87501
87591
  const oldDeps = pointer.get();
@@ -87507,7 +87597,7 @@ function useEffect(cb, depArray) {
87507
87597
  });
87508
87598
  }
87509
87599
 
87510
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
87600
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
87511
87601
  import { styleText } from "node:util";
87512
87602
 
87513
87603
  // ../node_modules/.pnpm/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
@@ -87799,7 +87889,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
87799
87889
  var dist_default = figures;
87800
87890
  var replacements = Object.entries(specialMainSymbols);
87801
87891
 
87802
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
87892
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
87803
87893
  var defaultTheme = {
87804
87894
  prefix: {
87805
87895
  idle: styleText("blue", "?"),
@@ -87820,7 +87910,7 @@ var defaultTheme = {
87820
87910
  }
87821
87911
  };
87822
87912
 
87823
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/make-theme.js
87913
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/make-theme.js
87824
87914
  function isPlainObject5(value) {
87825
87915
  if (typeof value !== "object" || value === null)
87826
87916
  return false;
@@ -87848,7 +87938,7 @@ function makeTheme(...themes) {
87848
87938
  return deepMerge(...themesToMerge);
87849
87939
  }
87850
87940
 
87851
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-prefix.js
87941
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-prefix.js
87852
87942
  function usePrefix({ status = "idle", theme }) {
87853
87943
  const [showLoader, setShowLoader] = useState(false);
87854
87944
  const [tick, setTick] = useState(0);
@@ -87878,12 +87968,12 @@ function usePrefix({ status = "idle", theme }) {
87878
87968
  const iconName = status === "loading" ? "idle" : status;
87879
87969
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
87880
87970
  }
87881
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-ref.js
87971
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-ref.js
87882
87972
  function useRef(val) {
87883
87973
  return useState({ current: val })[0];
87884
87974
  }
87885
87975
 
87886
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
87976
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
87887
87977
  function useKeypress(userHandler) {
87888
87978
  const signal = useRef(userHandler);
87889
87979
  signal.current = userHandler;
@@ -87901,7 +87991,7 @@ function useKeypress(userHandler) {
87901
87991
  };
87902
87992
  }, []);
87903
87993
  }
87904
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
87994
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
87905
87995
  var import_cli_width = __toESM(require_cli_width(), 1);
87906
87996
 
87907
87997
  // ../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
@@ -88245,7 +88335,7 @@ function wrapAnsi(string5, columns, options) {
88245
88335
  `);
88246
88336
  }
88247
88337
 
88248
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
88338
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
88249
88339
  function breakLines(content, width) {
88250
88340
  return content.split(`
88251
88341
  `).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
@@ -88256,7 +88346,7 @@ function readlineWidth() {
88256
88346
  return import_cli_width.default({ defaultWidth: 80, output: readline().output });
88257
88347
  }
88258
88348
 
88259
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88349
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88260
88350
  var import_mute_stream = __toESM(require_lib(), 1);
88261
88351
  import * as readline2 from "node:readline";
88262
88352
  import { AsyncResource as AsyncResource3 } from "node:async_hooks";
@@ -88469,7 +88559,7 @@ var {
88469
88559
  unload
88470
88560
  } = signalExitWrap(processOk(process8) ? new SignalExit(process8) : new SignalExitFallback);
88471
88561
 
88472
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88562
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88473
88563
  import { stripVTControlCharacters } from "node:util";
88474
88564
 
88475
88565
  // ../node_modules/.pnpm/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
@@ -88488,7 +88578,7 @@ var cursorTo = (x, y) => {
88488
88578
  var eraseLine = ESC2 + "2K";
88489
88579
  var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
88490
88580
 
88491
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88581
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
88492
88582
  var height = (content) => content.split(`
88493
88583
  `).length;
88494
88584
  var lastLine = (content) => content.split(`
@@ -88553,7 +88643,7 @@ class ScreenManager {
88553
88643
  }
88554
88644
  }
88555
88645
 
88556
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
88646
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
88557
88647
  class PromisePolyfill extends Promise {
88558
88648
  static withResolver() {
88559
88649
  let resolve;
@@ -88566,7 +88656,8 @@ class PromisePolyfill extends Promise {
88566
88656
  }
88567
88657
  }
88568
88658
 
88569
- // ../node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88659
+ // ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
88660
+ var nativeSetImmediate = globalThis.setImmediate;
88570
88661
  function getCallSites() {
88571
88662
  const _prepareStackTrace = Error.prepareStackTrace;
88572
88663
  let result = [];
@@ -88590,6 +88681,7 @@ function createPrompt(view) {
88590
88681
  const cleanups = new Set;
88591
88682
  const output = new import_mute_stream.default;
88592
88683
  output.pipe(context.output ?? process.stdout);
88684
+ output.mute();
88593
88685
  const rl = readline2.createInterface({
88594
88686
  terminal: true,
88595
88687
  input,
@@ -88613,30 +88705,37 @@ function createPrompt(view) {
88613
88705
  const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
88614
88706
  rl.on("SIGINT", sigint);
88615
88707
  cleanups.add(() => rl.removeListener("SIGINT", sigint));
88616
- const checkCursorPos = () => screen.checkCursorPos();
88617
- rl.input.on("keypress", checkCursorPos);
88618
- cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
88619
88708
  return withHooks(rl, (cycle) => {
88620
88709
  const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
88621
88710
  rl.on("close", hooksCleanup);
88622
88711
  cleanups.add(() => rl.removeListener("close", hooksCleanup));
88623
- cycle(() => {
88624
- try {
88625
- const nextView = view(config6, (value) => {
88626
- setImmediate(() => resolve(value));
88627
- });
88628
- if (nextView === undefined) {
88629
- const callerFilename = callSites[1]?.getFileName();
88630
- throw new Error(`Prompt functions must return a string.
88712
+ const startCycle = () => {
88713
+ const checkCursorPos = () => screen.checkCursorPos();
88714
+ rl.input.on("keypress", checkCursorPos);
88715
+ cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
88716
+ cycle(() => {
88717
+ try {
88718
+ const nextView = view(config6, (value) => {
88719
+ setImmediate(() => resolve(value));
88720
+ });
88721
+ if (nextView === undefined) {
88722
+ const callerFilename = callSites[1]?.getFileName();
88723
+ throw new Error(`Prompt functions must return a string.
88631
88724
  at ${callerFilename}`);
88725
+ }
88726
+ const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
88727
+ screen.render(content, bottomContent);
88728
+ effectScheduler.run();
88729
+ } catch (error54) {
88730
+ reject(error54);
88632
88731
  }
88633
- const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
88634
- screen.render(content, bottomContent);
88635
- effectScheduler.run();
88636
- } catch (error54) {
88637
- reject(error54);
88638
- }
88639
- });
88732
+ });
88733
+ };
88734
+ if ("readableFlowing" in input) {
88735
+ nativeSetImmediate(startCycle);
88736
+ } else {
88737
+ startCycle();
88738
+ }
88640
88739
  return Object.assign(promise4.then((answer) => {
88641
88740
  effectScheduler.clearAll();
88642
88741
  return answer;
@@ -88652,7 +88751,7 @@ function createPrompt(view) {
88652
88751
  };
88653
88752
  return prompt;
88654
88753
  }
88655
- // ../node_modules/.pnpm/@inquirer+confirm@6.0.6_@types+node@25.3.0/node_modules/@inquirer/confirm/dist/index.js
88754
+ // ../node_modules/.pnpm/@inquirer+confirm@6.0.8_@types+node@25.3.0/node_modules/@inquirer/confirm/dist/index.js
88656
88755
  function getBooleanValue(value, defaultValue) {
88657
88756
  let answer = defaultValue !== false;
88658
88757
  if (/^(y|yes)/i.test(value))
@@ -109221,7 +109320,7 @@ program.addCommand(pluginCommand);
109221
109320
  var me = new Command("me").description("查看当前用户信息").action(async () => {
109222
109321
  const aq = new AssistantQuery(assistantConfig3);
109223
109322
  await aq.init();
109224
- const info = await aq.queryLogin.checkLocalUser();
109323
+ const info = await aq.getToken();
109225
109324
  logger.info(info);
109226
109325
  });
109227
109326
  program.addCommand(me);