From 023760116bc5cf2acd31fdf507403b4cf71e50f1 Mon Sep 17 00:00:00 2001 From: Kristofer Jussmann Date: Mon, 18 May 2026 13:17:44 +0300 Subject: [PATCH] Keep execute code as filtered fallback --- lib/orchestration/tool-filter.ts | 4 ++-- .../test/test-execute-code-filter-fallback.ts | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 scripts/test/test-execute-code-filter-fallback.ts diff --git a/lib/orchestration/tool-filter.ts b/lib/orchestration/tool-filter.ts index 91f4df9..b586b8a 100644 --- a/lib/orchestration/tool-filter.ts +++ b/lib/orchestration/tool-filter.ts @@ -2,8 +2,8 @@ import { TOOL_REGISTRY } from "./tool-registry" const CATEGORY_GROUPS: Record = { inspection: ["get_scene_info", "get_object_info", "get_all_object_info", "inspect_blend_file_health", "inspect_modifier_constraint_stack", "inspect_rigging_data", "inspect_weight_paint_readiness", "inspect_animation_data", "inspect_collection_hierarchy", "inspect_viewport_areas", "set_viewport_shading", "focus_viewport_on_objects", "select_scene_objects", "set_active_collection", "get_viewport_screenshot", "render_viewport_to_path", "list_materials", "list_installed_addons"], - geometry: ["create_mesh_from_data", "validate_mesh_geometry", "inspect_retopology_readiness", "inspect_modifier_constraint_stack", "inspect_rigging_data", "inspect_weight_paint_readiness", "normalize_vertex_group_weights", "delete_object", "set_object_transform", "rename_object", "duplicate_object", "join_objects", "add_modifier", "configure_modifier", "configure_constraint", "add_object_constraint", "remove_object_constraint", "apply_modifier", "apply_transforms", "shade_smooth", "set_origin", "execute_code"], - animation: ["inspect_animation_data", "execute_code"], + geometry: ["create_mesh_from_data", "validate_mesh_geometry", "inspect_retopology_readiness", "inspect_modifier_constraint_stack", "inspect_rigging_data", "inspect_weight_paint_readiness", "normalize_vertex_group_weights", "delete_object", "set_object_transform", "rename_object", "duplicate_object", "join_objects", "add_modifier", "configure_modifier", "configure_constraint", "add_object_constraint", "remove_object_constraint", "apply_modifier", "apply_transforms", "shade_smooth", "set_origin"], + animation: ["inspect_animation_data"], organization: ["inspect_collection_hierarchy", "organize_collection_hierarchy", "select_scene_objects", "set_active_collection", "parent_set", "parent_clear", "move_to_collection", "set_visibility"], materials: ["list_materials", "create_material", "assign_material", "create_material_preset", "inspect_material_node_graph", "set_texture"], pipeline: ["prepare_uv_layout", "validate_export_readiness", "export_object"], diff --git a/scripts/test/test-execute-code-filter-fallback.ts b/scripts/test/test-execute-code-filter-fallback.ts new file mode 100644 index 0000000..47ff01a --- /dev/null +++ b/scripts/test/test-execute-code-filter-fallback.ts @@ -0,0 +1,20 @@ +import assert from "node:assert/strict" + +import { filterRelevantTools } from "../../lib/orchestration/tool-filter" + +const meshTools = filterRelevantTools("create a custom mesh from vertices and validate the mesh geometry") +assert.ok(meshTools.includes("create_mesh_from_data")) +assert.ok(meshTools.includes("validate_mesh_geometry")) +assert.ok(!meshTools.includes("execute_code"), "mesh factory prompts should not expose execute_code by default") + +const animationTools = filterRelevantTools("inspect the animation keyframes and f-curves on this scene") +assert.ok(animationTools.includes("inspect_animation_data")) +assert.ok(!animationTools.includes("execute_code"), "animation inspection prompts should not expose execute_code by default") + +const explicitFallbackTools = filterRelevantTools("write a custom python script for unsupported procedural particle effects") +assert.ok(explicitFallbackTools.includes("execute_code"), "explicit custom-code prompts should still expose execute_code") + +const largePlanTools = filterRelevantTools("build a large production scene with many dependent steps", 8) +assert.ok(largePlanTools.includes("execute_code"), "large multi-step plans should still expose execute_code as an escape hatch") + +console.log("execute_code filter fallback tests passed")