@kevisual/cli 0.1.28 → 0.1.30
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-opencode.js +56 -30
- package/dist/assistant-server.js +55 -29
- package/dist/assistant.js +53 -27
- package/dist/envision.js +16 -24
- package/package.json +4 -4
|
@@ -23714,7 +23714,7 @@ var require_lib2 = __commonJS((exports, module) => {
|
|
|
23714
23714
|
};
|
|
23715
23715
|
});
|
|
23716
23716
|
|
|
23717
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
23717
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router.js
|
|
23718
23718
|
import { createRequire as createRequire2 } from "node:module";
|
|
23719
23719
|
import { webcrypto as crypto2 } from "node:crypto";
|
|
23720
23720
|
import http from "node:http";
|
|
@@ -41232,7 +41232,7 @@ class QueryRouter {
|
|
|
41232
41232
|
console.error("=====debug====:", e);
|
|
41233
41233
|
console.error("=====debug====:[path:key]:", `${route.path}-${route.key}`);
|
|
41234
41234
|
}
|
|
41235
|
-
if (e instanceof CustomError) {
|
|
41235
|
+
if (e instanceof CustomError || e?.code) {
|
|
41236
41236
|
ctx.code = e.code;
|
|
41237
41237
|
ctx.message = e.message;
|
|
41238
41238
|
} else {
|
|
@@ -41495,6 +41495,39 @@ class QueryRouterServer extends QueryRouter {
|
|
|
41495
41495
|
const { path, key, id } = api2;
|
|
41496
41496
|
return this.run({ path, key, id, payload }, ctx);
|
|
41497
41497
|
}
|
|
41498
|
+
async createAuth(fun) {
|
|
41499
|
+
this.route({
|
|
41500
|
+
path: "auth",
|
|
41501
|
+
key: "auth",
|
|
41502
|
+
id: "auth",
|
|
41503
|
+
description: "token验证"
|
|
41504
|
+
}).define(async (ctx) => {
|
|
41505
|
+
if (fun) {
|
|
41506
|
+
await fun(ctx, "auth");
|
|
41507
|
+
}
|
|
41508
|
+
}).addTo(this, { overwrite: false });
|
|
41509
|
+
this.route({
|
|
41510
|
+
path: "auth-admin",
|
|
41511
|
+
key: "auth-admin",
|
|
41512
|
+
id: "auth-admin",
|
|
41513
|
+
description: "admin token验证",
|
|
41514
|
+
middleware: ["auth"]
|
|
41515
|
+
}).define(async (ctx) => {
|
|
41516
|
+
if (fun) {
|
|
41517
|
+
await fun(ctx, "auth-admin");
|
|
41518
|
+
}
|
|
41519
|
+
}).addTo(this, { overwrite: false });
|
|
41520
|
+
this.route({
|
|
41521
|
+
path: "auth-can",
|
|
41522
|
+
key: "auth-can",
|
|
41523
|
+
id: "auth-can",
|
|
41524
|
+
description: "权限验证"
|
|
41525
|
+
}).define(async (ctx) => {
|
|
41526
|
+
if (fun) {
|
|
41527
|
+
await fun(ctx, "auth-can");
|
|
41528
|
+
}
|
|
41529
|
+
}).addTo(this, { overwrite: false });
|
|
41530
|
+
}
|
|
41498
41531
|
}
|
|
41499
41532
|
var isNode2 = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
41500
41533
|
var isBrowser2 = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
|
|
@@ -42419,7 +42452,7 @@ class App extends QueryRouterServer {
|
|
|
42419
42452
|
}
|
|
42420
42453
|
}
|
|
42421
42454
|
|
|
42422
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
42455
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-simple.js
|
|
42423
42456
|
import url3 from "node:url";
|
|
42424
42457
|
var __create3 = Object.create;
|
|
42425
42458
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
@@ -44572,7 +44605,7 @@ class AssistantConfig {
|
|
|
44572
44605
|
return checkConfigDir;
|
|
44573
44606
|
}
|
|
44574
44607
|
getDefaultInitAssistantConfig() {
|
|
44575
|
-
|
|
44608
|
+
let id = randomId2();
|
|
44576
44609
|
const isCNB = !!useKey("CNB");
|
|
44577
44610
|
let kevisualUrl = "https://kevisual.cn";
|
|
44578
44611
|
if (isCNB) {
|
|
@@ -44586,6 +44619,7 @@ class AssistantConfig {
|
|
|
44586
44619
|
const routes = ["@kevisual/cnb/routes"];
|
|
44587
44620
|
if (isCNB) {
|
|
44588
44621
|
routes.push("@kevisual/project-search/routes");
|
|
44622
|
+
id = "dev-cnb";
|
|
44589
44623
|
}
|
|
44590
44624
|
return {
|
|
44591
44625
|
app: {
|
|
@@ -52669,7 +52703,7 @@ class RemoteApp {
|
|
|
52669
52703
|
}
|
|
52670
52704
|
}
|
|
52671
52705
|
|
|
52672
|
-
// ../node_modules/.pnpm/@kevisual+query@0.0.
|
|
52706
|
+
// ../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
|
|
52673
52707
|
var isTextForContentType = (contentType) => {
|
|
52674
52708
|
if (!contentType)
|
|
52675
52709
|
return false;
|
|
@@ -52872,10 +52906,6 @@ class Query {
|
|
|
52872
52906
|
});
|
|
52873
52907
|
}
|
|
52874
52908
|
}
|
|
52875
|
-
const headers2 = req.headers || {};
|
|
52876
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
52877
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
52878
|
-
}
|
|
52879
52909
|
} catch (e) {
|
|
52880
52910
|
console.error("request beforeFn error", e, req);
|
|
52881
52911
|
return wrapperError({
|
|
@@ -52936,20 +52966,20 @@ class Query {
|
|
|
52936
52966
|
this.afterResponse = fn;
|
|
52937
52967
|
}
|
|
52938
52968
|
async fetchText(urlOrOptions, options) {
|
|
52939
|
-
let _options = {
|
|
52969
|
+
let _options = { ...options };
|
|
52940
52970
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
52941
52971
|
_options.url = urlOrOptions;
|
|
52942
52972
|
}
|
|
52943
52973
|
if (typeof urlOrOptions === "object") {
|
|
52944
52974
|
_options = { ...urlOrOptions, ..._options };
|
|
52945
52975
|
}
|
|
52946
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
52947
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
52948
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
52949
|
-
}
|
|
52950
52976
|
const res = await adapter({
|
|
52977
|
+
method: "GET",
|
|
52951
52978
|
..._options,
|
|
52952
|
-
headers
|
|
52979
|
+
headers: {
|
|
52980
|
+
...this.headers,
|
|
52981
|
+
..._options?.headers || {}
|
|
52982
|
+
}
|
|
52953
52983
|
});
|
|
52954
52984
|
if (res && !res.code) {
|
|
52955
52985
|
return {
|
|
@@ -52961,7 +52991,7 @@ class Query {
|
|
|
52961
52991
|
}
|
|
52962
52992
|
}
|
|
52963
52993
|
|
|
52964
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
52994
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-browser.js
|
|
52965
52995
|
var __create5 = Object.create;
|
|
52966
52996
|
var __getProtoOf5 = Object.getPrototypeOf;
|
|
52967
52997
|
var __defProp5 = Object.defineProperty;
|
|
@@ -100608,7 +100638,7 @@ var checkLocalUser = async (opts) => {
|
|
|
100608
100638
|
}
|
|
100609
100639
|
}
|
|
100610
100640
|
};
|
|
100611
|
-
// ../node_modules/.pnpm/@kevisual+query@0.0.
|
|
100641
|
+
// ../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query.js
|
|
100612
100642
|
var isTextForContentType2 = (contentType) => {
|
|
100613
100643
|
if (!contentType)
|
|
100614
100644
|
return false;
|
|
@@ -100811,10 +100841,6 @@ class Query2 {
|
|
|
100811
100841
|
});
|
|
100812
100842
|
}
|
|
100813
100843
|
}
|
|
100814
|
-
const headers2 = req.headers || {};
|
|
100815
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
100816
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
100817
|
-
}
|
|
100818
100844
|
} catch (e) {
|
|
100819
100845
|
console.error("request beforeFn error", e, req);
|
|
100820
100846
|
return wrapperError2({
|
|
@@ -100875,20 +100901,20 @@ class Query2 {
|
|
|
100875
100901
|
this.afterResponse = fn;
|
|
100876
100902
|
}
|
|
100877
100903
|
async fetchText(urlOrOptions, options) {
|
|
100878
|
-
let _options = {
|
|
100904
|
+
let _options = { ...options };
|
|
100879
100905
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
100880
100906
|
_options.url = urlOrOptions;
|
|
100881
100907
|
}
|
|
100882
100908
|
if (typeof urlOrOptions === "object") {
|
|
100883
100909
|
_options = { ...urlOrOptions, ..._options };
|
|
100884
100910
|
}
|
|
100885
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
100886
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
100887
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
100888
|
-
}
|
|
100889
100911
|
const res = await adapter2({
|
|
100912
|
+
method: "GET",
|
|
100890
100913
|
..._options,
|
|
100891
|
-
headers
|
|
100914
|
+
headers: {
|
|
100915
|
+
...this.headers,
|
|
100916
|
+
..._options?.headers || {}
|
|
100917
|
+
}
|
|
100892
100918
|
});
|
|
100893
100919
|
if (res && !res.code) {
|
|
100894
100920
|
return {
|
|
@@ -103444,7 +103470,7 @@ var simpleRouter = useContextKey("simpleRouter", () => {
|
|
|
103444
103470
|
});
|
|
103445
103471
|
app.createRouteList();
|
|
103446
103472
|
|
|
103447
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
103473
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/opencode.js
|
|
103448
103474
|
import { createRequire as createRequire4 } from "node:module";
|
|
103449
103475
|
import { webcrypto as crypto4 } from "node:crypto";
|
|
103450
103476
|
var __create7 = Object.create;
|
|
@@ -123000,7 +123026,7 @@ var createOSInfo = (more = false) => {
|
|
|
123000
123026
|
return labels;
|
|
123001
123027
|
};
|
|
123002
123028
|
|
|
123003
|
-
// src/routes/cnb-board/cnb-
|
|
123029
|
+
// src/routes/cnb-board/dev-cnb-env.ts
|
|
123004
123030
|
var notCNBCheck = (ctx) => {
|
|
123005
123031
|
const isCNB = useKey2("CNB");
|
|
123006
123032
|
if (!isCNB) {
|
|
@@ -124156,7 +124182,7 @@ var import_busboy = __toESM(require_lib2(), 1);
|
|
|
124156
124182
|
import path16 from "path";
|
|
124157
124183
|
import fs19 from "fs";
|
|
124158
124184
|
|
|
124159
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
124185
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/src/server/cookie.ts
|
|
124160
124186
|
var NullObject2 = /* @__PURE__ */ (() => {
|
|
124161
124187
|
const C2 = function() {};
|
|
124162
124188
|
C2.prototype = Object.create(null);
|
package/dist/assistant-server.js
CHANGED
|
@@ -62838,7 +62838,7 @@ var useKey = (envKey, initKey = "context") => {
|
|
|
62838
62838
|
return null;
|
|
62839
62839
|
};
|
|
62840
62840
|
|
|
62841
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
62841
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router.js
|
|
62842
62842
|
import { createRequire as createRequire2 } from "node:module";
|
|
62843
62843
|
import { webcrypto as crypto2 } from "node:crypto";
|
|
62844
62844
|
import http from "node:http";
|
|
@@ -80356,7 +80356,7 @@ class QueryRouter {
|
|
|
80356
80356
|
console.error("=====debug====:", e);
|
|
80357
80357
|
console.error("=====debug====:[path:key]:", `${route.path}-${route.key}`);
|
|
80358
80358
|
}
|
|
80359
|
-
if (e instanceof CustomError) {
|
|
80359
|
+
if (e instanceof CustomError || e?.code) {
|
|
80360
80360
|
ctx.code = e.code;
|
|
80361
80361
|
ctx.message = e.message;
|
|
80362
80362
|
} else {
|
|
@@ -80619,6 +80619,39 @@ class QueryRouterServer extends QueryRouter {
|
|
|
80619
80619
|
const { path, key, id } = api2;
|
|
80620
80620
|
return this.run({ path, key, id, payload }, ctx);
|
|
80621
80621
|
}
|
|
80622
|
+
async createAuth(fun) {
|
|
80623
|
+
this.route({
|
|
80624
|
+
path: "auth",
|
|
80625
|
+
key: "auth",
|
|
80626
|
+
id: "auth",
|
|
80627
|
+
description: "token验证"
|
|
80628
|
+
}).define(async (ctx) => {
|
|
80629
|
+
if (fun) {
|
|
80630
|
+
await fun(ctx, "auth");
|
|
80631
|
+
}
|
|
80632
|
+
}).addTo(this, { overwrite: false });
|
|
80633
|
+
this.route({
|
|
80634
|
+
path: "auth-admin",
|
|
80635
|
+
key: "auth-admin",
|
|
80636
|
+
id: "auth-admin",
|
|
80637
|
+
description: "admin token验证",
|
|
80638
|
+
middleware: ["auth"]
|
|
80639
|
+
}).define(async (ctx) => {
|
|
80640
|
+
if (fun) {
|
|
80641
|
+
await fun(ctx, "auth-admin");
|
|
80642
|
+
}
|
|
80643
|
+
}).addTo(this, { overwrite: false });
|
|
80644
|
+
this.route({
|
|
80645
|
+
path: "auth-can",
|
|
80646
|
+
key: "auth-can",
|
|
80647
|
+
id: "auth-can",
|
|
80648
|
+
description: "权限验证"
|
|
80649
|
+
}).define(async (ctx) => {
|
|
80650
|
+
if (fun) {
|
|
80651
|
+
await fun(ctx, "auth-can");
|
|
80652
|
+
}
|
|
80653
|
+
}).addTo(this, { overwrite: false });
|
|
80654
|
+
}
|
|
80622
80655
|
}
|
|
80623
80656
|
var isNode2 = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
80624
80657
|
var isBrowser22 = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
|
|
@@ -81543,7 +81576,7 @@ class App extends QueryRouterServer {
|
|
|
81543
81576
|
}
|
|
81544
81577
|
}
|
|
81545
81578
|
|
|
81546
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
81579
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-simple.js
|
|
81547
81580
|
import url3 from "node:url";
|
|
81548
81581
|
var __create3 = Object.create;
|
|
81549
81582
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
@@ -83707,7 +83740,7 @@ class AssistantConfig {
|
|
|
83707
83740
|
return checkConfigDir;
|
|
83708
83741
|
}
|
|
83709
83742
|
getDefaultInitAssistantConfig() {
|
|
83710
|
-
|
|
83743
|
+
let id = randomId2();
|
|
83711
83744
|
const isCNB = !!useKey2("CNB");
|
|
83712
83745
|
let kevisualUrl = "https://kevisual.cn";
|
|
83713
83746
|
if (isCNB) {
|
|
@@ -83721,6 +83754,7 @@ class AssistantConfig {
|
|
|
83721
83754
|
const routes = ["@kevisual/cnb/routes"];
|
|
83722
83755
|
if (isCNB) {
|
|
83723
83756
|
routes.push("@kevisual/project-search/routes");
|
|
83757
|
+
id = "dev-cnb";
|
|
83724
83758
|
}
|
|
83725
83759
|
return {
|
|
83726
83760
|
app: {
|
|
@@ -92549,7 +92583,7 @@ class RemoteApp {
|
|
|
92549
92583
|
}
|
|
92550
92584
|
}
|
|
92551
92585
|
|
|
92552
|
-
// ../node_modules/.pnpm/@kevisual+query@0.0.
|
|
92586
|
+
// ../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
|
|
92553
92587
|
var isTextForContentType = (contentType) => {
|
|
92554
92588
|
if (!contentType)
|
|
92555
92589
|
return false;
|
|
@@ -92752,10 +92786,6 @@ class Query {
|
|
|
92752
92786
|
});
|
|
92753
92787
|
}
|
|
92754
92788
|
}
|
|
92755
|
-
const headers2 = req.headers || {};
|
|
92756
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
92757
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
92758
|
-
}
|
|
92759
92789
|
} catch (e) {
|
|
92760
92790
|
console.error("request beforeFn error", e, req);
|
|
92761
92791
|
return wrapperError({
|
|
@@ -92816,20 +92846,20 @@ class Query {
|
|
|
92816
92846
|
this.afterResponse = fn;
|
|
92817
92847
|
}
|
|
92818
92848
|
async fetchText(urlOrOptions, options) {
|
|
92819
|
-
let _options = {
|
|
92849
|
+
let _options = { ...options };
|
|
92820
92850
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
92821
92851
|
_options.url = urlOrOptions;
|
|
92822
92852
|
}
|
|
92823
92853
|
if (typeof urlOrOptions === "object") {
|
|
92824
92854
|
_options = { ...urlOrOptions, ..._options };
|
|
92825
92855
|
}
|
|
92826
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
92827
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
92828
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
92829
|
-
}
|
|
92830
92856
|
const res = await adapter({
|
|
92857
|
+
method: "GET",
|
|
92831
92858
|
..._options,
|
|
92832
|
-
headers
|
|
92859
|
+
headers: {
|
|
92860
|
+
...this.headers,
|
|
92861
|
+
..._options?.headers || {}
|
|
92862
|
+
}
|
|
92833
92863
|
});
|
|
92834
92864
|
if (res && !res.code) {
|
|
92835
92865
|
return {
|
|
@@ -92841,7 +92871,7 @@ class Query {
|
|
|
92841
92871
|
}
|
|
92842
92872
|
}
|
|
92843
92873
|
|
|
92844
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
92874
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-browser.js
|
|
92845
92875
|
var __create5 = Object.create;
|
|
92846
92876
|
var __getProtoOf5 = Object.getPrototypeOf;
|
|
92847
92877
|
var __defProp5 = Object.defineProperty;
|
|
@@ -139906,7 +139936,7 @@ var checkLocalUser = async (opts) => {
|
|
|
139906
139936
|
}
|
|
139907
139937
|
}
|
|
139908
139938
|
};
|
|
139909
|
-
// ../node_modules/.pnpm/@kevisual+query@0.0.
|
|
139939
|
+
// ../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query.js
|
|
139910
139940
|
var isTextForContentType2 = (contentType) => {
|
|
139911
139941
|
if (!contentType)
|
|
139912
139942
|
return false;
|
|
@@ -140109,10 +140139,6 @@ class Query2 {
|
|
|
140109
140139
|
});
|
|
140110
140140
|
}
|
|
140111
140141
|
}
|
|
140112
|
-
const headers2 = req.headers || {};
|
|
140113
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
140114
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
140115
|
-
}
|
|
140116
140142
|
} catch (e) {
|
|
140117
140143
|
console.error("request beforeFn error", e, req);
|
|
140118
140144
|
return wrapperError2({
|
|
@@ -140173,20 +140199,20 @@ class Query2 {
|
|
|
140173
140199
|
this.afterResponse = fn;
|
|
140174
140200
|
}
|
|
140175
140201
|
async fetchText(urlOrOptions, options) {
|
|
140176
|
-
let _options = {
|
|
140202
|
+
let _options = { ...options };
|
|
140177
140203
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
140178
140204
|
_options.url = urlOrOptions;
|
|
140179
140205
|
}
|
|
140180
140206
|
if (typeof urlOrOptions === "object") {
|
|
140181
140207
|
_options = { ...urlOrOptions, ..._options };
|
|
140182
140208
|
}
|
|
140183
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
140184
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
140185
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
140186
|
-
}
|
|
140187
140209
|
const res = await adapter2({
|
|
140210
|
+
method: "GET",
|
|
140188
140211
|
..._options,
|
|
140189
|
-
headers
|
|
140212
|
+
headers: {
|
|
140213
|
+
...this.headers,
|
|
140214
|
+
..._options?.headers || {}
|
|
140215
|
+
}
|
|
140190
140216
|
});
|
|
140191
140217
|
if (res && !res.code) {
|
|
140192
140218
|
return {
|
|
@@ -147294,7 +147320,7 @@ var createOSInfo = (more = false) => {
|
|
|
147294
147320
|
return labels;
|
|
147295
147321
|
};
|
|
147296
147322
|
|
|
147297
|
-
// src/routes/cnb-board/cnb-
|
|
147323
|
+
// src/routes/cnb-board/dev-cnb-env.ts
|
|
147298
147324
|
var notCNBCheck = (ctx) => {
|
|
147299
147325
|
const isCNB = useKey("CNB");
|
|
147300
147326
|
if (!isCNB) {
|
|
@@ -149127,7 +149153,7 @@ var import_busboy = __toESM(require_lib2(), 1);
|
|
|
149127
149153
|
import path20 from "path";
|
|
149128
149154
|
import fs23 from "fs";
|
|
149129
149155
|
|
|
149130
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
149156
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/src/server/cookie.ts
|
|
149131
149157
|
var NullObject2 = /* @__PURE__ */ (() => {
|
|
149132
149158
|
const C2 = function() {};
|
|
149133
149159
|
C2.prototype = Object.create(null);
|
package/dist/assistant.js
CHANGED
|
@@ -28845,7 +28845,7 @@ class AssistantConfig {
|
|
|
28845
28845
|
return checkConfigDir;
|
|
28846
28846
|
}
|
|
28847
28847
|
getDefaultInitAssistantConfig() {
|
|
28848
|
-
|
|
28848
|
+
let id = randomId();
|
|
28849
28849
|
const isCNB = !!useKey("CNB");
|
|
28850
28850
|
let kevisualUrl = "https://kevisual.cn";
|
|
28851
28851
|
if (isCNB) {
|
|
@@ -28859,6 +28859,7 @@ class AssistantConfig {
|
|
|
28859
28859
|
const routes = ["@kevisual/cnb/routes"];
|
|
28860
28860
|
if (isCNB) {
|
|
28861
28861
|
routes.push("@kevisual/project-search/routes");
|
|
28862
|
+
id = "dev-cnb";
|
|
28862
28863
|
}
|
|
28863
28864
|
return {
|
|
28864
28865
|
app: {
|
|
@@ -36930,7 +36931,7 @@ class RemoteApp {
|
|
|
36930
36931
|
}
|
|
36931
36932
|
}
|
|
36932
36933
|
|
|
36933
|
-
// ../node_modules/.pnpm/@kevisual+query@0.0.
|
|
36934
|
+
// ../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
|
|
36934
36935
|
var isTextForContentType = (contentType) => {
|
|
36935
36936
|
if (!contentType)
|
|
36936
36937
|
return false;
|
|
@@ -37133,10 +37134,6 @@ class Query {
|
|
|
37133
37134
|
});
|
|
37134
37135
|
}
|
|
37135
37136
|
}
|
|
37136
|
-
const headers2 = req.headers || {};
|
|
37137
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
37138
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
37139
|
-
}
|
|
37140
37137
|
} catch (e) {
|
|
37141
37138
|
console.error("request beforeFn error", e, req);
|
|
37142
37139
|
return wrapperError({
|
|
@@ -37197,20 +37194,20 @@ class Query {
|
|
|
37197
37194
|
this.afterResponse = fn;
|
|
37198
37195
|
}
|
|
37199
37196
|
async fetchText(urlOrOptions, options) {
|
|
37200
|
-
let _options = {
|
|
37197
|
+
let _options = { ...options };
|
|
37201
37198
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
37202
37199
|
_options.url = urlOrOptions;
|
|
37203
37200
|
}
|
|
37204
37201
|
if (typeof urlOrOptions === "object") {
|
|
37205
37202
|
_options = { ...urlOrOptions, ..._options };
|
|
37206
37203
|
}
|
|
37207
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
37208
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
37209
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
37210
|
-
}
|
|
37211
37204
|
const res = await adapter({
|
|
37205
|
+
method: "GET",
|
|
37212
37206
|
..._options,
|
|
37213
|
-
headers
|
|
37207
|
+
headers: {
|
|
37208
|
+
...this.headers,
|
|
37209
|
+
..._options?.headers || {}
|
|
37210
|
+
}
|
|
37214
37211
|
});
|
|
37215
37212
|
if (res && !res.code) {
|
|
37216
37213
|
return {
|
|
@@ -37222,7 +37219,7 @@ class Query {
|
|
|
37222
37219
|
}
|
|
37223
37220
|
}
|
|
37224
37221
|
|
|
37225
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
37222
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-browser.js
|
|
37226
37223
|
var __create3 = Object.create;
|
|
37227
37224
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
37228
37225
|
var __defProp3 = Object.defineProperty;
|
|
@@ -70227,7 +70224,7 @@ var getStringHash = (str) => {
|
|
|
70227
70224
|
return crypto2.createHash("md5").update(str).digest("hex");
|
|
70228
70225
|
};
|
|
70229
70226
|
|
|
70230
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
70227
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router.js
|
|
70231
70228
|
import { createRequire as createRequire3 } from "node:module";
|
|
70232
70229
|
import { webcrypto as crypto3 } from "node:crypto";
|
|
70233
70230
|
import http from "node:http";
|
|
@@ -87729,7 +87726,7 @@ class QueryRouter {
|
|
|
87729
87726
|
console.error("=====debug====:", e);
|
|
87730
87727
|
console.error("=====debug====:[path:key]:", `${route.path}-${route.key}`);
|
|
87731
87728
|
}
|
|
87732
|
-
if (e instanceof CustomError) {
|
|
87729
|
+
if (e instanceof CustomError || e?.code) {
|
|
87733
87730
|
ctx.code = e.code;
|
|
87734
87731
|
ctx.message = e.message;
|
|
87735
87732
|
} else {
|
|
@@ -87992,6 +87989,39 @@ class QueryRouterServer2 extends QueryRouter {
|
|
|
87992
87989
|
const { path: path7, key, id } = api2;
|
|
87993
87990
|
return this.run({ path: path7, key, id, payload }, ctx);
|
|
87994
87991
|
}
|
|
87992
|
+
async createAuth(fun) {
|
|
87993
|
+
this.route({
|
|
87994
|
+
path: "auth",
|
|
87995
|
+
key: "auth",
|
|
87996
|
+
id: "auth",
|
|
87997
|
+
description: "token验证"
|
|
87998
|
+
}).define(async (ctx) => {
|
|
87999
|
+
if (fun) {
|
|
88000
|
+
await fun(ctx, "auth");
|
|
88001
|
+
}
|
|
88002
|
+
}).addTo(this, { overwrite: false });
|
|
88003
|
+
this.route({
|
|
88004
|
+
path: "auth-admin",
|
|
88005
|
+
key: "auth-admin",
|
|
88006
|
+
id: "auth-admin",
|
|
88007
|
+
description: "admin token验证",
|
|
88008
|
+
middleware: ["auth"]
|
|
88009
|
+
}).define(async (ctx) => {
|
|
88010
|
+
if (fun) {
|
|
88011
|
+
await fun(ctx, "auth-admin");
|
|
88012
|
+
}
|
|
88013
|
+
}).addTo(this, { overwrite: false });
|
|
88014
|
+
this.route({
|
|
88015
|
+
path: "auth-can",
|
|
88016
|
+
key: "auth-can",
|
|
88017
|
+
id: "auth-can",
|
|
88018
|
+
description: "权限验证"
|
|
88019
|
+
}).define(async (ctx) => {
|
|
88020
|
+
if (fun) {
|
|
88021
|
+
await fun(ctx, "auth-can");
|
|
88022
|
+
}
|
|
88023
|
+
}).addTo(this, { overwrite: false });
|
|
88024
|
+
}
|
|
87995
88025
|
}
|
|
87996
88026
|
var isNode22 = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
87997
88027
|
var isBrowser22 = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
|
|
@@ -88916,7 +88946,7 @@ class App extends QueryRouterServer2 {
|
|
|
88916
88946
|
}
|
|
88917
88947
|
}
|
|
88918
88948
|
|
|
88919
|
-
// ../node_modules/.pnpm/@kevisual+router@0.1.
|
|
88949
|
+
// ../node_modules/.pnpm/@kevisual+router@0.1.6/node_modules/@kevisual/router/dist/router-simple.js
|
|
88920
88950
|
import url5 from "node:url";
|
|
88921
88951
|
var __create5 = Object.create;
|
|
88922
88952
|
var __getProtoOf5 = Object.getPrototypeOf;
|
|
@@ -90113,7 +90143,7 @@ var source_default = chalk;
|
|
|
90113
90143
|
// src/module/chalk.ts
|
|
90114
90144
|
var chalk2 = new Chalk({ level: 3 });
|
|
90115
90145
|
|
|
90116
|
-
// ../node_modules/.pnpm/@kevisual+query@0.0.
|
|
90146
|
+
// ../node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query.js
|
|
90117
90147
|
var isTextForContentType2 = (contentType) => {
|
|
90118
90148
|
if (!contentType)
|
|
90119
90149
|
return false;
|
|
@@ -90316,10 +90346,6 @@ class Query2 {
|
|
|
90316
90346
|
});
|
|
90317
90347
|
}
|
|
90318
90348
|
}
|
|
90319
|
-
const headers2 = req.headers || {};
|
|
90320
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
90321
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
90322
|
-
}
|
|
90323
90349
|
} catch (e) {
|
|
90324
90350
|
console.error("request beforeFn error", e, req);
|
|
90325
90351
|
return wrapperError2({
|
|
@@ -90380,20 +90406,20 @@ class Query2 {
|
|
|
90380
90406
|
this.afterResponse = fn;
|
|
90381
90407
|
}
|
|
90382
90408
|
async fetchText(urlOrOptions, options) {
|
|
90383
|
-
let _options = {
|
|
90409
|
+
let _options = { ...options };
|
|
90384
90410
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
90385
90411
|
_options.url = urlOrOptions;
|
|
90386
90412
|
}
|
|
90387
90413
|
if (typeof urlOrOptions === "object") {
|
|
90388
90414
|
_options = { ...urlOrOptions, ..._options };
|
|
90389
90415
|
}
|
|
90390
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
90391
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
90392
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
90393
|
-
}
|
|
90394
90416
|
const res = await adapter2({
|
|
90417
|
+
method: "GET",
|
|
90395
90418
|
..._options,
|
|
90396
|
-
headers
|
|
90419
|
+
headers: {
|
|
90420
|
+
...this.headers,
|
|
90421
|
+
..._options?.headers || {}
|
|
90422
|
+
}
|
|
90397
90423
|
});
|
|
90398
90424
|
if (res && !res.code) {
|
|
90399
90425
|
return {
|
package/dist/envision.js
CHANGED
|
@@ -22530,8 +22530,8 @@ InitEnv.init();
|
|
|
22530
22530
|
var version = useContextKey("version", () => {
|
|
22531
22531
|
let version2 = "0.0.64";
|
|
22532
22532
|
try {
|
|
22533
|
-
if ("0.1.
|
|
22534
|
-
version2 = "0.1.
|
|
22533
|
+
if ("0.1.29")
|
|
22534
|
+
version2 = "0.1.29";
|
|
22535
22535
|
} catch (e) {}
|
|
22536
22536
|
return version2;
|
|
22537
22537
|
});
|
|
@@ -25366,7 +25366,7 @@ var dist_default6 = createPrompt((config, done) => {
|
|
|
25366
25366
|
var import_md5 = __toESM(require_md5(), 1);
|
|
25367
25367
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
25368
25368
|
|
|
25369
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
25369
|
+
// node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query.js
|
|
25370
25370
|
var isTextForContentType = (contentType) => {
|
|
25371
25371
|
if (!contentType)
|
|
25372
25372
|
return false;
|
|
@@ -25569,10 +25569,6 @@ class Query {
|
|
|
25569
25569
|
});
|
|
25570
25570
|
}
|
|
25571
25571
|
}
|
|
25572
|
-
const headers2 = req.headers || {};
|
|
25573
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
25574
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
25575
|
-
}
|
|
25576
25572
|
} catch (e) {
|
|
25577
25573
|
console.error("request beforeFn error", e, req);
|
|
25578
25574
|
return wrapperError({
|
|
@@ -25633,20 +25629,20 @@ class Query {
|
|
|
25633
25629
|
this.afterResponse = fn;
|
|
25634
25630
|
}
|
|
25635
25631
|
async fetchText(urlOrOptions, options) {
|
|
25636
|
-
let _options = {
|
|
25632
|
+
let _options = { ...options };
|
|
25637
25633
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
25638
25634
|
_options.url = urlOrOptions;
|
|
25639
25635
|
}
|
|
25640
25636
|
if (typeof urlOrOptions === "object") {
|
|
25641
25637
|
_options = { ...urlOrOptions, ..._options };
|
|
25642
25638
|
}
|
|
25643
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
25644
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
25645
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
25646
|
-
}
|
|
25647
25639
|
const res = await adapter({
|
|
25640
|
+
method: "GET",
|
|
25648
25641
|
..._options,
|
|
25649
|
-
headers
|
|
25642
|
+
headers: {
|
|
25643
|
+
...this.headers,
|
|
25644
|
+
..._options?.headers || {}
|
|
25645
|
+
}
|
|
25650
25646
|
});
|
|
25651
25647
|
if (res && !res.code) {
|
|
25652
25648
|
return {
|
|
@@ -25658,7 +25654,7 @@ class Query {
|
|
|
25658
25654
|
}
|
|
25659
25655
|
}
|
|
25660
25656
|
|
|
25661
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
25657
|
+
// node_modules/.pnpm/@kevisual+query@0.0.55/node_modules/@kevisual/query/dist/query-browser.js
|
|
25662
25658
|
var isTextForContentType2 = (contentType) => {
|
|
25663
25659
|
if (!contentType)
|
|
25664
25660
|
return false;
|
|
@@ -25861,10 +25857,6 @@ class Query2 {
|
|
|
25861
25857
|
});
|
|
25862
25858
|
}
|
|
25863
25859
|
}
|
|
25864
|
-
const headers2 = req.headers || {};
|
|
25865
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
25866
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
25867
|
-
}
|
|
25868
25860
|
} catch (e) {
|
|
25869
25861
|
console.error("request beforeFn error", e, req);
|
|
25870
25862
|
return wrapperError2({
|
|
@@ -25925,20 +25917,20 @@ class Query2 {
|
|
|
25925
25917
|
this.afterResponse = fn;
|
|
25926
25918
|
}
|
|
25927
25919
|
async fetchText(urlOrOptions, options) {
|
|
25928
|
-
let _options = {
|
|
25920
|
+
let _options = { ...options };
|
|
25929
25921
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
25930
25922
|
_options.url = urlOrOptions;
|
|
25931
25923
|
}
|
|
25932
25924
|
if (typeof urlOrOptions === "object") {
|
|
25933
25925
|
_options = { ...urlOrOptions, ..._options };
|
|
25934
25926
|
}
|
|
25935
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
25936
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
25937
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
25938
|
-
}
|
|
25939
25927
|
const res = await adapter2({
|
|
25928
|
+
method: "GET",
|
|
25940
25929
|
..._options,
|
|
25941
|
-
headers
|
|
25930
|
+
headers: {
|
|
25931
|
+
...this.headers,
|
|
25932
|
+
..._options?.headers || {}
|
|
25933
|
+
}
|
|
25942
25934
|
});
|
|
25943
25935
|
if (res && !res.code) {
|
|
25944
25936
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "envision 命令行工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"basename": "/root/cli",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@kevisual/app": "^0.0.2",
|
|
46
46
|
"@kevisual/auth": "^2.0.3",
|
|
47
47
|
"@kevisual/context": "^0.0.8",
|
|
48
|
-
"@kevisual/router": "^0.1.
|
|
48
|
+
"@kevisual/router": "^0.1.6",
|
|
49
49
|
"@kevisual/use-config": "^1.0.30",
|
|
50
50
|
"@opencode-ai/sdk": "^1.2.27",
|
|
51
51
|
"@types/busboy": "^1.5.4",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"@kevisual/dts": "^0.0.4",
|
|
67
67
|
"@kevisual/load": "^0.0.6",
|
|
68
68
|
"@kevisual/logger": "^0.0.4",
|
|
69
|
-
"@kevisual/query": "0.0.
|
|
70
|
-
"@types/bun": "^1.3.
|
|
69
|
+
"@kevisual/query": "0.0.55",
|
|
70
|
+
"@types/bun": "^1.3.11",
|
|
71
71
|
"@types/crypto-js": "^4.2.2",
|
|
72
72
|
"@types/jsonwebtoken": "^9.0.10",
|
|
73
73
|
"@types/micromatch": "^4.0.10",
|