feat: add track-aware tool targeting and new agent tools, lifted the requirement of selection a MIDI region to use AI Agent
Introduces a shared `toolTargeting.ts` module that resolves the active MIDI region/track from the user's current selection, enabling tools to operate on the correct target without requiring explicit track IDs in most cases. Adds two new read-only tools — `list_all_tracks` and `get_user_selected_music_range_and_track` — so the agent can inspect available tracks and the current selection context before acting. Also refactors `AddNotesTool` to auto-create MIDI regions when no region exists, refactors `RemoveNotesTool`, `ReadMusicTool`, and `ReadChordProgressionTool` to use the new targeting helpers, adds a `buildToolHistoryContent` hook to `BaseTool` for cleaner chat history display, and updates system prompts and tests throughout.
This commit is contained in:
@@ -8,12 +8,8 @@ Current Project Context:
|
||||
- BPM: {bpm}
|
||||
- Time Signature: {time_signature}
|
||||
- Key Signature: {key_signature}
|
||||
- Current Track Instrument: {track_instrument}
|
||||
|
||||
Current Region Context:
|
||||
- Current Region Start: {current_region_start} beats
|
||||
- Current Region End: {current_region_end} beats
|
||||
Current Selected Music Range:
|
||||
{selected_music_range_section}
|
||||
|
||||
**Focus Area**: Your primary work area is the current region (from beat {current_region_start} to {current_region_end}). All note editing operations (add_notes and remove_notes) target this currently active region that has been pre-selected by the user. You do not need to select or specify regions yourself.
|
||||
|
||||
**Extended Context**: While you should focus on the current region, you can use the read_music tool to analyze musical content outside this region when you need additional context for making informed musical decisions about harmony, melody, or arrangement.
|
||||
**Focus Area**: Think in terms of tracks first. If the user identifies a target track, operate on that track. When a selected music range is available, focus on that span; otherwise, reason over the full song.
|
||||
|
||||
Reference in New Issue
Block a user