跳转至

迁移草案定义

MigrationDraft 是发布前的核心对象,用于承载迁移结果和审计信息。

字段结构

  1. template
    完整模板,包含目标、约束、预测配置、优化配置、安全规则。
  2. confidence
    草案置信度,范围 0.0-1.0
  3. pending_confirmations
    需要人工确认的条目。
  4. risks
    风险清单。
  5. generation_strategy
    生成策略,例如 llm_primaryrule_fallbackcatalog_binding
  6. source_mappings
    点位映射列表。
  7. trace
    每轮修正记录。
  8. llm_metadata
    模型供应商、模型名等元信息。

示例

{
  "draft_id": "draft-a1b2",
  "confidence": 0.86,
  "generation_strategy": "llm_primary",
  "template": {
    "template_id": "line-a-template",
    "version": "draft-1",
    "scene_metadata": {
      "scene_id": "line-a",
      "scenario_type": "optimization",
      "tags": ["boiler"],
      "granularity_sec": 60,
      "execution_window_sec": 300
    },
    "field_dictionary": {
      "fields": [
        {
          "field_name": "energy_cost",
          "semantic_label": "cost",
          "unit": "$/h",
          "dimension": "dimensionless",
          "observable": true,
          "controllable": false,
          "missing_strategy": "required"
        }
      ],
      "alias_map": {}
    },
    "objective": {
      "terms": [
        {"field_name": "energy_cost", "direction": "min", "weight": 1.0}
      ],
      "normalize_weights": false
    },
    "constraints": [],
    "prediction": {
      "feature_fields": ["energy_cost"],
      "horizon_steps": 3,
      "model_signature": "llm-draft:v1"
    },
    "optimization": {
      "solver_name": "projected-heuristic",
      "max_iterations": 80,
      "tolerance": 0.000001,
      "time_budget_ms": 400
    },
    "guardrail": {
      "rules": [
        {"field_name": "energy_cost", "max_delta": 0.2, "action": "clip"}
      ],
      "fallback_policy": "keep_previous"
    }
  },
  "source_mappings": [
    {
      "legacy_name": "AMICS_BALAR1503",
      "standard_name": "energy_cost",
      "confidence": 0.91,
      "reasoning": "token overlap + field dictionary"
    }
  ],
  "trace": [],
  "llm_metadata": {
    "vendor": "qwen",
    "model": "qwen-plus"
  }
}

何时判定可发布

发布前需要同时满足: 1. 模板校验通过 2. 评分阈值检查通过

任一失败都会被阻断。