@kevisual/cnb 0.0.35 → 0.0.37
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/agent/command.ts +4 -0
- package/agent/routes/cnb-board/index.ts +2 -2
- package/agent/routes/index.ts +1 -1
- package/agent/routes/share/index.ts +48 -0
- package/agent/routes/workspace/keep.ts +11 -12
- package/bin/index.js +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +57852 -0
- package/dist/opencode.js +64 -16
- package/dist/routes.js +63 -15
- package/package.json +10 -6
package/dist/opencode.js
CHANGED
|
@@ -316,7 +316,7 @@ var require_dayjs_min = __commonJS((exports, module) => {
|
|
|
316
316
|
});
|
|
317
317
|
});
|
|
318
318
|
|
|
319
|
-
// node_modules/.pnpm/@kevisual+router@0.0.
|
|
319
|
+
// node_modules/.pnpm/@kevisual+router@0.0.88/node_modules/@kevisual/router/dist/router.js
|
|
320
320
|
import { createRequire } from "node:module";
|
|
321
321
|
import { webcrypto as crypto2 } from "node:crypto";
|
|
322
322
|
import url2 from "node:url";
|
|
@@ -17597,6 +17597,10 @@ class QueryRouterServer extends QueryRouter {
|
|
|
17597
17597
|
}
|
|
17598
17598
|
return super.run(msg, ctx);
|
|
17599
17599
|
}
|
|
17600
|
+
async runAction(api2, payload, ctx) {
|
|
17601
|
+
const { path, key, id } = api2;
|
|
17602
|
+
return this.run({ path, key, id, payload }, ctx);
|
|
17603
|
+
}
|
|
17600
17604
|
}
|
|
17601
17605
|
var isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
17602
17606
|
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
|
|
@@ -33935,7 +33939,7 @@ config3(en_default2());
|
|
|
33935
33939
|
// node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
|
|
33936
33940
|
var zod_default = exports_external2;
|
|
33937
33941
|
|
|
33938
|
-
// node_modules/.pnpm/@opencode-ai+plugin@1.2.
|
|
33942
|
+
// node_modules/.pnpm/@opencode-ai+plugin@1.2.20/node_modules/@opencode-ai/plugin/dist/tool.js
|
|
33939
33943
|
function tool2(input) {
|
|
33940
33944
|
return input;
|
|
33941
33945
|
}
|
|
@@ -34280,18 +34284,17 @@ app.route({
|
|
|
34280
34284
|
ctx.throw(401, "CNB_COOKIE 环境变量无效或已过期,请重新登录获取新的cookie");
|
|
34281
34285
|
}
|
|
34282
34286
|
const res = await cnb.workspace.getWorkspaceCookie(repo2, pipelineId);
|
|
34283
|
-
|
|
34284
|
-
|
|
34285
|
-
if (res.code === 200) {
|
|
34286
|
-
cookie = res.data.value;
|
|
34287
|
-
console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
|
|
34288
|
-
} else {
|
|
34289
|
-
ctx.throw(500, `获取工作空间访问cookie失败: ${res.message}`);
|
|
34287
|
+
if (res.code !== 200 || !res.data?.cookie) {
|
|
34288
|
+
ctx.throw(500, `获取工作空间 Cookie 失败: ${res.message}`);
|
|
34290
34289
|
}
|
|
34291
|
-
|
|
34292
|
-
|
|
34293
|
-
|
|
34294
|
-
|
|
34290
|
+
const liveData = createLiveData({
|
|
34291
|
+
repo: repo2,
|
|
34292
|
+
pipelineId,
|
|
34293
|
+
cookie: res.data.cookie
|
|
34294
|
+
});
|
|
34295
|
+
addKeepAliveData(liveData);
|
|
34296
|
+
console.log("已添加 keep-alive 数据");
|
|
34297
|
+
ctx.body = { content: `已启动保持工作空间 ${repo2}/${pipelineId} 存活的任务`, data: liveData };
|
|
34295
34298
|
}).addTo(app);
|
|
34296
34299
|
app.route({
|
|
34297
34300
|
path: "cnb",
|
|
@@ -55533,7 +55536,7 @@ var execCommand = (command, options = {}) => {
|
|
|
55533
55536
|
});
|
|
55534
55537
|
};
|
|
55535
55538
|
app.route({
|
|
55536
|
-
path: "
|
|
55539
|
+
path: "cnb_board",
|
|
55537
55540
|
key: "is-cnb-board",
|
|
55538
55541
|
description: "检查是否是 cnb-board 环境",
|
|
55539
55542
|
middleware: ["auth-admin"]
|
|
@@ -55544,7 +55547,7 @@ app.route({
|
|
|
55544
55547
|
};
|
|
55545
55548
|
}).addTo(app);
|
|
55546
55549
|
app.route({
|
|
55547
|
-
path: "
|
|
55550
|
+
path: "cnb_board",
|
|
55548
55551
|
key: "exit",
|
|
55549
55552
|
description: "cnb的工作环境退出程序",
|
|
55550
55553
|
middleware: ["auth-admin"]
|
|
@@ -55553,6 +55556,51 @@ app.route({
|
|
|
55553
55556
|
execCommand(cmd);
|
|
55554
55557
|
}).addTo(app);
|
|
55555
55558
|
|
|
55559
|
+
// agent/routes/share/index.ts
|
|
55560
|
+
app.route({
|
|
55561
|
+
path: "cnb",
|
|
55562
|
+
key: "get-assistant-url",
|
|
55563
|
+
description: "获取cnb工作空间中部署的各个助手的访问地址",
|
|
55564
|
+
middleware: ["auth"],
|
|
55565
|
+
metadata: {
|
|
55566
|
+
args: {
|
|
55567
|
+
more: zod_default.boolean().describe("需要更多信息")
|
|
55568
|
+
}
|
|
55569
|
+
}
|
|
55570
|
+
}).define(async (ctx) => {
|
|
55571
|
+
const uri = useKey("CNB_VSCODE_PROXY_URI") || "";
|
|
55572
|
+
const base = {
|
|
55573
|
+
base: uri,
|
|
55574
|
+
link: uri.replace("{{port}}", "51515"),
|
|
55575
|
+
kevisual: uri.replace("{{port}}", "51515"),
|
|
55576
|
+
openclaw: uri.replace("{{port}}", "80"),
|
|
55577
|
+
opencode: uri.replace("{{port}}", "100"),
|
|
55578
|
+
openwebui: uri.replace("{{port}}", "200"),
|
|
55579
|
+
note: uri.replace("{{port}}", "3000"),
|
|
55580
|
+
uptime: uri.replace("{{port}}", "3001"),
|
|
55581
|
+
immich: uri.replace("{{port}}", "2283"),
|
|
55582
|
+
nocodb: uri.replace("{{port}}", "4000"),
|
|
55583
|
+
openlist: uri.replace("{{port}}", "5244"),
|
|
55584
|
+
xiaoyao: uri.replace("{{port}}", "5678"),
|
|
55585
|
+
meilisearch: uri.replace("{{port}}", "7700"),
|
|
55586
|
+
bark: uri.replace("{{port}}", "9111"),
|
|
55587
|
+
vaultwarden: uri.replace("{{port}}", "8180"),
|
|
55588
|
+
music: uri.replace("{{port}}", "8096"),
|
|
55589
|
+
jellyfin: uri.replace("{{port}}", "8096"),
|
|
55590
|
+
homeassistant: uri.replace("{{port}}", "8123"),
|
|
55591
|
+
cloudreve: uri.replace("{{port}}", "5212"),
|
|
55592
|
+
filebrowser: uri.replace("{{port}}", "8081"),
|
|
55593
|
+
vscode: useKey("CNB_VSCODE_WEB_URL") || "",
|
|
55594
|
+
codeServer: uri.replace("{{port}}", "10000"),
|
|
55595
|
+
gitea: uri.replace("{{port}}", "3000"),
|
|
55596
|
+
calibre: uri.replace("{{port}}", "8083"),
|
|
55597
|
+
searXNG: uri.replace("{{port}}", "8888")
|
|
55598
|
+
};
|
|
55599
|
+
ctx.body = {
|
|
55600
|
+
...base
|
|
55601
|
+
};
|
|
55602
|
+
}).addTo(app);
|
|
55603
|
+
|
|
55556
55604
|
// agent/routes/index.ts
|
|
55557
55605
|
var checkAppId = (ctx, appId) => {
|
|
55558
55606
|
const _appId = ctx?.app?.appId;
|
|
@@ -55582,7 +55630,7 @@ app.route({
|
|
|
55582
55630
|
}
|
|
55583
55631
|
}).addTo(app, { overwrite: false });
|
|
55584
55632
|
|
|
55585
|
-
// node_modules/.pnpm/@kevisual+router@0.0.
|
|
55633
|
+
// node_modules/.pnpm/@kevisual+router@0.0.88/node_modules/@kevisual/router/dist/opencode.js
|
|
55586
55634
|
import { webcrypto as crypto3 } from "node:crypto";
|
|
55587
55635
|
var __create5 = Object.create;
|
|
55588
55636
|
var __getProtoOf5 = Object.getPrototypeOf;
|
package/dist/routes.js
CHANGED
|
@@ -316,7 +316,7 @@ var require_dayjs_min = __commonJS((exports, module) => {
|
|
|
316
316
|
});
|
|
317
317
|
});
|
|
318
318
|
|
|
319
|
-
// node_modules/.pnpm/@kevisual+router@0.0.
|
|
319
|
+
// node_modules/.pnpm/@kevisual+router@0.0.88/node_modules/@kevisual/router/dist/router.js
|
|
320
320
|
import { createRequire } from "node:module";
|
|
321
321
|
import { webcrypto as crypto2 } from "node:crypto";
|
|
322
322
|
import url2 from "node:url";
|
|
@@ -17597,6 +17597,10 @@ class QueryRouterServer extends QueryRouter {
|
|
|
17597
17597
|
}
|
|
17598
17598
|
return super.run(msg, ctx);
|
|
17599
17599
|
}
|
|
17600
|
+
async runAction(api2, payload, ctx) {
|
|
17601
|
+
const { path, key, id } = api2;
|
|
17602
|
+
return this.run({ path, key, id, payload }, ctx);
|
|
17603
|
+
}
|
|
17600
17604
|
}
|
|
17601
17605
|
var isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
17602
17606
|
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
|
|
@@ -33935,7 +33939,7 @@ config3(en_default2());
|
|
|
33935
33939
|
// node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
|
|
33936
33940
|
var zod_default = exports_external2;
|
|
33937
33941
|
|
|
33938
|
-
// node_modules/.pnpm/@opencode-ai+plugin@1.2.
|
|
33942
|
+
// node_modules/.pnpm/@opencode-ai+plugin@1.2.20/node_modules/@opencode-ai/plugin/dist/tool.js
|
|
33939
33943
|
function tool2(input) {
|
|
33940
33944
|
return input;
|
|
33941
33945
|
}
|
|
@@ -34280,18 +34284,17 @@ app.route({
|
|
|
34280
34284
|
ctx.throw(401, "CNB_COOKIE 环境变量无效或已过期,请重新登录获取新的cookie");
|
|
34281
34285
|
}
|
|
34282
34286
|
const res = await cnb.workspace.getWorkspaceCookie(repo2, pipelineId);
|
|
34283
|
-
|
|
34284
|
-
|
|
34285
|
-
if (res.code === 200) {
|
|
34286
|
-
cookie = res.data.value;
|
|
34287
|
-
console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
|
|
34288
|
-
} else {
|
|
34289
|
-
ctx.throw(500, `获取工作空间访问cookie失败: ${res.message}`);
|
|
34287
|
+
if (res.code !== 200 || !res.data?.cookie) {
|
|
34288
|
+
ctx.throw(500, `获取工作空间 Cookie 失败: ${res.message}`);
|
|
34290
34289
|
}
|
|
34291
|
-
|
|
34292
|
-
|
|
34293
|
-
|
|
34294
|
-
|
|
34290
|
+
const liveData = createLiveData({
|
|
34291
|
+
repo: repo2,
|
|
34292
|
+
pipelineId,
|
|
34293
|
+
cookie: res.data.cookie
|
|
34294
|
+
});
|
|
34295
|
+
addKeepAliveData(liveData);
|
|
34296
|
+
console.log("已添加 keep-alive 数据");
|
|
34297
|
+
ctx.body = { content: `已启动保持工作空间 ${repo2}/${pipelineId} 存活的任务`, data: liveData };
|
|
34295
34298
|
}).addTo(app);
|
|
34296
34299
|
app.route({
|
|
34297
34300
|
path: "cnb",
|
|
@@ -55533,7 +55536,7 @@ var execCommand = (command, options = {}) => {
|
|
|
55533
55536
|
});
|
|
55534
55537
|
};
|
|
55535
55538
|
app.route({
|
|
55536
|
-
path: "
|
|
55539
|
+
path: "cnb_board",
|
|
55537
55540
|
key: "is-cnb-board",
|
|
55538
55541
|
description: "检查是否是 cnb-board 环境",
|
|
55539
55542
|
middleware: ["auth-admin"]
|
|
@@ -55544,7 +55547,7 @@ app.route({
|
|
|
55544
55547
|
};
|
|
55545
55548
|
}).addTo(app);
|
|
55546
55549
|
app.route({
|
|
55547
|
-
path: "
|
|
55550
|
+
path: "cnb_board",
|
|
55548
55551
|
key: "exit",
|
|
55549
55552
|
description: "cnb的工作环境退出程序",
|
|
55550
55553
|
middleware: ["auth-admin"]
|
|
@@ -55553,6 +55556,51 @@ app.route({
|
|
|
55553
55556
|
execCommand(cmd);
|
|
55554
55557
|
}).addTo(app);
|
|
55555
55558
|
|
|
55559
|
+
// agent/routes/share/index.ts
|
|
55560
|
+
app.route({
|
|
55561
|
+
path: "cnb",
|
|
55562
|
+
key: "get-assistant-url",
|
|
55563
|
+
description: "获取cnb工作空间中部署的各个助手的访问地址",
|
|
55564
|
+
middleware: ["auth"],
|
|
55565
|
+
metadata: {
|
|
55566
|
+
args: {
|
|
55567
|
+
more: zod_default.boolean().describe("需要更多信息")
|
|
55568
|
+
}
|
|
55569
|
+
}
|
|
55570
|
+
}).define(async (ctx) => {
|
|
55571
|
+
const uri = useKey("CNB_VSCODE_PROXY_URI") || "";
|
|
55572
|
+
const base = {
|
|
55573
|
+
base: uri,
|
|
55574
|
+
link: uri.replace("{{port}}", "51515"),
|
|
55575
|
+
kevisual: uri.replace("{{port}}", "51515"),
|
|
55576
|
+
openclaw: uri.replace("{{port}}", "80"),
|
|
55577
|
+
opencode: uri.replace("{{port}}", "100"),
|
|
55578
|
+
openwebui: uri.replace("{{port}}", "200"),
|
|
55579
|
+
note: uri.replace("{{port}}", "3000"),
|
|
55580
|
+
uptime: uri.replace("{{port}}", "3001"),
|
|
55581
|
+
immich: uri.replace("{{port}}", "2283"),
|
|
55582
|
+
nocodb: uri.replace("{{port}}", "4000"),
|
|
55583
|
+
openlist: uri.replace("{{port}}", "5244"),
|
|
55584
|
+
xiaoyao: uri.replace("{{port}}", "5678"),
|
|
55585
|
+
meilisearch: uri.replace("{{port}}", "7700"),
|
|
55586
|
+
bark: uri.replace("{{port}}", "9111"),
|
|
55587
|
+
vaultwarden: uri.replace("{{port}}", "8180"),
|
|
55588
|
+
music: uri.replace("{{port}}", "8096"),
|
|
55589
|
+
jellyfin: uri.replace("{{port}}", "8096"),
|
|
55590
|
+
homeassistant: uri.replace("{{port}}", "8123"),
|
|
55591
|
+
cloudreve: uri.replace("{{port}}", "5212"),
|
|
55592
|
+
filebrowser: uri.replace("{{port}}", "8081"),
|
|
55593
|
+
vscode: useKey("CNB_VSCODE_WEB_URL") || "",
|
|
55594
|
+
codeServer: uri.replace("{{port}}", "10000"),
|
|
55595
|
+
gitea: uri.replace("{{port}}", "3000"),
|
|
55596
|
+
calibre: uri.replace("{{port}}", "8083"),
|
|
55597
|
+
searXNG: uri.replace("{{port}}", "8888")
|
|
55598
|
+
};
|
|
55599
|
+
ctx.body = {
|
|
55600
|
+
...base
|
|
55601
|
+
};
|
|
55602
|
+
}).addTo(app);
|
|
55603
|
+
|
|
55556
55604
|
// agent/routes/index.ts
|
|
55557
55605
|
var checkAppId = (ctx, appId) => {
|
|
55558
55606
|
const _appId = ctx?.app?.appId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/cnb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"flow": "ev npm patch && pnpm build && ev npm publish npm -p"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [],
|
|
11
|
+
"bin": {
|
|
12
|
+
"cnb": "./bin/index.js"
|
|
13
|
+
},
|
|
11
14
|
"files": [
|
|
12
15
|
"dist",
|
|
13
16
|
"src",
|
|
@@ -21,13 +24,14 @@
|
|
|
21
24
|
"devDependencies": {
|
|
22
25
|
"@kevisual/ai": "^0.0.26",
|
|
23
26
|
"@kevisual/code-builder": "^0.0.6",
|
|
24
|
-
"@kevisual/dts": "^0.0.4",
|
|
25
27
|
"@kevisual/context": "^0.0.8",
|
|
28
|
+
"@kevisual/dts": "^0.0.4",
|
|
26
29
|
"@kevisual/types": "^0.0.12",
|
|
27
|
-
"@opencode-ai/plugin": "^1.2.
|
|
30
|
+
"@opencode-ai/plugin": "^1.2.20",
|
|
28
31
|
"@types/bun": "^1.3.10",
|
|
29
|
-
"@types/node": "^25.3.
|
|
32
|
+
"@types/node": "^25.3.5",
|
|
30
33
|
"@types/ws": "^8.18.1",
|
|
34
|
+
"commander": "^14.0.3",
|
|
31
35
|
"dayjs": "^1.11.19",
|
|
32
36
|
"dotenv": "^17.3.1"
|
|
33
37
|
},
|
|
@@ -38,8 +42,8 @@
|
|
|
38
42
|
"zod": "^4.3.6"
|
|
39
43
|
},
|
|
40
44
|
"dependencies": {
|
|
41
|
-
"@kevisual/query": "^0.0.
|
|
42
|
-
"@kevisual/router": "^0.0.
|
|
45
|
+
"@kevisual/query": "^0.0.53",
|
|
46
|
+
"@kevisual/router": "^0.0.88",
|
|
43
47
|
"@kevisual/use-config": "^1.0.30",
|
|
44
48
|
"es-toolkit": "^1.45.1",
|
|
45
49
|
"nanoid": "^5.1.6",
|