@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/agent/command.ts
ADDED
|
@@ -13,7 +13,7 @@ export const execCommand = (command: string, options: { cwd?: string } = {}) =>
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
app.route({
|
|
16
|
-
path: '
|
|
16
|
+
path: 'cnb_board',
|
|
17
17
|
key: 'is-cnb-board',
|
|
18
18
|
description: '检查是否是 cnb-board 环境',
|
|
19
19
|
middleware: ['auth-admin']
|
|
@@ -28,7 +28,7 @@ app.route({
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
app.route({
|
|
31
|
-
path: '
|
|
31
|
+
path: 'cnb_board',
|
|
32
32
|
key: 'exit',
|
|
33
33
|
description: 'cnb的工作环境退出程序',
|
|
34
34
|
middleware: ['auth-admin'],
|
package/agent/routes/index.ts
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useKey } from '@kevisual/context';
|
|
2
|
+
import { app, cnb } from '../../app.ts';
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
|
|
5
|
+
app.route({
|
|
6
|
+
path: 'cnb',
|
|
7
|
+
key: 'get-assistant-url',
|
|
8
|
+
description: '获取cnb工作空间中部署的各个助手的访问地址',
|
|
9
|
+
middleware: ['auth'],
|
|
10
|
+
metadata: {
|
|
11
|
+
args: {
|
|
12
|
+
more: z.boolean().describe('需要更多信息')
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}).define(async (ctx) => {
|
|
16
|
+
const uri = useKey('CNB_VSCODE_PROXY_URI') as string || '';
|
|
17
|
+
const base = {
|
|
18
|
+
base: uri,
|
|
19
|
+
link: uri.replace('{{port}}', '51515'),
|
|
20
|
+
kevisual: uri.replace('{{port}}', '51515'),
|
|
21
|
+
openclaw: uri.replace('{{port}}', '80'),
|
|
22
|
+
opencode: uri.replace('{{port}}', '100'),
|
|
23
|
+
openwebui: uri.replace('{{port}}', '200'),
|
|
24
|
+
note: uri.replace('{{port}}', '3000'),
|
|
25
|
+
uptime: uri.replace('{{port}}', '3001'),
|
|
26
|
+
immich: uri.replace('{{port}}', '2283'),
|
|
27
|
+
nocodb: uri.replace('{{port}}', '4000'),
|
|
28
|
+
openlist: uri.replace('{{port}}', '5244'),
|
|
29
|
+
xiaoyao: uri.replace('{{port}}', '5678'),
|
|
30
|
+
meilisearch: uri.replace('{{port}}', '7700'),
|
|
31
|
+
bark: uri.replace('{{port}}', '9111'),
|
|
32
|
+
vaultwarden: uri.replace('{{port}}', '8180'),
|
|
33
|
+
music: uri.replace('{{port}}', '8096'),
|
|
34
|
+
jellyfin: uri.replace('{{port}}', '8096'),
|
|
35
|
+
homeassistant: uri.replace('{{port}}', '8123'),
|
|
36
|
+
cloudreve: uri.replace('{{port}}', '5212'),
|
|
37
|
+
filebrowser: uri.replace('{{port}}', '8081'),
|
|
38
|
+
// newapi: uri.replace('{{port}}', '8080'),
|
|
39
|
+
vscode: useKey('CNB_VSCODE_WEB_URL') as string || '',
|
|
40
|
+
codeServer: uri.replace('{{port}}', '10000'),
|
|
41
|
+
gitea: uri.replace('{{port}}', '3000'),
|
|
42
|
+
calibre: uri.replace('{{port}}', '8083'),
|
|
43
|
+
searXNG: uri.replace('{{port}}', '8888'),
|
|
44
|
+
}
|
|
45
|
+
ctx.body = {
|
|
46
|
+
...base,
|
|
47
|
+
}
|
|
48
|
+
}).addTo(app);
|
|
@@ -30,21 +30,20 @@ app.route({
|
|
|
30
30
|
ctx.throw(401, 'CNB_COOKIE 环境变量无效或已过期,请重新登录获取新的cookie');
|
|
31
31
|
}
|
|
32
32
|
const res = await cnb.workspace.getWorkspaceCookie(repo, pipelineId);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (res.code === 200) {
|
|
36
|
-
cookie = res.data.value;
|
|
37
|
-
console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
|
|
38
|
-
} else {
|
|
39
|
-
ctx.throw(500, `获取工作空间访问cookie失败: ${res.message}`);
|
|
33
|
+
if (res.code !== 200 || !res.data?.cookie) {
|
|
34
|
+
ctx.throw(500, `获取工作空间 Cookie 失败: ${res.message}`);
|
|
40
35
|
}
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
// 添加保活数据
|
|
38
|
+
const liveData = createLiveData({
|
|
39
|
+
repo,
|
|
40
|
+
pipelineId,
|
|
41
|
+
cookie: res.data.cookie
|
|
42
|
+
});
|
|
43
|
+
addKeepAliveData(liveData);
|
|
44
|
+
console.log('已添加 keep-alive 数据');
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
addKeepAliveData(config);
|
|
46
|
-
|
|
47
|
-
ctx.body = { content: `已启动保持工作空间 ${wsUrl} 存活的任务`, data: config };
|
|
46
|
+
ctx.body = { content: `已启动保持工作空间 ${repo}/${pipelineId} 存活的任务`, data: liveData };
|
|
48
47
|
}).addTo(app);
|
|
49
48
|
|
|
50
49
|
// 停止保持工作空间存活技能
|
package/bin/index.js
ADDED
package/dist/cli.d.ts
ADDED