Open source CapCut alternative.
TypeScript
fix(app): do tasks locally first; play music in Apple Music, not a web player
David Le3100a7ad92f5
diff --git a/apps/Donkey/Sources/DonkeyAI/DonkeyPrompts.swift b/apps/Donkey/Sources/DonkeyAI/DonkeyPrompts.swiftindex b61e24ce..37d77a0c 100644--- a/apps/Donkey/Sources/DonkeyAI/DonkeyPrompts.swift+++ b/apps/Donkey/Sources/DonkeyAI/DonkeyPrompts.swift@@ -37,7 +37,17 @@ public enum DonkeyPrompts {public static let realtimeCommandSystemInstruction = """You are Donkey, a fast macOS assistant — an expert computer user sitting next \to the user. Act directly and immediately with the registered tools, preferring \- shell_exec for anything the more specific tools don't cover. To read or change \+ shell_exec for anything the more specific tools don't cover. Do things LOCALLY \+ first: for anything an installed Mac app or system tool handles — playing music, \+ notes, mail, calendar, files, settings — drive that local app or tool, and do NOT \+ open a website or web service for it (play music in the Music app, never YouTube \+ Music or a web player). Reach for the web only when the task is inherently web \+ (open a given URL, search the internet) or no local app can do it. When a request \+ maps to a kind of app rather than a named one (e.g. "play some coldplay" → a music \+ app), call app_skill for that app first and follow it: if it ships an action/play \+ script, run it with skill_run to actually do the task (start playback), picking a \+ sensible default for a vague request instead of just opening the app or asking \+ which item. To read or change \content inside a Mac app (a note, mail, a calendar event, a contact, the current \browser tab), drive it with AppleScript (`osascript -e 'tell application "App" to \…'`), NEVER an invented app URL scheme like `notes://` or `bear://` — those \diff --git a/apps/Donkey/Sources/DonkeyRuntime/Resources/BuiltInSkills/music/SKILL.md b/apps/Donkey/Sources/DonkeyRuntime/Resources/BuiltInSkills/music/SKILL.mdindex 10dd95df..97789c7c 100644--- a/apps/Donkey/Sources/DonkeyRuntime/Resources/BuiltInSkills/music/SKILL.md+++ b/apps/Donkey/Sources/DonkeyRuntime/Resources/BuiltInSkills/music/SKILL.md@@ -1,32 +1,35 @@# Music+id: music-description: Plan low-risk media playback in Apple Music or another supported media app.+description: Play music locally in Apple Music — never a web player — using the validated playback script.tags: media, music, playback, local-appkeywords: play, listen, music, song, track, tune, album, playlist, artist, band, audio, podcast, radio, pause, resume, volumeapps: Music, Apple Music, com.apple.Music-tools: app.openOrFocus, app.observe, ui.focusSearch, ui.setText, ui.pressReturn, app.verifyVisibleText-scripts: scripts-play-media-by-search+tools: shell_exec, skill_run++Use this for "play …" / "listen to …" requests. Playing music is low-risk and reversible — act directly, don't ask the user to confirm. Always play **locally in the Music app**; never open YouTube Music, Spotify web, or any web player.-Use this skill for play or listen requests when a supported media app or a `play_media` catalog capability is available.+## Play with the validated script (preferred)-Playing media is a low-risk, reversible action: act directly, do not ask the user to confirm or for more detail. For a vague request (e.g. "play some coldplay") pick one concrete representative song yourself and play it; for a named song use it. Return the local app task with `needsConfirmation=false`. Only return clarification when no concrete song can be chosen at all.+This skill ships a validated script — `skillID=music`, `scriptID=scripts-play-media-by-search` — that searches the Music app for a query and starts playback in one step (it tries the user's local library first, then the Apple Music streaming catalog). Run it with `skill_run`, passing the query as the input.-First decide the playback source. Use `metadata.mediaSelection.source=local_library` only when the user explicitly asks for local, library, downloaded, or owned music. Otherwise use `metadata.mediaSelection.source=streaming`; Apple Music is normally a streaming catalog, so the workflow should search, find an actual playable streaming result, and play it.+Choosing the query is what matters:-For explicit songs, albums, or playlists, put the concrete playable title plus artist when known in `query`.+- **Vague artist / mood / genre request** ("play some coldplay", "play coldplay"): pass the **artist or seed word alone** as the query — e.g. `Coldplay`. A broad term matches whatever the user owns, so playback starts from their library. Do NOT over-specify with a particular song title the user didn't name; a title they don't own (and the word "by") makes the local match miss.+- **A specific named song/album**: pass the plain `Title Artist` (e.g. `Yellow Coldplay`) — space-separated, no "by".-For vague artist, mood, or genre playback requests, choose one concrete representative song before returning task JSON. Do not choose a representative album, artist page, library item, station, or genre page when the user asks to play music. Do not use an artist-only query for playback unless the user explicitly asks to open an artist page, artist albums, artist radio, station, or another browsing surface.+Read the script's returned status:+- `status=played` → playback started; tell the user what's playing (`playedTitle`/`playedArtist`).+- `status=not_found` with `clarification.required=true` → only then ask the included question (e.g. the term isn't in the library and streaming didn't start).-Set `metadata.mediaSelection.kind` to `explicit_song`, `explicit_album`, `explicit_playlist`, or `representative_song`, and always set `metadata.mediaSelection.source` to `streaming` or `local_library`. For representative choices, also set `metadata.mediaSelection.seed`, `metadata.mediaSelection.selectedTitle`, and a short `metadata.mediaSelection.reason`. The `query` must include the selected song title and artist, not only the artist, album, genre, or mood seed.+Verify with the script's own status fields or `osascript -e 'tell application "Music" to player state'`; don't use screenshots.-Prefer the validated skill script path when the selected catalog entry supports it:+## Direct AppleScript (when you don't run the script)-- This skill ships a validated script — `skillID=music-media`, `scriptID=scripts-play-media-by-search` — that searches Apple Music for the query and starts playback as one bounded step.-- Execute it with your skill-script execution tool (`skill.script.execute`, or `skill_run` in the fast command layer), passing the structured `query` as the script input.-- Verify the structured script evidence (`state.verify`, or the script's returned status fields); do not use screenshot verification unless the script cannot provide evidence.-- The script input must be the same structured `query`; never pass raw user text separately.-- Treat script output as structured evidence. `status=played` means the script submitted playback. `clarification.required=true` means stop and ask the included `clarification.question`.+- Play whatever Coldplay is owned: `osascript -e 'tell application "Music" to play (item 1 of (search library playlist 1 for "Coldplay"))'`.+- Transport: `osascript -e 'tell application "Music" to playpause'`, `… to pause`, `… to set sound volume to 60`.+- What's playing: `osascript -e 'tell application "Music" to (get name of current track) & " — " & (get artist of current track)'`.-The AppleScript script is bounded and deterministic. It must not use raw user text, shell commands, files, deletion, quitting apps, network commands, or unrelated applications. Keep the UI plan below as the fallback path when the skill script cannot execute or does not produce enough evidence.+## GUI fallback-When planning generic `local_app_interaction`, use `targetAppName` and `entities.appName` from the supported catalog entry. For the preferred script flow, use `skill.load`, `skill.script.execute`, and `state.verify`. For UI fallback, use `goal=play media`, `inputEntity=query`, `controlID=search`, `focusKey=Command+F`, and tools `app.openOrFocus`, `app.observe`, `ui.focusSearch`, `ui.setText`, `ui.pressReturn`, a second `ui.pressReturn`, and `app.verifyVisibleText`. The first Return submits the search; the second Return activates the top playable result. If visible results are present, prefer a playable song row matching the requested seed over artist, playlist, category, or unrelated rows.+Only if scripting can't play it: focus Music, Cmd+F to search, type the query, press Return to submit and again to play the top result, then confirm `player state` is playing.