diff --git a/agent/routes/index.ts b/agent/routes/index.ts index 9644a65..ff74257 100644 --- a/agent/routes/index.ts +++ b/agent/routes/index.ts @@ -1,14 +1,20 @@ import { app } from '../app.ts' import './route-create.ts' -if (!app.hasRoute('auth', '')) { - app.route({ - path: 'auth', - key: '', - id: 'auth', - description: '身份验证路由', - }).define(async (ctx) => { - // - }).addTo(app); -} +app.route({ + path: 'auth', + key: '', + id: 'auth', + description: '身份验证路由', +}).define(async (ctx) => { + // +}).addTo(app, { overwrite: false }); +app.route({ + path: 'auth-admin', + key: '', + id: 'auth-admin', + description: '管理员身份验证路由', +}).define(async (ctx) => { + // +}).addTo(app, { overwrite: false }); \ No newline at end of file diff --git a/agent/routes/route-create.ts b/agent/routes/route-create.ts index 1fe72e2..c74662f 100644 --- a/agent/routes/route-create.ts +++ b/agent/routes/route-create.ts @@ -6,7 +6,7 @@ app.route({ path: 'router-skill', key: 'create-route', description: '创建路由技能', - middleware: ['auth'], + middleware: ['auth-admin'], metadata: { tags: ['opencode'], ...createSkill({ @@ -38,7 +38,7 @@ app.route({ path: 'router-skill', key: 'version', description: '获取最新router版本号', - middleware: ['auth'], + middleware: ['auth-admin'], metadata: { tags: ['opencode'], ...createSkill({ @@ -59,7 +59,7 @@ app.route({ path: 'route-skill', key: 'test', description: '测试路由技能', - middleware: ['auth'], + middleware: ['auth-admin'], metadata: { tags: ['opencode'], ...createSkill({ diff --git a/src/opencode.ts b/src/opencode.ts index 609d6ea..ddc8a1c 100644 --- a/src/opencode.ts +++ b/src/opencode.ts @@ -10,7 +10,7 @@ export const addCallFn = (app: App) => { path: 'call', key: '', description: '调用', - middleware: ['auth'], + middleware: ['auth-admin'], metadata: { tags: ['opencode'], ...createSkill({ @@ -24,7 +24,7 @@ export const addCallFn = (app: App) => { args: { path: tool.schema.string().describe('应用路径,例如 cnb'), key: tool.schema.string().optional().describe('应用key,例如 list-repos'), - payload: tool.schema.object({}).optional().describe('调用参数'), + payload: tool.schema.object({}).optional().describe('调用参数, 为对象, 例如 { "query": "javascript" }'), } }) }, @@ -75,7 +75,7 @@ export const createRouterAgentPluginFn = (opts?: { }); // opencode run "使用技能查看系统信息" const AgentPlugin: Plugin = async (pluginInput) => { - useContextKey('plugin-input', () => pluginInput, true) + useContextKey('plugin-input', () => pluginInput, { isNew: true }) const hooks = opts?.hooks ? await opts.hooks(pluginInput) : {} return { ...hooks,