/** * uid 工具 — Godot 4.4+ 文件 UID 管理(P1-1,2026-08-19) * * 对标 yanhuifair 独有品类中对表优先级最高的一项:文件 UID 查询/批量更新/缺失检测。 * Godot 4.4 起每个资源文件旁置 .uid 文件(`uid://xxxx` 一行),场景/资源的 ExtResource * 引用优先走 UID —— 文件移动后 .uid 跟着走,但 .uid 丢失/未生成时引用悬空。 * * 4 op(全部 headless,纯文件层,不依赖 editor 的 uid_cache.bin): * - uid_scan 全量扫描:缺 .uid 的资源 + 孤儿 .uid(无主文件) * - uid_get 查询文件(单个/批量)的 UID * - uid_set 写 .uid:指定 uid / 自动生成(generate) / 批量修复缺失(fix_missing) * - uid_check_refs 扫描文本资源中的 uid:// 引用,检测悬空引用 * * 主数据源是文件系统的 .uid 文件(非 ResourceUID 注册表):headless 下 uid_cache.bin * 仅在编辑器打开过项目时存在且可能过期,文件系统扫描永远反映磁盘真相。 * 新 UID 生成用 ResourceUID.create_id_for_path(确定性,同路径同 UID,与编辑器一致)。 */ import type { Tool } from "@modelcontextprotocol/server"; import type { ToolContext, ToolResult } from '../types.js'; import type { RiskLevel } from '../core/tool-registry.js'; /** 默认参与 UID 扫描的资源扩展(Godot 4.4 EditorFileSystem 常见建 .uid 的类型,可用 extensions 参数覆盖) */ export declare const DEFAULT_UID_EXTENSIONS: readonly ["tscn", "tres", "gd", "cs", "gdns", "gdshader", "shader", "json", "txt", "csv", "po", "png", "jpg", "jpeg", "webp", "svg", "bmp", "tga", "wav", "ogg", "mp3", "glb", "gltf", "ttf", "otf", "woff"]; /** check_refs 扫描的文本扩展(可能内嵌 uid:// 引用的) */ export declare const REF_SCAN_EXTENSIONS: readonly ["tscn", "tres", "gd", "cs", "gdns", "gdshader", "shader", "import", "json", "po", "cfg"]; export declare function genUidScanScript(extensions: string[], skipDirs: string[], limit: number): string; export declare function genUidGetScript(paths: string[]): string; /** * uid_set 三种模式(互斥): * - path + uid 为单文件写指定 UID(覆盖已有) * - path(省略 uid) 为单文件按路径确定性生成新 UID(与编辑器一致) * - fix_missing=true 扫描全部缺失 .uid 的资源并批量生成写入 */ export declare function genUidSetScript(opts: { path?: string; uid?: string; fixMissing?: boolean; extensions: string[]; skipDirs: string[]; }): string; export declare function genUidCheckRefsScript(skipDirs: string[], limit: number): string; export declare function getToolDefinitions(): Tool[]; export declare function handleTool(name: string, args: Record, ctx: ToolContext): Promise; export declare const TOOL_META: Record; }>;