/** * ============================================================ * plugins/computer_use/plugin.ts —— computer-use 插件入口 * ------------------------------------------------------------ * 两件事: * ① `app/` 下的应用说明书 —— 由内核 `vision/appGuide.ts::appManualProviders` * 按目录约定发现,**不经过本文件**。工具在每次观测时强制注入, * 模型没有「不看」这个选项。 * ② `/computeruse`(别名 `/cu`)—— 确定性的诊断与知识管理命令面。 * * 刻意不实现 `activate()`:本插件没有需要在宿主启动时常驻的东西。 * ============================================================ */ import type { PluginApi } from '../../src/plugin-sdk.js'; import { handleComputerUseCommand } from './src/commands.js'; const api: PluginApi = { async *runCommand(commandName, args, ctx) { if (commandName !== 'computeruse' && commandName !== 'cu') { yield { type: 'error', error: `computer-use: 未知命令 /${commandName}` }; return; } const text = await handleComputerUseCommand(args, ctx.signal); yield { type: 'text', delta: text }; yield { type: 'turn_done' }; }, }; export default api;