// sisyphus-debatewiki-plugin - OpenCode Plugin Entry Point // 兼容OpenCode插件系统的入口点 // 安全初始化 - 防止OpenCode启动失败 try { // 检查是否在OpenCode环境中运行 const hasOpenCodeAPI = typeof globalThis !== "undefined" && (globalThis as any).OpenCode !== undefined; if (!hasOpenCodeAPI) { console.warn( `[sisyphus-debatewiki] OpenCode API not available - running in standalone mode`, ); // 不注册可能引起冲突的处理器 } } catch (error) { console.error(`[sisyphus-debatewiki] Initialization warning:`, error); // ✅ 关键:不要抛出异常 - 让OpenCode继续启动 } // 定义插件信息 export const PLUGIN_INFO = { name: "sisyphus-debatewiki", version: "1.0.1", description: "Multi-agent forum debate, wiki collaboration, and knowledge synthesis system based on Sisyphus orchestration pattern", features: [ "Multi-agent forum debates", "Consensus algorithms (voting, deliberation, weighted)", "Wiki collaboration system", "Grounded theory research engine", "Ten different debate flow types" ] }; // 定义插件API - 使用函数而非类构造函数 export function initializePlugin(api: any) { console.log(`[sisyphus-debatewiki] Initializing plugin version ${PLUGIN_INFO.version}`); // 这里可以注册命令、工具或其他功能 // 但为了兼容性,我们只返回基本的插件信息 return { name: PLUGIN_INFO.name, version: PLUGIN_INFO.version, description: PLUGIN_INFO.description, initialized: true, capabilities: PLUGIN_INFO.features }; } // 默认导出 - 确保与OpenCode插件系统兼容 export default { PLUGIN_INFO, initializePlugin, // 为向后兼容性提供基本功能 // 这些功能通过sisyphus_task委托给专门的智能体实现 startDebate: async (config: any) => { // 委托给专门的论坛智能体 console.log('[sisyphus-debatewiki] Delegating debate start to forum agent via sisyphus_task'); // 在实际实现中,这将通过sisyphus_task委托给专门的智能体 return { status: 'delegated_to_sisyphus_agent', message: 'Debate start request delegated to specialized forum agent', config }; }, calculateConsensus: async (config: any) => { // 委托给专门的共识智能体 console.log('[sisyphus-debatewiki] Delegating consensus calculation to consensus agent via sisyphus_task'); // 在实际实现中,这将通过sisyphus_task委托给专门的智能体 return { status: 'delegated_to_sisyphus_agent', message: 'Consensus calculation delegated to specialized consensus agent', config }; }, createWikiPage: async (config: any) => { // 委托给专门的维基智能体 console.log('[sisyphus-debatewiki] Delegating wiki page creation to wiki agent via sisyphus_task'); // 在实际实现中,这将通过sisyphus_task委托给专门的智能体 return { status: 'delegated_to_sisyphus_agent', message: 'Wiki page creation delegated to specialized wiki agent', config }; }, performGroundedTheoryAnalysis: async (config: any) => { // 委托给专门的扎根理论智能体 console.log('[sisyphus-debatewiki] Delegating grounded theory analysis to GT agent via sisyphus_task'); // 在实际实现中,这将通过sisyphus_task委托给专门的智能体 return { status: 'delegated_to_sisyphus_agent', message: 'Grounded theory analysis delegated to specialized GT agent', config }; } };