605 lines
26 KiB
Python
605 lines
26 KiB
Python
"Static MiniMax H3 character replacement reference; no upstream execution."
|
||
|
||
import ast
|
||
import hashlib
|
||
import json
|
||
from pathlib import Path
|
||
|
||
REPO = Path(__file__).resolve().parents[3]
|
||
OUT = Path(__file__).resolve().parent
|
||
REF = OUT.parent / "director-replace-reference"
|
||
PATHS = ["example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_视频人物替换.json"]
|
||
LAYOUTS = {
|
||
"PathchSageAttentionKJ": ["sage_attention", "allow_compile"],
|
||
"ImageResizeKJv2": [
|
||
"width",
|
||
"height",
|
||
"upscale_method",
|
||
"keep_proportion",
|
||
"pad_color",
|
||
"crop_position",
|
||
"divisible_by",
|
||
"device",
|
||
],
|
||
"RandomNoise": ["noise_seed", "control_after_generate"],
|
||
"UniBlockSwap": ["num_blocks"],
|
||
"easy ifElse": ["boolean"],
|
||
"easy minimaxH3ToVideo": ["prompt", "mode", "width", "height", "length", "ref_image_size"],
|
||
"MiniMaxH3DualClockSamplerT8": [
|
||
"steps",
|
||
"shift_video",
|
||
"shift_audio",
|
||
"sampler_name",
|
||
"scheduler",
|
||
],
|
||
"CreateVideo": ["fps", "bit_depth", "color_space", "codec"],
|
||
"PrimitiveInt": ["value", "fixed"],
|
||
"PrimitiveBoolean": ["value"],
|
||
"easy compareVideos": ["compare_video"],
|
||
"easy multiTrackTaskOutput": ["task_index", "prompt_format"],
|
||
"easy seed": ["seed", "control_after_generate", "🎲 Manual Random Seed"],
|
||
"easy multiTrackEditor": [
|
||
"resolution",
|
||
"resolution.aspect_ratio",
|
||
"resolution.megapixels",
|
||
"format",
|
||
"track_data",
|
||
],
|
||
"UNETLoader": ["unet_name", "weight_dtype"],
|
||
"CLIPLoader": ["clip_name", "type", "device"],
|
||
"VAELoader": ["vae_name"],
|
||
"LoraLoaderModelOnly": ["lora_name", "strength_model"],
|
||
}
|
||
LABELS = {
|
||
"transition_step": "阶段切换位置保存",
|
||
"lowres_scale": "低阶段空间比例保存",
|
||
"rho": "混合权重条件保存",
|
||
"w_min": "混合起始权重保存",
|
||
"w_max": "混合结束权重保存",
|
||
"upscaler_model": "完整潜变量放大模型引用",
|
||
"highres_tiling": "高阶段切块开关保存",
|
||
"tiling_mode": "额外切块模式(映射未知)",
|
||
"tiling_tiles": "额外切块数(COMBO/int差异)",
|
||
"tiling_axis": "额外切块轴(映射未知)",
|
||
"selflift_tiling_plan": "额外完整空计划(映射未知)",
|
||
"selection.keep_percent": "稀疏子项保存(不换算)",
|
||
"shift_video": "视频sigma位移保存",
|
||
"shift_audio": "音频sigma位移保存",
|
||
"fov_x_degrees": "视场角缓存(int/FLOAT分列)",
|
||
"model_name": "完整几何模型引用",
|
||
"resolution_level": "几何分辨率等级缓存",
|
||
"batch_size": "几何批量缓存",
|
||
"output": "输出模式独立保存",
|
||
"force_projection": "投影条件保存",
|
||
"apply_mask": "遮罩条件保存",
|
||
"refine_steps": "v3细化次数保存",
|
||
"extra_steps": "sigma尾段增项保存",
|
||
"start_at_sigma": "尾段起点条件保存",
|
||
"end_at_sigma": "尾段终点条件保存",
|
||
"spacing": "尾段插值方式保存",
|
||
"num_blocks": "模型块迁移数量(-1条件另核)",
|
||
"boolean": "分支选择缓存(受外线覆盖)",
|
||
"Constant": "别名名称保存(版本未知)",
|
||
"seed": "独立种子缓存",
|
||
"control_after_generate": "种子前端控制保存",
|
||
"steps": "采样步数保存",
|
||
"cfg": "CFG保存",
|
||
"sampler_name": "采样算法保存",
|
||
"scheduler": "调度器保存",
|
||
"denoise": "降噪保存",
|
||
"sage_attention": "Sage实现选择保存",
|
||
"allow_compile": "编译允许保存",
|
||
"prompt": "完整提示文本缓存",
|
||
"mode": "模式选择保存(外线覆盖按实例核对)",
|
||
"width": "宽度保存缓存",
|
||
"height": "高度保存缓存",
|
||
"length": "帧长保存缓存",
|
||
"ref_image_size": "参考尺寸策略",
|
||
"🎲 Manual Random Seed": "手动随机种子辅助null",
|
||
"filename_prefix": "完整保存前缀",
|
||
"format": "容器/轨道格式保存",
|
||
"codec": "编码器选择保存",
|
||
"fps": "fps保存缓存(受外线覆盖)",
|
||
"bit_depth": "图像位深保存",
|
||
"task_index": "任务索引保存",
|
||
"prompt_format": "提示格式保存(非本次API请求)",
|
||
"string": "查找源字符串",
|
||
"substring": "待查子串缓存(受外线覆盖)",
|
||
"case_sensitive": "大小写匹配保存",
|
||
"expression": "完整数学表达式(不求值)",
|
||
"start_index": "起始行索引缓存(受外线覆盖)",
|
||
"max_rows": "最大行数保存",
|
||
"remove_empty_lines": "空行开关源字符串/BOOLEAN差异",
|
||
"get values from COMBO link": "额外COMBO前端辅助空串",
|
||
"upscale_method": "缩放算法选择",
|
||
"keep_proportion": "比例策略保存",
|
||
"pad_color": "完整填充颜色字符串",
|
||
"crop_position": "裁剪位置保存",
|
||
"divisible_by": "尺寸对齐倍数",
|
||
"device": "设备选择保存",
|
||
"value": "布尔开关原保存值",
|
||
"resolution": "分辨率保存(含义按节点接口核对)",
|
||
"resolution.resize_method": "轨道尺寸处理保存",
|
||
"track_data": "完整轨道状态原字符串(仅文本)",
|
||
"unet_name": "完整扩散模型文件引用",
|
||
"weight_dtype": "权重dtype选择",
|
||
"clip_name": "完整文本模型文件引用",
|
||
"type": "文本模型类型保存",
|
||
"vae_name": "完整VAE文件引用",
|
||
"lora_name": "完整普通LoRA文件引用",
|
||
"strength_model": "模型LoRA强度保存",
|
||
}
|
||
|
||
|
||
def canonical(v):
|
||
return json.dumps(v, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode()
|
||
|
||
|
||
def build(index=0):
|
||
raw = (REPO / PATHS[index]).read_bytes()
|
||
g = json.loads(raw)
|
||
editorial = json.loads((OUT / "editorial.json").read_bytes())
|
||
scopes = [("", "", g)]
|
||
nodes = [
|
||
((pre + ":" if pre else "") + str(n["id"]), ptr + f"/nodes/{i}", pre or "root", n)
|
||
for (pre, ptr, graph) in scopes
|
||
for (i, n) in enumerate(graph["nodes"])
|
||
]
|
||
manifest = json.loads((REF / "sources.json").read_bytes())["sources"]
|
||
sources = []
|
||
trees = {}
|
||
for e in manifest:
|
||
data = (REF / e["local_file"]).read_bytes()
|
||
assert hashlib.sha256(data).hexdigest() == e["sha256"]
|
||
sources.append(
|
||
dict(
|
||
e,
|
||
local_file="../director-replace-reference/" + e["local_file"],
|
||
lines=[1, len(data.decode().splitlines())],
|
||
claim="本图准确声明来源文本/元数据;Git与许可取得状态按各记录分列,未执行,代码许可不等于模型许可",
|
||
)
|
||
)
|
||
if e["file"].endswith(".py"):
|
||
trees[e["local_file"]] = ast.parse(data)
|
||
bindings = []
|
||
prose = json.loads((OUT / "prose.json").read_bytes())
|
||
refs = {}
|
||
schemas = {}
|
||
for nid, ptr, scope, n in nodes:
|
||
cls = n["type"]
|
||
if cls in ["Note", "MarkdownNote"]:
|
||
continue
|
||
symbol = {
|
||
"easy ifElse": "IfElse",
|
||
"easy saveVideo": "EasySaveVideo",
|
||
"easy compareVideos": "EasyCompareVideos",
|
||
"easy cleanGpuUsed": "cleanGPUUsed",
|
||
"easy matchLine": "MatchLine",
|
||
"SimpleMathDual+": "SimpleMathDual",
|
||
"easy seed": "easySeed",
|
||
"easy promptLine": "promptLine",
|
||
"easy minimaxH3ToVideo": "EasyMiniMaxH3ToVideo",
|
||
"easy multiTrackInfoOutput": "MultiTrackInfoOutput",
|
||
"easy multiTrackTaskOutput": "MultiTrackTaskOutput",
|
||
"easy multiTrackEditor": "MultiTrackEditor",
|
||
"easy anythingIndexSwitch": "anythingIndexSwitch",
|
||
"PrimitiveStringMultiline": "StringMultiline",
|
||
"CR Prompt Text": "CR_PromptText",
|
||
"VHS_VideoCombine": "VideoCombine",
|
||
"LayerUtility: ImageScaleByAspectRatio V2": "ImageScaleByAspectRatioV2",
|
||
"PrimitiveFloat": "Float",
|
||
"PrimitiveInt": "Int",
|
||
"PrimitiveBoolean": "Boolean",
|
||
"ComfyMathExpression": "MathExpressionNode",
|
||
"ShowText|pysssss": "ShowText",
|
||
"Image Comparer (rgthree)": "RgthreeImageComparer",
|
||
"ComfySwitchNode": "SwitchNode",
|
||
"Images to RGB": "WAS_Images_To_RGB",
|
||
"忽略多组孤海": "IgnoreGroupsGuHai",
|
||
"GH_ImageVideoComparer": "GHImageVideoComparer",
|
||
}.get(cls, cls)
|
||
version = n.get("properties", {}).get("ver", "未知")
|
||
core_id = {
|
||
"0.29.0": "core0290",
|
||
"0.30.0": "core0300",
|
||
"1289b52fbb6d64a339a4047b9ea74cf7758ccf1e": "kjpatch",
|
||
"eb356e6cd5dedac54bb84bc54b8da8f185fa8472": "kjresize",
|
||
"a019e82c45185beb5f3a2273a6b47b9f88e001b9": "swap",
|
||
"4174fd49e3e37e6787d1505749dc44a8be309209": "t8",
|
||
"595e0738a9e3f8d0d9c4d875461b2d2c9e7559c7": "easy",
|
||
"1254e0e0afa9afee268027b9540fdc91c888ebc5": "mediaeditor",
|
||
"829a7a6030b151cb6ac091595570eb3a3d8c4512": "mediaout",
|
||
"9d0282d4e19ef2718c084edf55864dfb4533032f": "media85",
|
||
}.get(version, "unknown")
|
||
candidates = []
|
||
rs = []
|
||
for i, e in enumerate(manifest):
|
||
if e["id"] != core_id or not e["file"].endswith(".py"):
|
||
continue
|
||
if (
|
||
cls in ["PrimitiveInt", "PrimitiveFloat", "PrimitiveBoolean"]
|
||
and e["file"] != "comfy_extras/nodes_primitive.py"
|
||
):
|
||
continue
|
||
if cls == "KSampler" and e["file"] != "nodes.py":
|
||
continue
|
||
if cls == "PreviewAudio" and e["file"] != "comfy_extras/nodes_audio.py":
|
||
continue
|
||
for c in trees[e["local_file"]].body:
|
||
if not isinstance(c, ast.ClassDef) or c.name != symbol:
|
||
continue
|
||
sources.append(
|
||
dict(
|
||
sources[i],
|
||
lines=[c.lineno, c.end_lineno],
|
||
claim=f"本节点准确{core_id}声明类实现;不等于目标安装或宿主恢复认证",
|
||
)
|
||
)
|
||
rs += [i, len(sources) - 1]
|
||
candidates.append(dict(source=i, symbol=symbol, lines=[c.lineno, c.end_lineno]))
|
||
if cls in ["LoraLoaderModelOnly", "LoraLoaderBypassModelOnly"]:
|
||
parent = next(
|
||
p
|
||
for p in trees[e["local_file"]].body
|
||
if isinstance(p, ast.ClassDef)
|
||
and p.name
|
||
== (
|
||
"LoraLoaderBypass"
|
||
if cls == "LoraLoaderBypassModelOnly"
|
||
else "LoraLoader"
|
||
)
|
||
)
|
||
sources.append(
|
||
dict(
|
||
sources[i],
|
||
lines=[parent.lineno, parent.end_lineno],
|
||
claim=f"本节点准确{core_id}父类及加载条件;只静态读取",
|
||
)
|
||
)
|
||
rs.append(len(sources) - 1)
|
||
for d in ast.walk(c):
|
||
if isinstance(d, ast.Dict):
|
||
for k, v in zip(d.keys, d.values, strict=True):
|
||
if (
|
||
isinstance(k, ast.Constant)
|
||
and isinstance(k.value, str)
|
||
and isinstance(v, ast.Tuple)
|
||
):
|
||
default = "无显式default;动态枚举/方法条件只作参考"
|
||
for opts in v.elts[1:]:
|
||
if isinstance(opts, ast.Dict):
|
||
for dk, dv in zip(opts.keys, opts.values, strict=True):
|
||
if (
|
||
isinstance(dk, ast.Constant)
|
||
and dk.value == "default"
|
||
):
|
||
default = ast.unparse(dv)
|
||
schemas[nid, k.value] = (default, ast.unparse(v))
|
||
if (
|
||
isinstance(d, ast.Call)
|
||
and isinstance(d.func, ast.Attribute)
|
||
and (d.func.attr == "Input")
|
||
):
|
||
arg = (
|
||
d.args[0]
|
||
if d.args
|
||
else next((k.value for k in d.keywords if k.arg == "id"), None)
|
||
)
|
||
if not isinstance(arg, ast.Constant) or not isinstance(arg.value, str):
|
||
continue
|
||
name = arg.value
|
||
if cls == "TextGenerate" and name in [
|
||
"temperature",
|
||
"top_k",
|
||
"top_p",
|
||
"min_p",
|
||
"repetition_penalty",
|
||
"seed",
|
||
"presence_penalty",
|
||
]:
|
||
name = "sampling_mode." + name
|
||
default = next(
|
||
(ast.unparse(k.value) for k in d.keywords if k.arg == "default"),
|
||
"无显式default,不从execute函数缺省补值",
|
||
)
|
||
if cls == "SaveImageAdvanced" and name in [
|
||
"bit_depth",
|
||
"input_color_space",
|
||
]:
|
||
# Keep the first exact PNG DynamicCombo branch.
|
||
schemas.setdefault((nid, "format." + name), (default, ast.unparse(d)))
|
||
else:
|
||
schemas[nid, name] = (default, ast.unparse(d))
|
||
assert len(candidates) <= 1, (nid, candidates)
|
||
if not candidates and core_id not in ["unknown", "subgraph-definition"]:
|
||
core_id = "unresolved-" + core_id
|
||
bindings.append(
|
||
dict(
|
||
node_id=nid,
|
||
class_type=cls,
|
||
source_version=version,
|
||
source_id=core_id,
|
||
candidates=candidates,
|
||
)
|
||
)
|
||
if core_id.replace("unresolved-", "") in [
|
||
"goohai",
|
||
"rgthree",
|
||
"showtext",
|
||
"ghgroup",
|
||
"ghcompare",
|
||
"was",
|
||
"vosr",
|
||
]:
|
||
rs += [
|
||
i for i, e in enumerate(manifest) if e["id"] == core_id.replace("unresolved-", "")
|
||
]
|
||
if cls == "KSampler":
|
||
rs += [
|
||
i
|
||
for i, e in enumerate(manifest)
|
||
if e["id"] == core_id and e["file"] == "comfy/samplers.py"
|
||
]
|
||
if cls in [
|
||
"KSampler",
|
||
"LoadImage",
|
||
"ShowText|pysssss",
|
||
"Image Comparer (rgthree)",
|
||
"忽略多组孤海",
|
||
]:
|
||
rs += [i for i, e in enumerate(manifest) if e["id"] in ["frontend", "litegraph"]]
|
||
if cls == "QwenImage21Cache":
|
||
rs += [
|
||
i
|
||
for i, e in enumerate(manifest)
|
||
if e["id"] == core_id
|
||
and e["file"].startswith(("comfy/ldm/qwen_image21/", "comfy_api/latest/"))
|
||
]
|
||
rs += [i for i, e in enumerate(manifest) if e["id"] == core_id.removeprefix("unresolved-")]
|
||
rs += [i for i, e in enumerate(manifest) if e["id"] == "frontend"]
|
||
refs[nid] = list(dict.fromkeys(rs))
|
||
fields = []
|
||
comments = []
|
||
flow = []
|
||
empty = []
|
||
for nid, ptr, scope, n in nodes:
|
||
cls = n["type"]
|
||
if cls in ["Note", "MarkdownNote"]:
|
||
comments.append(
|
||
dict(
|
||
node_id=nid,
|
||
pointer=ptr + "/widgets_values/0",
|
||
text=n["widgets_values"][0],
|
||
meaning=prose["notes"][nid],
|
||
named_pointer=ptr + "/widgets_values_named/text",
|
||
named_value=n["widgets_values_named"]["text"],
|
||
evidence=[],
|
||
)
|
||
)
|
||
flow.append(nid + " 原注释节点 " + json.dumps(n, ensure_ascii=False))
|
||
continue
|
||
core_id = next(b["source_id"] for b in bindings if b["node_id"] == nid)
|
||
effect = (
|
||
editorial[nid]
|
||
+ " 原mode="
|
||
+ str(n["mode"])
|
||
+ (
|
||
"(旁路保存态,不模拟穿透或执行)。"
|
||
if n["mode"] == 4
|
||
else "(mode2禁用/忽略保存态,不模拟组控制或执行)。"
|
||
if n["mode"] == 2
|
||
else "(活动保存态,不认证执行)。"
|
||
)
|
||
)
|
||
flow += [
|
||
effect,
|
||
nid + " 原属性 " + json.dumps(n.get("properties", {}), ensure_ascii=False),
|
||
nid
|
||
+ " 原输入/输出 "
|
||
+ json.dumps({k: n[k] for k in ["inputs", "outputs"]}, ensure_ascii=False),
|
||
nid
|
||
+ " 原具名保存 "
|
||
+ json.dumps(n.get("widgets_values_named", "missing"), ensure_ascii=False),
|
||
nid
|
||
+ " 原其它属性 "
|
||
+ json.dumps(
|
||
{
|
||
k: v
|
||
for k, v in n.items()
|
||
if k
|
||
not in [
|
||
"inputs",
|
||
"outputs",
|
||
"properties",
|
||
"widgets_values",
|
||
"widgets_values_named",
|
||
]
|
||
},
|
||
ensure_ascii=False,
|
||
),
|
||
]
|
||
if not n.get("widgets_values"):
|
||
empty.append(
|
||
dict(
|
||
node_id=nid,
|
||
class_type=cls,
|
||
pointer=ptr,
|
||
scope=scope,
|
||
state="missing" if "widgets_values" not in n else "empty_list",
|
||
effect=effect,
|
||
named_state="empty_object"
|
||
if n.get("widgets_values_named") == {}
|
||
else "missing",
|
||
)
|
||
)
|
||
continue
|
||
for j, (name, value) in enumerate(
|
||
n["widgets_values"].items()
|
||
if isinstance(n["widgets_values"], dict)
|
||
else zip(LAYOUTS[cls], n["widgets_values"], strict=True)
|
||
):
|
||
saved_key = (
|
||
name.replace("~", "~0").replace("/", "~1")
|
||
if isinstance(n["widgets_values"], dict)
|
||
else str(j)
|
||
)
|
||
found = [i for (i, x) in enumerate(n["inputs"]) if x["name"] == name]
|
||
inp = found[0] if len(found) == 1 else None
|
||
linked = inp is not None and n["inputs"][inp].get("link") is not None
|
||
boundary = False
|
||
aux = name in [
|
||
"control_after_generate",
|
||
"audioUI",
|
||
"preview",
|
||
"🎲 Manual Random Seed",
|
||
"get values from COMBO link",
|
||
"fixed",
|
||
"upload",
|
||
"text_0",
|
||
"rgthree_comparer",
|
||
"guhai_ig",
|
||
"videopreview",
|
||
]
|
||
(default, limits) = schemas.get(
|
||
(nid, name),
|
||
(
|
||
"未知:本准确类未给出该保存字段的独立schema默认",
|
||
"源保存位置与准确schema字段缺口分列,不认证后端执行映射",
|
||
),
|
||
)
|
||
unit = "无准确物理单位时只按原接口文本;源JSON类型与schema分列,不计算实际结果"
|
||
meta = prose.get("field_meta", {}).get(cls, {}).get(name, {})
|
||
default = meta.get("default", default)
|
||
limits = meta.get("limits", limits)
|
||
unit = meta.get("unit", unit)
|
||
if name in ["control_after_generate", "upload"]:
|
||
default = "前端辅助原值;准确frontend1.23.0条件参考,不当后端schema默认"
|
||
limits = "前端保存/恢复条件与本节点后端输入分开,不执行随机或上传"
|
||
unit = "前端辅助原JSON保存值,无物理单位"
|
||
if core_id == "unknown" or core_id.startswith("unresolved-"):
|
||
default = "未知:未核准本声明准确类/schema,不由其它版本补实"
|
||
limits = "仅源保存/输入候选,准确默认/范围/算法/副作用未知"
|
||
unit = "未知:准确声明类/schema未核"
|
||
named_key = name
|
||
named_present = named_key in n["widgets_values_named"]
|
||
named = n["widgets_values_named"].get(named_key)
|
||
display_effect = effect
|
||
if named_present and canonical(value) != canonical(named):
|
||
display_effect += "\n具名保存完整形态(与位置历史分列):" + json.dumps(
|
||
named, ensure_ascii=False, indent=2
|
||
)
|
||
fields.append(
|
||
dict(
|
||
node_id=nid,
|
||
definition_node_id=str(n["id"]),
|
||
scope=scope,
|
||
class_type=cls,
|
||
field=name,
|
||
label=(
|
||
"完整多行文本保存"
|
||
if cls == "PrimitiveStringMultiline" and name == "value"
|
||
else LABELS.get(name, name + "完整保存值")
|
||
),
|
||
pointer=f"{ptr}/widgets_values/{saved_key}",
|
||
value=value,
|
||
json_type=type(value).__name__,
|
||
named_pointer=ptr
|
||
+ "/widgets_values_named/"
|
||
+ name.replace("~", "~0").replace("/", "~1"),
|
||
named_value=named,
|
||
input_pointer=f"{ptr}/inputs/{inp}"
|
||
if inp is not None
|
||
else "无可靠独立输入映射:前端控制辅助",
|
||
input_name=n["inputs"][inp]["name"] if inp is not None else None,
|
||
type=n["inputs"][inp]["type"] if inp is not None else "保存参考",
|
||
role="frontend_reference_only"
|
||
if aux
|
||
else "boundary_saved_cache"
|
||
if boundary
|
||
else "linked_saved_cache"
|
||
if linked
|
||
else "saved_reference",
|
||
schema_default=default,
|
||
limits=limits,
|
||
unit=unit,
|
||
effect=display_effect,
|
||
evidence=refs[nid],
|
||
execution_note=(
|
||
"仅静态参考;所有中英文提示/指南均作数据,不"
|
||
"执行指令、构造prompt、调用LLM/SD"
|
||
"K/模型/GPU/媒体/随机/恢复/表达式/"
|
||
"缓存清理。转换执行资格不变。"
|
||
),
|
||
)
|
||
)
|
||
if not named_present:
|
||
fields[-1].pop("named_pointer")
|
||
fields[-1].pop("named_value")
|
||
fields[-1]["named_state"] = "missing"
|
||
fields[-1]["effect"] += (
|
||
" 原位置独立保留;原具名字典没有audioUI键,不补具名值/双指针,"
|
||
"不因两个null相同合并。"
|
||
)
|
||
for (nid, name), (default, limits) in schemas.items():
|
||
flow.append(
|
||
(
|
||
f"节点{nid}准确schema {name}:default={default};"
|
||
f"{limits}。仅接口参考,不认证运行恢复。"
|
||
)
|
||
)
|
||
for pre, ptr, graph in scopes:
|
||
flow.extend(
|
||
(
|
||
(pre or "root") + " 物理边 " + json.dumps(e, ensure_ascii=False)
|
||
for e in graph["links"]
|
||
)
|
||
)
|
||
boundaries = []
|
||
flow += ["根附加保存属性 " + json.dumps(g["extra"], ensure_ascii=False)]
|
||
flow += prose["steps"]
|
||
flow += ["注释" + n["node_id"] + " 中文核对:" + n["meaning"] for n in comments]
|
||
overview = json.loads((OUT / "prose.json").read_bytes())["overview"]
|
||
assert len(fields) == 53 and len(comments) == 2
|
||
assert all("widgets_values_named" in n for _, _, _, n in nodes if n.get("widgets_values"))
|
||
return dict(
|
||
source_path=PATHS[index],
|
||
source_sha1=hashlib.sha1(raw).hexdigest(),
|
||
source_sha256=hashlib.sha256(raw).hexdigest(),
|
||
canonical_sha256=hashlib.sha256(canonical(g)).hexdigest(),
|
||
notice="仅固定参考:SYSTEM_PROMPT外线与两Note独立;denoised_output双解码,T8准确构造协议与比较UI/文件I/O条件分列,不执行人物替换或认证效果。",
|
||
user_overview=overview,
|
||
versions=[
|
||
(f"{e['id']} {e['tag']} commit {e['commit']} tree {e['tree']};许可{e['license_file']}")
|
||
for e in {e["id"]: e for e in manifest}.values()
|
||
]
|
||
+ [
|
||
"旧122块7178位置/214注释冻结;新增53列表位置/2完整Note,总123参考7231位置/216标准注释仅参考。local_file以docs/hel-892/director-replace-document-evidence为基准。"
|
||
],
|
||
counts=dict(
|
||
saved_fields=53,
|
||
root_saved_fields=53,
|
||
internal_saved_fields=0,
|
||
linked_saved_fields=sum(f["role"] == "linked_saved_cache" for f in fields),
|
||
boundary_saved_fields=0,
|
||
frontend_only=sum(f["role"] == "frontend_reference_only" for f in fields),
|
||
source_nodes=27,
|
||
root_nodes=27,
|
||
internal_nodes=0,
|
||
physical_edges=42,
|
||
source_notes=2,
|
||
saved_objects=0,
|
||
history_objects=0,
|
||
final_scalars=0,
|
||
final_prompt_constructed=False,
|
||
),
|
||
node_bindings=bindings,
|
||
fields=fields,
|
||
sources=sources,
|
||
comments=comments,
|
||
flow=flow,
|
||
flow_evidence=list(range(len(sources))),
|
||
zero_saved_nodes=empty,
|
||
boundaries=boundaries,
|
||
steps=[overview] + json.loads((OUT / "prose.json").read_bytes())["steps"],
|
||
)
|