diff --git a/APPLY-AND-PUSH.bat b/APPLY-AND-PUSH.bat new file mode 100644 index 0000000000000000000000000000000000000000..f72145b802c6c86f6ada628efe10559ba639ba6b --- /dev/null +++ b/APPLY-AND-PUSH.bat @@ -0,0 +1,17 @@ +cd /d "%~dp0" +@echo off +( +echo ===== APPLY ===== +powershell -NoProfile -Command "Expand-Archive -LiteralPath distinct-update.zip -DestinationPath . -Force" +echo EXPAND_EXIT=%ERRORLEVEL% +git lfs install --local +git lfs track "*.gif" +git lfs track "*.webp" +git add -A +git -c user.name=User1342 -c user.email=User1342@users.noreply.huggingface.co commit -m "Library as its own page; cards show what each member makes; Anthropic-calm palette; artifact previews in answers" +echo COMMIT_EXIT=%ERRORLEVEL% +git push origin main +echo PUSH_EXIT=%ERRORLEVEL% +git log --oneline -1 +git ls-remote origin main +) >> push-log6.txt 2>&1 diff --git a/assets/library-demos/academy_guide-1.gif b/assets/library-demos/academy_guide-1.gif index 51ad32fb8a46632ee110d1b5796fd1904f7629f0..64f5ef6fc1d7f3454b1f4bdba749b91254547eda 100644 --- a/assets/library-demos/academy_guide-1.gif +++ b/assets/library-demos/academy_guide-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7581db4887795b4376d8bcaba304403a05335dceffa67020ebcdc9a9a3e1d7b -size 131294 +oid sha256:f7b8b9b58839c535ed845c92370af525d9fbb9baf725489dbaa311a5a0234cd4 +size 90445 diff --git a/assets/library-demos/academy_guide-1.webp b/assets/library-demos/academy_guide-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..bb64003b9386f3aa347470272bb09ca8799dab19 --- /dev/null +++ b/assets/library-demos/academy_guide-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82080fe65ae6385d14a510b0de3a5e7152ec42277b6b7ead1854a3050172c4fb +size 21274 diff --git a/assets/library-demos/algorithmic_art-1.gif b/assets/library-demos/algorithmic_art-1.gif index 0e19cfd11d5fd12daa06d2eba74a62159fec7ed3..932bc9bccc53b9933f473815d303bacf11915e51 100644 --- a/assets/library-demos/algorithmic_art-1.gif +++ b/assets/library-demos/algorithmic_art-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24e948eb23740a9cd7690a6a0176918b7223deeded1cbc91a52f35550edbaa55 -size 133562 +oid sha256:0b6402435472af80c6a46ec98d5225fb37ed301b6ab9f2b29bd26fbbb115f904 +size 124661 diff --git a/assets/library-demos/algorithmic_art-1.webp b/assets/library-demos/algorithmic_art-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..4e56701fd2ce46dfddfa0dd6d257226e7d2e616a --- /dev/null +++ b/assets/library-demos/algorithmic_art-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab2f0738377734c8f8e59e7eda6514d73111c3d56d16b0623bb486bd930a2b72 +size 20958 diff --git a/assets/library-demos/brand_guidelines-1.gif b/assets/library-demos/brand_guidelines-1.gif index f1ec67e216a1364f707cc818837b443fe7159668..c01395aa7a7fca54f8bcb0be2a107acbe53bfe38 100644 --- a/assets/library-demos/brand_guidelines-1.gif +++ b/assets/library-demos/brand_guidelines-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b92458e28f5a7aeb240f12f753869fee5c3c37de187eb62e0ede6dc3afa91a0 -size 168926 +oid sha256:e71800aa51a67ccbac19113728f90048b14cbb5fe847bac9f3c893c7f78d31f1 +size 115005 diff --git a/assets/library-demos/brand_guidelines-1.webp b/assets/library-demos/brand_guidelines-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..e78dbfe968ebcc4bd57d3cf67da6d6d3c52da333 --- /dev/null +++ b/assets/library-demos/brand_guidelines-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e45cdad8e194ed0cecb8c79010e665ce9dd353a4cc6397be1ec2b599d0b4c5d4 +size 21224 diff --git a/assets/library-demos/canvas_design-1.gif b/assets/library-demos/canvas_design-1.gif index 4cd1ac9e244d6ef768d4e04c4a6e22a2b7184f2a..a82ea81b5d58ce4db809d1602769464a99313641 100644 --- a/assets/library-demos/canvas_design-1.gif +++ b/assets/library-demos/canvas_design-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a660604fce9e8c84c25a5d96e7b75698e65c6e6ace781e4ab1e4a5bbcb9a80a -size 138166 +oid sha256:6f9af576a25d840bb43ad3477423ab6166f4ad2cda83b135ce3453611186dc9e +size 111736 diff --git a/assets/library-demos/canvas_design-1.webp b/assets/library-demos/canvas_design-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..194c24f74b535e20bd45ee7cb9ee1e8a7a284fc2 --- /dev/null +++ b/assets/library-demos/canvas_design-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de62403c2e78ae0ea914eaf3dc2764e9d88178a993ad4c0c34ab24a925d514d0 +size 18234 diff --git a/assets/library-demos/claude_api-1.gif b/assets/library-demos/claude_api-1.gif index c0e71f1e6493ec998ed3d2312783c0879f80594b..3bb5fe5814f027e092a7bbaafc4edafb228ca28b 100644 --- a/assets/library-demos/claude_api-1.gif +++ b/assets/library-demos/claude_api-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2ca63522dbecadd19d8388f5724b780807ce01fba702d5a8d4a9058e02f4e6f -size 181396 +oid sha256:b3042a2895d944c91279f20d2ea609de99c9cf1cb34a721718c2d18658129256 +size 115312 diff --git a/assets/library-demos/claude_api-1.webp b/assets/library-demos/claude_api-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..1a9d5fc08661d8718f94c807de03f8d5234c41b3 --- /dev/null +++ b/assets/library-demos/claude_api-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4012a926acd5a57cb878bf51897aac01719e1999c2181925db0c01cba47adea0 +size 21938 diff --git a/assets/library-demos/create_deck-1.gif b/assets/library-demos/create_deck-1.gif index c9779f25b7af2ce7c7370902e62d47e921fdc57e..14ba3abdbb9ec5b779662e3d2ce61721b4d0e6c2 100644 --- a/assets/library-demos/create_deck-1.gif +++ b/assets/library-demos/create_deck-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2902674f868d902a4a98700ffbb2db616d84ddae0ca509b237b336a98daad504 -size 135321 +oid sha256:23b29e3f009fb409031418d92292d83f50f9a578d41479860f31c8db7430a4a2 +size 68674 diff --git a/assets/library-demos/create_deck-1.webp b/assets/library-demos/create_deck-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..70a46cf12759b9eb2cd072889f122f9cb1a40ebc --- /dev/null +++ b/assets/library-demos/create_deck-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e28f20549d198317ddf12e878e9aa3339774bab4da590f8abb77df91f81f5aaa +size 5638 diff --git a/assets/library-demos/create_docx-1.gif b/assets/library-demos/create_docx-1.gif index 91a928780a5d3ab518c14c43d3e5166dc6b1c383..62ab54a37b72a27a635a71a76a2ad8503528465e 100644 --- a/assets/library-demos/create_docx-1.gif +++ b/assets/library-demos/create_docx-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c558b81576b98aca28e913552f3f441b15580a46a557ddeee603160948ce846 -size 150972 +oid sha256:f79068f86deb34d02cf7e8c5228b5515c38a91055d6315d7da876892f39577b3 +size 80409 diff --git a/assets/library-demos/create_docx-1.webp b/assets/library-demos/create_docx-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..0f32d4f47ef5cd731699499570d1627d1cbc537f --- /dev/null +++ b/assets/library-demos/create_docx-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec773cfe779ddc84113fc96152fd644ad9d5f081da3a28c0d0abdec88b17925e +size 8070 diff --git a/assets/library-demos/create_pdf-1.gif b/assets/library-demos/create_pdf-1.gif index b41ee7e32229c29836e00005c76bba3a44e72ce7..6cf8a0d098dc1b2e87a2c6b8356149e04448a291 100644 --- a/assets/library-demos/create_pdf-1.gif +++ b/assets/library-demos/create_pdf-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ae39a352baddd190fb4334d3afe6a4c03e5de9e22adf05479244874ddc2036e4 -size 144619 +oid sha256:e50294206ddbca9ffd0dcf194dd6ee802caf1d2c419127f01e7cccc7f9813c21 +size 87966 diff --git a/assets/library-demos/create_pdf-1.webp b/assets/library-demos/create_pdf-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..7107b66d0976046351f81fce2040e16f3aaaf24e --- /dev/null +++ b/assets/library-demos/create_pdf-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5adf90bbecae8e930bf559f2d5ff066fc6ffae3af68f86c3c79ffd0417b4e2c3 +size 10402 diff --git a/assets/library-demos/create_xlsx-1.gif b/assets/library-demos/create_xlsx-1.gif index 0c42452ca5473f22b9522962f5a81d37f36dacaf..3913e90a2219b39f9ba16aa41435ecc0cdd9587e 100644 --- a/assets/library-demos/create_xlsx-1.gif +++ b/assets/library-demos/create_xlsx-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ab1c433d970104069aeca9a50d26b849f55ab27a213fe19e799e7679e3c6fb5 -size 144470 +oid sha256:10786266bc1cafef302bf156977d78e21a1b00f2687320fd334c8a0f3c94ce74 +size 86244 diff --git a/assets/library-demos/create_xlsx-1.webp b/assets/library-demos/create_xlsx-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..857a2c40bca62e1a1b99f4713c9aef7b9254902f --- /dev/null +++ b/assets/library-demos/create_xlsx-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a8ceaf23219b1715a00f6cd7cf6dfa070640226a7cb3632d54acc46e98de75d +size 7696 diff --git a/assets/library-demos/csv_table-1.gif b/assets/library-demos/csv_table-1.gif index 1209d9a8096822a2f17027361902651fedd86733..cb71cb17c1ea6f5a50e54f9137c58b630dd94757 100644 --- a/assets/library-demos/csv_table-1.gif +++ b/assets/library-demos/csv_table-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bdab202b76de062b9823051efbe93c52f7efb88e2c44ac71e05c1ffcdef76bb2 -size 161577 +oid sha256:8b4962a4f78d9fd23f898c01b1580afef1b46c9b55d5be558b3fe678348c5d8b +size 61967 diff --git a/assets/library-demos/csv_table-1.webp b/assets/library-demos/csv_table-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e8584e5c68cf357a80b7899dd45088d796a8785 --- /dev/null +++ b/assets/library-demos/csv_table-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd67791a142b1e932d4c4d2245f4233de1f68d2263835dc1e97b5f9be73194dd +size 6748 diff --git a/assets/library-demos/discernment_nudge-1.gif b/assets/library-demos/discernment_nudge-1.gif index 2614f4477bf138f3d7c6e03ba113ae90f8d56037..1d03d7d35e0f57dce0d0d125c8ba9936454d4714 100644 --- a/assets/library-demos/discernment_nudge-1.gif +++ b/assets/library-demos/discernment_nudge-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a5d5fc150d2d405d5ac77b89cdae61b8e5a6f48f65bed92f84c3c141ceb53342 -size 196195 +oid sha256:254e810eb3817945fa95f09a8502e4e110b898190f5b1594ff59646ac6ab4ead +size 109804 diff --git a/assets/library-demos/discernment_nudge-1.webp b/assets/library-demos/discernment_nudge-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..cc3a567f4fb28fcb1eb79f5c68969f0e7a9d5b4b --- /dev/null +++ b/assets/library-demos/discernment_nudge-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b357f4dcc21c9a405807d9fef3c9adca9f42d4a229bcf25e36adec225bb734cc +size 21210 diff --git a/assets/library-demos/frontend_design-1.gif b/assets/library-demos/frontend_design-1.gif index 4c5868260ce13f68fc45bcd2350c80e042b38bea..504b1887c0da1c0c68ec1542a5fb8eee203b7676 100644 --- a/assets/library-demos/frontend_design-1.gif +++ b/assets/library-demos/frontend_design-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:64b742dbd12476e11be711c461ccf0a624d9c033d0320889ec5be7e4da7980d1 -size 150976 +oid sha256:3797dccb5e149355dfff3a56f6d8b50d0cd06744fd3bc14e4e903eb9cf29049c +size 135864 diff --git a/assets/library-demos/frontend_design-1.webp b/assets/library-demos/frontend_design-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..eef72764bc52bfaf6c3e5ce5f9579afcb34741ab --- /dev/null +++ b/assets/library-demos/frontend_design-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cdfdc9aa099348b4bf6a0f8e9f7d05f2b5c223f550b0acdb9245ab335a73278 +size 32812 diff --git a/assets/library-demos/make_plan-1.gif b/assets/library-demos/make_plan-1.gif index 23cef170e0fe9799765dc5f86935723118a4d15d..671dabecaa13fd27577fa739803ff7f166bbf806 100644 --- a/assets/library-demos/make_plan-1.gif +++ b/assets/library-demos/make_plan-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7dbcf416da1c6b49034fcfab2e9c8ec4d86166d6a1fc09e7a2161a456f83db9d -size 169867 +oid sha256:27db0e2a367fc92148dd4071bf468cf4ee0f8ff3bc3432741031dfeee999c73c +size 108106 diff --git a/assets/library-demos/make_plan-1.webp b/assets/library-demos/make_plan-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..79709738779a8d772e5d9e5f5835276614c058a3 --- /dev/null +++ b/assets/library-demos/make_plan-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1cbc4842ce3481ac01ff642e3ea312083a55f3f682c52e76d30436e7f7a3eacb +size 9266 diff --git a/assets/library-demos/mcp_builder-1.gif b/assets/library-demos/mcp_builder-1.gif index 61ebc71dc9ba9ef5dca11f4d07e9394fd3e77660..ac8fac8ae76ca7919f4135f44f28e3f20bd8a591 100644 --- a/assets/library-demos/mcp_builder-1.gif +++ b/assets/library-demos/mcp_builder-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e5ba79a1825fcf96898da76fab8aafd47827a90e74cab97e82beac37e4c7579 -size 200515 +oid sha256:f21732700f5f69495bd38d34e926cf231003493bc51064c7fdfa082aa0b7e88a +size 81143 diff --git a/assets/library-demos/mcp_builder-1.webp b/assets/library-demos/mcp_builder-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..e7d2bfad46463ce2cebd4b8daad2676e10ace7dd --- /dev/null +++ b/assets/library-demos/mcp_builder-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:874c55caf4d8ee1814afbd66083bef507a14b15ccbbd88a6cc418db33b0e3bc8 +size 19396 diff --git a/assets/library-demos/review_checklist-1.gif b/assets/library-demos/review_checklist-1.gif index 4adc956017232951c294dd15615fd718319c0689..79717dc5732754b65f93b5d57dff8c9d7945b59d 100644 --- a/assets/library-demos/review_checklist-1.gif +++ b/assets/library-demos/review_checklist-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c263afc4154698eec30f16ee621304b783cfc3451db346cb4ae6a59970cb8f8 -size 201436 +oid sha256:1ccd7e1d9c5d1482009992578a8e6c5d8db517c53e62d102290e4eadefbddb89 +size 120396 diff --git a/assets/library-demos/review_checklist-1.webp b/assets/library-demos/review_checklist-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..f87c481d7be6b48b47f44a438804e1994b52e8c0 --- /dev/null +++ b/assets/library-demos/review_checklist-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2af80caf9c787efdceebd849d3d1a36aa87af753a2c50aa66cc94f09599fd4c7 +size 21830 diff --git a/assets/library-demos/skill_scaffold-1.gif b/assets/library-demos/skill_scaffold-1.gif index 43270518d0edcb9023d425f299ab340f70c9bbaa..17721020e89c6281e0f3bcf0e063ac26453b0be0 100644 --- a/assets/library-demos/skill_scaffold-1.gif +++ b/assets/library-demos/skill_scaffold-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:73e61434456717ab60604722e2b5424cc69c17a0d1ac449fb4678be4b9a5b2a0 -size 155854 +oid sha256:0902e9fcca3d231cc81528919fccbd656c38c768e86fd7a1ddcd41c60bba307c +size 108233 diff --git a/assets/library-demos/skill_scaffold-1.webp b/assets/library-demos/skill_scaffold-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..6238d7443ec38d71570f11f3c86ebce919b53b09 --- /dev/null +++ b/assets/library-demos/skill_scaffold-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f47dbf3ff56eea681c17e3a93679197ee1e72fc884e5c57bea206b612a1958b +size 11524 diff --git a/assets/library-demos/slack_gif_creator-1.gif b/assets/library-demos/slack_gif_creator-1.gif index 3ac9596b1d5ae85fd19704c8e6c87e7d37f452b9..e20583599d21feac65eede366677ff96bc84450e 100644 --- a/assets/library-demos/slack_gif_creator-1.gif +++ b/assets/library-demos/slack_gif_creator-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97931b56d97ce6c9a0fc833f3c087c3a5929ff8a41a2d25e031f84a09ab3b35d -size 153515 +oid sha256:8aace9eff595a3c0f074634b0b683042465fc6d7c1561da34c24f82c1f1f7052 +size 113929 diff --git a/assets/library-demos/slack_gif_creator-1.webp b/assets/library-demos/slack_gif_creator-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..d57d2c26e9eccf3ccf9abb863203b3f933f42993 --- /dev/null +++ b/assets/library-demos/slack_gif_creator-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdeef3b8919635c984c414364cfe06cf83a86dc636222413ebe16776d3b532e0 +size 21536 diff --git a/assets/library-demos/status_update-1.gif b/assets/library-demos/status_update-1.gif index eea03e6611b3e9fcb3adcc258dc86cfb18f96eb7..e54994d6ea3907aa4d92ee1f79e3965aacd80ee6 100644 --- a/assets/library-demos/status_update-1.gif +++ b/assets/library-demos/status_update-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09c8214372ba172b41d55d17d7095fc0fd6216c67cc864dff8c73f2fbd6259fa -size 198517 +oid sha256:f4ca8f05752e8169b14c8c98fc856a1f97a1841a03e45231d8b6ae454ddb260a +size 81442 diff --git a/assets/library-demos/status_update-1.webp b/assets/library-demos/status_update-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..4ad91f3ccef82c6dc71f74a5b1be2b95e6cd0774 --- /dev/null +++ b/assets/library-demos/status_update-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69c5386dcc5f77fe1364e281b556503c1c099f5973af4e13563c4d629edffe73 +size 16192 diff --git a/assets/library-demos/theme_factory-1.gif b/assets/library-demos/theme_factory-1.gif index 6ae27f693c5d83542802a668746c7cde363aad68..7f29b38c217e8aab66bf9b0f40793053ea6fe979 100644 --- a/assets/library-demos/theme_factory-1.gif +++ b/assets/library-demos/theme_factory-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:04966f0ef15defdc90afcf15243dbc07cd159c8679d1c9adc2e0512ed4ee4f58 -size 159422 +oid sha256:ba557bae19c19551179bdc07d4d33db46a99655799228a9a6f8f84c27fa99523 +size 114287 diff --git a/assets/library-demos/theme_factory-1.webp b/assets/library-demos/theme_factory-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..aa1bd6bc9e3df6f540fe5e0150455cd5181bb102 --- /dev/null +++ b/assets/library-demos/theme_factory-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dfa2c9a2772b31619173449eb49479b4542d55da562b294fdac300a809a8e83 +size 16550 diff --git a/assets/library-demos/web_artifacts_builder-1.gif b/assets/library-demos/web_artifacts_builder-1.gif index 18c788d23012d0cece707d58f02ca4bde19afc48..099e5e38a1e4b8a85b59d21f818e2774fb9a974a 100644 --- a/assets/library-demos/web_artifacts_builder-1.gif +++ b/assets/library-demos/web_artifacts_builder-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:33109a137efdc9958bfbd459e89b98d6c914e6d39a764304395dd6bcd808a6bd -size 162187 +oid sha256:ea5a1ce194e452ea1e5848e6b600764db1dce6d97a4432b0634830cb1c0b37eb +size 115201 diff --git a/assets/library-demos/web_artifacts_builder-1.webp b/assets/library-demos/web_artifacts_builder-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..efe92717b4fe059a54803f3547f00507175e310c --- /dev/null +++ b/assets/library-demos/web_artifacts_builder-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:670490cb1fb61c78f43fd66802353920266bd8832045051a42f202f6c28e0252 +size 20708 diff --git a/assets/library-demos/webapp_testing-1.gif b/assets/library-demos/webapp_testing-1.gif index 4f6b55437ff6c526504a8afa90ef1c7de5e7158c..9cc106a9e0757dbff7b521d1f72c5a4e2db21350 100644 --- a/assets/library-demos/webapp_testing-1.gif +++ b/assets/library-demos/webapp_testing-1.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:27e5bb56ece3ab1bc3487031b161c96d0369c86063ee3c50fcdf9f7a8ca2d14f -size 204455 +oid sha256:27d6484c71f1e61ec2031508eb10e2da78415aa39012ceadc2526149461fef34 +size 125421 diff --git a/assets/library-demos/webapp_testing-1.webp b/assets/library-demos/webapp_testing-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..81b281b1d869c8a0257130b5f60cf04b7333e9d6 --- /dev/null +++ b/assets/library-demos/webapp_testing-1.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bd4d447231e25943f36a3a56b6e83b285e61e10d21c4ef5ac73dcdc16606543 +size 21476 diff --git a/distinct-update.zip b/distinct-update.zip new file mode 100644 index 0000000000000000000000000000000000000000..b6eb018320703b8b0152179af9e1071bcb1e9e10 --- /dev/null +++ b/distinct-update.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf6567abd8ff59b1041ca1e41072335eebeff321526bb347d243f08f8abefad1 +size 2613564 diff --git a/distinct_agent/runners.py b/distinct_agent/runners.py index 9b28516830ffd1cac785fae13b5573cfbecf9367..cfda6bc036d6c896ba1aff26d8cdabcbd4d55d18 100644 --- a/distinct_agent/runners.py +++ b/distinct_agent/runners.py @@ -172,9 +172,8 @@ class DeterministicDemoRunner: "type": "final", "answer": ( f"[demo:{model.manifest.id}] ran " - f"{len(directives)} requested library call(s); " - "results are in the trace and any artifact is in " - "your session outputs." + f"{len(directives)} requested library call(s). " + "Here is what came back." ), }, ensure_ascii=False, diff --git a/distinct_server.egg-info/SOURCES.txt b/distinct_server.egg-info/SOURCES.txt index dd1792e7827dfc0f81fd51ecaeb4d7c29dcab4cb..8ebd80231751df2f8f99ec80750917850684a5e9 100644 --- a/distinct_server.egg-info/SOURCES.txt +++ b/distinct_server.egg-info/SOURCES.txt @@ -36,6 +36,7 @@ distinct_agent/isolation/windows.py distinct_agent/isolation/windows_appcontainer.py distinct_mcp/__init__.py distinct_mcp/common.py +distinct_mcp/external.py distinct_mcp/files.py distinct_mcp/lists.py distinct_mcp/numbers.py @@ -69,8 +70,37 @@ distinct_skills/__main__.py distinct_skills/handlers.py distinct_skills/loader.py distinct_skills/manifest.py +distinct_skills/skills/academy-guide/SKILL.md +distinct_skills/skills/academy-guide/tool.json +distinct_skills/skills/academy-guide/assets/guide.md +distinct_skills/skills/algorithmic-art/SKILL.md +distinct_skills/skills/algorithmic-art/tool.json +distinct_skills/skills/algorithmic-art/assets/guide.md +distinct_skills/skills/brand-guidelines/SKILL.md +distinct_skills/skills/brand-guidelines/tool.json +distinct_skills/skills/brand-guidelines/assets/guide.md +distinct_skills/skills/canvas-design/SKILL.md +distinct_skills/skills/canvas-design/tool.json +distinct_skills/skills/canvas-design/assets/guide.md +distinct_skills/skills/claude-api/SKILL.md +distinct_skills/skills/claude-api/tool.json +distinct_skills/skills/claude-api/assets/guide.md +distinct_skills/skills/create-deck/SKILL.md +distinct_skills/skills/create-deck/tool.json +distinct_skills/skills/create-docx/SKILL.md +distinct_skills/skills/create-docx/tool.json +distinct_skills/skills/create-xlsx/SKILL.md +distinct_skills/skills/create-xlsx/tool.json distinct_skills/skills/csv-table/SKILL.md distinct_skills/skills/csv-table/tool.json +distinct_skills/skills/discernment-nudge/SKILL.md +distinct_skills/skills/discernment-nudge/tool.json +distinct_skills/skills/discernment-nudge/assets/guide.md +distinct_skills/skills/frontend-design/SKILL.md +distinct_skills/skills/frontend-design/tool.json +distinct_skills/skills/mcp-builder/SKILL.md +distinct_skills/skills/mcp-builder/tool.json +distinct_skills/skills/mcp-builder/assets/guide.md distinct_skills/skills/review-checklist/SKILL.md distinct_skills/skills/review-checklist/tool.json distinct_skills/skills/review-checklist/assets/checklist.md @@ -78,9 +108,20 @@ distinct_skills/skills/review-checklist/assets/claim-block.md distinct_skills/skills/skill-scaffold/SKILL.md distinct_skills/skills/skill-scaffold/tool.json distinct_skills/skills/skill-scaffold/assets/skill-template.md +distinct_skills/skills/slack-gif-creator/SKILL.md +distinct_skills/skills/slack-gif-creator/tool.json +distinct_skills/skills/slack-gif-creator/assets/guide.md distinct_skills/skills/status-update/SKILL.md distinct_skills/skills/status-update/tool.json distinct_skills/skills/status-update/assets/status-update.md +distinct_skills/skills/theme-factory/SKILL.md +distinct_skills/skills/theme-factory/tool.json +distinct_skills/skills/web-artifacts-builder/SKILL.md +distinct_skills/skills/web-artifacts-builder/tool.json +distinct_skills/skills/web-artifacts-builder/assets/guide.md +distinct_skills/skills/webapp-testing/SKILL.md +distinct_skills/skills/webapp-testing/tool.json +distinct_skills/skills/webapp-testing/assets/guide.md distinct_tools/__init__.py distinct_tools/approval.py distinct_tools/core.py diff --git a/distinct_server/presentation.py b/distinct_server/presentation.py index ae481e8ac65d349d57d03703f3c475c78909d9b7..ca36302e07ea623cf1a8a2dd2dbc496641153cf9 100644 --- a/distinct_server/presentation.py +++ b/distinct_server/presentation.py @@ -18,22 +18,23 @@ letter, because an absence drawn as a D is a measured poor result that nobody measured. **2. WCAG AA, computed rather than assumed.** -Contrast against the canvas ``#F7FAF3``: +Contrast against the canvas ``#FAF9F5``: =============== ========= ====== ========================================== Colour Ratio AA? Used for =============== ========= ====== ========================================== -``#203127`` 13.3:1 pass body text -``#4A5A50`` 6.0:1 pass secondary text -``#5F7064`` 4.9:1 pass muted text -``#2F4A38`` 9.2:1 pass accent text -``#3F6349`` 6.8:1* pass primary button (*white on it) -``#557E5E`` 4.3:1 FAIL borders, focus rings, 24px+ only -``#6E9B76`` 3.0:1 FAIL decorative fill only +``#1F1E1A`` 15.6:1 pass body text +``#504D45`` 7.6:1 pass secondary text +``#6C6961`` 4.6:1 pass muted text +``#174F37`` 9.3:1 pass accent text +``#1E6E4B`` 6.0:1* pass primary button (*white on it: 6.2:1) +``#4E7561`` 4.2:1 FAIL borders, strokes, 24px+ only +``#5E8A73`` 3.2:1 FAIL decorative fill only =============== ========= ====== ========================================== -The spec's two greens fail AA for body text, so neither is ever used for body -text. The darker values are shades of the same hue, not new colours. +The two lighter greens fail AA for body text, so neither is ever used for +body text. Every neutral is warm-grey over ivory; green appears only where +it means something (the action, the selection, the focus). **Layout: the shell decides its own height.** The previous sheet locked ``.gradio-container`` and ``.c-shell`` to ``100vh`` @@ -54,19 +55,25 @@ four the layout had grown. from __future__ import annotations PALETTE = { - "canvas": "#F7FAF3", + # A warm paper ground with exactly one accent. The previous sheet tinted + # the canvas, the borders, the fills and the pills green all at once, and + # four tinted neutrals beside one another read as a colour scheme fighting + # itself. Now the neutrals are neutral (warm greys over an ivory ground) + # and green appears only where it means something: the primary action, + # the selected state, the focus ring. + "canvas": "#FAF9F5", "surface": "#FFFFFF", - "mint": "#DDECD7", - "sage": "#6E9B76", - "sage_dark": "#557E5E", - "border": "#BDD2B7", - "text": "#203127", - "muted": "#5F7064", - # Accessible shades of the same hue; see the table above. - "sage_deep": "#2F4A38", - "sage_button": "#3F6349", - "text_secondary": "#4A5A50", - "hairline": "#E6EDE1", + "mint": "#E8F0EA", # selection tint, the only coloured fill + "sage": "#5E8A73", # decorative strokes over 24px + "sage_dark": "#4E7561", + "border": "#D8D3C7", + "text": "#1F1E1A", + "muted": "#6C6961", + # Accessible shades of the accent; see the table above. + "sage_deep": "#174F37", + "sage_button": "#1E6E4B", + "text_secondary": "#504D45", + "hairline": "#EAE7DF", } # Loaded via launch(head=...) so the font arrives before first paint rather than @@ -87,7 +94,8 @@ HEAD = """ """ @@ -127,12 +179,12 @@ CSS = """ ==================================================================== */ :root{ /* colour */ - --c-canvas:#F7FAF3; --c-surface:#FFFFFF; --c-mint:#DDECD7; - --c-sage:#6E9B76; --c-sage-dark:#557E5E; --c-sage-deep:#2F4A38; - --c-accent:#3F6349; --c-accent-hover:#33523B; - --c-text:#203127; --c-text-2:#4A5A50; --c-muted:#5F7064; - --c-hairline:#E6EDE1; --c-border:#BDD2B7; --c-fill:#F1F5EE; - --c-warn-bg:#FDF8EA; --c-warn-rule:#8A6D23; + --c-canvas:#FAF9F5; --c-surface:#FFFFFF; --c-mint:#E8F0EA; + --c-sage:#5E8A73; --c-sage-dark:#4E7561; --c-sage-deep:#174F37; + --c-accent:#1E6E4B; --c-accent-hover:#185C3E; + --c-text:#1F1E1A; --c-text-2:#504D45; --c-muted:#6C6961; + --c-hairline:#EAE7DF; --c-border:#D8D3C7; --c-fill:#F4F1EA; + --c-warn-bg:#FBF6E8; --c-warn-rule:#7A6420; /* spacing: 4px base, no value outside this scale */ --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; @@ -146,17 +198,20 @@ CSS = """ --r-md:12px; --r-lg:16px; --r-pill:999px; /* elevation: two levels */ - --e1:0 1px 2px rgba(32,49,39,.05); - --e2:0 8px 28px -12px rgba(32,49,39,.18); + --e1:0 1px 2px rgba(35,32,26,.05); + --e2:0 8px 28px -12px rgba(35,32,26,.16); --font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; - /* DISPLAY FACE. Option A is live. Comment it out and uncomment option B to - compare; nothing else in the sheet changes. */ - --font-display:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; /* A */ - /* --font-display:'Fraunces','Iowan Old Style',Georgia,serif; */ /* B */ + /* DISPLAY FACE. Option B is live: the serif display over a warm paper + ground is what carries the editorial, Anthropic-adjacent register; the + sans stays for everything set smaller than a title. Swap the live line + to compare; nothing else in the sheet changes. */ + /* --font-display:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; */ /* A */ + --font-display:'Fraunces','Iowan Old Style',Georgia,serif; /* B */ + --c-focus:rgba(30,110,75,.4); --measure:68ch; /* One shell geometry, referenced by every top-level block so there is @@ -272,9 +327,11 @@ footer,.gradio-container footer{display:none !important;} line-height:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding-left:var(--s3); border-left:1px solid var(--c-hairline);} -.c-identity{font-size:var(--t-micro); color:var(--c-text-2); - background:var(--c-surface); padding:5px 12px; - border-radius:var(--r-pill); box-shadow:var(--e1); white-space:nowrap;} +/* Who you are, said quietly. This was a floating white pill with a shadow, + which gave the top of the page a second object competing with the + wordmark for the eye; it is a caption, so it is set like one. */ +.c-identity{font-size:var(--t-micro); color:var(--c-muted); white-space:nowrap; + overflow:hidden; text-overflow:ellipsis; max-width:38ch;} .c-identity--link{text-decoration:underline; cursor:pointer;} /* ======================================================================== @@ -344,19 +401,24 @@ footer,.gradio-container footer{display:none !important;} /* ======================================================================== NOTICE ==================================================================== */ -.c-notice{background:var(--c-warn-bg); border-radius:var(--r-md); - padding:var(--s3) var(--s4);} -.c-notice__summary{display:flex; align-items:center; gap:var(--s3); - cursor:pointer; list-style:none; +/* A caution, not an alarm: paper surface and a hairline, with the mark the + only saturated pixel. The previous amber flood shouted over the page and + was the loudest colour on it. */ +.c-notice{background:var(--c-surface); border:1px solid var(--c-hairline); + border-radius:var(--r-md); padding:var(--s3) var(--s4);} +.c-notice__summary{display:flex; align-items:baseline; gap:var(--s3); + flex-wrap:wrap; cursor:pointer; list-style:none; font-size:var(--t-label); color:var(--c-text-2); - line-height:1.45;} + line-height:1.5;} .c-notice__summary::-webkit-details-marker{display:none;} .c-notice__summary strong{color:var(--c-text); font-weight:600;} .c-notice__mark{flex:none; width:16px; height:16px; border-radius:50%; - background:var(--c-warn-rule); color:#fff; font-size:11px; - font-weight:700; display:grid; place-items:center;} + align-self:center; + border:1.5px solid var(--c-warn-rule); color:var(--c-warn-rule); + font-size:10px; font-weight:700; display:grid; place-items:center;} .c-notice__toggle{margin-left:auto; white-space:nowrap; font-size:var(--t-micro); - color:var(--c-muted); text-decoration:underline;} + color:var(--c-muted); text-decoration:underline; + text-underline-offset:2px; padding-left:var(--s3);} .c-notice__body{margin:var(--s3) 0 var(--s1) 28px; font-size:var(--t-micro); line-height:1.6; color:var(--c-text-2); max-width:var(--measure);} .c-notice__summary:focus-visible{outline:3px solid var(--c-sage); outline-offset:3px; @@ -495,10 +557,9 @@ footer,.gradio-container footer{display:none !important;} .c-grade-card__name{font-size:var(--t-body); font-weight:600; color:var(--c-text);} .c-grade-card__link{font-size:var(--t-micro); color:var(--c-sage-deep); text-decoration:underline; white-space:nowrap;} -.c-grade-card__overall{display:flex; align-items:center; gap:var(--s3); - margin:0; flex-wrap:wrap;} -/* Coverage is never separated from the overall result. A letter with no - denominator beside it is the thing this panel must not produce. */ +/* Coverage sits in the card head, beside the name, because it qualifies the + whole card. "three of six areas published" is not a score and must never be + read as one, so it is set as quiet metadata rather than as a result. */ .c-grade-card__coverage{font-size:var(--t-micro); color:var(--c-text-2); font-variant-numeric:tabular-nums;} .c-grade-card__note{margin:0; padding-top:var(--s3); font-size:var(--t-micro); @@ -511,50 +572,82 @@ footer,.gradio-container footer{display:none !important;} .c-grade-row:last-child{border-bottom:none;} .c-grade-row__label{font-size:var(--t-label); color:var(--c-text-2);} -/* ONE TOKEN, NOT A LETTER WITH A CAPTION. - The scale name, the letter and the coverage share a single border and a - single overflow context, so there is no crop, no skim and no line break that - can separate a letter from the coverage it was drawn from. "B" over two of - six areas cannot be quoted as "B" because the two of six is inside the box. - - Impact and evidence are told apart three ways at once: the word inside the - token, the corner radius (rectangle against pill) and the fill. Three signals - because one is a column heading away from being lost, and the palette has a - single hue so colour cannot be one of them. */ -.c-score{display:inline-flex; align-items:stretch; flex:none; line-height:1; - border:1px solid var(--c-border); overflow:hidden; - font-variant-numeric:tabular-nums;} -.c-score--performance{border-radius:8px;} -.c-score--evidence{border-radius:var(--r-pill);} -.c-score__scale{display:flex; align-items:center; padding:0 8px; - font-size:9.5px; font-weight:600; letter-spacing:.08em; - text-transform:uppercase; color:var(--c-muted); - background:var(--c-fill); border-right:1px solid var(--c-border);} -.c-score__letter{display:flex; align-items:center; justify-content:center; - min-width:30px; padding:6px 8px; font-size:var(--t-body); - font-weight:700; color:#22402C; background:var(--c-mint);} -.c-score--evidence .c-score__letter{background:transparent; color:var(--c-text);} -.c-score__coverage{display:flex; align-items:center; padding:0 9px; - font-size:var(--t-micro); color:var(--c-text-2); - background:var(--c-surface); - border-left:1px solid var(--c-border); white-space:nowrap;} -/* An absence keeps its scale label, so a reader knows which question went - unanswered, and is dashed and lowercase so it cannot be mistaken for a - result on either scale. */ -.c-score--none{border-style:dashed; background:transparent;} -.c-score--none .c-score__scale{background:transparent; border-right-style:dashed;} -.c-score__word{display:flex; align-items:center; padding:6px 10px; - font-size:var(--t-micro); font-weight:500; color:var(--c-muted); - white-space:nowrap;} -/* A reported value is published fact without a letter: solid border, no fill, - value text where a letter would sit. Distinct from both a grade (filled - letter) and an absence (dashed). */ -.c-score--reported{background:transparent;} -.c-score--reported .c-score__word{color:var(--c-text-2); white-space:normal;} -.c-grade-row__value{font-size:var(--t-micro); color:var(--c-text-2); - margin-left:var(--s2); white-space:nowrap;} -.c-grade-card__evidence-detail{font-size:var(--t-micro); color:var(--c-muted); - align-self:center;} +/* ONE TOKEN, NOT A NUMBER WITH A CAPTION. + The figure and the method that produced it share a single border and a single + overflow context, so there is no crop, no skim and no line break that can + separate them. "54 MWh" metered at the socket and "54 MWh" inferred from a + chip's rated wattage are different claims, and the word that tells them apart + is inside the box rather than beside it. + + Method is told apart three ways at once: the word itself, the fill, and the + border. Three signals because one is a heading away from being lost, and the + palette has a single hue so colour cannot carry it alone. */ +.c-fig{display:inline-flex; align-items:stretch; flex:none; line-height:1; + border:1px solid var(--c-border); border-radius:8px; overflow:hidden; + font-variant-numeric:tabular-nums;} +.c-fig__value{display:flex; align-items:center; padding:6px 9px; + font-size:var(--t-label); font-weight:600; color:#22402C; + background:var(--c-mint); white-space:nowrap;} +.c-fig__method{display:flex; align-items:center; padding:0 8px; + font-size:9.5px; font-weight:600; letter-spacing:.08em; + text-transform:uppercase; color:var(--c-muted); + background:var(--c-surface); + border-left:1px solid var(--c-border); white-space:nowrap;} +/* A measured figure is the only one that gets the filled value. A modelled one + is the same shape unfilled, because it is a real published number arrived at + by calculation rather than by metering, and the difference should read at a + glance without either being dressed as a fault. */ +.c-fig--modelled .c-fig__value, +.c-fig--proxy .c-fig__value{background:var(--c-fill); color:var(--c-text);} +.c-fig--unknown{border-style:dotted;} +.c-fig--unknown .c-fig__value{background:transparent; color:var(--c-text-2);} +/* An absence is dashed, wordy and unfilled: it differs from a figure in shape, + fill and content, because an absence drawn as a small number asserts a light + result that nobody measured. */ +.c-fig--none{border-style:dashed; background:transparent;} +.c-fig__word{display:flex; align-items:center; padding:6px 10px; + font-size:var(--t-micro); font-weight:500; color:var(--c-muted); + white-space:nowrap;} + +/* The card's own prose. Summary sits above the figures because a reader who + stops after one paragraph should stop having read the caveat, not the + headline number. */ +.c-grade-card__summary{margin:0; font-size:var(--t-label); line-height:1.6; + color:var(--c-text-2);} +.c-grade-card__covers{margin:0; font-size:var(--t-micro); line-height:1.55; + color:var(--c-muted);} +.c-grade-card__covers strong{color:var(--c-text-2); font-weight:600;} +.c-grade-card__links{display:flex; flex-wrap:wrap; gap:var(--s3); margin:0; + padding-top:var(--s3); + border-top:1px solid var(--c-hairline);} + +/* THE WORKING, ONE CLICK AWAY. + Six notes and six citations on the face of the card bury the figures; hiding + them makes the figures unverifiable. A disclosure is the only arrangement + that is both complete and readable. */ +.c-sources{border-top:1px solid var(--c-hairline); padding-top:var(--s3);} +.c-sources__summary{cursor:pointer; font-size:var(--t-micro); font-weight:600; + letter-spacing:.04em; color:var(--c-sage-deep);} +.c-sources__summary:focus-visible{outline:2px solid var(--c-sage); + outline-offset:2px; border-radius:3px;} +.c-sources__body{display:flex; flex-direction:column; gap:var(--s2); + margin-top:var(--s3);} +.c-source{display:grid; grid-template-columns:minmax(88px,auto) 1fr; + gap:var(--s1) var(--s3); margin:0; font-size:var(--t-micro); + line-height:1.55;} +.c-source__label{color:var(--c-text-2); font-weight:600;} +.c-source__body{color:var(--c-muted);} +.c-source__link{color:var(--c-sage-deep); text-decoration:underline; + white-space:nowrap;} + +.c-reading{padding-top:var(--s3); border-top:1px dashed var(--c-border);} +.c-reading__title{margin:0 0 var(--s2); font-size:var(--t-micro); font-weight:600; + letter-spacing:.06em; text-transform:uppercase; + color:var(--c-muted);} +.c-reading__links{display:flex; flex-direction:column; gap:var(--s1); margin:0;} +.c-reading__link{font-size:var(--t-micro); color:var(--c-sage-deep); + text-decoration:underline;} + .c-rubric__warning{margin:0; padding:var(--s3); background:var(--c-mint); border-radius:var(--r-md); font-size:var(--t-micro); line-height:1.55; color:var(--c-text);} @@ -567,7 +660,6 @@ footer,.gradio-container footer{display:none !important;} .c-legend__scale-body{margin:0; font-size:var(--t-micro); line-height:1.55; color:var(--c-text-2);} .c-legend__scale-body strong{color:var(--c-text); font-weight:600;} -.c-grade-card__scores{display:flex; flex-wrap:wrap; gap:var(--s2);} /* ======================================================================== EMPTY STATES: no dashed drop-zone rectangles @@ -1317,14 +1409,12 @@ details[open] .c-libhelp__toggle::after{content:" -";} .c-grade-row{flex-wrap:wrap; gap:var(--s2);} } -/* The score token never breaks up, at any width. Coverage sharing a border - with its letter is the whole design, so the cells are explicitly not +/* The figure token never breaks up, at any width. The method word sharing a + border with its number is the whole design, so the cells are explicitly not allowed to wrap and the token is not allowed to shrink below its content. The row around it wraps instead. */ -.c-score{flex-wrap:nowrap !important; flex:none !important;} -.c-score__scale,.c-score__letter,.c-score__coverage,.c-score__word{ - white-space:nowrap; flex:none; -} +.c-fig{flex-wrap:nowrap !important; flex:none !important;} +.c-fig__value,.c-fig__method,.c-fig__word{white-space:nowrap; flex:none;} .c-grade-row__label{min-width:0; overflow-wrap:anywhere;} @media (prefers-reduced-motion:reduce){ @@ -1356,48 +1446,163 @@ details[open] .c-libhelp__toggle::after{content:" -";} } -/* ---- Library page: cards over tick boxes ------------------------------ */ -.c-library-section{scroll-margin-top:24px;} -.c-libgrid{display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); +/* ---- Library page ------------------------------------------------------ + Its own page, reached from the quick nav. One control: the card. Clicking + or tapping a card makes that member a default and the page saves at once; + there is no separate list of tick boxes to reconcile with the grid. The + selected state has to survive a squint test: accent border, filled check, + tinted wash — three signals, any one of which is enough. */ +.c-libpage{max-width:var(--shell-max); margin:0 auto; padding:var(--s5) var(--shell-pad) var(--s8);} +.c-libpage__back{font-size:var(--t-label); color:var(--c-text-2); text-decoration:none; + display:inline-flex; align-items:center; gap:6px;} +.c-libpage__back:hover{color:var(--c-text);} +.c-libpage__title{margin:var(--s3) 0 4px; font-family:var(--font-display); + font-weight:600; font-size:clamp(26px,4vw,34px); letter-spacing:-.015em; + color:var(--c-text);} +.c-libpage__lede{margin:0 0 var(--s5); max-width:var(--measure); color:var(--c-text-2);} +.c-libsave{position:sticky; top:0; z-index:9; display:flex; align-items:center; gap:var(--s3); + background:color-mix(in srgb, var(--c-canvas) 88%, transparent); + backdrop-filter:blur(6px); padding:var(--s2) 0; margin-bottom:var(--s2);} +.c-libsave__count{font-size:var(--t-label); color:var(--c-text-2);} +.c-libsave__count strong{color:var(--c-sage-deep); font-weight:650;} + +.c-libgrid{display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:var(--s4); margin:var(--s4) 0;} -.c-libcard{background:var(--c-surface); border:1px solid var(--c-hairline); - border-radius:var(--r-lg); padding:var(--s4); - display:flex; flex-direction:column; gap:6px; - transition:box-shadow .18s ease, transform .18s ease;} -.c-libcard:hover{box-shadow:var(--e2); transform:translateY(-2px);} +.c-libcard{position:relative; background:var(--c-surface); + border:1.5px solid var(--c-hairline); border-radius:var(--r-lg); + padding:var(--s4); cursor:pointer; -webkit-tap-highlight-color:transparent; + display:flex; flex-direction:column; gap:6px; text-align:left; + transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;} +.c-libcard:hover{border-color:var(--c-border); box-shadow:var(--e1);} +.c-libcard:focus-visible{outline:3px solid var(--c-focus, rgba(30,110,75,.4)); outline-offset:2px;} +.c-libcard.is-on{border-color:var(--c-accent); background:color-mix(in srgb, var(--c-mint) 38%, var(--c-surface));} +.c-libcard.is-on:hover{box-shadow:var(--e1);} +/* The check is a real mark, not a decoration: absent = a quiet plus, present + = a filled tick. It is what makes the card legible as a control at all. */ +.c-libcard__check{position:absolute; top:10px; right:10px; z-index:2; + width:24px; height:24px; border-radius:50%; + display:flex; align-items:center; justify-content:center; + font-size:14px; line-height:1; + border:1.5px solid var(--c-border); color:var(--c-muted); + background:var(--c-surface); + transition:all .15s ease;} +.c-libcard.is-on .c-libcard__check{border-color:var(--c-accent); + background:var(--c-accent); color:#fff;} +.c-libcard__check::before{content:"+";} +.c-libcard.is-on .c-libcard__check::before{content:"✓";} .c-libcard__media{margin:calc(var(--s4)*-1) calc(var(--s4)*-1) var(--s2); - aspect-ratio:16/9; border-radius:var(--r-lg) var(--r-lg) 0 0; + aspect-ratio:16/9; border-radius:calc(var(--r-lg) - 2px) calc(var(--r-lg) - 2px) 0 0; background:var(--c-fill) center/cover no-repeat; display:flex; align-items:center; justify-content:center; overflow:hidden; position:relative;} -.c-libcard__media img{width:100%; height:100%; object-fit:cover; display:block;} -.c-libcard__play{font-size:22px; color:var(--c-muted); opacity:.8;} +.c-libcard__media img{width:100%; height:100%; object-fit:cover; + object-position:top center; display:block; + position:absolute; inset:0;} +/* The still is the run's own result. It sits under the animation, and it is + what the card shows on a phone, where nothing hovers. */ +.c-libcard__poster{z-index:0;} +.c-libcard__media.is-playing .c-libcard__poster{opacity:0;} +.c-libcard__play{position:relative; z-index:1; + display:inline-flex; align-items:center; gap:6px; + font-size:var(--t-micro); color:var(--c-text-2); + background:color-mix(in srgb, var(--c-surface) 92%, transparent); + border:1px solid var(--c-hairline); backdrop-filter:blur(3px); + border-radius:999px; padding:4px 10px; opacity:0; + transition:opacity .15s ease;} +.c-libcard__play::before{content:"▶"; font-size:9px; color:var(--c-sage-deep);} +/* The invitation appears on approach and never sits permanently over the + result it is inviting you to watch. Always visible where there is no + poster to obscure, since then it is the only thing in the frame. */ +.c-libcard:hover .c-libcard__play, +.c-libcard:focus-visible .c-libcard__play{opacity:1;} +.c-libcard__media:not(:has(.c-libcard__poster)) .c-libcard__play{opacity:1;} .c-libcard__media.is-playing .c-libcard__play{display:none;} -.c-libcard__head{display:flex; align-items:center; gap:var(--s2);} +.c-libcard__head{display:flex; align-items:center; gap:var(--s2); padding-right:28px;} .c-libcard__kind{font-size:var(--t-micro); letter-spacing:.06em; text-transform:uppercase; padding:2px 8px; border-radius:999px; background:var(--c-fill); - color:var(--c-text-2);} -.c-libcard__kind--skill{background:var(--c-sage-wash, #e7efe7); color:var(--c-sage-deep);} -.c-libcard__default{margin-left:auto; font-size:var(--t-micro); color:var(--c-sage-deep); - border:1px solid currentColor; border-radius:999px; padding:1px 8px;} + color:var(--c-text-2); flex:none;} +.c-libcard__kind--skill{background:var(--c-mint); color:var(--c-sage-deep);} .c-libcard__name{margin:0; font-size:var(--t-body); font-weight:650; color:var(--c-text); text-transform:capitalize;} .c-libcard__author{margin:0; font-size:var(--t-micro); color:var(--c-muted);} -.c-libcard__desc{margin:2px 0 0; font-size:var(--t-small, 13px); line-height:1.5; +.c-libcard__desc{margin:2px 0 0; font-size:13px; line-height:1.5; color:var(--c-text-2); display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden;} .c-libcard__ref{margin-top:auto; padding-top:var(--s2); font-family:var(--mono); font-size:11px; color:var(--c-muted);} -.c-librarydefaults-head{margin-top:var(--s4);} -/* ---- Quick nav under the identity box --------------------------------- */ -.c-quicknav{display:flex; gap:var(--s3); justify-content:flex-end; - margin:calc(var(--s2)*-1) 0 var(--s2);} -.c-quicknav__link{font-size:var(--t-micro); letter-spacing:.04em; text-decoration:none; - color:var(--c-sage-deep); border:1px solid var(--c-hairline); - background:var(--c-surface); padding:4px 12px; border-radius:999px;} -.c-quicknav__link:hover{border-color:var(--c-sage-deep);} +/* ---- Navigation, in the header band ----------------------------------- + A button (the library, which navigates) beside a link (a section of this + page). They must look like one row of controls, so the button is styled to + match the link rather than the other way round. + + The row is pulled up against the header rule and the sign-in control sits + with it, because a site's navigation belongs to its header. Left where it + was, the page opened with a rule, a band of nothing, two floating pills, + another band of nothing, and only then the product. */ +.c-quicknav{display:flex !important; flex-wrap:wrap !important; gap:var(--s2) !important; + justify-content:flex-end !important; align-items:center !important; + /* Pulled tight against the header rule on both sides. The shell + puts a 24px gap between every child, which around a 34px row of + pills left the page opening on a band of nothing; these margins + spend that gap rather than adding to it. */ + margin:calc(var(--s4)*-1) 0 calc(var(--s2)*-1) !important; + min-height:0 !important;} +/* The row hugs its controls. Gradio wraps the anchor in a block that keeps a + 60px minimum, which made a 32px row of pills reserve twice its own height; + the wrapper is told to be the size of what it contains. */ +.c-quicknav>*{min-height:0 !important; margin:0 !important; align-self:center !important;} +.c-quicknav .block,.c-quicknav .prose,.c-quicknav nav{min-height:0 !important; + padding:0 !important; margin:0 !important; display:flex !important; + align-items:center !important;} +.c-quicknav .prose p{margin:0 !important;} +/* The wrapper keeps a 60px floor that no rule on it reaches, so the row is + given the height of its own controls and allowed to overflow it. On a + narrow screen the pills wrap, so the height goes back to automatic. */ +@media (min-width:701px){ + .c-quicknav{height:34px !important; overflow:visible !important;} +} +/* The Hugging Face control keeps company with the nav rather than spanning + the page as a full-width slab. */ +.c-shell>.gradio-button.huggingface, +.c-shell button.huggingface{width:auto !important; max-width:280px; + margin-left:auto !important; margin-top:calc(var(--s3)*-1) !important;} +.c-quicknav>*{flex:0 0 auto !important; width:auto !important; min-width:0 !important;} +.c-quicknav__link, +.c-quicknav .c-quicknav__btn button, +.c-quicknav button.c-quicknav__btn{ + display:inline-flex !important; align-items:center !important; + font-size:var(--t-label) !important; text-decoration:none; font-weight:550 !important; + color:var(--c-text-2) !important; border:1px solid var(--c-hairline) !important; + background:var(--c-surface) !important; padding:5px 14px !important; + border-radius:999px !important; min-height:0 !important; height:auto !important; + line-height:1.5 !important; + transition:border-color .15s ease, color .15s ease;} +.c-quicknav__link:hover, +.c-quicknav .c-quicknav__btn button:hover, +.c-quicknav button.c-quicknav__btn:hover{ + border-color:var(--c-accent) !important; color:var(--c-sage-deep) !important;} + +/* The library page's own way back, set as a quiet control at the top left. */ +.c-libpage .c-libpage__backbtn button, +.c-libpage button.c-libpage__backbtn{ + background:transparent !important; border:none !important; padding:0 !important; + color:var(--c-text-2) !important; font-size:var(--t-label) !important; + font-weight:550 !important; min-height:0 !important;} +.c-libpage .c-libpage__backbtn button:hover, +.c-libpage button.c-libpage__backbtn:hover{color:var(--c-text) !important;} +.c-libpage .c-librarysearch input, +.c-libpage .c-librarysearch textarea{max-width:420px;} +/* The transport, present in the document and not on the page. + ``display:none`` rather than the usual clip-to-1px trick: a clipped + element still occupies a box the browser hit-tests, so a stray box landed + in the corner of the page and could take a click meant for something else. + A synthetic ``click()`` — which is how a card forwards its selection — + dispatches on a hidden element exactly as it does on a shown one, so + nothing is lost by removing it from the layout entirely. It must never + become ``visible=False`` in Python: gradio 6 leaves that out of the DOM. */ +.c-hiddenfield{display:none !important;} /* ---- The no-agents veil ----------------------------------------------- */ /* Shown only while somebody is signed in (the identity span has text) and @@ -1406,9 +1611,13 @@ details[open] .c-libhelp__toggle::after{content:" -";} .c-conversation{position:relative;} .c-shell:has(.c-identity:not(:empty)):has(.c-noworker-hook) .c-veil{ display:flex; position:absolute; inset:0; z-index:12; - align-items:center; justify-content:center; padding:var(--s5); - background:color-mix(in srgb, var(--c-bg, #f7f9f3) 62%, transparent); - backdrop-filter:blur(2.5px); border-radius:var(--r-lg); + /* Aligned to the top of the column rather than its centre. Centred, the + panel sat across the privacy notice above the conversation and read as + a modal over the whole page instead of an explanation of this column. */ + align-items:flex-start; justify-content:center; + padding:var(--s7) var(--s5) var(--s5); + background:color-mix(in srgb, var(--c-canvas) 72%, transparent); + backdrop-filter:blur(2px); border-radius:var(--r-lg); /* The veil informs; it does not imprison. Pointer events pass through everywhere except its own panel, so a transient no-worker blip (a poll gap, a mode change) can never trap a click mid-flow. */ @@ -1419,11 +1628,16 @@ details[open] .c-libhelp__toggle::after{content:" -";} .c-veil__panel{max-width:380px; text-align:center; background:var(--c-surface); border:1px solid var(--c-hairline); border-radius:var(--r-lg); box-shadow:var(--e2); padding:var(--s5);} +@media (max-width:700px){ + .c-shell:has(.c-identity:not(:empty)):has(.c-noworker-hook) .c-veil{ + padding:var(--s5) var(--s4);} + .c-veil__panel{padding:var(--s4);} +} .c-veil__title{margin:0 0 6px; font-weight:650; font-size:var(--t-lg); color:var(--c-text);} .c-veil__body{margin:0 0 var(--s4); color:var(--c-text-2); line-height:1.55;} -.c-veil__action{display:inline-block; text-decoration:none; background:var(--c-sage-deep); - color:#fff; padding:10px 20px; border-radius:999px; font-weight:600;} -.c-veil__action:hover{filter:brightness(1.08);} +.c-veil__action{display:inline-block; text-decoration:none; background:var(--c-accent); + color:#fff; padding:10px 22px; border-radius:var(--r-md); font-weight:600;} +.c-veil__action:hover{background:var(--c-accent-hover);} /* ---- Professional polish pass ----------------------------------------- */ /* Calmer sections: the tail accordions read as pages, not widgets. */ @@ -1436,11 +1650,93 @@ details[open] .c-libhelp__toggle::after{content:" -";} /* Inputs: quiet until focused. */ .gradio-container input[type="text"], .gradio-container textarea{ border-radius:var(--r-md) !important;} +/* Buttons: one radius, one accent. The pill-shaped navy is gone; a primary + action is the accent green, a secondary is paper with a hairline, and the + Hugging Face sign-in follows the secondary language rather than bringing a + fourth colour to the page. */ +.gradio-container button{border-radius:var(--r-md) !important; font-weight:600 !important; + letter-spacing:0 !important; transition:background .15s ease, border-color .15s ease !important;} +.gradio-container button.primary{background:var(--c-accent) !important; color:#fff !important; + border:1px solid var(--c-accent) !important;} +.gradio-container button.primary:hover{background:var(--c-accent-hover) !important; + border-color:var(--c-accent-hover) !important;} +.gradio-container button.secondary{background:var(--c-surface) !important; + color:var(--c-text) !important; border:1px solid var(--c-border) !important;} +.gradio-container button.secondary:hover{border-color:var(--c-accent) !important; + color:var(--c-sage-deep) !important;} +.gradio-container button.huggingface{background:var(--c-surface) !important; + color:var(--c-text) !important; border:1px solid var(--c-border) !important; + border-radius:var(--r-md) !important;} +.gradio-container button.huggingface:hover{border-color:var(--c-accent) !important;} +/* Focus is the accent, everywhere, and only on focus. */ +.gradio-container :is(button,a,input,textarea,select,[role="button"]):focus-visible{ + outline:3px solid rgba(30,110,75,.4) !important; outline-offset:2px !important;} +/* Gradio's multipage navbar duplicates the quick nav; the page carries its + own way back. Belt and braces beside gr.Navbar(visible=False). */ +nav.navbar, .gradio-container .navbar{display:none !important;} + +/* ---- Answer artifacts: show the thing that came out -------------------- */ +/* A run that produced a file shows the file's own content, styled as the + kind of thing it is, inside the answer. The GIF demos end on this block, + because "generate a PDF" is only demonstrated by a PDF appearing. */ +.c-made{margin:var(--s3) 0 0; display:flex; flex-direction:column; gap:var(--s3);} +.c-madecard{background:var(--c-surface); border:1px solid var(--c-hairline); + border-radius:var(--r-md); overflow:hidden; max-width:520px; + box-shadow:var(--e1);} +.c-madecard__bar{display:flex; align-items:center; gap:var(--s2); + padding:8px var(--s3); border-bottom:1px solid var(--c-hairline); + background:var(--c-fill);} +.c-madecard__dot{width:8px; height:8px; border-radius:50%; background:var(--c-accent); flex:none;} +.c-madecard__name{font-family:var(--mono); font-size:12px; color:var(--c-text); + overflow:hidden; text-overflow:ellipsis; white-space:nowrap;} +.c-madecard__kind{margin-left:auto; flex:none; font-size:var(--t-micro); color:var(--c-muted); + letter-spacing:.05em; text-transform:uppercase;} +/* A glance, not a document viewer. The preview sits inside a conversation + and has to read as one object at one glance; at 340px it was a scrolling + panel taller than most of the answers around it. */ +.c-madecard__body{padding:var(--s3) var(--s4); max-height:210px; overflow:hidden; + position:relative;} +/* What is cut off is said with a fade rather than left as a hard edge, so a + truncated preview reads as "there is more in the file" instead of as a + rendering fault. The file itself is complete in Outputs. */ +.c-madecard__body::after{content:""; position:absolute; left:0; right:0; bottom:0; + height:34px; pointer-events:none; + background:linear-gradient(to bottom, transparent, var(--c-surface));} +/* A document page: a white sheet with real margins and the actual text. */ +.c-made--doc .c-madecard__body{font-family:Georgia,'Times New Roman',serif; + color:#26241F; line-height:1.6; font-size:13.5px;} +.c-made--doc .c-madecard__body h4{margin:0 0 8px; font-size:16px; font-weight:700;} +.c-made--doc .c-madecard__body p{margin:0 0 8px;} +/* A sheet: a real grid of the actual cells. */ +.c-madegrid{border-collapse:collapse; width:100%; font-size:12px; font-family:var(--font);} +.c-madegrid th{background:var(--c-fill); font-weight:650; text-align:left;} +.c-madegrid th,.c-madegrid td{border:1px solid var(--c-hairline); padding:4px 8px; + white-space:nowrap; max-width:180px; overflow:hidden; text-overflow:ellipsis;} +/* A deck: each slide a 16:9 miniature with its actual title. */ +.c-madeslides{display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); + gap:var(--s2);} +.c-madeslide{aspect-ratio:16/9; border:1px solid var(--c-hairline); border-radius:6px; + background:#fff; padding:8px; display:flex; flex-direction:column; gap:3px; overflow:hidden;} +.c-madeslide__no{font-size:9px; color:var(--c-muted);} +.c-madeslide__title{font-size:11px; font-weight:650; color:var(--c-text); line-height:1.25;} +.c-madeslide__line{height:3px; border-radius:2px; background:var(--c-fill); width:86%;} +.c-madeslide__line+.c-madeslide__line{width:70%;} +/* Code or plain text: the content itself, monospaced. */ +.c-made--text .c-madecard__body{padding:0;} +.c-made--text .c-madecard__body::after{height:30px;} +/* One height for every preview, whatever is inside it. The code preview kept + its own taller cap, which meant a stylesheet came back twice the height of + a document and the shelf of results had no common measure. */ +.c-made--text pre{margin:0; padding:var(--s3) var(--s4); font-family:var(--mono); + font-size:12px; line-height:1.55; color:var(--c-text); overflow:hidden; max-height:210px; + white-space:pre-wrap; overflow-wrap:anywhere;} +.c-made__foot{padding:6px var(--s3); border-top:1px solid var(--c-hairline); + font-size:var(--t-micro); color:var(--c-muted);} + @media (max-width:700px){ - .c-libgrid{grid-template-columns:1fr 1fr; gap:var(--s3);} + .c-libgrid{grid-template-columns:1fr; gap:var(--s3);} .c-quicknav{justify-content:flex-start;} -} -@media (max-width:460px){ - .c-libgrid{grid-template-columns:1fr;} + .c-libpage{padding:var(--s4) var(--s4) var(--s7);} + .c-madecard{max-width:none;} } """ diff --git a/distinct_server/render.py b/distinct_server/render.py index e10d792c3a36f4c8b868851b57b5f57cbf0d2fac..03063e50dac8fde609d11917415a93df3ebe7778 100644 --- a/distinct_server/render.py +++ b/distinct_server/render.py @@ -37,6 +37,8 @@ from typing import Optional __all__ = [ "activity", + "assessment_legend", + "assessment_section", "chip", "comparator", "credit", @@ -44,20 +46,18 @@ __all__ = [ "empty_state", "energy_headline", "energy_panel", - "format_joules", "esc", + "figure_token", "footer", - "grade_token", + "format_joules", "header", "join_this_server", "library_help", "library_summary", "live_steps", - "model_grade_card", + "model_evidence_card", "no_tools_note", "notice", - "rubric_legend", - "rubric_section", "run_receipts", "section_heading", "spinner", @@ -221,7 +221,7 @@ def join_this_server(*, addresses, code: str, qr: str = "", tools: str = "local" # into every shell anybody actually uses. command = ( f"python -m distinct_agent --server {first} " - f"--pair {code or 'YOUR-CODE'} --models qwen3-0.6b --tools {tools or 'local'}" + f"--pair {code or 'YOUR-CODE'} --models olmoe-1b-7b-0924-instruct --tools {tools or 'local'}" ) picture = f'
{qr}
' if qr else "" return ( @@ -261,14 +261,13 @@ def library_summary(*, shown: int, matched: int, total: int, chosen: int) -> str else: body = f"All {total} members." kept = ( - "No defaults chosen yet." + "Tap a card to make it a default — it saves at once." if not chosen - else f"{chosen} chosen as {'a default' if chosen == 1 else 'defaults'}." + else f"{chosen} saved as {'a default' if chosen == 1 else 'defaults'}." ) return ( - '

' - f"{esc(body)} {esc(kept)} A default is ticked automatically when a worker " - "offers it, and can be unticked for any single run.

" + '
' + f"{esc(body)} {kept}
" ) @@ -845,6 +844,369 @@ STEP_LEAD = { } +# -------------------------------------------------------------------------- +# What the run made: the artifact's own content, in the answer +# -------------------------------------------------------------------------- +# +# A run that produced a file used to say so with a count in the receipt and a +# row in the Outputs panel. Both are true and neither shows the thing. These +# two functions close that gap: `artifact_preview_data` reads the stored file +# once, at the moment the answer is claimed, and reduces it to a small plain +# record; `made_things` renders those records as the kind of object each one +# is — a document page, a sheet of cells, a fan of slides, the text itself. +# +# The split matters. Derivation happens once and the record rides in browser +# state beside the answer, so the transcript can re-render every two seconds +# without re-opening zip files. And because the record is data assembled here +# from bytes the worker sent, rendering it is the same trust exercise as the +# rest of this file: every string is escaped, structure comes from this +# module, and a file that cannot be parsed degrades to its name and size +# rather than to an error. + +#: Reading cap per artifact. Files are small (the job budget bounds them); +#: this is the backstop that keeps a surprise out of the render path. +_PREVIEW_READ_CAP = 400_000 + +_TEXT_SUFFIXES = { + ".txt", ".css", ".json", ".mermaid", ".py", ".js", ".html", ".svg", + ".yaml", ".yml", ".toml", ".xml", +} + + +def _xml_texts(blob: bytes, pattern: str) -> list[str]: + import re as _re + + return [ + escape_entities(match) + for match in _re.findall(pattern, blob.decode("utf-8", "replace"), _re.S) + ] + + +def escape_entities(text: str) -> str: + """Resolve the five XML entities OOXML writes; nothing else.""" + + return ( + text.replace("<", "<").replace(">", ">").replace(""", '"') + .replace("'", "'").replace("&", "&") + ) + + +def _docx_preview(blob: bytes) -> Optional[Mapping[str, object]]: + import io as _io + import re as _re + import zipfile as _zipfile + + try: + with _zipfile.ZipFile(_io.BytesIO(blob)) as archive: + document = archive.read("word/document.xml") + except Exception: + return None + paragraphs: list[str] = [] + for paragraph in _re.findall(rb"].*?", document, _re.S): + runs = _xml_texts(paragraph, r"]*>(.*?)") + text = "".join(runs).strip() + if text: + paragraphs.append(text) + if not paragraphs: + return None + return {"kind": "doc", "title": paragraphs[0][:160], "paras": paragraphs[1:5]} + + +def _xlsx_preview(blob: bytes) -> Optional[Mapping[str, object]]: + import io as _io + import re as _re + import zipfile as _zipfile + + try: + with _zipfile.ZipFile(_io.BytesIO(blob)) as archive: + sheet = archive.read("xl/worksheets/sheet1.xml") + try: + shared = archive.read("xl/sharedStrings.xml") + except KeyError: + shared = b"" + except Exception: + return None + strings = _xml_texts(shared, r"]*>(.*?)") if shared else [] + rows: list[list[str]] = [] + # CELLS IN DOCUMENT ORDER, WHATEVER KIND THEY ARE. + # + # The first version of this pulled the numbers out with one pattern and + # the inline strings with another, then concatenated the two lists. Every + # mixed row came out rotated — "Widget | 4 | 9.50" rendered as + # "4 | 9.50 | Widget" — because the text cells were appended after the + # numeric ones rather than kept in their columns. A preview that reorders + # somebody's spreadsheet is worse than no preview, so the cells are now + # walked once, in order, and each is read according to its own type. + for row in _re.findall(rb"].*?", sheet, _re.S)[:8]: + cells: list[str] = [] + for cell in _re.findall(rb"].*?(?:|/>)", row, _re.S): + kind = _re.search(rb'\st="(\w+)"', cell) + kind = kind.group(1).decode() if kind else "n" + inline = _xml_texts(cell, r"]*>(.*?)") + if inline: + cells.append(inline[0]) + continue + value = _re.search(rb"(.*?)", cell, _re.S) + if value is None: + cells.append("") + continue + raw = escape_entities(value.group(1).decode("utf-8", "replace")) + if kind == "s": + try: + raw = strings[int(raw)] + except (ValueError, IndexError): + pass + cells.append(raw) + while cells and cells[-1] == "": + cells.pop() + if cells: + rows.append(cells[:8]) + if not rows: + return None + return {"kind": "sheet", "rows": rows} + + +def _pptx_preview(blob: bytes) -> Optional[Mapping[str, object]]: + import io as _io + import re as _re + import zipfile as _zipfile + + try: + with _zipfile.ZipFile(_io.BytesIO(blob)) as archive: + names = sorted( + name + for name in archive.namelist() + if _re.fullmatch(r"ppt/slides/slide\d+\.xml", name) + ) + slides: list[Mapping[str, str]] = [] + for name in names[:8]: + texts = _xml_texts(archive.read(name), r"(.*?)") + texts = [text for text in (t.strip() for t in texts) if text] + if texts: + slides.append({"title": texts[0][:120]}) + except Exception: + return None + if not slides: + return None + return {"kind": "deck", "slides": slides} + + +def _pdf_preview(blob: bytes) -> Optional[Mapping[str, object]]: + import re as _re + import zlib as _zlib + + pages = len(_re.findall(rb"/Type\s*/Page\b(?!s)", blob)) + # Content streams are flate-compressed (the PDF this product writes says so + # in its own builder), so the text operators only exist after inflating. + # Streams that will not inflate are skipped rather than guessed at, and a + # PDF nobody can read still reports its page count, which is a fact. + chunks = [blob] + for raw in _re.findall(rb"stream\r?\n(.*?)\r?\nendstream", blob, _re.S): + try: + chunks.append(_zlib.decompress(raw)) + except Exception: + continue + lines: list[str] = [] + seen: set[str] = set() + for chunk in chunks: + for raw in _re.findall(rb"\(((?:[^()\\]|\\.)*)\)\s*Tj", chunk): + text = raw.decode("latin-1", "replace") + text = _re.sub(r"\\([()\\])", r"\1", text).strip() + if text and text not in seen: + seen.add(text) + lines.append(text) + if len(lines) >= 14: + break + lines = lines[:14] + if not lines and not pages: + return None + record: dict[str, object] = {"kind": "doc", "note": f"{pages or 1} page PDF"} + if lines: + record["title"] = lines[0][:160] + record["paras"] = lines[1:5] + else: + record["title"] = "PDF document" + record["paras"] = [] + return record + + +def _markdown_preview(text: str) -> Optional[Mapping[str, object]]: + """Markdown as the page it describes, not as its source. + + A guide rendered as a wall of hashes and asterisks demonstrates nothing: + the person is looking at the thing the run made, and the thing the run + made is a document. Headings become the title, bullets keep their bullet, + and everything else is a paragraph. + """ + + lines = [line.rstrip() for line in text.splitlines()] + title = "" + paras: list[str] = [] + for line in lines: + stripped = line.strip() + if not stripped: + continue + if stripped.startswith("#"): + heading = stripped.lstrip("#").strip() + if not title: + title = heading[:160] + elif len(paras) < 4: + paras.append(heading[:200]) + continue + if stripped.startswith(("-", "*", "+")) and len(stripped) > 1: + stripped = "• " + stripped[1:].strip() + cleaned = stripped.replace("**", "").replace("`", "") + if not title: + title = cleaned[:160] + elif len(paras) < 4: + paras.append(cleaned[:200]) + if len(paras) >= 4: + break + if not title: + return None + return {"kind": "doc", "title": title, "paras": paras} + + +def _table_preview(text: str) -> Optional[Mapping[str, object]]: + rows = [line for line in text.splitlines() if line.strip()][:8] + if not rows: + return None + split = [row.split(",") if "," in rows[0] else row.split("|") for row in rows] + return {"kind": "sheet", "rows": [[cell.strip() for cell in row][:8] for row in split]} + + +def artifact_preview_data(paths: Sequence[str]) -> list[Mapping[str, object]]: + """Small, renderable records of what a run's files contain. + + Read once per file, capped, every failure downgraded to name-and-size. + The records are plain data so they can live in browser state beside the + answer they belong to. + """ + + records: list[Mapping[str, object]] = [] + for item in paths: + path = Path(str(item)) + try: + size = path.stat().st_size + blob = path.read_bytes()[:_PREVIEW_READ_CAP] + except OSError: + continue + suffix = path.suffix.lower() + parsed: Optional[Mapping[str, object]] = None + if suffix == ".docx": + parsed = _docx_preview(blob) + elif suffix == ".xlsx": + parsed = _xlsx_preview(blob) + elif suffix == ".pptx": + parsed = _pptx_preview(blob) + elif suffix == ".pdf": + parsed = _pdf_preview(blob) + elif suffix == ".csv": + parsed = _table_preview(blob.decode("utf-8", "replace")) + elif suffix == ".md": + parsed = _markdown_preview(blob.decode("utf-8", "replace")) + elif suffix in _TEXT_SUFFIXES: + text = blob.decode("utf-8", "replace").strip() + parsed = {"kind": "text", "text": text[:1400]} if text else None + record: dict[str, object] = { + "name": path.name, + "size": size, + "kind": "file", + } + if parsed: + record.update(parsed) + records.append(record) + return records + + +def _human_size(size: object) -> str: + try: + value = float(size) # type: ignore[arg-type] + except (TypeError, ValueError): + return "" + if value >= 1_048_576: + return f"{value / 1_048_576:.1f} MB" + if value >= 1024: + return f"{value / 1024:.1f} KB" + return f"{int(value)} B" + + +_MADE_KIND_WORDS = { + "doc": "document", + "sheet": "spreadsheet", + "deck": "slides", + "text": "text", + "file": "file", +} + + +def made_things(previews: Sequence[Mapping[str, object]]) -> str: + """The artifacts a run produced, rendered as the things they are. + + Structure is fixed here; every string is escaped; a record whose kind is + unknown renders as a plain file card. The block sits inside the answer, + after the model's words, because "make me a PDF" is answered by the PDF. + """ + + if not previews: + return "" + cards: list[str] = [] + for record in previews: + if not isinstance(record, Mapping): + continue + name = esc(str(record.get("name") or "file")) + kind = str(record.get("kind") or "file") + kind_word = _MADE_KIND_WORDS.get(kind, "file") + body = "" + if kind == "doc": + title = esc(str(record.get("title") or "")) + paras = "".join( + f"

{esc(str(para))}

" for para in record.get("paras") or () + if isinstance(para, str) + ) + body = f"

{title}

{paras}" if title else paras + elif kind == "sheet": + rows = [row for row in record.get("rows") or () if isinstance(row, (list, tuple))] + if rows: + head = "".join(f"{esc(str(cell))}" for cell in rows[0]) + rest = "".join( + "" + "".join(f"{esc(str(cell))}" for cell in row) + "" + for row in rows[1:] + ) + body = f'{head}{rest}
' + elif kind == "deck": + slides = [ + slide for slide in record.get("slides") or () if isinstance(slide, Mapping) + ] + body = '
' + "".join( + f'
{index}' + f'{esc(str(slide.get("title") or ""))}' + '' + "
" + for index, slide in enumerate(slides, start=1) + ) + "
" + elif kind == "text": + body = f"
{esc(str(record.get('text') or ''))}
" + note = str(record.get("note") or "") + size = _human_size(record.get("size")) + foot_parts = [part for part in (note, size, "in Outputs, left panel") if part] + modifier = kind if kind in ("doc", "sheet", "deck", "text") else "file" + cards.append( + f'
' + '
' + '' + f'{name}' + f'{esc(kind_word)}' + "
" + + (f'
{body}
' if body else "") + + f'
{esc(" · ".join(foot_parts))}
' + "
" + ) + if not cards: + return "" + return '
' + "".join(cards) + "
" + + def run_steps(steps: Sequence[Mapping[str, object]]) -> str: """The agent's turns, in order, kept after the run that took them. @@ -891,11 +1253,12 @@ def run_steps(steps: Sequence[Mapping[str, object]]) -> str: #: The wash each conversation state gets in the rail. Faint on purpose: see #: the note in presentation.py. A state with no entry gets no wash, which is -#: how "idle" and "completed" are drawn. +#: how "idle" and "completed" are drawn. Warm washes over the ivory canvas: +#: the only saturated green on the page stays the accent. CONVERSATION_TONES = { - "waiting": "#FBF6E8", - "generating": "#EAF3E6", - "failed": "#F9EDE8", + "waiting": "#F7F1E1", + "generating": "#E8F0EA", + "failed": "#F7ECE7", } @@ -1185,18 +1548,28 @@ _DEMO_DIR = (Path(__file__).resolve().parent.parent / "assets" / "library-demos" _DEMO_BASE = f"/gradio_api/file={_DEMO_DIR.as_posix()}" -def _demo_gif(ref: str) -> str: - """The demo GIF's URL for a library member, or nothing. +def _demo_media(ref: str) -> tuple[str, str]: + """``(poster, gif)`` URLs for a member's demonstration, either may be empty. - The file is looked for on disk at render time so a card never promises a + Both are looked for on disk at render time so a card never promises a demonstration the repository does not carry. Slug: the ref with ``@`` and ``.`` flattened, which is how the recorder names them. + + The poster is the recording's last frame — the artifact the run produced — + so a card at rest already shows what the member makes. That matters most + on a phone, where there is no hover and the GIF is a deliberate act. """ slug = ref.replace("@", "-").replace(".", "-") - if (_DEMO_DIR / f"{slug}.gif").is_file(): - return f"{_DEMO_BASE}/{slug}.gif" - return "" + poster = f"{_DEMO_BASE}/{slug}.webp" if (_DEMO_DIR / f"{slug}.webp").is_file() else "" + gif = f"{_DEMO_BASE}/{slug}.gif" if (_DEMO_DIR / f"{slug}.gif").is_file() else "" + return poster, gif + + +def _demo_gif(ref: str) -> str: + """The demo GIF's URL for a library member, or nothing.""" + + return _demo_media(ref)[1] def library_cards(rows: Sequence[Mapping[str, object]], chosen: Sequence[str]) -> str: @@ -1222,24 +1595,37 @@ def library_cards(rows: Sequence[Mapping[str, object]], chosen: Sequence[str]) - name = str(row.get("name", ref)) author = str(row.get("author", "distinct")) description = str(row.get("description", "")) - gif = _demo_gif(ref) - media = ( - f'
' - '' - "
Hover or hold to preview
" - "
" - if gif - else "" - ) - default_mark = ( - 'default' if ref in picked else "" - ) + poster, gif = _demo_media(ref) + media = "" + if poster or gif: + still = ( + f'' + if poster + else "" + ) + media = ( + f'
' + f"{still}" + 'watch it work' + '
' + "Hover, or press and hold, to play this member's demonstration" + "
" + "
" + ) + on = ref in picked + # The card itself is the control: role, state and keyboard focus are + # its own, and the check mark is drawn by the stylesheet from the + # ``is-on`` class so the page script and this renderer cannot + # disagree about what selected looks like. cards.append( - f'
' + f'
' + f'' f"{media}" '
' f'{esc(kind)}' - f"{default_mark}" "
" f'

{esc(name)}

' f'

by {esc(author)}

' @@ -1501,253 +1887,231 @@ def _safe_url(value: object) -> str: #: reader who conflates them draws exactly the wrong conclusion, so each token #: carries its own scale name inside it rather than relying on a column header #: that may be scrolled away, screenshotted off, or read past. -PERFORMANCE = "performance" -EVIDENCE = "evidence" - -_SCALE_LABELS: Mapping[str, str] = { - PERFORMANCE: "impact", - EVIDENCE: "evidence", +#: Method words this surface knows, and the modifier each one paints with. +#: A word outside this map is rendered verbatim but styled as unknown rather +#: than silently promoted into one of the confident states. +_METHOD_SLUGS: Mapping[str, str] = { + "Measured": "measured", + "Modelled": "modelled", + "Proxy-based": "proxy", } -def grade_token( - letter: Optional[str], +def figure_token( *, - scale: str = PERFORMANCE, - assessed: Optional[int] = None, - total: Optional[int] = None, - absent_word: str = "not assessed", + value: str = "", + unit: str = "", + status: str = "", + absent_word: str = "Missing", ) -> str: - """One score, as one indivisible unit. + """One published figure, or one explicit absence, as one indivisible unit. - Three rules are enforced here rather than left to the caller. + This replaces the letter grade that used to sit here, and the replacement is + the point rather than a restyling. A letter was this catalogue's ranking of + somebody else's number; a figure is the number. Three rules survive from the + grade token because they were never about letters: - **A missing value is never a letter.** Not an F, not a D, not a dash in a - letter-shaped box. It is a dashed lozenge carrying words, which differs from - a grade in shape, fill, case and content. An absence drawn as a low grade - asserts a poor result that nobody measured. + **An absence is never a low value.** Missing is a dashed lozenge carrying a + word, differing from a figure in shape, fill and content. Nobody measured it, + so nothing may be drawn that looks like a small result. - **A performance letter never appears without its coverage.** They are one - token with one border, not a letter with a caption beside it, because a - caption can be cropped, skimmed or read as belonging to the next row. "B" - over two of six areas is not a B, and this is the markup that makes the two - impossible to separate. + **A figure never appears without its method.** "54 MWh" measured at the + socket and "54 MWh" inferred from a chip's rated wattage are different + claims, and a method printed as a caption beside the number can be cropped, + skimmed, or read as belonging to the next row. One token, one border. - **The two scales are told apart by more than a column heading.** A - performance letter is a filled square on a pill; an evidence letter is - outlined; and both name their own scale inside the token. + **Nothing is computed here.** Value, unit and method are passed straight + through. There is no code path that could derive one from the others. """ - scale_key = scale if scale in _SCALE_LABELS else PERFORMANCE - name = _SCALE_LABELS[scale_key] - tag = f'{esc(name)}' - - if letter is None or not str(letter).strip(): - # ``absent_word`` distinguishes the two absences the rubric names: - # "not assessed" (nothing published) and "withheld" (published, but - # coverage too thin for an overall letter). Both are absences, never - # letters, and a withheld overall still carries its coverage so the - # reader can see why it was withheld. - word = esc(absent_word if str(absent_word).strip() else "not assessed") - coverage = "" - if assessed is not None and total is not None: - coverage = ( - f'{esc(assessed)} of {esc(total)}' - ) + text = str(value).strip() + if not text: + word = esc(str(absent_word).strip() or "Missing") return ( - f'' - f'{tag}{word}{coverage}' - ) - - body = f'{esc(letter)}' - if assessed is not None and total is not None: - body += ( - f'{esc(assessed)} of {esc(total)}' + '' + f'{word}' ) - return f'{tag}{body}' - - -def rubric_legend() -> str: - """Two scales, what each one answers, and the case where they disagree. - - The worked example is the load-bearing part. Both misreadings this guards - against are the first reading most people take, so the legend shows them - happening rather than only warning against them. - """ + method = str(status).strip() + slug = _METHOD_SLUGS.get(method, "unknown") + shown = f"{text} {unit}".strip() if str(unit).strip() else text return ( - '
' - '

Two scales, two questions

' - '
' - '
' - + grade_token("A", scale=PERFORMANCE, assessed=6, total=6) - + '

Impact. How heavily the release ' - "weighed on energy, water, land and the rest. A is the lightest. The coverage inside " - "the token is part of the score: a letter drawn from two areas out of six describes " - "two areas out of six, and the other four are unknown rather than fine.

" - "
" - '
' - + grade_token("A", scale=EVIDENCE) - + '

Evidence. How good the published ' - "working is: method, boundary, primary sources. It says nothing about the size of " - "the impact, only about how much you can rely on the figure beside it.

" - "
" - "
" - '

?The two come apart, and that is the ' - "point. Lucie-7B has the best method quality of anything reviewed here and " - "still carries no impact letter, because too few areas have a published result to " - "score. A smaller model can show a B on the strength of a single measurement. The " - "high-evidence model is the better-documented one; the B is the thinner claim." - "

" - '

Cradle to release. Never added to, and never compared ' - "with, the use-phase energy this network measures per run.

" - "
" + f'' + f'{esc(shown)}' + f'{esc(method or "method not stated")}' + "" ) -def _category_cell(entry: object) -> str: - """Render one category cell in one of its three states. +def _source_row(entry: Mapping[str, object]) -> str: + """One area's working: what the note says, and where the number came from.""" - A tuple ``(label_ignored, letter)`` is the legacy grade-or-absent form. A - mapping carries the display contract's full state vocabulary: - - * ``state == "grade"``: render the letter (with its value as detail text); - * ``state == "reported"``: render the published value, never a letter, - because the value is not in the reference's unit; - * anything else: an explicit "not assessed" absence. - """ - - if isinstance(entry, Mapping): - state = str(entry.get("state") or "not_assessed") - letter = entry.get("letter") - value = entry.get("value") - if state == "grade" and letter is not None and str(letter).strip(): - token = grade_token(str(letter), scale=PERFORMANCE) - if isinstance(value, str) and value.strip(): - token += f'{esc(value)}' - return token - if state == "reported" and isinstance(value, str) and value.strip(): - return ( - f'' - 'impact' - f'{esc(value)} · reported, no letter' - "" - ) - return grade_token(None, scale=PERFORMANCE) - return grade_token(entry, scale=PERFORMANCE) + label = esc(str(entry.get("label") or "")) + note = str(entry.get("note") or "") + href = _safe_url(entry.get("source_url")) + cite = ( + f'primary source' + if href + else "" + ) + body = esc(note) if note else "No note recorded." + return ( + '

' + f"{label}{body} {cite}

" + ) -def model_grade_card( +def model_evidence_card( *, name: str, - impact: Optional[str], - assessed: int, - total: int, - evidence: Optional[str] = None, - evidence_detail: str = "", - categories: Sequence[object] = (), - download_url: str = "", - download_label: str = "", + coverage: str = "", + summary: str = "", + covers: str = "", + categories: Sequence[Mapping[str, object]] = (), + links: Sequence[Mapping[str, str]] = (), note: str = "", - impact_absent_word: str = "not assessed", ) -> str: - """One model release, on both scales. - - ``impact`` and ``evidence`` are passed straight through and are **never - derived here**. When the catalogue withholds one, this renders an explicit - absence. Computing a letter from partial categories is exactly the - assessor-created estimate the rubric prohibits, so there is no code path - that could, and the coverage that caused the absence travels inside the - token that reports it. - - ``categories`` entries are either legacy ``(label, letter)`` tuples or - mappings ``{"label", "state", "letter", "value"}`` following the display - contract in ``model_assessments.json``: read ``state`` before rendering - anything, and never render a letter for a category whose state is not - ``grade``. - """ + """One model release, showing what was published about it and nothing else. - def _label(entry: object) -> str: - if isinstance(entry, Mapping): - return str(entry.get("label") or "") - if isinstance(entry, Sequence) and not isinstance(entry, str) and entry: - return str(entry[0]) - return "" + Every area is always present. An area with no published result renders the + word rather than being dropped, because a six-row card missing three rows + reads as a model with three areas rather than a model with three unknowns. - def _cell(entry: object) -> str: - if isinstance(entry, Mapping): - return _category_cell(entry) - if isinstance(entry, Sequence) and not isinstance(entry, str) and len(entry) >= 2: - return _category_cell(entry[1]) - return _category_cell(None) + The workings sit behind a disclosure rather than on the face of the card: + six notes and six citations inline would bury the figures, and hiding them + entirely would make the figures unverifiable. Complete, one click away. + """ rows = "".join( - f'

{esc(_label(entry))}' - f"{_cell(entry)}

" + '

' + f'{esc(str(entry.get("label") or ""))}' + + figure_token( + value=str(entry.get("value") or ""), + unit=str(entry.get("unit") or ""), + status=str(entry.get("status") or ""), + ) + + "

" for entry in categories ) - href = _safe_url(download_url) - link = ( + link_html = "".join( f'{esc(download_label or "Weights on Hugging Face")}' - if href - else "" + f'rel="noopener noreferrer">{esc(str(link.get("label") or "Source"))}' + for link in links + if (href := _safe_url(link.get("url"))) ) - reason = f'

{esc(note)}

' if note else "" - evidence_note = ( - f'{esc(evidence_detail)}' - if evidence_detail + sources = "".join(_source_row(entry) for entry in categories) + workings = ( + "
" + "Where these figures come from" + f'
{sources}
' + if sources else "" ) + + head_coverage = ( + f'{esc(coverage)}' if coverage else "" + ) return ( '
' '

' - f'{esc(name)}{link}

' - '
' - + grade_token( - impact, - scale=PERFORMANCE, - assessed=assessed, - total=total, - absent_word=impact_absent_word, - ) - + grade_token(evidence, scale=EVIDENCE) - + evidence_note - + "
" + f'{esc(name)}{head_coverage}

' + + (f'

{esc(summary)}

' if summary else "") + (f'
{rows}
' if rows else "") - + reason + + (f'

Covers. {esc(covers)}

' if covers else "") + + workings + + (f'

{esc(note)}

' if note else "") + + (f'' if link_html else "") + "
" ) -def rubric_section(cards: Iterable[str], *, warning: str = "") -> str: - """The legend, the assessment set's warning, and the model cards. +def assessment_legend() -> str: + """What the words mean, and the two readings this surface has to prevent. + + The legend used to explain two letter scales and the case where they + disagree. There are no letters now, so it explains the two things a reader + can still get wrong: that Missing is a result, and that a small number is + a good model. + """ + + return ( + '
' + '

How to read these

' + '
' + '
' + + figure_token(value="54", unit="MWh", status="Measured") + + '

A figure and its method. ' + "Measured means somebody metered the hardware. Modelled means they computed it " + "from something they did meter, or from rated specifications. The number is " + "reproduced exactly as published; nothing here is converted, scaled or combined." + "

" + "
" + '
' + + figure_token() + + '

Missing is not zero. ' + "It means nobody published a usable result for that area. It is not a low score, " + "not a failure, and not evidence that the impact was small. Every area is shown " + "for every model so an absence has to be stated rather than quietly omitted.

" + "
" + "
" + '

?A smaller number is not automatically ' + "a better model. One OLMo 7B shows zero carbon and zero water because it " + "trained on hydroelectric power in Finland, while still drawing more electricity " + "than any other 7B in its cohort. Another drank four times the water of its sibling " + "for no reason except which state the data centre stood in. Read the figure with " + "the area beside it, and read both with where the run happened." + "

" + '

Cradle to release. Never added to, and never compared ' + "with, the use-phase energy this network measures per run.

" + "
" + ) + + +def assessment_section( + cards: Iterable[str], + *, + warning: str = "", + further_reading: Sequence[Mapping[str, str]] = (), +) -> str: + """The legend, the assessment set's own caveat, the cards, and the reading. - ``warning`` is the data file's own caveat and renders **before** the - grades, as its display contract requires, never in a footnote. + ``warning`` is the data file's caveat and renders **before** the figures, as + its display contract requires, never in a footnote. """ body = "".join(cards) if not body: body = empty_state( - glyph="○", + glyph="\u25cb", title="No assessed releases", body=( "No model in this catalogue has a published, model-specific assessment " - "recorded here yet. Nothing is graded until one exists." + "recorded here yet. Nothing is shown until one exists." ), ) - caution = ( - f'

{esc(warning)}

' if warning else "" + caution = f'

{esc(warning)}

' if warning else "" + reading = "".join( + f'{esc(str(item.get("label") or "Source"))}' + for item in further_reading + if (href := _safe_url(item.get("url"))) + ) + tail = ( + '

Further reading

' + f'
' + if reading + else "" ) return ( '
' - + rubric_legend() + + assessment_legend() + caution + f'
{body}
' + + tail + "
" ) diff --git a/distinct_server/ui.py b/distinct_server/ui.py index a08ea8649d623597d579a901c6e8feb8d5610e44..b619cc85026f767cf035c124fdaa33dcd6e44a16 100644 --- a/distinct_server/ui.py +++ b/distinct_server/ui.py @@ -50,6 +50,7 @@ from .catalog import ( RELEASE_BOUNDARY, RUBRIC_AREAS, USE_PHASE_BOUNDARY, + AreaStatus, model_choices, ) from .control_plane import ControlPlane @@ -891,30 +892,31 @@ def _tool_line(spec_tools: Sequence[ToolSelection], calls_reported: Optional[int def _catalogue_markdown() -> str: + """The two boundaries in prose, and where the working is. + + This used to print the whole assessment inline as a bullet per model. The + assessment surface now renders the figures, their method, their notes and + their primary sources as cards, so repeating them here produced two copies + of the same claims that could drift apart. What stays is the part the cards + cannot carry: what the two boundaries are, and why they never meet. + """ + lines = [ "#### Release assessment · cradle to release", "", f"_{RELEASE_BOUNDARY}_", "", - "Grades assess **evidence quality only**. They are absolute, never relative " - "between models, and this list is not a ranking. `No data` is not a grade and " - "is not zero.", + "Every model offered here has a published, model-specific assessment of its " + "training. Each figure is shown exactly as its publisher stated it, with the " + "method that produced it and a link to the document it came from, so you can " + "check the claim rather than take ours for it. Nothing on this surface is " + "ranked: a figure and an absence are not two points on one scale, and `Missing` " + "is neither zero nor a low score.", "", - ] - for model_id, manifest in MODEL_CATALOG.items(): - assessment = RELEASE_ASSESSMENT[model_id] - areas = " · ".join( - f"{AREA_LABELS[area]}: {assessment.areas[area].display}" for area in RUBRIC_AREAS - ) - lines.append( - f"- **{manifest.label}** — evidence: {assessment.grade_display} — " - f"weights identity: {manifest.identity_status} — hardware requirement: " - f"{manifest.min_ram_gb:g} GB RAM" - ) - lines.append(f"
{areas}") - if assessment.reason: - lines.append(f"
_{assessment.reason}_") - lines += [ + "Models with no published assessment are not listed. That is a stronger rule " + "than it looks — this project's only claim is about disclosed and measured " + "environmental cost, so a release nobody has published anything about is one " + "it has no business recommending.", "", "#### Use-phase energy · per run", "", @@ -923,7 +925,7 @@ def _catalogue_markdown() -> str: "Shown on each completed run and totalled per conversation, partitioned by " "measurement scope. It is never added to a release figure, and never converted " "into CO2e, water, land, materials or pollution — those conversions would be " - "assessor-created estimates, which the rubric prohibits.", + "assessor-created estimates, which this catalogue does not make.", "", "Minimum RAM is a disclosed hardware requirement of the file, not an " "environmental result. This catalogue deliberately carries no model-size or " @@ -932,29 +934,13 @@ def _catalogue_markdown() -> str: return "\n".join(lines) -#: Where the catalogue will publish the restructured rubric. Owned by the -#: catalogue, read here. Absent for now, which is handled rather than guarded -#: against: the fallback below reads the assessments already in catalog.py, and -#: those are all "no data", which is the state this surface has to render well -#: anyway. +#: Where the catalogue publishes the assessment set. Owned by the catalogue, +#: read here. Absent is handled rather than guarded against: the fallback below +#: reads the assessments in catalog.py, which now carry real published figures, +#: so an absent file degrades to a smaller surface rather than an empty one. ASSESSMENTS_PATH = Path(__file__).resolve().parent.parent / "model_assessments.json" -def _letter(value: Any) -> Optional[str]: - """A single grade letter, or ``None``. Never a substitute for one. - - Anything that is not a plausible letter becomes ``None`` and renders as an - explicit absence. That direction is deliberate and one-way: a malformed - record must be able to degrade into "not assessed", and must never be able - to acquire a letter it was not given. - """ - - if value is None: - return None - text = str(value).strip().upper() - return text if text in {"A", "B", "C", "D", "E", "F"} else None - - def _rubric_display() -> Mapping[str, Any]: """The assessment file's ``website_display`` block, or an empty mapping. @@ -978,71 +964,105 @@ def _rubric_warning() -> str: return warning if isinstance(warning, str) else "" -def _display_card(record: Mapping[str, Any], *, unranked_note: str = "") -> str: - """One ``website_display.models`` record as a grade card. +def _further_reading() -> list[Mapping[str, str]]: + items = _rubric_display().get("further_reading") + if not isinstance(items, (list, tuple)): + return [] + return [ + {"label": str(item.get("label") or ""), "url": str(item.get("url") or "")} + for item in items + if isinstance(item, Mapping) and item.get("url") + ] - State discipline, verbatim from the file's rendering rules: read ``state`` - before rendering anything; never render a letter for a category whose - state is not ``grade``; render the overall's coverage beside it whichever - state it is in; and a withheld overall renders the word "withheld", which - is an absence and not last place. + +#: The published method words this surface will display. Anything else is shown +#: as stated but not painted as one of the confident states, and an area with no +#: value renders as an absence whatever its status field says. +_METHOD_WORDS = frozenset({"Measured", "Modelled", "Proxy-based"}) + + +def _category_rows(record: Mapping[str, Any]) -> list[Mapping[str, Any]]: + """The six areas of one record, in the catalogue's order, always all six. + + State is read before value, per the assessment file's own rendering rules. + A record that omits an area entirely gets an explicit absence rather than a + missing row, because a card with four rows reads as a model with four areas. """ - overall = record.get("overall") if isinstance(record.get("overall"), Mapping) else {} - evidence = record.get("evidence") if isinstance(record.get("evidence"), Mapping) else {} categories = record.get("categories") + categories = categories if isinstance(categories, Mapping) else {} rows: list[Mapping[str, Any]] = [] - if isinstance(categories, Mapping): - for area in RUBRIC_AREAS: - cell = categories.get(area) - cell = cell if isinstance(cell, Mapping) else {} - rows.append( - { - "label": AREA_LABELS.get(area, area), - "state": str(cell.get("state") or "not_assessed"), - "letter": _letter(cell.get("letter")), - "value": cell.get("value") if isinstance(cell.get("value"), str) else None, - } - ) - overall_state = str(overall.get("state") or "withheld") - assessed = overall.get("areas_assessed") - total = overall.get("areas_total") - download = record.get("download") if isinstance(record.get("download"), Mapping) else {} - note_parts = [str(record.get("boundary") or "")] - if unranked_note: - note_parts.insert(0, unranked_note) - return render.model_grade_card( + for area in RUBRIC_AREAS: + cell = categories.get(area) + cell = cell if isinstance(cell, Mapping) else {} + reported = str(cell.get("state") or "missing") == "reported" + value = cell.get("value") + rows.append( + { + "label": AREA_LABELS.get(area, area), + "status": str(cell.get("status") or "") if reported else "", + "value": str(value) if reported and isinstance(value, (str, int, float)) else "", + "unit": str(cell.get("unit") or "") if reported else "", + "note": str(cell.get("note") or ""), + "source_url": str(cell.get("source_url") or "") if reported else "", + } + ) + return rows + + +def _evidence_card(record: Mapping[str, Any], *, note: str = "") -> str: + """One ``website_display.models`` record as an evidence card. + + No letter is computed, because there are no letters. Values, units and + method words are passed through exactly as the file states them; a cell + whose state is not ``reported`` renders as an absence regardless of what + else it carries, so a malformed record can only ever lose a figure, never + acquire one. + """ + + assessed = sum(1 for row in _category_rows(record) if row["value"]) + coverage = str(record.get("coverage") or "").strip() + coverage_text = ( + f"{coverage.lower()} · {assessed} of {len(RUBRIC_AREAS)} areas published" + if coverage and assessed + else "no published result" + ) + links = record.get("links") + links = links if isinstance(links, (list, tuple)) else () + return render.model_evidence_card( name=str(record.get("name") or record.get("model_id") or "unnamed"), - impact=_letter(overall.get("letter")) if overall_state == "grade" else None, - assessed=int(assessed) if isinstance(assessed, int) else 0, - total=int(total) if isinstance(total, int) else 6, - evidence=_letter(evidence.get("letter")), - evidence_detail=str(evidence.get("detail") or ""), - categories=rows, - download_url=str(download.get("url") or record.get("source_url") or ""), - download_label="Weights on Hugging Face" if download.get("url") else "Source", - note=" · ".join(part for part in note_parts if part), - impact_absent_word="withheld" if overall_state != "grade" else "not assessed", + coverage=coverage_text, + summary=str(record.get("summary") or ""), + covers=str(record.get("covers") or ""), + categories=_category_rows(record), + links=[ + {"label": str(item.get("label") or ""), "url": str(item.get("url") or "")} + for item in links + if isinstance(item, Mapping) and item.get("url") + ], + note=note or str(record.get("boundary") or ""), ) -#: The model selected when a session opens. -DEFAULT_MODEL_ID = "qwen3-0.6b" +#: The model selected when a session opens. The lowest published figures of any +#: assessed release this network can run; see model_assessments.json. +DEFAULT_MODEL_ID = "olmoe-1b-7b-0924-instruct" def _assessment_by_model_id() -> Mapping[str, Mapping[str, Any]]: - """``website_display.models`` keyed by model id, exact matches only. + """``website_display.models`` keyed by record id, exact matches only. Deliberately no fuzzy matching, and no alias table invented here. The - assessment records name releases ("OLMo 2 7B", "OLMo 1B"); the catalogue - names specific quantised checkpoints ("OLMo 2 0425 1B Instruct, Q4_K_M"). - Those are not the same object, and a rubric whose first rule is that a - grade belongs to the thing that was assessed cannot have its own renderer - guessing which grade goes with which file. - - So a catalogue entry gets a grade when the assessment file uses the same - id, and renders as not assessed otherwise. Extending the coverage is a - change to the assessment data, which is where the evidence lives. + assessment records name releases ("OLMo 2 7B", "OLMoE 1B-7B 0924"); the + catalogue names specific quantised checkpoints ("OLMo 2 1124 7B Instruct, + Q4_K_M"). Those are not the same object, and a surface whose first rule is + that a figure belongs to the thing that was assessed cannot have its own + renderer guessing which figure goes with which file. + + So a catalogue entry gets an assessment when ``ASSESSMENT_ASSIGNMENT`` says + which record covers it, and renders as not assessed otherwise. Extending the + coverage is a change to the assessment data, which is where the evidence + lives. """ records = _rubric_display().get("models") @@ -1055,40 +1075,42 @@ def _assessment_by_model_id() -> Mapping[str, Mapping[str, Any]]: } -#: Which assessment record covers which catalogue entry, and what it covers. -#: -#: The rubric's two scales behave differently under this mapping, and the -#: difference is the whole reason the table exists rather than a fuzzy match. +#: Which assessment record covers which catalogue entry, and what it leaves out. #: -#: **Evidence can always transfer within a release, because it grades -#: disclosure.** Whether a publisher published energy, carbon and water for a -#: release is a fact about the publisher's release, and it is the same fact for -#: every checkpoint in it. Silence transfers just as cleanly: Qwen disclosed -#: nothing for Qwen3, so every Qwen3 checkpoint earns the same F. This is what -#: makes "all models are assessed" achievable without inventing anything, and -#: it is the brief's own rule: evidence can always exist, because silence is -#: assessable. +#: This table used to carry an ``impact`` boolean, because the surface had two +#: ordinal scales and one of them could transfer between checkpoints while the +#: other could not. Both scales are gone, and with them the reason for that +#: flag: a published figure either covers the checkpoint being offered or it +#: does not, and where it does not the card says so in words rather than +#: withholding a letter. #: -#: **Impact cannot transfer between checkpoints.** It grades a *published -#: result* against a budget, and a figure published for a 7B model is not a -#: figure for a 1B one. Where the assessed record is a different checkpoint, -#: impact is withheld and says so. Withheld is not last place. -RUBRIC_ASSIGNMENT: Mapping[str, Mapping[str, Any]] = { - "qwen3-0.6b": { - "record": "qwen3-4b", - "impact": False, - "note": "assessed across the Qwen3 release, which discloses nothing", +#: The mapping itself stays, and stays explicit, for the reason it always +#: existed. Every entry below is a *pretraining* result being shown beside an +#: *instruction-tuned* checkpoint built on that pretraining run. That is a +#: partial coverage claim, not a complete one, and it is one substitution away +#: from the thing this catalogue refuses — quietly transferring a figure from +#: one release to another. Writing it down is what keeps the two apart. +ASSESSMENT_ASSIGNMENT: Mapping[str, Mapping[str, Any]] = { + "olmoe-1b-7b-0924-instruct": { + "record": "olmoe-1b-7b-0924", + "note": ( + "Figures cover the 0924 pretraining run; the tuning stage that produced this " + "checkpoint is not separately costed in the source." + ), }, - "qwen3-4b": {"record": "qwen3-4b", "impact": True, "note": ""}, - "olmo-2-1b-instruct": { - "record": "olmo-2-7b", - "impact": False, - "note": "evidence assessed across the OLMo 2 release; no published figure for this checkpoint", + "olmo-2-1124-7b-instruct": { + "record": "olmo-2-1124-7b", + "note": ( + "Figures cover the 1124 pretraining run; the tuning stage that produced this " + "checkpoint is not separately costed in the source." + ), }, - "olmoe-1b-7b-instruct": { - "record": "olmoe-1b-7b", - "impact": False, - "note": "evidence assessed across the OLMoE release; no published figure for this checkpoint", + "llama-2-7b-chat": { + "record": "llama-2-7b", + "note": ( + "Figures cover Llama 2 7B pretraining; Meta report fine-tuning compute inside " + "the family total without breaking it out per checkpoint." + ), }, } @@ -1096,99 +1118,84 @@ RUBRIC_ASSIGNMENT: Mapping[str, Mapping[str, Any]] = { def _assignment(model_id: str) -> tuple[Mapping[str, Any] | None, Mapping[str, Any]]: """``(assessment record, assignment rules)`` for one catalogue model.""" - rules = RUBRIC_ASSIGNMENT.get(model_id) + rules = ASSESSMENT_ASSIGNMENT.get(model_id) if rules is None: return None, {} return _assessment_by_model_id().get(str(rules["record"])), rules -def _grade_suffix(model_id: str) -> str: - """The grade fragment appended to a model's name in the chooser. +def _evidence_suffix(model_id: str) -> str: + """The fragment appended to a model's name in the chooser. - Reads ``state`` before reading ``letter``, per the assessment file's own - rendering rules: a withheld overall renders the word, never a letter, and - coverage always travels with the letter so "E on two of six areas" cannot - be shortened into "E". + A letter used to go here. What replaced it is the fact the letter was + standing in for: which areas somebody actually published, and how. That is + longer, and it is the thing a person choosing a model can act on -- "energy, + climate, water · measured" says what is known; "B" said what we thought of it. """ - record, rules = _assignment(model_id) + record, _ = _assignment(model_id) if record is None: - return "no assessment recorded" - overall = record.get("overall") if isinstance(record.get("overall"), Mapping) else {} - evidence = record.get("evidence") if isinstance(record.get("evidence"), Mapping) else {} - letter = _letter(overall.get("letter")) - if rules.get("impact") and str(overall.get("state") or "") == "grade" and letter: - assessed = overall.get("areas_assessed") - total = overall.get("areas_total") - coverage = ( - f" on {assessed} of {total}" - if isinstance(assessed, int) and isinstance(total, int) - else "" - ) - impact = f"impact {letter}{coverage}" + assessment = RELEASE_ASSESSMENT.get(model_id) + if assessment is None or not assessment.has_any_result: + return "no published assessment" + published = [ + AREA_LABELS[area].split(" /", 1)[0].lower() + for area in RUBRIC_AREAS + if assessment.areas[area].status is not AreaStatus.MISSING + ] + return ", ".join(published) + " published" + + rows = _category_rows(record) + published = [row["label"].split(" /", 1)[0].lower() for row in rows if row["value"]] + if not published: + return "no published assessment" + methods = {row["status"] for row in rows if row["value"] and row["status"] in _METHOD_WORDS} + if methods == {"Measured"}: + method = "measured" + elif "Measured" in methods: + # Not "partly measured", which reads as a hedge about the measuring. + # Some of these figures were metered and some were calculated from the + # metered ones, and both halves of that belong in the phrase. + method = "measured and modelled" + elif methods: + method = "modelled" else: - impact = "impact withheld" - evidence_letter = _letter(evidence.get("letter")) - evidence_part = ( - f"evidence {evidence_letter}" if evidence_letter else "evidence not assessed" - ) - # Evidence first, because the chooser is 280px wide and the operating - # system truncates from the right. With impact leading, every option in - # the list read "Qwen3 0.6B · unsloth · impact with..." and the grade this - # product exists to show was the part that fell off the end. The order is - # a presentation decision about which fact survives a narrow control, not - # a claim that one grade outranks the other; both are still here, and the - # rubric panel still shows them in full. - return " · ".join((evidence_part, impact)) + method = "method not stated" + return f"{', '.join(published)} · {method}" def _short_label(label: str) -> str: """The model's name, without the packager that follows it. - ``model_choices`` yields "Qwen3 0.6B · unsloth"; the part before the first - separator is the model, and that is what a chooser needs. + ``model_choices`` yields "OLMoE 1B-7B 0924 Instruct · Ai2 first-party GGUF"; + the part before the first separator is the model, and that is what a chooser + needs. """ return label.split(" · ", 1)[0].strip() or label -def model_choices_with_grades() -> list[tuple[str, str]]: - """Model options carrying their assessment rather than their RAM figure. +def model_choices_with_evidence() -> list[tuple[str, str]]: + """Model options carrying what was published about them, not their RAM. - Higher letter means lower impact, and the letters are not comparable - across models graded on different categories. That caveat lives in the - rubric panel; what belongs here is the fact that a grade exists at all, - beside the name, at the moment of choosing. + The publisher is dropped from the option text and not from the product: it + is on the worker card, on the assessment card and in the manifest the digest + is checked against. In a 280px control it was 9 characters that pushed the + disclosure out of view. """ - # The publisher is dropped from the option text and not from the product: - # it is on the worker card, in the rubric panel and in the manifest the - # digest is checked against. In a 280px control it was 9 characters that - # pushed the grade out of view. - offered = [ - (f"{_short_label(label)} · {_grade_suffix(model_id)}", model_id) - for label, model_id in model_choices() - if model_id in RUBRIC_ASSIGNMENT - ] - # A model with no assessment is not offered for selection. That is a - # stronger rule than it looks: this product's only claim is about measured - # and disclosed environmental cost, so a model nobody can say anything - # about is a model it has no business recommending. Such entries stay in - # the catalogue, where the rubric panel names them and says what is - # missing, rather than disappearing. - return offered or [ - (f"{_short_label(label)} · {_grade_suffix(model_id)}", model_id) + return [ + (f"{_short_label(label)} · {_evidence_suffix(model_id)}", model_id) for label, model_id in model_choices() ] -def _rubric_cards() -> list[str]: - """Build the grade cards from the assessment file's display block. +def _assessment_cards() -> list[str]: + """Build the evidence cards from the assessment file's display block. - Ranked models first, in the file's impact order (lowest impact first), - then the withheld models under their own marker: unranked is not last - place. No overall letter is computed anywhere in this function; both - scales are read as published or rendered as explicit absences. + Ordering follows the catalogue, and no ordering here implies a ranking: + these are not scores, and two models with published figures in different + areas are not on one scale. """ display = _rubric_display() @@ -1200,41 +1207,51 @@ def _rubric_cards() -> list[str]: for record in records: if isinstance(record, Mapping) and record.get("model_id"): by_id[str(record["model_id"])] = record - ranking = display.get("impact_ranking") - ranking = ranking if isinstance(ranking, Mapping) else {} - ranked_ids = [str(v) for v in ranking.get("order") or () if str(v) in by_id] - withheld_ids = [str(v) for v in ranking.get("withheld") or () if str(v) in by_id] - leftover = [ - model_id - for model_id in by_id - if model_id not in set(ranked_ids) | set(withheld_ids) - ] - withheld_note = str(ranking.get("withheld_note") or "Unranked, not last place.") - for model_id in ranked_ids + leftover: - cards.append(_display_card(by_id[model_id])) - for model_id in withheld_ids: - cards.append(_display_card(by_id[model_id], unranked_note=withheld_note)) + # Catalogue order first, so the surface matches the chooser; anything the + # file carries that the catalogue does not is appended rather than + # dropped, because a record for a model we no longer ship is still a + # published result somebody may be looking for. + seen: set[str] = set() + for model_id in MODEL_CATALOG: + rules = ASSESSMENT_ASSIGNMENT.get(model_id) or {} + record_id = str(rules.get("record") or "") + record = by_id.get(record_id) + if record is None: + continue + seen.add(record_id) + cards.append(_evidence_card(record, note=str(rules.get("note") or ""))) + for record_id, record in by_id.items(): + if record_id not in seen: + cards.append(_evidence_card(record)) return cards - # Fallback: the assessments already in the catalogue. Every one of them is - # "no data", so this is the all-absent rendering, which is the state the - # design has to carry well rather than an edge case to apologise for. + # Fallback: the assessments in the catalogue itself. These now carry real + # published figures rather than a uniform "no data", so an absent or + # unreadable assessment file degrades to a smaller surface rather than an + # empty one. for model_id, manifest in MODEL_CATALOG.items(): assessment = RELEASE_ASSESSMENT[model_id] - # Every area in the current catalogue is Missing, and Missing is not a - # letter, so every row is an explicit absence. Passing None rather than - # mapping a status onto a letter is the whole point: there is no - # translation table here that a future edit could extend into grading - # an absence. - rows = [(AREA_LABELS[area], None) for area in RUBRIC_AREAS] + rows = [ + { + "label": AREA_LABELS[area], + "status": assessment.areas[area].status.value + if assessment.areas[area].status is not AreaStatus.MISSING + else "", + "value": assessment.areas[area].value or "", + "unit": assessment.areas[area].unit or "", + "note": assessment.areas[area].note, + "source_url": assessment.areas[area].source_url or "", + } + for area in RUBRIC_AREAS + ] cards.append( - render.model_grade_card( + render.model_evidence_card( name=manifest.label, - impact=None, - assessed=0, - total=len(RUBRIC_AREAS), - evidence=_letter(assessment.evidence_grade), + coverage=assessment.coverage_display, + summary=assessment.summary, + covers=assessment.covers, categories=rows, + links=list(assessment.links), note=assessment.reason, ) ) @@ -1488,13 +1505,18 @@ class DistinctUI: def _library_page( self, query: str, defaults: Sequence[str] ) -> tuple[Any, str, str]: - """The page a person picks their defaults on: cards, summary, picker.""" + """The page a person picks their defaults on: the transport, then what is drawn. + + The checkbox group is not a second way to choose; it is the same + choice, off the screen, because the framework only reports its own + controls. Every box is labelled with the bare reference so the card + that forwards a click to it can find it by an exact string rather than + by its position in a list that a filter can reorder. + """ rows, matched = self._library_rows(query) total = len(_library_specs()) - choices = [ - (f"{row['name']} · {row['kind']}", row["ref"]) for row in rows - ] + choices = [(row["ref"], row["ref"]) for row in rows] # Defaults outside the current filter are preserved rather than # dropped. Searching is a way of looking, not a way of deselecting, # and a search box that quietly unticked everything it hid would be @@ -1525,16 +1547,19 @@ class DistinctUI: profile: "gr.OAuthProfile | None" = None, request: "gr.Request | None" = None, ) -> tuple[Any, Any, str, str, Any, str]: - """Record the defaults, merging the visible page into the kept set. - - The subtlety is that the component only reports what it can see. A - person who searches "pdf", unticks one member and then searches - "plan" has changed their mind about one member, not about every - member the filter was hiding. So the members currently on screen are - replaced wholesale and everything off screen is left exactly as it - was. + """Record the defaults the page's cards are currently showing as on. + + The merge only ever replaces members currently on screen. Somebody who + searches "pdf", drops one member and then searches "plan" has changed + their mind about one member, not about every member the filter was + hiding, and a page whose whole job is to remember a choice must not + forget one because it was scrolled out of a filter. + + Values arrive from the page's own hidden group and are still filtered + against the library, because a control in a browser is a suggestion. """ + visible_choice = [item for item in visible_choice or () if isinstance(item, str)] rows, _ = self._library_rows(query) on_screen = {row["ref"] for row in rows} previous = set(_library_defaults(state)) @@ -1552,8 +1577,13 @@ class DistinctUI: defaults=_library_defaults(updated), viewer_id=viewer_id, ) - _, summary, cards = self._library_page(query, _library_defaults(updated)) - return updated, updated, summary, cards, selector, note + _group, summary, _cards = self._library_page(query, _library_defaults(updated)) + # The cards are NOT re-rendered here. The click already moved the card + # in the browser, and pushing fresh markup back would rebuild the grid + # under the user's cursor — losing a hover preview mid-play and, on a + # phone, moving the thing they just tapped. The summary updates + # because it is the count, which is the feedback that matters. + return updated, updated, summary, gr.skip(), selector, note # Outputs ---------------------------------------------------------- @@ -1866,7 +1896,9 @@ class DistinctUI: library, library_note = self._library_components( None, defaults=_library_defaults(updated), viewer_id=user_id ) - page, page_summary, page_cards = self._library_page("", _library_defaults(updated)) + page_group, page_summary, page_cards = self._library_page( + "", _library_defaults(updated) + ) return ( updated, updated, @@ -1882,10 +1914,10 @@ class DistinctUI: library_note, self._outputs_component(updated), activity, - # The library page is filled on arrival rather than on first - # open, so a browser that already has defaults shows them ticked - # the moment the accordion is expanded. - page, + # The library page is filled on arrival rather than on first open, + # so a browser that already has defaults shows those cards already + # selected the moment the page is opened. + page_group, page_summary, page_cards, ) @@ -2781,6 +2813,16 @@ class DistinctUI: state["session_id"], job_id, raw_artifacts ) answer["artifacts"] = [Path(item).name for item in stored] + # WHAT THE RUN MADE, READ ONCE. + # + # A file the run produced is the answer to "make me a + # PDF", and until now the transcript said "1 file" and + # left the thing itself in a panel. The preview is + # derived here, at claim time, and travels in browser + # state with the answer: the transcript re-renders + # every two seconds and must never re-open a zip to + # do it. + answer["made"] = render.artifact_preview_data(stored) updated = record_answer(updated, job_id=job_id, answer=answer) if answer is not None: @@ -2828,6 +2870,12 @@ class DistinctUI: _step_messages(answer.get("steps") or (), running=False) ) messages.append({"role": "assistant", "content": str(answer.get("output", ""))}) + # The artifact, immediately under the words that announced it. + # A run whose whole purpose was to produce a file ends on the + # file, not on a sentence about a file. + made = render.made_things(answer.get("made") or ()) + if made: + messages.append({"role": "assistant", "content": made}) status_label = "completed" outcome = "" elif view is None: @@ -3109,15 +3157,18 @@ class DistinctUI: # button below is the one sign-in control, so a header link # would only duplicate it. identity = gr.HTML(_identity_html("")) - # The quick nav sits directly under the identity box: one - # anchor per page-worthy section. Links, not buttons, because - # they navigate rather than act. - gr.HTML( - '" - ) + # The quick nav sits directly under the identity box. The + # library is a destination rather than a section, so its + # control is a button that swaps the view; "Run an agent" is + # still a section of this page, so it stays an anchor. + with gr.Row(elem_classes="c-quicknav"): + open_library = gr.Button( + "Library", size="sm", variant="secondary", + elem_classes="c-quicknav__btn", scale=0, + ) + gr.HTML( + 'Run an agent' + ) # THE SIGN-IN CONTROL, AND WHY IT IS CONDITIONAL. # @@ -3200,7 +3251,7 @@ class DistinctUI: # the model. model = gr.Dropdown( label="Model", - choices=model_choices_with_grades(), + choices=model_choices_with_evidence(), value=DEFAULT_MODEL_ID, container=True, ) @@ -3455,57 +3506,91 @@ class DistinctUI: create_code = gr.Button("Generate pairing code") gr.Markdown() - # THE LIBRARY, AT THE SIZE IT IS GOING TO BE. - # - # The composer's picker shows what the chosen worker is - # actually offering, which is a handful. This page is the - # whole library, which is meant to reach the hundreds, and - # a list of hundreds is only usable through search. What a - # person does here is choose their defaults once; those - # are remembered in this browser and tick themselves on - # every run where a worker offers them. - with gr.Accordion( - "Library", open=True, elem_id="library", - elem_classes="c-library-section", - ): - gr.Markdown( - "Every tool and skill this server can offer, who wrote " - "it, and what it does. Hover a card — or press and hold " - "on a phone — to watch its demonstration. Tick the " - "members you usually want below: they select themselves " - "whenever a worker offers them, and any run can untick " - "them without changing what is saved." - ) - library_search = gr.Textbox( - label="Search the library", - show_label=False, - placeholder="Search by name, reference or what it does…", - container=False, - elem_classes="c-librarysearch", - ) - library_summary = gr.HTML( - render.library_summary(shown=0, matched=0, total=0, chosen=0) - ) - library_cards_html = gr.HTML(elem_classes="c-librarycards") - gr.Markdown("**Your defaults**", elem_classes="c-librarydefaults-head") - library_defaults = gr.CheckboxGroup( - label="Your defaults", - show_label=False, - choices=[], - value=[], - elem_classes="c-librarypage", - ) - - with gr.Accordion("Model grades and the rubric", open=False): + with gr.Accordion("Model assessments and their sources", open=False): gr.HTML( '

' 'Release assessment' 'boundary 2 of 2

' ) gr.HTML( - render.rubric_section(_rubric_cards(), warning=_rubric_warning()) + render.assessment_section( + _assessment_cards(), + warning=_rubric_warning(), + further_reading=_further_reading(), + ) ) + # THE LIBRARY IS A PAGE, NOT A SECTION. + # + # It used to be an accordion at the bottom of the chat page, which + # is where a person found it after scrolling past the conversation, + # the composer and the agent panel — that is a footnote, not a + # destination. It is now a full view of its own, reached from the + # control under the sign-in box and leaving by the same route. + # + # A view rather than a Gradio route, deliberately. A second route + # is a second Blocks with its own state, and the defaults live in + # this browser's own storage beside the transcript; two pages + # writing that one key is how a person loses their history to a + # visit to the library. One Blocks, two views, one copy of the + # state. + with gr.Column(elem_classes="c-libpage", visible=False) as library_view: + close_library = gr.Button( + "\u2190 Back to the conversation", size="sm", + variant="secondary", elem_classes="c-libpage__backbtn", scale=0, + ) + gr.HTML( + '

Library

' + '

Every tool and skill this server can ' + "offer, who wrote it, and what it does. Hover a card — or press " + "and hold on a phone — to watch it work. Tap a card to keep it as " + "a default: it selects itself whenever a worker offers it, and any " + "single run can drop it without changing what is saved.

" + ) + library_search = gr.Textbox( + label="Search the library", + show_label=False, + placeholder="Search by name, reference or what it does…", + container=False, + elem_classes="c-librarysearch", + ) + library_summary = gr.HTML( + render.library_summary(shown=0, matched=0, total=0, chosen=0) + ) + library_cards_html = gr.HTML(elem_classes="c-librarycards") + # THE CARDS ARE THE CONTROL; THIS IS HOW THEY REACH PYTHON. + # + # The page used to carry a grid of cards *and* a visible list + # of tick boxes naming the same members again: two controls for + # one decision, and the reason the page was unreadable on a + # phone. The grid is the only control a person sees now. This + # group is its transport, off the screen, and the click handler + # forwards a card's click to the box that belongs to it. + # + # Forwarding a real click rather than writing a value is the + # whole trick, and it was arrived at the hard way: setting a + # hidden field's ``value`` and dispatching ``input`` looks + # right, changes the DOM, and never reaches the server, because + # the framework's own binding is what it listens to. Clicking + # the framework's own control cannot drift from it. + # + # Each box is labelled with its bare reference so the mapping + # from card to box is an exact string match rather than a + # position, which would silently mis-tick the moment a filter + # reordered one list and not the other. Hidden in CSS, never + # with ``visible=False``: gradio 6 leaves an invisible block + # out of the document altogether, and a transport the page + # cannot find is a page that silently never saves. + library_defaults = gr.CheckboxGroup( + label="Saved defaults", + show_label=False, + choices=[], + value=[], + container=False, + elem_id="library-choice", + elem_classes="c-hiddenfield", + ) + # Hidden component bindings form the machine API consumed by gradio_client. with gr.Column(visible=False): api_pair_code = gr.Textbox() @@ -3559,6 +3644,28 @@ class DistinctUI: queue=False, api_visibility="private", ) + # THE LIBRARY VIEW SWAP. + # + # Two columns, one visible at a time, and the scroll position reset + # on arrival: a page that opens halfway down is the single clearest + # sign that nothing really navigated. The transition is instant + # because both views are already in the document; nothing is + # fetched to change page. + _scroll_top = "() => { window.scrollTo({top: 0, behavior: 'instant'}); }" + open_library.click( + lambda: (gr.Column(visible=False), gr.Column(visible=True)), + outputs=[app_view, library_view], + queue=False, + api_visibility="private", + js=_scroll_top, + ) + close_library.click( + lambda: (gr.Column(visible=True), gr.Column(visible=False)), + outputs=[app_view, library_view], + queue=False, + api_visibility="private", + js=_scroll_top, + ) new_conversation_button.click( self.new_conversation, inputs=[session_state], diff --git a/distinct_skills/manifest.py b/distinct_skills/manifest.py index dc329857d2fcf235ad3cee4440a80570adfb8c88..0d2d8622ce74e291b3bbc4814d69c4dcc26c482b 100644 --- a/distinct_skills/manifest.py +++ b/distinct_skills/manifest.py @@ -44,25 +44,25 @@ PACKAGED_ROOT = Path(__file__).resolve().parent / "skills" #: expect the review to ask why the digest changed. PINNED_DIGESTS: Mapping[str, str] = MappingProxyType( { - "academy-guide": "489ddd4c963552d243d68aa71af3e9f86ea58b6eb15fa77676eb21297d20e683", - "algorithmic-art": "a20eeb2e787e8f01f66fefc61fa34d84c7046015ba39728952f97ebe29709822", - "brand-guidelines": "bf9abe6506aa7785d36b027fd90f5a5552b40a36f1201ee09b3a680bbfff74d3", - "canvas-design": "776e112543645c5b22515c6e503ab572cde35c4633e0fd09e2d7c53ed912cde0", - "claude-api": "7f41a0e79797eb14c67e8a7fbfbabdb02da229829997496d719af141a597d0ce", + "academy-guide": "47c88cbeb129c2edcb68176bc09621df72557200d253c2a5795e8f76603d6b45", + "algorithmic-art": "15adcdf6e2f9a51d1a2cf9a0cfa636970c53c5f464fe6ef96b5144a72cc95dbd", + "brand-guidelines": "d4443542e29d6b91234dffd31a65ed7df578adea5f58dfc70af068ad82dae1e5", + "canvas-design": "fc44c8a8552c1c6bfc5f92f115d07082a9ae3a1a174333b9689abf1d6b8d3a69", + "claude-api": "23a386a66bce1123f0765779966b802279c23eff956932d3283cc9ba60ecea9e", "create-deck": "e7c9a709f4609af0e5560544ecd8b05cb32fe5e52c147a23690f700700ec5b88", "create-docx": "b1e950ab46f324bca84f6aade1d6772f13090e1fb1cb57df761c41bcb4764b7d", "create-xlsx": "73325b2bd0d99ec781610ed9da1af59fef2655fb6e7b3766a29e2915d5ec449d", "csv-table": "ff87a44fe03901f0cfb61f46209b6cc7138acf07d87279c936cd8711b0a5e455", - "discernment-nudge": "1901fbb6a6a0980fe3c8fc5297d492c39ef02f1c46bbcd77223cf7622cabcd5b", + "discernment-nudge": "d83200e87cae43adbd61ff7277fc08e14c1f032f11590fb5a04bfbf55eb16fdd", "frontend-design": "283205e755626aae7c517f6a3b0f9b8d16b2d30f32d24822080b58393eae689a", - "mcp-builder": "fafc5acb2b8e408182ed8f2be49e9c1dcf41827ceca7bba6aacaccce3393b37b", + "mcp-builder": "0c714adae4963be9411e061647f4efa3820b06d2974a2b319aa93330afc8eb82", "review-checklist": "98af818e3e4c178021bb87bcf355934b5effca7240b738f48ee344f7c6b6686f", "skill-scaffold": "158d1d1ff1ff3ad83865537708cd4464cdd114f420912136917b9c143c32e18e", - "slack-gif-creator": "854f079d2843b80cbf3bd261c099f187c07ad0edf69646ca122eee7e77007ae9", + "slack-gif-creator": "d1c7506e4c0bb3dfb17608e7e2909a91083d6f7323702a2b70bd5d3efc98c6b9", "status-update": "48b7b1914de88b70e0ff9d19262987aca01696f6ebce061d0793543cbacc309e", "theme-factory": "1b5d9800d869e902757d1b1733f98f3936319ee090035ffe9a82603662ccebe8", - "web-artifacts-builder": "4d0576368ca16dea4d5dea809b4766146d49ef84354269289843f55e76f9615e", - "webapp-testing": "cde6767ba5c2fd1cca6e86007010b228cb9296ffe3764485122ade9dd88c52fd", + "web-artifacts-builder": "c57043ce13ad02df16ce717da8572fc59ec309bf9326a1e7d8b2f4f6cbc7e962", + "webapp-testing": "c2202ffb51483464e7a485ffa704899f20bcb2feb71073689ed678af7b55e7a4", } ) diff --git a/distinct_skills/skills/academy-guide/assets/guide.md b/distinct_skills/skills/academy-guide/assets/guide.md index 6f4e7b7dd41c8eccd22117910c6192d16f189f94..256858622e0d1bd5fb6ab1310e53a1bd12848b21 100644 --- a/distinct_skills/skills/academy-guide/assets/guide.md +++ b/distinct_skills/skills/academy-guide/assets/guide.md @@ -1,6 +1,6 @@ -# Learning path: {{subject}} +# Learning path: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's academy-guide skill diff --git a/distinct_skills/skills/algorithmic-art/assets/guide.md b/distinct_skills/skills/algorithmic-art/assets/guide.md index 4c9ef235df3e10a9c26636ab58be5dea3b8ec09a..eb032d59e29ecb254ce64f1c021ca870055e5b18 100644 --- a/distinct_skills/skills/algorithmic-art/assets/guide.md +++ b/distinct_skills/skills/algorithmic-art/assets/guide.md @@ -1,6 +1,6 @@ -# Algorithmic art plan: {{subject}} +# Algorithmic art plan: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's algorithmic-art skill diff --git a/distinct_skills/skills/brand-guidelines/assets/guide.md b/distinct_skills/skills/brand-guidelines/assets/guide.md index 334b567653c044ce3d36c00966db135de59bfb03..0f5b5cd46e9a8a5df326b657cddf71ad186b3b65 100644 --- a/distinct_skills/skills/brand-guidelines/assets/guide.md +++ b/distinct_skills/skills/brand-guidelines/assets/guide.md @@ -1,6 +1,6 @@ -# Brand application: {{subject}} +# Brand application: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's brand-guidelines skill diff --git a/distinct_skills/skills/canvas-design/assets/guide.md b/distinct_skills/skills/canvas-design/assets/guide.md index 1e8ef22cab25846b26878a991df95dcf8f24ca30..b7c8bd2a853fe595cba381d52dc81b7d6613e941 100644 --- a/distinct_skills/skills/canvas-design/assets/guide.md +++ b/distinct_skills/skills/canvas-design/assets/guide.md @@ -1,6 +1,6 @@ -# Design plan: {{subject}} +# Design plan: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's canvas-design skill diff --git a/distinct_skills/skills/claude-api/assets/guide.md b/distinct_skills/skills/claude-api/assets/guide.md index 06cb2f8df402840e7a638d495e41470c2852c02a..86d6de8b7b7be5876e82460b4d543bd52b088467 100644 --- a/distinct_skills/skills/claude-api/assets/guide.md +++ b/distinct_skills/skills/claude-api/assets/guide.md @@ -1,6 +1,6 @@ -# Claude API build note: {{subject}} +# Claude API build note: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's claude-api skill diff --git a/distinct_skills/skills/discernment-nudge/assets/guide.md b/distinct_skills/skills/discernment-nudge/assets/guide.md index fd2efb4c95b4d98ac238ca81fc1467ca1530e440..1926745e9afc20255b2415c7cd08b157109d3569 100644 --- a/distinct_skills/skills/discernment-nudge/assets/guide.md +++ b/distinct_skills/skills/discernment-nudge/assets/guide.md @@ -1,6 +1,6 @@ -# Discernment nudge: {{subject}} +# Discernment nudge: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's discernment-nudge skill diff --git a/distinct_skills/skills/mcp-builder/assets/guide.md b/distinct_skills/skills/mcp-builder/assets/guide.md index add82743ca2cdefd75adc91e7ec14c642b5e2d25..c0def2fa2c2b58d3207b8286ac89dafa8a556491 100644 --- a/distinct_skills/skills/mcp-builder/assets/guide.md +++ b/distinct_skills/skills/mcp-builder/assets/guide.md @@ -1,6 +1,6 @@ -# MCP server plan: {{subject}} +# MCP server plan: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's mcp-builder skill diff --git a/distinct_skills/skills/slack-gif-creator/assets/guide.md b/distinct_skills/skills/slack-gif-creator/assets/guide.md index 104d1c4ffd7ac3159495b9203ec77ce03a02a939..9b41fecbdc5a3b97eadb0ec34a3833927682d6f3 100644 --- a/distinct_skills/skills/slack-gif-creator/assets/guide.md +++ b/distinct_skills/skills/slack-gif-creator/assets/guide.md @@ -1,6 +1,6 @@ -# GIF production plan: {{subject}} +# GIF production plan: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's slack-gif-creator skill diff --git a/distinct_skills/skills/web-artifacts-builder/assets/guide.md b/distinct_skills/skills/web-artifacts-builder/assets/guide.md index 38f1827f82ac15ca34fed428f9c2e88a1a713323..b1752a97c3d1f0453d3fea1eb63159b21968a217 100644 --- a/distinct_skills/skills/web-artifacts-builder/assets/guide.md +++ b/distinct_skills/skills/web-artifacts-builder/assets/guide.md @@ -1,6 +1,6 @@ -# Web artifact build plan: {{subject}} +# Web artifact build plan: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's web-artifacts-builder diff --git a/distinct_skills/skills/webapp-testing/assets/guide.md b/distinct_skills/skills/webapp-testing/assets/guide.md index 6460c0073900c517de4cc57fc93629239880f8ce..3bb38be826b09ffe091ac312263b6909aeee3b5f 100644 --- a/distinct_skills/skills/webapp-testing/assets/guide.md +++ b/distinct_skills/skills/webapp-testing/assets/guide.md @@ -1,6 +1,6 @@ -# Web app test plan: {{subject}} +# Web app test plan: {subject} -{{context}} +{context} ## Method — adapted from Anthropic's webapp-testing skill diff --git a/push-log6.txt b/push-log6.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/scripts/record_library_demos.py b/scripts/record_library_demos.py index 5daf6f4003bfb280ed10d4f4ab26f0ec253c7b5d..53d58c0332b55864399035921e1c9ae995cd454d 100644 --- a/scripts/record_library_demos.py +++ b/scripts/record_library_demos.py @@ -150,7 +150,7 @@ def _assemble_gif(frames: list, out_path: Path) -> int: from PIL import Image - width = 720 + width = 660 scaled = [] for frame in frames: ratio = width / frame.width @@ -158,9 +158,13 @@ def _assemble_gif(frames: list, out_path: Path) -> int: frame.resize((width, int(frame.height * ratio)), Image.LANCZOS) .convert("P", palette=Image.ADAPTIVE, colors=128) ) - durations = [650] * len(scaled) + # Held on the result for three seconds: the last frame is the artifact, + # and a demonstration that flashes its own answer for half a second has + # not demonstrated it. Everything before it is the working, which can go + # past quickly. + durations = [700] * len(scaled) durations[0] = 900 - durations[-1] = 1800 + durations[-1] = 3000 scaled[0].save( out_path, save_all=True, @@ -172,17 +176,70 @@ def _assemble_gif(frames: list, out_path: Path) -> int: return out_path.stat().st_size -def record(page, ref: str, spoken: str, arguments: dict, out_dir: Path) -> None: - """One member: request in, run through, artifact out, frames kept.""" +def _save_poster(frame, out_path: Path) -> int: + """The card's resting image: the run's own result, not a grey rectangle. + + A card that shows nothing until you hover it is a card that tells you + nothing at a glance, and on a phone there is no hover at all. The last + frame of the recording *is* the produced artifact, so it is also the best + possible still: the shelf reads as a shelf of outputs. + """ + + from PIL import Image + + width = 660 + ratio = width / frame.width + poster = frame.resize((width, int(frame.height * ratio)), Image.LANCZOS) + poster.save(out_path, "WEBP", quality=82, method=6) + return out_path.stat().st_size + + +def _shot(page, clip): + """One viewport frame, cropped to the conversation and nothing else. + + The crop is what keeps the recording honest about its subject: the whole + window carries the worker panel, the session list and the pairing box, + none of which is what any of these members does, and one of which must + never be filmed at all. + """ import io from PIL import Image + return Image.open(io.BytesIO(page.screenshot(clip=clip))).convert("RGB") + + +def record(page, ref: str, spoken: str, arguments: dict, out_dir: Path) -> None: + """One member: request in, run through, artifact out, frames kept. + + The recording ends on the thing the run produced — the document, the + sheet, the deck, the page — because that is the only frame that answers + "what does this member do". Earlier cuts ended on a line of prose saying + a call had been made, which demonstrates the plumbing rather than the + product. + """ + frames: list = [] + column = page.locator(".c-conversation") + + def clip(): + box = column.bounding_box() + if not box: + raise RuntimeError(f"{ref}: the conversation column has no box") + # A fixed 16:10 window on the column, pinned to its top. A clip that + # tracks the column's height would change shape between members and + # produce a shelf of cards in a dozen different aspect ratios. + width = min(box["width"], 760) + return { + "x": box["x"], + "y": max(box["y"], 0), + "width": width, + "height": min(width * 0.62, 520), + } def snap() -> None: - frames.append(Image.open(io.BytesIO(page.screenshot())).convert("RGB")) + frames.append(_shot(page, clip())) page.get_by_role("button", name=re.compile("^New conversation$", re.I)).click(timeout=15000) page.wait_for_timeout(900) @@ -193,12 +250,9 @@ def record(page, ref: str, spoken: str, arguments: dict, out_dir: Path) -> None: page.wait_for_timeout(300) snap() # 1: the ask, as a person typed it box.fill(prompt, timeout=15000) - # The run's allowlist is the composer picker, not the library defaults: - # tick every member the worker is offering so the directive's target is - # permitted for this run. - # Exactly one member selected: the one being demonstrated. A job - # carries at most sixteen selections, and a demo that selects the whole - # shelf is not a demo of anything. + # Exactly one member selected: the one being demonstrated. A job carries + # at most sixteen selections, and a demo that selects the whole shelf is + # not a demo of anything. wanted = ref.split("@", 1)[0].replace("_", " ") picker = page.locator(".c-composer-tools input[type=checkbox]") for index in range(picker.count()): @@ -216,36 +270,117 @@ def record(page, ref: str, spoken: str, arguments: dict, out_dir: Path) -> None: ).check(timeout=15000) page.wait_for_timeout(200) page.get_by_role("button", name=re.compile("^Queue run$", re.I)).click(timeout=15000) - page.wait_for_timeout(1200) - snap() # 2: queued / accepted + page.wait_for_timeout(1400) + snap() # 2: queued, and the work beginning page.wait_for_timeout(2600) snap() # 3: running + deadline = time.monotonic() + 45 done = False while time.monotonic() < deadline: - text = page.inner_text("body") - if "requested library call" in text: + if "requested library call" in page.inner_text("body"): done = True break page.wait_for_timeout(1000) if not done: raise RuntimeError(f"{ref}: the run did not complete in time") - page.wait_for_timeout(1200) - # Open the step trace so the final frames show the call and its return. - try: - page.get_by_text(re.compile(r"What the agent did"), exact=False).first.click(timeout=4000) - page.wait_for_timeout(700) - except Exception: - pass - snap() # 4: the answer, with the tool call in the trace + page.wait_for_timeout(1500) + text = page.inner_text("body") if "requested library call" not in text: raise RuntimeError(f"{ref}: the answer does not show the tool ran") - if "Called" not in text and "tool" not in text.lower(): - raise RuntimeError(f"{ref}: no tool call appears in the trace") - snap() # 5: hold on the result + + # THE POINT OF THE WHOLE RECORDING. + # + # Every member of this library produces a file, and the artifact card is + # that file's own content rendered in the transcript. If it is not on the + # page the run did not demonstrate anything, so this is an assertion + # rather than a nicety. + made = page.locator("figure.c-madecard") + if made.count() == 0: + raise RuntimeError(f"{ref}: the run produced no artifact card to show") + # Put the artifact's TOP edge on screen, not merely some part of it. + # ``scroll_into_view_if_needed`` is satisfied by any visible sliver, and a + # long document's card is taller than the transcript's own scroll box, so + # it settled with the file name scrolled off the top and the poster was + # cropped to a paragraph from the middle of the page. Aligning to the + # start, then nudging down by a margin, puts the name bar in frame. + made.first.evaluate( + "el => el.scrollIntoView({block: 'start', inline: 'nearest', behavior: 'instant'})" + ) + page.wait_for_timeout(500) + # If the top is still above the fold, walk the scroll parents down by the + # exact shortfall. A mouse wheel was tried and is wrong here: the pointer + # lands inside the preview's own scroll box and scrolls the document + # rather than the page. + for _ in range(3): + top = made.first.bounding_box() + if not top or top["y"] >= 20: + break + made.first.evaluate( + "(el, delta) => { let n = el.parentElement;" + " while (n) { const s = getComputedStyle(n);" + " if (/(auto|scroll)/.test(s.overflowY) && n.scrollHeight > n.clientHeight)" + " { n.scrollTop += delta; return; }" + " n = n.parentElement; }" + " window.scrollBy(0, delta); }", + top["y"] - 32, + ) + page.wait_for_timeout(400) + page.wait_for_timeout(400) + + # Frame the artifact itself for the closing shots: the card, centred in + # the column, at a size where its text can be read. + def artifact_clip(): + box = column.bounding_box() + card = made.first.bounding_box() + if not box or not card: + return clip() + width = min(box["width"], 760) + height = min(width * 0.62, 520) + centre = card["y"] + card["height"] / 2 + return { + "x": box["x"], + "y": max(box["y"], centre - height / 2), + "width": width, + "height": height, + } + + final = _shot(page, artifact_clip()) + frames.append(final) # 4: the artifact, in the conversation + frames.append(final) # 5: held + + # The poster is cropped to the top of the artifact, with a small margin, + # in roughly the shape the card will draw it. The animation needs a steady + # window to play inside; the still does not, and a still with a band of + # empty page under it reads as a mistake on a shelf of cards that are all + # one size. + # + # Every edge is clamped to the viewport. A clip that runs off the bottom + # of the window does not fail, it silently returns some other part of the + # page — which is how an earlier pass produced cards showing the privacy + # notice instead of the file they had just made. + card_box = made.first.bounding_box() + view = page.viewport_size or {"width": 1280, "height": 860} + still = final + if card_box is None or card_box["y"] < 0: + raise RuntimeError(f"{ref}: could not bring the artifact fully into frame") + if card_box: + pad = 12 + x = max(card_box["x"] - pad, 0) + y = max(card_box["y"] - pad, 0) + width = min(card_box["width"] + pad * 2, view["width"] - x) + height = min( + card_box["height"] + pad * 2, # never taller than the card + width * 0.66, # the shape the card draws + view["height"] - y, # never off the bottom + ) + if width > 80 and height > 60: + still = _shot(page, {"x": x, "y": y, "width": width, "height": height}) + size = _assemble_gif(frames, out_dir / f"{_slug(ref)}.gif") - print(f" {ref:26s} PASS gif {size/1024:.0f} KiB") + poster = _save_poster(still, out_dir / f"{_slug(ref)}.webp") + print(f" {ref:26s} PASS gif {size/1024:.0f} KiB poster {poster/1024:.0f} KiB") def main() -> int: