依赖方向与接口所有权
wesgine 的单向依赖架构与接口所有权规则。
依赖方向(单向向内)
Shared Kernel ← 零依赖
Subsystem BC ← 只依赖 Shared Kernel
Coordination ← 依赖 Subsystem 接口
Infrastructure ← 实现 Subsystem 接口
Cell ← 组装以上一切
Hypervisor ← 管理 Cell 生命周期
约束
- Hypervisor 不 import Cell 内部包
- Cell 之间不互相 import
- 子系统 BC 不感知 Cell
接口所有权
接口定义在 Provider 侧(子系统),不在 Consumer 侧。
package cognitive
type Resolver interface {
Stream(ctx context.Context, cellID string, req Request) (Stream, error)
}
安全默认
NewHypervisor()零 I/O、零 goroutineCells().Create(spec)是显式行为(无 default cell auto-create)- 未知错误 = 拒绝(fail-closed)
Shared Kernel 包
引擎公共契约包列表:
| 包 | 职责 |
|---|---|
message | 消息类型 |
engine | Event/Plan/BudgetStatus/ErrorKind |
tool | Tool 接口/ToolContext/ToolSchema |
knowledge | Corpus + SearchBackend |
config | HypervisorConfig/CellSpec/ProviderConfig |
agent | AgentConfig/Store |
task | TaskMemory |
tenancy | Tenancy BC |
channel | IM 渠道 |
cron | 定时 Run |
skill | Skill 子系统 |
capability | Capability 子系统 |
observe | Observability 契约 |
governance | 治理类型与预设 |
interact | HITL 类型 |
license | Ed25519 离线 license 校验 |
xdg | XDG Base Directory 布局 |
存储没有声明面
存储一律落到 {DataDir}/cells/{ID}/ 的三层 SQLite。
权威实现是 internal/cell/boot.go::cellDir 的推导 + resilience.DefaultOpenConfig。
CellSpec.Storage 与 BootParams.StorageBackend 已删除。