import { app, cnb } from '@/agent/app.ts'; app.route({ path: 'cnb', key: 'start-workspace', description: '启动开发工作空间, 参数 repo', middleware: ['auth'], metadata: { tags: ['opencode'] } }).define(async (ctx) => { const repo = ctx.query?.repo; const branch = ctx.query?.branch; const ref = ctx.query?.ref; if (!repo) { ctx.throw(400, '缺少参数 repo'); } const res = await cnb.workspace.startWorkspace(repo, { branch, ref }); ctx.forward(res); }).addTo(app);