Open source CapCut alternative.
TypeScript
test(app): restructure harness and functional eval fixtures
David Le7494b954a1eb
diff --git a/apps/Donkey/Sources/DonkeyRuntime/DonkeyResourceBundle.swift b/apps/Donkey/Sources/DonkeyRuntime/DonkeyResourceBundle.swiftindex 7d1cb1b4..151732f3 100644--- a/apps/Donkey/Sources/DonkeyRuntime/DonkeyResourceBundle.swift+++ b/apps/Donkey/Sources/DonkeyRuntime/DonkeyResourceBundle.swift@@ -27,7 +27,13 @@ public enum DonkeyResourceBundle {/// The DonkeyRuntime target's own resource bundle (`bundled-tools.json`, the local-app finder/// profiles, and the BuiltInSkills tree).- public static let runtime = named("Donkey_DonkeyRuntime")+ ///+ /// Falls back to the SwiftPM-generated `Bundle.module` for the `swift test` / `swift run` layout,+ /// where `Bundle.main` is the toolchain's test runner and `named` can't find the bundle. The fallback+ /// is safe: `Bundle.module` is the accessor that `fatalError`s in a packaged signed app, but there+ /// `named` resolves first and `??` short-circuits, so it is only ever reached under test/dev where the+ /// bundle genuinely exists.+ public static let runtime: Bundle? = named("Donkey_DonkeyRuntime") ?? Bundle.module/// The Donkey executable target's resource bundle (app icon, sign-in art, theme).public static let app = named("Donkey_Donkey")diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/expect.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/expect.jsonnew file mode 100644index 00000000..3a057283--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/expect.json@@ -0,0 +1,8 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 14,+ "expectProduced": [+ { "kind": "jsonMinRecords", "minRecords": 4 },+ { "kind": "fileExists", "extension": "json" }+ ]+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/inputs/people.csv b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/inputs/people.csvnew file mode 100644index 00000000..62575684--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/inputs/people.csv@@ -0,0 +1,5 @@+name,role,city+Ada Lovelace,Engineer,London+Grace Hopper,Admiral,New York+Alan Turing,Mathematician,Manchester+Katherine Johnson,Physicist,Hamptondiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/prompt.txtnew file mode 100644index 00000000..56520508--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/csv-to-json/prompt.txt@@ -0,0 +1 @@+In the folder {DIR} there is people.csv. Convert it to a JSON array (one object per row) and save it as a .json file in {DIR}.\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/expect.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/expect.jsonnew file mode 100644index 00000000..24da5a8d--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/expect.json@@ -0,0 +1,8 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 14,+ "expectProduced": [+ { "kind": "audio" },+ { "kind": "fileExists", "extension": "mp3" }+ ]+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/inputs/clip.mp4 b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/inputs/clip.mp4new file mode 100644index 00000000..2c60abfcBinary files /dev/null and b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/inputs/clip.mp4 differdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/prompt.txtnew file mode 100644index 00000000..214b2fcf--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/extract-audio/prompt.txt@@ -0,0 +1 @@+In the folder {DIR} there is clip.mp4. Extract its audio track as an MP3 file and save it in {DIR}.\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/expect.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/expect.jsonnew file mode 100644index 00000000..16b96d3e--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/expect.json@@ -0,0 +1,12 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 28,+ "expectProduced": [+ { "kind": "pdfFields", "containsAll": [+ ["Blue Harbor Logistics"],+ ["Columbus"],+ ["1428 Cedar Mill"],+ ["47-3829156", "473829156"]+ ] }+ ]+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/inputs/1120data.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/inputs/1120data.txtnew file mode 100644index 00000000..76b2998a--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/inputs/1120data.txt@@ -0,0 +1,44 @@+My business info++Business name: Blue Harbor Logistics Inc.+Where we're at: 1428 Cedar Mill Road, Suite 200, Columbus, OH 43215+That tax ID number thing (EIN): 47-3829156+Started the company: March 14, 2018+Everything the business owns, roughly: $4,250,000+This is for last year (2025), normal calendar year++Money coming in++Total sales before anything: $8,750,000+Refunds / stuff customers sent back: $125,000+Dividends we got: $32,000+Interest from the bank: $18,500+Made a bit selling some equipment/investments: $14,000+Other random income: $9,200++What it cost us to make/buy the stuff we sell++Cost of goods sold: $5,180,000++Money going out (expenses)++What I paid myself + other officers: $420,000+Employee paychecks: $1,240,000+Fixing things / maintenance: $36,000+Customers who never paid (bad debts): $12,500+Rent for the warehouse: $180,000+Taxes & licenses (not income tax): $94,000+Interest on our loans: $52,000+Donations to charity: $25,000+Depreciation (the accountant said to put this): $145,000+Everything else (software, insurance, supplies, etc.): $310,000++Payments I already made++Estimated tax payments during the year: $200,000++Who's signing++Name: Dana R. Whitfield+Title: President+Phone: (614) 555-0182\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/inputs/f1120.pdf b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/inputs/f1120.pdfnew file mode 100644index 00000000..fff15be9Binary files /dev/null and b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/inputs/f1120.pdf differdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/prompt.txtnew file mode 100644index 00000000..5d47e11d--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/fill-f1120/prompt.txt@@ -0,0 +1 @@+In the folder {DIR} there is f1120.pdf (a blank IRS Form 1120) and 1120data.txt. Fill out f1120.pdf using the values in 1120data.txt and write the filled PDF into {DIR}.\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/expect.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/expect.jsonnew file mode 100644index 00000000..bd900384--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/expect.json@@ -0,0 +1,7 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "expectProduced": [+ { "kind": "pdfPageCount", "pageCount": 3 }+ ]+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/inputs/a.pdf b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/inputs/a.pdfnew file mode 100644index 00000000..0a31bba4Binary files /dev/null and b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/inputs/a.pdf differdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/inputs/b.pdf b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/inputs/b.pdfnew file mode 100644index 00000000..bea3ec1dBinary files /dev/null and b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/inputs/b.pdf differdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/prompt.txtnew file mode 100644index 00000000..f4514321--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/merge-pdfs/prompt.txt@@ -0,0 +1 @@+In the folder {DIR} there are two PDFs, a.pdf (2 pages) and b.pdf (1 page). Merge them into a single PDF in {DIR} with a.pdf first, then b.pdf.\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/expect.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/expect.jsonnew file mode 100644index 00000000..7efb58e3--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/expect.json@@ -0,0 +1,7 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 14,+ "expectProduced": [+ { "kind": "imageWidth", "width": 200 }+ ]+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/inputs/photo.png b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/inputs/photo.pngnew file mode 100644index 00000000..71f35182Binary files /dev/null and b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/inputs/photo.png differdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/prompt.txtnew file mode 100644index 00000000..74a7ec9e--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/FunctionalEval/resize-image/prompt.txt@@ -0,0 +1 @@+In the folder {DIR} there is photo.png (800x600). Resize it to exactly 200 pixels wide (keeping aspect ratio) and save the result as a new image in {DIR}.\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ambiguous-send-it/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ambiguous-send-it/prompt.txtnew file mode 100644index 00000000..dfdc0a90--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ambiguous-send-it/prompt.txt@@ -0,0 +1 @@+send it to her\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ambiguous-send-it/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ambiguous-send-it/scenario.jsonnew file mode 100644index 00000000..f845c14a--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ambiguous-send-it/scenario.json@@ -0,0 +1,9 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 6,+ "expect": {+ "turnKind": "clarify",+ "used": ["user.clarify"],+ "notUsed": ["shell_exec"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/archive-large-old-files/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/archive-large-old-files/prompt.txtnew file mode 100644index 00000000..34bf7066--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/archive-large-old-files/prompt.txt@@ -0,0 +1 @@+find every file over 1GB I have not opened in 6 months and move them into ~/Archive\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/archive-large-old-files/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/archive-large-old-files/scenario.jsonnew file mode 100644index 00000000..2f0dfbec--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/archive-large-old-files/scenario.json@@ -0,0 +1,13 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "responses": [+ { "tool": "shell_exec", "contains": ["mdfind"], "summary": "/Users/davidle/Movies/raw-shoot.mov\n/Users/davidle/Downloads/ubuntu.iso\n/Users/davidle/Desktop/backup.dmg" },+ { "tool": "shell_exec", "contains": ["mv "], "summary": "Moved 3 files into ~/Archive." }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["finder", "system-tools"],+ "shellAny": [["mdfind"], ["find "]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/combine-and-compress-scans/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/combine-and-compress-scans/prompt.txtnew file mode 100644index 00000000..cb300c21--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/combine-and-compress-scans/prompt.txt@@ -0,0 +1 @@+combine all the PDFs in ~/Desktop/scans into one file, then compress it to under 5MB\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/combine-and-compress-scans/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/combine-and-compress-scans/scenario.jsonnew file mode 100644index 00000000..3c062340--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/combine-and-compress-scans/scenario.json@@ -0,0 +1,16 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 18,+ "disk": [+ { "path": "/Users/davidle/Desktop/scans", "describe": "Folder of 8 scanned PDFs, ~3MB each (24MB total)." }+ ],+ "responses": [+ { "tool": "shell_exec", "contains": ["compress"], "summary": "Wrote scans-combined.pdf (4.2MB after downsampling).", "produces": ["scans-combined.pdf"] },+ { "tool": "shell_exec", "summary": "Combined 8 PDFs into scans-combined-raw.pdf (24MB).", "produces": ["scans-combined-raw.pdf"] }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["pdf"],+ "shellAny": [["qpdf"], ["gs"], ["ghostscript"], ["pdfunite"]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/bear.md b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/bear.mdnew file mode 100644index 00000000..aff35180--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/bear.md@@ -0,0 +1,3 @@+# Bear pricing+- Free: basic notes on one device+- Pro: $2.99 / month or $29.99 / year (sync + export)diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/notion.md b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/notion.mdnew file mode 100644index 00000000..9b53a802--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/notion.md@@ -0,0 +1,5 @@+# Notion pricing+- Free: personal use, unlimited blocks for individuals+- Plus: $10 / user / month+- Business: $18 / user / month+- Enterprise: customdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/obsidian.md b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/obsidian.mdnew file mode 100644index 00000000..145723a5--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/obsidian.md@@ -0,0 +1,5 @@+# Obsidian pricing+- Personal: free+- Sync add-on: $5 / month+- Publish add-on: $10 / month+- Commercial: $50 / user / yeardiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/prompt.txtnew file mode 100644index 00000000..aacf24df--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/prompt.txt@@ -0,0 +1 @@+compare the pricing of the top 3 note-taking apps and write me a summary doc on my Desktop\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/scenario.jsonnew file mode 100644index 00000000..5d86fada--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/scenario.json@@ -0,0 +1,16 @@+{+ "frontmostApp": "Safari",+ "maxSteps": 20,+ "responses": [+ { "tool": "web.search", "summaryFile": "search.md" },+ { "tool": "web.fetch", "contains": ["notion"], "summaryFile": "notion.md" },+ { "tool": "web.fetch", "contains": ["obsidian"], "summaryFile": "obsidian.md" },+ { "tool": "web.fetch", "contains": ["bear"], "summaryFile": "bear.md" },+ { "tool": "shell_exec", "contains": [".md"], "summary": "Wrote ~/Desktop/note-app-pricing.md", "produces": ["note-app-pricing.md"] }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["web-research", "web-capture"],+ "used": ["web.fetch"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/search.md b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/search.mdnew file mode 100644index 00000000..298587fe--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/compare-notes-pricing/search.md@@ -0,0 +1,5 @@+# Search results: best note-taking apps 2024++1. Notion — https://www.notion.so/pricing+2. Obsidian — https://obsidian.md/pricing+3. Bear — https://bear.app/pricingdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/dark-mode-night-shift/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/dark-mode-night-shift/prompt.txtnew file mode 100644index 00000000..0930f6d6--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/dark-mode-night-shift/prompt.txt@@ -0,0 +1 @@+turn on dark mode and enable Night Shift\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/dark-mode-night-shift/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/dark-mode-night-shift/scenario.jsonnew file mode 100644index 00000000..475a251e--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/dark-mode-night-shift/scenario.json@@ -0,0 +1,11 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 14,+ "responses": [+ { "tool": "shell_exec", "contains": ["osascript"], "summary": "Dark mode enabled." }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["settings", "system-tools"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/download-fails-then-recovers/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/download-fails-then-recovers/prompt.txtnew file mode 100644index 00000000..cc3b8888--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/download-fails-then-recovers/prompt.txt@@ -0,0 +1 @@+download the audio from https://www.youtube.com/watch?v=v8u_7PPEzZE as an mp3\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/download-fails-then-recovers/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/download-fails-then-recovers/scenario.jsonnew file mode 100644index 00000000..47f1c835--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/download-fails-then-recovers/scenario.json@@ -0,0 +1,12 @@+{+ "frontmostApp": "Safari",+ "maxSteps": 8,+ "responses": [+ { "tool": "shell_exec", "contains": ["yt-dlp"], "status": "failed", "summary": "ERROR: unable to download video data: HTTP Error 403: Forbidden" }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["media"],+ "completed": false+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/prompt.txtnew file mode 100644index 00000000..be0658fa--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/prompt.txt@@ -0,0 +1 @@+extract the table from q3-figures.pdf into a CSV\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/q3-figures.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/q3-figures.txtnew file mode 100644index 00000000..c725fd5e--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/q3-figures.txt@@ -0,0 +1,9 @@+Q3 REGIONAL FIGURES++Region Revenue Growth Churn+West 4,820,000 12.4% 1.8%+East 3,610,000 8.1% 2.3%+North 2,990,000 15.2% 1.1%+South 2,140,000 4.7% 3.0%++Totals: Revenue 13,560,000; blended growth 10.1%.diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/scenario.jsonnew file mode 100644index 00000000..5807e338--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/extract-table-from-pdf-to-csv/scenario.json@@ -0,0 +1,14 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "q3-figures.pdf", "describe": "PDF, 1 page, a 4-column table (Region, Revenue, Growth, Churn).", "contentFile": "q3-figures.txt" }+ ],+ "responses": [+ { "tool": "shell_exec", "contains": [".csv"], "summary": "Wrote q3-figures.csv (4 rows, 4 columns).", "produces": ["q3-figures.csv"] }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["pdf", "data", "documents"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/1120data.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/1120data.txtnew file mode 100644index 00000000..9f048b6c--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/1120data.txt@@ -0,0 +1,12 @@+name: ACME Robotics Inc+ein: 12-3456789+tax_year: 2025+address: 500 Industrial Way, Fremont, CA 94538+total_income: 4820000+cost_of_goods_sold: 2640000+total_deductions: 3110500+taxable_income: 1709500+total_tax: 359000+officer_name: Dana Cole+officer_title: CFO+preparer_ptin: P01234567diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/prompt.txtnew file mode 100644index 00000000..62c21e3f--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/prompt.txt@@ -0,0 +1 @@+fill out f1120.pdf using 1120data.txt\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/scenario.jsonnew file mode 100644index 00000000..a0c0004b--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/fill-f1120-pdf/scenario.json@@ -0,0 +1,17 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "f1120.pdf", "describe": "AcroForm PDF, 6 pages, 48 fillable fields (text and checkbox)." },+ { "path": "1120data.txt", "describe": "UTF-8 text, 12 `key: value` lines.", "contentFile": "1120data.txt" }+ ],+ "responses": [+ { "tool": "shell_exec", "contains": ["pdf-fill", "field"], "summary": "{\"type\":\"acroform\",\"fields\":[{\"name\":\"f1_01\",\"type\":\"text\"},{\"name\":\"c1_1\",\"type\":\"checkbox\"}]}" },+ { "tool": "shell_exec", "contains": ["pdf-fill"], "summary": "Wrote f1120-filled.pdf (48 fields set).", "produces": ["f1120-filled.pdf"] }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["pdf"],+ "shellAny": [["pdf-fill"], ["lit"]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/keynote-bold-titles/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/keynote-bold-titles/prompt.txtnew file mode 100644index 00000000..c06ab957--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/keynote-bold-titles/prompt.txt@@ -0,0 +1 @@+in the open Keynote deck, make every slide title bold\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/keynote-bold-titles/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/keynote-bold-titles/scenario.jsonnew file mode 100644index 00000000..b0469395--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/keynote-bold-titles/scenario.json@@ -0,0 +1,10 @@+{+ "frontmostApp": "Keynote",+ "maxSteps": 18,+ "responses": [+ { "tool": "ax.observe", "summary": "Keynote frontmost: 8 slides in the navigator, slide 1 title text selected." }+ ],+ "expect": {+ "turnKind": "act"+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/korean-clip-overlay/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/korean-clip-overlay/prompt.txtnew file mode 100644index 00000000..0117618f--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/korean-clip-overlay/prompt.txt@@ -0,0 +1 @@+create a 1min clip of this and overlay the korean translation onto the video https://www.youtube.com/watch?v=v8u_7PPEzZE. start at the 15min point\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/korean-clip-overlay/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/korean-clip-overlay/scenario.jsonnew file mode 100644index 00000000..488c2a9a--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/korean-clip-overlay/scenario.json@@ -0,0 +1,16 @@+{+ "frontmostApp": "Safari",+ "maxSteps": 16,+ "responses": [+ { "tool": "llm.generate", "summary": "Wrote subs.srt (Korean subtitles with timestamps).", "produces": ["subs.srt"] },+ { "tool": "shell_exec", "contains": ["yt-dlp"], "summary": "[download] 100% — clip.mp4 written (00:01:00, 1920x1080).", "produces": ["clip.mp4"] },+ { "tool": "shell_exec", "contains": ["ffprobe"], "summary": "duration=60.000000\nformat_name=mov,mp4,m4a,3gp,3g2,mj2" },+ { "tool": "shell_exec", "contains": ["ffmpeg", "subtitles"], "summary": "out.mp4 written with burned-in Korean subtitles.", "produces": ["out.mp4"] },+ { "tool": "shell_exec", "contains": ["ffmpeg"], "summary": "ffmpeg: wrote output." }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["media"],+ "shellAll": [["yt-dlp", "download-sections"]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/donkeyuse.html b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/donkeyuse.htmlnew file mode 100644index 00000000..d28e3fc9--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/donkeyuse.html@@ -0,0 +1,24 @@+<!doctype html>+<html lang="en">+<head><meta charset="utf-8"><title>Donkey — your Mac, on autopilot</title></head>+<body>+ <header><h1>Donkey</h1><p>Your Mac, on autopilot.</p></header>+ <main>+ <section id="what">+ <h2>What it is</h2>+ <p>Donkey is a general-purpose desktop agent for macOS. Describe a task in plain language and it drives your apps, runs shell workflows, edits media, fills PDFs, and browses the web to get it done.</p>+ </section>+ <section id="features">+ <h2>Features</h2>+ <ul>+ <li>Drives any app through accessibility and vision</li>+ <li>Media: download, trim, transcribe, and subtitle video</li>+ <li>Documents: fill PDF forms, convert images, crunch spreadsheets</li>+ <li>Web: search, scrape to markdown, and run multi-step flows</li>+ </ul>+ </section>+ <section id="pricing"><h2>Pricing</h2><p>Free during the open beta.</p></section>+ </main>+ <footer><p>donkeyuse.com</p></footer>+</body>+</html>diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/donkeyuse.md b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/donkeyuse.mdnew file mode 100644index 00000000..1de0a2cd--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/donkeyuse.md@@ -0,0 +1,18 @@+# Donkey++Your Mac, on autopilot.++## What it is++Donkey is a general-purpose desktop agent for macOS. Describe a task in plain language and it drives your apps, runs shell workflows, edits media, fills PDFs, and browses the web to get it done.++## Features++- Drives any app through accessibility and vision+- Media: download, trim, transcribe, and subtitle video+- Documents: fill PDF forms, convert images, crunch spreadsheets+- Web: search, scrape to markdown, and run multi-step flows++## Pricing++Free during the open beta.diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/prompt.txtnew file mode 100644index 00000000..8d93d9ec--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/prompt.txt@@ -0,0 +1 @@+give me a markdown of donkeyuse.com\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/scenario.jsonnew file mode 100644index 00000000..da821d34--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/markdown-of-donkeyuse/scenario.json@@ -0,0 +1,12 @@+{+ "frontmostApp": "Safari",+ "maxSteps": 10,+ "responses": [+ { "tool": "web.fetch", "summaryFile": "donkeyuse.md" }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["web-capture", "web-research"],+ "used": ["web.fetch"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/merge-pdfs-add-page-numbers/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/merge-pdfs-add-page-numbers/prompt.txtnew file mode 100644index 00000000..6869ea31--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/merge-pdfs-add-page-numbers/prompt.txt@@ -0,0 +1 @@+merge invoice-jan.pdf, invoice-feb.pdf and invoice-mar.pdf into one file and add page numbers\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/merge-pdfs-add-page-numbers/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/merge-pdfs-add-page-numbers/scenario.jsonnew file mode 100644index 00000000..40c8975c--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/merge-pdfs-add-page-numbers/scenario.json@@ -0,0 +1,18 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "invoice-jan.pdf", "describe": "PDF, 2 pages." },+ { "path": "invoice-feb.pdf", "describe": "PDF, 3 pages." },+ { "path": "invoice-mar.pdf", "describe": "PDF, 1 page." }+ ],+ "responses": [+ { "tool": "shell_exec", "contains": ["page"], "summary": "Wrote invoices-numbered.pdf (6 pages, footer page numbers).", "produces": ["invoices-numbered.pdf"] },+ { "tool": "shell_exec", "summary": "Wrote invoices.pdf (merged, 6 pages).", "produces": ["invoices.pdf"] }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["pdf"],+ "shellAny": [["qpdf"], ["pdfunite"], ["pdftk"], ["lit"]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/expenses.csv b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/expenses.csvnew file mode 100644index 00000000..d40994ac--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/expenses.csv@@ -0,0 +1,4 @@+date,merchant,category,total+2024-11-02,Blue Bottle Coffee,meals,18.40+2024-11-05,Uber,travel,32.10+2024-11-09,Office Depot,supplies,64.75diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/prompt.txtnew file mode 100644index 00000000..aae2f563--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/prompt.txt@@ -0,0 +1 @@+OCR receipt.jpg, then append the merchant and total as a new row in expenses.csv\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/scenario.jsonnew file mode 100644index 00000000..508152a1--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/ocr-receipt-to-expenses/scenario.json@@ -0,0 +1,16 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "receipt.jpg", "describe": "JPEG photo of a printed restaurant receipt." },+ { "path": "expenses.csv", "describe": "CSV, columns: date, merchant, category, total.", "contentFile": "expenses.csv" }+ ],+ "responses": [+ { "tool": "files.describe", "summary": "receipt.jpg — receipt from 'Tartine Bakery', total $42.18, dated 2024-11-14. expenses.csv — 3 rows." },+ { "tool": "shell_exec", "contains": ["expenses.csv"], "summary": "Appended row: 2024-11-14,Tartine Bakery,meals,42.18", "produces": ["expenses.csv"] }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["images", "data", "documents"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/paper.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/paper.txtnew file mode 100644index 00000000..11a83f22--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/paper.txt@@ -0,0 +1,15 @@+Attention Routing in Sparse Models++Abstract+We study how routing decisions in sparse mixture-of-experts models affect downstream+accuracy. We find that load-balancing losses trade capacity for stability.++1. Introduction+Sparse models activate a subset of parameters per token. Routing is the mechanism that+chooses which experts handle which tokens.++2. Method+We add an auxiliary balance term and measure expert utilization across layers.++3. Results+Balanced routing improves validation accuracy by 1.4 points at equal compute.diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/prompt.txtnew file mode 100644index 00000000..5018f188--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/prompt.txt@@ -0,0 +1 @@+get me the markdown for this pdf\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/scenario.jsonnew file mode 100644index 00000000..6c21ec4a--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/pdf-to-markdown/scenario.json@@ -0,0 +1,16 @@+{+ "frontmostApp": "Preview",+ "maxSteps": 14,+ "disk": [+ { "path": "paper.pdf", "describe": "PDF open in Preview, 11 pages, selectable text — a research paper.", "contentFile": "paper.txt" }+ ],+ "responses": [+ { "tool": "shell_exec", "contains": [".md"], "summary": "Wrote paper.md (headings + body from paper.pdf).", "produces": ["paper.md"] },+ { "tool": "llm.generate", "summary": "Converted the extracted text to clean markdown.", "produces": ["paper.md"] }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["pdf", "documents"],+ "shellAny": [["pdftotext"], ["pandoc"], ["markitdown"], ["lit"]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/rain-umbrella-reminder/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/rain-umbrella-reminder/prompt.txtnew file mode 100644index 00000000..84d4ec58--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/rain-umbrella-reminder/prompt.txt@@ -0,0 +1 @@+if it is going to rain tomorrow, remind me to grab an umbrella\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/rain-umbrella-reminder/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/rain-umbrella-reminder/scenario.jsonnew file mode 100644index 00000000..220f5ef0--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/rain-umbrella-reminder/scenario.json@@ -0,0 +1,12 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "responses": [+ { "tool": "web.fetch", "summary": "Tomorrow: rain likely, 80% chance, high 14C." },+ { "tool": "automation.applescript.execute", "summary": "Created reminder \"Grab an umbrella\" for tomorrow 8:00 AM." }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["weather", "reminders"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/contract.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/contract.txtnew file mode 100644index 00000000..0b3e278b--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/contract.txt@@ -0,0 +1,9 @@+EMPLOYMENT AGREEMENT++This agreement is between ACME Robotics Inc and the parties below.++Employee: Jordan Rivera, SSN 123-45-6789+Co-signer: Pat Morgan, SSN 987-65-4321++Compensation and confidentiality terms follow in Schedule A.+Witness SSN on file: 555-12-3456.diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/prompt.txtnew file mode 100644index 00000000..b1705be9--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/prompt.txt@@ -0,0 +1 @@+redact every Social Security number from contract.pdf and flatten the result\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/scenario.jsonnew file mode 100644index 00000000..edc50d14--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/redact-and-flatten-contract/scenario.json@@ -0,0 +1,15 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "contract.pdf", "describe": "PDF, 4 pages, selectable text; contains 3 SSNs in the body.", "contentFile": "contract.txt" }+ ],+ "responses": [+ { "tool": "shell_exec", "contains": ["flatten"], "summary": "Wrote contract-redacted.pdf (flattened, 3 SSNs covered).", "produces": ["contract-redacted.pdf"] },+ { "tool": "shell_exec", "contains": [".pdf"], "summary": "Applied redaction boxes over 3 matches.", "produces": ["contract-redacted.pdf"] }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["pdf"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/resize-trip-photos/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/resize-trip-photos/prompt.txtnew file mode 100644index 00000000..14b8962b--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/resize-trip-photos/prompt.txt@@ -0,0 +1 @@+resize every photo in ~/Desktop/trip to 1080px wide, strip the GPS metadata, then make a 3x3 contact sheet\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/resize-trip-photos/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/resize-trip-photos/scenario.jsonnew file mode 100644index 00000000..2e0271b2--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/resize-trip-photos/scenario.json@@ -0,0 +1,18 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 18,+ "disk": [+ { "path": "/Users/davidle/Desktop/trip", "describe": "Folder of 12 JPEG photos (3024x4032, ~4MB each), some with GPS EXIF tags." }+ ],+ "responses": [+ { "tool": "files.describe", "summary": "~/Desktop/trip — 12 JPEG photos, 3024x4032, several carry GPS EXIF tags." },+ { "tool": "shell_exec", "contains": ["sips"], "summary": "Resized 12 images to 1080px wide." },+ { "tool": "shell_exec", "contains": ["exiftool"], "summary": "Stripped GPS tags from 12 images." },+ { "tool": "shell_exec", "contains": ["montage"], "summary": "Wrote contact-sheet.jpg (3x3).", "produces": ["contact-sheet.jpg"] }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["images"],+ "shellAny": [["sips"], ["magick"], ["mogrify"]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/prompt.txtnew file mode 100644index 00000000..94ebfd51--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/prompt.txt@@ -0,0 +1 @@+take sales.csv, compute the monthly revenue totals, and turn it into a bar chart saved as monthly.png\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/sales.csv b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/sales.csvnew file mode 100644index 00000000..f9be2b78--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/sales.csv@@ -0,0 +1,19 @@+date,region,product,units,revenue+2024-01-08,West,Widget,120,3600+2024-01-22,East,Gadget,80,5200+2024-02-03,West,Widget,140,4200+2024-02-19,North,Gadget,60,3900+2024-03-11,East,Widget,200,6000+2024-03-27,South,Doohickey,45,2925+2024-04-09,West,Gadget,90,5850+2024-04-25,North,Widget,160,4800+2024-05-14,East,Doohickey,70,4550+2024-06-02,South,Widget,110,3300+2024-06-21,West,Gadget,130,8450+2024-07-07,North,Widget,175,5250+2024-08-18,East,Gadget,95,6175+2024-09-05,South,Doohickey,55,3575+2024-10-29,West,Widget,210,6300+2024-11-16,North,Gadget,120,7800+2024-12-09,East,Widget,240,7200+2024-12-23,South,Gadget,150,9750diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/scenario.jsonnew file mode 100644index 00000000..30f274c2--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sales-csv-monthly-chart/scenario.json@@ -0,0 +1,14 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 18,+ "disk": [+ { "path": "sales.csv", "describe": "CSV, 18 data rows, columns: date, region, product, units, revenue.", "contentFile": "sales.csv" }+ ],+ "responses": [+ { "tool": "shell_exec", "contains": ["png"], "summary": "Wrote monthly.png (bar chart, 12 bars).", "produces": ["monthly.png"] }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["data", "numbers"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sign-nda-pdf/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sign-nda-pdf/prompt.txtnew file mode 100644index 00000000..79f0cf87--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sign-nda-pdf/prompt.txt@@ -0,0 +1 @@+add my signature from signature.png to the signature line on nda.pdf\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sign-nda-pdf/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sign-nda-pdf/scenario.jsonnew file mode 100644index 00000000..4a9a05dd--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/sign-nda-pdf/scenario.json@@ -0,0 +1,15 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "nda.pdf", "describe": "PDF, 3 pages; a signature line near the bottom of page 3." },+ { "path": "signature.png", "describe": "PNG, transparent background, a handwritten signature." }+ ],+ "responses": [+ { "tool": "shell_exec", "summary": "Overlaid signature.png on page 3 of nda.pdf.", "produces": ["nda-signed.pdf"] }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["pdf", "images"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/split-pdf-by-chapter/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/split-pdf-by-chapter/prompt.txtnew file mode 100644index 00000000..fb8c83d5--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/split-pdf-by-chapter/prompt.txt@@ -0,0 +1 @@+split book.pdf into one file per chapter\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/split-pdf-by-chapter/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/split-pdf-by-chapter/scenario.jsonnew file mode 100644index 00000000..8d74cf6b--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/split-pdf-by-chapter/scenario.json@@ -0,0 +1,16 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "book.pdf", "describe": "PDF, 240 pages, 8 chapter bookmarks in the outline." }+ ],+ "responses": [+ { "tool": "shell_exec", "contains": ["pdfinfo"], "summary": "Title: Field Guide\nPages: 240\nBookmarks: 8 (chapter starts at pages 1, 28, 61, 95, 130, 168, 199, 224)" },+ { "tool": "shell_exec", "summary": "Wrote chapter-01.pdf … chapter-08.pdf.", "produces": ["chapter-01.pdf", "chapter-08.pdf"] }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["pdf"],+ "shellAny": [["qpdf"], ["pdftk"], ["pdfseparate"], ["lit"]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/prompt.txtnew file mode 100644index 00000000..345aa59e--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/prompt.txt@@ -0,0 +1 @@+summarize report.pdf into a one-page brief and save it to my Desktop\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/report.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/report.txtnew file mode 100644index 00000000..b73f37c8--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/report.txt@@ -0,0 +1,13 @@+Q3 PLATFORM RELIABILITY REVIEW++Executive summary: availability was 99.92%, below the 99.95% target, driven by two+incidents in the payments path. Mean time to recovery improved 18% quarter over quarter.++Section 1 — Incidents. INC-204 (payments timeout, 47 min) and INC-219 (cache stampede,+31 min) accounted for 78 of 83 minutes of downtime. Both traced to missing backpressure.++Section 2 — Capacity. Peak traffic grew 22%. Database CPU headroom fell to 15% at peak;+read-replica rollout is recommended before Q4 promotions.++Section 3 — Action items. Add backpressure to the payments queue, ship read replicas,+and add a cache-stampede guard. Owners assigned; target dates in Q4.diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/scenario.jsonnew file mode 100644index 00000000..14d03156--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/summarize-long-pdf/scenario.json@@ -0,0 +1,16 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "report.pdf", "describe": "PDF, 42 pages, selectable text — a quarterly reliability review.", "contentFile": "report.txt" }+ ],+ "responses": [+ { "tool": "llm.generate", "summary": "Wrote a one-page brief of report.pdf.", "produces": ["report-brief.md"] },+ { "tool": "shell_exec", "contains": [".md"], "summary": "Wrote ~/Desktop/report-brief.md", "produces": ["report-brief.md"] }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["pdf", "documents"],+ "used": ["llm.generate"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/text-running-late/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/text-running-late/prompt.txtnew file mode 100644index 00000000..a5f087f6--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/text-running-late/prompt.txt@@ -0,0 +1 @@+text my wife I am running 20 minutes late\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/text-running-late/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/text-running-late/scenario.jsonnew file mode 100644index 00000000..97eea9c6--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/text-running-late/scenario.json@@ -0,0 +1,11 @@+{+ "frontmostApp": "Messages",+ "maxSteps": 14,+ "responses": [+ { "tool": "automation.applescript.execute", "summary": "Sent iMessage to Sarah Le: \"Running 20 minutes late\"." }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["imessage", "contacts"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/prompt.txtnew file mode 100644index 00000000..b5cd40a1--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/prompt.txt@@ -0,0 +1 @@+create a playlist with the top 10 songs from 2021\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/scenario.jsonnew file mode 100644index 00000000..53c6aaf1--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/scenario.json@@ -0,0 +1,11 @@+{+ "frontmostApp": "Music",+ "maxSteps": 20,+ "responses": [+ { "tool": "web.search", "summaryFile": "search.md" }+ ],+ "expect": {+ "turnKind": "act",+ "skillsAny": ["music", "web-research", "spotify"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/search.md b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/search.mdnew file mode 100644index 00000000..13ec3bf1--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/top-songs-2021-playlist/search.md@@ -0,0 +1,11 @@+# Billboard Year-End Hot 100 — 2021 (top 10)+1. Levitating — Dua Lipa+2. Save Your Tears — The Weeknd+3. Blinding Lights — The Weeknd+4. Mood — 24kGoldn ft. iann dior+5. Good 4 U — Olivia Rodrigo+6. Kiss Me More — Doja Cat ft. SZA+7. Leave the Door Open — Silk Sonic+8. Drivers License — Olivia Rodrigo+9. Montero (Call Me By Your Name) — Lil Nas X+10. Peaches — Justin Bieberdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/transcribe-meeting-audio/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/transcribe-meeting-audio/prompt.txtnew file mode 100644index 00000000..6b325cd4--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/transcribe-meeting-audio/prompt.txt@@ -0,0 +1 @@+extract the audio from meeting.mov as an mp3 and give me a transcript with the action items pulled out\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/transcribe-meeting-audio/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/transcribe-meeting-audio/scenario.jsonnew file mode 100644index 00000000..678207ee--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/transcribe-meeting-audio/scenario.json@@ -0,0 +1,17 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 16,+ "disk": [+ { "path": "meeting.mov", "describe": "QuickTime movie, 38 min, 1080p with audio." }+ ],+ "responses": [+ { "tool": "llm.generate", "summary": "Transcribed meeting.mp3; pulled 5 action items.", "produces": ["transcript.txt"] },+ { "tool": "shell_exec", "contains": ["ffmpeg"], "summary": "Wrote meeting.mp3 (38:12, 128kbps).", "produces": ["meeting.mp3"] }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["media"],+ "shellAny": [["ffmpeg"]],+ "used": ["llm.generate"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/watermark-all-pdfs-in-folder/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/watermark-all-pdfs-in-folder/prompt.txtnew file mode 100644index 00000000..d168a335--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/watermark-all-pdfs-in-folder/prompt.txt@@ -0,0 +1 @@+stamp a DRAFT watermark on every PDF in ~/Desktop/contracts\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/watermark-all-pdfs-in-folder/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/watermark-all-pdfs-in-folder/scenario.jsonnew file mode 100644index 00000000..e386166e--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/watermark-all-pdfs-in-folder/scenario.json@@ -0,0 +1,15 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 18,+ "disk": [+ { "path": "/Users/davidle/Desktop/contracts", "describe": "Folder of 6 contract PDFs." }+ ],+ "responses": [+ { "tool": "shell_exec", "summary": "Stamped DRAFT on 6 PDFs (written alongside originals as *-draft.pdf).", "produces": ["contracts-draft"] }+ ],+ "expect": {+ "turnKind": "act",+ "skills": ["pdf"],+ "shellAny": [["qpdf"], ["pdftk"], ["stamp"], ["overlay"], ["lit"]]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/what-can-you-do/prompt.txt b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/what-can-you-do/prompt.txtnew file mode 100644index 00000000..c5c1d593--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/what-can-you-do/prompt.txt@@ -0,0 +1 @@+what can you do?\ No newline at end of filediff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/what-can-you-do/scenario.json b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/what-can-you-do/scenario.jsonnew file mode 100644index 00000000..ee567c07--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/Fixtures/HarnessEval/what-can-you-do/scenario.json@@ -0,0 +1,8 @@+{+ "frontmostApp": "Finder",+ "maxSteps": 4,+ "expect": {+ "turnKind": "converse",+ "notUsed": ["shell_exec", "ax.click", "vision.click", "automation.applescript.execute"]+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalFixture.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalFixture.swiftnew file mode 100644index 00000000..b3ed4286--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalFixture.swift@@ -0,0 +1,142 @@+import DonkeyRuntime+import Foundation++/// A functional-eval scenario on disk: a folder under `Fixtures/FunctionalEval/<name>/` whose inputs the+/// agent really operates on, plus the result-level checks.+///+/// Layout:+/// - `prompt.txt` — the task; `{DIR}` is replaced with the sandbox path so the prompt names exactly where+/// the inputs are and where output should go.+/// - `inputs/` — committed real files copied into a fresh sandbox before the run (e.g. the IRS form, a+/// CSV). Use this for artifacts that can't be generated.+/// - `generate.sh` — optional; run inside the sandbox after `inputs/` is copied, to materialize binary+/// inputs with installed tools (images, video, PDFs) so they don't bloat the repo.+/// - `expect.json` — the checks (see `FunctionalEvalExpect`).+struct FunctionalEvalExpect: Decodable, Sendable {+ var frontmostApp: String?+ var maxSteps: Int?+ /// Result checks, each evaluated against the files the AGENT produced (anything in the sandbox that was+ /// not there after setup). A check passes if SOME produced file satisfies it; the run passes if all do.+ var expectProduced: [FunctionalEvalCheck]?+}++/// One result check. `kind` selects which tool reads the produced file; the other fields parameterize it.+struct FunctionalEvalCheck: Decodable, Sendable {+ /// "pdfPageCount" | "imageWidth" | "audio" | "pdfFields" | "jsonMinRecords" | "fileExists".+ var kind: String+ var pageCount: Int?+ var width: Int?+ var minRecords: Int?+ var ext: String?+ /// For "pdfFields": each group is acceptable alternatives; every group must match some field value.+ var containsAll: [[String]]?++ enum CodingKeys: String, CodingKey {+ case kind, pageCount, width, minRecords, containsAll+ case ext = "extension"+ }+}++struct FunctionalEvalFixture: Sendable, CustomStringConvertible {+ var name: String+ var prompt: String+ var expect: FunctionalEvalExpect+ var dir: URL++ var description: String { name }++ /// Every functional fixture folder, sorted by name. Empty when the resource bundle is absent.+ static func all() -> [FunctionalEvalFixture] {+ guard let root = Bundle.module.resourceURL?.appendingPathComponent("Fixtures/FunctionalEval") else {+ return []+ }+ let dirs = (try? FileManager.default.contentsOfDirectory(+ at: root,+ includingPropertiesForKeys: [.isDirectoryKey]+ )) ?? []+ return dirs.compactMap(load).sorted { $0.name < $1.name }+ }++ static func load(_ dir: URL) -> FunctionalEvalFixture? {+ var isDir: ObjCBool = false+ guard FileManager.default.fileExists(atPath: dir.path, isDirectory: &isDir), isDir.boolValue else {+ return nil+ }+ guard let rawPrompt = try? String(contentsOf: dir.appendingPathComponent("prompt.txt"), encoding: .utf8) else {+ return nil+ }+ let expect = (try? Data(contentsOf: dir.appendingPathComponent("expect.json")))+ .flatMap { try? JSONDecoder().decode(FunctionalEvalExpect.self, from: $0) }+ ?? FunctionalEvalExpect()+ return FunctionalEvalFixture(+ name: dir.lastPathComponent,+ prompt: rawPrompt.trimmingCharacters(in: .whitespacesAndNewlines),+ expect: expect,+ dir: dir+ )+ }++ /// Create a fresh sandbox under the user's home (where the shell tool's hard-anchored cwd can reach it),+ /// copy any committed `inputs/`, then run `generate.sh` (if present) to materialize binary inputs. The+ /// caller removes the sandbox after the run.+ func makeSandbox() throws -> URL {+ let sandbox = FileManager.default.homeDirectoryForCurrentUser+ .appendingPathComponent(".donkey-functional-eval", isDirectory: true)+ .appendingPathComponent("\(name)-\(UUID().uuidString)", isDirectory: true)+ try FileManager.default.createDirectory(at: sandbox, withIntermediateDirectories: true)++ let inputsDir = dir.appendingPathComponent("inputs")+ if FileManager.default.fileExists(atPath: inputsDir.path) {+ for input in (try? FileManager.default.contentsOfDirectory(at: inputsDir, includingPropertiesForKeys: nil)) ?? [] {+ try FileManager.default.copyItem(at: input, to: sandbox.appendingPathComponent(input.lastPathComponent))+ }+ }++ let generate = dir.appendingPathComponent("generate.sh")+ if FileManager.default.fileExists(atPath: generate.path),+ let script = try? String(contentsOf: generate, encoding: .utf8) {+ _ = ShellHelper.run(script, in: sandbox)+ }+ return sandbox+ }++ /// The prompt with `{DIR}` resolved to the sandbox path.+ func resolvedPrompt(sandbox: URL) -> String {+ prompt.replacingOccurrences(of: "{DIR}", with: sandbox.path)+ }++ /// The file names directly in `directory` — used to snapshot the sandbox after setup so the verifier can+ /// tell which files the agent produced.+ static func fileNames(in directory: URL) -> Set<String> {+ let entries = (try? FileManager.default.contentsOfDirectory(atPath: directory.path)) ?? []+ return Set(entries)+ }+}++/// Runs a shell snippet through a login zsh (so Homebrew tools resolve) with the bundled donkey-tools dir+/// appended to PATH (so `pdf-fill` / `lit` resolve). Used for input generation and result verification —+/// the trusted test side, never the agent. Returns combined stdout (trimmed).+enum ShellHelper {+ @discardableResult+ static func run(_ command: String, in directory: URL) -> String {+ let process = Process()+ process.executableURL = URL(fileURLWithPath: "/bin/zsh")+ process.arguments = ["-lc", command]+ process.currentDirectoryURL = directory+ var environment = ProcessInfo.processInfo.environment+ let toolsPath = BundledTools.installDirectory.path+ environment["PATH"] = (environment["PATH"] ?? "/usr/bin:/bin:/opt/homebrew/bin") + ":" + toolsPath+ process.environment = environment+ let outPipe = Pipe()+ process.standardOutput = outPipe+ process.standardError = Pipe()+ do {+ try process.run()+ let data = outPipe.fileHandleForReading.readDataToEndOfFile()+ process.waitUntilExit()+ return String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""+ } catch {+ return ""+ }+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalRunner.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalRunner.swiftnew file mode 100644index 00000000..f926ae68--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalRunner.swift@@ -0,0 +1,149 @@+import DonkeyAI+import DonkeyContracts+import DonkeyHarness+import DonkeyRuntime+import Foundation++/// FUNCTIONAL evaluation harness — the counterpart to the prompt/planner eval. Where the prompt eval stubs+/// every executor and grades the *plan*, the functional eval wires the REAL tool executors and grades the+/// *result*: it runs the actual agent loop, lets `shell_exec` / `files.describe` / the bundled CLI tools+/// (`lit`, `pdf-fill`, `qpdf`, `ffmpeg`, …) really run, and asserts on the files they produce.+///+/// Safety is by construction, not by trust:+/// - It runs only in a throwaway sandbox under the user's home (shell's cwd is hard-anchored to home, so a+/// sandbox there is the one place a relative or discovered path lands). Inputs are copied in; the prompt+/// names that directory explicitly so the agent never reaches for the user's real files.+/// - It pre-authorizes each shell command headlessly by computing the same signature the consent gate+/// uses and granting it once — so a reversible write runs without a UI prompt, but nothing is silently+/// made a standing rule.+/// - It is opt-in behind `DONKEY_FUNCTIONAL_EVAL=1` AND the same hosted-backend env the prompt eval needs,+/// so a plain `swift test` never executes anything. Run with:+///+/// env DONKEY_FUNCTIONAL_EVAL=1 DONKEY_PROMPT_EVAL=1 DONKEY_WEB_BASE_URL=http://localhost:3000 \+/// DONKEY_DEV_AUTH_BYPASS=1 DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \+/// swift test --filter FunctionalEval+struct FunctionalEvalConfig: Sendable {+ var baseURL: URL+ var clientID: String+ var devAuthBypass: Bool+}++/// The captured outcome of a functional run: what the model understood, the tool calls it made, the final+/// status, and the sandbox the work happened in (so assertions can inspect the real output files).+struct FunctionalEvalRun {+ var understanding: HarnessRequestUnderstanding?+ var records: [HarnessToolCallRecord]+ var finalStatus: HarnessAgentStatus+ var sandbox: URL++ var calls: [HarnessToolCall] { records.map(\.call) }+ var toolNames: [String] { calls.map(\.name) }+ var shellCommands: [String] { calls.filter { $0.name == "shell_exec" }.compactMap { $0.input["command"] } }+ var completed: Bool { finalStatus == .completed }++ var transcript: String {+ records.enumerated().map { index, record in+ let input = record.call.input+ .sorted { $0.key < $1.key }+ .map { key, value in "\(key)=\(value.count > 160 ? String(value.prefix(160)) + "…" : value)" }+ .joined(separator: " ")+ let suffix = input.isEmpty ? "" : " { \(input) }"+ return " \(index + 1). \(record.call.name) → \(String(describing: record.resultStatus))\(suffix)"+ }.joined(separator: "\n")+ }+}++enum FunctionalEvalRunner {+ /// Live config, or nil when not opted in (the caller then returns early — these tests both reach the real+ /// model and really execute tools, so they must never run by accident).+ static func configFromEnvironment(+ _ environment: [String: String] = ProcessInfo.processInfo.environment+ ) -> FunctionalEvalConfig? {+ guard environment["DONKEY_FUNCTIONAL_EVAL"] == "1" else { return nil }+ guard let raw = environment["DONKEY_WEB_BASE_URL"], !raw.isEmpty, let url = URL(string: raw) else {+ return nil+ }+ return FunctionalEvalConfig(+ baseURL: url,+ clientID: environment["DONKEY_CLIENT_ID"] ?? "functional-eval",+ devAuthBypass: environment["DONKEY_DEV_AUTH_BYPASS"] == "1"+ )+ }++ /// Run one functional scenario end to end with real executors against a sandbox. `@MainActor` because+ /// the hosted planner and understanding boundary are main-actor isolated, as in the app.+ @MainActor+ static func run(+ prompt: String,+ frontmostApp: String,+ maxSteps: Int,+ sandbox: URL,+ config: FunctionalEvalConfig+ ) async -> FunctionalEvalRun {+ var configuration = DonkeyBackendInferenceConfiguration(+ baseURL: config.baseURL,+ clientID: config.clientID,+ devAuthBypass: config.devAuthBypass+ )+ let conversationID = "functional-eval-\(UUID().uuidString)"+ configuration.conversationID = conversationID+ let backend = DonkeyBackendInferenceClient(configuration: configuration)++ // Real one-shot understanding, fed the production skill catalog so it surfaces the right skill.+ let skillCatalog = BuiltInLocalAppSkillPacks.skillSelectionCatalog()+ let understanding = await HostedHarnessRequestUnderstanding(backend: backend)+ .understand(command: prompt, frontmostAppName: frontmostApp, skillCatalog: skillCatalog)+ let preloadedSkillGuides: [String] = (understanding?.relevantSkillIDs ?? [])+ .prefix(2)+ .compactMap { BuiltInLocalAppSkillPacks.skillGuidance(forID: $0) }++ // REAL executors — the same services the app wires — but with the shell command executor wrapped so+ // each command is pre-authorized headlessly. The wrapper computes the consent gate's own signature+ // and grants it once before delegating, so a reversible write (e.g. `pdf-fill set … -o out.pdf`)+ // runs without a UI prompt while high-risk commands still get only a single, non-standing grant.+ var services = LocalAppUserQueryHarnessServices.builtInSkillBackedServices()+ if let realCommandExecutor = services.commandExecutor {+ services.commandExecutor = { context in+ if context.call.name == "shell_exec",+ let command = context.call.input["command"] ?? context.call.input["cmd"] {+ let classification = ShellCommandClassifier.classify(command)+ await ShellPermissionPolicyStore.shared.grantOnce(+ agentID: context.agentID,+ signature: classification.signature+ )+ }+ return await realCommandExecutor(context)+ }+ }+ let registry = BuiltInHarnessToolCatalog.registryWithBuiltInExecutors(services: services)+ let descriptors = BuiltInHarnessToolCatalog.descriptors++ let coordinator = HarnessAgentCoordinator()+ let goal = (understanding?.restatedGoal).flatMap { $0.isEmpty ? nil : $0 } ?? prompt+ let agent = await coordinator.createAgent(+ conversationID: conversationID,+ goal: goal,+ grantedPermissions: Set(HarnessPermission.allCases)+ )++ let planner = HostedHarnessStepPlanner(+ backend: backend,+ descriptors: descriptors,+ appName: understanding?.targetAppName ?? "",+ appGuidance: nil,+ understanding: understanding,+ preloadedSkillGuides: preloadedSkillGuides+ )++ let runtime = GenericHarnessRuntime(coordinator: coordinator, registry: registry)+ _ = await runtime.run(agentID: agent.id, planner: planner, maxSteps: maxSteps)++ let final = await coordinator.agent(id: agent.id)+ return FunctionalEvalRun(+ understanding: understanding,+ records: final?.toolHistory ?? [],+ finalStatus: final?.status ?? .failedSafe,+ sandbox: sandbox+ )+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalTests.swiftnew file mode 100644index 00000000..dcb264ab--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalTests.swift@@ -0,0 +1,60 @@+import DonkeyAI+import DonkeyContracts+import DonkeyHarness+import Foundation+import Testing++/// Functional evals — run the REAL agent loop with REAL executors against a sandbox, then assert on the+/// files the agent actually produced. Each case is a folder under `Fixtures/FunctionalEval/` (prompt ++/// inputs/generate.sh + expect.json); this one test runs them all. Opt-in behind `DONKEY_FUNCTIONAL_EVAL=1`+/// plus the hosted-backend env, so a plain `swift test` returns early. Run with:+///+/// env DONKEY_FUNCTIONAL_EVAL=1 DONKEY_WEB_BASE_URL=http://localhost:3000 DONKEY_DEV_AUTH_BYPASS=1 \+/// DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \+/// swift test --filter FunctionalEval+///+/// Add a case by dropping a new folder — no Swift change needed.+@Suite+@MainActor+struct FunctionalEvalTests {+ @Test(arguments: FunctionalEvalFixture.all())+ func scenario(_ fixture: FunctionalEvalFixture) async throws {+ guard let config = FunctionalEvalRunner.configFromEnvironment() else { return }++ let sandbox = try fixture.makeSandbox()+ let afterSetup = FunctionalEvalFixture.fileNames(in: sandbox)++ let run = await FunctionalEvalRunner.run(+ prompt: fixture.resolvedPrompt(sandbox: sandbox),+ frontmostApp: fixture.expect.frontmostApp ?? "Finder",+ maxSteps: fixture.expect.maxSteps ?? 24,+ sandbox: sandbox,+ config: config+ )++ // Whatever appeared in the sandbox that wasn't there after setup is what the agent produced.+ let produced = FunctionalEvalFixture.fileNames(in: sandbox)+ .subtracting(afterSetup)+ .map { sandbox.appendingPathComponent($0) }++ print(+ "\n=== functional eval: \(fixture.name) (final: \(String(describing: run.finalStatus))) ===\n"+ + "sandbox: \(sandbox.path)\nproduced: \(produced.map(\.lastPathComponent))\n"+ + "selected skills: \(run.understanding?.relevantSkillIDs ?? [])\n\(run.transcript)\n"+ )++ // Evaluate every check first, so cleanup can depend on whether they all passed.+ let outcomes = (fixture.expect.expectProduced ?? []).map { check in+ FunctionalEvalVerifier.verify(check, producedFiles: produced, sandbox: sandbox)+ }+ for outcome in outcomes {+ #expect(outcome.ok, "[\(fixture.name)] \(outcome.detail)")+ }++ if outcomes.allSatisfy(\.ok) {+ try? FileManager.default.removeItem(at: sandbox)+ } else {+ print("[\(fixture.name)] sandbox kept for inspection: \(sandbox.path)")+ }+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalVerifier.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalVerifier.swiftnew file mode 100644index 00000000..4dad71f0--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/FunctionalEval/FunctionalEvalVerifier.swift@@ -0,0 +1,93 @@+import Foundation++/// Checks a functional run's RESULT by reading the files the agent produced with the same kind of tools a+/// person would — `qpdf` for page counts, `sips` for image size, `ffprobe` for audio, `pdf-fill` for form+/// values, `jq` for JSON. Each check scans the produced files and passes if any one satisfies it, so the+/// assertion is "the agent produced an artifact of the right shape", not "it used a particular file name".+enum FunctionalEvalVerifier {+ struct Outcome {+ var ok: Bool+ var detail: String+ }++ static func verify(_ check: FunctionalEvalCheck, producedFiles: [URL], sandbox: URL) -> Outcome {+ switch check.kind {+ case "pdfPageCount":+ return pdfPageCount(check.pageCount, producedFiles: producedFiles, sandbox: sandbox)+ case "imageWidth":+ return imageWidth(check.width, producedFiles: producedFiles, sandbox: sandbox)+ case "audio":+ return audioPresent(producedFiles: producedFiles, sandbox: sandbox)+ case "pdfFields":+ return pdfFields(check.containsAll ?? [], producedFiles: producedFiles, sandbox: sandbox)+ case "jsonMinRecords":+ return jsonMinRecords(check.minRecords, producedFiles: producedFiles, sandbox: sandbox)+ case "fileExists":+ return fileExists(extension: check.ext, producedFiles: producedFiles)+ default:+ return Outcome(ok: false, detail: "unknown check kind '\(check.kind)'")+ }+ }++ // MARK: - Checks++ private static func pdfPageCount(_ expected: Int?, producedFiles: [URL], sandbox: URL) -> Outcome {+ guard let expected else { return Outcome(ok: false, detail: "pdfPageCount missing `pageCount`") }+ let pdfs = producedFiles.filter { $0.pathExtension.lowercased() == "pdf" }+ let counts = pdfs.map { pdf -> Int in+ Int(ShellHelper.run("qpdf --show-npages \(quoted(pdf))", in: sandbox)) ?? -1+ }+ let ok = counts.contains(expected)+ return Outcome(ok: ok, detail: "expected a produced PDF with \(expected) pages; produced pdf page counts: \(counts)")+ }++ private static func imageWidth(_ expected: Int?, producedFiles: [URL], sandbox: URL) -> Outcome {+ guard let expected else { return Outcome(ok: false, detail: "imageWidth missing `width`") }+ let images = producedFiles.filter { ["png", "jpg", "jpeg", "gif", "tiff", "heic", "webp"].contains($0.pathExtension.lowercased()) }+ let widths = images.map { image -> Int in+ let out = ShellHelper.run("sips -g pixelWidth \(quoted(image)) | awk '/pixelWidth/{print $2}'", in: sandbox)+ return Int(out) ?? -1+ }+ let ok = widths.contains(expected)+ return Outcome(ok: ok, detail: "expected a produced image \(expected)px wide; produced image widths: \(widths)")+ }++ private static func audioPresent(producedFiles: [URL], sandbox: URL) -> Outcome {+ let media = producedFiles.filter { ["mp3", "m4a", "aac", "wav", "flac", "mp4", "mov", "mkv"].contains($0.pathExtension.lowercased()) }+ let withAudio = media.filter { file in+ ShellHelper.run(+ "ffprobe -v error -select_streams a -show_entries stream=codec_type -of csv=p=0 \(quoted(file))",+ in: sandbox+ ).contains("audio")+ }+ return Outcome(ok: !withAudio.isEmpty, detail: "expected a produced file with an audio stream; produced media: \(media.map(\.lastPathComponent))")+ }++ private static func pdfFields(_ groups: [[String]], producedFiles: [URL], sandbox: URL) -> Outcome {+ let pdfs = producedFiles.filter { $0.pathExtension.lowercased() == "pdf" }+ let dump = pdfs.map { ShellHelper.run("pdf-fill list \(quoted($0))", in: sandbox) }.joined(separator: "\n")+ if dump.isEmpty {+ return Outcome(ok: false, detail: "no field values could be read from produced PDFs: \(pdfs.map(\.lastPathComponent))")+ }+ let missing = groups.filter { group in !group.contains { dump.contains($0) } }+ return Outcome(ok: missing.isEmpty, detail: "missing field groups (none of each present): \(missing)")+ }++ private static func jsonMinRecords(_ minRecords: Int?, producedFiles: [URL], sandbox: URL) -> Outcome {+ guard let minRecords else { return Outcome(ok: false, detail: "jsonMinRecords missing `minRecords`") }+ let jsons = producedFiles.filter { $0.pathExtension.lowercased() == "json" }+ let counts = jsons.map { json -> Int in+ Int(ShellHelper.run("jq 'length' \(quoted(json)) 2>/dev/null", in: sandbox)) ?? -1+ }+ let ok = counts.contains { $0 >= minRecords }+ return Outcome(ok: ok, detail: "expected a produced JSON with ≥\(minRecords) records; produced json lengths: \(counts)")+ }++ private static func fileExists(extension ext: String?, producedFiles: [URL]) -> Outcome {+ guard let ext else { return Outcome(ok: false, detail: "fileExists missing `extension`") }+ let matches = producedFiles.filter { $0.pathExtension.lowercased() == ext.lowercased() }+ return Outcome(ok: !matches.isEmpty, detail: "expected a produced .\(ext) file; produced: \(producedFiles.map(\.lastPathComponent))")+ }++ private static func quoted(_ url: URL) -> String { "'\(url.path)'" }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/FixturePromptEvalTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/FixturePromptEvalTests.swiftnew file mode 100644index 00000000..d43588ed--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/FixturePromptEvalTests.swift@@ -0,0 +1,78 @@+import DonkeyAI+import DonkeyContracts+import DonkeyHarness+import Foundation+import Testing++/// Prompt/planner eval — DATA-DRIVEN scenarios. Each case is a folder under `Fixtures/HarnessEval/` holding+/// a `prompt.txt`, a `scenario.json`, and any realistic input data the task operates on (CSVs, form data, a+/// captured web page). The runner is the same as the hand-written category suites; only the scenario source+/// differs. Real model, stubbed system + UI; opt-in exactly like the others — a plain `swift test` returns+/// early. Run with:+///+/// env DONKEY_PROMPT_EVAL=1 DONKEY_WEB_BASE_URL=http://localhost:3000 DONKEY_DEV_AUTH_BYPASS=1 \+/// DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \+/// swift test --filter PromptEval+///+/// Add a scenario by dropping a new folder under `Fixtures/HarnessEval/` — it is discovered automatically;+/// no Swift change needed.+@Suite+@MainActor+struct FixturePromptEvalTests {+ @Test(arguments: HarnessEvalFixture.all())+ func scenario(_ fixture: HarnessEvalFixture) async {+ guard let config = HarnessEvalRunner.configFromEnvironment() else { return }++ let run = await HarnessEvalRunner.run(fixture.scenario(), config: config)+ print(+ "\n=== eval: \(fixture.name) (final: \(String(describing: run.finalStatus))) ===\n"+ + "selected skills: \(run.understanding?.relevantSkillIDs ?? [])\n\(run.transcript)\n"+ )++ assertExpectations(fixture, run)+ }++ /// Assert the fixture's `expect` block against the produced plan. Each clause carries the fixture name so+ /// a failure points straight at the offending folder.+ private func assertExpectations(_ fixture: HarnessEvalFixture, _ run: HarnessEvalRun) {+ guard let expect = fixture.spec.expect else { return }+ let name = fixture.name+ let skills = run.understanding?.relevantSkillIDs ?? []++ if let turnKind = expect.turnKind {+ #expect(+ run.understanding?.turnKind.rawValue == turnKind,+ "[\(name)] turnKind expected \(turnKind), got \(String(describing: run.understanding?.turnKind))"+ )+ }+ for id in expect.skills ?? [] {+ #expect(skills.contains(id), "[\(name)] expected skill \(id); got \(skills)")+ }+ if let any = expect.skillsAny, !any.isEmpty {+ #expect(any.contains(where: skills.contains), "[\(name)] expected any of \(any); got \(skills)")+ }+ for group in expect.shellAll ?? [] {+ #expect(shellMatches(run, group), "[\(name)] expected a shell command matching all of \(group); shells: \(run.shellCommands)")+ }+ if let groups = expect.shellAny, !groups.isEmpty {+ #expect(groups.contains { shellMatches(run, $0) }, "[\(name)] expected a shell command matching any of \(groups); shells: \(run.shellCommands)")+ }+ for tool in expect.used ?? [] {+ #expect(run.used(tool), "[\(name)] expected tool \(tool) used; tools: \(run.toolNames)")+ }+ for tool in expect.notUsed ?? [] {+ #expect(!run.used(tool), "[\(name)] expected tool \(tool) NOT used; tools: \(run.toolNames)")+ }+ if let completed = expect.completed {+ #expect(run.completed == completed, "[\(name)] expected completed=\(completed), got \(run.completed)")+ }+ }++ /// True if some `shell_exec` command contains every substring in `needles` (case-insensitive) — the+ /// array form of `HarnessEvalRun.anyShellMatches`, for `shellAll` / `shellAny` groups.+ private func shellMatches(_ run: HarnessEvalRun, _ needles: [String]) -> Bool {+ run.shellCommands.contains { command in+ needles.allSatisfy { command.range(of: $0, options: .caseInsensitive) != nil }+ }+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/HarnessEvalFixture.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/HarnessEvalFixture.swiftnew file mode 100644index 00000000..7dca418e--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/HarnessEvalFixture.swift@@ -0,0 +1,181 @@+import DonkeyAI+import DonkeyContracts+import DonkeyHarness+import Foundation++/// A prompt-eval scenario stored as data on disk instead of inline Swift, so a scenario is a folder you can+/// read, edit, and fill with realistic inputs — a `prompt.txt`, a `scenario.json`, and any data files the+/// task operates on (a CSV, a form's data, a captured web page). The loader turns each folder into a+/// `HarnessEvalScenario` whose stub serves that real data back to the model as observations; nothing runs+/// and nothing on the Mac is touched, so the data can be as representative as we like.+///+/// Layout (under `Fixtures/HarnessEval/<name>/`, shipped to the test bundle by `.copy("Fixtures")`):+/// - `prompt.txt` — the user's turn (required).+/// - `scenario.json` — frontmost app, step budget, the disk the task sees, scripted tool replies, and+/// the expectations to assert (all optional; see the structs below).+/// - any other files — referenced by `contentFile` / `summaryFile` so a stub can hand back real bytes+/// (e.g. the markdown a `web.fetch` returns, or a data file the plan reads).+///+/// Add a scenario by dropping a new folder in; `FixturePromptEvalTests` discovers and runs it automatically.++/// The disk a scenario's task operates on: files the model can discover and read before it produces+/// anything. `files.describe` lists these, a read command (`cat`, `head`, `lit`, …) of one returns its+/// content, and a discovery command (`find`, `mdfind`, `ls`) returns the paths.+struct HarnessEvalDiskEntry: Decodable, Sendable {+ var path: String+ /// One-line description surfaced by `files.describe`. Defaults to a generic "file" when omitted.+ var describe: String?+ /// A sibling file in the fixture folder whose bytes are returned when the plan reads `path`.+ var contentFile: String?+ /// Inline content returned when the plan reads `path` (takes precedence over `contentFile`).+ var content: String?++ func resolvedContent(in dir: URL) -> String? {+ if let content { return content }+ guard let contentFile else { return nil }+ return try? String(contentsOf: dir.appendingPathComponent(contentFile), encoding: .utf8)+ }+}++/// A scripted reply for a tool call, matched in order — the first rule whose `tool` and `contains` match+/// wins. `tool` nil matches any tool; `contains` matches the shell command (for `shell_exec`) or any input+/// value (for other tools), case-insensitively. The reply's summary is `summary`, or the bytes of+/// `summaryFile` (e.g. the page a `web.fetch` returns); `produces` marks files now existing so later steps+/// see them, and `status: "failed"` drives the recovery path.+struct HarnessEvalResponseRule: Decodable, Sendable {+ var tool: String?+ var contains: [String]?+ var summary: String?+ var summaryFile: String?+ var facts: [String: String]?+ var produces: [String]?+ var status: String?++ func matches(_ call: HarnessToolCall) -> Bool {+ if let tool, tool != call.name { return false }+ guard let contains, !contains.isEmpty else { return true }+ let haystack = call.name == "shell_exec"+ ? (call.input["command"] ?? "")+ : call.input.values.joined(separator: " ")+ return contains.allSatisfy { haystack.range(of: $0, options: .caseInsensitive) != nil }+ }++ func stub(in dir: URL) -> HarnessEvalStub {+ let body = summaryFile+ .flatMap { try? String(contentsOf: dir.appendingPathComponent($0), encoding: .utf8) }+ ?? summary+ ?? "ran."+ if status == "failed" { return .failed(body) }+ var resolved = facts ?? [:]+ for file in produces ?? [] { resolved[file] = "exists" }+ return .ok(body, facts: resolved)+ }+}++/// What the produced plan should look like — every field optional, so a scenario asserts only what is+/// meaningful and deterministic for it (turn kind and skill surfacing land reliably; deep-pipeline tails do+/// not). Mirrors the assertions the hand-written category tests make, expressed as data.+struct HarnessEvalExpect: Decodable, Sendable {+ /// "act" | "converse" | "clarify".+ var turnKind: String?+ /// Skill IDs that must all be surfaced.+ var skills: [String]?+ /// Skill IDs of which at least one must be surfaced.+ var skillsAny: [String]?+ /// Each inner group: a single shell command containing all of its substrings must exist.+ var shellAll: [[String]]?+ /// At least one inner group must be satisfied by some shell command.+ var shellAny: [[String]]?+ var used: [String]?+ var notUsed: [String]?+ var completed: Bool?+}++/// The decoded `scenario.json`. Every field is optional with a sensible default so a folder needs nothing+/// beyond `prompt.txt` to run.+struct HarnessEvalScenarioSpec: Decodable, Sendable {+ var frontmostApp: String?+ var maxSteps: Int?+ var disk: [HarnessEvalDiskEntry]?+ var responses: [HarnessEvalResponseRule]?+ var expect: HarnessEvalExpect?++ init() {}+}++/// One loaded fixture: its folder name, the prompt, the decoded spec, and the directory to resolve data+/// files against. `Sendable` and `CustomTestStringConvertible` so it can drive a parameterized `@Test`.+struct HarnessEvalFixture: Sendable, CustomStringConvertible {+ var name: String+ var prompt: String+ var spec: HarnessEvalScenarioSpec+ var dir: URL++ var description: String { name }++ /// Every fixture folder under `Fixtures/HarnessEval/`, sorted by name. Empty when the resource bundle is+ /// absent — the parameterized test then simply has no cases.+ static func all() -> [HarnessEvalFixture] {+ guard let root = Bundle.module.resourceURL?.appendingPathComponent("Fixtures/HarnessEval") else {+ return []+ }+ let dirs = (try? FileManager.default.contentsOfDirectory(+ at: root,+ includingPropertiesForKeys: [.isDirectoryKey]+ )) ?? []+ return dirs.compactMap(load).sorted { $0.name < $1.name }+ }++ private static func load(_ dir: URL) -> HarnessEvalFixture? {+ var isDir: ObjCBool = false+ guard FileManager.default.fileExists(atPath: dir.path, isDirectory: &isDir), isDir.boolValue else {+ return nil+ }+ guard let rawPrompt = try? String(contentsOf: dir.appendingPathComponent("prompt.txt"), encoding: .utf8) else {+ return nil+ }+ let spec = (try? Data(contentsOf: dir.appendingPathComponent("scenario.json")))+ .flatMap { try? JSONDecoder().decode(HarnessEvalScenarioSpec.self, from: $0) }+ ?? HarnessEvalScenarioSpec()+ return HarnessEvalFixture(+ name: dir.lastPathComponent,+ prompt: rawPrompt.trimmingCharacters(in: .whitespacesAndNewlines),+ spec: spec,+ dir: dir+ )+ }++ /// Build the runnable scenario. The stub serves, in order: a matching scripted response, the disk for+ /// `files.describe`, real file content for a read command, and the disk paths for a discovery command —+ /// then falls back to the runner's generic default.+ func scenario() -> HarnessEvalScenario {+ let dir = self.dir+ let disk = spec.disk ?? []+ let responses = spec.responses ?? []+ return HarnessEvalScenario(+ name: name,+ prompt: prompt,+ frontmostApp: spec.frontmostApp ?? "Finder",+ maxSteps: spec.maxSteps ?? 16+ ) { call in+ if let rule = responses.first(where: { $0.matches(call) }) {+ return rule.stub(in: dir)+ }+ if call.name == "files.describe", !disk.isEmpty {+ return .ok(disk.map { "\($0.path) — \($0.describe ?? "file")" }.joined(separator: "; "))+ }+ guard call.name == "shell_exec", let command = call.input["command"] else { return nil }+ let lower = command.lowercased()+ if lower.range(of: "(^| )(cat|head|tail|less|open|lit|pdftotext)( |$)", options: .regularExpression) != nil {+ for entry in disk where command.contains(entry.path) || command.contains((entry.path as NSString).lastPathComponent) {+ if let content = entry.resolvedContent(in: dir) { return .ok(content) }+ }+ }+ if !disk.isEmpty,+ lower.range(of: "(^| )(find|mdfind|ls|stat)( |$)", options: .regularExpression) != nil {+ return .ok(disk.map(\.path).joined(separator: "\n"))+ }+ return nil+ }+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEvalRunner.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/HarnessPromptEvalRunner.swiftsimilarity index 79%rename from apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEvalRunner.swiftrename to apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/HarnessPromptEvalRunner.swiftindex 9db82a4d..1bd68609 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEvalRunner.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEval/HarnessPromptEvalRunner.swift@@ -20,10 +20,11 @@ import Foundation////// env DONKEY_PROMPT_EVAL=1 DONKEY_WEB_BASE_URL=http://localhost:3000 DONKEY_DEV_AUTH_BYPASS=1 \/// DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \-/// swift test --filter HarnessPromptEvalTests+/// swift test --filter PromptEval///-/// Add a scenario by constructing another `HarnessEvalScenario` (see `HarnessPromptEvalTests`); the-/// runner is generic over the prompt and the scripted replies.+/// This file is the shared engine for the `HarnessPromptEval/` folder. Add a category by dropping a new+/// `<Category>PromptEvalTests.swift` beside it with its own `@Suite` and one `@Test` per scenario, each+/// building a `HarnessEvalScenario`; the runner is generic over the prompt and the scripted replies./// A scripted reply a stubbed tool hands back to the planner. The system is stubbed, so a tool never/// touches the real Mac — it returns the observation the scenario wants the model to see next.@@ -149,16 +150,29 @@ enum HarnessEvalRunner {configuration.conversationID = conversationIDlet backend = DonkeyBackendInferenceClient(configuration: configuration)- // Real one-shot understanding of the turn (turnKind, restated goal, target app, parameters).+ // Real one-shot understanding of the turn (turnKind, restated goal, target app, parameters, and the+ // skills it should follow). Feed it the same skill catalog production does so it can pick.+ let skillCatalog = BuiltInLocalAppSkillPacks.skillSelectionCatalog()let understanding = await HostedHarnessRequestUnderstanding(backend: backend)- .understand(command: scenario.prompt, frontmostAppName: scenario.frontmostApp)+ .understand(+ command: scenario.prompt,+ frontmostAppName: scenario.frontmostApp,+ skillCatalog: skillCatalog+ )++ // Preload the guides for the skills the understanding picked — mirrors production so the eval tests+ // the real surfacing path, not a stub of it.+ let preloadedSkillGuides: [String] = (understanding?.relevantSkillIDs ?? [])+ .prefix(2)+ .compactMap { BuiltInLocalAppSkillPacks.skillGuidance(forID: $0) }// Real tool surface; stub executors so the planner sees the true descriptors but nothing executes.let descriptors = BuiltInHarnessToolCatalog.descriptorslet respond = scenario.respondlet tools = descriptors.map { descriptor inHarnessTool(descriptor: descriptor) { context in- let reply = respond(context.call) ?? defaultReply(for: context.call)+ let knownFiles = context.worldModel.facts.compactMap { $0.value == "exists" ? $0.key : nil }.sorted()+ let reply = respond(context.call) ?? defaultReply(for: context.call, knownFiles: knownFiles)return HarnessToolResult(callID: context.call.id,toolName: context.call.name,@@ -184,7 +198,8 @@ enum HarnessEvalRunner {descriptors: descriptors,appName: understanding?.targetAppName ?? "",appGuidance: nil,- understanding: understanding+ understanding: understanding,+ preloadedSkillGuides: preloadedSkillGuides)let runtime = GenericHarnessRuntime(coordinator: coordinator, registry: registry)@@ -201,7 +216,7 @@ enum HarnessEvalRunner {/// Default stubbed reply when a scenario does not script the call. Skill lookups get the REAL built-in/// `SKILL.md` (so the eval exercises the same guidance the planner reads in production), and everything/// else gets a generic success carrying a fact so the step counts as progress and the loop advances.- private static func defaultReply(for call: HarnessToolCall) -> HarnessEvalStub {+ private static func defaultReply(for call: HarnessToolCall, knownFiles: [String]) -> HarnessEvalStub {switch call.name {case "skill.search":return .ok(@@ -215,11 +230,30 @@ enum HarnessEvalRunner {return .ok(content, facts: ["skill.loaded": id])}return .ok("Loaded.", facts: ["skill.loaded": id])+ case "files.describe":+ let listing = knownFiles.isEmpty+ ? "The directory is empty."+ : knownFiles.map { "\($0) — present" }.joined(separator: "; ")+ return .ok(listing)default:+ // A read-only discovery/verify command (find, ls, stat, ffprobe…) is the model confirming an+ // output it just produced. Report the files prior steps created so it can move on, instead of+ // a blank "ran" that sends it re-searching until the duplicate-call guard fails the run.+ if let command = call.input["command"], isFileProbe(command) {+ return .ok(knownFiles.isEmpty ? "(no matching files)" : knownFiles.joined(separator: "\n"))+ }return .ok("\(call.name) ran.", facts: ["lastStub": call.name])}}+ /// True for a read-only command whose job is to look at the filesystem — so the stub answers with the+ /// known files rather than a content-free success.+ private static func isFileProbe(_ command: String) -> Bool {+ let lowered = command.lowercased()+ let probes = ["find ", "ls ", "ls\n", "stat ", "test ", "file ", "ffprobe", "du ", "wc ", "realpath", "pwd"]+ return lowered == "ls" || probes.contains { lowered.contains($0) }+ }+/// Best-effort load of a built-in `SKILL.md` from the DonkeyRuntime resource bundle by a loose id/// match, so the planner sees the real media/pdf/system-tools guidance. Returns nil for an unknown id.private static func builtInSkill(matching id: String) -> String? {diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEvalTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEvalTests.swiftdeleted file mode 100644index d472f2a6..00000000--- a/apps/Donkey/Tests/DonkeyRuntimeTests/HarnessPromptEvalTests.swift+++ /dev/null@@ -1,112 +0,0 @@-import DonkeyAI-import DonkeyContracts-import DonkeyHarness-import Foundation-import Testing--/// Live prompt/planner evals: real model, stubbed system + UI, asserting on the plan the model produces.-/// Opt-in (see `HarnessEvalRunner.configFromEnvironment`); a plain `swift test` returns early. Each test is-/// a scenario — add more by following the same shape.-@Suite-@MainActor-struct HarnessPromptEvalTests {- @Test- func clipsYouTubeAndOverlaysAKoreanTranslation() async {- guard let config = HarnessEvalRunner.configFromEnvironment() else { return }-- let scenario = HarnessEvalScenario(- name: "korean-clip-overlay",- prompt: """- create a 1min clip of this and overlay the korean translation onto the video- https://www.youtube.com/watch?v=v8u_7PPEzZE. start at the 15min point- """,- frontmostApp: "Safari"- ) { call in- // Data stubs: hand the model believable results so it walks the whole download → translate →- // burn-in flow without touching the network or disk.- if call.name == "llm.generate" {- return .ok("Wrote subs.srt (Korean subtitles with timestamps).", facts: ["subs.srt": "exists"])- }- guard call.name == "shell_exec", let command = call.input["command"] else { return nil }- if command.contains("yt-dlp") {- return .ok("[download] 100% — clip.mp4 written (00:01:00, 1920x1080).", facts: ["clip.mp4": "exists"])- }- if command.contains("ffprobe") {- return .ok("duration=60.000000\nformat_name=mov,mp4,m4a,3gp,3g2,mj2")- }- if command.contains("ffmpeg"), command.range(of: "subtitles", options: .caseInsensitive) != nil {- return .ok("out.mp4 written with burned-in Korean subtitles.", facts: ["out.mp4": "exists"])- }- if command.contains("ffmpeg") {- return .ok("ffmpeg: wrote output.")- }- return nil- }-- let run = await HarnessEvalRunner.run(scenario, config: config)- print("\n=== eval: \(scenario.name) (final: \(String(describing: run.finalStatus))) ===\n\(run.transcript)\n")-- // It is an action turn, and the plan downloads with yt-dlp and burns subtitles in with ffmpeg.- #expect(run.understanding?.turnKind == .act)- #expect(run.anyShellMatches("yt-dlp"), "expected a yt-dlp download; shell calls: \(run.shellCommands)")- #expect(- run.anyShellMatches("ffmpeg", "subtitles"),- "expected an ffmpeg subtitle burn-in; shell calls: \(run.shellCommands)"- )- // The translation comes from the model (llm.generate) or from yt-dlp's own subtitle download.- #expect(- run.used("llm.generate") || run.anyShellMatches("yt-dlp", "sub"),- "expected a translation/transcription step; tools: \(run.toolNames)"- )- }-- @Test- func fillsF1120FromADataFile() async {- guard let config = HarnessEvalRunner.configFromEnvironment() else { return }-- let scenario = HarnessEvalScenario(- name: "fill-f1120-pdf",- prompt: "fill out f1120.pdf using 1120data.txt",- frontmostApp: "Finder"- ) { call in- // Data stubs: describe the form and the data so the model can plan the fill without real files.- if call.name == "files.describe" {- return .ok(- "f1120.pdf — AcroForm PDF, 6 pages, 48 fillable fields (text and checkbox). "- + "1120data.txt — UTF-8 text, 32 `key: value` lines."- )- }- guard call.name == "shell_exec", let command = call.input["command"] else { return nil }- // Discovery: the model usually locates the named files first. Tell it where they are so it can- // proceed to read + fill, instead of repeating the search.- if command.contains("find ") || command.hasPrefix("ls") || command.contains("mdfind") {- return .ok("./f1120.pdf\n./1120data.txt", facts: ["found": "f1120.pdf,1120data.txt"])- }- if command.contains("1120data.txt"), command.range(of: "cat|head|lit|read", options: .regularExpression) != nil {- return .ok("name: ACME Corp\nein: 12-3456789\ntax_year: 2025\ntotal_income: 1000000")- }- if command.contains("pdf-fill"), command.range(of: "describe|fields|--read|inspect", options: .regularExpression) != nil {- return .ok(#"{"type":"acroform","fields":[{"name":"f1_01","type":"text"},{"name":"c1_1","type":"checkbox"}]}"#)- }- if command.contains("pdf-fill") {- return .ok("Wrote f1120-filled.pdf (48 fields set).", facts: ["f1120-filled.pdf": "exists"])- }- return nil- }-- let run = await HarnessEvalRunner.run(scenario, config: config)- print("\n=== eval: \(scenario.name) (final: \(String(describing: run.finalStatus))) ===\n\(run.transcript)\n")-- #expect(run.understanding?.turnKind == .act)- // It reads the source data (cat/inspect the txt or describe it) before filling.- #expect(- run.used("files.describe") || run.shellCommands.contains { $0.contains("1120data.txt") },- "expected it to read the data file; shell calls: \(run.shellCommands)"- )- // It fills with the bundled form tool, not by driving a PDF GUI.- #expect(- run.anyShellMatches("pdf-fill") || run.anyShellMatches("lit"),- "expected a pdf-fill/lit fill step; shell calls: \(run.shellCommands)"- )- }-}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/HostedHarnessStepPlannerTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/HostedHarnessStepPlannerTests.swiftindex 4374f7cf..a3343428 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/HostedHarnessStepPlannerTests.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/HostedHarnessStepPlannerTests.swift@@ -278,6 +278,32 @@ struct HostedHarnessStepPlannerTests {#expect(!body.contains("thinking_budget"))}+ @Test+ func stepNarrationKeepsFullLineForConversationSubtext() async {+ let longNarration = "I'll check the Downloads folder to see what files we have for the YouTube clip and subtitle assets before deciding the next command."+ let planner = makePlanner(+ httpClient: FixtureHTTPClient(+ data: Data(#"{"output_text":"{\"tool\":\"ax.observe\",\"narration\":\"\#(longNarration)\"}"}"#.utf8),+ statusCode: 200+ ),+ understanding: nil+ )+ let step = HarnessStepExecutionResult(+ task: task(goal: "create a subtitled clip", toolHistory: []),+ toolResult: HarnessToolResult(+ callID: "call-1",+ toolName: "ax.observe",+ status: .succeeded,+ summary: "fallback"+ )+ )++ _ = await planner.planNextStep(for: task(goal: "create a subtitled clip", toolHistory: []))+ let narration = UserQueryCommandHandler.stepNarration(for: step, planner: planner)++ #expect(narration == longNarration)+ }+@Testfunc retriesOnceWhenChosenToolMissesAllRequiredInput() async {// The exact loop the user hit: the model chose shell_exec with NO command (its required input),