From 98dddbcc2ef78d44e01451be6f5f04c7a7aca4e7 Mon Sep 17 00:00:00 2001 From: 134 Date: Sun, 12 Jul 2026 01:13:45 +0800 Subject: [PATCH] fix: keep Pascal agent bound to active scene --- .../pascal-editor/apps/editor/lib/pascal-agent-config.test.ts | 3 +++ services/pascal-editor/apps/editor/lib/pascal-agent-mcp.ts | 3 +++ services/pascal-editor/apps/editor/lib/pascal-agent-prompt.ts | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/pascal-editor/apps/editor/lib/pascal-agent-config.test.ts b/services/pascal-editor/apps/editor/lib/pascal-agent-config.test.ts index 90f320fa8..27c7d2cb8 100644 --- a/services/pascal-editor/apps/editor/lib/pascal-agent-config.test.ts +++ b/services/pascal-editor/apps/editor/lib/pascal-agent-config.test.ts @@ -66,6 +66,9 @@ describe('Pascal agent scene isolation', () => { test('blocks tools that can switch or destroy projects', () => { expect(isPascalAgentToolAllowed('load_scene')).toBe(false) expect(isPascalAgentToolAllowed('delete_scene')).toBe(false) + expect(isPascalAgentToolAllowed('create_house_from_brief')).toBe(false) + expect(isPascalAgentToolAllowed('create_from_template')).toBe(false) + expect(isPascalAgentToolAllowed('photo_to_scene')).toBe(false) expect(isPascalAgentToolAllowed('create_room')).toBe(true) expect(isPascalAgentToolAllowed('save_scene')).toBe(true) }) diff --git a/services/pascal-editor/apps/editor/lib/pascal-agent-mcp.ts b/services/pascal-editor/apps/editor/lib/pascal-agent-mcp.ts index d6ccc41b6..0b478c8c6 100644 --- a/services/pascal-editor/apps/editor/lib/pascal-agent-mcp.ts +++ b/services/pascal-editor/apps/editor/lib/pascal-agent-mcp.ts @@ -5,12 +5,15 @@ import { Experimental_StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio' import type { ModelMessage, ToolSet } from 'ai' const BLOCKED_TOOL_NAMES = new Set([ + 'create_from_template', + 'create_house_from_brief', 'create_project', 'delete_scene', 'generate_variants', 'get_project_status', 'list_scenes', 'load_scene', + 'photo_to_scene', 'rename_scene', ]) diff --git a/services/pascal-editor/apps/editor/lib/pascal-agent-prompt.ts b/services/pascal-editor/apps/editor/lib/pascal-agent-prompt.ts index 8ab351099..94b222065 100644 --- a/services/pascal-editor/apps/editor/lib/pascal-agent-prompt.ts +++ b/services/pascal-editor/apps/editor/lib/pascal-agent-prompt.ts @@ -5,7 +5,7 @@ You are already bound to scene "${params.sceneName}" (${params.sceneId}). Never Operating rules: - Interpret the user's design intent, make reasonable architectural defaults, and start working without asking questions unless a missing constraint makes the task unsafe or impossible. -- Use semantic Pascal tools before low-level patches: create_house_from_brief, create_story_shell, create_room, add_door, add_window, create_stair_between_levels, create_roof, and furnish_room. +- Use scene-bound semantic Pascal tools before low-level patches: create_story_shell, create_room, add_door, add_window, create_stair_between_levels, create_roof, and furnish_room. Template, photo-to-scene, and project-creation tools are intentionally unavailable because they can switch away from the user's active scene. - Inspect the current scene before changing an existing design. Preserve unrelated work. - Pascal uses metres, with X/Z on the ground plane and Y pointing up. - Build in coherent groups. Call save_scene with saveMode "draft" after each meaningful group so the open editor updates while you work.