feat: 更新依赖项,添加 OpenCode 支持,重构代理和路由逻辑,新增 AGENTS 文档

This commit is contained in:
2026-01-20 02:46:29 +08:00
parent 26b4ffa3a2
commit 9f20e149a0
16 changed files with 531 additions and 32 deletions

33
assistant/agent/call.ts Normal file
View File

@@ -0,0 +1,33 @@
import { createSkill } from '@kevisual/router'
import { app } from './index.ts'
import { tool } from '@opencode-ai/plugin/tool'
// "调用 path: router key: list"
app.route({
path: 'call',
key: '',
description: '调用',
middleware: ['auth'],
metadata: {
tags: ['opencode'],
...createSkill({
skill: 'call-app',
title: '调用app应用',
summary: '调用router的应用, 参数path, key, payload',
args: {
path: tool.schema.string().describe('应用路径,例如 cnb'),
key: tool.schema.string().optional().describe('应用key例如 list-repos'),
payload: tool.schema.object({}).optional().describe('调用参数'),
}
})
},
}).define(async (ctx) => {
const { path, key = '' } = ctx.query;
if (!path) {
ctx.throw('路径path不能为空');
}
const res = await ctx.run({ path, key, payload: ctx.query.payload || {} }, {
...ctx
});
ctx.forward(res);
}).addTo(app)