@kevisual/cli 0.1.31 → 0.1.33
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/bin/cli.js +2 -0
- package/bun.config.ts +5 -0
- package/dist/assistant-opencode.js +92 -72
- package/dist/assistant-server.js +516 -428
- package/dist/assistant.js +56 -43
- package/dist/cli.js +81687 -0
- package/dist/envision.js +29 -34
- package/package.json +15 -11
- package/bun.config.mjs +0 -19
package/dist/assistant.js
CHANGED
|
@@ -37219,7 +37219,7 @@ class Query {
|
|
|
37219
37219
|
}
|
|
37220
37220
|
}
|
|
37221
37221
|
|
|
37222
|
-
// ../node_modules/.pnpm/@kevisual+router@0.
|
|
37222
|
+
// ../node_modules/.pnpm/@kevisual+router@0.2.2/node_modules/@kevisual/router/dist/router-browser.js
|
|
37223
37223
|
var __create3 = Object.create;
|
|
37224
37224
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
37225
37225
|
var __defProp3 = Object.defineProperty;
|
|
@@ -70036,7 +70036,7 @@ function filter(data, query) {
|
|
|
70036
70036
|
return executor.execute(ast, data);
|
|
70037
70037
|
}
|
|
70038
70038
|
|
|
70039
|
-
// ../node_modules/.pnpm/@kevisual+api@0.0.
|
|
70039
|
+
// ../node_modules/.pnpm/@kevisual+api@0.0.65_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
|
|
70040
70040
|
var initApi = async (opts) => {
|
|
70041
70041
|
const router = opts?.router;
|
|
70042
70042
|
const item = opts?.item;
|
|
@@ -70224,7 +70224,7 @@ var getStringHash = (str) => {
|
|
|
70224
70224
|
return crypto2.createHash("md5").update(str).digest("hex");
|
|
70225
70225
|
};
|
|
70226
70226
|
|
|
70227
|
-
// ../node_modules/.pnpm/@kevisual+router@0.
|
|
70227
|
+
// ../node_modules/.pnpm/@kevisual+router@0.2.2/node_modules/@kevisual/router/dist/router.js
|
|
70228
70228
|
import { createRequire as createRequire3 } from "node:module";
|
|
70229
70229
|
import { webcrypto as crypto3 } from "node:crypto";
|
|
70230
70230
|
import http from "node:http";
|
|
@@ -87473,11 +87473,11 @@ var fromJSONSchema22 = (args2 = {}, opts) => {
|
|
|
87473
87473
|
}
|
|
87474
87474
|
return resultArgs;
|
|
87475
87475
|
};
|
|
87476
|
-
var pickValue = ["path", "key", "
|
|
87476
|
+
var pickValue = ["path", "key", "rid", "description", "type", "middleware", "metadata"];
|
|
87477
87477
|
class Route {
|
|
87478
87478
|
path;
|
|
87479
87479
|
key;
|
|
87480
|
-
|
|
87480
|
+
rid;
|
|
87481
87481
|
run;
|
|
87482
87482
|
nextRoute;
|
|
87483
87483
|
description;
|
|
@@ -87495,7 +87495,7 @@ class Route {
|
|
|
87495
87495
|
this.key = key;
|
|
87496
87496
|
const pathKey = `${path7}$$${key}`;
|
|
87497
87497
|
if (opts) {
|
|
87498
|
-
this.
|
|
87498
|
+
this.rid = opts.rid || hashIdMd5Sync(pathKey);
|
|
87499
87499
|
this.run = opts.run;
|
|
87500
87500
|
this.nextRoute = opts.nextRoute;
|
|
87501
87501
|
this.description = opts.description;
|
|
@@ -87507,8 +87507,8 @@ class Route {
|
|
|
87507
87507
|
} else {
|
|
87508
87508
|
this.middleware = [];
|
|
87509
87509
|
}
|
|
87510
|
-
if (!this.
|
|
87511
|
-
this.
|
|
87510
|
+
if (!this.rid) {
|
|
87511
|
+
this.rid = hashIdMd5Sync(pathKey);
|
|
87512
87512
|
}
|
|
87513
87513
|
this.isDebug = opts?.isDebug ?? false;
|
|
87514
87514
|
}
|
|
@@ -87614,14 +87614,14 @@ class QueryRouter {
|
|
|
87614
87614
|
this.routes = this.routes.filter((r) => r.path === route.path && r.key == route.key);
|
|
87615
87615
|
}
|
|
87616
87616
|
removeById(uniqueId) {
|
|
87617
|
-
this.routes = this.routes.filter((r) => r.
|
|
87617
|
+
this.routes = this.routes.filter((r) => r.rid !== uniqueId);
|
|
87618
87618
|
}
|
|
87619
87619
|
async runRoute(path7, key, ctx) {
|
|
87620
87620
|
const route = this.routes.find((r) => r.path === path7 && r.key === key);
|
|
87621
87621
|
const maxNextRoute = this.maxNextRoute;
|
|
87622
87622
|
ctx = ctx || {};
|
|
87623
87623
|
ctx.currentPath = path7;
|
|
87624
|
-
ctx.currentId = route?.
|
|
87624
|
+
ctx.currentId = route?.rid;
|
|
87625
87625
|
ctx.currentKey = key;
|
|
87626
87626
|
ctx.currentRoute = route;
|
|
87627
87627
|
ctx.index = (ctx.index || 0) + 1;
|
|
@@ -87648,11 +87648,11 @@ class QueryRouter {
|
|
|
87648
87648
|
let route2;
|
|
87649
87649
|
const isString22 = typeof item === "string";
|
|
87650
87650
|
if (isString22) {
|
|
87651
|
-
route2 = this.routes.find((r) => r.
|
|
87651
|
+
route2 = this.routes.find((r) => r.rid === item);
|
|
87652
87652
|
} else {
|
|
87653
87653
|
route2 = this.routes.find((r) => {
|
|
87654
|
-
if (item.
|
|
87655
|
-
return r.
|
|
87654
|
+
if (item.rid) {
|
|
87655
|
+
return r.rid === item.rid;
|
|
87656
87656
|
} else {
|
|
87657
87657
|
return r.path === item.path && r.key == item.key;
|
|
87658
87658
|
}
|
|
@@ -87701,8 +87701,8 @@ class QueryRouter {
|
|
|
87701
87701
|
ctx.message = e.message;
|
|
87702
87702
|
ctx.body = null;
|
|
87703
87703
|
} else {
|
|
87704
|
-
console.error(`[router error] fn:${route.path}-${route.key}:${route.
|
|
87705
|
-
console.error(`[router error] middleware:${middleware.path}-${middleware.key}:${middleware.
|
|
87704
|
+
console.error(`[router error] fn:${route.path}-${route.key}:${route.rid}`);
|
|
87705
|
+
console.error(`[router error] middleware:${middleware.path}-${middleware.key}:${middleware.rid}`);
|
|
87706
87706
|
console.error(e);
|
|
87707
87707
|
ctx.code = 500;
|
|
87708
87708
|
ctx.message = "Internal Server Error";
|
|
@@ -87730,7 +87730,7 @@ class QueryRouter {
|
|
|
87730
87730
|
ctx.code = e.code;
|
|
87731
87731
|
ctx.message = e.message;
|
|
87732
87732
|
} else {
|
|
87733
|
-
console.error(`[router error] fn:${route.path}-${route.key}:${route.
|
|
87733
|
+
console.error(`[router error] fn:${route.path}-${route.key}:${route.rid}`);
|
|
87734
87734
|
console.error(`[router error] error`, e);
|
|
87735
87735
|
ctx.code = 500;
|
|
87736
87736
|
ctx.message = "Internal Server Error";
|
|
@@ -87746,8 +87746,8 @@ class QueryRouter {
|
|
|
87746
87746
|
if (route.nextRoute.path || route.nextRoute.key) {
|
|
87747
87747
|
path22 = route.nextRoute.path;
|
|
87748
87748
|
key2 = route.nextRoute.key;
|
|
87749
|
-
} else if (route.nextRoute.
|
|
87750
|
-
const nextRoute = this.routes.find((r) => r.
|
|
87749
|
+
} else if (route.nextRoute.rid) {
|
|
87750
|
+
const nextRoute = this.routes.find((r) => r.rid === route.nextRoute.rid);
|
|
87751
87751
|
if (nextRoute) {
|
|
87752
87752
|
path22 = nextRoute.path;
|
|
87753
87753
|
key2 = nextRoute.key;
|
|
@@ -87811,8 +87811,8 @@ class QueryRouter {
|
|
|
87811
87811
|
let key = message.key;
|
|
87812
87812
|
if (path7) {
|
|
87813
87813
|
return await this.parse({ ...message, path: path7, key }, { ...this.context, ...ctx });
|
|
87814
|
-
} else if (message.
|
|
87815
|
-
const route = this.routes.find((r) => r.
|
|
87814
|
+
} else if (message.rid) {
|
|
87815
|
+
const route = this.routes.find((r) => r.rid === message.rid);
|
|
87816
87816
|
if (route) {
|
|
87817
87817
|
path7 = route.path;
|
|
87818
87818
|
key = route.key;
|
|
@@ -87885,10 +87885,10 @@ class QueryRouter {
|
|
|
87885
87885
|
return this.routes.find((r) => r.path === path7 && r.key === key);
|
|
87886
87886
|
}
|
|
87887
87887
|
findRoute(opts) {
|
|
87888
|
-
const { path: path7, key,
|
|
87888
|
+
const { path: path7, key, rid } = opts || {};
|
|
87889
87889
|
return this.routes.find((r) => {
|
|
87890
|
-
if (
|
|
87891
|
-
return r.
|
|
87890
|
+
if (rid) {
|
|
87891
|
+
return r.rid === rid;
|
|
87892
87892
|
}
|
|
87893
87893
|
if (path7) {
|
|
87894
87894
|
if (key !== undefined) {
|
|
@@ -87909,14 +87909,14 @@ class QueryRouter {
|
|
|
87909
87909
|
const tokenUser = ctx.state;
|
|
87910
87910
|
let isUser = !!tokenUser;
|
|
87911
87911
|
const list4 = this.getList(opts?.filter).filter((item) => {
|
|
87912
|
-
if (item.
|
|
87912
|
+
if (item.rid === "auth" || item.rid === "auth-can" || item.rid === "check-auth-admin" || item.rid === "auth-admin") {
|
|
87913
87913
|
return false;
|
|
87914
87914
|
}
|
|
87915
87915
|
return true;
|
|
87916
87916
|
});
|
|
87917
87917
|
ctx.body = {
|
|
87918
87918
|
list: list4.map((item) => {
|
|
87919
|
-
const route = pick2(item, ["
|
|
87919
|
+
const route = pick2(item, ["rid", "path", "key", "description", "middleware", "metadata"]);
|
|
87920
87920
|
return toJSONSchemaRoute(route);
|
|
87921
87921
|
}),
|
|
87922
87922
|
isUser
|
|
@@ -87986,14 +87986,14 @@ class QueryRouterServer2 extends QueryRouter {
|
|
|
87986
87986
|
return super.run(msg, ctx);
|
|
87987
87987
|
}
|
|
87988
87988
|
async runAction(api2, payload, ctx) {
|
|
87989
|
-
const { path: path7, key,
|
|
87990
|
-
return this.run({ path: path7, key,
|
|
87989
|
+
const { path: path7, key, rid } = api2;
|
|
87990
|
+
return this.run({ path: path7, key, rid, payload }, ctx);
|
|
87991
87991
|
}
|
|
87992
87992
|
async createAuth(fun) {
|
|
87993
87993
|
this.route({
|
|
87994
87994
|
path: "auth",
|
|
87995
87995
|
key: "auth",
|
|
87996
|
-
|
|
87996
|
+
rid: "auth",
|
|
87997
87997
|
description: "token验证"
|
|
87998
87998
|
}).define(async (ctx) => {
|
|
87999
87999
|
if (fun) {
|
|
@@ -88003,7 +88003,7 @@ class QueryRouterServer2 extends QueryRouter {
|
|
|
88003
88003
|
this.route({
|
|
88004
88004
|
path: "auth-admin",
|
|
88005
88005
|
key: "auth-admin",
|
|
88006
|
-
|
|
88006
|
+
rid: "auth-admin",
|
|
88007
88007
|
description: "admin token验证",
|
|
88008
88008
|
middleware: ["auth"]
|
|
88009
88009
|
}).define(async (ctx) => {
|
|
@@ -88014,7 +88014,7 @@ class QueryRouterServer2 extends QueryRouter {
|
|
|
88014
88014
|
this.route({
|
|
88015
88015
|
path: "auth-can",
|
|
88016
88016
|
key: "auth-can",
|
|
88017
|
-
|
|
88017
|
+
rid: "auth-can",
|
|
88018
88018
|
description: "权限验证"
|
|
88019
88019
|
}).define(async (ctx) => {
|
|
88020
88020
|
if (fun) {
|
|
@@ -88946,7 +88946,7 @@ class App extends QueryRouterServer2 {
|
|
|
88946
88946
|
}
|
|
88947
88947
|
}
|
|
88948
88948
|
|
|
88949
|
-
// ../node_modules/.pnpm/@kevisual+router@0.
|
|
88949
|
+
// ../node_modules/.pnpm/@kevisual+router@0.2.2/node_modules/@kevisual/router/dist/router-simple.js
|
|
88950
88950
|
import url5 from "node:url";
|
|
88951
88951
|
var __create5 = Object.create;
|
|
88952
88952
|
var __getProtoOf5 = Object.getPrototypeOf;
|
|
@@ -90751,7 +90751,7 @@ ${line}`;
|
|
|
90751
90751
|
}
|
|
90752
90752
|
}
|
|
90753
90753
|
|
|
90754
|
-
// ../node_modules/.pnpm/@kevisual+api@0.0.
|
|
90754
|
+
// ../node_modules/.pnpm/@kevisual+api@0.0.65_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
|
|
90755
90755
|
import { homedir as homedir2 } from "node:os";
|
|
90756
90756
|
import { join, dirname } from "node:path";
|
|
90757
90757
|
import fs12 from "node:fs";
|
|
@@ -90761,15 +90761,29 @@ var __getProtoOf6 = Object.getPrototypeOf;
|
|
|
90761
90761
|
var __defProp6 = Object.defineProperty;
|
|
90762
90762
|
var __getOwnPropNames6 = Object.getOwnPropertyNames;
|
|
90763
90763
|
var __hasOwnProp6 = Object.prototype.hasOwnProperty;
|
|
90764
|
+
function __accessProp5(key) {
|
|
90765
|
+
return this[key];
|
|
90766
|
+
}
|
|
90767
|
+
var __toESMCache_node5;
|
|
90768
|
+
var __toESMCache_esm5;
|
|
90764
90769
|
var __toESM6 = (mod, isNodeMode, target) => {
|
|
90770
|
+
var canCache = mod != null && typeof mod === "object";
|
|
90771
|
+
if (canCache) {
|
|
90772
|
+
var cache = isNodeMode ? __toESMCache_node5 ??= new WeakMap : __toESMCache_esm5 ??= new WeakMap;
|
|
90773
|
+
var cached3 = cache.get(mod);
|
|
90774
|
+
if (cached3)
|
|
90775
|
+
return cached3;
|
|
90776
|
+
}
|
|
90765
90777
|
target = mod != null ? __create6(__getProtoOf6(mod)) : {};
|
|
90766
90778
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp6(target, "default", { value: mod, enumerable: true }) : target;
|
|
90767
90779
|
for (let key of __getOwnPropNames6(mod))
|
|
90768
90780
|
if (!__hasOwnProp6.call(to, key))
|
|
90769
90781
|
__defProp6(to, key, {
|
|
90770
|
-
get: (
|
|
90782
|
+
get: __accessProp5.bind(mod, key),
|
|
90771
90783
|
enumerable: true
|
|
90772
90784
|
});
|
|
90785
|
+
if (canCache)
|
|
90786
|
+
cache.set(mod, to);
|
|
90773
90787
|
return to;
|
|
90774
90788
|
};
|
|
90775
90789
|
var __commonJS6 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
@@ -91151,10 +91165,6 @@ class Query3 {
|
|
|
91151
91165
|
});
|
|
91152
91166
|
}
|
|
91153
91167
|
}
|
|
91154
|
-
const headers2 = req.headers || {};
|
|
91155
|
-
if (options?.token && !headers2["Authorization"]) {
|
|
91156
|
-
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
91157
|
-
}
|
|
91158
91168
|
} catch (e) {
|
|
91159
91169
|
console.error("request beforeFn error", e, req);
|
|
91160
91170
|
return wrapperError3({
|
|
@@ -91215,20 +91225,20 @@ class Query3 {
|
|
|
91215
91225
|
this.afterResponse = fn;
|
|
91216
91226
|
}
|
|
91217
91227
|
async fetchText(urlOrOptions, options) {
|
|
91218
|
-
let _options = {
|
|
91228
|
+
let _options = { ...options };
|
|
91219
91229
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
91220
91230
|
_options.url = urlOrOptions;
|
|
91221
91231
|
}
|
|
91222
91232
|
if (typeof urlOrOptions === "object") {
|
|
91223
91233
|
_options = { ...urlOrOptions, ..._options };
|
|
91224
91234
|
}
|
|
91225
|
-
const headers = { ...this.headers, ..._options.headers };
|
|
91226
|
-
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
91227
|
-
headers["Authorization"] = `Bearer ${options.token}`;
|
|
91228
|
-
}
|
|
91229
91235
|
const res = await adapter3({
|
|
91236
|
+
method: "GET",
|
|
91230
91237
|
..._options,
|
|
91231
|
-
headers
|
|
91238
|
+
headers: {
|
|
91239
|
+
...this.headers,
|
|
91240
|
+
..._options?.headers || {}
|
|
91241
|
+
}
|
|
91232
91242
|
});
|
|
91233
91243
|
if (res && !res.code) {
|
|
91234
91244
|
return {
|
|
@@ -92097,6 +92107,9 @@ class QueryLogin extends BaseQuery {
|
|
|
92097
92107
|
const res = await this.refreshLoginUser();
|
|
92098
92108
|
if (res.code === 200) {
|
|
92099
92109
|
return res.data?.accessToken || null;
|
|
92110
|
+
} else {
|
|
92111
|
+
this.storage.removeItem("token");
|
|
92112
|
+
await this.cacheStore.clearCurrentUser();
|
|
92100
92113
|
}
|
|
92101
92114
|
return null;
|
|
92102
92115
|
}
|