@kevisual/cli 0.1.5 → 0.1.6
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 +273 -148
- package/dist/assistant-server.js +263 -159
- package/dist/assistant.js +115 -63
- package/dist/envision.js +1482 -1368
- package/package.json +4 -5
|
@@ -21593,7 +21593,7 @@ var require_lib2 = __commonJS((exports, module) => {
|
|
|
21593
21593
|
};
|
|
21594
21594
|
});
|
|
21595
21595
|
|
|
21596
|
-
// ../node_modules/.pnpm/@kevisual+router@0.0.
|
|
21596
|
+
// ../node_modules/.pnpm/@kevisual+router@0.0.80/node_modules/@kevisual/router/dist/router.js
|
|
21597
21597
|
import { createRequire as createRequire2 } from "node:module";
|
|
21598
21598
|
import { webcrypto as crypto2 } from "node:crypto";
|
|
21599
21599
|
import http from "node:http";
|
|
@@ -38257,11 +38257,101 @@ var nanoid3 = customAlphabet("abcdefghijklmnopqrstuvwxyz", 16);
|
|
|
38257
38257
|
var randomId = (length = 8, affix = "") => {
|
|
38258
38258
|
return affix + nanoid3(length);
|
|
38259
38259
|
};
|
|
38260
|
+
var extractArgs = (args) => {
|
|
38261
|
+
if (args && typeof args === "object" && typeof args.shape === "object") {
|
|
38262
|
+
return args.shape;
|
|
38263
|
+
}
|
|
38264
|
+
return args || {};
|
|
38265
|
+
};
|
|
38266
|
+
var toJSONSchema2 = (args, opts) => {
|
|
38267
|
+
const mergeObject = opts?.mergeObject ?? false;
|
|
38268
|
+
if (!args)
|
|
38269
|
+
return {};
|
|
38270
|
+
const _override = ({ jsonSchema, path, zodSchema }) => {
|
|
38271
|
+
if (Array.isArray(path) && path.length > 0) {
|
|
38272
|
+
return;
|
|
38273
|
+
}
|
|
38274
|
+
const isOptional = zodSchema.isOptional?.();
|
|
38275
|
+
if (isOptional) {
|
|
38276
|
+
jsonSchema.optional = true;
|
|
38277
|
+
}
|
|
38278
|
+
};
|
|
38279
|
+
const isError = (keys2) => {
|
|
38280
|
+
const errorKeys = ["toJSONSchema", "def", "type", "parse"];
|
|
38281
|
+
const hasErrorKeys = errorKeys.every((key) => keys2.includes(key));
|
|
38282
|
+
return hasErrorKeys;
|
|
38283
|
+
};
|
|
38284
|
+
const override = opts?.override || _override;
|
|
38285
|
+
if (mergeObject) {
|
|
38286
|
+
if (typeof args === "object" && typeof args.toJSONSchema === "function") {
|
|
38287
|
+
return args.toJSONSchema();
|
|
38288
|
+
}
|
|
38289
|
+
if (isError(Object.keys(args))) {
|
|
38290
|
+
return {};
|
|
38291
|
+
}
|
|
38292
|
+
const schema = exports_external.object(args);
|
|
38293
|
+
return schema.toJSONSchema();
|
|
38294
|
+
}
|
|
38295
|
+
args = extractArgs(args);
|
|
38296
|
+
let keys = Object.keys(args);
|
|
38297
|
+
if (isError(keys)) {
|
|
38298
|
+
console.error(`[toJSONSchema error]: 解析到的 schema 可能不正确,包含了zod默认的value的schema. 请检查输入的 schema 是否正确。`);
|
|
38299
|
+
args = {};
|
|
38300
|
+
keys = [];
|
|
38301
|
+
}
|
|
38302
|
+
if (mergeObject) {}
|
|
38303
|
+
let newArgs = {};
|
|
38304
|
+
for (let key of keys) {
|
|
38305
|
+
const item = args[key];
|
|
38306
|
+
if (item && typeof item === "object" && typeof item.toJSONSchema === "function") {
|
|
38307
|
+
newArgs[key] = item.toJSONSchema({ override });
|
|
38308
|
+
} else {
|
|
38309
|
+
newArgs[key] = args[key];
|
|
38310
|
+
}
|
|
38311
|
+
}
|
|
38312
|
+
return newArgs;
|
|
38313
|
+
};
|
|
38314
|
+
var fromJSONSchema2 = (args = {}, opts) => {
|
|
38315
|
+
let resultArgs = null;
|
|
38316
|
+
const mergeObject = opts?.mergeObject ?? false;
|
|
38317
|
+
if (args["$schema"] || args.type === "object" && args.properties && typeof args.properties === "object") {
|
|
38318
|
+
const objectSchema = exports_external.fromJSONSchema(args);
|
|
38319
|
+
const extract = extractArgs(objectSchema);
|
|
38320
|
+
const keys = Object.keys(extract);
|
|
38321
|
+
const newArgs = {};
|
|
38322
|
+
for (let key of keys) {
|
|
38323
|
+
newArgs[key] = extract[key];
|
|
38324
|
+
}
|
|
38325
|
+
resultArgs = newArgs;
|
|
38326
|
+
}
|
|
38327
|
+
if (!resultArgs) {
|
|
38328
|
+
const keys = Object.keys(args);
|
|
38329
|
+
const newArgs = {};
|
|
38330
|
+
for (let key of keys) {
|
|
38331
|
+
const item = args[key];
|
|
38332
|
+
newArgs[key] = exports_external.fromJSONSchema(item);
|
|
38333
|
+
if (item.optional) {
|
|
38334
|
+
newArgs[key] = newArgs[key].optional();
|
|
38335
|
+
}
|
|
38336
|
+
}
|
|
38337
|
+
resultArgs = newArgs;
|
|
38338
|
+
}
|
|
38339
|
+
if (mergeObject) {
|
|
38340
|
+
resultArgs = exports_external.object(resultArgs);
|
|
38341
|
+
}
|
|
38342
|
+
return resultArgs;
|
|
38343
|
+
};
|
|
38260
38344
|
var pickValue = ["path", "key", "id", "description", "type", "middleware", "metadata"];
|
|
38261
38345
|
var tool = {
|
|
38262
38346
|
schema: exports_external
|
|
38263
38347
|
};
|
|
38264
38348
|
var createSkill = (skill) => {
|
|
38349
|
+
if (skill.tags) {
|
|
38350
|
+
const hasOpencode = skill.tags.includes("opencode");
|
|
38351
|
+
if (!hasOpencode) {
|
|
38352
|
+
skill.tags.push("opencode");
|
|
38353
|
+
}
|
|
38354
|
+
}
|
|
38265
38355
|
return {
|
|
38266
38356
|
args: {},
|
|
38267
38357
|
...skill
|
|
@@ -38278,7 +38368,6 @@ class Route {
|
|
|
38278
38368
|
metadata;
|
|
38279
38369
|
middleware;
|
|
38280
38370
|
type = "route";
|
|
38281
|
-
data;
|
|
38282
38371
|
isDebug;
|
|
38283
38372
|
constructor(path = "", key = "", opts) {
|
|
38284
38373
|
if (!path) {
|
|
@@ -38370,45 +38459,19 @@ class Route {
|
|
|
38370
38459
|
addTo(router, opts) {
|
|
38371
38460
|
router.add(this, opts);
|
|
38372
38461
|
}
|
|
38373
|
-
setData(data) {
|
|
38374
|
-
this.data = data;
|
|
38375
|
-
return this;
|
|
38376
|
-
}
|
|
38377
38462
|
throw(...args) {
|
|
38378
38463
|
throw new CustomError(...args);
|
|
38379
38464
|
}
|
|
38380
38465
|
}
|
|
38381
|
-
var
|
|
38466
|
+
var toJSONSchemaRoute = (route) => {
|
|
38382
38467
|
const pickValues = pick(route, pickValue);
|
|
38383
38468
|
if (pickValues?.metadata?.args) {
|
|
38384
|
-
|
|
38385
|
-
const keys = Object.keys(args);
|
|
38386
|
-
const newArgs = {};
|
|
38387
|
-
for (let key of keys) {
|
|
38388
|
-
const item = args[key];
|
|
38389
|
-
if (item && typeof item === "object" && typeof item.toJSONSchema === "function") {
|
|
38390
|
-
newArgs[key] = item.toJSONSchema();
|
|
38391
|
-
} else {
|
|
38392
|
-
newArgs[key] = args[key];
|
|
38393
|
-
}
|
|
38394
|
-
}
|
|
38395
|
-
pickValues.metadata.args = newArgs;
|
|
38469
|
+
pickValues.metadata.args = toJSONSchema3(pickValues?.metadata?.args, { mergeObject: false });
|
|
38396
38470
|
}
|
|
38397
38471
|
return pickValues;
|
|
38398
38472
|
};
|
|
38399
|
-
var
|
|
38400
|
-
|
|
38401
|
-
if (!args)
|
|
38402
|
-
return route;
|
|
38403
|
-
const keys = Object.keys(args);
|
|
38404
|
-
const newArgs = {};
|
|
38405
|
-
for (let key of keys) {
|
|
38406
|
-
const item = args[key];
|
|
38407
|
-
newArgs[key] = exports_external.fromJSONSchema(item);
|
|
38408
|
-
}
|
|
38409
|
-
route.metadata.args = newArgs;
|
|
38410
|
-
return route;
|
|
38411
|
-
};
|
|
38473
|
+
var toJSONSchema3 = toJSONSchema2;
|
|
38474
|
+
var fromJSONSchema3 = fromJSONSchema2;
|
|
38412
38475
|
|
|
38413
38476
|
class QueryRouter {
|
|
38414
38477
|
appId = "";
|
|
@@ -38662,20 +38725,6 @@ class QueryRouter {
|
|
|
38662
38725
|
getList(filter) {
|
|
38663
38726
|
return this.routes.filter(filter || (() => true)).map((r) => {
|
|
38664
38727
|
const pickValues = pick(r, pickValue);
|
|
38665
|
-
if (pickValues?.metadata?.args) {
|
|
38666
|
-
const args = pickValues.metadata.args;
|
|
38667
|
-
const keys = Object.keys(args);
|
|
38668
|
-
const newArgs = {};
|
|
38669
|
-
for (let key of keys) {
|
|
38670
|
-
const item = args[key];
|
|
38671
|
-
if (item && typeof item === "object" && typeof item.toJSONSchema === "function") {
|
|
38672
|
-
newArgs[key] = item.toJSONSchema();
|
|
38673
|
-
} else {
|
|
38674
|
-
newArgs[key] = args[key];
|
|
38675
|
-
}
|
|
38676
|
-
}
|
|
38677
|
-
pickValues.metadata.args = newArgs;
|
|
38678
|
-
}
|
|
38679
38728
|
return pickValues;
|
|
38680
38729
|
});
|
|
38681
38730
|
}
|
|
@@ -38747,7 +38796,7 @@ class QueryRouter {
|
|
|
38747
38796
|
ctx.body = {
|
|
38748
38797
|
list: list.map((item) => {
|
|
38749
38798
|
const route = pick(item, ["id", "path", "key", "description", "middleware", "metadata"]);
|
|
38750
|
-
return
|
|
38799
|
+
return toJSONSchemaRoute(route);
|
|
38751
38800
|
}),
|
|
38752
38801
|
isUser
|
|
38753
38802
|
};
|
|
@@ -38763,8 +38812,8 @@ class QueryRouter {
|
|
|
38763
38812
|
}
|
|
38764
38813
|
return listenProcess({ app: this, params, ...opts });
|
|
38765
38814
|
}
|
|
38766
|
-
toJSONSchema =
|
|
38767
|
-
fromJSONSchema =
|
|
38815
|
+
toJSONSchema = toJSONSchema3;
|
|
38816
|
+
fromJSONSchema = fromJSONSchema3;
|
|
38768
38817
|
}
|
|
38769
38818
|
var isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
38770
38819
|
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
|
|
@@ -39707,7 +39756,7 @@ class App extends QueryRouter {
|
|
|
39707
39756
|
}
|
|
39708
39757
|
}
|
|
39709
39758
|
|
|
39710
|
-
// ../node_modules/.pnpm/@kevisual+router@0.0.
|
|
39759
|
+
// ../node_modules/.pnpm/@kevisual+router@0.0.80/node_modules/@kevisual/router/dist/router-simple.js
|
|
39711
39760
|
import url3 from "node:url";
|
|
39712
39761
|
var __create3 = Object.create;
|
|
39713
39762
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
@@ -49869,23 +49918,17 @@ var getEnvToken = () => {
|
|
|
49869
49918
|
return envTokne;
|
|
49870
49919
|
};
|
|
49871
49920
|
|
|
49872
|
-
// ../node_modules/.pnpm/@kevisual+query@0.0.
|
|
49921
|
+
// ../node_modules/.pnpm/@kevisual+query@0.0.49/node_modules/@kevisual/query/dist/query-browser.js
|
|
49873
49922
|
var isTextForContentType = (contentType) => {
|
|
49874
49923
|
if (!contentType)
|
|
49875
49924
|
return false;
|
|
49876
|
-
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded", "md"];
|
|
49925
|
+
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded", "md", "json"];
|
|
49877
49926
|
return textTypes.some((type) => contentType.includes(type));
|
|
49878
49927
|
};
|
|
49879
49928
|
var adapter = async (opts = {}, overloadOpts) => {
|
|
49880
49929
|
const controller = new AbortController;
|
|
49881
49930
|
const signal = controller.signal;
|
|
49882
49931
|
const isPostFile = opts.isPostFile || false;
|
|
49883
|
-
let responseType = opts.responseType || "json";
|
|
49884
|
-
if (opts.isBlob) {
|
|
49885
|
-
responseType = "blob";
|
|
49886
|
-
} else if (opts.isText) {
|
|
49887
|
-
responseType = "text";
|
|
49888
|
-
}
|
|
49889
49932
|
const timeout = opts.timeout || 60000 * 3;
|
|
49890
49933
|
const timer = setTimeout(() => {
|
|
49891
49934
|
controller.abort();
|
|
@@ -49944,21 +49987,31 @@ var adapter = async (opts = {}, overloadOpts) => {
|
|
|
49944
49987
|
headers
|
|
49945
49988
|
}).then(async (response) => {
|
|
49946
49989
|
const contentType = response.headers.get("Content-Type");
|
|
49947
|
-
if (responseType === "blob") {
|
|
49948
|
-
return await response.blob();
|
|
49949
|
-
}
|
|
49950
|
-
const isText = responseType === "text";
|
|
49951
49990
|
const isJson = contentType && contentType.includes("application/json");
|
|
49952
|
-
|
|
49953
|
-
|
|
49991
|
+
const isSuccess = response.ok;
|
|
49992
|
+
if (isJson) {
|
|
49993
|
+
const json2 = await response.json();
|
|
49994
|
+
if (json2?.code) {
|
|
49995
|
+
return json2;
|
|
49996
|
+
}
|
|
49997
|
+
return {
|
|
49998
|
+
code: isSuccess ? 200 : response.status,
|
|
49999
|
+
status: response.status,
|
|
50000
|
+
data: json2
|
|
50001
|
+
};
|
|
49954
50002
|
} else if (isTextForContentType(contentType)) {
|
|
49955
50003
|
return {
|
|
49956
|
-
code: response.status,
|
|
50004
|
+
code: isSuccess ? 200 : response.status,
|
|
49957
50005
|
status: response.status,
|
|
49958
50006
|
data: await response.text()
|
|
49959
50007
|
};
|
|
49960
50008
|
} else {
|
|
49961
|
-
return
|
|
50009
|
+
return {
|
|
50010
|
+
code: isSuccess ? 200 : response.status,
|
|
50011
|
+
status: response.status,
|
|
50012
|
+
data: "非文本非JSON响应, 请手动处理response。",
|
|
50013
|
+
response
|
|
50014
|
+
};
|
|
49962
50015
|
}
|
|
49963
50016
|
}).catch((err) => {
|
|
49964
50017
|
if (err.name === "AbortError") {
|
|
@@ -49978,16 +50031,14 @@ var adapter = async (opts = {}, overloadOpts) => {
|
|
|
49978
50031
|
var wrapperError = ({ code, message }) => {
|
|
49979
50032
|
const result = {
|
|
49980
50033
|
code: code || 500,
|
|
49981
|
-
|
|
49982
|
-
message: message || "api request error",
|
|
49983
|
-
showError: (fn) => {},
|
|
49984
|
-
noMsg: true
|
|
50034
|
+
message: message || "请求错误"
|
|
49985
50035
|
};
|
|
49986
50036
|
return result;
|
|
49987
50037
|
};
|
|
49988
50038
|
|
|
49989
50039
|
class Query {
|
|
49990
50040
|
adapter;
|
|
50041
|
+
baseURL;
|
|
49991
50042
|
url;
|
|
49992
50043
|
beforeRequest;
|
|
49993
50044
|
afterResponse;
|
|
@@ -49995,11 +50046,20 @@ class Query {
|
|
|
49995
50046
|
timeout;
|
|
49996
50047
|
stop;
|
|
49997
50048
|
qws;
|
|
49998
|
-
|
|
50049
|
+
tokenName;
|
|
50050
|
+
storage;
|
|
50051
|
+
token;
|
|
49999
50052
|
constructor(opts) {
|
|
50000
50053
|
this.adapter = opts?.adapter || adapter;
|
|
50054
|
+
this.tokenName = opts?.tokenName || "token";
|
|
50055
|
+
this.storage = opts?.storage || globalThis?.localStorage;
|
|
50001
50056
|
const defaultURL = opts?.isClient ? "/client/router" : "/api/router";
|
|
50002
50057
|
this.url = opts?.url || defaultURL;
|
|
50058
|
+
if (this.url.startsWith("http")) {
|
|
50059
|
+
const urlObj = new URL(this.url);
|
|
50060
|
+
this.baseURL = urlObj.origin;
|
|
50061
|
+
}
|
|
50062
|
+
this.baseURL = opts?.baseURL || this.baseURL;
|
|
50003
50063
|
this.headers = opts?.headers || {
|
|
50004
50064
|
"Content-Type": "application/json"
|
|
50005
50065
|
};
|
|
@@ -50008,7 +50068,7 @@ class Query {
|
|
|
50008
50068
|
this.beforeRequest = opts.beforeRequest;
|
|
50009
50069
|
} else {
|
|
50010
50070
|
this.beforeRequest = async (opts2) => {
|
|
50011
|
-
const token =
|
|
50071
|
+
const token = this.token || this.storage?.getItem?.(this.tokenName);
|
|
50012
50072
|
if (token) {
|
|
50013
50073
|
opts2.headers = {
|
|
50014
50074
|
...opts2.headers,
|
|
@@ -50030,7 +50090,6 @@ class Query {
|
|
|
50030
50090
|
}
|
|
50031
50091
|
async post(body, options) {
|
|
50032
50092
|
const url4 = options?.url || this.url;
|
|
50033
|
-
console.log("query post", url4, body, options);
|
|
50034
50093
|
const { headers, adapter: adapter2, beforeRequest, afterResponse, timeout, ...rest } = options || {};
|
|
50035
50094
|
const _headers = { ...this.headers, ...headers };
|
|
50036
50095
|
const _adapter = adapter2 || this.adapter;
|
|
@@ -50044,13 +50103,20 @@ class Query {
|
|
|
50044
50103
|
timeout: _timeout,
|
|
50045
50104
|
...rest
|
|
50046
50105
|
};
|
|
50106
|
+
const isStartsWithHttp = req.url.startsWith("http");
|
|
50107
|
+
if (!isStartsWithHttp) {
|
|
50108
|
+
if (this.baseURL) {
|
|
50109
|
+
const baseURL = new URL(this.baseURL || globalThis?.location?.origin).origin;
|
|
50110
|
+
req.url = baseURL + req.url;
|
|
50111
|
+
}
|
|
50112
|
+
}
|
|
50047
50113
|
try {
|
|
50048
50114
|
if (_beforeRequest) {
|
|
50049
50115
|
const res = await _beforeRequest(req);
|
|
50050
50116
|
if (res === false) {
|
|
50051
50117
|
return wrapperError({
|
|
50052
50118
|
code: 500,
|
|
50053
|
-
message: "
|
|
50119
|
+
message: "请求取消",
|
|
50054
50120
|
req
|
|
50055
50121
|
});
|
|
50056
50122
|
}
|
|
@@ -50059,13 +50125,13 @@ class Query {
|
|
|
50059
50125
|
console.error("request beforeFn error", e, req);
|
|
50060
50126
|
return wrapperError({
|
|
50061
50127
|
code: 500,
|
|
50062
|
-
message: "
|
|
50128
|
+
message: "请求在请求前处理时发生错误",
|
|
50063
50129
|
req
|
|
50064
50130
|
});
|
|
50065
50131
|
}
|
|
50066
50132
|
if (this.stop && !options?.noStop) {
|
|
50067
50133
|
const that = this;
|
|
50068
|
-
await new Promise((resolve) => {
|
|
50134
|
+
const res = await new Promise((resolve) => {
|
|
50069
50135
|
let timer = 0;
|
|
50070
50136
|
const detect = setInterval(() => {
|
|
50071
50137
|
if (!that.stop) {
|
|
@@ -50073,11 +50139,20 @@ class Query {
|
|
|
50073
50139
|
resolve(true);
|
|
50074
50140
|
}
|
|
50075
50141
|
timer++;
|
|
50076
|
-
if (timer >
|
|
50077
|
-
console.error("
|
|
50142
|
+
if (timer > 5) {
|
|
50143
|
+
console.error("等待请求失败:", req.url, timer);
|
|
50144
|
+
clearInterval(detect);
|
|
50145
|
+
resolve(false);
|
|
50078
50146
|
}
|
|
50079
50147
|
}, 1000);
|
|
50080
50148
|
});
|
|
50149
|
+
if (!res) {
|
|
50150
|
+
return wrapperError({
|
|
50151
|
+
code: 500,
|
|
50152
|
+
message: "请求取消,可能是因为用户未登录或者token过期",
|
|
50153
|
+
req
|
|
50154
|
+
});
|
|
50155
|
+
}
|
|
50081
50156
|
}
|
|
50082
50157
|
return _adapter(req).then(async (res) => {
|
|
50083
50158
|
try {
|
|
@@ -50090,10 +50165,10 @@ class Query {
|
|
|
50090
50165
|
}
|
|
50091
50166
|
return res;
|
|
50092
50167
|
} catch (e) {
|
|
50093
|
-
console.error("
|
|
50168
|
+
console.error("请求在响应后处理时发生错误", e, req);
|
|
50094
50169
|
return wrapperError({
|
|
50095
50170
|
code: 500,
|
|
50096
|
-
message: "
|
|
50171
|
+
message: "请求在响应后处理时发生错误",
|
|
50097
50172
|
req
|
|
50098
50173
|
});
|
|
50099
50174
|
}
|
|
@@ -50131,7 +50206,7 @@ class Query {
|
|
|
50131
50206
|
}
|
|
50132
50207
|
}
|
|
50133
50208
|
|
|
50134
|
-
// ../node_modules/.pnpm/@kevisual+router@0.0.
|
|
50209
|
+
// ../node_modules/.pnpm/@kevisual+router@0.0.80/node_modules/@kevisual/router/dist/router-browser.js
|
|
50135
50210
|
var __create5 = Object.create;
|
|
50136
50211
|
var __getProtoOf5 = Object.getPrototypeOf;
|
|
50137
50212
|
var __defProp5 = Object.defineProperty;
|
|
@@ -50359,7 +50434,7 @@ __export3(exports_external2, {
|
|
|
50359
50434
|
transform: () => transform2,
|
|
50360
50435
|
toUpperCase: () => _toUpperCase2,
|
|
50361
50436
|
toLowerCase: () => _toLowerCase2,
|
|
50362
|
-
toJSONSchema: () =>
|
|
50437
|
+
toJSONSchema: () => toJSONSchema4,
|
|
50363
50438
|
templateLiteral: () => templateLiteral2,
|
|
50364
50439
|
symbol: () => symbol2,
|
|
50365
50440
|
superRefine: () => superRefine2,
|
|
@@ -50452,7 +50527,7 @@ __export3(exports_external2, {
|
|
|
50452
50527
|
globalRegistry: () => globalRegistry2,
|
|
50453
50528
|
getErrorMap: () => getErrorMap2,
|
|
50454
50529
|
function: () => _function2,
|
|
50455
|
-
fromJSONSchema: () =>
|
|
50530
|
+
fromJSONSchema: () => fromJSONSchema4,
|
|
50456
50531
|
formatError: () => formatError2,
|
|
50457
50532
|
float64: () => float642,
|
|
50458
50533
|
float32: () => float322,
|
|
@@ -50579,7 +50654,7 @@ __export3(exports_core22, {
|
|
|
50579
50654
|
version: () => version2,
|
|
50580
50655
|
util: () => exports_util2,
|
|
50581
50656
|
treeifyError: () => treeifyError2,
|
|
50582
|
-
toJSONSchema: () =>
|
|
50657
|
+
toJSONSchema: () => toJSONSchema4,
|
|
50583
50658
|
toDotPath: () => toDotPath2,
|
|
50584
50659
|
safeParseAsync: () => safeParseAsync3,
|
|
50585
50660
|
safeParse: () => safeParse3,
|
|
@@ -61816,7 +61891,7 @@ var allProcessors2 = {
|
|
|
61816
61891
|
optional: optionalProcessor2,
|
|
61817
61892
|
lazy: lazyProcessor2
|
|
61818
61893
|
};
|
|
61819
|
-
function
|
|
61894
|
+
function toJSONSchema4(input, params) {
|
|
61820
61895
|
if ("_idmap" in input) {
|
|
61821
61896
|
const registry22 = input;
|
|
61822
61897
|
const ctx2 = initializeContext2({ ...params, processors: allProcessors2 });
|
|
@@ -63735,7 +63810,7 @@ function convertSchema2(schema, ctx) {
|
|
|
63735
63810
|
}
|
|
63736
63811
|
return baseSchema;
|
|
63737
63812
|
}
|
|
63738
|
-
function
|
|
63813
|
+
function fromJSONSchema4(schema, params) {
|
|
63739
63814
|
if (typeof schema === "boolean") {
|
|
63740
63815
|
return schema ? z2.any() : z2.never();
|
|
63741
63816
|
}
|
|
@@ -64138,7 +64213,7 @@ function filter(data, query) {
|
|
|
64138
64213
|
return executor.execute(ast, data);
|
|
64139
64214
|
}
|
|
64140
64215
|
|
|
64141
|
-
// ../node_modules/.pnpm/@kevisual+api@0.0.
|
|
64216
|
+
// ../node_modules/.pnpm/@kevisual+api@0.0.52_@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
|
|
64142
64217
|
var initApi = async (opts) => {
|
|
64143
64218
|
const router = opts?.router;
|
|
64144
64219
|
const item = opts?.item;
|
|
@@ -64175,7 +64250,7 @@ var initApi = async (opts) => {
|
|
|
64175
64250
|
metadata
|
|
64176
64251
|
}).define(async (ctx) => {
|
|
64177
64252
|
const msg = { ...ctx.query };
|
|
64178
|
-
if (msg.token === undefined && token !== undefined) {
|
|
64253
|
+
if (msg.token === undefined && token !== undefined && !_isBrowser) {
|
|
64179
64254
|
msg.token = token;
|
|
64180
64255
|
}
|
|
64181
64256
|
const res2 = await query.post({ path: r.path, key: r.key, ...msg });
|
|
@@ -64566,7 +64641,7 @@ __export(exports_external3, {
|
|
|
64566
64641
|
transform: () => transform3,
|
|
64567
64642
|
toUpperCase: () => _toUpperCase3,
|
|
64568
64643
|
toLowerCase: () => _toLowerCase3,
|
|
64569
|
-
toJSONSchema: () =>
|
|
64644
|
+
toJSONSchema: () => toJSONSchema7,
|
|
64570
64645
|
templateLiteral: () => templateLiteral3,
|
|
64571
64646
|
symbol: () => symbol3,
|
|
64572
64647
|
superRefine: () => superRefine3,
|
|
@@ -64659,7 +64734,7 @@ __export(exports_external3, {
|
|
|
64659
64734
|
globalRegistry: () => globalRegistry3,
|
|
64660
64735
|
getErrorMap: () => getErrorMap3,
|
|
64661
64736
|
function: () => _function3,
|
|
64662
|
-
fromJSONSchema: () =>
|
|
64737
|
+
fromJSONSchema: () => fromJSONSchema7,
|
|
64663
64738
|
formatError: () => formatError3,
|
|
64664
64739
|
float64: () => float643,
|
|
64665
64740
|
float32: () => float323,
|
|
@@ -64788,7 +64863,7 @@ __export(exports_core3, {
|
|
|
64788
64863
|
version: () => version3,
|
|
64789
64864
|
util: () => exports_util3,
|
|
64790
64865
|
treeifyError: () => treeifyError3,
|
|
64791
|
-
toJSONSchema: () =>
|
|
64866
|
+
toJSONSchema: () => toJSONSchema7,
|
|
64792
64867
|
toDotPath: () => toDotPath3,
|
|
64793
64868
|
safeParseAsync: () => safeParseAsync5,
|
|
64794
64869
|
safeParse: () => safeParse5,
|
|
@@ -76097,7 +76172,7 @@ var allProcessors3 = {
|
|
|
76097
76172
|
optional: optionalProcessor3,
|
|
76098
76173
|
lazy: lazyProcessor3
|
|
76099
76174
|
};
|
|
76100
|
-
function
|
|
76175
|
+
function toJSONSchema7(input, params) {
|
|
76101
76176
|
if ("_idmap" in input) {
|
|
76102
76177
|
const registry4 = input;
|
|
76103
76178
|
const ctx2 = initializeContext3({ ...params, processors: allProcessors3 });
|
|
@@ -78030,7 +78105,7 @@ function convertSchema3(schema, ctx) {
|
|
|
78030
78105
|
}
|
|
78031
78106
|
return baseSchema;
|
|
78032
78107
|
}
|
|
78033
|
-
function
|
|
78108
|
+
function fromJSONSchema7(schema, params) {
|
|
78034
78109
|
if (typeof schema === "boolean") {
|
|
78035
78110
|
return schema ? z3.any() : z3.never();
|
|
78036
78111
|
}
|
|
@@ -78281,23 +78356,17 @@ class AssistantApp extends Manager2 {
|
|
|
78281
78356
|
}
|
|
78282
78357
|
}
|
|
78283
78358
|
}
|
|
78284
|
-
// ../node_modules/.pnpm/@kevisual+query@0.0.
|
|
78359
|
+
// ../node_modules/.pnpm/@kevisual+query@0.0.49/node_modules/@kevisual/query/dist/query.js
|
|
78285
78360
|
var isTextForContentType2 = (contentType) => {
|
|
78286
78361
|
if (!contentType)
|
|
78287
78362
|
return false;
|
|
78288
|
-
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded", "md"];
|
|
78363
|
+
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded", "md", "json"];
|
|
78289
78364
|
return textTypes.some((type) => contentType.includes(type));
|
|
78290
78365
|
};
|
|
78291
78366
|
var adapter2 = async (opts = {}, overloadOpts) => {
|
|
78292
78367
|
const controller = new AbortController;
|
|
78293
78368
|
const signal = controller.signal;
|
|
78294
78369
|
const isPostFile = opts.isPostFile || false;
|
|
78295
|
-
let responseType = opts.responseType || "json";
|
|
78296
|
-
if (opts.isBlob) {
|
|
78297
|
-
responseType = "blob";
|
|
78298
|
-
} else if (opts.isText) {
|
|
78299
|
-
responseType = "text";
|
|
78300
|
-
}
|
|
78301
78370
|
const timeout = opts.timeout || 60000 * 3;
|
|
78302
78371
|
const timer = setTimeout(() => {
|
|
78303
78372
|
controller.abort();
|
|
@@ -78356,21 +78425,31 @@ var adapter2 = async (opts = {}, overloadOpts) => {
|
|
|
78356
78425
|
headers
|
|
78357
78426
|
}).then(async (response) => {
|
|
78358
78427
|
const contentType = response.headers.get("Content-Type");
|
|
78359
|
-
if (responseType === "blob") {
|
|
78360
|
-
return await response.blob();
|
|
78361
|
-
}
|
|
78362
|
-
const isText = responseType === "text";
|
|
78363
78428
|
const isJson = contentType && contentType.includes("application/json");
|
|
78364
|
-
|
|
78365
|
-
|
|
78429
|
+
const isSuccess = response.ok;
|
|
78430
|
+
if (isJson) {
|
|
78431
|
+
const json4 = await response.json();
|
|
78432
|
+
if (json4?.code) {
|
|
78433
|
+
return json4;
|
|
78434
|
+
}
|
|
78435
|
+
return {
|
|
78436
|
+
code: isSuccess ? 200 : response.status,
|
|
78437
|
+
status: response.status,
|
|
78438
|
+
data: json4
|
|
78439
|
+
};
|
|
78366
78440
|
} else if (isTextForContentType2(contentType)) {
|
|
78367
78441
|
return {
|
|
78368
|
-
code: response.status,
|
|
78442
|
+
code: isSuccess ? 200 : response.status,
|
|
78369
78443
|
status: response.status,
|
|
78370
78444
|
data: await response.text()
|
|
78371
78445
|
};
|
|
78372
78446
|
} else {
|
|
78373
|
-
return
|
|
78447
|
+
return {
|
|
78448
|
+
code: isSuccess ? 200 : response.status,
|
|
78449
|
+
status: response.status,
|
|
78450
|
+
data: "非文本非JSON响应, 请手动处理response。",
|
|
78451
|
+
response
|
|
78452
|
+
};
|
|
78374
78453
|
}
|
|
78375
78454
|
}).catch((err) => {
|
|
78376
78455
|
if (err.name === "AbortError") {
|
|
@@ -78390,16 +78469,14 @@ var adapter2 = async (opts = {}, overloadOpts) => {
|
|
|
78390
78469
|
var wrapperError2 = ({ code, message }) => {
|
|
78391
78470
|
const result = {
|
|
78392
78471
|
code: code || 500,
|
|
78393
|
-
|
|
78394
|
-
message: message || "api request error",
|
|
78395
|
-
showError: (fn) => {},
|
|
78396
|
-
noMsg: true
|
|
78472
|
+
message: message || "请求错误"
|
|
78397
78473
|
};
|
|
78398
78474
|
return result;
|
|
78399
78475
|
};
|
|
78400
78476
|
|
|
78401
78477
|
class Query2 {
|
|
78402
78478
|
adapter;
|
|
78479
|
+
baseURL;
|
|
78403
78480
|
url;
|
|
78404
78481
|
beforeRequest;
|
|
78405
78482
|
afterResponse;
|
|
@@ -78407,11 +78484,20 @@ class Query2 {
|
|
|
78407
78484
|
timeout;
|
|
78408
78485
|
stop;
|
|
78409
78486
|
qws;
|
|
78410
|
-
|
|
78487
|
+
tokenName;
|
|
78488
|
+
storage;
|
|
78489
|
+
token;
|
|
78411
78490
|
constructor(opts) {
|
|
78412
78491
|
this.adapter = opts?.adapter || adapter2;
|
|
78492
|
+
this.tokenName = opts?.tokenName || "token";
|
|
78493
|
+
this.storage = opts?.storage || globalThis?.localStorage;
|
|
78413
78494
|
const defaultURL = opts?.isClient ? "/client/router" : "/api/router";
|
|
78414
78495
|
this.url = opts?.url || defaultURL;
|
|
78496
|
+
if (this.url.startsWith("http")) {
|
|
78497
|
+
const urlObj = new URL(this.url);
|
|
78498
|
+
this.baseURL = urlObj.origin;
|
|
78499
|
+
}
|
|
78500
|
+
this.baseURL = opts?.baseURL || this.baseURL;
|
|
78415
78501
|
this.headers = opts?.headers || {
|
|
78416
78502
|
"Content-Type": "application/json"
|
|
78417
78503
|
};
|
|
@@ -78420,7 +78506,7 @@ class Query2 {
|
|
|
78420
78506
|
this.beforeRequest = opts.beforeRequest;
|
|
78421
78507
|
} else {
|
|
78422
78508
|
this.beforeRequest = async (opts2) => {
|
|
78423
|
-
const token =
|
|
78509
|
+
const token = this.token || this.storage?.getItem?.(this.tokenName);
|
|
78424
78510
|
if (token) {
|
|
78425
78511
|
opts2.headers = {
|
|
78426
78512
|
...opts2.headers,
|
|
@@ -78442,7 +78528,6 @@ class Query2 {
|
|
|
78442
78528
|
}
|
|
78443
78529
|
async post(body, options) {
|
|
78444
78530
|
const url4 = options?.url || this.url;
|
|
78445
|
-
console.log("query post", url4, body, options);
|
|
78446
78531
|
const { headers, adapter: adapter22, beforeRequest, afterResponse, timeout, ...rest } = options || {};
|
|
78447
78532
|
const _headers = { ...this.headers, ...headers };
|
|
78448
78533
|
const _adapter = adapter22 || this.adapter;
|
|
@@ -78456,13 +78541,20 @@ class Query2 {
|
|
|
78456
78541
|
timeout: _timeout,
|
|
78457
78542
|
...rest
|
|
78458
78543
|
};
|
|
78544
|
+
const isStartsWithHttp = req.url.startsWith("http");
|
|
78545
|
+
if (!isStartsWithHttp) {
|
|
78546
|
+
if (this.baseURL) {
|
|
78547
|
+
const baseURL = new URL(this.baseURL || globalThis?.location?.origin).origin;
|
|
78548
|
+
req.url = baseURL + req.url;
|
|
78549
|
+
}
|
|
78550
|
+
}
|
|
78459
78551
|
try {
|
|
78460
78552
|
if (_beforeRequest) {
|
|
78461
78553
|
const res = await _beforeRequest(req);
|
|
78462
78554
|
if (res === false) {
|
|
78463
78555
|
return wrapperError2({
|
|
78464
78556
|
code: 500,
|
|
78465
|
-
message: "
|
|
78557
|
+
message: "请求取消",
|
|
78466
78558
|
req
|
|
78467
78559
|
});
|
|
78468
78560
|
}
|
|
@@ -78471,13 +78563,13 @@ class Query2 {
|
|
|
78471
78563
|
console.error("request beforeFn error", e, req);
|
|
78472
78564
|
return wrapperError2({
|
|
78473
78565
|
code: 500,
|
|
78474
|
-
message: "
|
|
78566
|
+
message: "请求在请求前处理时发生错误",
|
|
78475
78567
|
req
|
|
78476
78568
|
});
|
|
78477
78569
|
}
|
|
78478
78570
|
if (this.stop && !options?.noStop) {
|
|
78479
78571
|
const that = this;
|
|
78480
|
-
await new Promise((resolve) => {
|
|
78572
|
+
const res = await new Promise((resolve) => {
|
|
78481
78573
|
let timer = 0;
|
|
78482
78574
|
const detect = setInterval(() => {
|
|
78483
78575
|
if (!that.stop) {
|
|
@@ -78485,11 +78577,20 @@ class Query2 {
|
|
|
78485
78577
|
resolve(true);
|
|
78486
78578
|
}
|
|
78487
78579
|
timer++;
|
|
78488
|
-
if (timer >
|
|
78489
|
-
console.error("
|
|
78580
|
+
if (timer > 5) {
|
|
78581
|
+
console.error("等待请求失败:", req.url, timer);
|
|
78582
|
+
clearInterval(detect);
|
|
78583
|
+
resolve(false);
|
|
78490
78584
|
}
|
|
78491
78585
|
}, 1000);
|
|
78492
78586
|
});
|
|
78587
|
+
if (!res) {
|
|
78588
|
+
return wrapperError2({
|
|
78589
|
+
code: 500,
|
|
78590
|
+
message: "请求取消,可能是因为用户未登录或者token过期",
|
|
78591
|
+
req
|
|
78592
|
+
});
|
|
78593
|
+
}
|
|
78493
78594
|
}
|
|
78494
78595
|
return _adapter(req).then(async (res) => {
|
|
78495
78596
|
try {
|
|
@@ -78502,10 +78603,10 @@ class Query2 {
|
|
|
78502
78603
|
}
|
|
78503
78604
|
return res;
|
|
78504
78605
|
} catch (e) {
|
|
78505
|
-
console.error("
|
|
78606
|
+
console.error("请求在响应后处理时发生错误", e, req);
|
|
78506
78607
|
return wrapperError2({
|
|
78507
78608
|
code: 500,
|
|
78508
|
-
message: "
|
|
78609
|
+
message: "请求在响应后处理时发生错误",
|
|
78509
78610
|
req
|
|
78510
78611
|
});
|
|
78511
78612
|
}
|
|
@@ -79340,7 +79441,7 @@ var simpleRouter = useContextKey("simpleRouter", () => {
|
|
|
79340
79441
|
});
|
|
79341
79442
|
app.createRouteList();
|
|
79342
79443
|
|
|
79343
|
-
// ../node_modules/.pnpm/@kevisual+router@0.0.
|
|
79444
|
+
// ../node_modules/.pnpm/@kevisual+router@0.0.80/node_modules/@kevisual/router/dist/opencode.js
|
|
79344
79445
|
import { webcrypto as crypto4 } from "node:crypto";
|
|
79345
79446
|
var __create6 = Object.create;
|
|
79346
79447
|
var __getProtoOf6 = Object.getPrototypeOf;
|
|
@@ -80118,7 +80219,7 @@ __export4(exports_external4, {
|
|
|
80118
80219
|
transform: () => transform4,
|
|
80119
80220
|
toUpperCase: () => _toUpperCase4,
|
|
80120
80221
|
toLowerCase: () => _toLowerCase4,
|
|
80121
|
-
toJSONSchema: () =>
|
|
80222
|
+
toJSONSchema: () => toJSONSchema8,
|
|
80122
80223
|
templateLiteral: () => templateLiteral4,
|
|
80123
80224
|
symbol: () => symbol4,
|
|
80124
80225
|
superRefine: () => superRefine4,
|
|
@@ -80211,7 +80312,7 @@ __export4(exports_external4, {
|
|
|
80211
80312
|
globalRegistry: () => globalRegistry4,
|
|
80212
80313
|
getErrorMap: () => getErrorMap4,
|
|
80213
80314
|
function: () => _function4,
|
|
80214
|
-
fromJSONSchema: () =>
|
|
80315
|
+
fromJSONSchema: () => fromJSONSchema8,
|
|
80215
80316
|
formatError: () => formatError4,
|
|
80216
80317
|
float64: () => float644,
|
|
80217
80318
|
float32: () => float324,
|
|
@@ -80338,7 +80439,7 @@ __export4(exports_core23, {
|
|
|
80338
80439
|
version: () => version4,
|
|
80339
80440
|
util: () => exports_util4,
|
|
80340
80441
|
treeifyError: () => treeifyError4,
|
|
80341
|
-
toJSONSchema: () =>
|
|
80442
|
+
toJSONSchema: () => toJSONSchema8,
|
|
80342
80443
|
toDotPath: () => toDotPath4,
|
|
80343
80444
|
safeParseAsync: () => safeParseAsync7,
|
|
80344
80445
|
safeParse: () => safeParse7,
|
|
@@ -91575,7 +91676,7 @@ var allProcessors4 = {
|
|
|
91575
91676
|
optional: optionalProcessor4,
|
|
91576
91677
|
lazy: lazyProcessor4
|
|
91577
91678
|
};
|
|
91578
|
-
function
|
|
91679
|
+
function toJSONSchema8(input, params) {
|
|
91579
91680
|
if ("_idmap" in input) {
|
|
91580
91681
|
const registry22 = input;
|
|
91581
91682
|
const ctx2 = initializeContext4({ ...params, processors: allProcessors4 });
|
|
@@ -93494,7 +93595,7 @@ function convertSchema4(schema, ctx) {
|
|
|
93494
93595
|
}
|
|
93495
93596
|
return baseSchema;
|
|
93496
93597
|
}
|
|
93497
|
-
function
|
|
93598
|
+
function fromJSONSchema8(schema, params) {
|
|
93498
93599
|
if (typeof schema === "boolean") {
|
|
93499
93600
|
return schema ? z4.any() : z4.never();
|
|
93500
93601
|
}
|
|
@@ -93578,6 +93679,12 @@ var tool2 = {
|
|
|
93578
93679
|
schema: exports_external4
|
|
93579
93680
|
};
|
|
93580
93681
|
var createSkill2 = (skill) => {
|
|
93682
|
+
if (skill.tags) {
|
|
93683
|
+
const hasOpencode = skill.tags.includes("opencode");
|
|
93684
|
+
if (!hasOpencode) {
|
|
93685
|
+
skill.tags.push("opencode");
|
|
93686
|
+
}
|
|
93687
|
+
}
|
|
93581
93688
|
return {
|
|
93582
93689
|
args: {},
|
|
93583
93690
|
...skill
|
|
@@ -93935,8 +94042,12 @@ var addCallFn = (app2) => {
|
|
|
93935
94042
|
tags: ["opencode"],
|
|
93936
94043
|
...createSkill2({
|
|
93937
94044
|
skill: "call-app",
|
|
93938
|
-
title: "调用app
|
|
93939
|
-
summary:
|
|
94045
|
+
title: "调用app应用,非技能模块",
|
|
94046
|
+
summary: `调用router的应用(非技能模块),适用于需要直接调用应用而不是技能的场景
|
|
94047
|
+
条件1: 参数path(string), key(string), payload(object)
|
|
94048
|
+
条件2: 当前的应用调用的模式不是技能
|
|
94049
|
+
|
|
94050
|
+
`,
|
|
93940
94051
|
args: {
|
|
93941
94052
|
path: tool2.schema.string().describe("应用路径,例如 cnb"),
|
|
93942
94053
|
key: tool2.schema.string().optional().describe("应用key,例如 list-repos"),
|
|
@@ -93956,6 +94067,7 @@ var addCallFn = (app2) => {
|
|
|
93956
94067
|
}).addTo(app2);
|
|
93957
94068
|
};
|
|
93958
94069
|
var createRouterAgentPluginFn = (opts) => {
|
|
94070
|
+
new Promise((resolve) => setTimeout(resolve, 100));
|
|
93959
94071
|
let router = opts?.router;
|
|
93960
94072
|
if (!router) {
|
|
93961
94073
|
const app2 = useContextKey2("app");
|
|
@@ -93973,6 +94085,9 @@ var createRouterAgentPluginFn = (opts) => {
|
|
|
93973
94085
|
const _routes = filter2(router.routes, opts?.query || "");
|
|
93974
94086
|
const routes = _routes.filter((r) => {
|
|
93975
94087
|
const metadata = r.metadata;
|
|
94088
|
+
if (metadata && metadata.skill && metadata.summary) {
|
|
94089
|
+
return true;
|
|
94090
|
+
}
|
|
93976
94091
|
if (metadata && metadata.tags && metadata.tags.includes("opencode")) {
|
|
93977
94092
|
return !!metadata.skill;
|
|
93978
94093
|
}
|
|
@@ -93986,15 +94101,16 @@ var createRouterAgentPluginFn = (opts) => {
|
|
|
93986
94101
|
tool: {
|
|
93987
94102
|
...routes.reduce((acc, route) => {
|
|
93988
94103
|
const metadata = route.metadata;
|
|
94104
|
+
let args2 = extractArgs2(metadata?.args);
|
|
93989
94105
|
acc[metadata.skill] = {
|
|
93990
94106
|
name: metadata.title || metadata.skill,
|
|
93991
94107
|
description: metadata.summary || "",
|
|
93992
|
-
args:
|
|
93993
|
-
async execute(
|
|
94108
|
+
args: args2,
|
|
94109
|
+
async execute(args22) {
|
|
93994
94110
|
const res = await router.run({
|
|
93995
94111
|
path: route.path,
|
|
93996
94112
|
key: route.key,
|
|
93997
|
-
payload:
|
|
94113
|
+
payload: args22
|
|
93998
94114
|
}, { appId: router.appId });
|
|
93999
94115
|
if (res.code === 200) {
|
|
94000
94116
|
if (res.data?.content) {
|
|
@@ -94021,6 +94137,12 @@ var createRouterAgentPluginFn = (opts) => {
|
|
|
94021
94137
|
};
|
|
94022
94138
|
return AgentPlugin;
|
|
94023
94139
|
};
|
|
94140
|
+
var extractArgs2 = (args2) => {
|
|
94141
|
+
if (args2 && typeof args2 === "object" && typeof args2.shape === "object") {
|
|
94142
|
+
return args2.shape;
|
|
94143
|
+
}
|
|
94144
|
+
return args2 || {};
|
|
94145
|
+
};
|
|
94024
94146
|
|
|
94025
94147
|
// src/module/reload-server.ts
|
|
94026
94148
|
import pm24 from "pm2";
|
|
@@ -117662,7 +117784,8 @@ app.route({
|
|
|
117662
117784
|
}
|
|
117663
117785
|
}).addTo(app);
|
|
117664
117786
|
|
|
117665
|
-
// ../node_modules/.pnpm/@kevisual+context@0.0.
|
|
117787
|
+
// ../node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
|
|
117788
|
+
var isBrowser22 = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
117666
117789
|
function getDefaultExportFromCjs4(x) {
|
|
117667
117790
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
117668
117791
|
}
|
|
@@ -118126,7 +118249,7 @@ var useEnv3 = (initEnv, initKey = "config", isOverwrite) => {
|
|
|
118126
118249
|
}
|
|
118127
118250
|
return gt3[initKey];
|
|
118128
118251
|
};
|
|
118129
|
-
var useEnvKey3 = (key, init, initKey = "config") => {
|
|
118252
|
+
var useEnvKey3 = (key, init, initKey = "config", opts = {}) => {
|
|
118130
118253
|
const _env = useEnv3({}, initKey);
|
|
118131
118254
|
if (key && typeof _env[key] !== "undefined") {
|
|
118132
118255
|
return _env[key];
|
|
@@ -118152,12 +118275,13 @@ var useEnvKey3 = (key, init, initKey = "config") => {
|
|
|
118152
118275
|
const voidFn = async () => {
|
|
118153
118276
|
return _env[key];
|
|
118154
118277
|
};
|
|
118278
|
+
const timeout2 = opts.timeout || 5 * 60 * 1000;
|
|
118155
118279
|
const checkFn = async () => {
|
|
118156
118280
|
const loadRes = await baseLoad.load(voidFn, {
|
|
118157
118281
|
key,
|
|
118158
118282
|
isReRun: true,
|
|
118159
118283
|
checkSuccess: () => _env[key],
|
|
118160
|
-
timeout:
|
|
118284
|
+
timeout: timeout2,
|
|
118161
118285
|
interval: 1000
|
|
118162
118286
|
});
|
|
118163
118287
|
if (loadRes.code !== 200) {
|
|
@@ -118173,27 +118297,28 @@ var useEnvKey3 = (key, init, initKey = "config") => {
|
|
|
118173
118297
|
};
|
|
118174
118298
|
var useEnvKeyNew3 = (key, initKey = "config", opts) => {
|
|
118175
118299
|
const _env = useEnv3({}, initKey);
|
|
118300
|
+
const timeout2 = opts?.timeout;
|
|
118176
118301
|
if (key) {
|
|
118177
118302
|
delete _env[key];
|
|
118178
118303
|
}
|
|
118179
118304
|
if (opts?.getNew && opts.init) {
|
|
118180
|
-
return useEnvKey3(key, opts.init, initKey);
|
|
118305
|
+
return useEnvKey3(key, opts.init, initKey, { timeout: timeout2 });
|
|
118181
118306
|
} else if (opts?.getNew) {
|
|
118182
|
-
return useEnvKey3(key, null, initKey);
|
|
118307
|
+
return useEnvKey3(key, null, initKey, { timeout: timeout2 });
|
|
118183
118308
|
}
|
|
118184
118309
|
};
|
|
118185
|
-
var useContextKey3 = (key, init,
|
|
118186
|
-
if (isNew) {
|
|
118187
|
-
return useEnvKeyNew3(key, "context", { getNew: true, init });
|
|
118310
|
+
var useContextKey3 = (key, init, opts) => {
|
|
118311
|
+
if (opts?.isNew) {
|
|
118312
|
+
return useEnvKeyNew3(key, "context", { getNew: true, init, ...opts });
|
|
118188
118313
|
}
|
|
118189
|
-
return useEnvKey3(key, init, "context");
|
|
118314
|
+
return useEnvKey3(key, init, "context", opts);
|
|
118190
118315
|
};
|
|
118191
118316
|
var use3 = useContextKey3;
|
|
118192
|
-
var useConfigKey3 = (key, init,
|
|
118193
|
-
if (isNew) {
|
|
118194
|
-
return useEnvKeyNew3(key, "config", { getNew: true, init });
|
|
118317
|
+
var useConfigKey3 = (key, init, opts) => {
|
|
118318
|
+
if (opts?.isNew) {
|
|
118319
|
+
return useEnvKeyNew3(key, "config", { getNew: true, init, ...opts });
|
|
118195
118320
|
}
|
|
118196
|
-
return useEnvKey3(key, init, "config");
|
|
118321
|
+
return useEnvKey3(key, init, "config", opts);
|
|
118197
118322
|
};
|
|
118198
118323
|
|
|
118199
118324
|
class InitEnv3 {
|
|
@@ -118982,7 +119107,7 @@ var import_busboy = __toESM(require_lib2(), 1);
|
|
|
118982
119107
|
import path15 from "path";
|
|
118983
119108
|
import fs17 from "fs";
|
|
118984
119109
|
|
|
118985
|
-
// ../node_modules/.pnpm/@kevisual+router@0.0.
|
|
119110
|
+
// ../node_modules/.pnpm/@kevisual+router@0.0.80/node_modules/@kevisual/router/src/server/cookie.ts
|
|
118986
119111
|
var NullObject2 = /* @__PURE__ */ (() => {
|
|
118987
119112
|
const C2 = function() {};
|
|
118988
119113
|
C2.prototype = Object.create(null);
|