@kevisual/cli 0.1.15 → 0.1.16

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.
@@ -51818,8 +51818,10 @@ class RemoteApp {
51818
51818
  mainApp;
51819
51819
  url;
51820
51820
  id;
51821
+ username;
51821
51822
  emitter;
51822
51823
  isConnected;
51824
+ isVerified;
51823
51825
  ws;
51824
51826
  remoteIsConnected;
51825
51827
  isError = false;
@@ -51836,12 +51838,17 @@ class RemoteApp {
51836
51838
  const token = opts.token;
51837
51839
  const url4 = opts.url;
51838
51840
  const id = opts.id;
51841
+ const username = opts.username;
51842
+ this.username = username;
51839
51843
  this.emitter = opts?.emitter || new import__2.default;
51840
51844
  const _url2 = new URL(url4);
51841
51845
  if (token) {
51842
51846
  _url2.searchParams.set("token", token);
51843
51847
  }
51844
51848
  _url2.searchParams.set("id", id);
51849
+ if (!token && !username) {
51850
+ console.error(`[remote-app] 不存在用户名和token ${id}. 权限认证会失败。`);
51851
+ }
51845
51852
  this.url = _url2.toString();
51846
51853
  this.id = id;
51847
51854
  this.autoReconnect = opts?.autoReconnect ?? true;
@@ -51873,6 +51880,18 @@ class RemoteApp {
51873
51880
  that.emitter.once("open", listenOnce);
51874
51881
  });
51875
51882
  }
51883
+ async waitVerify() {
51884
+ if (this.isVerified) {
51885
+ return true;
51886
+ }
51887
+ return new Promise((resolve) => {
51888
+ const listenOnce = () => {
51889
+ this.isVerified = true;
51890
+ resolve(true);
51891
+ };
51892
+ this.emitter.once("verified", listenOnce);
51893
+ });
51894
+ }
51876
51895
  getWsURL(url4) {
51877
51896
  const { protocol } = new URL(url4);
51878
51897
  if (protocol.startsWith("ws")) {
@@ -51999,6 +52018,7 @@ class RemoteApp {
51999
52018
  listenProxy() {
52000
52019
  const remoteApp = this;
52001
52020
  const app = this.mainApp;
52021
+ const username = this.username;
52002
52022
  const listenFn = async (event) => {
52003
52023
  try {
52004
52024
  const data = event.toString();
@@ -52006,11 +52026,16 @@ class RemoteApp {
52006
52026
  const bodyData = body?.data;
52007
52027
  const message = bodyData?.message || {};
52008
52028
  const context = bodyData?.context || {};
52029
+ console.log("[remote-app] 远程应用收到消息:", body);
52009
52030
  if (body?.code === 401) {
52010
- console.error("远程应用认证失败,请检查 token 是否正确");
52031
+ console.error("[remote-app] 远程应用认证失败,请检查 token 是否正确");
52011
52032
  this.isError = true;
52012
52033
  return;
52013
52034
  }
52035
+ if (body?.type === "verified") {
52036
+ remoteApp.emitter.emit("verified");
52037
+ return;
52038
+ }
52014
52039
  if (body?.type !== "proxy")
52015
52040
  return;
52016
52041
  if (!body.id) {
@@ -52033,13 +52058,15 @@ class RemoteApp {
52033
52058
  }
52034
52059
  });
52035
52060
  } catch (error49) {
52036
- console.error("处理远程代理请求出错:", error49);
52061
+ console.error("[remote-app] 处理远程代理请求出错:", error49);
52037
52062
  }
52038
52063
  };
52039
52064
  remoteApp.json({
52040
52065
  id: this.id,
52041
- type: "registryClient"
52066
+ type: "registryClient",
52067
+ username
52042
52068
  });
52069
+ console.log(`[remote-app] 远程应用 ${this.id} (${username}) 已注册到主应用,等待消息...`);
52043
52070
  remoteApp.emitter.on("message", listenFn);
52044
52071
  const closeMessage = () => {
52045
52072
  remoteApp.emitter.off("message", listenFn);
@@ -80981,10 +81008,11 @@ class AssistantApp extends Manager2 {
80981
81008
  }
80982
81009
  const url4 = new URL(shareUrl);
80983
81010
  const id = config4?.app?.id;
80984
- if (token && url4 && id) {
81011
+ if (url4 && id) {
80985
81012
  const remoteApp = new RemoteApp({
80986
81013
  url: url4.toString(),
80987
81014
  token,
81015
+ username: config4?.auth?.username || "",
80988
81016
  id,
80989
81017
  app: this.mainApp,
80990
81018
  autoReconnect: true,
@@ -91433,8 +91433,10 @@ class RemoteApp {
91433
91433
  mainApp;
91434
91434
  url;
91435
91435
  id;
91436
+ username;
91436
91437
  emitter;
91437
91438
  isConnected;
91439
+ isVerified;
91438
91440
  ws;
91439
91441
  remoteIsConnected;
91440
91442
  isError = false;
@@ -91451,12 +91453,17 @@ class RemoteApp {
91451
91453
  const token = opts.token;
91452
91454
  const url4 = opts.url;
91453
91455
  const id = opts.id;
91456
+ const username = opts.username;
91457
+ this.username = username;
91454
91458
  this.emitter = opts?.emitter || new import__2.default;
91455
91459
  const _url2 = new URL(url4);
91456
91460
  if (token) {
91457
91461
  _url2.searchParams.set("token", token);
91458
91462
  }
91459
91463
  _url2.searchParams.set("id", id);
91464
+ if (!token && !username) {
91465
+ console.error(`[remote-app] 不存在用户名和token ${id}. 权限认证会失败。`);
91466
+ }
91460
91467
  this.url = _url2.toString();
91461
91468
  this.id = id;
91462
91469
  this.autoReconnect = opts?.autoReconnect ?? true;
@@ -91488,6 +91495,18 @@ class RemoteApp {
91488
91495
  that.emitter.once("open", listenOnce);
91489
91496
  });
91490
91497
  }
91498
+ async waitVerify() {
91499
+ if (this.isVerified) {
91500
+ return true;
91501
+ }
91502
+ return new Promise((resolve) => {
91503
+ const listenOnce = () => {
91504
+ this.isVerified = true;
91505
+ resolve(true);
91506
+ };
91507
+ this.emitter.once("verified", listenOnce);
91508
+ });
91509
+ }
91491
91510
  getWsURL(url4) {
91492
91511
  const { protocol } = new URL(url4);
91493
91512
  if (protocol.startsWith("ws")) {
@@ -91614,6 +91633,7 @@ class RemoteApp {
91614
91633
  listenProxy() {
91615
91634
  const remoteApp = this;
91616
91635
  const app = this.mainApp;
91636
+ const username = this.username;
91617
91637
  const listenFn = async (event) => {
91618
91638
  try {
91619
91639
  const data = event.toString();
@@ -91621,11 +91641,16 @@ class RemoteApp {
91621
91641
  const bodyData = body?.data;
91622
91642
  const message = bodyData?.message || {};
91623
91643
  const context = bodyData?.context || {};
91644
+ console.log("[remote-app] 远程应用收到消息:", body);
91624
91645
  if (body?.code === 401) {
91625
- console.error("远程应用认证失败,请检查 token 是否正确");
91646
+ console.error("[remote-app] 远程应用认证失败,请检查 token 是否正确");
91626
91647
  this.isError = true;
91627
91648
  return;
91628
91649
  }
91650
+ if (body?.type === "verified") {
91651
+ remoteApp.emitter.emit("verified");
91652
+ return;
91653
+ }
91629
91654
  if (body?.type !== "proxy")
91630
91655
  return;
91631
91656
  if (!body.id) {
@@ -91648,13 +91673,15 @@ class RemoteApp {
91648
91673
  }
91649
91674
  });
91650
91675
  } catch (error49) {
91651
- console.error("处理远程代理请求出错:", error49);
91676
+ console.error("[remote-app] 处理远程代理请求出错:", error49);
91652
91677
  }
91653
91678
  };
91654
91679
  remoteApp.json({
91655
91680
  id: this.id,
91656
- type: "registryClient"
91681
+ type: "registryClient",
91682
+ username
91657
91683
  });
91684
+ console.log(`[remote-app] 远程应用 ${this.id} (${username}) 已注册到主应用,等待消息...`);
91658
91685
  remoteApp.emitter.on("message", listenFn);
91659
91686
  const closeMessage = () => {
91660
91687
  remoteApp.emitter.off("message", listenFn);
@@ -120014,10 +120041,11 @@ class AssistantApp extends Manager2 {
120014
120041
  }
120015
120042
  const url4 = new URL(shareUrl);
120016
120043
  const id = config4?.app?.id;
120017
- if (token && url4 && id) {
120044
+ if (url4 && id) {
120018
120045
  const remoteApp = new RemoteApp({
120019
120046
  url: url4.toString(),
120020
120047
  token,
120048
+ username: config4?.auth?.username || "",
120021
120049
  id,
120022
120050
  app: this.mainApp,
120023
120051
  autoReconnect: true,
package/dist/assistant.js CHANGED
@@ -36603,8 +36603,10 @@ class RemoteApp {
36603
36603
  mainApp;
36604
36604
  url;
36605
36605
  id;
36606
+ username;
36606
36607
  emitter;
36607
36608
  isConnected;
36609
+ isVerified;
36608
36610
  ws;
36609
36611
  remoteIsConnected;
36610
36612
  isError = false;
@@ -36621,12 +36623,17 @@ class RemoteApp {
36621
36623
  const token = opts.token;
36622
36624
  const url = opts.url;
36623
36625
  const id = opts.id;
36626
+ const username = opts.username;
36627
+ this.username = username;
36624
36628
  this.emitter = opts?.emitter || new import__2.default;
36625
36629
  const _url = new URL(url);
36626
36630
  if (token) {
36627
36631
  _url.searchParams.set("token", token);
36628
36632
  }
36629
36633
  _url.searchParams.set("id", id);
36634
+ if (!token && !username) {
36635
+ console.error(`[remote-app] 不存在用户名和token ${id}. 权限认证会失败。`);
36636
+ }
36630
36637
  this.url = _url.toString();
36631
36638
  this.id = id;
36632
36639
  this.autoReconnect = opts?.autoReconnect ?? true;
@@ -36658,6 +36665,18 @@ class RemoteApp {
36658
36665
  that.emitter.once("open", listenOnce);
36659
36666
  });
36660
36667
  }
36668
+ async waitVerify() {
36669
+ if (this.isVerified) {
36670
+ return true;
36671
+ }
36672
+ return new Promise((resolve) => {
36673
+ const listenOnce = () => {
36674
+ this.isVerified = true;
36675
+ resolve(true);
36676
+ };
36677
+ this.emitter.once("verified", listenOnce);
36678
+ });
36679
+ }
36661
36680
  getWsURL(url) {
36662
36681
  const { protocol } = new URL(url);
36663
36682
  if (protocol.startsWith("ws")) {
@@ -36784,6 +36803,7 @@ class RemoteApp {
36784
36803
  listenProxy() {
36785
36804
  const remoteApp = this;
36786
36805
  const app = this.mainApp;
36806
+ const username = this.username;
36787
36807
  const listenFn = async (event) => {
36788
36808
  try {
36789
36809
  const data = event.toString();
@@ -36791,11 +36811,16 @@ class RemoteApp {
36791
36811
  const bodyData = body?.data;
36792
36812
  const message = bodyData?.message || {};
36793
36813
  const context = bodyData?.context || {};
36814
+ console.log("[remote-app] 远程应用收到消息:", body);
36794
36815
  if (body?.code === 401) {
36795
- console.error("远程应用认证失败,请检查 token 是否正确");
36816
+ console.error("[remote-app] 远程应用认证失败,请检查 token 是否正确");
36796
36817
  this.isError = true;
36797
36818
  return;
36798
36819
  }
36820
+ if (body?.type === "verified") {
36821
+ remoteApp.emitter.emit("verified");
36822
+ return;
36823
+ }
36799
36824
  if (body?.type !== "proxy")
36800
36825
  return;
36801
36826
  if (!body.id) {
@@ -36818,13 +36843,15 @@ class RemoteApp {
36818
36843
  }
36819
36844
  });
36820
36845
  } catch (error2) {
36821
- console.error("处理远程代理请求出错:", error2);
36846
+ console.error("[remote-app] 处理远程代理请求出错:", error2);
36822
36847
  }
36823
36848
  };
36824
36849
  remoteApp.json({
36825
36850
  id: this.id,
36826
- type: "registryClient"
36851
+ type: "registryClient",
36852
+ username
36827
36853
  });
36854
+ console.log(`[remote-app] 远程应用 ${this.id} (${username}) 已注册到主应用,等待消息...`);
36828
36855
  remoteApp.emitter.on("message", listenFn);
36829
36856
  const closeMessage = () => {
36830
36857
  remoteApp.emitter.off("message", listenFn);
@@ -87240,10 +87267,11 @@ class AssistantApp extends Manager2 {
87240
87267
  }
87241
87268
  const url4 = new URL(shareUrl);
87242
87269
  const id = config5?.app?.id;
87243
- if (token && url4 && id) {
87270
+ if (url4 && id) {
87244
87271
  const remoteApp = new RemoteApp({
87245
87272
  url: url4.toString(),
87246
87273
  token,
87274
+ username: config5?.auth?.username || "",
87247
87275
  id,
87248
87276
  app: this.mainApp,
87249
87277
  autoReconnect: true,
package/dist/envision.js CHANGED
@@ -22312,8 +22312,8 @@ InitEnv.init();
22312
22312
  var version = useContextKey("version", () => {
22313
22313
  let version2 = "0.0.64";
22314
22314
  try {
22315
- if ("0.1.15")
22316
- version2 = "0.1.15";
22315
+ if ("0.1.16")
22316
+ version2 = "0.1.16";
22317
22317
  } catch (e) {}
22318
22318
  return version2;
22319
22319
  });
@@ -30007,7 +30007,10 @@ class SyncBase {
30007
30007
  const syncList = syncKeys.map((key) => {
30008
30008
  const value = sync[key];
30009
30009
  const filepath = path9.join(this.#dir, key);
30010
- if (filepath.includes("node_modules") || filepath.includes(".git")) {
30010
+ const dirs = path9.dirname(filepath).split(path9.sep);
30011
+ const hasGit = dirs.includes(".git");
30012
+ const hasNodeModules = dirs.includes("node_modules");
30013
+ if (hasGit || hasNodeModules) {
30011
30014
  return null;
30012
30015
  }
30013
30016
  if (typeof value === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cli",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "envision 命令行工具",
5
5
  "type": "module",
6
6
  "basename": "/root/cli",