import type { ToolContext, ToolResult } from '../../types.js'; /** P1-2 (2026-07-06 review): editor 文本资源写守卫。ctx.checkEditorTextResourceWrite 由 * dispatcher 在 editorExecutor 可用时注入(headless 模式不注入 → 直接放行)。 * 返回非 null = 被守卫阻塞(脚本在 ScriptEditor 打开 / ResourceLoader 缓存冲突), * 调用方直接 return 该 ToolResult。防 TS writeFileSync 绕过编辑器内存状态守卫致版本撕裂。 */ export declare function checkTextResourceGuard(ctx: ToolContext, path: string): Promise; /** * SEC-P1-1 (2026-08-08): write_script/edit_script 沙箱扫描守卫。 * * write_script/edit_script 写任意 content 不经沙箱扫描,与 execute_gdscript 不对齐—— * 客户端可写 @tool 脚本(editor 加载即执行 _ready)+ 含 OS.execute 脚本(配合 load/instantiate 触发)。 * 此函数对 .gd 文件内容调 scanGdscriptSandbox,发现危险模式则阻断(对齐 overrides.ts:106-119 范式)。 * * 旁路:UNRESTRICTED && (DISABLE_SAFETY || ALLOW_UNSAFE) 双 opt-in(对齐 executeGdscript * gdscript-executor.ts:1054-1055 + overrides.ts:106-108)。非 .gd 文件跳过(.cs 等不适用)。 * * @returns opsErrorResult 若检测到危险模式且未旁路;null 表示通过(安全或已旁路) */ export declare function scanScriptSandboxOrThrow(content: string, filePath: string): ToolResult | null; /** M6 (write_script 2026-06-23 / edit_script 2026-06-24): 若 .gd 的 class_name 新增或变化, * 触发 --import 重建 .godot/global_script_class_cache。否则自定义目录新 class_name 不被 * needsImport 检测 → execute_gdscript 不 warm → 后续 "Identifier not declared"。 * write_script 传 contentBefore=null(新文件,after 有 class_name 即触发); * edit_script 传 rawFile(编辑前),仅 class_name 变化才触发(避免每次 edit 都 30s import)。 */ export declare function ensureClassNameImport(projectPath: string, filePath: string, contentBefore: string | null, contentAfter: string, ctx: ToolContext): Promise;