CellSpec 不可变字段
wesgine CellSpec 字段的可变性标记与运行时修改规则。
三级可变性
CellSpec 字段通过 wesgine:"immutable|mutable|restricted" struct tag 标记:
| 标记 | 含义 | 示例 |
|---|---|---|
immutable | 创建后不可变 | ID、Timezone |
mutable | 运行时可通过 SpecPatch 修改 | Locale、Quotas |
restricted | 需要特殊条件或 admin 权限 | Compliance、Governance |
SpecPatch
UpdateSpec(ctx, cellID, patch SpecPatch) error
SpecPatch 只包含可修改字段的子集,不覆盖整个 CellSpec。
热更新 vs 冷更新
| 类型 | 行为 | 示例 |
|---|---|---|
| 热更新 | 立即生效,无需重启 | Quotas、Governance.DenyPaths |
| 冷更新 | 需重启 Cell 生效 | Channels、MCPs |
json:"-" Hook 字段
以下字段不持久化,每次 GetOrCreate 前必须绑定:
ProviderLiveKeyFn— live-token provider 的密钥获取函数OnStarted— Cell 启动后回调HostEnvironment— 宿主环境注入QualityGate— 质量门控回调EditPatrol— 编辑巡逻回调FileSegmenter— 文件分段器EditMatchFallback— 编辑匹配回退ToolExecutorHooks— 工具执行钩子PostRunFn— Run 结束后回调