多语言插件架构
Multi-Language Plugin Architecture
可扩展的语言插件系统,支持零代码变更接入新语言
子问题
1.Plugin registration and validation
2.Static config vs runtime state separation
3.Generic plugin factory from tool specs
4.Tree-sitter AST integration
5.Plugin discovery across multiple sources (packages, files, user plugins)
6.Progressive capability enhancement based on optional dependencies
7.Explicit attribute forwarding whitelist for runtime facade
各项目的解法1 solutions
Signals
横向对比
| 维度 | Desloppify |
|---|---|
| 插件注册方式 | @register_lang 装饰器 + register_generic_lang 双轨注册 |
| 配置与状态分离 | LangConfig 不可变 + LangRun 门面 + LangRuntimeState 临时状态 |
| 工厂模式 | generic_lang() 从 tool specs 自动组装完整 LangConfig |
| 验证机制 | 三层验证:结构(目录) → 契约(字段) → 规范化(tool spec) |
| 渐进增强 | tree-sitter 可用时自动升级 integration_depth 和分析能力 |
| 插件发现 | 三源发现:plugin_*.py + packages + .desloppify/plugins/ |
| 容错隔离 | 6 类异常捕获 + 错误记录不中断 + 覆盖率降级标记 |
最佳实践
1.Decorator-based registration with structure validation
2.Factory pattern for tool-based generic plugins
3.Three-layer validation pipeline: structure → contract → spec normalization
4.Graceful degradation with error collection during plugin discovery
5.Capability introspection via integration_depth and capability_report