From 64e260f721059589440e1e53761dcbc69c1cfc32 Mon Sep 17 00:00:00 2001 From: winlifes <110321103+Winlifes@users.noreply.github.com> Date: Wed, 15 Apr 2026 18:05:11 +0800 Subject: [PATCH] Prompts: prioritize execute_javascript in core mode --- lib/prompts.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/prompts.js b/lib/prompts.js index 6d80cad..86f9ed0 100644 --- a/lib/prompts.js +++ b/lib/prompts.js @@ -8,10 +8,10 @@ class PromptProvider { listPrompts() { const { projectName } = this.getRuntimeContext(); return [ - this.createPrompt('fix_script_errors', `Use execute_javascript first to diagnose and repair current Cocos script problems in '${projectName}'.`), - this.createPrompt('create_playable_prototype', `Use execute_javascript first to build a playable Cocos prototype in '${projectName}' from a short idea.`), - this.createPrompt('scene_validation', `Use execute_javascript first to validate a scene change in '${projectName}' with hierarchy checks and focused inspection.`), - this.createPrompt('auto_wire_scene', `Use execute_javascript first to inspect a target setup in '${projectName}' and wire missing scene relationships.`), + this.createPrompt('fix_script_errors', `In core mode, default to execute_javascript first and only switch to specialist tools when they are clearly better for diagnostics, screenshots, or resource reads in '${projectName}'.`), + this.createPrompt('create_playable_prototype', `In core mode, default to execute_javascript first and only switch to specialist tools when they are clearly better for screenshots, asset lookup, or scene opening in '${projectName}'.`), + this.createPrompt('scene_validation', `In core mode, default to execute_javascript first and only switch to specialist tools when they are clearly better for screenshots, diagnostics, or structured resource reads in '${projectName}'.`), + this.createPrompt('auto_wire_scene', `In core mode, default to execute_javascript first and only switch to specialist tools when they are clearly better for asset lookup, scene opening, diagnostics, or screenshots in '${projectName}'.`), ]; } @@ -21,16 +21,16 @@ class PromptProvider { switch (name) { case 'fix_script_errors': - text = 'Prefer `execute_javascript` first: use `context="editor"` for diagnostics, filesystem edits, and asset-db workflows, and `context="scene"` when runtime or scene validation is needed. Run script diagnostics, inspect source snippets for each error, patch the smallest safe regions with focused file edits, refresh assets, and verify the project returns to a healthy state.'; + text = 'In `core` mode, assume `execute_javascript` is the default first tool. Start with `context="editor"` for diagnosis, local file edits, asset-db workflows, and orchestration; switch to `context="scene"` only when runtime or scene state must be inspected directly. Only use specialist tools when they are strictly better primitives: `run_script_diagnostics` and `get_script_diagnostic_context` for TypeScript errors, `resources/read` for structured project context, and screenshot tools for visual verification. Avoid hopping across many narrow tools when one `execute_javascript` call can inspect, decide, and act. Patch the smallest safe regions, refresh assets if needed, and verify the project returns to a healthy state.'; break; case 'create_playable_prototype': - text = 'Prefer `execute_javascript` as the primary tool: use `context="scene"` for node/component/runtime orchestration and `context="editor"` for editor-side automation. Create a playable Cocos prototype from the provided idea. Build scene nodes, scripts, prefabs, UI, camera, animation hooks, helper controls, and verify the result with runtime state and screenshots.'; + text = 'In `core` mode, treat `execute_javascript` as the primary tool for almost the entire workflow. Use `context="scene"` for node, component, UI, and runtime orchestration, and use `context="editor"` only when editor-side automation, file work, or asset-db access is required. Reach for specialist tools only when they provide a clearly better primitive: `open_scene` to load a scene, asset tools when you need exact asset identification, and screenshot tools when you need visual proof. Build the prototype in a few high-leverage `execute_javascript` steps instead of many tiny tool calls, then verify with runtime state and screenshots.'; break; case 'scene_validation': - text = 'Prefer `execute_javascript` as the first tool, usually with `context="scene"`. Inspect the active scene, verify hierarchy, nodes, components, prefab instances, cameras, animations, runtime state, screenshots, and targeted checks.'; + text = 'In `core` mode, start with `execute_javascript`, usually with `context="scene"`, and keep it as the main tool unless a specialist tool is clearly superior. Use it to inspect hierarchy, nodes, components, prefab instances, cameras, animations, and runtime state in one place. Only switch to specialist tools when you specifically need a screenshot, a structured resource read, or TypeScript diagnostics. Prefer a small number of high-signal validation steps over broad tool hopping.'; break; case 'auto_wire_scene': - text = 'Prefer `execute_javascript` as the first tool, using `context="scene"` for hierarchy and component repair and `context="editor"` for file or asset-side repair. Inspect the target node structure, identify missing scene references, UI children, camera/animation setup, or expected children, and repair them with the smallest safe change.'; + text = 'In `core` mode, begin with `execute_javascript` and assume it will handle nearly all inspection and repair. Use `context="scene"` for hierarchy, node, component, and UI wiring repair, and use `context="editor"` only when file edits, asset-db access, or editor-side orchestration is required. Switch to specialist tools only for exact asset lookup, scene opening, diagnostics, or screenshots. Inspect the target structure, identify missing references or expected children, and repair them with the smallest safe change rather than scattering work across many narrow tools.'; break; default: text = `Prompt not found: ${name}`;