@kevisual/cnb 0.0.34 → 0.0.36
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/call/index.ts +1 -1
- package/agent/routes/cnb-board/index.ts +2 -2
- package/agent/routes/cnb-env/check.ts +1 -1
- package/agent/routes/cnb-env/env.ts +2 -2
- package/agent/routes/cnb-env/vscode.ts +4 -4
- package/agent/routes/index.ts +3 -3
- package/agent/routes/issues/issue.ts +2 -2
- package/agent/routes/issues/list.ts +3 -2
- package/agent/routes/knowledge/ai.ts +4 -3
- package/agent/routes/repo/list.ts +1 -1
- package/agent/routes/repo/repo.ts +4 -4
- package/agent/routes/share/index.ts +48 -0
- package/agent/routes/workspace/index.ts +5 -5
- package/agent/routes/workspace/keep.ts +3 -3
- package/agent/routes/workspace/skills.ts +2 -2
- package/bin/index.js +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +57853 -0
- package/dist/opencode.js +86 -37
- package/dist/routes.js +85 -36
- 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'],
|
|
@@ -6,7 +6,7 @@ app.route({
|
|
|
6
6
|
path: 'cnb',
|
|
7
7
|
key: 'set-cnb-cookie',
|
|
8
8
|
description: '设置当前cnb工作空间的cookie环境变量',
|
|
9
|
-
middleware: ['admin
|
|
9
|
+
middleware: ['auth-admin'],
|
|
10
10
|
metadata: {
|
|
11
11
|
tags: ['opencode'],
|
|
12
12
|
...createSkill({
|
|
@@ -33,7 +33,7 @@ app.route({
|
|
|
33
33
|
path: 'cnb',
|
|
34
34
|
key: 'get-cnb-cookie',
|
|
35
35
|
description: '获取当前cnb工作空间的cookie环境变量',
|
|
36
|
-
middleware: ['admin
|
|
36
|
+
middleware: ['auth-admin'],
|
|
37
37
|
metadata: {
|
|
38
38
|
tags: ['opencode'],
|
|
39
39
|
...createSkill({
|
|
@@ -11,7 +11,7 @@ app.route({
|
|
|
11
11
|
path: 'cnb',
|
|
12
12
|
key: 'get-cnb-port-uri',
|
|
13
13
|
description: '获取当前cnb工作空间的port代理uri',
|
|
14
|
-
middleware: ['admin
|
|
14
|
+
middleware: ['auth-admin'],
|
|
15
15
|
metadata: {
|
|
16
16
|
tags: ['opencode'],
|
|
17
17
|
...createSkill({
|
|
@@ -19,12 +19,12 @@ app.route({
|
|
|
19
19
|
title: '获取当前cnb工作空间的port代理uri',
|
|
20
20
|
summary: '获取当前cnb工作空间的port代理uri,用于端口转发',
|
|
21
21
|
args: {
|
|
22
|
-
port: tool.schema.number().optional().describe('端口号,默认为
|
|
22
|
+
port: tool.schema.number().optional().describe('端口号,默认为51515'),
|
|
23
23
|
}
|
|
24
24
|
})
|
|
25
25
|
}
|
|
26
26
|
}).define(async (ctx) => {
|
|
27
|
-
const port = ctx.query?.port ||
|
|
27
|
+
const port = ctx.query?.port || 51515;
|
|
28
28
|
const uri = CNB_ENV?.CNB_VSCODE_PROXY_URI as string || '';
|
|
29
29
|
const finalUri = uri.replace('{{port}}', port.toString());
|
|
30
30
|
let content = `
|
|
@@ -40,7 +40,7 @@ app.route({
|
|
|
40
40
|
path: 'cnb',
|
|
41
41
|
key: 'get-cnb-vscode-uri',
|
|
42
42
|
description: '获取当前cnb工作空间的vscode代理uri, 包括多种访问方式, 如web、vscode、codebuddy、cursor、ssh',
|
|
43
|
-
middleware: ['admin
|
|
43
|
+
middleware: ['auth-admin'],
|
|
44
44
|
metadata: {
|
|
45
45
|
tags: ['opencode'],
|
|
46
46
|
...createSkill({
|
package/agent/routes/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import './cnb-env/index.ts'
|
|
|
7
7
|
import './knowledge/index.ts'
|
|
8
8
|
import './issues/index.ts'
|
|
9
9
|
import './cnb-board/index.ts';
|
|
10
|
-
|
|
10
|
+
import './share/index.ts';
|
|
11
11
|
/**
|
|
12
12
|
* 验证上下文中的 App ID 是否与指定的 App ID 匹配
|
|
13
13
|
* @param {any} ctx - 上下文对象,可能包含 appId 属性
|
|
@@ -37,8 +37,8 @@ app.route({
|
|
|
37
37
|
}).addTo(app, { overwrite: false });
|
|
38
38
|
|
|
39
39
|
app.route({
|
|
40
|
-
id: 'admin
|
|
41
|
-
path: 'admin
|
|
40
|
+
id: 'auth-admin',
|
|
41
|
+
path: 'auth-admin',
|
|
42
42
|
middleware: ['auth'],
|
|
43
43
|
}).define(async (ctx) => {
|
|
44
44
|
// ctx.body = 'Admin Auth Route';
|
|
@@ -7,7 +7,7 @@ app.route({
|
|
|
7
7
|
path: 'cnb',
|
|
8
8
|
key: 'create-issue',
|
|
9
9
|
description: '创建 Issue, 参数 repo, title, body, assignees, labels, priority',
|
|
10
|
-
middleware: ['admin
|
|
10
|
+
middleware: ['auth-admin'],
|
|
11
11
|
metadata: {
|
|
12
12
|
tags: ['opencode'],
|
|
13
13
|
...createSkill({
|
|
@@ -51,7 +51,7 @@ app.route({
|
|
|
51
51
|
path: 'cnb',
|
|
52
52
|
key: 'complete-issue',
|
|
53
53
|
description: '完成 Issue, 参数 repo, issueNumber',
|
|
54
|
-
middleware: ['admin
|
|
54
|
+
middleware: ['auth-admin'],
|
|
55
55
|
metadata: {
|
|
56
56
|
tags: ['opencode'],
|
|
57
57
|
...createSkill({
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createSkill, tool } from '@kevisual/router';
|
|
2
2
|
import { app, cnb } from '../../app.ts';
|
|
3
|
+
import { useKey } from '@kevisual/context';
|
|
3
4
|
|
|
4
5
|
// 查询 Issue 列表 repo是 kevisual/kevisual
|
|
5
6
|
app.route({
|
|
6
7
|
path: 'cnb',
|
|
7
8
|
key: 'list-issues',
|
|
8
9
|
description: '查询 Issue 列表, 参数 repo, state, keyword, labels, page, page_size 等',
|
|
9
|
-
middleware: ['admin
|
|
10
|
+
middleware: ['auth-admin'],
|
|
10
11
|
metadata: {
|
|
11
12
|
tags: ['opencode'],
|
|
12
13
|
...createSkill({
|
|
@@ -25,7 +26,7 @@ app.route({
|
|
|
25
26
|
})
|
|
26
27
|
}
|
|
27
28
|
}).define(async (ctx) => {
|
|
28
|
-
const repo = ctx.query?.repo;
|
|
29
|
+
const repo = ctx.query?.repo || useKey('CNB_REPO_SLUG_LOWERCASE');
|
|
29
30
|
const state = ctx.query?.state;
|
|
30
31
|
const keyword = ctx.query?.keyword;
|
|
31
32
|
const labels = ctx.query?.labels;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createSkill, tool } from '@kevisual/router';
|
|
2
2
|
import { app, cnb } from '../../app.ts';
|
|
3
3
|
import { CNBChat } from '@kevisual/ai/browser'
|
|
4
|
+
import { useKey } from '@kevisual/context';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
|
|
@@ -12,7 +13,7 @@ app.route({
|
|
|
12
13
|
path: 'cnb',
|
|
13
14
|
key: 'cnb-ai-chat',
|
|
14
15
|
description: '调用cnb的知识库ai对话功能进行聊天',
|
|
15
|
-
middleware: ['admin
|
|
16
|
+
middleware: ['auth-admin'],
|
|
16
17
|
metadata: {
|
|
17
18
|
tags: ['opencode'],
|
|
18
19
|
...createSkill({
|
|
@@ -88,7 +89,7 @@ app.route({
|
|
|
88
89
|
path: 'cnb',
|
|
89
90
|
key: 'cnb-rag-query',
|
|
90
91
|
description: '调用cnb的知识库RAG查询功能进行问答',
|
|
91
|
-
middleware: ['admin
|
|
92
|
+
middleware: ['auth-admin'],
|
|
92
93
|
metadata: {
|
|
93
94
|
tags: ['opencode'],
|
|
94
95
|
...createSkill({
|
|
@@ -107,7 +108,7 @@ app.route({
|
|
|
107
108
|
ctx.body = { content: '请提供有效的消息内容' };
|
|
108
109
|
return;
|
|
109
110
|
}
|
|
110
|
-
let repo = ctx.query?.repo;
|
|
111
|
+
let repo = ctx.query?.repo || useKey('CNB_REPO_SLUG_LOWERCASE');
|
|
111
112
|
if (!repo) {
|
|
112
113
|
// 如果未指定知识库仓库ID,则使用默认知识库
|
|
113
114
|
const res = await cnb.repo.getRepoList({ flags: 'KnowledgeBase' });
|
|
@@ -6,7 +6,7 @@ app.route({
|
|
|
6
6
|
path: 'cnb',
|
|
7
7
|
key: 'create-repo',
|
|
8
8
|
description: '创建代码仓库, 参数name, visibility, description',
|
|
9
|
-
middleware: ['admin
|
|
9
|
+
middleware: ['auth-admin'],
|
|
10
10
|
metadata: {
|
|
11
11
|
tags: ['opencode'],
|
|
12
12
|
...createSkill({
|
|
@@ -45,8 +45,8 @@ app.route({
|
|
|
45
45
|
app.route({
|
|
46
46
|
path: 'cnb',
|
|
47
47
|
key: 'create-repo-file',
|
|
48
|
-
description: '在代码仓库中创建文件, repoName, filePath, content, encoding',
|
|
49
|
-
middleware: ['admin
|
|
48
|
+
description: '在代码仓库中创建文件, repoName, filePath, content, encoding。使用CNB_COOKIE进行鉴权',
|
|
49
|
+
middleware: ['auth-admin'],
|
|
50
50
|
metadata: {
|
|
51
51
|
tags: ['opencode'],
|
|
52
52
|
...createSkill({
|
|
@@ -85,7 +85,7 @@ app.route({
|
|
|
85
85
|
path: 'cnb',
|
|
86
86
|
key: 'delete-repo',
|
|
87
87
|
description: '删除代码仓库, 参数name',
|
|
88
|
-
middleware: ['admin
|
|
88
|
+
middleware: ['auth-admin'],
|
|
89
89
|
metadata: {
|
|
90
90
|
tags: ['opencode'],
|
|
91
91
|
...createSkill({
|
|
@@ -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_PROXY_URI') 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);
|
|
@@ -9,7 +9,7 @@ app.route({
|
|
|
9
9
|
path: 'cnb',
|
|
10
10
|
key: 'start-workspace',
|
|
11
11
|
description: '启动开发工作空间, 参数 repo',
|
|
12
|
-
middleware: ['admin
|
|
12
|
+
middleware: ['auth-admin'],
|
|
13
13
|
metadata: {
|
|
14
14
|
tags: ['opencode'],
|
|
15
15
|
...createSkill({
|
|
@@ -42,7 +42,7 @@ app.route({
|
|
|
42
42
|
path: 'cnb',
|
|
43
43
|
key: 'list-workspace',
|
|
44
44
|
description: '获取cnb开发工作空间列表,可选参数 status=running 获取运行中的环境',
|
|
45
|
-
middleware: ['admin
|
|
45
|
+
middleware: ['auth-admin'],
|
|
46
46
|
metadata: {
|
|
47
47
|
tags: ['opencode'],
|
|
48
48
|
...createSkill({
|
|
@@ -73,7 +73,7 @@ app.route({
|
|
|
73
73
|
path: 'cnb',
|
|
74
74
|
key: 'get-workspace',
|
|
75
75
|
description: '获取工作空间详情,通过 repo 和 sn 获取',
|
|
76
|
-
middleware: ['admin
|
|
76
|
+
middleware: ['auth-admin'],
|
|
77
77
|
metadata: {
|
|
78
78
|
tags: ['opencode'],
|
|
79
79
|
...createSkill({
|
|
@@ -104,7 +104,7 @@ app.route({
|
|
|
104
104
|
path: 'cnb',
|
|
105
105
|
key: 'delete-workspace',
|
|
106
106
|
description: '删除工作空间,通过 pipelineId 或 sn',
|
|
107
|
-
middleware: ['admin
|
|
107
|
+
middleware: ['auth-admin'],
|
|
108
108
|
metadata: {
|
|
109
109
|
tags: ['opencode'],
|
|
110
110
|
...createSkill({
|
|
@@ -143,7 +143,7 @@ app.route({
|
|
|
143
143
|
path: 'cnb',
|
|
144
144
|
key: 'stop-workspace',
|
|
145
145
|
description: '停止工作空间,通过 pipelineId 或 sn',
|
|
146
|
-
middleware: ['admin
|
|
146
|
+
middleware: ['auth-admin'],
|
|
147
147
|
metadata: {
|
|
148
148
|
tags: ['opencode'],
|
|
149
149
|
...createSkill({
|
|
@@ -8,7 +8,7 @@ app.route({
|
|
|
8
8
|
path: 'cnb',
|
|
9
9
|
key: 'keep-workspace-alive',
|
|
10
10
|
description: '保持工作空间存活技能,参数repo:代码仓库路径,例如 user/repo,pipelineId:流水线ID,例如 cnb-708-1ji9sog7o-001',
|
|
11
|
-
middleware: ['admin
|
|
11
|
+
middleware: ['auth-admin'],
|
|
12
12
|
metadata: {
|
|
13
13
|
tags: [],
|
|
14
14
|
...({
|
|
@@ -52,7 +52,7 @@ app.route({
|
|
|
52
52
|
path: 'cnb',
|
|
53
53
|
key: 'stop-keep-workspace-alive',
|
|
54
54
|
description: '停止保持工作空间存活技能, 参数repo:代码仓库路径,例如 user/repo,pipelineId:流水线ID,例如 cnb-708-1ji9sog7o-001',
|
|
55
|
-
middleware: ['admin
|
|
55
|
+
middleware: ['auth-admin'],
|
|
56
56
|
metadata: {
|
|
57
57
|
tags: [],
|
|
58
58
|
...({
|
|
@@ -80,7 +80,7 @@ app.route({
|
|
|
80
80
|
path: 'cnb',
|
|
81
81
|
key: 'keep-alive-current-workspace',
|
|
82
82
|
description: '保持当前工作空间存活技能',
|
|
83
|
-
middleware: ['admin
|
|
83
|
+
middleware: ['auth-admin'],
|
|
84
84
|
metadata: {
|
|
85
85
|
tags: ['opencode'],
|
|
86
86
|
skill: 'keep-alive-current-workspace',
|
|
@@ -35,7 +35,7 @@ app.route({
|
|
|
35
35
|
path: 'cnb',
|
|
36
36
|
key: 'clean-closed-workspace',
|
|
37
37
|
description: '批量删除已停止的cnb工作空间',
|
|
38
|
-
middleware: ['admin
|
|
38
|
+
middleware: ['auth-admin'],
|
|
39
39
|
metadata: {
|
|
40
40
|
tags: ['opencode'],
|
|
41
41
|
...createSkill({
|
|
@@ -45,7 +45,7 @@ app.route({
|
|
|
45
45
|
})
|
|
46
46
|
}
|
|
47
47
|
}).define(async (ctx) => {
|
|
48
|
-
const closedWorkspaces = await cnb.workspace.list({ status: 'closed' });
|
|
48
|
+
const closedWorkspaces = await cnb.workspace.list({ status: 'closed', pageSize: 100 });
|
|
49
49
|
if (closedWorkspaces.code !== 200) {
|
|
50
50
|
ctx.throw(500, '获取已关闭工作空间列表失败');
|
|
51
51
|
}
|
package/bin/index.js
ADDED
package/dist/cli.d.ts
ADDED