Release 11.0 (full): passage readings held back when the sentence leaves out a question word, the judge names the step it refused, the part format v1, anyone's sealed test, the sleep cycle, and the six orbiters as files in the pack
Browse filesHead oracle_release_runtime_w575. Root 5985f38d66bcdedbdedb74db90432675a32ddce9dfe2d196b3282c40581d889b. Solana anchor: pending Ben's signature. Internal week (seven simulated nights): 0 parts admitted, 0 new wrong, published as measured. Full changelog: CHANGELOG_11.md.
This view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- CHANGELOG_11.mdAdded+74
- RELEASE_HASHES.json+41-20
- oracle7.py+1-1
- orbiters/artist/LICENSEAdded+202
- orbiters/artist/README.mdAdded+110
- orbiters/artist/SHA256SUMSAdded+17
- orbiters/artist/artist/__init__.pyAdded
- orbiters/artist/artist/build_library.pyAdded+107
- orbiters/artist/artist/build_library_v0.pyAdded+58
- orbiters/artist/artist/core.pyAdded+250
- orbiters/artist/artist/core_v0.pyAdded+236
- orbiters/artist/eval/calibrate_judge.pyAdded+54
- orbiters/artist/eval/eval_geneval.pyAdded+123
- orbiters/artist/eval/eval_geneval.py.nextAdded+123
- orbiters/artist/eval/judge.pyAdded+94
- orbiters/artist/exam_pack.pyAdded+40
- orbiters/artist/night.pyAdded+22
- orbiters/artist/orbiter.jsonAdded+10
- orbiters/artist/results/HELDOUT_FREEZE.txtAdded+3
- orbiters/artist/results/geneval_dev_v0_40.jsonAdded+399
- orbiters/artist/results/geneval_dev_v1a_120.jsonAdded+1119
- orbiters/artist/results/geneval_dev_v1b_120.jsonAdded+1246
- orbiters/artist/results/geneval_heldout.jsonAdded
- orbiters/artist/results/judge_calibration.jsonAdded+42
- orbiters/chameleon/LICENSEAdded+202
- orbiters/chameleon/README.mdAdded+95
- orbiters/chameleon/SHA256SUMSAdded+336
- orbiters/chameleon/apps/api/chameleon_api/__init__.pyAdded+1
- orbiters/chameleon/apps/api/chameleon_api/app.pyAdded+873
- orbiters/chameleon/apps/api/chameleon_api/fixture.pyAdded+6
- orbiters/chameleon/exam_pack.pyAdded+18
- orbiters/chameleon/night.pyAdded+22
- orbiters/chameleon/orbiter.jsonAdded+9
- orbiters/chameleon/package.jsonAdded+7
- orbiters/chameleon/packages/adapters/chameleon_adapters/__init__.pyAdded+1
- orbiters/chameleon/packages/adapters/chameleon_adapters/hotel_fixture.pyAdded+214
- orbiters/chameleon/packages/cli/ditto_reconstruction.pyAdded+35
- orbiters/chameleon/packages/cli/src/chameleon_cli/__init__.pyAdded+1
- orbiters/chameleon/packages/cli/src/chameleon_cli/__main__.pyAdded+3
- orbiters/chameleon/packages/cli/src/chameleon_cli/client.pyAdded+183
- orbiters/chameleon/packages/cli/src/chameleon_cli/main.pyAdded+186
- orbiters/chameleon/packages/core/chameleon_core/__init__.pyAdded+1
- orbiters/chameleon/packages/core/chameleon_core/adaptation_contracts.pyAdded+140
- orbiters/chameleon/packages/core/chameleon_core/adaptation_service.pyAdded+406
- orbiters/chameleon/packages/core/chameleon_core/application_saves.pyAdded+79
- orbiters/chameleon/packages/core/chameleon_core/behavior_records.pyAdded+153
- orbiters/chameleon/packages/core/chameleon_core/browser_contract.pyAdded+65
- orbiters/chameleon/packages/core/chameleon_core/build_plan.pyAdded+45
- orbiters/chameleon/packages/core/chameleon_core/bundle_preview.pyAdded+55
- orbiters/chameleon/packages/core/chameleon_core/config.pyAdded+123
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374# Oracle7 11.0 — changelog since 10.3.2
11.0 is 10.3.2 plus the 10.5 line: a head that holds back what it can't fully read, a judge that names the step it refused, the partformat, anyone's sealed test, the sleep cycle, and the six orbiters as files in the pack. No language model.
## What's new
- **Passage readings are held back when the sentence leaves out a question word.** They're shown, marked as held back, and never stated as answers.- **The judge names the step it refused.** When no shape passes, the reply says which word no step reads, and which kind of step is missing (`step_address.py`, in the head).- **Parts, version 1.** A part is declared data the format can check: table, formula, alias-set, reading-rule, sensor, example-set or composite. It's hashed, signed by its author (Ed25519) and carries its own exam, which the format sets a minimum for. `python oracle7.py part check|submit <part.json>` takes a part in, and it joins only by the same exam as any internal part.- **Anyone's sealed test.** `python oracle7.py exam seal|run`: a question it fails becomes a typed hole.- **The sleep cycle.** `sleep105.py` runs the roadmap's five steps (replay, consolidation, dreaming, forgetting, morning report) on a day's ledger.- **Six orbiters ship as files:** artist, chameleon, deepspace, sensors, trafficcop, vision. `python oracle7.py orbiters` lists them and what each needs, `orbiters exam <name>` runs its exam from the pack, and an orbiter missing something says what, while the rest keeps working. verify, the anchor and update all cover them.
## Changes to checks
- The flash score's threshold was relearned: 0.79 to 0.733.- The flash score no longer depends on the hash seed. In 10.3.2, `program_score` could score the same program differently under different seeds.- The owner stage records a witness for the answer it gave.
## Measured
- **Gate, 5,128 questions, against 10.3.2:** 0 right answers lost, 0 new wrong, 0 new false yes. 2 false yes removed, 1 newly right.- **Passage reader:** of 10.3.2's 4 wrong passage answers, the 3 whose sentence left out a question word are now held back, along with 15 right guesses. 0 new wrong. 1 is left: Great Britain, where the relation is read backwards with every word covered.- **Judge addresses:** on 400 KQA validation questions, 148 of 148 refusals named their step, and the gate saw 0 status changes.
## The internal week (run once, published as measured)
Seven simulated nights: each night is one batch, run back to back on box five, 4–5 Nov. Days were generated by `gen_sealed.py` from arecorded internal seed (`1d25a74f…`, the sha256 of a fixed phrase and the pre-registration's hash). The anchored run waits on Ben'ssignature. Days file sha256 `4dc8eebb…`.
| | Night 1 | 2 | 3 | 4 | 5 | 6 | 7 ||---|---|---|---|---|---|---|---|| Turns | 408 | 408 | 408 | 408 | 408 | 408 | 408 || Holes | 272 | 268 | 264 | 285 | 273 | 284 | 277 || Filled | 0 | 0 | 0 | 2 | 0 | 0 | 0 || Parts admitted | 0 | 0 | 0 | 0 | 0 | 0 | 0 || New wrong | 0 | 0 | 0 | 0 | 0 | 0 | 0 || False yes on controls | 1 | 2 | 1 | 0 | 3 | 0 | 3 || Reference (600), right / wrong | 260 / 21 | 260 / 21 | 260 / 21 | 260 / 21 | 260 / 21 | 260 / 21 | 260 / 21 |
The reference was measured in a fresh process after every night. Night 0 was also 260 / 21.
| Id | Hypothesis | Result ||---|---|---|| H1 | Reach rises | **Not met.** No part was admitted, so reach stayed at 260 of 600 || H2 | No new wrong | **Met.** 0 across seven nights || H3 | No new false yes | **Not met as written.** 10 false yes on 406 controls. No part changed the head, so all 10 are the 11.0 head's own || H4 | Planted bad parts refused | **Not tested in the week**, because none were planted. The part format's own suite refuses every planted bad part (below) || H5 | Rebuilt byte for byte | **Not run** |
What this says: on generated questions, the sleep cycle found 2 fills in 1,923 holes, and neither passed its exam. The holes aremostly the relate and compare classes, written up in `paper-four-limits/E2_STEP_PARTS.md`: what they need is a step, which the currentfills don't build. The 21 reference wrong answers haven't been traced yet. They're the first item for 11.1, along with the 10 false yes.
## Hashes
| | Merkle root ||---|---|| oracle7 (full) | `5985f38d66bcdedbdedb74db90432675a32ddce9dfe2d196b3282c40581d889b` || oracle7-slim | `e5393079284039405e58b8340d34ffaf6af958fe3448c8273fd6be277546624e` |
The Solana anchor is Ben's signature, and it's added to RELEASE_HASHES.json when he signs. Until then the published roots above arewhat `python oracle7.py verify` checks.123456789101112131415161497 unmodified lines15141515151615171518151915201521152215231524152520 unmodified lines154615471548154915501551155217 unmodified lines157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596{"format": "oracle7-release-hashes/1","release": "oracle7","version": "10.3.2","head": "oracle_release_runtime_w574","merkle_root": "414667ae5ed09f15fe0c86897ba533cd90d289a981c2f825418a4cabb9a454b3","parts": {"specialists/_cards": {"sha256": "619ae757757de886c389cf953924f090d0f71ecff02447171381287f9553a2cf","files": 142},"specialists/_gate": {"sha256": "7b50cd843be5a3a4f8bcbdea3f1958d7d44d24b25380c69f085aba19024cb47b","files": 25},"specialists/_proved": {1497 unmodified lines"files": 9},"core/admitted": {"sha256": "6e2c6a8039fcc6af2efd8385b119cd45eade4d26115583601f2496d3a13a0d3c","files": 371},"workbench": {"sha256": "2a2e43779f8bc0916082d29669f6174a0a4fb0652164b1e7c50ab2bf88e11cc5","files": 238},"core/wander-train": {"sha256": "e04d863053d78f488f6b1df944654ee51e01d433bbf78df31f295fa452de0437",20 unmodified lines"files": 4},"oracle7.py": {"sha256": "1c05ef290e1afca4175057e809d3d7413085f9973e7000df1a92023d0d0eb88f","files": 1},"PACK_MANIFEST.json": {17 unmodified lines"files": 1},"data/fable-content": {"sha256": "947fbead08fc9adb45c0eed1f4e0db191929a66ad867a59229510d7e8e71847a","files": 25},"data/variant": {"sha256": "ce54354b45bf0e54e40e2dff2eaac2591f93b3e07bbff4c55519f870d2695afc","files": 1}},"recipe": "workbench/verify.py (recipe v4): part hash = SHA-256 over every file under the part in byte-sorted relative POSIX path order (skipping __pycache__, state, local, *.pyc, *.zst) of path, NUL, the file's SHA-256; leaf = SHA-256('oracle7-part:' + name + ':' + hex); root = binary Merkle tree over leaves in name order, an odd last node carried up. Parts: specialists/<dir>, core/admitted, workbench, core/wander-train, core/relstore-routes (top-level .json), organs10/<kqa|physics|air|library>, oracle7.py, PACK_MANIFEST.json (each large store's SHA-256), and (v4) data/<nltk_data|textbooks|vendor>, data/relstore-tables (top-level non-.json not in the manifest), data/fable-content (outside self_loop, not in the manifest), data/variant.","anchor": {"chain": "solana-mainnet","program": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr","memo": "Oracle7 release 10.3.2 full (w574): ember arlynx's #10 plurals and #11 binomial support, binomial questions reach the statistics specialist in chat; oracle7 merkle 414667ae5ed09f15fe0c86897ba533cd90d289a981c2f825418a4cabb9a454b3. Release test pre-registration v41, run once: 37 of 37 rows, all 9 bars (held-out bars re-measured on the spent v37c/v37d samples). Coverage stage, development: 361 right, 79 wrong of 1428 declines; at its threshold 0.79: 44 right of 46. Recipe: RELEASE_HASHES.json in the repository.","signature": "M68CHP4trHGytDSaHGCRABQZWGU972oUxC5fpEXuyShhcpiFRUqEGxbQA6rfSa7DhcPkoZcDPGJcsGRvJuAGimd","slot": 464323054,"block_time_utc": "2026-11-02T02:13:17Z","explorer": "https://explorer.solana.com/tx/M68CHP4trHGytDSaHGCRABQZWGU972oUxC5fpEXuyShhcpiFRUqEGxbQA6rfSa7DhcPkoZcDPGJcsGRvJuAGimd"},"supersedes": {"merkle_root": "c507d7f285fd5b3ec3dae6be453072d30be0416124771b7737889eb64fcb2c96","anchor_signature": "2jTgoo4acCK4kecMvxbUtW8cUKZJtY6CzZZBhCBtanZgu16UVeNDZMQ4Xxm3wQbkCj9Ne8VW3stsuGYwWvfqk9SD","reason": "release 10.3.2: ember arlynx's #10 (canonical plurals) and #11 (binomial support, whole counts), binomial questions reach the statistics specialist in chat (CHANGELOG_1032.md); slim also carries 10.3's coverage work (CHANGELOG_103.md)"}}123456789101112131415161497 unmodified lines15141515151615171518151915201521152215231524152520 unmodified lines154615471548154915501551155217 unmodified lines157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617{"format": "oracle7-release-hashes/1","release": "oracle7","version": "11.0","head": "oracle_release_runtime_w575","merkle_root": "5985f38d66bcdedbdedb74db90432675a32ddce9dfe2d196b3282c40581d889b","parts": {"specialists/_cards": {"sha256": "619ae757757de886c389cf953924f090d0f71ecff02447171381287f9553a2cf","files": 142},"specialists/_gate": {"sha256": "bfb54b3ac42dddf09bc980e31d3c106e7f7f6c46fc086cb510175030b93a40e6","files": 25},"specialists/_proved": {1497 unmodified lines"files": 9},"core/admitted": {"sha256": "c885d72ea1c68bff1a8d76cf33233ee7c4151868478712385a239fc5af932b8c","files": 375},"workbench": {"sha256": "36c6fedfccae72694c6dbed4fa7c753c60bf6892a2a0f915921dd887b766bb55","files": 246},"core/wander-train": {"sha256": "e04d863053d78f488f6b1df944654ee51e01d433bbf78df31f295fa452de0437",20 unmodified lines"files": 4},"oracle7.py": {"sha256": "27d852467a900dc2e957297e7ed780442f7bef80e1c89c63f89ca433ae04eb92","files": 1},"PACK_MANIFEST.json": {17 unmodified lines"files": 1},"data/fable-content": {"sha256": "5841cfdd2eba8dbf827c93b9b18f1053478ff9227531b5fc77fcc50b3e9cf93c","files": 24},"data/variant": {"sha256": "ce54354b45bf0e54e40e2dff2eaac2591f93b3e07bbff4c55519f870d2695afc","files": 1},"orbiters/artist": {"sha256": "59d15d697bb154ff5b00b9a8a2b4367041ca74b8f112fab1aab50bb080fc84bd","files": 21},"orbiters/chameleon": {"sha256": "97f7d486bfe981040be61fd20c16465c5c10fe420937904aab6816a8dedce4c6","files": 342},"orbiters/deepspace": {"sha256": "ffbb3a946d770f1d58d66b10c860239c84c416a50947b3134b248a8248b090fb","files": 49},"orbiters/sensors": {"sha256": "a11cbe46f5378d71c77dc0d589b122eac806a78f2853b62aa25c10a69883d935","files": 14},"orbiters/trafficcop": {"sha256": "2cf57df21916f7fe557563c40a38bab881f296dd0c8631d729bbb971781da196","files": 19},"orbiters/vision": {"sha256": "fe67d90a60cded0c29556808370a3c39848c8790c7704da7349d5065ffe52378","files": 29}},"recipe": "workbench/verify.py (recipe v5): part hash = SHA-256 over every file under the part in byte-sorted relative POSIX path order (skipping __pycache__, state, local, *.pyc, *.zst) of path, NUL, the file's SHA-256; leaf = SHA-256('oracle7-part:' + name + ':' + hex); root = binary Merkle tree over leaves in name order, an odd last node carried up. Parts: specialists/<dir>, core/admitted, workbench, core/wander-train, core/relstore-routes (top-level .json), organs10/<kqa|physics|air|library>, oracle7.py, PACK_MANIFEST.json (each large store's SHA-256), and (v4) data/<nltk_data|textbooks|vendor>, data/relstore-tables (top-level non-.json not in the manifest), data/fable-content (outside self_loop, not in the manifest), data/variant.","anchor": {"chain": "solana-mainnet","program": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr","memo": "Oracle7 release 11.0 full (w575). oracle7 merkle 5985f38d66bcdedbdedb74db90432675a32ddce9dfe2d196b3282c40581d889b.","signature": null},"supersedes": {"merkle_root": "414667ae5ed09f15fe0c86897ba533cd90d289a981c2f825418a4cabb9a454b3","anchor_signature": "M68CHP4trHGytDSaHGCRABQZWGU972oUxC5fpEXuyShhcpiFRUqEGxbQA6rfSa7DhcPkoZcDPGJcsGRvJuAGimd","reason": "release 10.3.2: ember arlynx's #10 and #11 and the binomial route (CHANGELOG_1032.md)"}}
134 unmodified lines135136137138139140141134 unmodified linesexcept ImportError:cli = Noneif cli is not None and a and a[0] in cli.COMMANDS:if a[0] not in ("help", "specialists", "card", "systems", "verify", "mine", "new", "example", "scan", "sensor-test", "history"):if a[0] == "mcp": # 10.2: stdout carries the MCP protocol, so setup reports on stderrimport contextlibwith contextlib.redirect_stdout(sys.stderr):134 unmodified lines135136137138139140141134 unmodified linesexcept ImportError:cli = Noneif cli is not None and a and a[0] in cli.COMMANDS:if a[0] not in ("orbiters", "vision", "trafficcop", "deepspace", "chameleon", "artist", "help", "specialists", "card", "systems", "verify", "mine", "new", "example", "scan", "sensor-test", "history"):if a[0] == "mcp": # 10.2: stdout carries the MCP protocol, so setup reports on stderrimport contextlibwith contextlib.redirect_stdout(sys.stderr):
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110---license: apache-2.0library_name: oracle7tags:- oracle7- no-neural-network- text-to-image- compositional---
> Text-to-image by citation of real COCO instances, self-verified; GenEval-style 50.9% held-out, no generative model.
# Oracle7-Artist 2.0 (internal)
**Status:** public release. Prometheus7 Research Institute, 2026-09-25. **Held-out complete: GenEval-style 50.9% (2,212 images, run once).****Frozen 2026-09-25 13:35 UTC** (box four `/opt/oracle7-artist/results/HELDOUT_FREEZE.txt`):- code SHA-256 `000154e2ebf0403c300c98c12da0aa94a7e553e12e07acab12b74086f8acd6c7` (C-locale sorted `artist/*.py` + `eval/*.py`, v0 copies excluded);- library index SHA-256 `4b1d83af4ab12424822ce58129fd044283fa77d216bac789784c80f062187f4d` (2,673 sprites, 80 classes).
## What it is
Text-to-image by citation, with no generative model and no learned weights.1. **Parse.** A prompt is parsed into objects, counts, colours and spatial relations.2. **Cite.** Every object is a real instance cut from COCO val2017, cited by image id and annotation id.3. **Lay out.** The layout satisfies counts and relations by construction.4. **Colour.** It cites a real instance already of the named colour when the library holds one. Otherwise it recolours an instance, keeping its light and saturation structure.5. **Verify.** Artist re-measures every clause from its own pixels.
**The judge is independent of Artist** and shares no code with it. It is OWLv2 (base) queried with all 80 COCO classnames plus CLIP ViT-B/32 for colour, applying GenEval's task rules. It is an **approximation** of the official GenEvalscorer (Mask2Former + CLIP); numbers are "GenEval-style", not official GenEval. Its detection threshold (0.25) was setby presence F1 on 250 real COCO photographs before library v1 existed. It was then fixed.
## Protocol
- **Development:** 120 templated prompts (seed 4242) covering the GenEval task families, excluding every official prompt. Every library and renderer change was made here.- **Held-out:** the 553 official GenEval prompts × seeds 0–3, rendered and judged **once**, seed-major. `results/geneval_heldout.json` is rewritten after each seed and marked `final: true` at the end.
## Development results (120 prompts, seed 0)
| Version | Overall | Counting | Two objects | Position | Colours | Colour attribution ||---|---|---|---|---|---|---|| v0 (first 40 prompts, thr 0.30) | 39.2% | 75% | 37.5% | 33.3% | 50% | 0% || v1 (library filters, own-colour citation) | 45.5% | 68.0% | 58.3% | 52.6% | 48.4% | 0% || **v1b, frozen** (texture-keeping recolour, fragmented masks rejected) | **47.7%** | 68.0% | 58.3% | 52.6% | 45.2% | 14.3% |
Artist's self-verification passes 95–100% of its own images in every task. **The gap between self-verification and thejudge is the finding:** the layout is right by construction, but many composited instances are not recognised as thatobject by a detector trained on photographs.
What changed from v0 to v1b, each change found by looking at dev renders:- **Occlusion:** occluded instances are dropped (other boxes may cover at most 35% of the instance's box).- **Legibility:** dark or flat cut-outs are dropped (median value < 0.18, or std < 0.04).- **Fragmentation:** masks whose largest piece is under 80% of the mask are dropped.- **Own colour:** a sprite's own colour is recorded only when unambiguous (red, orange, yellow, green, blue, white, black; saturation ≥ 0.35).- **Recolour:** it now keeps the object's own light and saturation ratios. The old recolour flattened objects into blobs.
## Held-out (official GenEval prompts): complete
Run once on box four, 2026-09-25 13:35 to 22:33 UTC (32,275 s on 2 CPU cores, no GPU): the 553 official prompts × seeds0–3 = 2,212 images, judged once. `results/geneval_heldout.json` (`final: true`, SHA-256`b792e7906e54171d31ca3e3e5134c6250d481c5e9e44af288dc98f0f4c0cda9e`). The code and library hashes are the frozen ones above.
| Task | Images | Independent judge | Artist's own self-check ||---|---|---|---|| **Overall (GenEval-style)** | **2,212** | **50.9%** | || Single object | 320 | 80.6% | 100% || Two objects | 396 | 49.2% | 100% || Counting | 320 | 55.0% | 91.3% || Colours | 376 | 45.7% | 97.1% || Position | 400 | 56.0% | 100% || Colour attribution | 400 | 19.0% | 92.0% |
584 of the 2,212 images needed a recoloured instance. Held-out (50.9%) is above the frozen dev figure (47.7%), so the devprompts did not overstate it.
Published GenEval overall scores for generative models (official scorer): SD 1.5 ≈ 43%, SDXL ≈ 55%, SD3 ≈ 68–74%. Artistuses no generative model and no learned weights, and every object in every image is a cited COCO instance. The judge isan approximation of the official scorer, so this comparison is indicative only.
## Failures, stated plainly
- **Most dev failures are "missing":** the judge does not detect the composited object. Colour attribution is weakest (14.3%). Two recoloured objects in one image compound the detector's difficulty.- **Counting fails when an instance overlaps or is cropped** below the detector's confidence (8/25 dev).- **Thin library classes:** hair drier 1, toaster 2, skis 3, frisbee 5, remote 5, knife 6.- **Brown, purple and pink objects are always recoloured,** because photographed objects in these hues are read unreliably (red apples read as pink or purple).- **Judge calibration overlap:** 67 of the 250 calibration photographs are also cited by the frozen library. The threshold was chosen on whole-photo detection before that library existed, so this does not favour Artist. It is disclosed.- **The judge is not the official GenEval scorer.** Treat comparisons with published GenEval numbers (SD 1.5 ≈ 43%, SDXL ≈ 55%, SD3 ≈ 68–74%) as indicative only.
## Reproduce (box four)
```cd /opt/oracle7-artistjudge-venv/bin/python artist/build_library.py coco libraryjudge-venv/bin/python eval/calibrate_judge.py 250judge-venv/bin/python eval/eval_geneval.py dev 120judge-venv/bin/python eval/eval_geneval.py heldout```1234567891011121314151617cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSEde12d1c2f7fb03a564be0ea27afe9e25dd34b9311e9798a367b20e1dee83bef7 README.mde3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 artist/__init__.pyc6b4b4cafc386e83a175ca84e550d97c4130a541a310e1fb44ec912141212d84 artist/build_library.py3a3a9ca37375672717977ebe8596f784e67c68dc0a67d774db8cecb47144b043 artist/build_library_v0.py455dedbf77176e55d4dde827bbbd06330d15ca6d787ffbdf9b5161ca525cc0ce artist/core.py6c1d936ea3b2d29a7def575d7a08f01939c70b329ae64292d4c1035c408dc1ab artist/core_v0.py5b82207b1e7db899f37e2e30d2b12a818652a9b95aee5250d5363c4bc0a92639 eval/calibrate_judge.py943b967f8689b5e2be049ba119e123541b3979c484f1e05556c3cd5c34bddf23 eval/eval_geneval.py943b967f8689b5e2be049ba119e123541b3979c484f1e05556c3cd5c34bddf23 eval/eval_geneval.py.nextd9fb544dfc7991d94555106ae89c1cde19a94fe43c611f5081ce6917f9fdbcc0 eval/judge.py9a10618bbda20d45842fe2515f9e56a7e893cad6d17d13c1b20a13f2814773ed results/HELDOUT_FREEZE.txtcd5a4fb02f693d0f70806b78672628760604f62a67df4ad86290ddbc5e0c63f1 results/geneval_dev_v0_40.jsone772bba279ba67235e67bdf3d77b132b3e399adf59284fc31712f96ad1a35f56 results/geneval_dev_v1a_120.json6aaefda454d12091116d89d41f8083f7fddbb0409552c1192dbfd2265084871c results/geneval_dev_v1b_120.jsonb792e7906e54171d31ca3e3e5134c6250d481c5e9e44af288dc98f0f4c0cda9e results/geneval_heldout.jsonaf261174cfec930988a17df7f835df4adb1238b9b645646916693181281e40d3 results/judge_calibration.json123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107#!/usr/bin/env python3
"""Build the Artist instance library from COCO val2017: for each of the 80 classes, the largest, least truncated,
least occluded, legible non-crowd instance masks, cut out as RGBA sprites. Each sprite cites its COCO image id and
annotation id, and records its OWN colour (Vision's HSV reading) so a colour prompt can cite a real instance of that
colour instead of recolouring one.
v1 (dev renders 2026-09-25): v0 kept occluded and dark cut-outs (a "dining table" that was a patch of tabletop under
bananas, a cat in shadow) and recoloured every coloured object (a glass cup became a flat yellow blob).
usage: build_library.py <coco_dir with val2017/ and annotations/> <out_dir>"""
import json
import os
import sys
import numpy as np
from scipy import ndimage
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from artist.core import named_color # noqa: E402
from PIL import Image, ImageDraw
coco, out = sys.argv[1], sys.argv[2]
ann = json.load(open(os.path.join(coco, "annotations", "instances_val2017.json")))
cats = {c["id"]: c["name"] for c in ann["categories"]}
imgs = {i["id"]: i for i in ann["images"]}
API_TO_OURS = {"mouse": "computer mouse", "keyboard": "computer keyboard"}
by = {}
boxes_of = {}
for a in ann["annotations"]:
boxes_of.setdefault(a["image_id"], []).append((a["id"], a["bbox"]))
def occlusion(a):
"""fraction of this instance's box covered by the boxes of OTHER instances in the same photo"""
x, y, w, h = a["bbox"]
cov = np.zeros((max(1, int(h)), max(1, int(w))), bool)
for oid, (ox, oy, ow, oh) in boxes_of[a["image_id"]]:
if oid == a["id"]:
continue
x0, y0 = int(max(0, ox - x)), int(max(0, oy - y))
x1, y1 = int(min(w, ox + ow - x)), int(min(h, oy + oh - y))
if x1 > x0 and y1 > y0:
cov[y0:y1, x0:x1] = True
return cov.mean()
for a in ann["annotations"]:
if a["iscrowd"] or not isinstance(a["segmentation"], list):
continue
im = imgs[a["image_id"]]
x, y, w, h = a["bbox"]
if w * h < 3500 or x < 3 or y < 3 or x + w > im["width"] - 3 or y + h > im["height"] - 3:
continue # too small, or touching the frame (probably truncated)
solidity = a["area"] / (w * h)
if solidity < 0.25:
continue
name = API_TO_OURS.get(cats[a["category_id"]], cats[a["category_id"]])
occ = occlusion(a)
by.setdefault(name, []).append((a["area"] * min(1.0, solidity * 1.5) * (1.0 - occ), a, occ))
index = {}
os.makedirs(out, exist_ok=True)
for name, lst in sorted(by.items()):
lst.sort(key=lambda t: -t[0])
clean = [t for t in lst if t[2] <= 0.35]
pool = clean if len(clean) >= 6 else lst # a class whose instances are always overlapped keeps its best
keep = []
for _, a, occ in pool:
if len(keep) >= 60:
break
im = imgs[a["image_id"]]
src = Image.open(os.path.join(coco, "val2017", im["file_name"])).convert("RGB")
mask = Image.new("L", src.size, 0)
d = ImageDraw.Draw(mask)
for poly in a["segmentation"]:
if len(poly) >= 6:
d.polygon(poly, fill=255)
x, y, w, h = [int(round(v)) for v in a["bbox"]]
crop = src.crop((x, y, x + w, y + h))
m = mask.crop((x, y, x + w, y + h))
rgba = crop.copy()
rgba.putalpha(m)
mm = np.asarray(m) > 128
lab, nlab = ndimage.label(mm)
if nlab > 1 and np.bincount(lab.ravel())[1:].max() < 0.8 * mm.sum():
continue # fragmented mask (occluded into pieces): not one object
px = np.asarray(crop)[mm]
if len(px) < 200:
continue
v = px.max(axis=1) / 255.0
if np.median(v) < 0.18 or v.std() < 0.04:
continue # too dark or too flat to read as the object
own = named_color(px.astype(np.float32))
sat = np.median((px.max(axis=1) - px.min(axis=1)) / np.maximum(px.max(axis=1), 1))
if own not in ("black", "white") and (sat < 0.35 or np.median(v) < 0.3):
own = None # muted or mixed: no colour claim, recolour when one is asked
if own in ("brown", "purple", "pink"):
own = None # read unreliably from photos (red apples/buses read pink/purple)
s = 320 / max(w, h)
if s < 1:
rgba = rgba.resize((max(1, int(w * s)), max(1, int(h * s))), Image.LANCZOS)
rel = os.path.join(name.replace(" ", "_"), "%d.png" % a["id"])
os.makedirs(os.path.join(out, os.path.dirname(rel)), exist_ok=True)
rgba.save(os.path.join(out, rel))
keep.append({"file": rel, "cite": {"coco_image_id": a["image_id"], "coco_annotation_id": a["id"]}, "area": a["area"],
"occlusion": round(float(occ), 3), "color": own})
index[name] = keep
json.dump(index, open(os.path.join(out, "index.json"), "w"), indent=1)
print("classes %d, sprites %d; thinnest classes: %s" % (len(index), sum(len(v) for v in index.values()),
sorted(((len(v), k) for k, v in index.items()))[:6]))12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758#!/usr/bin/env python3"""Build the Artist instance library from COCO val2017: for each of the 80 classes, the largest, least truncated,non-crowd instance masks, cut out as RGBA sprites. Each sprite cites its COCO image id and annotation id.usage: build_library.py <coco_dir with val2017/ and annotations/> <out_dir>"""import jsonimport osimport sys
import numpy as npfrom PIL import Image, ImageDraw
coco, out = sys.argv[1], sys.argv[2]ann = json.load(open(os.path.join(coco, "annotations", "instances_val2017.json")))cats = {c["id"]: c["name"] for c in ann["categories"]}imgs = {i["id"]: i for i in ann["images"]}API_TO_OURS = {"mouse": "computer mouse", "keyboard": "computer keyboard"}by = {}for a in ann["annotations"]: if a["iscrowd"] or not isinstance(a["segmentation"], list): continue im = imgs[a["image_id"]] x, y, w, h = a["bbox"] if w * h < 3500 or x < 3 or y < 3 or x + w > im["width"] - 3 or y + h > im["height"] - 3: continue # too small, or touching the frame (probably truncated) solidity = a["area"] / (w * h) if solidity < 0.25: continue name = API_TO_OURS.get(cats[a["category_id"]], cats[a["category_id"]]) by.setdefault(name, []).append((a["area"] * min(1.0, solidity * 1.5), a))index = {}os.makedirs(out, exist_ok=True)for name, lst in sorted(by.items()): lst.sort(key=lambda t: -t[0]) keep = [] for _, a in lst[:24]: im = imgs[a["image_id"]] src = Image.open(os.path.join(coco, "val2017", im["file_name"])).convert("RGB") mask = Image.new("L", src.size, 0) d = ImageDraw.Draw(mask) for poly in a["segmentation"]: if len(poly) >= 6: d.polygon(poly, fill=255) x, y, w, h = [int(round(v)) for v in a["bbox"]] crop = src.crop((x, y, x + w, y + h)) m = mask.crop((x, y, x + w, y + h)) rgba = crop.copy() rgba.putalpha(m) s = 320 / max(w, h) if s < 1: rgba = rgba.resize((max(1, int(w * s)), max(1, int(h * s))), Image.LANCZOS) rel = os.path.join(name.replace(" ", "_"), "%d.png" % a["id"]) os.makedirs(os.path.join(out, os.path.dirname(rel)), exist_ok=True) rgba.save(os.path.join(out, rel)) keep.append({"file": rel, "cite": {"coco_image_id": a["image_id"], "coco_annotation_id": a["id"]}, "area": a["area"]}) index[name] = keepjson.dump(index, open(os.path.join(out, "index.json"), "w"), indent=1)print("classes %d, sprites %d; thinnest classes: %s" % (len(index), sum(len(v) for v in index.values()), sorted(((len(v), k) for k, v in index.items()))[:6]))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250"""oracle7-artist: compositional image synthesis by CITED EXEMPLARS (no learned generator, no learned weights).
prompt -> specification (objects, counts, colours, one spatial relation) parse()
-> real object instances cut from COCO val2017 with their masks Library (every sprite cites image/annotation)
-> layout that makes counts and relations true by construction layout()
-> recolouring that keeps each object's texture recolor()
-> render on a neutral ground; VERIFY each clause from the pixels render(), verify()
The verifier re-measures colour inside each placed object's mask and the geometry of the placed boxes; a clause it cannot
certify is reported, never hidden. The independent score comes from a separate judge (eval/judge.py), not from here.
"""
from __future__ import annotations
import colorsys
import json
import os
import random
import re
import numpy as np
from PIL import Image, ImageDraw, ImageFilter
COCO = ["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light",
"fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow", "elephant",
"bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard",
"sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle",
"wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange", "broccoli",
"carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch", "potted plant", "bed", "dining table", "toilet",
"tv", "laptop", "computer mouse", "remote", "computer keyboard", "cell phone", "microwave", "oven", "toaster",
"sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush"]
COCO_API_NAME = {"computer mouse": "mouse", "computer keyboard": "keyboard"} # COCO annotation names
IRREGULAR = {"person": "people", "knife": "knives", "mouse": "mice", "sheep": "sheep", "skis": "skis", "scissors": "scissors",
"bus": "buses", "couch": "couches", "sandwich": "sandwiches", "toothbrush": "toothbrushes", "glass": "glasses",
"wine glass": "wine glasses", "bench": "benches", "tv": "tvs", "hair drier": "hair driers", "cell phone": "cell phones",
"potted plant": "potted plants", "dining table": "dining tables", "hot dog": "hot dogs", "teddy bear": "teddy bears"}
NUMS = {"two": 2, "three": 3, "four": 4, "five": 5}
COLORS = {"red": (0, .85, .80), "orange": (28, .90, .92), "yellow": (54, .90, .95), "green": (125, .75, .60),
"blue": (218, .80, .80), "purple": (282, .65, .62), "pink": (330, .45, .95), "brown": (25, .70, .40),
"black": (0, 0.0, 0.10), "white": (0, 0.0, 0.97)}
REL = {"left of": "left", "right of": "right", "above": "above", "below": "below"}
SIZE = 512
def plural(name):
if name in IRREGULAR:
return IRREGULAR[name]
return name + ("es" if name.endswith(("s", "x", "ch", "sh")) else "s")
_NAMES = sorted(COCO, key=len, reverse=True)
_PLURALS = {plural(n): n for n in COCO}
def _object(phrase):
"""'a purple wine glass' / 'three skis' -> {'class','count','color'}"""
p = phrase.strip().lower()
count = 1
m = re.match(r"^(a|an|one|two|three|four|five)\s+(.*)$", p)
if m:
count = NUMS.get(m.group(1), 1)
p = m.group(2)
color = None
for c in COLORS:
if p.startswith(c + " "):
color, p = c, p[len(c) + 1:]
name = _PLURALS.get(p, p)
if name not in COCO:
for n in _NAMES:
if p.endswith(n) or p.endswith(plural(n)):
name = n
break
if name not in COCO:
raise ValueError("unknown object %r" % phrase)
return {"class": name, "count": count, "color": color}
def parse(prompt):
p = prompt.strip().lower()
p = re.sub(r"^a photo of\s+", "", p)
for rel in REL:
if " %s " % rel in p:
a, b = p.split(" %s " % rel, 1)
return {"objects": [_object(a), _object(b)], "relation": (0, REL[rel], 1)}
if " and " in p:
a, b = p.split(" and ", 1)
return {"objects": [_object(a), _object(b)], "relation": None}
return {"objects": [_object(p)], "relation": None}
class Library:
"""real object instances from COCO val2017: the largest, least truncated masks per class, each with its citation"""
def __init__(self, root):
self.root = root
self.index = json.load(open(os.path.join(root, "index.json")))
def pick(self, cls, rng, k=1, color=None):
"""a real instance of the requested colour when the library holds one (cited as is, no recolour);
otherwise the best-ranked instances, to be recoloured"""
items = self.index[cls]
if color:
own = [it for it in items if it.get("color") == color]
if own:
top = own[:max(k, 8)]
return rng.sample(top, k) if len(top) >= k else [rng.choice(top) for _ in range(k)]
top = items[:max(k, 8)]
return rng.sample(top, k) if len(top) >= k else [rng.choice(top) for _ in range(k)]
def load(self, item):
return Image.open(os.path.join(self.root, item["file"])).convert("RGBA")
def recolor(im, color):
"""keep the object's luminance texture; move hue/saturation (or value, for black/white) to the named colour"""
a = np.asarray(im).astype(np.float32) / 255.0
rgb, alpha = a[..., :3], a[..., 3:]
hsv = np.array(np.vectorize(colorsys.rgb_to_hsv)(rgb[..., 0], rgb[..., 1], rgb[..., 2])).transpose(1, 2, 0)
h, s, v = COLORS[color]
lum = hsv[..., 2]
lum_n = (lum - lum.min()) / (lum.max() - lum.min() + 1e-6)
if color == "black":
V = 0.04 + 0.22 * lum_n
S = hsv[..., 1] * 0.15
H = hsv[..., 0]
elif color == "white":
V = 0.80 + 0.20 * lum_n
S = hsv[..., 1] * 0.08
H = hsv[..., 0]
else:
# v1: keep the object's own light and saturation STRUCTURE (ratios to its median), move only hue and level.
# v0 forced one saturation and squeezed brightness into 55-100%, which flattened objects into blobs the
# judge's detector no longer recognised (dev color_attr 0/21)
m = alpha[..., 0] > 0.5
med_v = float(np.median(lum[m])) if m.any() else 0.5
med_s = float(np.median(hsv[..., 1][m])) if m.any() else 0.5
V = np.clip(v * (lum / max(med_v, 0.05)) ** 0.8, 0, 1)
S = np.clip(s * (0.7 + 0.3 * hsv[..., 1] / max(med_s, 0.05)), 0, 1)
H = np.full_like(lum, h / 360.0)
out = np.array(np.vectorize(colorsys.hsv_to_rgb)(H, S, V)).transpose(1, 2, 0)
return Image.fromarray((np.concatenate([out, alpha], -1) * 255).astype(np.uint8), "RGBA")
def _ground(rng):
top = np.array([rng.randint(205, 235)] * 3, np.float32)
bot = np.array([rng.randint(150, 185)] * 3, np.float32)
t = np.linspace(0, 1, SIZE)[:, None, None]
g = top * (1 - t) + bot * t
g = np.repeat(g, SIZE, axis=1) + np.random.default_rng(rng.randint(0, 1 << 30)).normal(0, 2.0, (SIZE, SIZE, 3))
return Image.fromarray(np.clip(g, 0, 255).astype(np.uint8), "RGB")
def layout(spec):
"""boxes (x0, y0, x1, y1) per object instance, making counts and the relation true with clear margins"""
objs = spec["objects"]
rel = spec["relation"]
slots = []
if rel:
_, r, _ = rel
A = (40, 150, 240, 360) if r in ("left",) else (272, 150, 472, 360) if r == "right" else \
(146, 20, 366, 230) if r == "above" else (146, 282, 366, 492)
B = {"left": (272, 150, 472, 360), "right": (40, 150, 240, 360), "above": (146, 282, 366, 492),
"below": (146, 20, 366, 230)}[r]
return [[A], [B]]
if len(objs) == 2:
return [[(30, 120, 246, 392)], [(266, 120, 482, 392)]]
n = objs[0]["count"]
if n == 1:
return [[(96, 86, 416, 426)]]
cols = 2 if n == 4 else n
rows = 2 if n == 4 else 1
w = (SIZE - 40) / cols
hgt = (SIZE - 80) / rows if rows > 1 else 300
y0 = 40 if rows > 1 else (SIZE - hgt) / 2
boxes = []
for i in range(n):
r_, c_ = divmod(i, cols)
boxes.append((int(20 + c_ * w + 8), int(y0 + r_ * hgt + 8), int(20 + (c_ + 1) * w - 8), int(y0 + (r_ + 1) * hgt - 8)))
return [boxes]
def _fit(sprite, box):
x0, y0, x1, y1 = box
w, h = sprite.size
s = min((x1 - x0) / w, (y1 - y0) / h)
sp = sprite.resize((max(1, int(w * s)), max(1, int(h * s))), Image.LANCZOS)
return sp, (x0 + (x1 - x0 - sp.size[0]) // 2, y0 + (y1 - y0 - sp.size[1]) // 2)
def render(spec, lib, seed=0):
rng = random.Random(seed)
canvas = _ground(rng)
placed = []
for obj, boxes in zip(spec["objects"], layout(spec)):
items = lib.pick(obj["class"], rng, len(boxes), obj["color"])
for item, box in zip(items, boxes):
sp = lib.load(item)
if obj["color"] and item.get("color") != obj["color"]:
sp = recolor(sp, obj["color"])
sp, (x, y) = _fit(sp, box)
shadow = Image.new("RGBA", sp.size, (0, 0, 0, 0))
shadow.putalpha(sp.split()[3].point(lambda a: int(a * 0.25)))
canvas.paste(shadow.filter(ImageFilter.GaussianBlur(6)), (x + 6, y + 8), shadow.filter(ImageFilter.GaussianBlur(6)))
canvas.paste(sp, (x, y), sp)
placed.append({"class": obj["class"], "color": obj["color"], "box": (x, y, x + sp.size[0], y + sp.size[1]),
"alpha": np.asarray(sp.split()[3]) > 128, "cite": item["cite"],
"recoloured": bool(obj["color"]) and item.get("color") != obj["color"]})
return canvas, placed
def named_color(rgb_pixels):
"""nearest named colour of a set of pixels (Vision's HSV reading), for self-verification"""
if len(rgb_pixels) == 0:
return None
hsv = np.array([colorsys.rgb_to_hsv(*(p / 255.0)) for p in rgb_pixels[:: max(1, len(rgb_pixels) // 400)]])
h, s, v = np.median(hsv[:, 0]), np.median(hsv[:, 1]), np.median(hsv[:, 2])
if v < 0.22:
return "black"
if s < 0.18 and v > 0.7:
return "white"
best, bd = None, 9
for name, (ch, cs, cv) in COLORS.items():
if name in ("black", "white"):
continue
dh = min(abs(h * 360 - ch), 360 - abs(h * 360 - ch)) / 180
d = dh * 2 + abs(s - cs) * 0.6 + abs(v - cv) * 0.8
if d < bd:
best, bd = name, d
return best
def verify(spec, canvas, placed):
"""re-measure every clause from the rendered pixels; returns (all_certified, [clause reports])"""
a = np.asarray(canvas)
rep = []
for obj in spec["objects"]:
mine = [p for p in placed if p["class"] == obj["class"]]
rep.append({"clause": "%d %s" % (obj["count"], obj["class"]), "ok": len(mine) == obj["count"]})
if obj["color"]:
for p in mine:
x0, y0, x1, y1 = p["box"]
px = a[y0:y1, x0:x1][p["alpha"]]
got = named_color(px)
rep.append({"clause": "%s %s" % (obj["color"], obj["class"]), "measured": got, "ok": got == obj["color"]})
if spec["relation"]:
i, r, j = spec["relation"]
A = [p for p in placed if p["class"] == spec["objects"][i]["class"]][0]["box"]
B = [p for p in placed if p["class"] == spec["objects"][j]["class"]][-1]["box"]
ca, cb = ((A[0] + A[2]) / 2, (A[1] + A[3]) / 2), ((B[0] + B[2]) / 2, (B[1] + B[3]) / 2)
ok = {"left": ca[0] < cb[0], "right": ca[0] > cb[0], "above": ca[1] < cb[1], "below": ca[1] > cb[1]}[r]
rep.append({"clause": "%s %s %s" % (spec["objects"][i]["class"], r, spec["objects"][j]["class"]), "ok": ok})
return all(r["ok"] for r in rep), rep123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236"""oracle7-artist: compositional image synthesis by CITED EXEMPLARS (no learned generator, no learned weights).
prompt -> specification (objects, counts, colours, one spatial relation) parse() -> real object instances cut from COCO val2017 with their masks Library (every sprite cites image/annotation) -> layout that makes counts and relations true by construction layout() -> recolouring that keeps each object's texture recolor() -> render on a neutral ground; VERIFY each clause from the pixels render(), verify()The verifier re-measures colour inside each placed object's mask and the geometry of the placed boxes; a clause it cannotcertify is reported, never hidden. The independent score comes from a separate judge (eval/judge.py), not from here."""from __future__ import annotations
import colorsysimport jsonimport osimport randomimport re
import numpy as npfrom PIL import Image, ImageDraw, ImageFilter
COCO = ["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light", "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch", "potted plant", "bed", "dining table", "toilet", "tv", "laptop", "computer mouse", "remote", "computer keyboard", "cell phone", "microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush"]COCO_API_NAME = {"computer mouse": "mouse", "computer keyboard": "keyboard"} # COCO annotation namesIRREGULAR = {"person": "people", "knife": "knives", "mouse": "mice", "sheep": "sheep", "skis": "skis", "scissors": "scissors", "bus": "buses", "couch": "couches", "sandwich": "sandwiches", "toothbrush": "toothbrushes", "glass": "glasses", "wine glass": "wine glasses", "bench": "benches", "tv": "tvs", "hair drier": "hair driers", "cell phone": "cell phones", "potted plant": "potted plants", "dining table": "dining tables", "hot dog": "hot dogs", "teddy bear": "teddy bears"}NUMS = {"two": 2, "three": 3, "four": 4, "five": 5}COLORS = {"red": (0, .85, .80), "orange": (28, .90, .92), "yellow": (54, .90, .95), "green": (125, .75, .60), "blue": (218, .80, .80), "purple": (282, .65, .62), "pink": (330, .45, .95), "brown": (25, .70, .40), "black": (0, 0.0, 0.10), "white": (0, 0.0, 0.97)}REL = {"left of": "left", "right of": "right", "above": "above", "below": "below"}SIZE = 512
def plural(name): if name in IRREGULAR: return IRREGULAR[name] return name + ("es" if name.endswith(("s", "x", "ch", "sh")) else "s")
_NAMES = sorted(COCO, key=len, reverse=True)_PLURALS = {plural(n): n for n in COCO}
def _object(phrase): """'a purple wine glass' / 'three skis' -> {'class','count','color'}""" p = phrase.strip().lower() count = 1 m = re.match(r"^(a|an|one|two|three|four|five)\s+(.*)$", p) if m: count = NUMS.get(m.group(1), 1) p = m.group(2) color = None for c in COLORS: if p.startswith(c + " "): color, p = c, p[len(c) + 1:] name = _PLURALS.get(p, p) if name not in COCO: for n in _NAMES: if p.endswith(n) or p.endswith(plural(n)): name = n break if name not in COCO: raise ValueError("unknown object %r" % phrase) return {"class": name, "count": count, "color": color}
def parse(prompt): p = prompt.strip().lower() p = re.sub(r"^a photo of\s+", "", p) for rel in REL: if " %s " % rel in p: a, b = p.split(" %s " % rel, 1) return {"objects": [_object(a), _object(b)], "relation": (0, REL[rel], 1)} if " and " in p: a, b = p.split(" and ", 1) return {"objects": [_object(a), _object(b)], "relation": None} return {"objects": [_object(p)], "relation": None}
class Library: """real object instances from COCO val2017: the largest, least truncated masks per class, each with its citation"""
def __init__(self, root): self.root = root self.index = json.load(open(os.path.join(root, "index.json")))
def pick(self, cls, rng, k=1): items = self.index[cls] top = items[:max(k, 8)] return rng.sample(top, k) if len(top) >= k else [rng.choice(top) for _ in range(k)]
def load(self, item): return Image.open(os.path.join(self.root, item["file"])).convert("RGBA")
def recolor(im, color): """keep the object's luminance texture; move hue/saturation (or value, for black/white) to the named colour""" a = np.asarray(im).astype(np.float32) / 255.0 rgb, alpha = a[..., :3], a[..., 3:] hsv = np.array(np.vectorize(colorsys.rgb_to_hsv)(rgb[..., 0], rgb[..., 1], rgb[..., 2])).transpose(1, 2, 0) h, s, v = COLORS[color] lum = hsv[..., 2] lum_n = (lum - lum.min()) / (lum.max() - lum.min() + 1e-6) if color == "black": V = 0.04 + 0.22 * lum_n S = hsv[..., 1] * 0.15 H = hsv[..., 0] elif color == "white": V = 0.80 + 0.20 * lum_n S = hsv[..., 1] * 0.08 H = hsv[..., 0] else: V = np.clip(v * (0.55 + 0.45 * lum_n), 0, 1) S = np.full_like(lum, s) H = np.full_like(lum, h / 360.0) out = np.array(np.vectorize(colorsys.hsv_to_rgb)(H, S, V)).transpose(1, 2, 0) return Image.fromarray((np.concatenate([out, alpha], -1) * 255).astype(np.uint8), "RGBA")
def _ground(rng): top = np.array([rng.randint(205, 235)] * 3, np.float32) bot = np.array([rng.randint(150, 185)] * 3, np.float32) t = np.linspace(0, 1, SIZE)[:, None, None] g = top * (1 - t) + bot * t g = np.repeat(g, SIZE, axis=1) + np.random.default_rng(rng.randint(0, 1 << 30)).normal(0, 2.0, (SIZE, SIZE, 3)) return Image.fromarray(np.clip(g, 0, 255).astype(np.uint8), "RGB")
def layout(spec): """boxes (x0, y0, x1, y1) per object instance, making counts and the relation true with clear margins""" objs = spec["objects"] rel = spec["relation"] slots = [] if rel: _, r, _ = rel A = (40, 150, 240, 360) if r in ("left",) else (272, 150, 472, 360) if r == "right" else \ (146, 20, 366, 230) if r == "above" else (146, 282, 366, 492) B = {"left": (272, 150, 472, 360), "right": (40, 150, 240, 360), "above": (146, 282, 366, 492), "below": (146, 20, 366, 230)}[r] return [[A], [B]] if len(objs) == 2: return [[(30, 120, 246, 392)], [(266, 120, 482, 392)]] n = objs[0]["count"] if n == 1: return [[(96, 86, 416, 426)]] cols = 2 if n == 4 else n rows = 2 if n == 4 else 1 w = (SIZE - 40) / cols hgt = (SIZE - 80) / rows if rows > 1 else 300 y0 = 40 if rows > 1 else (SIZE - hgt) / 2 boxes = [] for i in range(n): r_, c_ = divmod(i, cols) boxes.append((int(20 + c_ * w + 8), int(y0 + r_ * hgt + 8), int(20 + (c_ + 1) * w - 8), int(y0 + (r_ + 1) * hgt - 8))) return [boxes]
def _fit(sprite, box): x0, y0, x1, y1 = box w, h = sprite.size s = min((x1 - x0) / w, (y1 - y0) / h) sp = sprite.resize((max(1, int(w * s)), max(1, int(h * s))), Image.LANCZOS) return sp, (x0 + (x1 - x0 - sp.size[0]) // 2, y0 + (y1 - y0 - sp.size[1]) // 2)
def render(spec, lib, seed=0): rng = random.Random(seed) canvas = _ground(rng) placed = [] for obj, boxes in zip(spec["objects"], layout(spec)): items = lib.pick(obj["class"], rng, len(boxes)) for item, box in zip(items, boxes): sp = lib.load(item) if obj["color"]: sp = recolor(sp, obj["color"]) sp, (x, y) = _fit(sp, box) shadow = Image.new("RGBA", sp.size, (0, 0, 0, 0)) shadow.putalpha(sp.split()[3].point(lambda a: int(a * 0.25))) canvas.paste(shadow.filter(ImageFilter.GaussianBlur(6)), (x + 6, y + 8), shadow.filter(ImageFilter.GaussianBlur(6))) canvas.paste(sp, (x, y), sp) placed.append({"class": obj["class"], "color": obj["color"], "box": (x, y, x + sp.size[0], y + sp.size[1]), "alpha": np.asarray(sp.split()[3]) > 128, "cite": item["cite"]}) return canvas, placed
def named_color(rgb_pixels): """nearest named colour of a set of pixels (Vision's HSV reading), for self-verification""" if len(rgb_pixels) == 0: return None hsv = np.array([colorsys.rgb_to_hsv(*(p / 255.0)) for p in rgb_pixels[:: max(1, len(rgb_pixels) // 400)]]) h, s, v = np.median(hsv[:, 0]), np.median(hsv[:, 1]), np.median(hsv[:, 2]) if v < 0.22: return "black" if s < 0.18 and v > 0.7: return "white" best, bd = None, 9 for name, (ch, cs, cv) in COLORS.items(): if name in ("black", "white"): continue dh = min(abs(h * 360 - ch), 360 - abs(h * 360 - ch)) / 180 d = dh * 2 + abs(s - cs) * 0.6 + abs(v - cv) * 0.8 if d < bd: best, bd = name, d return best
def verify(spec, canvas, placed): """re-measure every clause from the rendered pixels; returns (all_certified, [clause reports])""" a = np.asarray(canvas) rep = [] for obj in spec["objects"]: mine = [p for p in placed if p["class"] == obj["class"]] rep.append({"clause": "%d %s" % (obj["count"], obj["class"]), "ok": len(mine) == obj["count"]}) if obj["color"]: for p in mine: x0, y0, x1, y1 = p["box"] px = a[y0:y1, x0:x1][p["alpha"]] got = named_color(px) rep.append({"clause": "%s %s" % (obj["color"], obj["class"]), "measured": got, "ok": got == obj["color"]}) if spec["relation"]: i, r, j = spec["relation"] A = [p for p in placed if p["class"] == spec["objects"][i]["class"]][0]["box"] B = [p for p in placed if p["class"] == spec["objects"][j]["class"]][-1]["box"] ca, cb = ((A[0] + A[2]) / 2, (A[1] + A[3]) / 2), ((B[0] + B[2]) / 2, (B[1] + B[3]) / 2) ok = {"left": ca[0] < cb[0], "right": ca[0] > cb[0], "above": ca[1] < cb[1], "below": ca[1] > cb[1]}[r] rep.append({"clause": "%s %s %s" % (spec["objects"][i]["class"], r, spec["objects"][j]["class"]), "ok": ok}) return all(r["ok"] for r in rep), rep123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#!/usr/bin/env python3"""Calibrate the judge's detection threshold on REAL photographs, independently of Artist: COCO val2017 images that theArtist library does NOT use, ground-truth class presence from COCO annotations (non-crowd instances of area >= 3000 px).The threshold with the best presence F1 is written to results/judge_calibration.json and then used unchanged."""import jsonimport osimport randomimport sys
HERE = os.path.dirname(os.path.abspath(__file__))ROOT = os.path.dirname(HERE)sys.path.insert(0, ROOT)sys.path.insert(0, HERE)from PIL import Image # noqa: E402
import judge as J # noqa: E402from artist import core as A # noqa: E402
ann = json.load(open(os.path.join(ROOT, "coco", "annotations", "instances_val2017.json")))lib = json.load(open(os.path.join(ROOT, "library", "index.json")))used = {it["cite"]["coco_image_id"] for v in lib.values() for it in v}cats = {c["id"]: {"mouse": "computer mouse", "keyboard": "computer keyboard"}.get(c["name"], c["name"]) for c in ann["categories"]}gt = {}for a in ann["annotations"]: if not a["iscrowd"] and a["area"] >= 3000 and a["image_id"] not in used: gt.setdefault(a["image_id"], set()).add(cats[a["category_id"]])imgs = {i["id"]: i["file_name"] for i in ann["images"]}ids = sorted(gt)random.Random(11).shuffle(ids)ids = ids[: int(sys.argv[1]) if len(sys.argv) > 1 else 250]J.DET_THR = 0.05judge = J.Judge(A.COCO)scores = [] # (image, class, max score or 0, present?)for n, i in enumerate(ids): img = Image.open(os.path.join(ROOT, "coco", "val2017", imgs[i])).convert("RGB") best = {} for d in judge.detect(img): best[d["class"]] = max(best.get(d["class"], 0), d["score"]) for c in A.COCO: scores.append((best.get(c, 0.0), c in gt[i])) if (n + 1) % 50 == 0: print(" %d images" % (n + 1), flush=True)res = {}for thr in (0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4): tp = sum(1 for s, p in scores if s >= thr and p) fp = sum(1 for s, p in scores if s >= thr and not p) fn = sum(1 for s, p in scores if s < thr and p) prec, rec = tp / max(1, tp + fp), tp / max(1, tp + fn) res[str(thr)] = {"precision": round(prec, 3), "recall": round(rec, 3), "f1": round(2 * prec * rec / max(1e-9, prec + rec), 3)} print("thr %.2f precision %.3f recall %.3f F1 %.3f" % (thr, prec, rec, res[str(thr)]["f1"]))best = max(res, key=lambda k: res[k]["f1"])out = {"images": len(ids), "excluded_library_images": len(used), "by_threshold": res, "chosen_threshold": float(best)}json.dump(out, open(os.path.join(ROOT, "results", "judge_calibration.json"), "w"), indent=1)print("chosen threshold", best)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123#!/usr/bin/env python3
"""oracle7-artist on GenEval-style prompts, scored by the independent judge (eval/judge.py).
PROTOCOL
dev prompts GENERATED from GenEval's six templates with a fixed seed, excluding every exact GenEval prompt;
all Artist choices are made here
held-out the 553 official GenEval prompts (djghosh13/geneval prompts/evaluation_metadata.jsonl), 4 images each
(seeds 0-3), rendered and judged ONCE
Also recorded: Artist's own pixel verification per image, so its self-report can be compared with the judge.
Also run: the judge on real COCO images with known instance counts (a sanity check on the judge, not on Artist).
usage: eval_geneval.py dev|heldout [n_prompts]"""
import json
import os
import random
import sys
import time
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(HERE)
sys.path.insert(0, ROOT)
sys.path.insert(0, HERE)
from artist import core as A # noqa: E402
GEN = os.path.join(ROOT, "data", "geneval_prompts.jsonl")
NUMW = {2: "two", 3: "three", 4: "four"}
def article(w):
return "an" if w[0] in "aeiou" else "a"
def dev_prompts(n, official):
rng = random.Random(4242)
out = []
while len(out) < n:
tag = rng.choice(["single_object", "two_object", "counting", "colors", "position", "color_attr"])
a, b = rng.sample(A.COCO, 2)
c1, c2 = rng.sample(list(A.COLORS), 2)
if tag == "single_object":
p, inc = "a photo of %s %s" % (article(a), a), [{"class": a, "count": 1}]
elif tag == "two_object":
p, inc = "a photo of %s %s and %s %s" % (article(a), a, article(b), b), [{"class": a, "count": 1}, {"class": b, "count": 1}]
elif tag == "counting":
k = rng.choice([2, 3, 4])
p, inc = "a photo of %s %s" % (NUMW[k], A.plural(a)), [{"class": a, "count": k}]
elif tag == "colors":
p, inc = "a photo of %s %s %s" % (article(c1), c1, a), [{"class": a, "count": 1, "color": c1}]
elif tag == "position":
rel = rng.choice(["left of", "right of", "above", "below"])
p = "a photo of %s %s %s %s %s" % (article(a), a, rel, article(b), b)
inc = [{"class": a, "count": 1, "position": [rel, 1]}, {"class": b, "count": 1}]
else:
p = "a photo of %s %s %s and %s %s %s" % (article(c1), c1, a, article(c2), c2, b)
inc = [{"class": a, "count": 1, "color": c1}, {"class": b, "count": 1, "color": c2}]
if p not in official:
out.append({"tag": tag, "include": inc, "prompt": p})
return out
def main():
split = sys.argv[1]
n = int(sys.argv[2]) if len(sys.argv) > 2 else None
official = [json.loads(l) for l in open(GEN)]
rows = dev_prompts(n or 120, {r["prompt"] for r in official}) if split == "dev" else official[: n or None]
seeds = [0] if split == "dev" else [0, 1, 2, 3]
from judge import Judge
judge = Judge(A.COCO)
lib = A.Library(os.path.join(ROOT, "library"))
outdir = os.path.join(ROOT, "renders", split)
os.makedirs(outdir, exist_ok=True)
per_tag, log = {}, []
t0 = time.time()
specs = []
for r in rows:
try:
specs.append((A.parse(r["prompt"]), None))
except ValueError as e:
specs.append((None, str(e)))
import judge as J
def summary(done_seeds, final):
tags = {k: {"judge": round(v[0] / v[1], 4), "self_verified": round(v[2] / v[1], 4), "n_images": v[1]}
for k, v in per_tag.items()}
overall = sum(t["judge"] for t in tags.values()) / max(1, len(tags)) # GenEval = mean over the tasks
return {"split": split, "prompts": len(rows), "seeds": seeds, "seeds_done": done_seeds, "final": final,
"geneval_style_overall": round(overall, 4), "by_task": tags,
"recoloured_images": sum(1 for x in log if x.get("recoloured")),
"library": os.path.realpath(lib.root), "library_sprites": sum(len(v) for v in lib.index.values()),
"judge": "OWLv2 base (80 COCO queries, thr %.2f) + CLIP ViT-B/32 colour; approximation of official "
"GenEval" % J.DET_THR,
"seconds": round(time.time() - t0), "log": log}
os.makedirs(os.path.join(ROOT, "results"), exist_ok=True)
out = os.path.join(ROOT, "results", "geneval_%s.json" % split)
for si, s in enumerate(seeds): # seed-major: every prompt once before any prompt twice
for i, (r, (spec, err)) in enumerate(zip(rows, specs)):
rec = False
if spec is None:
ok, info, selfok = False, {"reason": "parse: " + err}, False
else:
img, placed = A.render(spec, lib, seed=s)
selfok, rep = A.verify(spec, img, placed)
rec = any(p.get("recoloured") for p in placed)
img.save(os.path.join(outdir, "%03d_%d.png" % (i, s)))
ok, info = judge.score(img, r)
e = per_tag.setdefault(r["tag"], [0, 0, 0])
e[0] += ok
e[1] += 1
e[2] += selfok
log.append({"i": i, "seed": s, "tag": r["tag"], "prompt": r["prompt"], "judge_ok": ok, "self_verified": selfok,
"recoloured": rec, "reason": info.get("reason")})
if (i + 1) % 20 == 0:
tot = sum(v[0] for v in per_tag.values()) / sum(v[1] for v in per_tag.values())
print(" seed %d: %d/%d prompts judge acc %.3f (%.0fs)" % (s, i + 1, len(rows), tot, time.time() - t0),
flush=True)
json.dump(summary(seeds[: si + 1], si == len(seeds) - 1), open(out, "w"), indent=1) # partial after each seed
res = summary(seeds, True)
print(json.dumps({k: v for k, v in res.items() if k != "log"}, indent=1))
json.dump(res, open(out, "w"), indent=1)
if __name__ == "__main__":
main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123#!/usr/bin/env python3
"""oracle7-artist on GenEval-style prompts, scored by the independent judge (eval/judge.py).
PROTOCOL
dev prompts GENERATED from GenEval's six templates with a fixed seed, excluding every exact GenEval prompt;
all Artist choices are made here
held-out the 553 official GenEval prompts (djghosh13/geneval prompts/evaluation_metadata.jsonl), 4 images each
(seeds 0-3), rendered and judged ONCE
Also recorded: Artist's own pixel verification per image, so its self-report can be compared with the judge.
Also run: the judge on real COCO images with known instance counts (a sanity check on the judge, not on Artist).
usage: eval_geneval.py dev|heldout [n_prompts]"""
import json
import os
import random
import sys
import time
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(HERE)
sys.path.insert(0, ROOT)
sys.path.insert(0, HERE)
from artist import core as A # noqa: E402
GEN = os.path.join(ROOT, "data", "geneval_prompts.jsonl")
NUMW = {2: "two", 3: "three", 4: "four"}
def article(w):
return "an" if w[0] in "aeiou" else "a"
def dev_prompts(n, official):
rng = random.Random(4242)
out = []
while len(out) < n:
tag = rng.choice(["single_object", "two_object", "counting", "colors", "position", "color_attr"])
a, b = rng.sample(A.COCO, 2)
c1, c2 = rng.sample(list(A.COLORS), 2)
if tag == "single_object":
p, inc = "a photo of %s %s" % (article(a), a), [{"class": a, "count": 1}]
elif tag == "two_object":
p, inc = "a photo of %s %s and %s %s" % (article(a), a, article(b), b), [{"class": a, "count": 1}, {"class": b, "count": 1}]
elif tag == "counting":
k = rng.choice([2, 3, 4])
p, inc = "a photo of %s %s" % (NUMW[k], A.plural(a)), [{"class": a, "count": k}]
elif tag == "colors":
p, inc = "a photo of %s %s %s" % (article(c1), c1, a), [{"class": a, "count": 1, "color": c1}]
elif tag == "position":
rel = rng.choice(["left of", "right of", "above", "below"])
p = "a photo of %s %s %s %s %s" % (article(a), a, rel, article(b), b)
inc = [{"class": a, "count": 1, "position": [rel, 1]}, {"class": b, "count": 1}]
else:
p = "a photo of %s %s %s and %s %s %s" % (article(c1), c1, a, article(c2), c2, b)
inc = [{"class": a, "count": 1, "color": c1}, {"class": b, "count": 1, "color": c2}]
if p not in official:
out.append({"tag": tag, "include": inc, "prompt": p})
return out
def main():
split = sys.argv[1]
n = int(sys.argv[2]) if len(sys.argv) > 2 else None
official = [json.loads(l) for l in open(GEN)]
rows = dev_prompts(n or 120, {r["prompt"] for r in official}) if split == "dev" else official[: n or None]
seeds = [0] if split == "dev" else [0, 1, 2, 3]
from judge import Judge
judge = Judge(A.COCO)
lib = A.Library(os.path.join(ROOT, "library"))
outdir = os.path.join(ROOT, "renders", split)
os.makedirs(outdir, exist_ok=True)
per_tag, log = {}, []
t0 = time.time()
specs = []
for r in rows:
try:
specs.append((A.parse(r["prompt"]), None))
except ValueError as e:
specs.append((None, str(e)))
import judge as J
def summary(done_seeds, final):
tags = {k: {"judge": round(v[0] / v[1], 4), "self_verified": round(v[2] / v[1], 4), "n_images": v[1]}
for k, v in per_tag.items()}
overall = sum(t["judge"] for t in tags.values()) / max(1, len(tags)) # GenEval = mean over the tasks
return {"split": split, "prompts": len(rows), "seeds": seeds, "seeds_done": done_seeds, "final": final,
"geneval_style_overall": round(overall, 4), "by_task": tags,
"recoloured_images": sum(1 for x in log if x.get("recoloured")),
"library": os.path.realpath(lib.root), "library_sprites": sum(len(v) for v in lib.index.values()),
"judge": "OWLv2 base (80 COCO queries, thr %.2f) + CLIP ViT-B/32 colour; approximation of official "
"GenEval" % J.DET_THR,
"seconds": round(time.time() - t0), "log": log}
os.makedirs(os.path.join(ROOT, "results"), exist_ok=True)
out = os.path.join(ROOT, "results", "geneval_%s.json" % split)
for si, s in enumerate(seeds): # seed-major: every prompt once before any prompt twice
for i, (r, (spec, err)) in enumerate(zip(rows, specs)):
rec = False
if spec is None:
ok, info, selfok = False, {"reason": "parse: " + err}, False
else:
img, placed = A.render(spec, lib, seed=s)
selfok, rep = A.verify(spec, img, placed)
rec = any(p.get("recoloured") for p in placed)
img.save(os.path.join(outdir, "%03d_%d.png" % (i, s)))
ok, info = judge.score(img, r)
e = per_tag.setdefault(r["tag"], [0, 0, 0])
e[0] += ok
e[1] += 1
e[2] += selfok
log.append({"i": i, "seed": s, "tag": r["tag"], "prompt": r["prompt"], "judge_ok": ok, "self_verified": selfok,
"recoloured": rec, "reason": info.get("reason")})
if (i + 1) % 20 == 0:
tot = sum(v[0] for v in per_tag.values()) / sum(v[1] for v in per_tag.values())
print(" seed %d: %d/%d prompts judge acc %.3f (%.0fs)" % (s, i + 1, len(rows), tot, time.time() - t0),
flush=True)
json.dump(summary(seeds[: si + 1], si == len(seeds) - 1), open(out, "w"), indent=1) # partial after each seed
res = summary(seeds, True)
print(json.dumps({k: v for k, v in res.items() if k != "log"}, indent=1))
json.dump(res, open(out, "w"), indent=1)
if __name__ == "__main__":
main()12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394"""Independent judge for GenEval-style prompts (an APPROXIMATION of the official GenEval scorer, which uses
Mask2Former + CLIP): OWLv2 open-vocabulary detection queried with ALL 80 COCO class names (each box takes its best class,
so it behaves as a closed-set detector), CLIP ViT-B/32 for object colour, and GenEval's task rules:
single_object / two_object every required class detected
counting exactly N detections of the class
colors / color_attr required classes detected, and CLIP names the right colour on each (largest) detection
position both detected and the centre of A lies left/right/above/below B by > 10% of the image
Nothing from Artist is shared with the judge: it sees only the rendered image and the prompt's metadata."""
from __future__ import annotations
import numpy as np
import torch
from PIL import Image
from transformers import CLIPModel, CLIPProcessor, Owlv2ForObjectDetection, Owlv2Processor
COLORS = ["red", "orange", "yellow", "green", "blue", "purple", "pink", "brown", "black", "white"]
DET_THR = 0.25 # calibrate_judge.py: best presence F1 on 250 real COCO photos (0.543; 0.30 ties), fixed thereafter
NMS_IOU = 0.5
POS_MARGIN = 0.10
class Judge:
def __init__(self, classes):
torch.set_num_threads(2)
self.classes = classes
self.dp = Owlv2Processor.from_pretrained("google/owlv2-base-patch16-ensemble")
self.dm = Owlv2ForObjectDetection.from_pretrained("google/owlv2-base-patch16-ensemble").eval()
self.cp = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
self.cm = CLIPModel.from_pretrained("openai/clip-vit-base-patch32").eval()
self.queries = ["a photo of a %s" % c for c in classes]
@torch.no_grad()
def detect(self, img):
inp = self.dp(text=[self.queries], images=img, return_tensors="pt")
out = self.dm(**inp)
W, H = img.size
side = max(W, H) # OWLv2 pads to a square: boxes are relative to the padded side
pp = getattr(self.dp, "post_process_grounded_object_detection", None) or self.dp.post_process_object_detection
res = pp(outputs=out, threshold=DET_THR, target_sizes=torch.tensor([[side, side]]))[0]
dets = [{"class": self.classes[int(l)], "score": float(s), "box": [float(v) for v in b]}
for s, l, b in zip(res["scores"], res["labels"], res["boxes"])]
dets.sort(key=lambda d: -d["score"])
keep = []
for d in dets: # class-aware NMS
if all(k["class"] != d["class"] or _iou(k["box"], d["box"]) < NMS_IOU for k in keep):
keep.append(d)
return keep
@torch.no_grad()
def color(self, img, box, cls):
x0, y0, x1, y1 = [int(v) for v in box]
crop = img.crop((max(0, x0), max(0, y0), max(x0 + 1, x1), max(y0 + 1, y1)))
texts = ["a photo of a %s %s" % (c, cls) for c in COLORS]
inp = self.cp(text=texts, images=crop, return_tensors="pt", padding=True)
return COLORS[int(self.cm(**inp).logits_per_image[0].argmax())]
def score(self, img, meta):
dets = self.detect(img)
W, H = img.size
need = meta["include"]
found = []
for req in need:
mine = [d for d in dets if d["class"] == req["class"]]
n = req.get("count", 1)
if meta["tag"] == "counting":
if len(mine) != n:
return False, {"reason": "count %d != %d" % (len(mine), n), "dets": dets}
elif len(mine) < 1:
return False, {"reason": "missing %s" % req["class"], "dets": dets}
if req.get("color"):
big = max(mine, key=lambda d: (d["box"][2] - d["box"][0]) * (d["box"][3] - d["box"][1]))
got = self.color(img, big["box"], req["class"])
if got != req["color"]:
return False, {"reason": "colour %s != %s" % (got, req["color"]), "dets": dets}
found.append(mine)
for k, req in enumerate(need):
if req.get("position"):
rel, j = req["position"]
a = max(found[k], key=lambda d: d["score"])["box"]
b = max(found[j], key=lambda d: d["score"])["box"]
ca, cb = ((a[0] + a[2]) / 2, (a[1] + a[3]) / 2), ((b[0] + b[2]) / 2, (b[1] + b[3]) / 2)
ok = {"left of": ca[0] < cb[0] - POS_MARGIN * W, "right of": ca[0] > cb[0] + POS_MARGIN * W,
"above": ca[1] < cb[1] - POS_MARGIN * H, "below": ca[1] > cb[1] + POS_MARGIN * H}[rel]
if not ok:
return False, {"reason": "relation %s failed" % rel, "dets": dets}
return True, {"dets": dets}
def _iou(a, b):
ix = max(0, min(a[2], b[2]) - max(a[0], b[0]))
iy = max(0, min(a[3], b[3]) - max(a[1], b[1]))
inter = ix * iy
ua = (a[2] - a[0]) * (a[3] - a[1]) + (b[2] - b[0]) * (b[3] - b[1]) - inter
return inter / ua if ua > 0 else 0.012345678910111213141516171819202122232425262728293031323334353637383940#!/usr/bin/env python3"""artist pack exam: a small sprite library drawn here, since the cited COCO sprites are in the full pack only. Every clause is measured backfrom the pixels by verify(), a wrong layout must fail it, and every placed sprite carries a citation."""import jsonimport osimport sysimport tempfilefrom pathlib import Path
from PIL import Image, ImageDraw
sys.path.insert(0, str(Path(__file__).resolve().parent))from artist import core as A # noqa: E402
root = tempfile.mkdtemp()index = {}for cls, draw in (("apple", lambda d: d.ellipse((30, 30, 226, 226), fill=(200, 60, 50, 255))), ("cup", lambda d: d.rectangle((30, 30, 226, 226), fill=(70, 110, 200, 255)))): im = Image.new("RGBA", (256, 256), (0, 0, 0, 0)) draw(ImageDraw.Draw(im)) f = cls + ".png" im.save(os.path.join(root, f)) index[cls] = [{"file": f, "cite": "drawn by this exam", "color": None}]json.dump(index, open(os.path.join(root, "index.json"), "w"))lib = A.Library(root)prompts = ["a photo of a red apple", "a photo of a blue cup", "a photo of two apples", "a photo of a red apple and a blue cup", "a photo of an apple left of a cup", "a photo of an apple above a cup"]good = cited = 0for p in prompts: spec = A.parse(p) canvas, placed = A.render(spec, lib, 0) ok, _rep = A.verify(spec, canvas, placed) good += ok cited += all(x["cite"] for x in placed)spec = A.parse("a photo of an apple left of a cup")canvas, placed = A.render(spec, lib, 0)placed = list(reversed(placed))swap = [dict(placed[0], **{"class": "apple"}), dict(placed[1], **{"class": "cup"})]swap[0]["box"], swap[1]["box"] = placed[1]["box"], placed[0]["box"]swap[0]["box"], swap[1]["box"] = swap[1]["box"], swap[0]["box"]mutant_caught = not A.verify(spec, canvas, swap)[0]print(json.dumps({"passed": good == len(prompts) and cited == len(prompts) and mutant_caught, "summary": "%d of %d prompts certified from pixels, all cited: %s, wrong layout refused: %s" % (good, len(prompts), cited == len(prompts), mutant_caught)}))12345678910111213141516171819202122#!/usr/bin/env python3"""night for artist and chameleon - each failure in the orbiter's own record becomes a typed hole in the orbiters' one format, ranked by what it costs. What fills a hole needs ajudge or a browser that isn't in the pack, so this night reports; it builds nothing. usage: python night.py"""import jsonfrom pathlib import Path
HERE = Path(__file__).resolve().parentholes = []if HERE.name == "artist": d = json.load(open(HERE / "results" / "geneval_heldout.json")) for task, r in d["by_task"].items(): lost = r["n_images"] * (1 - r["judge"]) gap = r["self_verified"] - r["judge"] holes.append({"origin": "artist", "kind": "not_recognised" if gap > .2 else "failed_check", "want": "compositing an outside judge recognises" if gap > .2 else "sprites for this kind", "givens": {"task": task, "judge": r["judge"], "self_verified": r["self_verified"]}, "cost": round(lost)})else: d = json.load(open(HERE / "results" / "release-panel-current-20260921b.json")) for t in d["targets"]: st = [a.get("status") for a in t.get("attempts", [])] if st and st[-1] != "COMPLETE": holes.append({"origin": "chameleon", "kind": "blocked", "want": "an operator or a contract for this target", "givens": {"id": t["id"], "family": t.get("family"), "split": t.get("split"), "status": st[-1]}, "cost": 1})holes.sort(key=lambda h: -h["cost"])print(json.dumps({"holes": len(holes), "top": holes[:4]}, indent=1))12345678910{
"name": "artist",
"good_for": "Makes images by citation: real sprites, placed to the prompt, each clause checked from the pixels.",
"python": [
"numpy",
"PIL"
],
"programs": [],
"exam": "exam_pack.py"
}123code_sha256 000154e2ebf0403c300c98c12da0aa94a7e553e12e07acab12b74086f8acd6c7library_index_sha256 4b1d83af4ab12424822ce58129fd044283fa77d216bac789784c80f062187f4dfrozen 2026-09-25T13:35:12Z123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399{ "split": "dev", "prompts": 40, "seeds": [ 0 ], "geneval_style_overall": 0.3917, "by_task": { "colors": { "judge": 0.5, "self_verified": 0.9167, "n_images": 12 }, "position": { "judge": 0.3333, "self_verified": 1.0, "n_images": 6 }, "two_object": { "judge": 0.375, "self_verified": 1.0, "n_images": 8 }, "color_attr": { "judge": 0.0, "self_verified": 1.0, "n_images": 6 }, "counting": { "judge": 0.75, "self_verified": 1.0, "n_images": 8 } }, "judge": "OWLv2 base (80 COCO queries, thr 0.30) + CLIP ViT-B/32 colour; approximation of official GenEval", "seconds": 1045, "log": [ { "i": 0, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow cup", "judge_ok": false, "self_verified": true, "reason": "missing cup" }, { "i": 1, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow motorcycle", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 2, "seed": 0, "tag": "position", "prompt": "a photo of a dining table right of a cat", "judge_ok": false, "self_verified": true, "reason": "missing dining table" }, { "i": 3, "seed": 0, "tag": "two_object", "prompt": "a photo of a knife and a cat", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 4, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown refrigerator and a red frisbee", "judge_ok": false, "self_verified": true, "reason": "missing frisbee" }, { "i": 5, "seed": 0, "tag": "counting", "prompt": "a photo of four knives", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 6, "seed": 0, "tag": "counting", "prompt": "a photo of three bowls", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 7, "seed": 0, "tag": "color_attr", "prompt": "a photo of a purple bottle and a black bear", "judge_ok": false, "self_verified": true, "reason": "missing bottle" }, { "i": 8, "seed": 0, "tag": "colors", "prompt": "a photo of an orange baseball bat", "judge_ok": false, "self_verified": true, "reason": "missing baseball bat" }, { "i": 9, "seed": 0, "tag": "counting", "prompt": "a photo of three bears", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 10, "seed": 0, "tag": "counting", "prompt": "a photo of four fire hydrants", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 11, "seed": 0, "tag": "colors", "prompt": "a photo of a brown dining table", "judge_ok": false, "self_verified": true, "reason": "missing dining table" }, { "i": 12, "seed": 0, "tag": "position", "prompt": "a photo of a sandwich right of a fire hydrant", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 13, "seed": 0, "tag": "colors", "prompt": "a photo of a green scissors", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 14, "seed": 0, "tag": "color_attr", "prompt": "a photo of a green donut and a pink tv", "judge_ok": false, "self_verified": true, "reason": "missing donut" }, { "i": 15, "seed": 0, "tag": "position", "prompt": "a photo of a sandwich below a bird", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 16, "seed": 0, "tag": "counting", "prompt": "a photo of four surfboards", "judge_ok": false, "self_verified": true, "reason": "count 0 != 4" }, { "i": 17, "seed": 0, "tag": "two_object", "prompt": "a photo of a motorcycle and a giraffe", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 18, "seed": 0, "tag": "colors", "prompt": "a photo of a green dog", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 19, "seed": 0, "tag": "counting", "prompt": "a photo of three sheep", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 20, "seed": 0, "tag": "colors", "prompt": "a photo of a blue hair drier", "judge_ok": false, "self_verified": true, "reason": "missing hair drier" }, { "i": 21, "seed": 0, "tag": "two_object", "prompt": "a photo of a bowl and a parking meter", "judge_ok": false, "self_verified": true, "reason": "missing bowl" }, { "i": 22, "seed": 0, "tag": "two_object", "prompt": "a photo of a traffic light and a cow", "judge_ok": false, "self_verified": true, "reason": "missing cow" }, { "i": 23, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow umbrella", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 24, "seed": 0, "tag": "position", "prompt": "a photo of a refrigerator below a chair", "judge_ok": false, "self_verified": true, "reason": "missing chair" }, { "i": 25, "seed": 0, "tag": "colors", "prompt": "a photo of a pink truck", "judge_ok": false, "self_verified": true, "reason": "missing truck" }, { "i": 26, "seed": 0, "tag": "two_object", "prompt": "a photo of a sports ball and a dog", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 27, "seed": 0, "tag": "two_object", "prompt": "a photo of a dog and a sheep", "judge_ok": false, "self_verified": true, "reason": "missing sheep" }, { "i": 28, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown suitcase and an orange bowl", "judge_ok": false, "self_verified": true, "reason": "missing suitcase" }, { "i": 29, "seed": 0, "tag": "colors", "prompt": "a photo of an orange horse", "judge_ok": true, "self_verified": false, "reason": null }, { "i": 30, "seed": 0, "tag": "position", "prompt": "a photo of a person left of a cup", "judge_ok": false, "self_verified": true, "reason": "missing person" }, { "i": 31, "seed": 0, "tag": "colors", "prompt": "a photo of a black broccoli", "judge_ok": false, "self_verified": true, "reason": "missing broccoli" }, { "i": 32, "seed": 0, "tag": "position", "prompt": "a photo of a truck below a book", "judge_ok": false, "self_verified": true, "reason": "missing book" }, { "i": 33, "seed": 0, "tag": "counting", "prompt": "a photo of three computer mouses", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 34, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown cat and a white clock", "judge_ok": false, "self_verified": true, "reason": "missing cat" }, { "i": 35, "seed": 0, "tag": "two_object", "prompt": "a photo of an apple and a chair", "judge_ok": false, "self_verified": true, "reason": "missing apple" }, { "i": 36, "seed": 0, "tag": "counting", "prompt": "a photo of two tvs", "judge_ok": false, "self_verified": true, "reason": "count 1 != 2" }, { "i": 37, "seed": 0, "tag": "two_object", "prompt": "a photo of a stop sign and a baseball bat", "judge_ok": false, "self_verified": true, "reason": "missing baseball bat" }, { "i": 38, "seed": 0, "tag": "colors", "prompt": "a photo of a blue motorcycle", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 39, "seed": 0, "tag": "color_attr", "prompt": "a photo of a yellow sandwich and a blue cat", "judge_ok": false, "self_verified": true, "reason": "missing sandwich" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119{ "split": "dev", "prompts": 120, "seeds": [ 0 ], "geneval_style_overall": 0.4547, "by_task": { "colors": { "judge": 0.4839, "self_verified": 0.9677, "n_images": 31 }, "position": { "judge": 0.5263, "self_verified": 1.0, "n_images": 19 }, "two_object": { "judge": 0.5833, "self_verified": 1.0, "n_images": 24 }, "color_attr": { "judge": 0.0, "self_verified": 0.9524, "n_images": 21 }, "counting": { "judge": 0.68, "self_verified": 1.0, "n_images": 25 } }, "judge": "OWLv2 base (80 COCO queries, thr 0.30) + CLIP ViT-B/32 colour; approximation of official GenEval", "seconds": 2785, "log": [ { "i": 0, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow cup", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 1, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow motorcycle", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 2, "seed": 0, "tag": "position", "prompt": "a photo of a dining table right of a cat", "judge_ok": false, "self_verified": true, "reason": "missing dining table" }, { "i": 3, "seed": 0, "tag": "two_object", "prompt": "a photo of a knife and a cat", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 4, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown refrigerator and a red frisbee", "judge_ok": false, "self_verified": true, "reason": "missing frisbee" }, { "i": 5, "seed": 0, "tag": "counting", "prompt": "a photo of four knives", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 6, "seed": 0, "tag": "counting", "prompt": "a photo of three bowls", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 7, "seed": 0, "tag": "color_attr", "prompt": "a photo of a purple bottle and a black bear", "judge_ok": false, "self_verified": true, "reason": "missing bottle" }, { "i": 8, "seed": 0, "tag": "colors", "prompt": "a photo of an orange baseball bat", "judge_ok": false, "self_verified": true, "reason": "colour brown != orange" }, { "i": 9, "seed": 0, "tag": "counting", "prompt": "a photo of three bears", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 10, "seed": 0, "tag": "counting", "prompt": "a photo of four fire hydrants", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 11, "seed": 0, "tag": "colors", "prompt": "a photo of a brown dining table", "judge_ok": false, "self_verified": true, "reason": "missing dining table" }, { "i": 12, "seed": 0, "tag": "position", "prompt": "a photo of a sandwich right of a fire hydrant", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 13, "seed": 0, "tag": "colors", "prompt": "a photo of a green scissors", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 14, "seed": 0, "tag": "color_attr", "prompt": "a photo of a green donut and a pink tv", "judge_ok": false, "self_verified": true, "reason": "missing donut" }, { "i": 15, "seed": 0, "tag": "position", "prompt": "a photo of a sandwich below a bird", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 16, "seed": 0, "tag": "counting", "prompt": "a photo of four surfboards", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 17, "seed": 0, "tag": "two_object", "prompt": "a photo of a motorcycle and a giraffe", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 18, "seed": 0, "tag": "colors", "prompt": "a photo of a green dog", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 19, "seed": 0, "tag": "counting", "prompt": "a photo of three sheep", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 20, "seed": 0, "tag": "colors", "prompt": "a photo of a blue hair drier", "judge_ok": false, "self_verified": true, "reason": "missing hair drier" }, { "i": 21, "seed": 0, "tag": "two_object", "prompt": "a photo of a bowl and a parking meter", "judge_ok": false, "self_verified": true, "reason": "missing parking meter" }, { "i": 22, "seed": 0, "tag": "two_object", "prompt": "a photo of a traffic light and a cow", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 23, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow umbrella", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 24, "seed": 0, "tag": "position", "prompt": "a photo of a refrigerator below a chair", "judge_ok": false, "self_verified": true, "reason": "missing chair" }, { "i": 25, "seed": 0, "tag": "colors", "prompt": "a photo of a pink truck", "judge_ok": false, "self_verified": true, "reason": "missing truck" }, { "i": 26, "seed": 0, "tag": "two_object", "prompt": "a photo of a sports ball and a dog", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 27, "seed": 0, "tag": "two_object", "prompt": "a photo of a dog and a sheep", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 28, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown suitcase and an orange bowl", "judge_ok": false, "self_verified": true, "reason": "missing bowl" }, { "i": 29, "seed": 0, "tag": "colors", "prompt": "a photo of an orange horse", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 30, "seed": 0, "tag": "position", "prompt": "a photo of a person left of a cup", "judge_ok": false, "self_verified": true, "reason": "missing person" }, { "i": 31, "seed": 0, "tag": "colors", "prompt": "a photo of a black broccoli", "judge_ok": false, "self_verified": true, "reason": "missing broccoli" }, { "i": 32, "seed": 0, "tag": "position", "prompt": "a photo of a truck below a book", "judge_ok": false, "self_verified": true, "reason": "missing book" }, { "i": 33, "seed": 0, "tag": "counting", "prompt": "a photo of three computer mouses", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 34, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown cat and a white clock", "judge_ok": false, "self_verified": true, "reason": "missing cat" }, { "i": 35, "seed": 0, "tag": "two_object", "prompt": "a photo of an apple and a chair", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 36, "seed": 0, "tag": "counting", "prompt": "a photo of two tvs", "judge_ok": false, "self_verified": true, "reason": "count 1 != 2" }, { "i": 37, "seed": 0, "tag": "two_object", "prompt": "a photo of a stop sign and a baseball bat", "judge_ok": false, "self_verified": true, "reason": "missing baseball bat" }, { "i": 38, "seed": 0, "tag": "colors", "prompt": "a photo of a blue motorcycle", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 39, "seed": 0, "tag": "color_attr", "prompt": "a photo of a yellow sandwich and a blue cat", "judge_ok": false, "self_verified": true, "reason": "colour green != yellow" }, { "i": 40, "seed": 0, "tag": "position", "prompt": "a photo of a dog left of a refrigerator", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 41, "seed": 0, "tag": "two_object", "prompt": "a photo of a baseball bat and a cell phone", "judge_ok": false, "self_verified": true, "reason": "missing baseball bat" }, { "i": 42, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown fire hydrant and a white cell phone", "judge_ok": false, "self_verified": true, "reason": "missing cell phone" }, { "i": 43, "seed": 0, "tag": "colors", "prompt": "a photo of a brown suitcase", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 44, "seed": 0, "tag": "colors", "prompt": "a photo of a black tennis racket", "judge_ok": false, "self_verified": false, "reason": "missing tennis racket" }, { "i": 45, "seed": 0, "tag": "position", "prompt": "a photo of a bench right of a snowboard", "judge_ok": false, "self_verified": true, "reason": "missing bench" }, { "i": 46, "seed": 0, "tag": "color_attr", "prompt": "a photo of a purple bowl and a white tie", "judge_ok": false, "self_verified": true, "reason": "missing bowl" }, { "i": 47, "seed": 0, "tag": "colors", "prompt": "a photo of a purple toilet", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 48, "seed": 0, "tag": "colors", "prompt": "a photo of a red spoon", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 49, "seed": 0, "tag": "two_object", "prompt": "a photo of a knife and a spoon", "judge_ok": false, "self_verified": true, "reason": "missing spoon" }, { "i": 50, "seed": 0, "tag": "two_object", "prompt": "a photo of a potted plant and a bird", "judge_ok": false, "self_verified": true, "reason": "missing potted plant" }, { "i": 51, "seed": 0, "tag": "counting", "prompt": "a photo of four beds", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 52, "seed": 0, "tag": "color_attr", "prompt": "a photo of an orange cake and a blue potted plant", "judge_ok": false, "self_verified": true, "reason": "missing cake" }, { "i": 53, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown fire hydrant and a pink bear", "judge_ok": false, "self_verified": true, "reason": "missing bear" }, { "i": 54, "seed": 0, "tag": "color_attr", "prompt": "a photo of a white computer mouse and a red sports ball", "judge_ok": false, "self_verified": true, "reason": "missing sports ball" }, { "i": 55, "seed": 0, "tag": "counting", "prompt": "a photo of three scissors", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 56, "seed": 0, "tag": "two_object", "prompt": "a photo of a scissors and a chair", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 57, "seed": 0, "tag": "colors", "prompt": "a photo of an orange cat", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 58, "seed": 0, "tag": "counting", "prompt": "a photo of two bottles", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 59, "seed": 0, "tag": "color_attr", "prompt": "a photo of an orange microwave and a red chair", "judge_ok": false, "self_verified": true, "reason": "colour brown != orange" }, { "i": 60, "seed": 0, "tag": "colors", "prompt": "a photo of a white person", "judge_ok": false, "self_verified": true, "reason": "colour green != white" }, { "i": 61, "seed": 0, "tag": "colors", "prompt": "a photo of a green tie", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 62, "seed": 0, "tag": "colors", "prompt": "a photo of a red boat", "judge_ok": false, "self_verified": true, "reason": "missing boat" }, { "i": 63, "seed": 0, "tag": "position", "prompt": "a photo of a fire hydrant below a baseball glove", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 64, "seed": 0, "tag": "counting", "prompt": "a photo of two baseball bats", "judge_ok": false, "self_verified": true, "reason": "count 0 != 2" }, { "i": 65, "seed": 0, "tag": "position", "prompt": "a photo of a bowl left of a hot dog", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 66, "seed": 0, "tag": "counting", "prompt": "a photo of four fire hydrants", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 67, "seed": 0, "tag": "color_attr", "prompt": "a photo of a black car and a purple couch", "judge_ok": false, "self_verified": true, "reason": "colour brown != black" }, { "i": 68, "seed": 0, "tag": "counting", "prompt": "a photo of three cats", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 69, "seed": 0, "tag": "colors", "prompt": "a photo of a pink fork", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 70, "seed": 0, "tag": "color_attr", "prompt": "a photo of a white potted plant and a black banana", "judge_ok": false, "self_verified": false, "reason": "missing potted plant" }, { "i": 71, "seed": 0, "tag": "color_attr", "prompt": "a photo of an orange person and a white clock", "judge_ok": false, "self_verified": true, "reason": "missing person" }, { "i": 72, "seed": 0, "tag": "counting", "prompt": "a photo of two suitcases", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 73, "seed": 0, "tag": "two_object", "prompt": "a photo of a bench and a chair", "judge_ok": false, "self_verified": true, "reason": "missing bench" }, { "i": 74, "seed": 0, "tag": "colors", "prompt": "a photo of a green person", "judge_ok": false, "self_verified": true, "reason": "missing person" }, { "i": 75, "seed": 0, "tag": "two_object", "prompt": "a photo of a bus and a surfboard", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 76, "seed": 0, "tag": "two_object", "prompt": "a photo of a chair and a surfboard", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 77, "seed": 0, "tag": "colors", "prompt": "a photo of a blue train", "judge_ok": false, "self_verified": true, "reason": "colour yellow != blue" }, { "i": 78, "seed": 0, "tag": "counting", "prompt": "a photo of four birds", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 79, "seed": 0, "tag": "position", "prompt": "a photo of a bed above a car", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 80, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown computer keyboard and a red cake", "judge_ok": false, "self_verified": true, "reason": "missing cake" }, { "i": 81, "seed": 0, "tag": "counting", "prompt": "a photo of two benches", "judge_ok": false, "self_verified": true, "reason": "count 0 != 2" }, { "i": 82, "seed": 0, "tag": "counting", "prompt": "a photo of two refrigerators", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 83, "seed": 0, "tag": "two_object", "prompt": "a photo of a boat and a giraffe", "judge_ok": false, "self_verified": true, "reason": "missing boat" }, { "i": 84, "seed": 0, "tag": "position", "prompt": "a photo of a book below a kite", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 85, "seed": 0, "tag": "colors", "prompt": "a photo of a green scissors", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 86, "seed": 0, "tag": "counting", "prompt": "a photo of four toothbrushes", "judge_ok": false, "self_verified": true, "reason": "count 3 != 4" }, { "i": 87, "seed": 0, "tag": "colors", "prompt": "a photo of a pink book", "judge_ok": false, "self_verified": true, "reason": "colour purple != pink" }, { "i": 88, "seed": 0, "tag": "color_attr", "prompt": "a photo of an orange hair drier and a red baseball bat", "judge_ok": false, "self_verified": true, "reason": "missing hair drier" }, { "i": 89, "seed": 0, "tag": "position", "prompt": "a photo of a cat left of a clock", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 90, "seed": 0, "tag": "colors", "prompt": "a photo of a black parking meter", "judge_ok": false, "self_verified": true, "reason": "colour brown != black" }, { "i": 91, "seed": 0, "tag": "colors", "prompt": "a photo of a red person", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 92, "seed": 0, "tag": "position", "prompt": "a photo of a person below a handbag", "judge_ok": false, "self_verified": true, "reason": "missing person" }, { "i": 93, "seed": 0, "tag": "counting", "prompt": "a photo of four cakes", "judge_ok": false, "self_verified": true, "reason": "count 2 != 4" }, { "i": 94, "seed": 0, "tag": "counting", "prompt": "a photo of two tvs", "judge_ok": false, "self_verified": true, "reason": "count 1 != 2" }, { "i": 95, "seed": 0, "tag": "two_object", "prompt": "a photo of a vase and an apple", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 96, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow skis", "judge_ok": false, "self_verified": true, "reason": "missing skis" }, { "i": 97, "seed": 0, "tag": "color_attr", "prompt": "a photo of a yellow truck and a purple sheep", "judge_ok": false, "self_verified": true, "reason": "missing sheep" }, { "i": 98, "seed": 0, "tag": "two_object", "prompt": "a photo of a traffic light and an oven", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 99, "seed": 0, "tag": "position", "prompt": "a photo of a clock left of a snowboard", "judge_ok": false, "self_verified": true, "reason": "missing snowboard" }, { "i": 100, "seed": 0, "tag": "two_object", "prompt": "a photo of a scissors and a giraffe", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 101, "seed": 0, "tag": "position", "prompt": "a photo of a motorcycle left of a traffic light", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 102, "seed": 0, "tag": "position", "prompt": "a photo of a hair drier right of a car", "judge_ok": false, "self_verified": true, "reason": "missing hair drier" }, { "i": 103, "seed": 0, "tag": "position", "prompt": "a photo of a broccoli right of a vase", "judge_ok": false, "self_verified": true, "reason": "missing broccoli" }, { "i": 104, "seed": 0, "tag": "two_object", "prompt": "a photo of a chair and a suitcase", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 105, "seed": 0, "tag": "colors", "prompt": "a photo of a white surfboard", "judge_ok": false, "self_verified": true, "reason": "missing surfboard" }, { "i": 106, "seed": 0, "tag": "colors", "prompt": "a photo of a black parking meter", "judge_ok": false, "self_verified": true, "reason": "colour brown != black" }, { "i": 107, "seed": 0, "tag": "colors", "prompt": "a photo of a brown cell phone", "judge_ok": false, "self_verified": true, "reason": "missing cell phone" }, { "i": 108, "seed": 0, "tag": "two_object", "prompt": "a photo of a backpack and a truck", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 109, "seed": 0, "tag": "position", "prompt": "a photo of a refrigerator left of a computer mouse", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 110, "seed": 0, "tag": "two_object", "prompt": "a photo of an apple and a dining table", "judge_ok": false, "self_verified": true, "reason": "missing dining table" }, { "i": 111, "seed": 0, "tag": "two_object", "prompt": "a photo of a cat and a handbag", "judge_ok": false, "self_verified": true, "reason": "missing handbag" }, { "i": 112, "seed": 0, "tag": "counting", "prompt": "a photo of two elephants", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 113, "seed": 0, "tag": "two_object", "prompt": "a photo of a snowboard and a cell phone", "judge_ok": false, "self_verified": true, "reason": "missing snowboard" }, { "i": 114, "seed": 0, "tag": "counting", "prompt": "a photo of four backpacks", "judge_ok": false, "self_verified": true, "reason": "count 3 != 4" }, { "i": 115, "seed": 0, "tag": "color_attr", "prompt": "a photo of a purple apple and a red tie", "judge_ok": false, "self_verified": true, "reason": "missing apple" }, { "i": 116, "seed": 0, "tag": "counting", "prompt": "a photo of three vases", "judge_ok": false, "self_verified": true, "reason": "count 4 != 3" }, { "i": 117, "seed": 0, "tag": "color_attr", "prompt": "a photo of a green hair drier and a purple stop sign", "judge_ok": false, "self_verified": true, "reason": "missing hair drier" }, { "i": 118, "seed": 0, "tag": "counting", "prompt": "a photo of three couches", "judge_ok": true, "self_verified": true, "reason": null }, { "i": 119, "seed": 0, "tag": "color_attr", "prompt": "a photo of a red tv and a pink hair drier", "judge_ok": false, "self_verified": true, "reason": "missing tv" } ]}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246{ "split": "dev", "prompts": 120, "seeds": [ 0 ], "seeds_done": [ 0 ], "final": true, "geneval_style_overall": 0.4768, "by_task": { "colors": { "judge": 0.4516, "self_verified": 0.9677, "n_images": 31 }, "position": { "judge": 0.5263, "self_verified": 1.0, "n_images": 19 }, "two_object": { "judge": 0.5833, "self_verified": 1.0, "n_images": 24 }, "color_attr": { "judge": 0.1429, "self_verified": 0.9524, "n_images": 21 }, "counting": { "judge": 0.68, "self_verified": 1.0, "n_images": 25 } }, "recoloured_images": 38, "library": "/opt/oracle7-artist/library", "library_sprites": 2673, "judge": "OWLv2 base (80 COCO queries, thr 0.25) + CLIP ViT-B/32 colour; approximation of official GenEval", "seconds": 3009, "log": [ { "i": 0, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow cup", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 1, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow motorcycle", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 2, "seed": 0, "tag": "position", "prompt": "a photo of a dining table right of a cat", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing dining table" }, { "i": 3, "seed": 0, "tag": "two_object", "prompt": "a photo of a knife and a cat", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 4, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown refrigerator and a red frisbee", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "colour brown != red" }, { "i": 5, "seed": 0, "tag": "counting", "prompt": "a photo of four knives", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 6, "seed": 0, "tag": "counting", "prompt": "a photo of three bowls", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 7, "seed": 0, "tag": "color_attr", "prompt": "a photo of a purple bottle and a black bear", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "colour brown != black" }, { "i": 8, "seed": 0, "tag": "colors", "prompt": "a photo of an orange baseball bat", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "colour brown != orange" }, { "i": 9, "seed": 0, "tag": "counting", "prompt": "a photo of three bears", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 10, "seed": 0, "tag": "counting", "prompt": "a photo of four fire hydrants", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 11, "seed": 0, "tag": "colors", "prompt": "a photo of a brown dining table", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing dining table" }, { "i": 12, "seed": 0, "tag": "position", "prompt": "a photo of a sandwich right of a fire hydrant", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 13, "seed": 0, "tag": "colors", "prompt": "a photo of a green scissors", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 14, "seed": 0, "tag": "color_attr", "prompt": "a photo of a green donut and a pink tv", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 15, "seed": 0, "tag": "position", "prompt": "a photo of a sandwich below a bird", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 16, "seed": 0, "tag": "counting", "prompt": "a photo of four surfboards", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 17, "seed": 0, "tag": "two_object", "prompt": "a photo of a motorcycle and a giraffe", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 18, "seed": 0, "tag": "colors", "prompt": "a photo of a green dog", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 19, "seed": 0, "tag": "counting", "prompt": "a photo of three sheep", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 20, "seed": 0, "tag": "colors", "prompt": "a photo of a blue hair drier", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing hair drier" }, { "i": 21, "seed": 0, "tag": "two_object", "prompt": "a photo of a bowl and a parking meter", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing parking meter" }, { "i": 22, "seed": 0, "tag": "two_object", "prompt": "a photo of a traffic light and a cow", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 23, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow umbrella", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 24, "seed": 0, "tag": "position", "prompt": "a photo of a refrigerator below a chair", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing chair" }, { "i": 25, "seed": 0, "tag": "colors", "prompt": "a photo of a pink truck", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 26, "seed": 0, "tag": "two_object", "prompt": "a photo of a sports ball and a dog", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 27, "seed": 0, "tag": "two_object", "prompt": "a photo of a dog and a sheep", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 28, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown suitcase and an orange bowl", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "colour yellow != orange" }, { "i": 29, "seed": 0, "tag": "colors", "prompt": "a photo of an orange horse", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 30, "seed": 0, "tag": "position", "prompt": "a photo of a person left of a cup", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing person" }, { "i": 31, "seed": 0, "tag": "colors", "prompt": "a photo of a black broccoli", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing broccoli" }, { "i": 32, "seed": 0, "tag": "position", "prompt": "a photo of a truck below a book", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing book" }, { "i": 33, "seed": 0, "tag": "counting", "prompt": "a photo of three computer mouses", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 34, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown cat and a white clock", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 35, "seed": 0, "tag": "two_object", "prompt": "a photo of an apple and a chair", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 36, "seed": 0, "tag": "counting", "prompt": "a photo of two tvs", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "count 1 != 2" }, { "i": 37, "seed": 0, "tag": "two_object", "prompt": "a photo of a stop sign and a baseball bat", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing baseball bat" }, { "i": 38, "seed": 0, "tag": "colors", "prompt": "a photo of a blue motorcycle", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 39, "seed": 0, "tag": "color_attr", "prompt": "a photo of a yellow sandwich and a blue cat", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "colour green != yellow" }, { "i": 40, "seed": 0, "tag": "position", "prompt": "a photo of a dog left of a refrigerator", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 41, "seed": 0, "tag": "two_object", "prompt": "a photo of a baseball bat and a cell phone", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing baseball bat" }, { "i": 42, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown fire hydrant and a white cell phone", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing cell phone" }, { "i": 43, "seed": 0, "tag": "colors", "prompt": "a photo of a brown suitcase", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 44, "seed": 0, "tag": "colors", "prompt": "a photo of a black tennis racket", "judge_ok": false, "self_verified": false, "recoloured": false, "reason": "missing tennis racket" }, { "i": 45, "seed": 0, "tag": "position", "prompt": "a photo of a bench right of a snowboard", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing bench" }, { "i": 46, "seed": 0, "tag": "color_attr", "prompt": "a photo of a purple bowl and a white tie", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing tie" }, { "i": 47, "seed": 0, "tag": "colors", "prompt": "a photo of a purple toilet", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 48, "seed": 0, "tag": "colors", "prompt": "a photo of a red spoon", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 49, "seed": 0, "tag": "two_object", "prompt": "a photo of a knife and a spoon", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing spoon" }, { "i": 50, "seed": 0, "tag": "two_object", "prompt": "a photo of a potted plant and a bird", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing potted plant" }, { "i": 51, "seed": 0, "tag": "counting", "prompt": "a photo of four beds", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 52, "seed": 0, "tag": "color_attr", "prompt": "a photo of an orange cake and a blue potted plant", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing cake" }, { "i": 53, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown fire hydrant and a pink bear", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing bear" }, { "i": 54, "seed": 0, "tag": "color_attr", "prompt": "a photo of a white computer mouse and a red sports ball", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing sports ball" }, { "i": 55, "seed": 0, "tag": "counting", "prompt": "a photo of three scissors", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 56, "seed": 0, "tag": "two_object", "prompt": "a photo of a scissors and a chair", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 57, "seed": 0, "tag": "colors", "prompt": "a photo of an orange cat", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing cat" }, { "i": 58, "seed": 0, "tag": "counting", "prompt": "a photo of two bottles", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 59, "seed": 0, "tag": "color_attr", "prompt": "a photo of an orange microwave and a red chair", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing chair" }, { "i": 60, "seed": 0, "tag": "colors", "prompt": "a photo of a white person", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "colour green != white" }, { "i": 61, "seed": 0, "tag": "colors", "prompt": "a photo of a green tie", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 62, "seed": 0, "tag": "colors", "prompt": "a photo of a red boat", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing boat" }, { "i": 63, "seed": 0, "tag": "position", "prompt": "a photo of a fire hydrant below a baseball glove", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 64, "seed": 0, "tag": "counting", "prompt": "a photo of two baseball bats", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "count 0 != 2" }, { "i": 65, "seed": 0, "tag": "position", "prompt": "a photo of a bowl left of a hot dog", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 66, "seed": 0, "tag": "counting", "prompt": "a photo of four fire hydrants", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 67, "seed": 0, "tag": "color_attr", "prompt": "a photo of a black car and a purple couch", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "colour brown != black" }, { "i": 68, "seed": 0, "tag": "counting", "prompt": "a photo of three cats", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 69, "seed": 0, "tag": "colors", "prompt": "a photo of a pink fork", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 70, "seed": 0, "tag": "color_attr", "prompt": "a photo of a white potted plant and a black banana", "judge_ok": false, "self_verified": false, "recoloured": false, "reason": "missing potted plant" }, { "i": 71, "seed": 0, "tag": "color_attr", "prompt": "a photo of an orange person and a white clock", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing person" }, { "i": 72, "seed": 0, "tag": "counting", "prompt": "a photo of two suitcases", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 73, "seed": 0, "tag": "two_object", "prompt": "a photo of a bench and a chair", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing bench" }, { "i": 74, "seed": 0, "tag": "colors", "prompt": "a photo of a green person", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing person" }, { "i": 75, "seed": 0, "tag": "two_object", "prompt": "a photo of a bus and a surfboard", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 76, "seed": 0, "tag": "two_object", "prompt": "a photo of a chair and a surfboard", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 77, "seed": 0, "tag": "colors", "prompt": "a photo of a blue train", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "colour yellow != blue" }, { "i": 78, "seed": 0, "tag": "counting", "prompt": "a photo of four birds", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 79, "seed": 0, "tag": "position", "prompt": "a photo of a bed above a car", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 80, "seed": 0, "tag": "color_attr", "prompt": "a photo of a brown computer keyboard and a red cake", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing cake" }, { "i": 81, "seed": 0, "tag": "counting", "prompt": "a photo of two benches", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "count 0 != 2" }, { "i": 82, "seed": 0, "tag": "counting", "prompt": "a photo of two refrigerators", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 83, "seed": 0, "tag": "two_object", "prompt": "a photo of a boat and a giraffe", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing boat" }, { "i": 84, "seed": 0, "tag": "position", "prompt": "a photo of a book below a kite", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 85, "seed": 0, "tag": "colors", "prompt": "a photo of a green scissors", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 86, "seed": 0, "tag": "counting", "prompt": "a photo of four toothbrushes", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "count 3 != 4" }, { "i": 87, "seed": 0, "tag": "colors", "prompt": "a photo of a pink book", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing book" }, { "i": 88, "seed": 0, "tag": "color_attr", "prompt": "a photo of an orange hair drier and a red baseball bat", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing hair drier" }, { "i": 89, "seed": 0, "tag": "position", "prompt": "a photo of a cat left of a clock", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 90, "seed": 0, "tag": "colors", "prompt": "a photo of a black parking meter", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "colour brown != black" }, { "i": 91, "seed": 0, "tag": "colors", "prompt": "a photo of a red person", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing person" }, { "i": 92, "seed": 0, "tag": "position", "prompt": "a photo of a person below a handbag", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing person" }, { "i": 93, "seed": 0, "tag": "counting", "prompt": "a photo of four cakes", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "count 2 != 4" }, { "i": 94, "seed": 0, "tag": "counting", "prompt": "a photo of two tvs", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "count 1 != 2" }, { "i": 95, "seed": 0, "tag": "two_object", "prompt": "a photo of a vase and an apple", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 96, "seed": 0, "tag": "colors", "prompt": "a photo of a yellow skis", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing skis" }, { "i": 97, "seed": 0, "tag": "color_attr", "prompt": "a photo of a yellow truck and a purple sheep", "judge_ok": true, "self_verified": true, "recoloured": true, "reason": null }, { "i": 98, "seed": 0, "tag": "two_object", "prompt": "a photo of a traffic light and an oven", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 99, "seed": 0, "tag": "position", "prompt": "a photo of a clock left of a snowboard", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing snowboard" }, { "i": 100, "seed": 0, "tag": "two_object", "prompt": "a photo of a scissors and a giraffe", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 101, "seed": 0, "tag": "position", "prompt": "a photo of a motorcycle left of a traffic light", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 102, "seed": 0, "tag": "position", "prompt": "a photo of a hair drier right of a car", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing hair drier" }, { "i": 103, "seed": 0, "tag": "position", "prompt": "a photo of a broccoli right of a vase", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing broccoli" }, { "i": 104, "seed": 0, "tag": "two_object", "prompt": "a photo of a chair and a suitcase", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 105, "seed": 0, "tag": "colors", "prompt": "a photo of a white surfboard", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing surfboard" }, { "i": 106, "seed": 0, "tag": "colors", "prompt": "a photo of a black parking meter", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "colour brown != black" }, { "i": 107, "seed": 0, "tag": "colors", "prompt": "a photo of a brown cell phone", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing cell phone" }, { "i": 108, "seed": 0, "tag": "two_object", "prompt": "a photo of a backpack and a truck", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 109, "seed": 0, "tag": "position", "prompt": "a photo of a refrigerator left of a computer mouse", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 110, "seed": 0, "tag": "two_object", "prompt": "a photo of an apple and a dining table", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing dining table" }, { "i": 111, "seed": 0, "tag": "two_object", "prompt": "a photo of a cat and a handbag", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing handbag" }, { "i": 112, "seed": 0, "tag": "counting", "prompt": "a photo of two elephants", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 113, "seed": 0, "tag": "two_object", "prompt": "a photo of a snowboard and a cell phone", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "missing snowboard" }, { "i": 114, "seed": 0, "tag": "counting", "prompt": "a photo of four backpacks", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "count 3 != 4" }, { "i": 115, "seed": 0, "tag": "color_attr", "prompt": "a photo of a purple apple and a red tie", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing tie" }, { "i": 116, "seed": 0, "tag": "counting", "prompt": "a photo of three vases", "judge_ok": false, "self_verified": true, "recoloured": false, "reason": "count 4 != 3" }, { "i": 117, "seed": 0, "tag": "color_attr", "prompt": "a photo of a green hair drier and a purple stop sign", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing hair drier" }, { "i": 118, "seed": 0, "tag": "counting", "prompt": "a photo of three couches", "judge_ok": true, "self_verified": true, "recoloured": false, "reason": null }, { "i": 119, "seed": 0, "tag": "color_attr", "prompt": "a photo of a red tv and a pink hair drier", "judge_ok": false, "self_verified": true, "recoloured": true, "reason": "missing tv" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142{ "images": 250, "excluded_library_images": 1478, "by_threshold": { "0.1": { "precision": 0.299, "recall": 0.967, "f1": 0.457 }, "0.15": { "precision": 0.366, "recall": 0.882, "f1": 0.517 }, "0.2": { "precision": 0.415, "recall": 0.752, "f1": 0.535 }, "0.25": { "precision": 0.46, "recall": 0.661, "f1": 0.543 }, "0.3": { "precision": 0.508, "recall": 0.583, "f1": 0.543 }, "0.35": { "precision": 0.544, "recall": 0.51, "f1": 0.527 }, "0.4": { "precision": 0.582, "recall": 0.459, "f1": 0.514 } }, "chosen_threshold": 0.25}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495---license: apache-2.0library_name: oracle7tags:- oracle7- no-neural-network- web- verification---
> Website and repository reconstruction with contracts checked in a browser; 0 false completions.
# Oracle7-Chameleon 2.0 (internal)
**Status:** public release. Prometheus7 Research Institute, 2026-09-25.**Source digest** (SHA-256 over path + bytes of every .py/.mjs/.js/.ts file under `packages/`, `scripts/` and`apps/api` in the project-chameleon working tree, 348 files; node_modules, dist and caches excluded):`cb48b3e527b490b8f1d70071042914dc39b08f58eae45cb96bc11d6c71992822`. The working tree is ahead of its last commit(`cac9772`); the digest identifies the code that produced the evidence below.**Release digest (2026-10-13):** `823787a94793d1d1fef99600339834e512b9be8a9fb1faae54b0011adb9262d5`, recipe: for each of thesame 348 files in byte-sorted repo-relative path order, SHA-256 update with the UTF-8 path and then the file bytes (noseparators). The exact recipe of the 2026-09-25 digest above was not recorded and could not be reproduced; no covered filehas a modification time after 2026-09-25 12:00 UTC, so the code is the code that produced the evidence. `SHA256SUMS` inthe repository lists every file.
## What it is
Chameleon is a website and component reconstruction engine run as an Oracle7 specialist.- Its stores are captures and receipts.- Its operators are MetaFold repair operations. Each operation acts only when its admissibility preconditions hold.- A clone counts as COMPLETE only when contracts declared before execution pass in a supervised browser.- The delivered package is re-verified by an independent audit.
trafficcop is vendored in as the decision service. It chooses repair operators and triages captures, and runs inshadow mode for captures.
## Results
### Repository reconstruction, release panel (`results/release-panel-current-20260921b.json`)
| | Count ||---|---|| Registered targets / families | 10 / 7 || Complete on first pass (no repair) | 3 || Complete at latest attempt (development repair allowed) | 7 || **Held-out targets complete on first pass** | **1 / 4 (25%)** || False completions (COMPLETE with a failing contract or failed audit) | **0** || Release gate (24 targets across 6 families) | **NOT ESTABLISHED** |
The four held-out targets:
| Target | Outcome | Stage reached ||---|---|---|| robinparisi/tingle (modal) | **COMPLETE** | Fresh acquisition, then button-close, Escape-close and footer-cancel contracts all PASS; independent audit of all three 13-file packages PASS || autocomplete | Stopped honestly | Before behaviour, at `REPOSITORY_PACKAGE_ENTRY_OR_LICENSE_MISSING` || validator | Stopped honestly | Before behaviour, at `REPOSITORY_LICENSE_FILE_REQUIRED_FOR_PACKAGE` || Pickr (colour picker) | Behaviour verification FAILED | `COUNT_ASSERTION_FAILED:0`. The failure was reported, and no repair was counted toward the held-out score |
Evidence: `results/metafold-tingle-heldout-first-pass-20260921.json` and its audit.
### Website quality (clone catalogue: 1,493 captures)
Current state: 33 approved, 31 needs_repair, 1,429 needs_review.
Website quality is scored by the same sealed 60-site blind panel as trafficcop (see the trafficcop card). Chameleon'sfigure from that panel is the **clone approval rate**: the fraction of the 60 random needs_review captures that Benscores 4 (ship as is), with the mean score alongside. **Reviewer check (2026-10-13):** the project's owner looked through all 60 sampled sites and judged them good. This is a stated overall judgement, not the pre-registered blind 0–4 score per site, so no panel number is claimed and the scored panel stays open.
## Failures, stated plainly
- **The release gate is not met.** It needs 24 targets across 6 families; 10 targets across 7 families are registered. A 1/4 held-out first-pass rate is an inventory, not a generalisation estimate.- **Held-out targets were chosen by the evaluator,** who read their documentation to write contracts. That is source- informed testing, not externally blinded evaluation.- **Two of the three held-out non-completions stopped at licence and packaging admission,** before any behaviour was tested. They measure acquisition breadth, not reconstruction ability.- **One held-out target (Pickr) failed behaviour verification.** The cause, missing initialisation versus an unsupported transformation, has not been established.- **Recording trafficcop advice in the durable MetaFold engine is not done.** That work is owned by Codex in project-chameleon and logged in `docs/progress.md`.
## What the evidence supports
The completion discipline holds: no COMPLETE has ever been issued with a failing contract or a failed audit, and everystop names the stage and the reason. Reconstruction breadth is early.
## Reproduce
In project-chameleon: `scripts/clone_benchmark.mjs` and the release-panel audit (see `docs/BROAD_RECONSTRUCTION_EVALUATION.md`,`docs/TINGLE_TRANSFER_FREEZE.md`).
## Files not included
18 deployment and demo scripts for the builders' own servers are not in this repository (they name private hosts). None is part of the method or of the evaluation that produced the numbers above. SHA-256 of the sorted list of their paths: `059eff217257a94a4435f9ca13d9e6da513a47b786067cf09056b6bcd472a1c1`.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSEdf694df853decf70683407063d71cbde0a19708c80180467140aac27a1a8732d README.md861247926c110b14f82b9dfad7dbd84f588aed681289172e0aa927b112bfdc3c apps/api/chameleon_api/__init__.py47dd7b492ba774d015e75b83a9cbf6fa0331f0e0036726fb4d1502152b4a6bff apps/api/chameleon_api/app.pyd3c76ff098df015169abaa3dfc210b8c89008401fd9f77f12d62f4fc240485a0 apps/api/chameleon_api/fixture.py0a695acd7a8e05203aa57da18ec29b7265b251dd6beb1fe08d347a974761b695 packages/adapters/chameleon_adapters/__init__.py038b888d3fe9f579e65baca79c54c7691b57e8752344163b0244c586f346842a packages/adapters/chameleon_adapters/hotel_fixture.pyd562bd2b2180b3b7c72198561508d66d59d7716ccac56701af1930bcf3223f27 packages/cli/ditto_reconstruction.py21bd665a624353eaae26804f3476e5ff00e9e8988a840ecba0985ada0a114af8 packages/cli/src/chameleon_cli/__init__.py130acafaef8483625c857235eb995dace14121a5ba10eec2c7464c9f045153a7 packages/cli/src/chameleon_cli/__main__.pydddc4ff7ff3ec32af4a3248b3452798824a2b4d823bdb38e9b30a3c13f4c7fdd packages/cli/src/chameleon_cli/client.py91b6448f770becf449ad3387cc71d0b0b339ba46965d11eedba7e7a2045dbea4 packages/cli/src/chameleon_cli/main.py30df6ff641ea85abb0e72dbc304cde0bce13cd80ba0153b717875721226ad1c7 packages/core/chameleon_core/__init__.pyff143524857403c50a0f9b9d263368175e867ecbe7d418a19c57af1f0d4adc57 packages/core/chameleon_core/adaptation_contracts.py5e027c997487e4a79866244b3ddf481f5301fe32843eff396f1339186140241e packages/core/chameleon_core/adaptation_service.pyfc2f956ff80e29f10c69652eee05a5b7cf00ab7a7ff20b70c6650a57d9176bb3 packages/core/chameleon_core/application_saves.py8fd6a3431ca009468741345192d2aff4efb0573dff9d9d787080d6f8237cb6dc packages/core/chameleon_core/behavior_records.py9599309fb5ea94d9991a03ec5970000235abe17fcfac766e6bbadfd1d94bdd54 packages/core/chameleon_core/browser_contract.py0eb2e35d97fae5a9daa438fd60d6dcd50fb2b7b3312d0a0335c224c0035264b8 packages/core/chameleon_core/build_plan.py1243256f02cbc39070cca0205200592889991c6947539eaa144f24494a912a64 packages/core/chameleon_core/bundle_preview.pyc6997a67cd5aa25ca0d7d8014e7f8c4f32dc3ce8f5f2855ee3ff3d0319e275d2 packages/core/chameleon_core/config.py9d5a16d85dd4e1a5ba8702c14f9b68278f076af49849b279195424e308d463fd packages/core/chameleon_core/contracts.pyf9cff81a7ab2383eba74fcfda873c753283ed2785df1124839a7b6f8b2ee622d packages/core/chameleon_core/control_overlay.py1669ec71dbba791f47a2cf60760478f97ff2948aefb2f0245da1bcb101e4ffa8 packages/core/chameleon_core/counterpart_bundles.pyb55e21bf0d4c1a7aafe51cb069407ba973c050c361eea88435fbdd93ff56f095 packages/core/chameleon_core/counterparts.py22cf7b99d3c0ac4d1d62f8ce0a0acf1aa70075ea11e81fbf4a7bd59490151526 packages/core/chameleon_core/curated_app.pyf6bdf92631c603dddf052d80a4cfccb24934301fa7c7766ab45d2373ee19fe5b packages/core/chameleon_core/db.py4702ce54f642131c556eecc2e8db75b14647f1e1ed4d49a11ad39de00e2db9b5 packages/core/chameleon_core/declared_dependencies.py4415ad9a098a7d5596728c002aa56a0fdaafa523a769ecc83d44a3ab914c322d packages/core/chameleon_core/define_overlay.py68afe000659a751e20e909825202788e72443328fff8ff2c405ab0c5fe688cac packages/core/chameleon_core/dependency_plan.pydff5f01a1f02a685571950ffa22f2d4bef4f5fc1ddcea986cca51edc6f77c0a6 packages/core/chameleon_core/entry_capture.py1688c90692d8200ee54e10a5a34e136243f068135153f06cb1463031cd1405dd packages/core/chameleon_core/entry_inventory.py07ce1cfbd1a5cc05fcc16d7b1c821cf37db6b3a2c0bacc81ad501be9a63bcbb3 packages/core/chameleon_core/fetch_worker.py23ec95e653b889eb465106286037a602c65e874846f4cb2c934b9ed1d6ae124a packages/core/chameleon_core/form_engine.py1181463526070244e247a1575f785d9b4a715ce44e1b298e764f5bbafdbf009e packages/core/chameleon_core/image_sources.pyd5c69f21d81cd646523fe223b87b87b2202acda0b39ca24d20477a46ea1b5268 packages/core/chameleon_core/inert_svg.py17ba9637dd878e1d06c81d48f24617135a872a22b382e3f2bc7f075ec0dcbc88 packages/core/chameleon_core/intake.pye069a2949f8be02551d138268e8f0311035975e0c33bf024c59fd856b771aafb packages/core/chameleon_core/interaction_replay.py1f815061c222f1c48c65384aa2435e769021f3c8ab1f4eb39f92e48debf9e241 packages/core/chameleon_core/interfaces.py04dcd35b4b10f668885211977bc3557abb7ac9b0cfc6ecad455551c3569924b8 packages/core/chameleon_core/laya_consumer.pycbe7c36014bbc1696c3c13a3fd5f9bc393bd07d305433395228959ff17bb8dc5 packages/core/chameleon_core/laya_contract.py295c263f1437a7cc2b25bcd4726545da72cc756637b9536cc6fed75f7fede7df packages/core/chameleon_core/laya_input_budget.py19fce53e6921274449da67ea4a1e4fb95424e9d1c25e01ccc3a6df9e3ad73d1f packages/core/chameleon_core/license_notices.py859890762f81422c4d2020d8572e13236a36883eafca709b88435f9820a6eaea packages/core/chameleon_core/linux_job.py68c40a13d2228fc93e2b78cd6bf390d7d754c69f4eb27d30b58baef533b4fdd7 packages/core/chameleon_core/locked_assets.py228dad02300bd5bda6cc9db24fff9cfe57c3c5a0e05c3c17e5e51025d1ecf061 packages/core/chameleon_core/metafold_correspondence.py5e5866b20f258635d67854d35c1f828bc15c6af4f791aff11bdf4223b58ed56c packages/core/chameleon_core/metafold_evidence.py4c0bce8eee0900abe536f7ef2aa722db5dc247da0379ef6167f6dc10b64b6fe2 packages/core/chameleon_core/metafold_lookahead.pyb3fb3290b2e4919286cc678b90c03b351d41323f5cc13ffd1c80cf4c9272760a packages/core/chameleon_core/metafold_service.py34428d7a070a76aedbbf30c69236e15851ac5dd7a75a0f4b30b2adb383bb31af packages/core/chameleon_core/metafold_steps.py9bd9b5b255b6cc33ab88fd6783c69f0597b570ec0de606a31d9194dac6d45b40 packages/core/chameleon_core/microfold.pyc06cec891b7907e6a6513ea550226ebfa0cb17356b78be910d5fc6ac2e5a7aba packages/core/chameleon_core/module_completion.py8a6c2530c900f9805430beed46dc991ff95ecf07104b9fa32cccc62053c7c12e packages/core/chameleon_core/module_resolution.pyb7508c93961fda0925278f54d879b13148e20fa2ae268faa3268a52743ac6a70 packages/core/chameleon_core/mount_overlay.pyb6be347dc76408c5fc9943876e60ae9ad32b266290097bf3cd659db490936467 packages/core/chameleon_core/mount_plan.pyf107d5197fe286bd0266da87fe1c417bb1bd7b607e2e599e16f0e918844abb50 packages/core/chameleon_core/oracle_spatial.pya15fe059fc6a48d64228113851322494e49fa0b93ce162d3e730b3e73ecaf04f packages/core/chameleon_core/packages.py80797c3950b754b603a289cdee018912f56794ffcc76abb64901d9cd41c88835 packages/core/chameleon_core/pnpm_bundle.pyf3c639dc2e190a081dbf0323e59f1df1d213a8d32c88ee4605640000ca61d72e packages/core/chameleon_core/pnpm_discovery.py73c1ef759480211ce9238c59155226d627cba03fee6df0c31e14accee704479b packages/core/chameleon_core/pnpm_plan.py3ea20774a4c44cd6df8d042d626d0194f073cfeb3355a244b8fef4c77198e551 packages/core/chameleon_core/providers.py235a03d048a8866d14e56bb1da01b4673af51a3f0536ffb7f39f490606e3e896 packages/core/chameleon_core/recovery.pyacd730155ea02ddfa7aab32cab69a92449f294d712871b2e4fe36211da87ec51 packages/core/chameleon_core/repository_artifact.py1794bac9cdbfda92bf0d4c9fab6db70fa202a4809dfcdcb6f2ad157327e952e9 packages/core/chameleon_core/repository_capture.pyd26731ac776b295475fe0a68a4109defa23b666ff7ba9db16b9acc8c3a04741f packages/core/chameleon_core/retention.pydab98787ce8059b5ed61f5596db2ac7a3cf1ba92c2d7633c009db336d4ecf149 packages/core/chameleon_core/sass_assembly.py4d139f705c49d01aaefd405b3e67be6bcabeaf58322cbf1ff1b01ba9147627e5 packages/core/chameleon_core/script_images.pye41670d11227b44e2f5c5ea6efc49ee7363560dafa82e8b1cec50a1bca80c034 packages/core/chameleon_core/script_inventory.pyd92b8e91a9a2aa571e9d11b424f8be17a35103e5f579227e460a66ac3bfb1200 packages/core/chameleon_core/service.py2e7bde501a6fddd437bb045333cfa83081115ca5b0dfb40f60834562dc4a87d7 packages/core/chameleon_core/surface_graph.py3c78bab9fa96bf044eac255f227434a23af7cbcaba3632a0493e826f25c66ce4 packages/core/chameleon_core/trafficcop/__init__.py0476c062124d6f1d942c49d5f67e7548d2d0b88c000520e29e90e7e02f50625d packages/core/chameleon_core/trafficcop/chameleon_capture.pyc65230b556779a697892ef2202ac01e8ae5ed3334031ee0f837f3a4283f2cb37 packages/core/chameleon_core/trafficcop/model.pyd989b8e2d523b7d9302bfab67a097138cceccecf7d7a22408d2ed6def563ae3d packages/core/chameleon_core/twins.py911819610d11ef62646773f6392d32f60dcc4a01952580c78766f8f60fc427f8 packages/core/chameleon_core/verification_jobs.py9eac11d9c3dd3a8c551038fe595693d7cff8430dc49e8c1cebee78243532594f packages/core/chameleon_core/visual_capture.py364c8f1e630b05c307632bd3431d35c6825202bc22989888118296be60f96738 packages/core/chameleon_core/visual_css.py8f33da7ac508ca55f60dadd276d10c7af2120374fd66473ee1bb514a2eee29f7 packages/core/chameleon_core/website.pyc5b55be8f8807fc23b228d07de978b15f1985c8caa3bb58520d2e5e9313d40cf packages/core/chameleon_core/website_bundle.pybb537376285949404a07c409bb8bfa3e6c0c3f3f9f3a23a86100f962b3b5d8a8 packages/core/chameleon_core/website_bundle_capture.py96da07b3aa2c178ad5aa1c37f62b54901712f94f60d3d0f506f611aebbbee80f packages/core/chameleon_core/website_bundle_worker.py4fef094c1a89c8cde7e4f836a19b383f3cd73bd11870348c4b8b29e0d1e199d9 packages/core/chameleon_core/website_captures.pycf510a2df443b39d6e72e9a3faa5918304bc9b8984a080df5744ac2a72f8bc92 packages/core/chameleon_core/windows_job.pyce5bf6d5fbff9dd80b6c7161c9ceecdec909c3d66259dc79806df5a2076b2e74 packages/core/chameleon_core/worker_health.py2a3d4390549531f6d8cfb022260252f4ae08ecdd6c462ed66497f89555d802ca results/metafold-tingle-heldout-audit-20260921.json38a913e4069f19c74a20bbebfa2acb5e62dcee47c0cf6e649daa4103ea55ee3b results/metafold-tingle-heldout-first-pass-20260921.jsond57cdbfca1d03d28bf85fd58bb7abe7366e6b91e5615f5c0e019304204278f0e results/release-panel-current-20260921b.json99feef6904483cbd34d38d10d758703b2bc27958ec334cf978ecd15f59612a48 results/trafficcop-capture-triage.jsonce4491eb04ac2e4f6e823cbc2be276c4de5c04017500b084bbf368455ddb8759 scripts/accept_saved_behavior_ui.mjsed56a7c2b50190300f65e2f427eb5993c2980b90c03dcbf60928a3c6d705fb9c scripts/activate_ditto_verifier_worker.py2b795a8993dfa01f3eff537eedb011f653eb55f3561f9a362a31393b3cb721a3 scripts/archive-nav.js5676173dd76a2e2f98472483dd3553428dc1cb7624d2383154e761c1216264a7 scripts/archive_thumbnails.mjse00f5264ef27cc71a6f6459992d560d8c65d8f9c291583b81e495736dd61ba46 scripts/arithmetic_expression.mjs854569100d18a66db881480d4a9c63fbce91ffe5b2b52fceb47d76f059f21e7b scripts/audit_catalogue_revisions.pydf8a0f49e2295cc1d02309ddc31dfc40001afe475d98642dfe78a443aec95bce scripts/audit_metafold_local.py9365af970538a912a62365dc806d6b69689758ee5ac318c8cc19fd2ef39c5e1b scripts/audit_repository_catalogue.pyc5419988186d1e5d16a289201b9ebff790bd94896a53e012a934dd2832b84d05 scripts/audit_website_catalogue.py3d02041531be9be83c5de16bee44d08a785c9d834d94794d07f1655cf45a2fa0 scripts/benchmark_microfold.py63d26ca330f9ba2636f39f6d671304b120103aae8f14b505ab3063e1f2f6683e scripts/bootstrap_uv_linux.py7773d7a28481aedc0a188152bb38db4c0297e8fa1c0c29fa280322974a45b549 scripts/browser_contract.mjsd09e41a98588ba9b0f77420778ebeb3361e754454dbc882a7620715d694f1ef3 scripts/browser_contract.test.mjs9c81db639772c452cb02f642aaae192f68b5d3d1cc0376ccd7bfd7b0ba855323 scripts/browser_result_gate.pyc96c38c607e9eb4cb02a97209e4bf33cfcd7428515050e20087052c3e15f45a2 scripts/build_artifact_plan.mjs43d6731f0c35fa87b7870fd56be8c197f3a48f81b023b64dfc67c4fb9d2428cf scripts/build_artifact_plan.test.mjsec8eb1ea43b7f5d11b6c08cb42c5a8f4b360e47fa89ad119b29fcab000a1ef7d scripts/build_calculator_overlay.mjs14d53efe55e808fe970fc3cefec989de7eafdd15e994dc3097b3dc25addcfbc6 scripts/build_declared_module.mjs08fbdff12a5f4d2720633715d8d5100a36fd515b9f43beb19d47f5974f85ac98 scripts/build_declared_module.test.mjsaedd3bb5d6b1e36bf08a7184f1df4196c2b3e8c1182de3fdddbadc970636a2c4 scripts/build_defined_module.mjs798faf73eb91e3d8eac896265de6e763bb10ca7308c8efa3c6a49b2787728475 scripts/build_graph_plan.mjsfdda12053cb7980c6dff2d0c26f3d8f1df82d138ea6b26fb5eac30bf390d61da scripts/build_input_discovery.py28d9de3634a3ec043dcdf24adb39cedc0d078f7a7e3ca65fbd21cd4fb4338bb1 scripts/build_metafold_candidate.mjsb99cb0aefc643c309078c89d74c7d57b48ffa636bcb90e42fdc3a8cbb0afffcc scripts/build_module_capture.py5d1da67d792bc7f9928d2306bb4b56a2eaf0b61312e058359c645d9c0e31c37e scripts/build_module_overlay.py2196aa683ed1d18f3e116288e9d56a74ad058f0420f691caee1dd6e8bce815ef scripts/build_public_archive.pye03caef945794b7cca73e029550efdbf9e22c4f90b2127a72b007521865661c5 scripts/build_saved_control.py9c5b590528f9b58c9baedb5531f22275acf88b1d3d5a3dafd2ebc788b255ffcd scripts/build_saved_declared.py0551aa5465ca30046a8f27a4cf2cf8f1437474d22d24caf4fad7e3340bf9354a scripts/build_saved_mount.pyf5aaa3e64134634d9408e8b98765f9930852ff6074ad208cdc3ad4d29bc9d8d8 scripts/build_staging_bundle.py616b532d52751061974f8b6efcc38ca346b67d9fc8feae59f5ae76ccb155d522 scripts/calculator_repair.test.mjs5002ed39682df5586f0fa8952c4a7e3d0008c0800931059b4e4c9a7559ecb7f6 scripts/capture_connected_site.py2fb5da2f2ca1a62e5c63d1c83c559e3ca507c4071e585f69d4ecc84fee359955 scripts/capture_entry_pilot.py9d97eb01332670823a3d43b8064efe65d72b2f192299aea52fd6d9eaf5b8c0af scripts/capture_evidence.pybac0f03ddc86b21ed8ee96786b6ab523f3907d36a8a94aded7aa0861f60e36f4 scripts/capture_locked_assets.py273530e186c00a36ec37552eae5de380c3d2346f20db87d140543dff082e90d7 scripts/capture_module_pilot.py265d3aa4f3b2544f7a1e3694d301efebeb24f7c95e20c1e5206bbf00e1edd677 scripts/capture_read_form_evidence.py3cec9043b2c949592222c0b29d3839775aceff055266f1e81cecb84ae9f58174 scripts/capture_recovery_evidence.py1edbf3dc603733c713a0565f7c46f5a4abbdabe7408c5054ff0944438ed17d9b scripts/capture_rendered_catalogue.mjsa1ab7a7cf9137d9d1d7243c658f508a0b998a8ab4438ddf727b5d60d949392b1 scripts/capture_repository.py2027762517f79af4e42738a65e8889dcd2b19a7ddf7d57fd9fb155159278b1b4 scripts/capture_repository_catalogue.py76497adc555a463678051e8c45c4030d13b76c4db1301f8d89331f3c4272a1fa scripts/capture_repository_evidence.py1f246af3594030eaf51c9f3b0d81d9cada2af8b51e18044404f091f85fcc9703 scripts/capture_showcase.mjsfa012539f031c4f478075f9d4a785970d1c6646c2b4560d14f14f7cba1c7d8fb scripts/capture_stage_evidence.pyae464d0f56d6bf80645d6727179205737c3b91e0a46b6668b0e71c2f83c36eb7 scripts/capture_website_candidate.pya72c3837e2f0e3d5571a81996689c6a25a16bd7cda491796b2d43bbf3d6bdd51 scripts/catalogue_animation_state.mjsa29623400b8467791f9a748d61919b20741de1d2447b5a2a0921693c64a69542 scripts/catalogue_canvas_isolation.mjsfa888b48db98326cf8259874f31961edf5d1798d8312a5b70dc1a4ee6efe2475 scripts/catalogue_canvas_replace.mjs41c14d20fdc457230a69eadd886f8e78518be3a6f3475016264c4f00dffa3c88 scripts/catalogue_compare_sections.mjs56b88ae23a3539eb09e0ced8961338d9f6dc45cb95f3c09ffad51af825f3e731 scripts/catalogue_contact_sheet.mjs5f6c8356b26e2a7643f5029c6fabbc0e886798924fdeed6b597f7d60a7b63537 scripts/catalogue_cssom.mjsaa51ec16c6a5eccb02c0407646fc4d3dd95091e982050da3646c4bf74d44fafc scripts/catalogue_failure_report.pya9a7c4ca9c028173783ae45232f2832f7c8b44c9d8f9a33efb9cdf9078c82de6 scripts/catalogue_gallery.py814bc2c18eee479a4924597a17408d3b3f225e583f501b492d9dbaf98ce3b831 scripts/catalogue_header_state.mjsa26f76a1464913fbe15ec5bf8bff488e8d992092f3a7b3a306f4310ae0fdadec scripts/catalogue_header_state.test.mjsc7524a9fa54244f8ba38fe3f8a5871f3f866ba27ed646f816438ed211615adbc scripts/catalogue_image_pixels.mjs9320a1dba80c1ae7bd849fc04fa24c9b229fae3f9192c287e2fd9197b46b0159 scripts/catalogue_pseudo_state.mjsa4ac4d22a92911823a9ec990be103f40f16a3ec5cb80b62fb2c3401de3291e70 scripts/catalogue_review_screenshot.mjs286bea57726b8d1d0a3ca2a4141de6cdccee59d242a7cf72bdda9b8c8907a89d scripts/catalogue_revision_index.pyc99bdc216ea8e93ced5aae1c77920c62460ab196fb078e771b04608e0ec1572d scripts/catalogue_source_context.py9acf284da0405c40ceccbac1807d03d1296f7a53d92285d296dce22d8b251f1a scripts/catalogue_standards_mode.test.mjse8badfd939ff82d3e8677f32838121eff40ae7ccc4914a57bd4303180bd10a2a scripts/catalogue_timer_freeze.mjsd0a377e8e39bae37fb292d6581f81b3671ccd18e17a2d6d5e81546a68e882656 scripts/catalogue_timer_freeze.test.mjscc218de09b7cbacbcebad46ce17913866da7455aae0ff6e49211c59de99c5ae8 scripts/catalogue_visual_metrics.mjs9a02e203e7d44e6abf89911260d71c03b11de7d75a205da25cdd2bc19bd616fd scripts/check_browser_network_policy.py3af1a24564c676abafc97d2e6f007c3fc5d1d094fb17f4d9a218c954d9eb91e6 scripts/check_ditto_verifier.py55ddfd98c1b2099ca1c7773ed6b70d15650c6ffef7e9758e8591dc9cc1462365 scripts/check_image_capture.pyd8ac9af53d7e69136842b74e3f368f7bd3c053569d95eb42b2def5f9eb964094 scripts/check_nasa_capture.py2d6140c7d3e956cf2c8dba37e880f9714c3bea64e6361575d1a6ffd770cdfd80 scripts/check_production_verifier.py31e143b2e3fb3e0055e08fe8e4df2cb6f76a29e7077c7956b86b29785f81e594 scripts/check_queued_delivery.pyfbec2e0f33f68d8a3e86d67ba0ba5fb34d2106a039228f1bb43a2dca1b73f0e0 scripts/check_rehearsal_database.py6ad8c2e0bfe4e10bdc16d882ac019a58ba2ad746d7d8a644fa9ce9df4e37e7bc scripts/check_rehearsal_results.pybd7ae7b8d59be73b79d1d61dcd69a7de5a5b4fde9cc8f3f38244e0467dffbb43 scripts/check_verifier_tunnel.pyae4e92300962895daea9b661b9ab16547d619fd152b60a13efdc273b48b05750 scripts/check_website_bundle.py1c1d4f9474ad289ac3dbb3b643ee55778874206bc54a166434dcf2c320c94a8e scripts/check_worker_filesystem.pyc17fc28b4347806e6f895b176c49d2152e631810d4a04cccaf540cee4ac4b7d5 scripts/ci-setup.py94588ecd5e5749b52c9d446520733d74c20aecf1af7257ac1dabcc0b5996f523 scripts/clone_benchmark.mjs93546f90fb44a0cdf6d4cfaf2b1d5c658a842520b0dd6c3eb5cf6c6afd40f30b scripts/clone_benchmark.test.mjs91935d307e1c8ca29738ea2120399c0ddbafefb18daf508befe35226e847a358 scripts/clone_catalogue.py59db410f74b099ef0a6e13e98c932f9248095d968de4fe65e627666d2f0d7103 scripts/compare_mount_visual.mjs77b82ff4fc264ef4b315107f131ea018086f668af81807b62313e4aacfca20b2 scripts/compare_mount_visual.py3034290735d6c19ef1221ed964d6ca77a50947a3c95cc7c71c5ab0641ad2d6c6 scripts/compile_frozen_sass.mjs4b75c1603739588d3f66d72687a2a64fa75e3149d91d96179a226049d81818ea scripts/compile_frozen_sass.test.mjs8dfcbd4dd810640edc65857d08dda90a559f3bb44347394cbb6f7e8472e211ef scripts/complete_declared_styles_local.py44b9fe2fb5476a5ad9b9b75ad27de3d7c319d1cc215df1d46c12cff785a52494 scripts/create_define_overlay.py6aacddf1887df7af58a094e49c74ab92b4c84aedb1a61689be0a2a04df678d1e scripts/demo.pycbab2f5088e3b7935f4dfff9b09824fb70e25866052700d6b307c854c3ef7766 scripts/deploy_archive_nav.py9b831a0ecbb868c8b06e9b012e329dc2eb04c503084c918ee4b09bc1ed962193 scripts/deploy_ditto_effort_profiles.py6d2c1563fdcfc92c1a3e22668cc017a2ec877d3f73cf19add028fb5af19691d1 scripts/deploy_ditto_frame_route.py8b93f69ce7cadd88bb865f96f615cff2f9d3df739542f7b23996b4153534b5e7 scripts/deploy_effort_profiles.py9497ffc61de5d89796a267d4c071a610ba0807b6d925565e932f8d138d5d89b6 scripts/deploy_field_notes.py6cf82e8f9250544f32ebbf89f6bfdfec9518080c516511959f42406eeb1e41d2 scripts/derived_overlay.pyea3b06e9f9148fde34a9610b7ac31323c78868412fe4b2d6805103868cd81ded scripts/discover_catalogue.py10f58d8f2941579b2c57e9f74a1001c5299437d391280611c20ebf144cb5efcd scripts/dom_references.mjs42dce6c1fe2a12aa054580f4ed80edb88b3338a82e869003ffc27e1cbe9b3e4a scripts/dom_references.test.mjs5ca54cb32a338f8e9fff8127f8906fa86d1f2b7db27dac85a32e7a58f292f786 scripts/enable_box_a_route.py9e2d75f7692787db2d189ac35c4697644773f78a5f2d0c4c083d6a620fe521b3 scripts/enable_ditto_reconstruction.py4d86286982f48353f198cd2cb4376a9c675500f5dbc70e11ac8a26a99b4c1c76 scripts/enable_production_verification.py910a1aaab289463b654be5c5f2276897bd7b0bde894965f599d42f5dff1c36b6 scripts/evaluate_read_forms.pyb8c8ff0b44b45fd565b8dd1caaa7c3c73eee5121209519c19975abb251d64be5 scripts/expand_entry_pilot.pye916abfbc02047baa34e3925b75658ee4bd069d4e82366bbe4895b5c5a7913a5 scripts/explore_surface_wall.py74bc0d11d3a876c2665553b3683c184611abfa5ca9460b530f2f62dba5d09451 scripts/export_runtime.mjsaff632a7ddbc6bb79c5c5d7b6f499fc152822da7423a2730c0e874dd65aea51d scripts/export_site_demos.mjs9e5d231988e283de4594658bb25e7766f496b2a867c9940fd64f88980ed416fd scripts/export_verified_pilot.py72df539a475ff93f3de66936b6b0b0a5b2367557a0af293ed1ae0755ed689879 scripts/fidelity_metrics.mjse104f5ef27e343fdfb20fee06e357d8dddc610ee24f331e78ee233f442d2043b scripts/fidelity_policy.mjs48e791d22ad3e113c180d74c782612f35abece7009013fe6efb136b0f5ff42e5 scripts/fidelity_policy.test.mjsb0f4a9308ef38157b6f1441d6f3155f0753f2d00eb74f44a3ac46d9ecfbe1bcf scripts/harden_ditto_services.py5f92550ad60ff25e53da85c94cb2166d03b52363f2801aac418f728851a5b9b3 scripts/inspect_catalogue_layout.mjsff97b95f102477044a31b276f3f0d0491ade1fdacc2d59a3e791e9c6350cba1c scripts/inspect_define_local.py1c558da8c6e1636d9556be1e2688ee1b0863f6fd13a4fcbf0cb1f314adcf6c87 scripts/inspect_laya_artifact.pyfee4bff75ea2ddf71fb97e8281e477f506ca9ff1a0fbe2f4e63134bd7e57f494 scripts/inspect_pnpm_local.pyf6387e04e18730876f3d5a433523e1e0cf50d1d1c84acb8fe0095436edf1acc0 scripts/inspect_rehearsal_queue.py852757abd9ef37779a4bf6c78f65848b8d28216fd6c7d28dfe154d11e1b42a86 scripts/inspect_sass_local.py513e8bdfa3bf52a047f62a3a691ea609badf1fe210978558ecd2cdce21b7fb66 scripts/interaction_surface.mjs0247ed33d6097d7e5c8cf0abdc38419f9e8eab361b76ff1a82cc6b7769f72ca1 scripts/interaction_surface.test.mjsbd2fdf7a0a61f76a19de4b701517c1759856ed129fbc3d46e20aa8867130c14d scripts/laya_diagnostic_supervisor.py3e5e238b25778d4cabcdaf4eac70fc16d2609d2a3f7bc2b772e50ecb79bebdeb scripts/laya_linux_smoke.py5c5999b3415d2704feb124b030ebbf80db05c0acf2d2823f5c5bc75fdf3cb02f scripts/laya_routing_eval.pye33afc7b017fde3fe347aa79479ad43d676387341a2910d595fb1bee000f13bb scripts/laya_worker.py331800f0a1ae3b79cf691fb9c98e82703226930903fd50289b04d9f4bd00dc04 scripts/linux_worker_bootstrap.pyd8c7fbf4e324c4842d97cea0f6ab5da639bc6f0516bb1cca58026d6cb5aefece scripts/list_filter_artifact.mjs4cd6a3a269027b80a6e75e2d1997a7d76f52a9d02df8fb598bce8b37de4bb2cf scripts/list_filter_artifact.test.mjs0e87d0e66cf89b3aa98e35c1664b67764f3e7701b716db2bba35f5f56fe6161c scripts/list_filter_observation.mjs4181ae69f9111520e05553031d9030dc4d0becebf2fb41cdc949f24801c451ca scripts/list_filter_observation.test.mjs16cdec94fde6051a862dbfdba2fc77ed67c1c26528aff72b4e12ae095dd26198 scripts/list_filter_operator.mjsf89362d9f5d5b43212c84a8b9461a4fb6768ab9904388978818be9b986e51241 scripts/list_filter_operator.test.mjs15f6a8bafef843d26259166cc00d768e3ad06f71bf7251bcc68b6b5e939012b4 scripts/local.py4eb975b7a945b4a190453e88f5515551bdfaf8c3af42154e39c359de814476fb scripts/lock_laya_runtime.py812673d06175ae1f94df6cd3beb86747ef8030490a8e9a175e2e220f72efa58d scripts/metafold_acceptance.mjsc2a16cf3a50226c80e98c2e3b9a7824759eedc75360626050c5900d3a6893423 scripts/metafold_acceptance.test.mjsbae2f74ba9bcfbc3f94881255cdba15960859e977aaa86a10e07aef930b04640 scripts/metafold_arithmetic_candidate.mjs75601173c8ae1641ced73d0f614d4068b20d4174a34a858db2cdcc8f1692e043 scripts/metafold_arithmetic_candidate.test.mjs700e3b252d47f8ef91436d420af7d672b04413715297a74dfbb1ec223f3df6a0 scripts/metafold_clone.mjs8cc2c80c16a1e4148b887bc88f0bca6679bb7ba4d2a5d2e42b0ca8d308bbca5c scripts/metafold_clone.test.mjs8c6fba4a6b78b4803e4e3c78768cc151708ec8c0ec9d828076b80d5c6a227674 scripts/metafold_correspondence.mjsf36ceab283ebfafc831af171d81e6c790843ee4c348a0391884085768b973731 scripts/metafold_correspondence.test.mjsb595767edd772cc955772715087744f1a839ed962e8d605a0cb8fe66898135d3 scripts/metafold_dependencies.test.mjs2ee96a75713fc178e178482e45638b59bb8ef55df1f97ed7a5163e01b615f27c scripts/metafold_laya_shadow.mjs13c45576d773141de03915b3ebcce6f0c6b887a2612fbc671b35645a8972aeb0 scripts/metafold_laya_shadow.test.mjs9726be40043d6dc8e229fc98a5caab145e41b608646cbcd92944e713b412f243 scripts/metafold_observation.mjs7ef1b8bc2bebda2272dd84d99e1c909be8a52ded509becc32663effb24880d94 scripts/metafold_observation.test.mjs8c0e62e0b41aa23476019b6bcd5788980b459c1b1b1237e21f037e0cdd01a716 scripts/metafold_package.mjs2d5b0a1742a4d234a7ea83d888ff0d2ea387a9ed53cba75323d03b5e5328374f scripts/metafold_trafficcop_shadow.mjs3168d8efd9c4928b9f6b7951d1d8e0d49ab673fb3e83c48b7e7fe29323d36201 scripts/migrate_local_behavior.py893f32cb10cf5aabdc587a56a1d35e8d3a825a173dd403244ca283f2021c9ac8 scripts/module_dependencies.mjs726eb43eb12a3e9939397c2bd2b240a942da4b98f0515518a0babf91b4e3f040 scripts/module_dependencies.test.mjs2bc19fce0772e756ba5351220659c18053c4c1965c91a3db93338ea4d21004ad scripts/module_dependency_driver.mjs9595b24b45fe627fd2fb5efa8b94a88270ed269c5dad2f38e6487ba0ebdd234e scripts/module_references.mjsd5d7a7b3e2b6032bacc8e2cbda6f836c14a38e4ff0329a549217c5b484886991 scripts/module_references.test.mjs0b2c5fba2091088cfd92e4adf646a556ee7990a1a7805868816daaa2cc19ddfa scripts/multipage_contract.test.mjsc5ecfec7c79e790d02edc53944bae0621e3b254de1b2b27f2c40d680f6841362 scripts/package_backend_release.py3645ae03256daa77153f119518f81f5d83d5a42e217a43dc3a54f328decee6a2 scripts/package_cli.pycd4fffdf7c1c44ecffb949e145f0af159eb92a20cb68a1a1c5e78ff66fbfd3a0 scripts/package_curated_2048.py0ec60cbcffb55331e2218024eef81217cfc47e7e7e5e185e3483d5284a37bde5 scripts/package_gallery_six.py56a82c84477277da80b620898b8ad30364c9c6b36129a5409f662f7e57c2f182 scripts/package_repository_pilot.py969f6722f43ede1520805f7e892030f2dc2a39186fe836cb0839f67a86985be1 scripts/package_saved_demos.py2ad3bdf0ca2e735addbe2e14dc30cc06a69b3419af028e8fe8e2726f7e442a76 scripts/plan_dom_dependencies.pyb9bde635c9c56c37876f7f951800dedb91df76621e4d31882dc61feec29294aa scripts/plan_saved_build.py2fe5e186ce01d1dcb87e8e5e825b74644afb0d35c3b523969d39c0d945220916 scripts/plan_saved_mount.pycaac6b562a8eae7b9602530715b6ef247ca5d4b31d9552b289398eec18f358d1 scripts/prepare_jev_presentation.mjsbd6b95644ec2a60b869560cf7d8a50fad120a294f8a450b8975c285c303085a5 scripts/prepare_laya_artifact.py95c8473844b7d7638bded5fdd0268c42370ce443c7f4afc8d61c7d7abe3d48ac scripts/prepare_verifier_tunnel.py28b03c30b987d5d3b93dcd00a14a33aab73f95933e32da449f59a775e399944c scripts/probe_repository_contracts.py889fac5e2d4149ddbfb59595201ba4552da2e400d2ddaaaf637a83650c970f75 scripts/provision_box_a.pyf1f31f0df44ee6aa40b3f7c42da12b4d55d8dbe7e18ac3b349307d0011f815a2 scripts/provision_production_verifier.pyc11220c0b32d772b4b7a35666046028beacdef5c4fda99777b24942a0a59a5cc scripts/provision_rehearsal_verifier.py4206068a8f85f26c9b1a1178c7075de7d611312f642e3ca3b6e35b33d8767227 scripts/publish_source_style_gallery.pya1d1d00ad216bc9756956ba769af97a1ff22782f5e382f5231df598188ad256a scripts/queue_rehearsal_contract.py3f358a86de0d2dc65037a5f9099549a9c73d5d78ac59105a0901cab495626932 scripts/recover_full_review.mjs825074e7b38262d831bdd09f07a402dc3aace020f18af67f7150243c0a2fbe6c scripts/refresh_catalogue_previews.mjse3ec420588f671063513ca74ddedbb1a9d4bf5be1b05a135f974857996a9b33d scripts/rehearse_live_copy.py72ea82e3322279ac8dbd6a7e2d9c0da94913f41ff4ffe749fc2909c75cc3e55b scripts/rehearse_verifier_migrations.py3e0e21702d364fbe0308f24728e39e8342958358a835af90f66373bfd71658ca scripts/release_panel.pye37e047cbce09fd93f1e42d03f5e815555e8eabb1a2c6274c15bbe4d158c3dce scripts/render_connected_site.py0ff4e88d5c4dc05061ed8ab85082090edee2928494644c2cd4b673170ef61489 scripts/repair_catalogue_doctype.py56b91587cdabcc52cc93b410d89f7ef59f27765f9f73318996c261d0a60e66f6 scripts/repair_catalogue_standards_batch.py9a4bbb41e2ed3d3b8d6da6e3d3337c4465ae51b1082a1284bcc2db3bda1c43f7 scripts/repair_registry.mjs214d07b8fdcd9ec76d15086bae7faf6db82912873569087ea144cdd4466ce79c scripts/repair_registry.test.mjs1c6f2d028f6a3420a091f6ac611c3cbf608173cc2d0473503785ddeeb50fa91f scripts/replay_capture_failures.pya6cf85136a25d2942014755d53a24d5759a6e2b744544a940beeba722166e4c5 scripts/replay_gallery_mapping.mjs2721a6b38e7114cfb12346b9d818e765a6adb6b0f8fa2b3c732bbfd1d1e82295 scripts/repository_browser.mjs36dd3ef361d32aee074555b7d649dc7b43131de98debf8d348ac89485b90424c scripts/reset-test-db.py2521395c1a385cb6b1d70c09413bd8b94e0af7e1e8b1cdaf7b76b8e0b147f213 scripts/retention_inventory.pyed5da725f66c0c36bc110305003e783ca18bd97f76c39dad48c4c77be06a88b4 scripts/rotate_local_test_secret.py527cd3af72924a9b8763d4daecfc359be3477783dafc7e37615466c34e78bbdc scripts/run_asset_recovery.py5f103745c5cdac229a2815d99a5a767488aabe8a6263ec36350a425d48febbb7 scripts/run_catalogue.py93deffe78e1ebaf81a1c6545eb27bf349d36d421528fa33793a4be73cc9e846a scripts/run_metafold.py410ebfd9c5445d3761c9a5913f58d158a14165e14946f1def5295207accaa405 scripts/run_metafold_package.mjs4c2a3db8515745995c758a6a73de48613f2d2c68ef942eef97fb30ab6eda95c3 scripts/run_microfold.py438e279bd6728d5503346a555d8267fb62606ab2b5d75874e9a6264396a951de scripts/run_reconstruction_campaign.pyab2a982dd314516e4c0d6e3a183e61b400e1509efd212a9badd533fb478a118e scripts/serve.py3515c272430314dd359a63e3a770f81832246d860fa8c7f55e449bf2b3583adf scripts/server_readiness.py200252b344480ca08aa6838c825f1d2769819cc1a685aabe89f7a0baf9b91b79 scripts/smoke_arithmetic_transfer.mjsa468d49ac9c824979ba59540341474413faeaa94cbf57c4438aab904838dec88 scripts/smoke_local_verifier.py29b72ae8074b30dcd098d459fd81c16c2f891ac8a90d6c1ba7abcd52be2d80c1 scripts/smoke_locked_assets_live.pyb830cd860f25c2895a26e89edcc51096a3e908c8daeb1a3efbab888acd091640 scripts/smoke_metafold_local.pyadd1643cefd403bb323b923529e1e682e1695aa2c4fddff0740b166b3efd26c9 scripts/smoke_pnpm_browser.pyde2b5806163428abdd75946c31883046cb0683d6719dbf1ddcc540381ef97bf9 scripts/smoke_pnpm_module_completion.py3498257c3efa32c93b7bea5fca77891376fceed0b87c39a2f47f11c3d3801054 scripts/smoke_replay_ui.mjs590c4e5586911951fcacfa730fd55b30bcae3000f3fc4c69303e882a4797c41c scripts/test_catalogue_animation_state.mjs07003f6de90611b0d961836e781ccc6a145835c339b9a9d249f79affef735232 scripts/test_catalogue_border_roundtrip.mjsb3d56cbb8e5a7162ec394d01aab21eb8f5397bdfae24be5da7ab318451941603 scripts/test_catalogue_canvas_isolation.mjse888a2a42d7194d2369d6389aac286a74699e4ffd876a9932d1e3c05f691ec94 scripts/test_catalogue_canvas_replace.mjsd626a71b4ab6b3196548b8a42a101c1c6a95b0ed67912e4a1d509dcb7613c809 scripts/test_catalogue_cssom.mjs83b1bd2860f91253ed95147f466e484a3f5fc3ed1dca14d24ad3170e6069e56d scripts/test_catalogue_image_pixels.mjseb7971ff75a71037c6e9a0d2404644b42fa905ba3b2158066c941df425d7db2c scripts/test_catalogue_pseudo_state.mjs4bf5701552c6bfba93e7cef227ca38c265b5ca324ad2204c21cee7811d43bcfe scripts/test_catalogue_source_context.pydf67d42a548936d1c83673b81355baef4e18019a20d1547b98ec687d08ea4422 scripts/test_fidelity_metrics.mjsa1f5f9f5fb25bd7210900d778c58668a09177b9773169e6506f9341e346b00cb scripts/test_laya_clone_advice.pyf97f06039a6f97345d27d05da09713b01ac1f8b38a6e15ebb0db6546bffde3dc scripts/test_laya_routing_eval.pyb36a15a18d9e8deb30a1c6fcfeadb7593b6dead2d318e91884fe375a4835a31b scripts/test_linux_browser_host.pyfc22859bfb82a9b91803703fbad03a6bc66f51ce42078977f2b660a4cab838e8 scripts/test_linux_job_host.pyeed61f243ef72b6a98f02aff47a802f03b4a01c49fa110ea052cb1ad302917a4 scripts/test_repair_catalogue_doctype.py43dcd678cc5fbb9990637b06109139b4729e89cf9b1f6042654c620672e882fd scripts/test_trafficcop_clone_advice.py4f11c4e0efb2b80b3a18ec630f2fc33b6f3749d975151ae928c4f7594784762e scripts/test_visual_report.py4543cbad84599fe1a09646107bfba355368940aded544208058b9d589f3a09d1 scripts/trafficcop_capture_triage.pybfd60e49ddfdae9bc2b7d1f951a00727642d340b30975ee0958ebada1dd5c705 scripts/trafficcop_clone_advice.py2e9c0df99bdd10b12dcef1ba76f72a79591068ee564f549936a6128815271700 scripts/upgrade_source_style_stage.py6a6ede81861ccf2373d6193df6f0347e2958537923159ac7765232e9d80a3e10 scripts/validate_scroll_mapping.py16cdf16d522c6fbd8c914ddaa798b0e4b08b7720e4f8f57fed2cd9542c0e6917 scripts/verification_worker.pyc16de9a19ea7d9a69cd8752f2fb4224d2b4b50634f1c0a33d33bc638316b0935 scripts/verified_counterpart.pycaddc71b4a558656960dac594a5993183d12de7e4c82ca08552250818bbd877f scripts/verify_application_save_migration.py8d979626534404f6c526163cf160d534790e286f0308a59b284da938965f5c87 scripts/verify_atlas_ui.mjsec873e969c8d9f7460211f4fee289f2b93ec1a485de2671d2ed06fe31f59e6e3 scripts/verify_backup_restore.py52e180eb0be3b31ee78d5a4d2acd6d4b099462d325c6bd25758558f36a9e73bc scripts/verify_built_package.py03b52315deb873d67e7644749ab449b5e0f9fd3d50f5d1695abced8dc3a0e555 scripts/verify_capture_migration.pyb7ac02578bcb2d52817323c6196735d54e1db6da5211b654e465a243b9909b6e scripts/verify_curated_game.mjsd3de88f884259511e261a10775bf9d106b2a375a7f4541fcbab1c08f93c9e99f scripts/verify_data_gallery.mjsf40611ab787dc76c4121a50f922b2f4ffaf6b63f449bb9ac4d6c76a180e31494 scripts/verify_ditto_burn.mjs7fa75afc330e04acd657129ac7003e03e24c8d35d13d7c0755a0bed10c2ff8d1 scripts/verify_export_runtime.py06bf9f8d11b9be70f55bb470854d033ed06a453873d8f33e0f3ec9bb57fdb6f3 scripts/verify_gallery_six.mjs18f71a626889cc5177c95a4a5b8ef869b00c49c1706962b37230a44f4c250cdd scripts/verify_json_table_source.py0ca72818a899b8d270deefb9d29b95c248c0a6e6d2780a06f21274047c4d8f69 scripts/verify_json_table_ui.mjs4c1a4a110747bddd3a7d95e2573efea575e985be24e33664838a7271f45295f7 scripts/verify_laya_tokenizer.py465261feefdc058cb8648e25c9a2381e61c2177bc7f6785dd4c619bc480d022c scripts/verify_laya_worker.py2656dac48036d2cc27bcb75eca386666fd878c43567e3c8eec9d1b5514409792 scripts/verify_live_examples.mjsbc67ff3c7689f03f4cb2a10c815c800f70df716c3eaaf6300bfe3286d24afa00 scripts/verify_packaged_json_cli.py22ece4c413f5295f486b66c10d7ae1daca48b00660fcfedecb9473c297dd1776 scripts/verify_public_metafold.mjsd7f4293c8b6451247639c5782e304bfac87b31c68532e449910ea497eaaf0766 scripts/verify_repository_pilot.py7c03d3f8846677a9390c0b13ebe151ef9d5abcc191fb3922694ed953a31afffb scripts/verify_repository_ui.mjs6568d313f5d380721aa3dbfddfd3d31fc4f94055395aedc6cf13332ad9bf5adf scripts/verify_saved_demos.mjse26be1af8d88ae436049a86207e3f9f030b0e85be18d22cf3f0f5061a784e4be scripts/verify_saved_repository.pyc4947899f3af447537bdbc1042704e4a7adf47a8e3f34d98343e09f1ed589a83 scripts/verify_source_fidelity.mjsdc2391a85128e830d783e346269abce05bb396b6658270f8063a198eb24fe20c scripts/verify_source_gallery.mjsa5ec66766c8115a758f72bf4e212f8644be1ea519e00755c68477f28d03f7167 scripts/verify_staging.mjs814e2e06975e516b6648f7a6f2e27b1e53abb49da804f8833334fbc41184ed0f scripts/vite_define_plan.mjsa43c0686e79d4ef6254c5cb7ba41b0155fce40eea9a46b41a75d84a35f2d7df2 scripts/vite_define_plan.test.mjs1"""Authenticated local control API."""123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873from __future__ import annotations
import hashlibimport jsonimport secretsfrom datetime import timedelta
from chameleon_adapters.hotel_fixture import HotelAdapterfrom chameleon_core.adaptation_contracts import Intake, Residualfrom chameleon_core.adaptation_service import Adaptationsfrom chameleon_core.application_saves import ApplicationSaves, SaveRequestfrom chameleon_core.config import ROOT, Settings, load_settingsfrom chameleon_core.contracts import StrictRecord, host_formfrom chameleon_core.db import ( Agent, Grant, Instance, Run, ScopedMemory, SessionToken, User, database, now, uid,)from chameleon_core.intake import EXAMPLES, LIVE_EXAMPLESfrom chameleon_core.service import Failure, Runtime, ownedfrom chameleon_core.twins import AttachPage, Mutation, TwinQuery, Twinsfrom chameleon_core.website_captures import CaptureRequest, WebsiteCapturesfrom chameleon_core.worker_health import WorkerHealthfrom fastapi import Depends, FastAPI, HTTPException, Query, Request, Responsefrom fastapi.responses import HTMLResponse, JSONResponse, StreamingResponsefrom fastapi.staticfiles import StaticFilesfrom pydantic import Fieldfrom sqlalchemy import func, select, text
class Credentials(StrictRecord): name: str = Field(min_length=1, max_length=80, pattern=r"^[a-zA-Z0-9 _-]+$") password: str = Field(min_length=12, max_length=128)
class Seed(StrictRecord): name: str = Field(default="Iris", min_length=1, max_length=80) approve_synthetic_permissions: bool
class Start(StrictRecord): instance_id: str = Field(pattern=r"^[a-f0-9]{32}$") request_id: str = Field(pattern=r"^req_[a-z0-9]{1,40}$")
class ApprovalDecision(StrictRecord): approved: bool
def token_hash(value: str) -> str: return hashlib.sha256(value.encode()).hexdigest()
def password_hash(value: str, salt: str | None = None) -> str: salt = salt or secrets.token_hex(16) result = hashlib.scrypt(value.encode(), salt=bytes.fromhex(salt), n=16384, r=8, p=1).hex() return salt + ":" + result
class DisabledFixtureAdapter: def observe(self, *args, **kwargs): raise Failure("SYNTHETIC_SERVICE_DISABLED", 403)
create = observe read = observe
def create_app(settings: Settings, adapter=None, provider=None) -> FastAPI: if settings.secure_cookies and adapter is not None: raise ValueError("Public preview cannot receive a synthetic effect adapter") engine, sessions = database(settings.database_url) runtime = Runtime( sessions, DisabledFixtureAdapter() if settings.secure_cookies else adapter or HotelAdapter(settings), provider, ) app = FastAPI(title="Project Chameleon", docs_url=None, redoc_url=None, openapi_url=None) app.state.runtime = runtime app.state.sessions = sessions app.state.engine = engine adaptations = Adaptations(sessions, limits=settings.limits) app.state.adaptations = adaptations twins = Twins(sessions) captures = WebsiteCaptures(sessions, limits=settings.limits) worker_health = WorkerHealth(sessions, settings)
@app.exception_handler(Residual) async def residual(_request, exc): return JSONResponse({"code": exc.code}, status_code=422)
@app.exception_handler(Failure) async def failure(_request, exc): return JSONResponse( {"code": exc.code}, status_code=exc.status, headers={"Retry-After": "60"} if exc.status == 429 else None, )
def response_headers(response): response.headers["Cache-Control"] = "no-store" response.headers["X-Content-Type-Options"] = "nosniff" response.headers["Referrer-Policy"] = "no-referrer" preview = response.headers.get("X-Chameleon-Preview-Policy") == "isolated-v1" if "X-Chameleon-Preview-Policy" in response.headers: del response.headers["X-Chameleon-Preview-Policy"] if not preview: response.headers["Content-Security-Policy"] = ( "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; frame-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'" ) if settings.secure_cookies: response.headers["Strict-Transport-Security"] = "max-age=31536000" return response
@app.middleware("http") async def boundary(request: Request, call_next): def denied(code, status=403): return response_headers(JSONResponse({"code": code}, status_code=status))
if request.headers.get("host") not in settings.allowed_hosts: return denied("HOST_DENIED") if settings.secure_cookies: # Trust the ASGI server's scheme, never an arbitrary forwarding header here. if request.url.scheme != "https": return denied("HTTPS_REQUIRED") path = request.url.path if path.startswith("/api/v1/"): root = path.removeprefix("/api/v1/").split("/", 1)[0] if root not in { "auth", "session", "capabilities", "examples", "providers", "memory", "adaptations", "metafold", "twins", "captures", "agents", } or (root == "auth" and path != "/api/v1/auth/guest"): return denied("LOCAL_SERVICE_DISABLED", 404) if request.method not in {"GET", "HEAD", "OPTIONS"}: if request.headers.get("origin") != settings.origin: return denied("ORIGIN_DENIED") body = bytearray() async for chunk in request.stream(): body.extend(chunk) if len(body) > 32768: return denied("BODY_TOO_LARGE", 413) request._body = bytes(body) response = await call_next(request) return response_headers(response)
def owner(request: Request): value = request.cookies.get("chameleon_session", "") if not value: raise HTTPException(401, "AUTH_REQUIRED") with sessions() as s: session = s.get(SessionToken, token_hash(value)) if not session or now() >= session.expires: raise HTTPException(401, "AUTH_REQUIRED") if request.method not in {"GET", "HEAD"}: csrf = request.headers.get("x-csrf-token", "") if ( not csrf or not secrets.compare_digest(token_hash(csrf), session.csrf_hash) or not secrets.compare_digest(csrf, request.cookies.get("chameleon_csrf", "")) ): raise HTTPException(403, "CSRF_DENIED") return session.owner
def issue_session(s, user, response): token, csrf = secrets.token_urlsafe(32), secrets.token_urlsafe(32) s.add( SessionToken( token_hash=token_hash(token), owner=user.id, csrf_hash=token_hash(csrf), expires=now() + timedelta(hours=8), ) ) response.set_cookie( "chameleon_session", token, httponly=True, secure=settings.secure_cookies, samesite="strict", max_age=28800, path=settings.base_path + "/", ) response.set_cookie( "chameleon_csrf", csrf, httponly=False, secure=settings.secure_cookies, samesite="strict", max_age=28800, path=settings.base_path + "/", ) return {"owner_id": user.id, "name": user.name, "csrf": csrf}
@app.get("/health/live") def live(): return {"status": "live", "profile": settings.profile, "paid_providers": "unconfigured"}
@app.get("/api/v1/capabilities") def capabilities(): return { "profile": settings.profile, "service_desk": settings.profile == "synthetic", "counterparts": ["website_reader", "local_table", "frozen_repository_package"], "source_style_preview": True, "repository_packages": True, "repository_entry_subsets": True, "surface_wall": True, "metafold_step_engine": settings.verification_enabled, "recorded_asset_completion": True, "repository_browser_execution": False, "source_writes": False, }
@app.get("/health/ready") def ready(): result = worker_health.report() return JSONResponse(result, status_code=200 if result["status"] == "ready" else 503)
@app.post("/api/v1/auth/bootstrap") def bootstrap(body: Credentials, response: Response): with sessions.begin() as s: s.execute(text("SELECT pg_advisory_xact_lock(7162001)")) if s.scalar(select(func.count()).select_from(User).where(User.password != "guest-disabled")): raise HTTPException(409, "OWNER_ALREADY_EXISTS") user = User(name=body.name, password=password_hash(body.password)) s.add(user) s.flush() return issue_session(s, user, response)
@app.post("/api/v1/auth/login") def login(body: Credentials, response: Response): with sessions.begin() as s: user = s.scalar(select(User).where(User.name == body.name)) if ( not user or user.password == "guest-disabled" or not secrets.compare_digest( password_hash(body.password, user.password.split(":")[0]), user.password ) ): raise HTTPException(401, "INVALID_CREDENTIALS") return issue_session(s, user, response)
@app.post("/api/v1/auth/guest") def guest(request: Request, response: Response): with sessions.begin() as s: existing = s.get(SessionToken, token_hash(request.cookies.get("chameleon_session", ""))) if existing and existing.expires > now(): csrf = request.cookies.get("chameleon_csrf", "") if csrf and secrets.compare_digest(token_hash(csrf), existing.csrf_hash): return {"owner_id": existing.owner, "profile": "guest_or_existing_session"} s.execute(text("SELECT pg_advisory_xact_lock(7162002)")) if s.scalar(select(func.count()).select_from(User)) >= settings.limits.max_users: raise Failure("GLOBAL_SESSION_CAP_REACHED", 429) # Sessions have a fixed eight-hour expiry. Count actual committed # issuance in the preceding minute without retaining visitor IPs. if ( s.scalar( select(func.count()) .select_from(SessionToken) .where(SessionToken.expires > now() + timedelta(hours=8, minutes=-1)) ) >= settings.limits.new_sessions_per_minute ): raise Failure("GLOBAL_SESSION_ISSUANCE_LIMIT", 429) user = User(name="guest_" + uid(), password="guest-disabled") s.add(user) s.flush() return issue_session(s, user, response)
@app.get("/api/v1/examples") def examples(): return [ *LIVE_EXAMPLES, *[ {"source": source, "origin": "synthetic", **{k: v for k, v in data.items() if k != "data"}} for source, data in EXAMPLES.items() ], ]
@app.get("/api/v1/providers") def providers(owner_id: str = Depends(owner)): return [ { "id": "chameleon-local-v1", "scope": "Chameleon structural forms and spatial reasoning", "paid": False, }, { "id": "structural-v1", "scope": "structural read-form baseline; no spatial inference", "paid": False, }, ]
@app.post("/api/v1/adaptations", status_code=202) def adapt(body: Intake, request: Request, owner_id: str = Depends(owner)): return adaptations.report( owner_id, adaptations.create(owner_id, body, request.headers.get("idempotency-key")) )
@app.post("/api/v1/metafold/runs", status_code=202) def metafold_create(body: dict, request: Request, owner_id: str = Depends(owner)): from chameleon_core.metafold_service import MetaFold
if not settings.verification_enabled: raise Failure("VERIFICATION_DISABLED", 503) service = MetaFold(sessions, adaptations=adaptations) ident = service.create(owner_id, body, request.headers.get("idempotency-key")) return service.report(owner_id, ident)
@app.get("/api/v1/metafold/runs") def metafold_list(response: Response, twin_id: str | None = None, owner_id: str = Depends(owner)): from chameleon_core.metafold_service import MetaFold
response.headers["Cache-Control"] = "no-store" return MetaFold(sessions, adaptations=adaptations).list(owner_id, twin_id)
@app.get("/api/v1/metafold/runs/{run_id}") def metafold_status(run_id: str, response: Response, owner_id: str = Depends(owner)): from chameleon_core.metafold_service import MetaFold
response.headers["Cache-Control"] = "no-store" return MetaFold(sessions, adaptations=adaptations).report(owner_id, run_id)
@app.post("/api/v1/metafold/runs/{run_id}/advance") def metafold_advance(run_id: str, owner_id: str = Depends(owner)): from chameleon_core.metafold_service import MetaFold
if not settings.verification_enabled: raise Failure("VERIFICATION_DISABLED", 503) return MetaFold(sessions, adaptations=adaptations).advance(owner_id, run_id)
@app.get("/api/v1/adaptations") def adaptation_list(owner_id: str = Depends(owner)): return adaptations.list(owner_id)
@app.get("/api/v1/adaptations/{job_id}") def adaptation_report(job_id: str, owner_id: str = Depends(owner)): return adaptations.report(owner_id, job_id)
@app.post("/api/v1/adaptations/{job_id}/cancel") def adaptation_cancel(job_id: str, owner_id: str = Depends(owner)): adaptations.cancel(owner_id, job_id) return adaptations.report(owner_id, job_id)
@app.get("/api/v1/memory") def memory(owner_id: str = Depends(owner)): with sessions() as s: return [ { "agent_id": m.agent, "job_id": m.job, "target_scope": m.target_scope, "evidence_digest": m.evidence_digest, "form_digest": m.form_digest, "authority": m.data.get("authority"), } for m in s.scalars(select(ScopedMemory).where(ScopedMemory.owner == owner_id).limit(50)) ]
@app.post("/api/v1/adaptations/{job_id}/twin", status_code=201) def create_twin(job_id: str, owner_id: str = Depends(owner)): return twins.report(owner_id, twins.create(owner_id, job_id))
@app.get("/api/v1/twins") def list_twins(owner_id: str = Depends(owner)): return twins.list(owner_id)
@app.get("/api/v1/twins/{twin_id}") def twin_report(twin_id: str, owner_id: str = Depends(owner)): return twins.report(owner_id, twin_id)
@app.get("/api/v1/twins/{twin_id}/preview/{page_index}", response_class=HTMLResponse) def twin_preview( twin_id: str, page_index: int, channel: str = Query(pattern=r"^[a-f0-9]{32}$"), owner_id: str = Depends(owner), ): from chameleon_core.visual_capture import render_page
report = twins.report(owner_id, twin_id) if not 0 <= page_index < len(report["pages"]): raise Failure("VISUAL_PAGE_NOT_FOUND", 404) artifact = report["pages"][page_index].get("visual") if not artifact: raise Failure("SOURCE_STYLE_CAPTURE_REQUIRED", 409) nonce = secrets.token_urlsafe(24) return HTMLResponse( render_page(artifact, nonce, channel), headers={ "X-Chameleon-Preview-Policy": "isolated-v1", "Content-Security-Policy": "default-src 'none'; script-src 'nonce-" + nonce + "'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'; sandbox allow-scripts", "Permissions-Policy": "camera=(), microphone=(), geolocation=(), payment=()", }, )
@app.post("/api/v1/twins/{twin_id}/mutations") def twin_mutation(twin_id: str, body: Mutation, request: Request, owner_id: str = Depends(owner)): return twins.mutate(owner_id, twin_id, body, request.headers.get("idempotency-key", ""))
@app.post("/api/v1/twins/{twin_id}/query") def query_twin(twin_id: str, body: TwinQuery, owner_id: str = Depends(owner)): return twins.query(owner_id, twin_id, body.objective)
@app.post("/api/v1/twins/{twin_id}/pages") def attach_page(twin_id: str, body: AttachPage, owner_id: str = Depends(owner)): return twins.attach_page(owner_id, twin_id, body)
@app.post("/api/v1/twins/{twin_id}/captures", status_code=202) def capture_page(twin_id: str, body: CaptureRequest, request: Request, owner_id: str = Depends(owner)): return captures.start(owner_id, twin_id, body, request.headers.get("idempotency-key", ""))
@app.get("/api/v1/twins/{twin_id}/coverage") def website_coverage(twin_id: str, owner_id: str = Depends(owner)): return captures.coverage(owner_id, twin_id)
@app.get("/api/v1/twins/{twin_id}/surfaces") def surface_wall(twin_id: str, response: Response, owner_id: str = Depends(owner)): from chameleon_core.surface_graph import SurfaceGraphs
response.headers["Cache-Control"] = "no-store" return SurfaceGraphs(sessions).read(owner_id, twin_id)
@app.post("/api/v1/captures/{capture_id}/cancel") def cancel_capture(capture_id: str, owner_id: str = Depends(owner)): return captures.cancel(owner_id, capture_id)
@app.get("/api/v1/twins/{twin_id}/export") def export_twin(twin_id: str, owner_id: str = Depends(owner)): return twins.export(owner_id, twin_id)
@app.get("/api/v1/twins/{twin_id}/verification") def verification_status(twin_id: str, response: Response, owner_id: str = Depends(owner)): from chameleon_core.verification_jobs import PROFILE, VerificationJobs, supported
evidence = twins.repository_evidence(owner_id, twin_id) response.headers["Cache-Control"] = "no-store" available = settings.verification_enabled and supported(evidence) return { "available": available, "profile": PROFILE if available else None, "declared_contracts_available": settings.verification_enabled, "declared_contract_versions": ["browser-contract-v1", "browser-contract-v2"], "declared_contract_max_steps": 12, "declared_wait_count_timeout_ms": 2000, "interaction_replay_available": settings.verification_enabled, "declared_contract_scope": "Caller-declared checks only; not independent equivalence", "scope": "Reviewed calculator addition and bounded repair only", "jobs": VerificationJobs(sessions, limits=settings.limits).list(owner_id, twin_id) if settings.verification_enabled else [], }
@app.post("/api/v1/twins/{twin_id}/verification", status_code=202) def verification_start(twin_id: str, request: Request, owner_id: str = Depends(owner)): from chameleon_core.verification_jobs import VerificationJobs, supported
evidence = twins.repository_evidence(owner_id, twin_id) if not settings.verification_enabled: raise Failure("VERIFICATION_DISABLED", 503) if not supported(evidence): raise Failure("VERIFICATION_FAMILY_UNSUPPORTED", 422) queue = VerificationJobs(sessions, limits=settings.limits) ident = queue.enqueue(owner_id, twin_id, request.headers.get("idempotency-key", "")) return queue.report(owner_id, ident)
@app.post("/api/v1/twins/{twin_id}/verification/contract", status_code=202) def verification_contract(twin_id: str, request: Request, contract: dict, owner_id: str = Depends(owner)): from chameleon_core.verification_jobs import CONTRACT_PROFILE, VerificationJobs
twins.repository_evidence(owner_id, twin_id) if not settings.verification_enabled: raise Failure("VERIFICATION_DISABLED", 503) queue = VerificationJobs(sessions, limits=settings.limits) ident = queue.enqueue( owner_id, twin_id, request.headers.get("idempotency-key", ""), profile=CONTRACT_PROFILE, contract=contract, ) return { **queue.report(owner_id, ident), "scope": "Caller-declared checks only; not independent equivalence", }
@app.post("/api/v1/twins/{twin_id}/verification/locked-assets", status_code=202) def verification_locked_assets( twin_id: str, request: Request, body: dict, owner_id: str = Depends(owner) ): from chameleon_core.verification_jobs import CONTRACT_PROFILE, VerificationJobs
if not settings.verification_enabled: raise Failure("VERIFICATION_DISABLED", 503) if set(body) != {"contract", "lock_path"} or not isinstance(body["lock_path"], str): raise Failure("DEPENDENCY_REQUEST_INVALID", 422) queue = VerificationJobs(sessions, limits=settings.limits) ident = queue.enqueue( owner_id, twin_id, request.headers.get("idempotency-key", ""), profile=CONTRACT_PROFILE, contract=body["contract"], dependency_lock=body["lock_path"], ) return { **queue.report(owner_id, ident), "scope": "Caller-declared checks; exact captured npm lock assets only", }
@app.get("/api/v1/twins/{twin_id}/dependencies/plan") def dependency_metadata_plan(twin_id: str, owner_id: str = Depends(owner)): from chameleon_core.dependency_plan import plan_dependencies
evidence = twins.repository_evidence(owner_id, twin_id) return plan_dependencies({"digest": evidence.content_digest, "repository": evidence.payload})
@app.post("/api/v1/twins/{twin_id}/dependencies/capture-metadata", status_code=202) def dependency_metadata_capture(twin_id: str, request: Request, owner_id: str = Depends(owner)): from chameleon_core.dependency_plan import metadata_intake
intake = metadata_intake(twins.repository_evidence(owner_id, twin_id)) ident = adaptations.create(owner_id, intake, request.headers.get("idempotency-key")) return adaptations.report(owner_id, ident)
@app.get("/api/v1/twins/{twin_id}/behavior") def behavior_records(twin_id: str, response: Response, owner_id: str = Depends(owner)): from chameleon_core.behavior_records import BehaviorRecords
response.headers["Cache-Control"] = "no-store" return BehaviorRecords(twins.sessions).read(owner_id, twin_id)
@app.get("/api/v1/twins/{twin_id}/behavior/{record_id}/complete-assets") def recorded_asset_plan(twin_id: str, record_id: str, owner_id: str = Depends(owner)): from chameleon_core.behavior_records import BehaviorRecords
intake = BehaviorRecords(twins.sessions).asset_completion(owner_id, twin_id, record_id) return {"source": intake.source, "entry": intake.repository_entry, "paths": intake.repository_assets}
@app.get("/api/v1/twins/{twin_id}/behavior/{record_id}/correspondence") def source_correspondence(twin_id: str, record_id: str, response: Response, owner_id: str = Depends(owner)): from chameleon_core.metafold_evidence import MetafoldEvidence
response.headers["Cache-Control"] = "no-store" return MetafoldEvidence(sessions).correspondence(owner_id, twin_id, record_id)
@app.post("/api/v1/twins/{twin_id}/behavior/{record_id}/complete-assets", status_code=202) def complete_recorded_assets( twin_id: str, record_id: str, request: Request, owner_id: str = Depends(owner) ): from chameleon_core.behavior_records import BehaviorRecords
intake = BehaviorRecords(twins.sessions).asset_completion(owner_id, twin_id, record_id) ident = adaptations.create(owner_id, intake, request.headers.get("idempotency-key")) return adaptations.report(owner_id, ident)
@app.get("/api/v1/twins/{twin_id}/bundles/{bundle_id}/download") def counterpart_bundle(twin_id: str, bundle_id: str, owner_id: str = Depends(owner)): from chameleon_core.counterpart_bundles import CounterpartBundles
body, fingerprint = CounterpartBundles(twins.sessions).download(owner_id, twin_id, bundle_id) return Response( body, media_type="application/zip", headers={ "Content-Disposition": 'attachment; filename="chameleon-counterpart.zip"', "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff", "X-Chameleon-Bundle-SHA256": fingerprint, }, )
@app.get("/api/v1/twins/{twin_id}/bundles/{bundle_id}/frame", response_class=HTMLResponse) def counterpart_bundle_frame(twin_id: str, bundle_id: str, owner_id: str = Depends(owner)): from chameleon_core.bundle_preview import render from chameleon_core.counterpart_bundles import CounterpartBundles
body, _ = CounterpartBundles(twins.sessions).download(owner_id, twin_id, bundle_id) nonce = secrets.token_urlsafe(24) return HTMLResponse( render(body, nonce), headers={ "X-Chameleon-Preview-Policy": "isolated-v1", "Cache-Control": "no-store", "Content-Security-Policy": "default-src 'none'; script-src 'nonce-" + nonce + "'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; " "frame-src 'none'; worker-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; " "frame-ancestors 'self'; sandbox allow-scripts", "Permissions-Policy": "camera=(), microphone=(), geolocation=(), payment=()", }, )
@app.get("/api/v1/twins/{twin_id}/bundles/{bundle_id}/interaction-frame") def counterpart_interaction_frame(twin_id: str, bundle_id: str, owner_id: str = Depends(owner)): from chameleon_core.counterpart_bundles import CounterpartBundles
body, fingerprint = CounterpartBundles(sessions).interaction_frame(owner_id, twin_id, bundle_id) return Response( body, media_type="image/png", headers={ "Cache-Control": "no-store", "X-Content-Type-Options": "nosniff", "Cross-Origin-Resource-Policy": "same-origin", "Content-Security-Policy": "default-src 'none'; sandbox", "X-Chameleon-Frame-SHA256": fingerprint, }, )
@app.post("/api/v1/twins/{twin_id}/bundles/{bundle_id}/replay", status_code=202) def counterpart_replay( twin_id: str, bundle_id: str, request: Request, action: dict, owner_id: str = Depends(owner) ): from chameleon_core.counterpart_bundles import CounterpartBundles
if not settings.verification_enabled: raise Failure("VERIFICATION_DISABLED", 503) result = CounterpartBundles(sessions, limits=settings.limits).replay( owner_id, twin_id, bundle_id, action, request.headers.get("idempotency-key", "") ) return { **result, "scope": "Fresh isolated replay of recorded steps and requested action; not a persistent live session", }
@app.get("/api/v1/twins/{twin_id}/repository/file") def repository_file( twin_id: str, path: str = Query(min_length=1, max_length=240), owner_id: str = Depends(owner) ): return twins.repository_file(owner_id, twin_id, path)
@app.get("/api/v1/twins/{twin_id}/repository/application") def repository_application_status(twin_id: str, owner_id: str = Depends(owner)): from chameleon_core.curated_app import approved_2048
evidence = twins.repository_evidence(owner_id, twin_id) supported = approved_2048({"digest": evidence.content_digest, "repository": evidence.payload}) return { "available": supported, "application": "2048" if supported else None, "coverage": "Previously tested original-source revision; this acquisition does not rerun behavior tests", "storage": "private server save; explicit Save progress required", "source_writes": False, }
@app.get("/api/v1/twins/{twin_id}/repository/application/save") def application_save_get(twin_id: str, response: Response, owner_id: str = Depends(owner)): response.headers["Cache-Control"] = "no-store" return ApplicationSaves(twins.sessions).read(owner_id, twin_id)
@app.put("/api/v1/twins/{twin_id}/repository/application/save") def application_save_put(twin_id: str, body: SaveRequest, owner_id: str = Depends(owner)): return ApplicationSaves(twins.sessions).write(owner_id, twin_id, body)
@app.get("/api/v1/twins/{twin_id}/repository/application/frame", response_class=HTMLResponse) def repository_application_frame( twin_id: str, channel: str = Query(pattern=r"^[a-f0-9]{32}$"), owner_id: str = Depends(owner) ): from chameleon_core.curated_app import render_2048
evidence = twins.repository_evidence(owner_id, twin_id) nonce = secrets.token_urlsafe(24) return HTMLResponse( render_2048({"digest": evidence.content_digest, "repository": evidence.payload}, nonce, channel), headers={ "X-Chameleon-Preview-Policy": "isolated-v1", "Cache-Control": "no-store", "Content-Security-Policy": "default-src 'none'; script-src 'nonce-" + nonce + "'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'; sandbox allow-scripts", "Permissions-Policy": "camera=(), microphone=(), geolocation=(), payment=()", }, )
@app.get("/api/v1/twins/{twin_id}/repository/download") def repository_download(twin_id: str, owner_id: str = Depends(owner)): body, commit = twins.repository_zip(owner_id, twin_id) return Response( body, media_type="application/zip", headers={ "Content-Disposition": f'attachment; filename="chameleon-source-{commit[:12]}.zip"', "X-Chameleon-Package-Scope": "frozen-source-behavior-untested", }, )
@app.get("/api/v1/session") def session(owner_id: str = Depends(owner)): return {"owner_id": owner_id, "profile": settings.profile, "live_providers": "unconfigured"}
@app.post("/api/v1/demo/seed", status_code=201) def seed(body: Seed, owner_id: str = Depends(owner)): if not body.approve_synthetic_permissions: raise HTTPException(403, "EXPLICIT_FIXTURE_GRANTS_REQUIRED") return runtime.seed(owner_id, body.name)
@app.get("/api/v1/agents") def agents(owner_id: str = Depends(owner)): with sessions() as s: return [a.identity for a in s.scalars(select(Agent).where(Agent.owner == owner_id))]
@app.get("/api/v1/agents/{agent_id}") def agent(agent_id: str, owner_id: str = Depends(owner)): with sessions() as s: return owned(s, Agent, agent_id, owner_id).identity
@app.get("/api/v1/instances") def instances(owner_id: str = Depends(owner)): with sessions() as s: return [ {"agent_id": i.agent, "instance_id": i.id, "form_digest": i.form} for i in s.scalars(select(Instance).where(Instance.owner == owner_id).limit(100)) ]
@app.get("/api/v1/forms/host") def form(owner_id: str = Depends(owner)): return host_form().model_dump()
@app.post("/api/v1/runs", status_code=201) def start(body: Start, request: Request, owner_id: str = Depends(owner)): key = request.headers.get("idempotency-key", "") if not 1 <= len(key) <= 80 or not key.isascii(): raise HTTPException(400, "IDEMPOTENCY_KEY_REQUIRED") ident = runtime.start(owner_id, body.instance_id, body.request_id, key) return runtime.report(owner_id, ident)
@app.get("/api/v1/runs") def runs(owner_id: str = Depends(owner)): with sessions() as s: return [ {"run_id": r.id, "status": r.status, "request_id": r.request_id} for r in s.scalars(select(Run).where(Run.owner == owner_id).limit(100)) ]
@app.get("/api/v1/runs/{run_id}/report") def report(run_id: str, owner_id: str = Depends(owner)): return runtime.report(owner_id, run_id)
@app.post("/api/v1/runs/{run_id}/step") def step(run_id: str, owner_id: str = Depends(owner)): runtime.step(owner_id, run_id) return runtime.report(owner_id, run_id)
@app.post("/api/v1/approvals/{approval_id}/decision") def approve(approval_id: str, body: ApprovalDecision, owner_id: str = Depends(owner)): runtime.decide_approval(owner_id, approval_id, body.approved) return {"recorded": True}
@app.post("/api/v1/runs/{run_id}/pause") def pause(run_id: str, owner_id: str = Depends(owner)): runtime.pause(owner_id, run_id) return runtime.report(owner_id, run_id)
@app.post("/api/v1/runs/{run_id}/cancel") def cancel(run_id: str, owner_id: str = Depends(owner)): runtime.pause(owner_id, run_id, cancel=True) return runtime.report(owner_id, run_id)
@app.post("/api/v1/runs/{run_id}/resume") def resume(run_id: str, owner_id: str = Depends(owner)): runtime.resume(owner_id, run_id) return runtime.report(owner_id, run_id)
@app.post("/api/v1/runs/{run_id}/reconcile") def reconcile(run_id: str, owner_id: str = Depends(owner)): runtime.broker.reconcile(owner_id, run_id) return runtime.report(owner_id, run_id)
@app.post("/api/v1/grants/{grant_id}/revoke") def revoke(grant_id: str, owner_id: str = Depends(owner)): with sessions.begin() as s: grant = owned(s, Grant, grant_id, owner_id, lock=True) grant.active = False grant.version += 1 return {"revoked": True}
@app.get("/api/v1/runs/{run_id}/events") def events(run_id: str, request: Request, after: int = 0, owner_id: str = Depends(owner)): if after < 0: raise HTTPException(400, "INVALID_CURSOR") try: cursor = max(after, int(request.headers.get("last-event-id", "0"))) except ValueError: raise HTTPException(400, "INVALID_CURSOR") rows = runtime.events(owner_id, run_id, cursor) if "text/event-stream" in request.headers.get("accept", ""): return StreamingResponse( iter([f"id: {r['sequence']}\nevent: trace\ndata: {json.dumps(r)}\n\n" for r in rows]), media_type="text/event-stream", ) return { "events": rows, "cursor": rows[-1]["sequence"] if rows else cursor, "replay": True, "external_calls": 0, }
@app.get("/showcase/application/2048", response_class=HTMLResponse) def curated_game(channel: str = Query(pattern=r"^[a-f0-9]{32}$")): from chameleon_core.curated_app import render_2048
path = ROOT / "apps/web/dist/showcase/2048-package.json" if not path.is_file(): raise Failure("EXAMPLE_NOT_AVAILABLE", 404) nonce = secrets.token_urlsafe(24) return HTMLResponse( render_2048(json.loads(path.read_text(encoding="utf-8")), nonce, channel), headers={ "X-Chameleon-Preview-Policy": "isolated-v1", "Content-Security-Policy": "default-src 'none'; script-src 'nonce-" + nonce + "'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'; sandbox allow-scripts", "Permissions-Policy": "camera=(), microphone=(), geolocation=(), payment=()", }, )
@app.get("/showcase/frame/{example}/{page_index}", response_class=HTMLResponse) def public_example_preview( example: int, page_index: int, channel: str = Query(pattern=r"^[a-f0-9]{32}$"), ): from chameleon_core.visual_capture import render_page
# Fixed release artifacts only. Never accept guest/twin identifiers here. if example not in (0, 1, 2, 4, 5) or page_index not in range(8): raise Failure("EXAMPLE_PAGE_NOT_FOUND", 404) path = ROOT / f"apps/web/dist/showcase/demo-{example}.json" if not path.is_file(): raise Failure("EXAMPLE_PAGE_NOT_FOUND", 404) capture = json.loads(path.read_text(encoding="utf-8")) if page_index >= len(capture["pages"]): raise Failure("EXAMPLE_PAGE_NOT_FOUND", 404) nonce = secrets.token_urlsafe(24) return HTMLResponse( render_page(capture["pages"][page_index]["visual"], nonce, channel), headers={ "X-Chameleon-Preview-Policy": "isolated-v1", "Content-Security-Policy": "default-src 'none'; script-src 'nonce-" + nonce + "'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'; sandbox allow-scripts", "Permissions-Policy": "camera=(), microphone=(), geolocation=(), payment=()", }, )
static = ROOT / "apps/web/dist" if static.exists(): app.mount("/", StaticFiles(directory=static, html=True), name="web") return app
def factory(): return create_app(load_settings())123456from chameleon_adapters.hotel_fixture import fixture_appfrom chameleon_core.config import load_settings
def factory(): return fixture_app(load_settings())123456789101112131415161718#!/usr/bin/env python3
"""chameleon pack exam: each of its own test files is run alone. One that needs a package, a browser or a frozen fixture the pack doesn't carry counts as
waiting on the checked fetch; every test that can run here must pass."""
import glob
import json
import subprocess
done, waiting, failed = 0, [], []
for f in sorted(glob.glob("scripts/*.test.mjs")):
p = subprocess.run(["node", "--test", f], capture_output=True, text=True, timeout=120)
text = p.stdout + p.stderr
if p.returncode == 0:
done += 1
elif "Cannot find module" in text or "Cannot find package" in text or "ERR_MODULE_NOT_FOUND" in text or "Executable doesn't exist" in text or "/.local/" in text or " '.local/" in text:
waiting.append(f)
else:
failed.append(f)
print(json.dumps({"passed": done > 0 and not failed, "summary": "%d test files pass, %d wait on packages, a browser or fixtures, %d fail" % (done, len(waiting), len(failed)), "failed": failed}))12345678910111213141516171819202122#!/usr/bin/env python3"""night for artist and chameleon - each failure in the orbiter's own record becomes a typed hole in the orbiters' one format, ranked by what it costs. What fills a hole needs ajudge or a browser that isn't in the pack, so this night reports; it builds nothing. usage: python night.py"""import jsonfrom pathlib import Path
HERE = Path(__file__).resolve().parentholes = []if HERE.name == "artist": d = json.load(open(HERE / "results" / "geneval_heldout.json")) for task, r in d["by_task"].items(): lost = r["n_images"] * (1 - r["judge"]) gap = r["self_verified"] - r["judge"] holes.append({"origin": "artist", "kind": "not_recognised" if gap > .2 else "failed_check", "want": "compositing an outside judge recognises" if gap > .2 else "sprites for this kind", "givens": {"task": task, "judge": r["judge"], "self_verified": r["self_verified"]}, "cost": round(lost)})else: d = json.load(open(HERE / "results" / "release-panel-current-20260921b.json")) for t in d["targets"]: st = [a.get("status") for a in t.get("attempts", [])] if st and st[-1] != "COMPLETE": holes.append({"origin": "chameleon", "kind": "blocked", "want": "an operator or a contract for this target", "givens": {"id": t["id"], "family": t.get("family"), "split": t.get("split"), "status": st[-1]}, "cost": 1})holes.sort(key=lambda h: -h["cost"])print(json.dumps({"holes": len(holes), "top": holes[:4]}, indent=1))123456789{
"name": "chameleon",
"good_for": "Turns repositories into finished apps, and blocks with reasons rather than claim completion.",
"python": [],
"programs": [
"node"
],
"exam": "exam_pack.py"
}1234567{ "name": "project-chameleon", "version": "0.1.0", "private": true, "packageManager": "pnpm@11.19.0", "type": "module", "scripts": {"build": "vite build --config apps/web/vite.config.ts", "typecheck": "tsc -p apps/web/tsconfig.json --noEmit", "test:e2e": "playwright test"}, "dependencies": {"react": "19.3.0", "react-dom": "19.3.0"}, "devDependencies": {"vite": "8.3.0", "typescript": "7.0.2", "@vitejs/plugin-react": "6.1.1", "@types/react": "19.3.0", "@types/react-dom": "19.3.0", "@playwright/test": "1.63.0"}}1"""Registered trusted executors. No dynamic code import from form packages."""123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214from __future__ import annotations
import secretsfrom typing import Literal
import httpxfrom chameleon_core.config import Settingsfrom chameleon_core.contracts import StrictRecord, TicketArguments, digestfrom chameleon_core.db import FixtureRequest, FixtureTicket, databasefrom fastapi import FastAPI, Header, HTTPExceptionfrom pydantic import Fieldfrom sqlalchemy import select
class CreateTicket(StrictRecord): arguments: TicketArguments expected_version: int = Field(ge=1) idempotency_key: str = Field(pattern=r"^[a-f0-9]{64}$")
class TicketView(StrictRecord): ticket_id: str request_id: str room_id: str category: str idempotency_key: str status: Literal["open", "closed"]
def ticket_view(t: FixtureTicket) -> dict: if t.status not in ("open", "closed"): raise ValueError("Unexpected fixture ticket status") return TicketView( ticket_id=t.id, request_id=t.request_id, room_id=t.room, category=t.category, idempotency_key=t.idempotency_key, status="open" if t.status == "open" else "closed", ).model_dump()
def fixture_app(settings: Settings) -> FastAPI: if settings.profile != "synthetic": raise ValueError("Synthetic fixture is disabled in this profile") engine, sessions = database(settings.database_url) app = FastAPI(title="SYNTHETIC Hotel fixture", docs_url=None, redoc_url=None) app.state.engine = engine
def principal(authorization: str, owner: str): if not secrets.compare_digest(authorization, "Bearer " + settings.fixture_key) or len(owner) != 32: raise HTTPException(403, "FIXTURE_AUTH_REQUIRED")
@app.get("/health") def health(): return {"profile": "synthetic", "version": "hotel-fixture-v1"}
@app.get("/requests/{request_id}") def observe(request_id: str, authorization: str = Header(default=""), x_owner: str = Header(default="")): principal(authorization, x_owner) with sessions() as s: row = s.get(FixtureRequest, (request_id, x_owner)) if not row: raise HTTPException(404, "REQUEST_NOT_FOUND") tickets = s.scalars( select(FixtureTicket).where( FixtureTicket.owner == x_owner, FixtureTicket.request_id == request_id ) ).all() return { "request_id": row.id, "room_id": row.room, "category": row.category, "text": row.text, "version": row.version, "available": row.available, "status": row.status, "tickets": [ticket_view(t) for t in tickets], "interface_version": "hotel-fixture-v1", }
@app.post("/tickets") def create( body: CreateTicket, authorization: str = Header(default=""), x_owner: str = Header(default="") ): principal(authorization, x_owner) args = body.arguments with sessions.begin() as s: row = s.scalar( select(FixtureRequest) .where(FixtureRequest.id == args.request_id, FixtureRequest.owner == x_owner) .with_for_update() ) if not row: raise HTTPException(404, "REQUEST_NOT_FOUND") binding = digest(args.model_dump()) prior = s.scalar( select(FixtureTicket).where( FixtureTicket.owner == x_owner, FixtureTicket.idempotency_key == body.idempotency_key ) ) if prior: if prior.binding != binding: raise HTTPException(409, "IDEMPOTENCY_CONFLICT") return ticket_view(prior) if row.version != body.expected_version: raise HTTPException(409, "STALE_STATE") if ( not row.available or row.status != "open" or row.category != args.category or row.room != args.room_id ): raise HTTPException(409, "SERVICE_UNAVAILABLE") if s.scalar( select(FixtureTicket).where( FixtureTicket.owner == x_owner, FixtureTicket.request_id == args.request_id ) ): raise HTTPException(409, "DUPLICATE_REQUEST") ticket = FixtureTicket( owner=x_owner, request_id=args.request_id, room=args.room_id, category=args.category, idempotency_key=body.idempotency_key, binding=binding, ) s.add(ticket) s.flush() row.version += 1 return ticket_view(ticket)
@app.get("/tickets/by-key/{key}") def by_key(key: str, authorization: str = Header(default=""), x_owner: str = Header(default="")): principal(authorization, x_owner) with sessions() as s: ticket = s.scalar( select(FixtureTicket).where( FixtureTicket.owner == x_owner, FixtureTicket.idempotency_key == key ) ) if not ticket: raise HTTPException(404, "TICKET_NOT_FOUND") return ticket_view(ticket)
return app
class AdapterFailure(RuntimeError): def __init__(self, code: str): self.code = code super().__init__(code)
class HotelAdapter: """Connection URL is deployment-owned. Form/provider output cannot change it."""
def __init__(self, settings: Settings, client=None): if settings.profile != "synthetic": raise ValueError("Synthetic adapter is disabled in this profile") self.settings = settings self.client = client or httpx.Client( base_url=settings.fixture_url, timeout=3, trust_env=False, follow_redirects=False )
def call(self, method: str, path: str, owner: str, body=None): try: response = self.client.request( method, path, headers={"Authorization": "Bearer " + self.settings.fixture_key, "X-Owner": owner}, json=body, ) except httpx.TransportError as exc: raise AdapterFailure("OUTCOME_UNKNOWN" if method == "POST" else "TARGET_UNAVAILABLE") from exc if response.status_code >= 500: raise AdapterFailure("OUTCOME_UNKNOWN" if method == "POST" else "TARGET_UNAVAILABLE") if response.status_code != 200: known = ( response.json().get("detail") if response.headers.get("content-type", "").startswith("application/json") else None ) raise AdapterFailure( known if known in { "STALE_STATE", "SERVICE_UNAVAILABLE", "TICKET_NOT_FOUND", "DUPLICATE_REQUEST", "IDEMPOTENCY_CONFLICT", "REQUEST_NOT_FOUND", } else "TARGET_ERROR" ) if len(response.content) > 32768: raise AdapterFailure("TARGET_INVALID_RESULT") return response.json()
def observe(self, owner: str, request_id: str): return self.call("GET", f"/requests/{request_id}", owner)
def create(self, owner: str, candidate, key: str): body = CreateTicket( arguments=candidate.arguments, expected_version=candidate.precondition_version, idempotency_key=key, ) return TicketView.model_validate(self.call("POST", "/tickets", owner, body.model_dump())).model_dump()
def read(self, owner: str, key: str): return TicketView.model_validate(self.call("GET", f"/tickets/by-key/{key}", owner)).model_dump()1234567891011121314151617181920212223242526272829303132333435"""Ditto-specific durable MetaFold submission, packaged without altering Chameleon."""import jsonfrom uuid import uuid4
def reconstruct(client, request_path=None, effort='sol', *, resume=False): pending = client.state.get('ditto_reconstruction_pending') if resume: if not pending: raise ValueError('NO_PENDING_RECONSTRUCTION') else: if pending: raise ValueError('PENDING_RECONSTRUCTION_USE_RESUME') if effort not in {'luna', 'sol', 'astra'}: raise ValueError('INVALID_EFFORT') with request_path.open('rb') as stream: raw = stream.read(32769) if len(raw) > 32768: raise ValueError('RECONSTRUCTION_REQUEST_TOO_LARGE') body = json.loads(raw) if not isinstance(body, dict) or 'max_steps' in body: raise ValueError('USE_EFFORT_NOT_MAX_STEPS') if 'effort' in body and body['effort'] != effort: raise ValueError('CONFLICTING_EFFORT') body['effort'] = effort pending = {'key': uuid4().hex, 'body': body} client.state['ditto_reconstruction_pending'] = pending client.save() result = client.request('metafold/runs', 'POST', pending['body'], key=pending['key']) if not isinstance(result, dict) or not isinstance(result.get('id'), str): raise ValueError('RECONSTRUCTION_DELIVERY_UNCONFIRMED') client.state['ditto_reconstruction_last_run'] = result['id'] client.state.pop('ditto_reconstruction_pending', None) client.save() return result1"""Chameleon command-line harness."""123from .main import main
raise SystemExit(main())123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183"""A session-scoped API client. No generated code or direct source effects."""
import hashlibimport jsonimport osimport reimport tempfileimport timefrom pathlib import Pathfrom urllib.parse import unquote, urlsplitfrom uuid import uuid4
import httpx
class HarnessError(RuntimeError): pass
def server_origin(value): value = value.rstrip("/") parsed = urlsplit(value) if ( parsed.username or parsed.password or not re.fullmatch(r"(?:/[a-zA-Z0-9_-]+)*", parsed.path) or parsed.query or parsed.fragment or not parsed.hostname or parsed.scheme not in {"https", "http"} or (parsed.scheme == "http" and parsed.hostname not in {"127.0.0.1", "localhost", "::1"}) ): raise HarnessError("SERVER_MUST_BE_HTTPS_OR_LOOPBACK_ORIGIN") return value
class Harness: def __init__(self, server, home: Path, http=None): self.server = server_origin(server) parsed = urlsplit(self.server) self.origin = parsed.scheme + "://" + parsed.netloc self.home = home self.path = home / (hashlib.sha256(self.server.encode()).hexdigest()[:24] + ".json") self.state = json.loads(self.path.read_text()) if self.path.exists() else {} self.http = http or httpx.Client(timeout=20, follow_redirects=False) for cookie in self.state.get("cookies", []): self.http.cookies.set( cookie["name"], cookie["value"], domain=cookie["domain"], path=cookie["path"] )
def save(self): self.home.mkdir(parents=True, exist_ok=True) self.state["cookies"] = [ {"name": c.name, "value": c.value, "domain": c.domain, "path": c.path} for c in self.http.cookies.jar ] fd, name = tempfile.mkstemp(prefix="session-", dir=self.home) try: with os.fdopen(fd, "w", encoding="utf-8") as stream: json.dump(self.state, stream) os.replace(name, self.path) finally: if os.path.exists(name): os.unlink(name)
def request(self, path, method="GET", body=None, key=None): csrf = next((c.value for c in self.http.cookies.jar if c.name == "chameleon_csrf"), "") headers = {"Origin": self.origin, "X-CSRF-Token": unquote(csrf)} if key: headers["Idempotency-Key"] = key try: response = self.http.request(method, self.server + "/api/v1/" + path, headers=headers, json=body) except httpx.RequestError as exc: raise HarnessError("TRANSPORT_UNCERTAIN_USE_RESUME_FOR_PENDING_LAUNCH") from exc if not response.is_success: try: code = response.json().get("code", "REQUEST_REJECTED") except ValueError: code = "INVALID_SERVER_RESPONSE" # Never echo an arbitrary server body, URLs with credentials or cookie headers. safe = code if isinstance(code, str) and code.replace("_", "").isalnum() else "REQUEST_REJECTED" raise HarnessError(f"HTTP_{response.status_code}_{safe}") return response.json()
def connect(self): identity = self.request("auth/guest", "POST") owner = identity["owner_id"] if self.state.get("owner") and self.state["owner"] != owner: raise HarnessError("SESSION_EXPIRED_USE_NEW_HOME_TO_START_AGAIN") self.state["owner"] = owner self.save()
def point( self, source, objective, provider, wait=0, presentation="reader", source_type="web", entry=None, table_pointer=None, ): if self.state.get("pending"): raise HarnessError("PENDING_LAUNCH_USE_RESUME") if table_pointer is not None and ( not isinstance(table_pointer, str) or len(table_pointer) > 500 or (table_pointer != "" and not table_pointer.startswith("/")) or source_type != "web" or presentation != "reader" ): raise HarnessError("INVALID_JSON_TABLE_SELECTION") self.state["pending"] = { "key": str(uuid4()), "body": { "source": source, "objective": objective, "provider": provider, "build_counterpart": True, "presentation": presentation, **({"table_pointer": table_pointer} if table_pointer is not None else {}), **( {"source_type": "repository", "repository_entry": entry} if source_type == "repository" else {} ), }, } self.save() return self.resume(wait)
def resume(self, wait=0): pending = self.state.get("pending") if not pending: raise HarnessError("NO_PENDING_LAUNCH") try: result = self.request("adaptations", "POST", pending["body"], pending["key"]) except HarnessError as exc: if str(exc).startswith("HTTP_4"): self.state.pop("pending", None) self.save() raise self.state.pop("pending", None) self.state["last_job"] = result["id"] self.save() return self.status(result["id"], wait) if wait else result
def status(self, ident, wait=0): deadline = time.monotonic() + wait while True: result = self.request("adaptations/" + ident) pending = ( result["status"] in {"QUEUED", "RUNNING"} or (result.get("counterpart") or {}).get("status") == "PENDING" ) if not pending or time.monotonic() >= deadline: return result time.sleep(0.5)
def close(self): self.http.close()
def download(self, ident, output: Path): if not re.fullmatch(r"[a-f0-9]{32}", ident): raise HarnessError("INVALID_COUNTERPART_ID") if output.exists(): raise HarnessError("OUTPUT_ALREADY_EXISTS") body = bytearray() try: with self.http.stream( "GET", self.server + "/api/v1/twins/" + ident + "/repository/download" ) as response: if response.status_code != 200 or response.headers.get("content-type") != "application/zip": raise HarnessError("REPOSITORY_DOWNLOAD_REJECTED") for chunk in response.iter_bytes(): body.extend(chunk) if len(body) > 6 * 1024 * 1024: raise HarnessError("REPOSITORY_DOWNLOAD_BYTE_BUDGET") except httpx.RequestError as exc: raise HarnessError("REPOSITORY_DOWNLOAD_TRANSPORT_FAILED") from exc if not body.startswith(b"PK\x03\x04"): raise HarnessError("REPOSITORY_DOWNLOAD_NOT_ZIP") with output.open("xb") as stream: stream.write(body) return { "saved": str(output), "bytes": len(body), "sha256": hashlib.sha256(body).hexdigest(), "extracted": False, "executed": False, }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186"""Pixel terminal for humans; JSON interface for an external agent's tool runner."""
import argparseimport jsonimport osimport sysfrom pathlib import Path
from .client import Harness, HarnessError
BANNER = """ ▄████▄ ▄█████▀ ▀██▄ ▄██ ▀██▄ ▄███▄▄ ▄▄▄██████████████████████▄ ██▀▀ ▀██▀ ▀██▀ ▀████▄ ██▄ ██ ██ ▄█▀ ██ ▀████▄▄▄▄██ ██ ██▄▄██▀ ▀▀▀▀▀▀▀ ▀▀▀
C H A M E L E O N / H A R N E S S POINT > OBSERVE > FORM > VERIFY > RUN""".strip("\n")
def schema(): return { "name": "chameleon-harness", "version": "0.1.0", "transport": "CLI arguments; one JSON result on stdout with --json", "description": "External AI agents may call these bounded tools. They do not replace the server's reasoning provider.", "commands": { "examples": {}, "providers": {}, "point": { "source": "public HTTPS URL or labeled example:// fixture", "objective": "optional", "wait": "0..120 seconds", "presentation": "reader (default) or preserve (source-style static website)", "source_type": "web (default) or repository (frozen public GitHub source package)", "entry": "repository HTML entry, defaults to index.html; never executed by capture", "table_pointer": "optional RFC 6901 JSON row-array path, e.g. /results; reader/web only; full response retained; no pagination", }, "resume": {"description": "Retry an uncertain launch with its saved request key"}, "status": {"job": "job ID from point", "wait": "0..120 seconds"}, "show": {"twin": "counterpart ID from status"}, "query": { "twin": "table counterpart ID", "objective": "count rows, sum FIELD, mean FIELD, group by FIELD", }, "export": {"twin": "counterpart ID"}, "download": { "twin": "repository artifact ID", "out": "new ZIP path; no overwrite, extraction or execution", }, }, "source_writes": False, "executes_generated_code": False, "session": "private local cookie store; same expiry and owner boundary as the site", }
def render(data): if isinstance(data, dict) and "status" in data and "source" in data: counterpart = data.get("counterpart") or {} form = data.get("form") or {} result = [ f" SOURCE {data['source']}", f" STATE {data['status']}", f" ENGINE {form.get('provider', 'waiting for compiler')}", " ROUTE " + " > ".join(step["operation"] for step in form.get("steps", [])), f" COPY {counterpart.get('status', 'not requested')}", f" JOB {data['id']}", ] if counterpart.get("twin_id"): result += [ f" TWIN {counterpart['twin_id']}", " NEXT chameleon show " + counterpart["twin_id"], ] if data.get("residual") or counterpart.get("residual"): result += [" NOTE " + str(data.get("residual") or counterpart.get("residual"))] return "\n".join(result) + "\n\n Copied evidence. No source writes. Scope follows the manifest." if isinstance(data, dict) and "manifest" in data: manifest = data["manifest"] return "\n".join( [ " WORKING COUNTERPART", f" KIND {manifest['kind']}", f" REVISION {data['revision']}", f" PAGES {len(data.get('pages', []))}", f" TABLES {len(data.get('tables', {}))}", " MANIFEST " + json.dumps(manifest, ensure_ascii=True, indent=2), ] ) return json.dumps(data, indent=2, ensure_ascii=True)
def main(argv=None): parser = argparse.ArgumentParser( description="Chameleon: bounded working counterparts, from your terminal." ) parser.add_argument("--server", default=os.environ.get("CHAMELEON_SERVER", "http://127.0.0.1:8120")) parser.add_argument( "--home", type=Path, default=Path(os.environ.get("CHAMELEON_HOME", str(Path.home() / ".chameleon"))) ) parser.add_argument("--json", action="store_true", help="Machine-readable output, no banner") sub = parser.add_subparsers(dest="command", required=True) for name in ("examples", "providers", "schema", "banner"): sub.add_parser(name) point = sub.add_parser("point") point.add_argument("source") point.add_argument("--objective", default="Discover what is possible") point.add_argument( "--provider", choices=["chameleon-local-v1", "structural-v1"], default="chameleon-local-v1" ) point.add_argument("--wait", type=int, default=30) point.add_argument("--presentation", choices=["reader", "preserve"], default="reader") point.add_argument("--source-type", choices=["web", "repository"], default="web") point.add_argument("--entry") point.add_argument("--table-pointer", help="Select a nested JSON row array, e.g. /results") resume = sub.add_parser("resume") resume.add_argument("--wait", type=int, default=30) status = sub.add_parser("status") status.add_argument("job") status.add_argument("--wait", type=int, default=0) for name in ("show", "query", "export"): command = sub.add_parser(name) command.add_argument("twin") if name == "query": command.add_argument("objective") download = sub.add_parser("download") download.add_argument("twin") download.add_argument("--out", type=Path, required=True) args = parser.parse_args(argv) if not 0 <= getattr(args, "wait", 0) <= 120: parser.error("--wait must be between 0 and 120 seconds") if hasattr(sys.stdout, "reconfigure"): sys.stdout.reconfigure(encoding="utf-8") if not args.json: print(BANNER) print() if args.command in {"schema", "banner"}: if args.command == "schema": print(json.dumps(schema(), indent=2)) elif args.json: print(json.dumps({"banner": BANNER})) return 0 client = None try: client = Harness(args.server, args.home) client.connect() if args.command in {"examples", "providers"}: result = client.request(args.command) elif args.command == "point": result = client.point( args.source, args.objective, args.provider, args.wait, args.presentation, args.source_type, args.entry, args.table_pointer, ) elif args.command == "resume": result = client.resume(args.wait) elif args.command == "status": result = client.status(args.job, args.wait) elif args.command == "download": result = client.download(args.twin, args.out) else: path = "twins/" + args.twin result = ( client.request(path + "/query", "POST", {"objective": args.objective}) if args.command == "query" else client.request(path + ("/export" if args.command == "export" else "")) ) print(json.dumps(result, ensure_ascii=True) if args.json else render(result)) return 0 except (HarnessError, ValueError, OSError) as exc: code = str(exc) if isinstance(exc, HarnessError) else type(exc).__name__ print(json.dumps({"error": code}) if args.json else " STOP " + code) return 1 finally: if client: client.close()1"""Project-owned runtime contracts and services."""123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140"""Provider-neutral proposals are data; the harness owns execution and verification."""
from typing import Any, Literal, Protocol
from pydantic import Field, model_validator
from .contracts import StrictRecord
Kind = Literal[ "dataset", "website", "api_spec", "database_snapshot", "server_snapshot", "spatial", "document", "repository",]Operation = Literal["profile", "count", "sum", "mean", "group_count", "spatial_reason"]
class Intake(StrictRecord): source: str = Field(min_length=1, max_length=2048) objective: str = Field(default="Discover what is possible", max_length=500) provider: Literal["chameleon-local-v1", "oracle7-adapted-v1", "structural-v1"] = "chameleon-local-v1" text: str | None = Field(default=None, max_length=20000) build_counterpart: bool = False presentation: Literal["reader", "preserve"] = "reader" source_type: Literal["web", "repository"] = "web" repository_entry: str | None = Field(default=None, min_length=1, max_length=240) repository_scope: Literal["full", "entry"] = "full" repository_assets: list[str] = Field(default_factory=list, max_length=16) module_policy: Literal['relative-js-unique-v1'] | None = None build_importer: str | None = Field(default=None, max_length=240) table_pointer: str | None = Field(default=None, max_length=500)
@model_validator(mode="after") def source_contract(self): if self.build_importer is not None: from .repository_capture import safe_path, target safe_path(self.build_importer) if (self.source_type != 'repository' or self.repository_scope != 'entry' or target(self.source)[2] == 'HEAD' or self.module_policy or not self.build_importer.endswith(('.js', '.mjs'))): raise ValueError('Build discovery requires pinned entry and a JS importer') if self.module_policy is not None and not self.repository_assets: raise ValueError('Module policy requires explicit pinned asset requests') if self.repository_assets: from .repository_capture import safe_path, target
if ( self.source_type != "repository" or self.repository_scope != "entry" or target(self.source)[2] == "HEAD" ): raise ValueError("Additional assets require pinned entry capture") for path in self.repository_assets: safe_path(path) if len(set(self.repository_assets)) != len(self.repository_assets): raise ValueError("Duplicate asset paths") if self.table_pointer is not None and (self.source_type != "web" or self.presentation != "reader"): raise ValueError("JSON table selection requires reader/data mode") if self.source_type == "repository": if self.text is not None or self.presentation != "reader": raise ValueError( "repository acquisition takes a URL and entry, not inline data or webpage mode" ) elif self.repository_entry is not None or self.repository_scope != "full": raise ValueError("repository entry requires repository source type") return self
class Evidence(StrictRecord): source: str kind: Kind content_digest: str = Field(pattern=r"^[0-9a-f]{64}$") captured_at: str payload: Any bytes_received: int = Field(ge=0, le=6291456) external_reads: int = Field(ge=0, le=64) authority: Literal["synthetic_fixture", "user_supplied", "public_snapshot"]
@model_validator(mode="after") def acquisition_budget(self): if self.kind == "repository": subset = ( isinstance(self.payload, dict) and isinstance(self.payload.get("projection"), dict) and self.payload["projection"].get("kind") == "static-entry-subset-v1" ) if ( self.external_reads > (64 if subset else 3) or self.authority != "public_snapshot" or (not subset and self.bytes_received > 3145728) ): raise ValueError("repository evidence requires bounded public acquisition") elif self.bytes_received > (4718592 if self.kind == 'website' and isinstance(self.payload, dict) and isinstance(self.payload.get('visual'), dict) else 1572864) or self.external_reads > 36: raise ValueError("existing non-repository acquisition budget exceeded") return self
class FormStep(StrictRecord): id: str = Field(pattern=r"^[a-z_]{1,40}$") operation: Operation field: str | None = Field(default=None, max_length=120) table: str | None = Field(default=None, max_length=120) effect: Literal["pure"] = "pure"
class WorkingForm(StrictRecord): version: Literal["read-form-v1"] = "read-form-v1" source_kind: Kind evidence_digest: str objective: str provider: str steps: list[FormStep] = Field(min_length=1, max_length=4) requested_permissions: list[str] = Field(default_factory=lambda: ["snapshot.read"]) compiler: Literal["structural-compiler-v1"] = "structural-compiler-v1"
@model_validator(mode="after") def graph(self): if len({x.id for x in self.steps}) != len(self.steps): raise ValueError("duplicate step ID") if self.steps[0].operation != "profile" or len(self.steps) > 2: raise ValueError("read-form-v1 supports profile followed by one bounded transformation") if self.requested_permissions != ["snapshot.read"]: raise ValueError("only snapshot.read may be requested") return self
class ProposalProvider(Protocol): version: str
def propose(self, evidence: Evidence, objective: str) -> dict: ...
class Residual(ValueError): def __init__(self, code: str): self.code = code super().__init__(code)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406"""Leased read-only jobs. A stale worker cannot commit a result or scoped memory."""
import timefrom datetime import timedeltafrom typing import TypedDict
from sqlalchemy import and_, exists, func, or_, select, textfrom sqlalchemy.exc import SQLAlchemyError
from .adaptation_contracts import Evidence, Intake, Residualfrom .config import ResourceLimitsfrom .contracts import AgentIdentity, digestfrom .db import AdaptationJob, Agent, ScopedMemory, WebsiteCapture, now, uidfrom .form_engine import ProviderRegistry, execute, verifyfrom .intake import acquirefrom .service import Failure, owned
class RepositoryAcquireOptions(TypedDict, total=False): repository_scope: str repository_assets: list[str] module_policy: str build_importer: str
def append(job, event, data=None): job.events = [ *job.events, {"sequence": len(job.events) + 1, "type": event, "at": now().isoformat(), "data": data or {}}, ]
class Adaptations: def __init__(self, sessions, providers=None, intake=None, limits=None): self.sessions = sessions self.providers = providers or ProviderRegistry() self.acquire = intake or acquire self.limits = limits or ResourceLimits()
def create(self, owner: str, request: Intake, key: str | None = None): with self.sessions.begin() as s: return self.create_in(s, owner, request, key)
def create_in(self, s, owner: str, request: Intake, key: str | None = None): """Same transaction can record a durable consumer alongside its queued job.""" if request.build_counterpart and not key: raise Failure("COUNTERPART_REQUEST_KEY_REQUIRED", 400) if key is not None and ( not 1 <= len(key) <= 100 or not key.isascii() or not all(c.isalnum() or c in "-_" for c in key) ): raise Failure("INVALID_IDEMPOTENCY_KEY", 400) # Global admission before owner/twin locks; shared across API processes. s.execute(text("SELECT pg_advisory_xact_lock(7162101)")) s.execute(text("SELECT pg_advisory_xact_lock(hashtext(:owner))"), {"owner": owner}) # Reader is the pre-existing default; preserve old accepted retry hashes. request_identity = request.model_dump() if request.module_policy is None: request_identity.pop('module_policy') if request.build_importer is None: request_identity.pop('build_importer') if not request.repository_assets: request_identity.pop("repository_assets") if request.repository_scope == "full": request_identity.pop("repository_scope") if request.table_pointer is None: request_identity.pop("table_pointer") if request.presentation == "reader": request_identity.pop("presentation") if request.source_type == "web": request_identity.pop("source_type") request_identity.pop("repository_entry") request_hash = digest(request_identity) if key: prior = s.scalar( select(AdaptationJob).where(AdaptationJob.owner == owner, AdaptationJob.creation_key == key) ) if prior: if prior.request_digest != request_hash: raise Failure("IDEMPOTENCY_CONFLICT") return prior.id if request.source_type == "repository": from .repository_capture import safe_path, target
target(request.source) safe_path(request.repository_entry or "index.html") count = s.scalar( select(func.count()) .select_from(AdaptationJob) .where(AdaptationJob.intake["source_type"].as_string() == "repository") ) if count >= self.limits.max_stored_repository_jobs: raise Failure("GLOBAL_REPOSITORY_STORAGE_LIMIT", 429) if s.scalar(select(func.count()).select_from(AdaptationJob)) >= self.limits.max_stored_jobs: raise Failure("GLOBAL_STORAGE_JOB_LIMIT", 429) pending = s.scalar( select(func.count()) .select_from(AdaptationJob) .where( or_( AdaptationJob.status.in_(["QUEUED", "RUNNING"]), AdaptationJob.counterpart["status"].as_string() == "PENDING", exists().where( WebsiteCapture.job == AdaptationJob.id, WebsiteCapture.status == "PENDING" ), ) ) ) if pending >= self.limits.max_pending_jobs: raise Failure("GLOBAL_PENDING_JOB_LIMIT", 429) if ( s.scalar(select(func.count()).select_from(AdaptationJob).where(AdaptationJob.owner == owner)) >= 50 ): raise Failure("SESSION_JOB_LIMIT", 429) active = s.scalar( select(func.count()) .select_from(AdaptationJob) .where(AdaptationJob.owner == owner, AdaptationJob.status.in_(["QUEUED", "RUNNING"])) ) if active >= 2: raise Failure("SESSION_CONCURRENCY_LIMIT", 429) agent = s.scalar(select(Agent).where(Agent.owner == owner).order_by(Agent.id)) if not agent: ident = uid() identity = AgentIdentity(agent_id=ident, owner_id=owner, display_name="Iris", identity_version=1) agent = Agent(id=ident, owner=owner, name="Iris", identity=identity.model_dump()) s.add(agent) s.flush() job = AdaptationJob( owner=owner, agent=agent.id, source=request.source, objective=request.objective, provider=request.provider, intake=request.model_dump(), expires=now() + timedelta(minutes=3), events=[], creation_key=key, request_digest=request_hash if key else None, counterpart={"status": "PENDING", "twin_id": None, "residual": None} if request.build_counterpart else None, ) s.add(job) s.flush() append(job, "job.queued", {"mode": "read_only", "provider": request.provider}) return job.id
def list(self, owner): with self.sessions() as s: return [ {"id": j.id, "source": j.source, "status": j.status, "agent_id": j.agent} for j in s.scalars( select(AdaptationJob) .where(AdaptationJob.owner == owner) .order_by(AdaptationJob.created.desc()) .limit(50) ) ]
def report(self, owner, ident): with self.sessions() as s: j = owned(s, AdaptationJob, ident, owner) return { "id": j.id, "agent_id": j.agent, "source": j.source, "objective": j.objective, "provider": j.provider, "presentation": j.intake.get("presentation", "reader"), "source_type": j.intake.get("source_type", "web"), "repository_entry": j.intake.get("repository_entry"), "repository_scope": j.intake.get("repository_scope", "full"), "repository_assets": j.intake.get("repository_assets", []), "table_pointer": j.intake.get("table_pointer"), "status": j.status, "events": j.events, "form": j.form, "result": j.result, "metrics": j.metrics, "residual": j.residual, "evidence": {k: v for k, v in (j.evidence or {}).items() if k != "payload"}, "attempts": j.attempts, "counterpart": j.counterpart, "scope": "read_only_snapshot", "paid_model_calls": 0, }
def cancel(self, owner, ident): with self.sessions.begin() as s: j = owned(s, AdaptationJob, ident, owner, lock=True) if j.counterpart and j.counterpart["status"] == "PENDING": j.counterpart = {"status": "CANCELLED", "twin_id": None, "residual": "CONSTRUCTION_CANCELLED"} append(j, "counterpart.cancelled") if j.status in {"VERIFIED", "NEEDS_EVIDENCE", "FAILED", "CANCELLED"}: return j.status, j.lease_token = "CANCELLED", uid() append( j, "job.cancelled", {"inflight_read_may_finish": True, "future_result_commit_blocked": True} )
def claim(self): with self.sessions.begin() as s: s.execute(text("SELECT pg_advisory_xact_lock(7162102)")) for j in s.scalars( select(AdaptationJob) .where( AdaptationJob.status.in_(["QUEUED", "RUNNING"]), or_( AdaptationJob.expires <= now(), and_(AdaptationJob.attempts >= 3, AdaptationJob.lease_until < now()), ), ) .with_for_update(skip_locked=True) .limit(10) ): j.status, j.residual = "FAILED", "JOB_DEADLINE_OR_RECOVERY_LIMIT" append(j, "job.failed", {"code": j.residual}) running = s.scalar( select(func.count()) .select_from(AdaptationJob) .where( AdaptationJob.status == "RUNNING", AdaptationJob.lease_until > now(), AdaptationJob.expires > now(), ) ) if running >= self.limits.max_running_jobs: return None j = s.scalar( select(AdaptationJob) .where( AdaptationJob.expires > now(), AdaptationJob.attempts < 3, or_( AdaptationJob.status == "QUEUED", and_(AdaptationJob.status == "RUNNING", AdaptationJob.lease_until < now()), ), ) .order_by(AdaptationJob.created) .with_for_update(skip_locked=True) .limit(1) ) if not j: return None recovered = j.status == "RUNNING" lease = 60 if j.intake.get("source_type") == "repository" else 30 j.status, j.lease_token, j.lease_until = "RUNNING", uid(), now() + timedelta(seconds=lease) j.attempts += 1 append(j, "worker.recovered" if recovered else "worker.claimed", {"attempt": j.attempts}) return j.id, j.owner, j.lease_token, j.intake
@staticmethod def guard(s, ident, owner, token): j = owned(s, AdaptationJob, ident, owner, lock=True) if j.status != "RUNNING" or j.lease_token != token or j.lease_until <= now() or j.expires <= now(): raise Failure("STALE_ADAPTATION_WORKER") j.lease_until = now() + timedelta(seconds=60 if j.intake.get("source_type") == "repository" else 30) return j
def process(self, claim): ident, owner, token, raw = claim start, cpu = time.monotonic(), time.process_time() try: request = Intake.model_validate(raw) with self.sessions.begin() as s: held = self.guard(s, ident, owner, token) frozen = held.evidence if request.source_type == "repository" else None append( held, "evidence.reused" if frozen else "evidence.read_dispatched", {"mode": "GET_or_supplied_snapshot"}, ) repository_options: RepositoryAcquireOptions = {} if request.repository_scope == "entry": repository_options["repository_scope"] = "entry" if request.repository_assets: repository_options["repository_assets"] = request.repository_assets if request.module_policy: repository_options['module_policy'] = request.module_policy if request.build_importer: repository_options['build_importer'] = request.build_importer evidence = ( Evidence.model_validate(frozen) if frozen else self.acquire(request.source, request.text, table_pointer=request.table_pointer) if request.table_pointer is not None else self.acquire( request.source, source_type="repository", repository_entry=request.repository_entry, **repository_options, ) if request.source_type == "repository" else self.acquire(request.source, request.text, presentation="preserve") if request.presentation == "preserve" else self.acquire(request.source, request.text) ) if request.source_type == "repository": from .repository_artifact import checked_files
checked_files(evidence) if evidence.payload.get('projection', {}).get('build_importer') != request.build_importer: raise Residual('REPOSITORY_BUILD_IMPORTER_BINDING_MISMATCH') if evidence.payload.get('projection', {}).get('module_policy') != request.module_policy: raise Residual('REPOSITORY_MODULE_POLICY_BINDING_MISMATCH') if ( evidence.payload.get("projection", {}).get("additional_local_paths", []) != request.repository_assets ): raise Residual("REPOSITORY_ASSET_BINDING_MISMATCH") if ("entry" if evidence.payload.get("projection") else "full") != request.repository_scope: raise Residual("REPOSITORY_SCOPE_BINDING_MISMATCH") if evidence.source != request.source or evidence.payload["entry"] != ( request.repository_entry or "index.html" ): raise Residual("REPOSITORY_REQUEST_BINDING_MISMATCH") with self.sessions.begin() as s: j = self.guard(s, ident, owner, token) j.evidence = evidence.model_dump() append( j, "evidence.captured", { "kind": evidence.kind, "digest": evidence.content_digest, "authority": evidence.authority, }, ) form = self.providers.compile(evidence, request.objective, request.provider) with self.sessions.begin() as s: j = self.guard(s, ident, owner, token) j.form = form.model_dump() append( j, "form.compiled", { "digest": digest(j.form), "compiler": form.compiler, "operations": [x.operation for x in form.steps], }, ) result = execute(form, evidence) if not verify(form, evidence, result): raise Residual("INDEPENDENT_RESULT_CHECK_FAILED") metrics = { "wall_seconds": round(time.monotonic() - start, 6), "worker_process_cpu_seconds": round(time.process_time() - cpu, 6), "bytes_received": evidence.bytes_received, "external_reads": evidence.external_reads, "steps": len(form.steps), "spatial_kernel_invocations": sum(x.operation == "spatial_reason" for x in form.steps), "paid_model_calls": 0, } with self.sessions.begin() as s: j = self.guard(s, ident, owner, token) j.result, j.metrics, j.status = result, metrics, "VERIFIED" scope = digest( { "owner": owner, "source": j.source, "inline_content": evidence.content_digest if j.source.startswith("inline://") else None, } ) s.add( ScopedMemory( owner=owner, agent=j.agent, job=j.id, target_scope=scope, evidence_digest=evidence.content_digest, form_digest=digest(j.form), data={"result": result, "authority": evidence.authority, "scope": "snapshot_only"}, ) ) append( j, "result.verified", {"scope": "consistency_with_captured_evidence_not_external_truth", "memory_scope": scope}, ) except Failure: # Cancellation, expiry or a newer lease owns the state. Never overwrite it. return except SQLAlchemyError: # Infrastructure failures are not evidence failures. Leave the lease # recoverable; an uncertain successful commit is observed on retry. raise except Exception as exc: # noqa: BLE001 -- worker boundary records bounded residuals, never raw exception text try: with self.sessions.begin() as s: j = self.guard(s, ident, owner, token) j.status = "NEEDS_EVIDENCE" if isinstance(exc, Residual) else "FAILED" j.residual = exc.code if isinstance(exc, Residual) else "INTERNAL_ADAPTATION_ERROR" j.metrics = {"wall_seconds": round(time.monotonic() - start, 6), "paid_model_calls": 0} append(j, "job.residual", {"code": j.residual}) except Failure: return
def tick(self): claim = self.claim() if claim: self.process(claim) return True return False12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879"""Private copied-game state, never a verified score or source-system write."""
import json
from pydantic import Field, model_validator
from .contracts import StrictRecord, canonicalfrom .curated_app import approved_2048from .db import ApplicationSave, LocalTwin, nowfrom .service import Failure, ownedfrom .twins import Twins
class SaveRequest(StrictRecord): expected_revision: int = Field(ge=0, le=2147483646) data: dict[str, str]
@model_validator(mode="after") def bounded(self): if set(self.data) - {"gameState", "bestScore"} or len(canonical(self.data).encode()) > 16384: raise ValueError("Unsupported or oversized application save") for key, value in self.data.items(): if len(value) > 8192: raise ValueError("Application save value too large") if key == "bestScore" and (not value.isascii() or not value.isdecimal() or len(value) > 16): raise ValueError("Invalid best score") if key == "gameState": try: decoded = json.loads(value) except (ValueError, RecursionError) as exc: raise ValueError("Invalid game state JSON") from exc if not isinstance(decoded, dict): raise ValueError("Game state must be an object") return self
class ApplicationSaves: def __init__(self, sessions): self.sessions = sessions
def access(self, owner, ident): evidence = Twins(self.sessions).repository_evidence(owner, ident) if not approved_2048({"digest": evidence.content_digest, "repository": evidence.payload}): raise Failure("APPLICATION_SAVE_NOT_SUPPORTED") return evidence.content_digest
@staticmethod def report(row): return {"revision": row.revision if row else 0, "data": row.data if row else {}, "storage": "private server save", "verified_score": False, "source_writes": False}
def read(self, owner, ident): source = self.access(owner, ident) with self.sessions() as s: row = s.get(ApplicationSave, ident) if row and (row.owner != owner or row.source_digest != source): raise Failure("APPLICATION_SAVE_BINDING_MISMATCH") return self.report(row)
def write(self, owner, ident, request): source = self.access(owner, ident) with self.sessions.begin() as s: twin = owned(s, LocalTwin, ident, owner, lock=True) if twin.source_digest != source: raise Failure("APPLICATION_SAVE_BINDING_MISMATCH") row = s.get(ApplicationSave, ident) if row and (row.owner != owner or row.source_digest != source): raise Failure("APPLICATION_SAVE_BINDING_MISMATCH") revision = row.revision if row else 0 if revision != request.expected_revision: raise Failure("APPLICATION_SAVE_REVISION_CONFLICT") if row is None: row = ApplicationSave(twin=ident, owner=owner, source_digest=source, data={}) s.add(row) row.data = dict(request.data) row.revision = revision + 1 row.updated = now() s.flush() return self.report(row)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153"""Durable internal verifier receipts. Call record only from a trusted supervisor.
There is intentionally no public upload endpoint: hashes bind evidence, not authorship.Records do not promote a repository to an executable application or a complete clone."""
import copyimport re
from sqlalchemy import select
from .bundle_preview import reviewed_filesfrom .contracts import canonical, digestfrom .db import BehaviorRecord, CounterpartBundle, LocalTwinfrom .repository_artifact import REPOSITORY_KINDfrom .service import Failure, owned
def completion_receipt_allowed(receipt, receipt_digest, discard_dependencies=False): return (receipt_digest == digest(receipt) and not receipt.get('overlay_digest') and (not receipt.get('dependency_digest') or ( discard_dependencies is True and receipt['behavior'].get('status') == 'FAIL')))
class BehaviorRecords: def __init__(self, sessions): self.sessions = sessions
def asset_completion(self, owner, twin_id, record_id, *, discard_dependencies=False): """Only trusted persisted original-source observations may propose capture.""" from .entry_capture import asset_completion_intake from .twins import Twins
with self.sessions() as session: twin = owned(session, LocalTwin, twin_id, owner) record = owned(session, BehaviorRecord, record_id, owner) if record.twin != twin.id: raise Failure("NOT_FOUND") if record.source_digest != twin.source_digest: raise Failure("BEHAVIOR_SOURCE_MISMATCH") if not completion_receipt_allowed(record.receipt, record.receipt_digest, discard_dependencies): raise Failure("ASSET_COMPLETION_REQUIRES_ORIGINAL_RECEIPT") report = copy.deepcopy(record.receipt["behavior"]) evidence = Twins(self.sessions).repository_evidence(owner, twin_id) return asset_completion_intake(evidence, report)
def record(self, owner, twin_id, receipt): receipt = copy.deepcopy(receipt) if len(canonical(receipt).encode()) > 65536 or set(receipt) - {"dependency_digest"} != { "source_digest", "contract_digest", "overlay_digest", "runtime", "behavior", }: raise Failure("BEHAVIOR_RECEIPT_SCHEMA") dependency_digest = receipt.get("dependency_digest") if dependency_digest is not None and ( not isinstance(dependency_digest, str) or not re.fullmatch(r"[a-f0-9]{64}", dependency_digest) ): raise Failure("BEHAVIOR_RECEIPT_DIGEST") for key in ("source_digest", "contract_digest", "overlay_digest"): value = receipt[key] if key == "overlay_digest" and value is None: continue if not isinstance(value, str) or not re.fullmatch(r"[a-f0-9]{64}", value): raise Failure("BEHAVIOR_RECEIPT_DIGEST") runtime, behavior = receipt["runtime"], receipt["behavior"] if ( not isinstance(runtime, dict) or not isinstance(behavior, dict) or behavior.get("status") not in {"PASS", "FAIL"} ): raise Failure("BEHAVIOR_RECEIPT_SCHEMA") for key, expected in ( ("package_digest", receipt["source_digest"]), ("contract_digest", receipt["contract_digest"]), ("overlay_digest", receipt["overlay_digest"]), ("dependency_digest", dependency_digest), ): if runtime.get(key) != expected or behavior.get(key) != expected: raise Failure("BEHAVIOR_RECEIPT_BINDING") if behavior["status"] == "PASS" and not ( runtime.get("returncode") == 0 and runtime.get("remaining_job_processes") == 0 and all( runtime.get(key) is False for key in ("timed_out", "cpu_budget_exhausted", "output_budget_exhausted") ) ): raise Failure("BEHAVIOR_RUNTIME_NOT_PASSED") fingerprint = digest(receipt) with self.sessions.begin() as session: twin = owned(session, LocalTwin, twin_id, owner, lock=True) if twin.manifest.get("kind") != REPOSITORY_KIND or twin.source_digest != receipt["source_digest"]: raise Failure("BEHAVIOR_SOURCE_MISMATCH") previous = session.scalar( select(BehaviorRecord).where( BehaviorRecord.twin == twin_id, BehaviorRecord.receipt_digest == fingerprint ) ) if previous: return previous.id row = BehaviorRecord( twin=twin_id, owner=owner, source_digest=twin.source_digest, receipt_digest=fingerprint, receipt=receipt, ) session.add(row) session.flush() return row.id
def read(self, owner, twin_id): with self.sessions() as session: twin = owned(session, LocalTwin, twin_id, owner) rows = session.scalars( select(BehaviorRecord) .where(BehaviorRecord.twin == twin_id, BehaviorRecord.owner == owner) .order_by(BehaviorRecord.created.desc(), BehaviorRecord.id.desc()) .limit(20) ).all() bundles = { item.record: item for item in session.scalars( select(CounterpartBundle).where( CounterpartBundle.twin == twin_id, CounterpartBundle.owner == owner ) ) } return { "scope": "Recorded supplied contracts only; not complete-clone certification", "source_digest": twin.source_digest, "records": [ { "id": row.id, "created": row.created.isoformat(), "receipt_digest": row.receipt_digest, "current_source": row.source_digest == twin.source_digest, "receipt": row.receipt, "bundle": { "id": bundles[row.id].id, "sha256": bundles[row.id].sha256, "interactive": reviewed_files(bundles[row.id].body) is not None, "replay_supported": True, } if row.id in bundles and row.source_digest == twin.source_digest else None, } for row in rows ], }1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465"""Bounded declarative browser checks; no executable expressions or host actions."""
import hashlibimport jsonimport re
SHAPES = { "click": {"op", "selector"}, "dblclick": {"op", "selector"}, "fill": {"op", "selector", "value"}, "type": {"op", "selector", "value"}, "press": {"op", "selector", "key"}, "reload": {"op"}, "visible": {"op", "selector"}, "text": {"op", "selector", "equals"}, "value": {"op", "selector", "equals"}, "count": {"op", "selector", "equals"}, "wait_count": {"op", "selector", "equals"}, "location": {"op", "equals"},}KEYS = {"Enter", "Tab", "Space", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Escape", "Backspace"}
def validate_contract(value): def require(condition): if not condition: raise ValueError("INVALID_BROWSER_CONTRACT")
require(isinstance(value, dict) and set(value) == {"version", "name", "steps"}) require(value["version"] in {"browser-contract-v1", "browser-contract-v2"}) require(isinstance(value["name"], str) and 1 <= len(value["name"]) <= 120) steps = value["steps"] require(isinstance(steps, list) and 1 <= len(steps) <= 12) assertions = 0 for step in steps: require(isinstance(step, dict) and isinstance(step.get("op"), str)) op = step["op"] require(op in SHAPES and set(step) == SHAPES[op]) if "selector" in step: selector = step["selector"] require(isinstance(selector, str) and 1 <= len(selector) <= 200) require(">>" not in selector and not re.match(r"^(xpath|text|internal|role)=", selector)) if op == "press": require(isinstance(step["key"], str) and step["key"] in KEYS) if op == 'type': require(value['version'] == 'browser-contract-v2') require(isinstance(step['value'], str) and bool(re.fullmatch(r'[\x20-\x7e]{1,256}', step['value']))) if op in {"fill", "text", "value"}: text = step["value" if op == "fill" else "equals"] require(isinstance(text, str) and len(text) <= 1000) if op in {"wait_count", "location", "dblclick"}: require(value["version"] == "browser-contract-v2") if op in {"count", "wait_count"}: require(type(step["equals"]) is int and 0 <= step["equals"] <= 1000) if op == "location": target = step["equals"] require(isinstance(target, str) and 1 <= len(target) <= 500) require( target.startswith("/") and not target.startswith("//") and not re.search(r"[\\\s]", target) ) assertions += op in {"visible", "text", "value", "count", "wait_count", "location"} require(assertions > 0) encoded = json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True).encode() require(len(encoded) <= 6000) return json.loads(encoded), hashlib.sha256(encoded).hexdigest()123456789101112131415161718192021222324252627282930313233343536373839404142434445"""Bounded inert declaration inspection shared by capture and orchestration."""import hashlibimport jsonimport shutilfrom pathlib import Path
from .repository_capture import verify_packagefrom .windows_job import run_bounded
ROOT = Path(__file__).resolve().parents[3]
def plan_saved_build(package, importer=None): files = verify_package(package) required = ('rollup.config.js', 'package.json') if any(p not in files for p in required): raise ValueError('BUILD_METADATA_NOT_CAPTURED') request = {'config': files[required[0]].decode('utf-8'), 'package': files[required[1]].decode('utf-8')} node = shutil.which('node') if not node: raise ValueError('NODE_UNAVAILABLE') script = 'build_artifact_plan.mjs' if importer is not None: script = 'build_graph_plan.mjs' request = {'package': package, 'importer': importer} runtime = run_bounded([node, str(ROOT / 'scripts' / script)], json.dumps(request), ROOT) stdout = runtime.pop('stdout') if (runtime.get('returncode') != 0 or runtime.get('remaining_job_processes') != 0 or any(runtime.get(k) is not False for k in ('timed_out', 'cpu_budget_exhausted', 'output_budget_exhausted'))): raise ValueError('BUILD_PARSER_EXECUTION_FAILED') plan = json.loads(stdout) for field, name in zip(('config_sha256', 'package_sha256'), required, strict=True): if plan[field] != hashlib.sha256(files[name]).hexdigest(): raise ValueError('BUILD_PLAN_SOURCE_MISMATCH') plan['source_digest'] = package['digest'] plan['captured_inputs'] = {m['input']: hashlib.sha256(files[m['input']]).hexdigest() for m in plan['mappings'] if m['input'] in files} plan['missing_inputs'] = sorted({m['input'] for m in plan['mappings'] if m['input'] not in files}) if importer is not None: graph = plan['graph'] if (graph['source_digest'] != package['digest'] or graph['importer'] != importer or any(p not in files or hashlib.sha256(files[p]).hexdigest() != h for p, h in graph['used'].items())): raise ValueError('BUILD_GRAPH_SOURCE_MISMATCH') plan['missing_inputs'] = graph['missing_paths'] return {'plan': plan, 'runtime': runtime}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455"""Explicitly reviewed executable bundle family, not arbitrary ZIP execution."""
import hashlibimport htmlimport ioimport reimport zipfile
from .service import Failure
REVIEWED = { "index.html": "ad2157d4649975da0b8817ca08d834e267f808e1d479f0a6f5c06511d62bcf50", "css/style.css": "61f3122b1664cab2b1607e0349935b02cc196356d3c11bc524cefb01bda02177", "js/calculate.js": "f97785e4c230ac7e403feca805866b57103240b8a3447fcab983f5ca81ccbd8a",}
def reviewed_files(body): try: with zipfile.ZipFile(io.BytesIO(body)) as archive: names = archive.namelist() if len(names) != len(set(names)): return None files = {} for name, expected in REVIEWED.items(): info = archive.getinfo("application/" + name) if info.file_size > 12000: return None content = archive.read(info) if hashlib.sha256(content).hexdigest() != expected: return None files[name] = content.decode("utf-8") return files except (ValueError, KeyError, UnicodeError, zipfile.BadZipFile): return None
def render(body, nonce): files = reviewed_files(body) if files is None: raise Failure("BUNDLE_INTERACTIVE_FAMILY_UNSUPPORTED") document = files["index.html"] # Exact reviewed entry contains these stylesheet and classic script references. # External font dependencies are intentionally omitted, as in offline verification. document = re.sub(r"<link\b[^>]*>", "", document, flags=re.DOTALL) document = re.sub(r"<script\b[^>]*>.*?</script>", "", document, flags=re.DOTALL) document = document.replace("</head>", "<style>" + files["css/style.css"] + "</style></head>") return document.replace( "</body>", '<script nonce="' + html.escape(nonce, quote=True) + '">' + files["js/calculate.js"] + "</script></body>", )123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123import jsonimport osimport refrom dataclasses import dataclassfrom pathlib import Pathfrom urllib.parse import urlsplit
ROOT = Path(__file__).resolve().parents[3]
@dataclass(frozen=True)class ResourceLimits: max_users: int = 1000 new_sessions_per_minute: int = 20 max_pending_jobs: int = 64 max_running_jobs: int = 4 max_stored_jobs: int = 10000 # Each repository payload is separately bounded to 6 MiB before persistence. max_stored_repository_jobs: int = 12 max_verification_jobs_per_owner: int = 20 max_metafold_runs_per_owner: int = 10
def __post_init__(self): for name, value in vars(self).items(): if type(value) is not int or not 1 <= value <= 100000: raise ValueError(f"{name} must be a positive bounded integer") if self.max_running_jobs > self.max_pending_jobs: raise ValueError("Running budget cannot exceed pending budget")
@dataclass(frozen=True)class Settings: database_url: str fixture_key: str fixture_url: str = "http://127.0.0.1:8121" origin: str = "http://127.0.0.1:8120" profile: str = "synthetic" limits: ResourceLimits = ResourceLimits() worker_slot: str = "default" base_path: str = "" verification_enabled: bool = False
def __post_init__(self): if len(self.base_path) > 200 or not re.fullmatch(r"(?:/[a-zA-Z0-9_-]+)*", self.base_path): raise ValueError("Base path must contain only bounded clean path segments") if not re.fullmatch(r"[a-zA-Z0-9_-]{1,64}", self.worker_slot): raise ValueError("Worker slot must be a bounded name") if self.profile not in {"synthetic", "public-preview"}: raise ValueError("Unsupported runtime profile") if self.fixture_url != "http://127.0.0.1:8121": raise ValueError("Only the pinned loopback fixture address is supported") if self.profile == "synthetic": if self.origin not in {"http://127.0.0.1:8120", "http://localhost:8120"}: raise ValueError("Local profile requires a loopback origin") if len(self.fixture_key) < 32: raise ValueError("Fixture key must be locally provisioned") else: host = urlsplit(self.origin).hostname or "" labels = host.split(".") if ( self.origin != "https://" + host or len(labels) < 2 or len(host) > 253 or host.endswith((".localhost", ".local")) or not re.fullmatch(r"[a-z]{2,63}", labels[-1]) or any(not re.fullmatch(r"[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?", label) for label in labels) ): raise ValueError("Public preview requires an exact canonical HTTPS domain origin") if self.fixture_key: raise ValueError("Public preview must not receive synthetic fixture credentials")
@property def secure_cookies(self): return self.profile == "public-preview"
@property def allowed_hosts(self): if self.profile == "synthetic": return {"127.0.0.1:8120", "localhost:8120"} return {urlsplit(self.origin).netloc}
def load_settings() -> Settings: profile = os.environ.get("CHAMELEON_PROFILE", "synthetic") limits = ResourceLimits( **{ key: int(os.environ.get("CHAMELEON_" + key.upper(), str(default))) for key, default in vars(ResourceLimits()).items() } ) if profile == "public-preview": url = os.environ.get("CHAMELEON_DATABASE_URL", "") if not url.startswith("postgresql+psycopg://") or not os.environ.get("CHAMELEON_ORIGIN"): raise RuntimeError("Public preview requires an explicit database URL and HTTPS origin") if os.environ.get("CHAMELEON_TEST_DB") == "1": raise RuntimeError("Public preview cannot use the local test-database override") return Settings( database_url=url, fixture_key="", origin=os.environ["CHAMELEON_ORIGIN"], profile=profile, limits=limits, worker_slot=os.environ.get("CHAMELEON_WORKER_SLOT", "default"), base_path=os.environ.get("CHAMELEON_BASE_PATH", ""), verification_enabled=os.environ.get("CHAMELEON_VERIFICATION_ENABLED") == "1", ) path = ROOT / ".local/runtime.json" if not path.exists(): raise RuntimeError("Run scripts/local.py setup first; live credentials are not needed") value = json.loads(path.read_text()) url = os.environ.get("CHAMELEON_DATABASE_URL", value["database_url"]) if os.environ.get("CHAMELEON_TEST_DB") == "1": url = url.rsplit("/", 1)[0] + "/chameleon_test" return Settings( database_url=url, fixture_key=value["fixture_key"], profile=profile, origin=os.environ.get("CHAMELEON_ORIGIN", "http://127.0.0.1:8120"), limits=limits, worker_slot=os.environ.get("CHAMELEON_WORKER_SLOT", "default"), base_path=os.environ.get("CHAMELEON_BASE_PATH", ""), verification_enabled=os.environ.get("CHAMELEON_VERIFICATION_ENABLED") == "1", )CHANGELOG_11.mdAdded+74
RELEASE_HASHES.json+41-20
oracle7.py+1-1
orbiters/artist/LICENSEAdded+202
orbiters/artist/README.mdAdded+110
orbiters/artist/SHA256SUMSAdded+17
orbiters/artist/artist/__init__.pyAdded
orbiters/artist/artist/build_library.pyAdded+107
orbiters/artist/artist/build_library_v0.pyAdded+58
orbiters/artist/artist/core.pyAdded+250
orbiters/artist/artist/core_v0.pyAdded+236
orbiters/artist/eval/calibrate_judge.pyAdded+54
orbiters/artist/eval/eval_geneval.pyAdded+123
orbiters/artist/eval/eval_geneval.py.nextAdded+123
orbiters/artist/eval/judge.pyAdded+94
orbiters/artist/exam_pack.pyAdded+40
orbiters/artist/night.pyAdded+22
orbiters/artist/orbiter.jsonAdded+10
orbiters/artist/results/HELDOUT_FREEZE.txtAdded+3
orbiters/artist/results/geneval_dev_v0_40.jsonAdded+399
orbiters/artist/results/geneval_dev_v1a_120.jsonAdded+1119
orbiters/artist/results/geneval_dev_v1b_120.jsonAdded+1246
orbiters/artist/results/geneval_heldout.jsonAdded
orbiters/artist/results/judge_calibration.jsonAdded+42
orbiters/chameleon/LICENSEAdded+202
orbiters/chameleon/README.mdAdded+95
orbiters/chameleon/SHA256SUMSAdded+336
orbiters/chameleon/apps/api/chameleon_api/__init__.pyAdded+1
orbiters/chameleon/apps/api/chameleon_api/app.pyAdded+873
orbiters/chameleon/apps/api/chameleon_api/fixture.pyAdded+6
orbiters/chameleon/exam_pack.pyAdded+18
orbiters/chameleon/night.pyAdded+22
orbiters/chameleon/orbiter.jsonAdded+9
orbiters/chameleon/package.jsonAdded+7
orbiters/chameleon/packages/adapters/chameleon_adapters/__init__.pyAdded+1
orbiters/chameleon/packages/adapters/chameleon_adapters/hotel_fixture.pyAdded+214
orbiters/chameleon/packages/cli/ditto_reconstruction.pyAdded+35
orbiters/chameleon/packages/cli/src/chameleon_cli/__init__.pyAdded+1
orbiters/chameleon/packages/cli/src/chameleon_cli/__main__.pyAdded+3
orbiters/chameleon/packages/cli/src/chameleon_cli/client.pyAdded+183
orbiters/chameleon/packages/cli/src/chameleon_cli/main.pyAdded+186
orbiters/chameleon/packages/core/chameleon_core/__init__.pyAdded+1
orbiters/chameleon/packages/core/chameleon_core/adaptation_contracts.pyAdded+140
orbiters/chameleon/packages/core/chameleon_core/adaptation_service.pyAdded+406
orbiters/chameleon/packages/core/chameleon_core/application_saves.pyAdded+79
orbiters/chameleon/packages/core/chameleon_core/behavior_records.pyAdded+153
orbiters/chameleon/packages/core/chameleon_core/browser_contract.pyAdded+65
orbiters/chameleon/packages/core/chameleon_core/build_plan.pyAdded+45
orbiters/chameleon/packages/core/chameleon_core/bundle_preview.pyAdded+55
orbiters/chameleon/packages/core/chameleon_core/config.pyAdded+123