@kevisual/cli 0.1.3 → 0.1.5
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 +44752 -37719
- package/dist/assistant-server.js +32757 -25364
- package/dist/assistant.js +9938 -2919
- package/dist/envision.js +48 -15
- package/package.json +6 -6
package/dist/envision.js
CHANGED
|
@@ -22309,8 +22309,8 @@ InitEnv.init();
|
|
|
22309
22309
|
var version = useContextKey("version", () => {
|
|
22310
22310
|
let version2 = "0.0.64";
|
|
22311
22311
|
try {
|
|
22312
|
-
if ("0.1.
|
|
22313
|
-
version2 = "0.1.
|
|
22312
|
+
if ("0.1.5")
|
|
22313
|
+
version2 = "0.1.5";
|
|
22314
22314
|
} catch (e) {}
|
|
22315
22315
|
return version2;
|
|
22316
22316
|
});
|
|
@@ -25123,7 +25123,7 @@ var dist_default6 = createPrompt((config, done) => {
|
|
|
25123
25123
|
var import_md5 = __toESM(require_md5(), 1);
|
|
25124
25124
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
25125
25125
|
|
|
25126
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
25126
|
+
// node_modules/.pnpm/@kevisual+query@0.0.44/node_modules/@kevisual/query/dist/query.js
|
|
25127
25127
|
var isTextForContentType = (contentType) => {
|
|
25128
25128
|
if (!contentType)
|
|
25129
25129
|
return false;
|
|
@@ -25151,7 +25151,7 @@ var adapter = async (opts = {}, overloadOpts) => {
|
|
|
25151
25151
|
if (opts?.url?.startsWith("http")) {
|
|
25152
25152
|
url = new URL(opts.url);
|
|
25153
25153
|
} else {
|
|
25154
|
-
origin =
|
|
25154
|
+
origin = globalThis?.location?.origin || "http://localhost:51515";
|
|
25155
25155
|
url = new URL(opts?.url || "", origin);
|
|
25156
25156
|
}
|
|
25157
25157
|
const isGet = method === "GET";
|
|
@@ -25293,6 +25293,7 @@ class Query {
|
|
|
25293
25293
|
}
|
|
25294
25294
|
async post(body, options) {
|
|
25295
25295
|
const url = options?.url || this.url;
|
|
25296
|
+
console.log("query post", url, body, options);
|
|
25296
25297
|
const { headers, adapter: adapter2, beforeRequest, afterResponse, timeout, ...rest } = options || {};
|
|
25297
25298
|
const _headers = { ...this.headers, ...headers };
|
|
25298
25299
|
const _adapter = adapter2 || this.adapter;
|
|
@@ -25321,7 +25322,8 @@ class Query {
|
|
|
25321
25322
|
console.error("request beforeFn error", e, req);
|
|
25322
25323
|
return wrapperError({
|
|
25323
25324
|
code: 500,
|
|
25324
|
-
message: "api request beforeFn error"
|
|
25325
|
+
message: "api request beforeFn error",
|
|
25326
|
+
req
|
|
25325
25327
|
});
|
|
25326
25328
|
}
|
|
25327
25329
|
if (this.stop && !options?.noStop) {
|
|
@@ -25354,7 +25356,8 @@ class Query {
|
|
|
25354
25356
|
console.error("request afterFn error", e, req);
|
|
25355
25357
|
return wrapperError({
|
|
25356
25358
|
code: 500,
|
|
25357
|
-
message: "api request afterFn error"
|
|
25359
|
+
message: "api request afterFn error",
|
|
25360
|
+
req
|
|
25358
25361
|
});
|
|
25359
25362
|
}
|
|
25360
25363
|
});
|
|
@@ -25391,7 +25394,7 @@ class Query {
|
|
|
25391
25394
|
}
|
|
25392
25395
|
}
|
|
25393
25396
|
|
|
25394
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
25397
|
+
// node_modules/.pnpm/@kevisual+query@0.0.44/node_modules/@kevisual/query/dist/query-browser.js
|
|
25395
25398
|
var isTextForContentType2 = (contentType) => {
|
|
25396
25399
|
if (!contentType)
|
|
25397
25400
|
return false;
|
|
@@ -25419,7 +25422,7 @@ var adapter2 = async (opts = {}, overloadOpts) => {
|
|
|
25419
25422
|
if (opts?.url?.startsWith("http")) {
|
|
25420
25423
|
url = new URL(opts.url);
|
|
25421
25424
|
} else {
|
|
25422
|
-
origin =
|
|
25425
|
+
origin = globalThis?.location?.origin || "http://localhost:51515";
|
|
25423
25426
|
url = new URL(opts?.url || "", origin);
|
|
25424
25427
|
}
|
|
25425
25428
|
const isGet = method === "GET";
|
|
@@ -25552,9 +25555,10 @@ class Query2 {
|
|
|
25552
25555
|
}
|
|
25553
25556
|
async post(body, options) {
|
|
25554
25557
|
const url = options?.url || this.url;
|
|
25555
|
-
|
|
25558
|
+
console.log("query post", url, body, options);
|
|
25559
|
+
const { headers, adapter: adapter22, beforeRequest, afterResponse, timeout, ...rest } = options || {};
|
|
25556
25560
|
const _headers = { ...this.headers, ...headers };
|
|
25557
|
-
const _adapter =
|
|
25561
|
+
const _adapter = adapter22 || this.adapter;
|
|
25558
25562
|
const _beforeRequest = beforeRequest || this.beforeRequest;
|
|
25559
25563
|
const _afterResponse = afterResponse || this.afterResponse;
|
|
25560
25564
|
const _timeout = timeout || this.timeout;
|
|
@@ -25580,7 +25584,8 @@ class Query2 {
|
|
|
25580
25584
|
console.error("request beforeFn error", e, req);
|
|
25581
25585
|
return wrapperError2({
|
|
25582
25586
|
code: 500,
|
|
25583
|
-
message: "api request beforeFn error"
|
|
25587
|
+
message: "api request beforeFn error",
|
|
25588
|
+
req
|
|
25584
25589
|
});
|
|
25585
25590
|
}
|
|
25586
25591
|
if (this.stop && !options?.noStop) {
|
|
@@ -25605,7 +25610,7 @@ class Query2 {
|
|
|
25605
25610
|
return await _afterResponse(res, {
|
|
25606
25611
|
req,
|
|
25607
25612
|
res,
|
|
25608
|
-
fetch:
|
|
25613
|
+
fetch: adapter22
|
|
25609
25614
|
});
|
|
25610
25615
|
}
|
|
25611
25616
|
return res;
|
|
@@ -25613,7 +25618,8 @@ class Query2 {
|
|
|
25613
25618
|
console.error("request afterFn error", e, req);
|
|
25614
25619
|
return wrapperError2({
|
|
25615
25620
|
code: 500,
|
|
25616
|
-
message: "api request afterFn error"
|
|
25621
|
+
message: "api request afterFn error",
|
|
25622
|
+
req
|
|
25617
25623
|
});
|
|
25618
25624
|
}
|
|
25619
25625
|
});
|
|
@@ -25675,7 +25681,7 @@ class BaseQuery {
|
|
|
25675
25681
|
}
|
|
25676
25682
|
}
|
|
25677
25683
|
|
|
25678
|
-
// node_modules/.pnpm/@kevisual+query-login@0.0.7_@kevisual+query@0.0.
|
|
25684
|
+
// node_modules/.pnpm/@kevisual+query-login@0.0.7_@kevisual+query@0.0.44/node_modules/@kevisual/query-login/dist/query-login-node.js
|
|
25679
25685
|
import { homedir } from "os";
|
|
25680
25686
|
import { join, dirname } from "path";
|
|
25681
25687
|
import fs4 from "fs";
|
|
@@ -40463,7 +40469,12 @@ var cnbCmd = new Command("cnb").description("CNB 相关命令").action(async (op
|
|
|
40463
40469
|
});
|
|
40464
40470
|
var liveCmd = new Command("live").description("启动 CNB Keep Alive 服务").option("-j, --json <string>", "JSON数据").option("-c, --config <string>", "配置文件路径 (优先级高于 JSON 参数), 默认keep.json").action(async (opts) => {
|
|
40465
40471
|
let config2;
|
|
40466
|
-
|
|
40472
|
+
let configPath2 = opts.config || "keep.json";
|
|
40473
|
+
if (configPath2.startsWith("/")) {
|
|
40474
|
+
configPath2 = path17.resolve(configPath2);
|
|
40475
|
+
} else {
|
|
40476
|
+
configPath2 = path17.join(process.cwd(), configPath2);
|
|
40477
|
+
}
|
|
40467
40478
|
try {
|
|
40468
40479
|
let jsonString = opts.json;
|
|
40469
40480
|
if (!jsonString) {
|
|
@@ -40488,6 +40499,28 @@ var liveCmd = new Command("live").description("启动 CNB Keep Alive 服务").op
|
|
|
40488
40499
|
});
|
|
40489
40500
|
});
|
|
40490
40501
|
cnbCmd.addCommand(liveCmd);
|
|
40502
|
+
var workspaceCmd = new Command("workspace").alias("w").description("工作区live保活,默认执行 ev cnb live -c /workspace/live/keep.json").action(() => {
|
|
40503
|
+
try {
|
|
40504
|
+
const configPath2 = path17.join("/workspace/live/keep.json");
|
|
40505
|
+
const json = readFileSync2(configPath2, "utf-8").trim();
|
|
40506
|
+
let config2 = JSON.parse(json);
|
|
40507
|
+
if (!config2.wss || !config2.cookie) {
|
|
40508
|
+
console.error("配置错误: 必须包含 wss 和 cookie 字段");
|
|
40509
|
+
process.exit(1);
|
|
40510
|
+
}
|
|
40511
|
+
createKeepAlive({
|
|
40512
|
+
wsUrl: config2.wss,
|
|
40513
|
+
cookie: config2.cookie,
|
|
40514
|
+
onDisconnect: (code) => {
|
|
40515
|
+
console.log(`与 CNB 服务器断开连接,代码: ${code}`);
|
|
40516
|
+
},
|
|
40517
|
+
debug: true
|
|
40518
|
+
});
|
|
40519
|
+
} catch (e) {
|
|
40520
|
+
console.error("error", e);
|
|
40521
|
+
}
|
|
40522
|
+
});
|
|
40523
|
+
program.addCommand(workspaceCmd);
|
|
40491
40524
|
program.addCommand(cnbCmd);
|
|
40492
40525
|
|
|
40493
40526
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "envision 命令行工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"basename": "/root/cli",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@kevisual/auth": "^2.0.3",
|
|
47
47
|
"@kevisual/context": "^0.0.6",
|
|
48
48
|
"@kevisual/use-config": "^1.0.30",
|
|
49
|
-
"@opencode-ai/sdk": "^1.2.
|
|
49
|
+
"@opencode-ai/sdk": "^1.2.6",
|
|
50
50
|
"@types/busboy": "^1.5.4",
|
|
51
51
|
"busboy": "^1.6.0",
|
|
52
52
|
"eventemitter3": "^5.0.4",
|
|
@@ -59,12 +59,12 @@
|
|
|
59
59
|
"unstorage": "^1.17.4"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@kevisual/api": "^0.0.
|
|
62
|
+
"@kevisual/api": "^0.0.51",
|
|
63
63
|
"@kevisual/cnb": "^0.0.26",
|
|
64
|
-
"@kevisual/dts": "^0.0.
|
|
64
|
+
"@kevisual/dts": "^0.0.4",
|
|
65
65
|
"@kevisual/load": "^0.0.6",
|
|
66
66
|
"@kevisual/logger": "^0.0.4",
|
|
67
|
-
"@kevisual/query": "0.0.
|
|
67
|
+
"@kevisual/query": "0.0.44",
|
|
68
68
|
"@kevisual/query-login": "0.0.7",
|
|
69
69
|
"@types/bun": "^1.3.9",
|
|
70
70
|
"@types/crypto-js": "^4.2.2",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"ignore": "^7.0.5",
|
|
82
82
|
"jsonwebtoken": "^9.0.3",
|
|
83
83
|
"pm2": "^6.0.14",
|
|
84
|
-
"tar": "^7.5.
|
|
84
|
+
"tar": "^7.5.9",
|
|
85
85
|
"zustand": "^5.0.11"
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|