@kevisual/cli 0.1.11 → 0.1.12
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 +85 -34
- package/dist/assistant-server.js +85 -34
- package/dist/assistant.js +2 -1
- package/dist/envision.js +2 -2
- package/package.json +1 -1
|
@@ -44002,6 +44002,7 @@ class AssistantConfig {
|
|
|
44002
44002
|
}
|
|
44003
44003
|
getDefaultInitAssistantConfig() {
|
|
44004
44004
|
const id = randomId2();
|
|
44005
|
+
const isCNB = !!useKey("CNB");
|
|
44005
44006
|
return {
|
|
44006
44007
|
app: {
|
|
44007
44008
|
url: "https://kevisual.cn",
|
|
@@ -44009,7 +44010,7 @@ class AssistantConfig {
|
|
|
44009
44010
|
},
|
|
44010
44011
|
description: "助手配置文件",
|
|
44011
44012
|
docs: "https://kevisual.cn/root/cli/docs/",
|
|
44012
|
-
home: "/root/home",
|
|
44013
|
+
home: isCNB ? "/root/cli-center" : "/root/home",
|
|
44013
44014
|
proxy: [],
|
|
44014
44015
|
share: {
|
|
44015
44016
|
enabled: true,
|
|
@@ -102223,47 +102224,56 @@ var getLiveMdContent = (opts) => {
|
|
|
102223
102224
|
`;
|
|
102224
102225
|
const labels = [
|
|
102225
102226
|
{
|
|
102226
|
-
|
|
102227
|
+
key: "vscodeWebUrl",
|
|
102228
|
+
title: "VSCode Web 地址",
|
|
102227
102229
|
value: vscodeWebUrl,
|
|
102228
102230
|
description: "VSCode Web 的访问地址"
|
|
102229
102231
|
},
|
|
102230
102232
|
{
|
|
102231
|
-
|
|
102233
|
+
key: "kevisualUrl",
|
|
102234
|
+
title: "Kevisual 地址",
|
|
102232
102235
|
value: kevisualUrl,
|
|
102233
102236
|
description: "Kevisual 的访问地址,可以通过该地址访问 Kevisual 服务"
|
|
102234
102237
|
},
|
|
102235
102238
|
{
|
|
102236
|
-
|
|
102239
|
+
key: "cnbTempToken",
|
|
102240
|
+
title: "CNB Token",
|
|
102237
102241
|
value: token,
|
|
102238
102242
|
description: "CNB 临时 Token,保持和环境变量 CNB_TOKEN 一致"
|
|
102239
102243
|
},
|
|
102240
102244
|
{
|
|
102241
|
-
|
|
102245
|
+
key: "openWebUrl",
|
|
102246
|
+
title: "OpenWebUI 地址",
|
|
102242
102247
|
value: openWebUrl,
|
|
102243
102248
|
description: "OpenWebUI 的访问地址,可以通过该地址访问 OpenWebUI 服务"
|
|
102244
102249
|
},
|
|
102245
102250
|
{
|
|
102246
|
-
|
|
102251
|
+
key: "openclawUrl",
|
|
102252
|
+
title: "OpenClaw 地址",
|
|
102247
102253
|
value: openclawUrl,
|
|
102248
102254
|
description: "OpenClaw 的访问地址,可以通过该地址访问 OpenClaw 服务"
|
|
102249
102255
|
},
|
|
102250
102256
|
{
|
|
102251
|
-
|
|
102257
|
+
key: "openclawUrlSecret",
|
|
102258
|
+
title: "OpenClaw 访问地址(含 Token)",
|
|
102252
102259
|
value: openclawUrlSecret,
|
|
102253
102260
|
description: "OpenClaw 的访问地址,包含 token 参数,可以直接访问 OpenClaw 服务"
|
|
102254
102261
|
},
|
|
102255
102262
|
{
|
|
102256
|
-
|
|
102263
|
+
key: "opencodeUrl",
|
|
102264
|
+
title: "OpenCode 地址",
|
|
102257
102265
|
value: opencodeUrl,
|
|
102258
102266
|
description: "OpenCode 的访问地址,可以通过该地址访问 OpenCode 服务"
|
|
102259
102267
|
},
|
|
102260
102268
|
{
|
|
102261
|
-
|
|
102269
|
+
key: "opencodeUrlSecret",
|
|
102270
|
+
title: "OpenCode 访问地址(含 Token)",
|
|
102262
102271
|
value: opencodeUrlSecret,
|
|
102263
102272
|
description: "OpenCode 的访问地址,包含 token 参数,可以直接访问 OpenCode 服务"
|
|
102264
102273
|
},
|
|
102265
102274
|
{
|
|
102266
|
-
|
|
102275
|
+
key: "docs",
|
|
102276
|
+
title: "配置说明文档",
|
|
102267
102277
|
value: TEMPLATE,
|
|
102268
102278
|
description: "开发环境模式配置说明文档"
|
|
102269
102279
|
}
|
|
@@ -102312,13 +102322,19 @@ var createOSInfo = (more = false) => {
|
|
|
102312
102322
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
102313
102323
|
return (bytes / Math.pow(1024, i)).toFixed(2) + " " + sizes[i];
|
|
102314
102324
|
};
|
|
102315
|
-
const bootTime = os7.uptime();
|
|
102316
102325
|
const formatUptime = (seconds) => {
|
|
102317
102326
|
const days = Math.floor(seconds / 86400);
|
|
102318
102327
|
const hours = Math.floor(seconds % 86400 / 3600);
|
|
102319
102328
|
const minutes = Math.floor(seconds % 3600 / 60);
|
|
102320
102329
|
const secs = Math.floor(seconds % 60);
|
|
102321
|
-
|
|
102330
|
+
let uptimeStr = "";
|
|
102331
|
+
if (days > 0)
|
|
102332
|
+
uptimeStr += `${days}天 `;
|
|
102333
|
+
if (hours > 0)
|
|
102334
|
+
uptimeStr += `${hours}小时 `;
|
|
102335
|
+
if (minutes > 0)
|
|
102336
|
+
uptimeStr += `${minutes}分钟 `;
|
|
102337
|
+
return `${uptimeStr}${secs}秒`;
|
|
102322
102338
|
};
|
|
102323
102339
|
let diskUsage = "";
|
|
102324
102340
|
try {
|
|
@@ -102328,37 +102344,40 @@ var createOSInfo = (more = false) => {
|
|
|
102328
102344
|
diskUsage = "获取失败";
|
|
102329
102345
|
}
|
|
102330
102346
|
labels.push({
|
|
102331
|
-
|
|
102347
|
+
key: "cpuUsage",
|
|
102348
|
+
title: "CPU 使用率",
|
|
102332
102349
|
value: `${cpuUsage}%`,
|
|
102333
102350
|
description: "CPU 使用率"
|
|
102334
102351
|
}, {
|
|
102335
|
-
|
|
102352
|
+
key: "cpuCores",
|
|
102353
|
+
title: "CPU 核心数",
|
|
102336
102354
|
value: `${cpus.length}`,
|
|
102337
102355
|
description: "CPU 核心数"
|
|
102338
102356
|
}, {
|
|
102339
|
-
|
|
102357
|
+
key: "memoryUsed",
|
|
102358
|
+
title: "已使用内存",
|
|
102340
102359
|
value: formatBytes(memUsed),
|
|
102341
102360
|
description: "已使用内存"
|
|
102342
102361
|
}, {
|
|
102343
|
-
|
|
102362
|
+
key: "memoryTotal",
|
|
102363
|
+
title: "总内存",
|
|
102344
102364
|
value: formatBytes(memTotal),
|
|
102345
102365
|
description: "总内存"
|
|
102346
102366
|
}, {
|
|
102347
|
-
|
|
102367
|
+
key: "memoryFree",
|
|
102368
|
+
title: "空闲内存",
|
|
102348
102369
|
value: formatBytes(memFree),
|
|
102349
102370
|
description: "空闲内存"
|
|
102350
102371
|
}, {
|
|
102351
|
-
|
|
102372
|
+
key: "memoryUsage",
|
|
102373
|
+
title: "内存使用率",
|
|
102352
102374
|
value: `${memUsage}%`,
|
|
102353
102375
|
description: "内存使用率"
|
|
102354
102376
|
}, {
|
|
102355
|
-
|
|
102377
|
+
key: "diskUsage",
|
|
102378
|
+
title: "磁盘使用",
|
|
102356
102379
|
value: diskUsage,
|
|
102357
102380
|
description: "当前目录磁盘使用情况"
|
|
102358
|
-
}, {
|
|
102359
|
-
title: "uptime",
|
|
102360
|
-
value: formatUptime(bootTime),
|
|
102361
|
-
description: "系统运行时间"
|
|
102362
102381
|
});
|
|
102363
102382
|
if (startTimer) {
|
|
102364
102383
|
const buildStartTime = import_dayjs.default(startTimer).format("YYYY-MM-DD HH:mm:ss");
|
|
@@ -102367,11 +102386,13 @@ var createOSInfo = (more = false) => {
|
|
|
102367
102386
|
const buildUptimeStr = formatUptime(Math.floor(buildUptime / 1000));
|
|
102368
102387
|
const maxRunTime = useKey2("CNB_PIPELINE_MAX_RUN_TIME") || 0;
|
|
102369
102388
|
labels.push({
|
|
102370
|
-
|
|
102389
|
+
key: "buildStartTime",
|
|
102390
|
+
title: "构建启动时间",
|
|
102371
102391
|
value: buildStartTime,
|
|
102372
102392
|
description: "构建启动时间"
|
|
102373
102393
|
}, {
|
|
102374
|
-
|
|
102394
|
+
key: "buildUptime",
|
|
102395
|
+
title: "构建已运行时间",
|
|
102375
102396
|
value: buildUptimeStr,
|
|
102376
102397
|
description: "构建已运行时间"
|
|
102377
102398
|
});
|
|
@@ -102384,11 +102405,13 @@ var createOSInfo = (more = false) => {
|
|
|
102384
102405
|
}
|
|
102385
102406
|
const timeTo4Str = `[距离晚上4点重启时间: ${formatUptime(Math.floor(timeTo4 / 1000))}]`;
|
|
102386
102407
|
labels.push({
|
|
102387
|
-
|
|
102408
|
+
key: "buildMaxRunTime",
|
|
102409
|
+
title: "最大运行时间",
|
|
102388
102410
|
value: formatUptime(Math.floor(maxRunTime / 1000)),
|
|
102389
102411
|
description: "构建最大运行时间(限制时间)"
|
|
102390
102412
|
});
|
|
102391
102413
|
labels.unshift({
|
|
102414
|
+
key: "remainingTime",
|
|
102392
102415
|
title: "剩余时间",
|
|
102393
102416
|
value: formatUptime(Math.floor((maxRunTime - buildUptime) / 1000)) + " " + timeTo4Str,
|
|
102394
102417
|
description: "构建剩余时间"
|
|
@@ -102398,31 +102421,38 @@ var createOSInfo = (more = false) => {
|
|
|
102398
102421
|
if (more) {
|
|
102399
102422
|
const loadavg = os7.loadavg();
|
|
102400
102423
|
labels.push({
|
|
102401
|
-
|
|
102424
|
+
key: "hostname",
|
|
102425
|
+
title: "主机名",
|
|
102402
102426
|
value: os7.hostname(),
|
|
102403
102427
|
description: "主机名"
|
|
102404
102428
|
}, {
|
|
102405
|
-
|
|
102429
|
+
key: "platform",
|
|
102430
|
+
title: "运行平台",
|
|
102406
102431
|
value: os7.platform(),
|
|
102407
102432
|
description: "运行平台"
|
|
102408
102433
|
}, {
|
|
102409
|
-
|
|
102434
|
+
key: "arch",
|
|
102435
|
+
title: "系统架构",
|
|
102410
102436
|
value: os7.arch(),
|
|
102411
102437
|
description: "系统架构"
|
|
102412
102438
|
}, {
|
|
102413
|
-
|
|
102439
|
+
key: "osType",
|
|
102440
|
+
title: "操作系统类型",
|
|
102414
102441
|
value: os7.type(),
|
|
102415
102442
|
description: "操作系统类型"
|
|
102416
102443
|
}, {
|
|
102417
|
-
|
|
102444
|
+
key: "loadavg1m",
|
|
102445
|
+
title: "系统负载 (1分钟)",
|
|
102418
102446
|
value: loadavg[0].toFixed(2),
|
|
102419
102447
|
description: "系统负载 (1分钟)"
|
|
102420
102448
|
}, {
|
|
102421
|
-
|
|
102449
|
+
key: "loadavg5m",
|
|
102450
|
+
title: "系统负载 (5分钟)",
|
|
102422
102451
|
value: loadavg[1].toFixed(2),
|
|
102423
102452
|
description: "系统负载 (5分钟)"
|
|
102424
102453
|
}, {
|
|
102425
|
-
|
|
102454
|
+
key: "loadavg15m",
|
|
102455
|
+
title: "系统负载 (15分钟)",
|
|
102426
102456
|
value: loadavg[2].toFixed(2),
|
|
102427
102457
|
description: "系统负载 (15分钟)"
|
|
102428
102458
|
});
|
|
@@ -102431,6 +102461,17 @@ var createOSInfo = (more = false) => {
|
|
|
102431
102461
|
};
|
|
102432
102462
|
|
|
102433
102463
|
// src/routes/cnb-board/cnb-dev-env.ts
|
|
102464
|
+
var notCNBCheck = (ctx) => {
|
|
102465
|
+
const isCNB = useKey2("CNB");
|
|
102466
|
+
if (!isCNB) {
|
|
102467
|
+
ctx.body = {
|
|
102468
|
+
title: "非 cnb-board 环境",
|
|
102469
|
+
list: []
|
|
102470
|
+
};
|
|
102471
|
+
return true;
|
|
102472
|
+
}
|
|
102473
|
+
return false;
|
|
102474
|
+
};
|
|
102434
102475
|
app.route({
|
|
102435
102476
|
path: "cnb_board",
|
|
102436
102477
|
key: "live",
|
|
@@ -102444,6 +102485,8 @@ app.route({
|
|
|
102444
102485
|
}).define(async (ctx) => {
|
|
102445
102486
|
const more = ctx.query?.more ?? false;
|
|
102446
102487
|
const list4 = getLiveMdContent({ more });
|
|
102488
|
+
if (notCNBCheck(ctx))
|
|
102489
|
+
return;
|
|
102447
102490
|
ctx.body = {
|
|
102448
102491
|
title: "开发环境模式配置",
|
|
102449
102492
|
list: list4
|
|
@@ -102458,7 +102501,9 @@ app.route({
|
|
|
102458
102501
|
const repoSlug = useKey2("CNB_REPO_SLUG") || "";
|
|
102459
102502
|
const repoName = useKey2("CNB_REPO_NAME") || "";
|
|
102460
102503
|
const repoId = useKey2("CNB_REPO_ID") || "";
|
|
102461
|
-
const repoUrlHttps = useKey2("
|
|
102504
|
+
const repoUrlHttps = useKey2("CNB_REPO_UR if (notCNBCheck(ctx)) return;L_HTTPS") || "";
|
|
102505
|
+
if (notCNBCheck(ctx))
|
|
102506
|
+
return;
|
|
102462
102507
|
const repoNameFromSlug = repoSlug.split("/").pop() || "";
|
|
102463
102508
|
const labels = [
|
|
102464
102509
|
{
|
|
@@ -102503,6 +102548,8 @@ app.route({
|
|
|
102503
102548
|
description: "获取cnb-board live的构建信息",
|
|
102504
102549
|
middleware: ["auth-admin"]
|
|
102505
102550
|
}).define(async (ctx) => {
|
|
102551
|
+
if (notCNBCheck(ctx))
|
|
102552
|
+
return;
|
|
102506
102553
|
const labels = [
|
|
102507
102554
|
{
|
|
102508
102555
|
title: "CNB_BUILD_ID",
|
|
@@ -102744,6 +102791,8 @@ app.route({
|
|
|
102744
102791
|
description: "获取cnb-board live的NPC信息",
|
|
102745
102792
|
middleware: ["auth-admin"]
|
|
102746
102793
|
}).define(async (ctx) => {
|
|
102794
|
+
if (notCNBCheck(ctx))
|
|
102795
|
+
return;
|
|
102747
102796
|
const labels = [
|
|
102748
102797
|
{
|
|
102749
102798
|
title: "CNB_NPC_SLUG",
|
|
@@ -102787,6 +102836,8 @@ app.route({
|
|
|
102787
102836
|
description: "获取cnb-board live的评论信息",
|
|
102788
102837
|
middleware: ["auth-admin"]
|
|
102789
102838
|
}).define(async (ctx) => {
|
|
102839
|
+
if (notCNBCheck(ctx))
|
|
102840
|
+
return;
|
|
102790
102841
|
const labels = [
|
|
102791
102842
|
{
|
|
102792
102843
|
title: "CNB_COMMENT_ID",
|
package/dist/assistant-server.js
CHANGED
|
@@ -83251,6 +83251,7 @@ class AssistantConfig {
|
|
|
83251
83251
|
}
|
|
83252
83252
|
getDefaultInitAssistantConfig() {
|
|
83253
83253
|
const id = randomId2();
|
|
83254
|
+
const isCNB = !!useKey2("CNB");
|
|
83254
83255
|
return {
|
|
83255
83256
|
app: {
|
|
83256
83257
|
url: "https://kevisual.cn",
|
|
@@ -83258,7 +83259,7 @@ class AssistantConfig {
|
|
|
83258
83259
|
},
|
|
83259
83260
|
description: "助手配置文件",
|
|
83260
83261
|
docs: "https://kevisual.cn/root/cli/docs/",
|
|
83261
|
-
home: "/root/home",
|
|
83262
|
+
home: isCNB ? "/root/cli-center" : "/root/home",
|
|
83262
83263
|
proxy: [],
|
|
83263
83264
|
share: {
|
|
83264
83265
|
enabled: true,
|
|
@@ -127110,47 +127111,56 @@ var getLiveMdContent = (opts) => {
|
|
|
127110
127111
|
`;
|
|
127111
127112
|
const labels = [
|
|
127112
127113
|
{
|
|
127113
|
-
|
|
127114
|
+
key: "vscodeWebUrl",
|
|
127115
|
+
title: "VSCode Web 地址",
|
|
127114
127116
|
value: vscodeWebUrl,
|
|
127115
127117
|
description: "VSCode Web 的访问地址"
|
|
127116
127118
|
},
|
|
127117
127119
|
{
|
|
127118
|
-
|
|
127120
|
+
key: "kevisualUrl",
|
|
127121
|
+
title: "Kevisual 地址",
|
|
127119
127122
|
value: kevisualUrl,
|
|
127120
127123
|
description: "Kevisual 的访问地址,可以通过该地址访问 Kevisual 服务"
|
|
127121
127124
|
},
|
|
127122
127125
|
{
|
|
127123
|
-
|
|
127126
|
+
key: "cnbTempToken",
|
|
127127
|
+
title: "CNB Token",
|
|
127124
127128
|
value: token,
|
|
127125
127129
|
description: "CNB 临时 Token,保持和环境变量 CNB_TOKEN 一致"
|
|
127126
127130
|
},
|
|
127127
127131
|
{
|
|
127128
|
-
|
|
127132
|
+
key: "openWebUrl",
|
|
127133
|
+
title: "OpenWebUI 地址",
|
|
127129
127134
|
value: openWebUrl,
|
|
127130
127135
|
description: "OpenWebUI 的访问地址,可以通过该地址访问 OpenWebUI 服务"
|
|
127131
127136
|
},
|
|
127132
127137
|
{
|
|
127133
|
-
|
|
127138
|
+
key: "openclawUrl",
|
|
127139
|
+
title: "OpenClaw 地址",
|
|
127134
127140
|
value: openclawUrl,
|
|
127135
127141
|
description: "OpenClaw 的访问地址,可以通过该地址访问 OpenClaw 服务"
|
|
127136
127142
|
},
|
|
127137
127143
|
{
|
|
127138
|
-
|
|
127144
|
+
key: "openclawUrlSecret",
|
|
127145
|
+
title: "OpenClaw 访问地址(含 Token)",
|
|
127139
127146
|
value: openclawUrlSecret,
|
|
127140
127147
|
description: "OpenClaw 的访问地址,包含 token 参数,可以直接访问 OpenClaw 服务"
|
|
127141
127148
|
},
|
|
127142
127149
|
{
|
|
127143
|
-
|
|
127150
|
+
key: "opencodeUrl",
|
|
127151
|
+
title: "OpenCode 地址",
|
|
127144
127152
|
value: opencodeUrl,
|
|
127145
127153
|
description: "OpenCode 的访问地址,可以通过该地址访问 OpenCode 服务"
|
|
127146
127154
|
},
|
|
127147
127155
|
{
|
|
127148
|
-
|
|
127156
|
+
key: "opencodeUrlSecret",
|
|
127157
|
+
title: "OpenCode 访问地址(含 Token)",
|
|
127149
127158
|
value: opencodeUrlSecret,
|
|
127150
127159
|
description: "OpenCode 的访问地址,包含 token 参数,可以直接访问 OpenCode 服务"
|
|
127151
127160
|
},
|
|
127152
127161
|
{
|
|
127153
|
-
|
|
127162
|
+
key: "docs",
|
|
127163
|
+
title: "配置说明文档",
|
|
127154
127164
|
value: TEMPLATE,
|
|
127155
127165
|
description: "开发环境模式配置说明文档"
|
|
127156
127166
|
}
|
|
@@ -127199,13 +127209,19 @@ var createOSInfo = (more = false) => {
|
|
|
127199
127209
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
127200
127210
|
return (bytes / Math.pow(1024, i)).toFixed(2) + " " + sizes[i];
|
|
127201
127211
|
};
|
|
127202
|
-
const bootTime = os7.uptime();
|
|
127203
127212
|
const formatUptime = (seconds) => {
|
|
127204
127213
|
const days = Math.floor(seconds / 86400);
|
|
127205
127214
|
const hours = Math.floor(seconds % 86400 / 3600);
|
|
127206
127215
|
const minutes = Math.floor(seconds % 3600 / 60);
|
|
127207
127216
|
const secs = Math.floor(seconds % 60);
|
|
127208
|
-
|
|
127217
|
+
let uptimeStr = "";
|
|
127218
|
+
if (days > 0)
|
|
127219
|
+
uptimeStr += `${days}天 `;
|
|
127220
|
+
if (hours > 0)
|
|
127221
|
+
uptimeStr += `${hours}小时 `;
|
|
127222
|
+
if (minutes > 0)
|
|
127223
|
+
uptimeStr += `${minutes}分钟 `;
|
|
127224
|
+
return `${uptimeStr}${secs}秒`;
|
|
127209
127225
|
};
|
|
127210
127226
|
let diskUsage = "";
|
|
127211
127227
|
try {
|
|
@@ -127215,37 +127231,40 @@ var createOSInfo = (more = false) => {
|
|
|
127215
127231
|
diskUsage = "获取失败";
|
|
127216
127232
|
}
|
|
127217
127233
|
labels.push({
|
|
127218
|
-
|
|
127234
|
+
key: "cpuUsage",
|
|
127235
|
+
title: "CPU 使用率",
|
|
127219
127236
|
value: `${cpuUsage}%`,
|
|
127220
127237
|
description: "CPU 使用率"
|
|
127221
127238
|
}, {
|
|
127222
|
-
|
|
127239
|
+
key: "cpuCores",
|
|
127240
|
+
title: "CPU 核心数",
|
|
127223
127241
|
value: `${cpus.length}`,
|
|
127224
127242
|
description: "CPU 核心数"
|
|
127225
127243
|
}, {
|
|
127226
|
-
|
|
127244
|
+
key: "memoryUsed",
|
|
127245
|
+
title: "已使用内存",
|
|
127227
127246
|
value: formatBytes(memUsed),
|
|
127228
127247
|
description: "已使用内存"
|
|
127229
127248
|
}, {
|
|
127230
|
-
|
|
127249
|
+
key: "memoryTotal",
|
|
127250
|
+
title: "总内存",
|
|
127231
127251
|
value: formatBytes(memTotal),
|
|
127232
127252
|
description: "总内存"
|
|
127233
127253
|
}, {
|
|
127234
|
-
|
|
127254
|
+
key: "memoryFree",
|
|
127255
|
+
title: "空闲内存",
|
|
127235
127256
|
value: formatBytes(memFree),
|
|
127236
127257
|
description: "空闲内存"
|
|
127237
127258
|
}, {
|
|
127238
|
-
|
|
127259
|
+
key: "memoryUsage",
|
|
127260
|
+
title: "内存使用率",
|
|
127239
127261
|
value: `${memUsage}%`,
|
|
127240
127262
|
description: "内存使用率"
|
|
127241
127263
|
}, {
|
|
127242
|
-
|
|
127264
|
+
key: "diskUsage",
|
|
127265
|
+
title: "磁盘使用",
|
|
127243
127266
|
value: diskUsage,
|
|
127244
127267
|
description: "当前目录磁盘使用情况"
|
|
127245
|
-
}, {
|
|
127246
|
-
title: "uptime",
|
|
127247
|
-
value: formatUptime(bootTime),
|
|
127248
|
-
description: "系统运行时间"
|
|
127249
127268
|
});
|
|
127250
127269
|
if (startTimer) {
|
|
127251
127270
|
const buildStartTime = import_dayjs.default(startTimer).format("YYYY-MM-DD HH:mm:ss");
|
|
@@ -127254,11 +127273,13 @@ var createOSInfo = (more = false) => {
|
|
|
127254
127273
|
const buildUptimeStr = formatUptime(Math.floor(buildUptime / 1000));
|
|
127255
127274
|
const maxRunTime = useKey("CNB_PIPELINE_MAX_RUN_TIME") || 0;
|
|
127256
127275
|
labels.push({
|
|
127257
|
-
|
|
127276
|
+
key: "buildStartTime",
|
|
127277
|
+
title: "构建启动时间",
|
|
127258
127278
|
value: buildStartTime,
|
|
127259
127279
|
description: "构建启动时间"
|
|
127260
127280
|
}, {
|
|
127261
|
-
|
|
127281
|
+
key: "buildUptime",
|
|
127282
|
+
title: "构建已运行时间",
|
|
127262
127283
|
value: buildUptimeStr,
|
|
127263
127284
|
description: "构建已运行时间"
|
|
127264
127285
|
});
|
|
@@ -127271,11 +127292,13 @@ var createOSInfo = (more = false) => {
|
|
|
127271
127292
|
}
|
|
127272
127293
|
const timeTo4Str = `[距离晚上4点重启时间: ${formatUptime(Math.floor(timeTo4 / 1000))}]`;
|
|
127273
127294
|
labels.push({
|
|
127274
|
-
|
|
127295
|
+
key: "buildMaxRunTime",
|
|
127296
|
+
title: "最大运行时间",
|
|
127275
127297
|
value: formatUptime(Math.floor(maxRunTime / 1000)),
|
|
127276
127298
|
description: "构建最大运行时间(限制时间)"
|
|
127277
127299
|
});
|
|
127278
127300
|
labels.unshift({
|
|
127301
|
+
key: "remainingTime",
|
|
127279
127302
|
title: "剩余时间",
|
|
127280
127303
|
value: formatUptime(Math.floor((maxRunTime - buildUptime) / 1000)) + " " + timeTo4Str,
|
|
127281
127304
|
description: "构建剩余时间"
|
|
@@ -127285,31 +127308,38 @@ var createOSInfo = (more = false) => {
|
|
|
127285
127308
|
if (more) {
|
|
127286
127309
|
const loadavg = os7.loadavg();
|
|
127287
127310
|
labels.push({
|
|
127288
|
-
|
|
127311
|
+
key: "hostname",
|
|
127312
|
+
title: "主机名",
|
|
127289
127313
|
value: os7.hostname(),
|
|
127290
127314
|
description: "主机名"
|
|
127291
127315
|
}, {
|
|
127292
|
-
|
|
127316
|
+
key: "platform",
|
|
127317
|
+
title: "运行平台",
|
|
127293
127318
|
value: os7.platform(),
|
|
127294
127319
|
description: "运行平台"
|
|
127295
127320
|
}, {
|
|
127296
|
-
|
|
127321
|
+
key: "arch",
|
|
127322
|
+
title: "系统架构",
|
|
127297
127323
|
value: os7.arch(),
|
|
127298
127324
|
description: "系统架构"
|
|
127299
127325
|
}, {
|
|
127300
|
-
|
|
127326
|
+
key: "osType",
|
|
127327
|
+
title: "操作系统类型",
|
|
127301
127328
|
value: os7.type(),
|
|
127302
127329
|
description: "操作系统类型"
|
|
127303
127330
|
}, {
|
|
127304
|
-
|
|
127331
|
+
key: "loadavg1m",
|
|
127332
|
+
title: "系统负载 (1分钟)",
|
|
127305
127333
|
value: loadavg[0].toFixed(2),
|
|
127306
127334
|
description: "系统负载 (1分钟)"
|
|
127307
127335
|
}, {
|
|
127308
|
-
|
|
127336
|
+
key: "loadavg5m",
|
|
127337
|
+
title: "系统负载 (5分钟)",
|
|
127309
127338
|
value: loadavg[1].toFixed(2),
|
|
127310
127339
|
description: "系统负载 (5分钟)"
|
|
127311
127340
|
}, {
|
|
127312
|
-
|
|
127341
|
+
key: "loadavg15m",
|
|
127342
|
+
title: "系统负载 (15分钟)",
|
|
127313
127343
|
value: loadavg[2].toFixed(2),
|
|
127314
127344
|
description: "系统负载 (15分钟)"
|
|
127315
127345
|
});
|
|
@@ -127318,6 +127348,17 @@ var createOSInfo = (more = false) => {
|
|
|
127318
127348
|
};
|
|
127319
127349
|
|
|
127320
127350
|
// src/routes/cnb-board/cnb-dev-env.ts
|
|
127351
|
+
var notCNBCheck = (ctx) => {
|
|
127352
|
+
const isCNB = useKey("CNB");
|
|
127353
|
+
if (!isCNB) {
|
|
127354
|
+
ctx.body = {
|
|
127355
|
+
title: "非 cnb-board 环境",
|
|
127356
|
+
list: []
|
|
127357
|
+
};
|
|
127358
|
+
return true;
|
|
127359
|
+
}
|
|
127360
|
+
return false;
|
|
127361
|
+
};
|
|
127321
127362
|
app.route({
|
|
127322
127363
|
path: "cnb_board",
|
|
127323
127364
|
key: "live",
|
|
@@ -127331,6 +127372,8 @@ app.route({
|
|
|
127331
127372
|
}).define(async (ctx) => {
|
|
127332
127373
|
const more = ctx.query?.more ?? false;
|
|
127333
127374
|
const list4 = getLiveMdContent({ more });
|
|
127375
|
+
if (notCNBCheck(ctx))
|
|
127376
|
+
return;
|
|
127334
127377
|
ctx.body = {
|
|
127335
127378
|
title: "开发环境模式配置",
|
|
127336
127379
|
list: list4
|
|
@@ -127345,7 +127388,9 @@ app.route({
|
|
|
127345
127388
|
const repoSlug = useKey("CNB_REPO_SLUG") || "";
|
|
127346
127389
|
const repoName = useKey("CNB_REPO_NAME") || "";
|
|
127347
127390
|
const repoId = useKey("CNB_REPO_ID") || "";
|
|
127348
|
-
const repoUrlHttps = useKey("
|
|
127391
|
+
const repoUrlHttps = useKey("CNB_REPO_UR if (notCNBCheck(ctx)) return;L_HTTPS") || "";
|
|
127392
|
+
if (notCNBCheck(ctx))
|
|
127393
|
+
return;
|
|
127349
127394
|
const repoNameFromSlug = repoSlug.split("/").pop() || "";
|
|
127350
127395
|
const labels = [
|
|
127351
127396
|
{
|
|
@@ -127390,6 +127435,8 @@ app.route({
|
|
|
127390
127435
|
description: "获取cnb-board live的构建信息",
|
|
127391
127436
|
middleware: ["auth-admin"]
|
|
127392
127437
|
}).define(async (ctx) => {
|
|
127438
|
+
if (notCNBCheck(ctx))
|
|
127439
|
+
return;
|
|
127393
127440
|
const labels = [
|
|
127394
127441
|
{
|
|
127395
127442
|
title: "CNB_BUILD_ID",
|
|
@@ -127631,6 +127678,8 @@ app.route({
|
|
|
127631
127678
|
description: "获取cnb-board live的NPC信息",
|
|
127632
127679
|
middleware: ["auth-admin"]
|
|
127633
127680
|
}).define(async (ctx) => {
|
|
127681
|
+
if (notCNBCheck(ctx))
|
|
127682
|
+
return;
|
|
127634
127683
|
const labels = [
|
|
127635
127684
|
{
|
|
127636
127685
|
title: "CNB_NPC_SLUG",
|
|
@@ -127674,6 +127723,8 @@ app.route({
|
|
|
127674
127723
|
description: "获取cnb-board live的评论信息",
|
|
127675
127724
|
middleware: ["auth-admin"]
|
|
127676
127725
|
}).define(async (ctx) => {
|
|
127726
|
+
if (notCNBCheck(ctx))
|
|
127727
|
+
return;
|
|
127677
127728
|
const labels = [
|
|
127678
127729
|
{
|
|
127679
127730
|
title: "CNB_COMMENT_ID",
|
package/dist/assistant.js
CHANGED
|
@@ -28799,6 +28799,7 @@ class AssistantConfig {
|
|
|
28799
28799
|
}
|
|
28800
28800
|
getDefaultInitAssistantConfig() {
|
|
28801
28801
|
const id = randomId();
|
|
28802
|
+
const isCNB = !!useKey("CNB");
|
|
28802
28803
|
return {
|
|
28803
28804
|
app: {
|
|
28804
28805
|
url: "https://kevisual.cn",
|
|
@@ -28806,7 +28807,7 @@ class AssistantConfig {
|
|
|
28806
28807
|
},
|
|
28807
28808
|
description: "助手配置文件",
|
|
28808
28809
|
docs: "https://kevisual.cn/root/cli/docs/",
|
|
28809
|
-
home: "/root/home",
|
|
28810
|
+
home: isCNB ? "/root/cli-center" : "/root/home",
|
|
28810
28811
|
proxy: [],
|
|
28811
28812
|
share: {
|
|
28812
28813
|
enabled: true,
|
package/dist/envision.js
CHANGED
|
@@ -22312,8 +22312,8 @@ InitEnv.init();
|
|
|
22312
22312
|
var version = useContextKey("version", () => {
|
|
22313
22313
|
let version2 = "0.0.64";
|
|
22314
22314
|
try {
|
|
22315
|
-
if ("0.1.
|
|
22316
|
-
version2 = "0.1.
|
|
22315
|
+
if ("0.1.12")
|
|
22316
|
+
version2 = "0.1.12";
|
|
22317
22317
|
} catch (e) {}
|
|
22318
22318
|
return version2;
|
|
22319
22319
|
});
|