Files
cnb/agent/routes/cnb-env/env.ts
xiongxiao 50332fe2f4 feat: update package dependencies and add new routes for CNB environment management
- Updated package.json and pnpm-lock.yaml with new dependencies and versions.
- Removed outdated readme files from requirements.
- Enhanced CNB environment configuration in cnb-env.ts with new VS Code remote SSH settings.
- Modified KnowledgeBase class to return structured results.
- Updated Workspace class to return structured results.
- Implemented new routes for managing CNB cookies and VS Code proxy URIs.
- Added AI chat functionality for querying knowledge base.
- Created skills for cleaning up closed workspaces.
2026-01-27 04:02:34 +08:00

48 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { createSkill, tool } from '@kevisual/router';
import { app, cnb } from '../../app.ts';
// 设置 CNB_COOKIE环境变量和获取环境变量,用于界面操作定制模块功能
app.route({
path: 'cnb',
key: 'set-cnb-cookie',
description: '设置当前cnb工作空间的cookie环境变量',
middleware: ['auth'],
metadata: {
tags: ['opencode'],
...createSkill({
skill: 'set-cnb-cookie',
title: '设置当前cnb工作空间的cookie环境变量',
summary: '设置当前cnb工作空间的cookie环境变量用于界面操作定制模块功能,例子CNBSESSION=xxxx;csrfkey=2222xxxx;',
args: {
cookie: tool.schema.string().describe('cnb的cookie值'),
}
})
}
}).define(async (ctx) => {
const cookie = ctx.query?.cookie;
if (!cookie) {
ctx.body = { content: '请提供有效的cookie值' };
return;
}
cnb.cookie = cookie;
ctx.body = { content: '已成功设置cnb的cookie环境变量' };
}).addTo(app);
// 获取 CNB_COOKIE环境变量
app.route({
path: 'cnb',
key: 'get-cnb-cookie',
description: '获取当前cnb工作空间的cookie环境变量',
middleware: ['auth'],
metadata: {
tags: ['opencode'],
...createSkill({
skill: 'get-cnb-cookie',
title: '获取当前cnb工作空间的cookie环境变量',
summary: '获取当前cnb工作空间的cookie环境变量用于界面操作定制模块功能',
})
}
}).define(async (ctx) => {
const cookie = cnb.cookie || '未设置cookie环境变量';
ctx.body = { content: `当前cnb工作空间的cookie环境变量为${cookie}` };
}).addTo(app);