Update original Terminal Desk tasks
Browse files- LICENSES/README.txt +1 -1
- MANIFEST.json +14 -14
- README.md +3 -3
- SHA256SUMS +8 -8
- SOURCE_LOCK.json +1 -1
- components/dnakhla/NOTICE +1 -1
- components/dnakhla/README.md +2 -0
- components/dnakhla/SOURCE_MANIFEST.json +3 -5
- tasks.jsonl +4 -6
- validate_dataset.py +77 -30
LICENSES/README.txt
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Terminal Desk
|
|
|
|
| 1 |
+
Terminal Desk declares Apache-2.0. The standard license text was added by this distribution; see components/dnakhla/LICENSE and NOTICE for attribution.
|
MANIFEST.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
"LICENSES/README.txt": {
|
| 4 |
-
"bytes":
|
| 5 |
-
"sha256": "
|
| 6 |
},
|
| 7 |
"README.md": {
|
| 8 |
-
"bytes":
|
| 9 |
-
"sha256": "
|
| 10 |
},
|
| 11 |
"SOURCE_LOCK.json": {
|
| 12 |
"bytes": 322,
|
| 13 |
-
"sha256": "
|
| 14 |
},
|
| 15 |
"components/dnakhla/.dockerignore": {
|
| 16 |
"bytes": 49,
|
|
@@ -26,15 +26,15 @@
|
|
| 26 |
},
|
| 27 |
"components/dnakhla/NOTICE": {
|
| 28 |
"bytes": 351,
|
| 29 |
-
"sha256": "
|
| 30 |
},
|
| 31 |
"components/dnakhla/README.md": {
|
| 32 |
-
"bytes":
|
| 33 |
-
"sha256": "
|
| 34 |
},
|
| 35 |
"components/dnakhla/SOURCE_MANIFEST.json": {
|
| 36 |
-
"bytes":
|
| 37 |
-
"sha256": "
|
| 38 |
},
|
| 39 |
"components/dnakhla/runtime/common/__init__.py": {
|
| 40 |
"bytes": 1,
|
|
@@ -273,12 +273,12 @@
|
|
| 273 |
"sha256": "10993deaaa8553929fa0b3b6bf3c1ad100baaaf9ff10ae8ed139a8ec4279a3c4"
|
| 274 |
},
|
| 275 |
"tasks.jsonl": {
|
| 276 |
-
"bytes":
|
| 277 |
-
"sha256": "
|
| 278 |
},
|
| 279 |
"validate_dataset.py": {
|
| 280 |
-
"bytes":
|
| 281 |
-
"sha256": "
|
| 282 |
}
|
| 283 |
}
|
| 284 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"files": {
|
| 3 |
"LICENSES/README.txt": {
|
| 4 |
+
"bytes": 152,
|
| 5 |
+
"sha256": "73b6e48016e027d623e5b6e03c4a6eae26ea366447f10cc09d6a7f06bfef8913"
|
| 6 |
},
|
| 7 |
"README.md": {
|
| 8 |
+
"bytes": 791,
|
| 9 |
+
"sha256": "1e23d241e1da2922af95a043de8cea2d71fb5a67c95da8780c5e406223d22d13"
|
| 10 |
},
|
| 11 |
"SOURCE_LOCK.json": {
|
| 12 |
"bytes": 322,
|
| 13 |
+
"sha256": "77d0d1993cb7e5b2e68e90850e0a4e7ce89a9236e175204fb86b6c7df43f07a3"
|
| 14 |
},
|
| 15 |
"components/dnakhla/.dockerignore": {
|
| 16 |
"bytes": 49,
|
|
|
|
| 26 |
},
|
| 27 |
"components/dnakhla/NOTICE": {
|
| 28 |
"bytes": 351,
|
| 29 |
+
"sha256": "a3e807759b2b290d9c6af290af392f2ac87d7951a99b13fd62ee5cb431c86c68"
|
| 30 |
},
|
| 31 |
"components/dnakhla/README.md": {
|
| 32 |
+
"bytes": 268,
|
| 33 |
+
"sha256": "e868fbee82b3288b177de089ff6d0e4acab807772d422828c3e81d4580fa350e"
|
| 34 |
},
|
| 35 |
"components/dnakhla/SOURCE_MANIFEST.json": {
|
| 36 |
+
"bytes": 6263,
|
| 37 |
+
"sha256": "2fc003f012c04e9897d8a629e9b9d6b937154f0646f083ca1cc7493445892d74"
|
| 38 |
},
|
| 39 |
"components/dnakhla/runtime/common/__init__.py": {
|
| 40 |
"bytes": 1,
|
|
|
|
| 273 |
"sha256": "10993deaaa8553929fa0b3b6bf3c1ad100baaaf9ff10ae8ed139a8ec4279a3c4"
|
| 274 |
},
|
| 275 |
"tasks.jsonl": {
|
| 276 |
+
"bytes": 3402,
|
| 277 |
+
"sha256": "d86495b21e4322e5265bff6a2f920b7237278522f0a5c076bf279ba63d9d3d82"
|
| 278 |
},
|
| 279 |
"validate_dataset.py": {
|
| 280 |
+
"bytes": 4483,
|
| 281 |
+
"sha256": "e62ac01d70ca2c5682089a0713a127a8bcccb5fdf9c5ca53e81ddd8b6f94aaba"
|
| 282 |
}
|
| 283 |
}
|
| 284 |
}
|
README.md
CHANGED
|
@@ -11,10 +11,10 @@ configs:
|
|
| 11 |
path: tasks.jsonl
|
| 12 |
---
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
Original generators, tools and graders are retained. Reset generates a fresh instance. Reward is one when all required artifact checks pass, otherwise zero.
|
| 17 |
|
| 18 |
-
Use the tools shown at reset and `op=finish` to grade the output. Task IDs and pinned source references are in `tasks.jsonl`. Licenses and provenance are retained in the component directory.
|
| 19 |
|
| 20 |
Run `python3 -B validate_dataset.py` to verify the file inventory.
|
|
|
|
| 11 |
path: tasks.jsonl
|
| 12 |
---
|
| 13 |
|
| 14 |
+
Four original Terminal Desk tasks served by one OpenEnv image.
|
| 15 |
|
| 16 |
+
The tasks cover exam scheduling, meeting availability, subtitle retiming and audio silence reports. Original generators, tools and graders are retained. Reset generates a fresh instance. Reward is one when all required artifact checks pass, otherwise zero.
|
| 17 |
|
| 18 |
+
Use the tools shown at reset and `op=finish` to grade the output. Each episode requires a fresh sandbox. Task IDs and pinned source references are in `tasks.jsonl`. Licenses and provenance are retained in the component directory.
|
| 19 |
|
| 20 |
Run `python3 -B validate_dataset.py` to verify the file inventory.
|
SHA256SUMS
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
c04a2771c0665225047882b2da49d452e20d7cc9bc0ea024a48f1cd31411c504 components/dnakhla/.dockerignore
|
| 5 |
a2464ca6190e49c967ccb0b521c8190dba35d94b9b2208e31562161f20f535b8 components/dnakhla/Dockerfile
|
| 6 |
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 components/dnakhla/LICENSE
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b components/dnakhla/runtime/common/__init__.py
|
| 11 |
b1e1429208e84aefc2422ee1d2400ad793c43cd5c0e8db213a3b669fe0947ce1 components/dnakhla/runtime/common/contracts.py
|
| 12 |
6a1ac8e55af6168d3fdd6b17c700a15cf0546b6154773aa3c59c97d6bffa2ffd components/dnakhla/runtime/common/models.py
|
|
@@ -66,5 +66,5 @@ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 components/dna
|
|
| 66 |
6bf7658ec8ad07dda230a01fd893091a9b87df18ebf6af25af6c35965ed01fd8 components/dnakhla/upstream/terminal_desk/server/app.py
|
| 67 |
8e92f991e14098a0858490fe5beb43ca9b0ee2cfbddb36e73ecf987ba3922902 components/dnakhla/upstream/terminal_desk/server/environment.py
|
| 68 |
10993deaaa8553929fa0b3b6bf3c1ad100baaaf9ff10ae8ed139a8ec4279a3c4 schema.json
|
| 69 |
-
|
| 70 |
-
|
|
|
|
| 1 |
+
73b6e48016e027d623e5b6e03c4a6eae26ea366447f10cc09d6a7f06bfef8913 LICENSES/README.txt
|
| 2 |
+
1e23d241e1da2922af95a043de8cea2d71fb5a67c95da8780c5e406223d22d13 README.md
|
| 3 |
+
77d0d1993cb7e5b2e68e90850e0a4e7ce89a9236e175204fb86b6c7df43f07a3 SOURCE_LOCK.json
|
| 4 |
c04a2771c0665225047882b2da49d452e20d7cc9bc0ea024a48f1cd31411c504 components/dnakhla/.dockerignore
|
| 5 |
a2464ca6190e49c967ccb0b521c8190dba35d94b9b2208e31562161f20f535b8 components/dnakhla/Dockerfile
|
| 6 |
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 components/dnakhla/LICENSE
|
| 7 |
+
a3e807759b2b290d9c6af290af392f2ac87d7951a99b13fd62ee5cb431c86c68 components/dnakhla/NOTICE
|
| 8 |
+
e868fbee82b3288b177de089ff6d0e4acab807772d422828c3e81d4580fa350e components/dnakhla/README.md
|
| 9 |
+
2fc003f012c04e9897d8a629e9b9d6b937154f0646f083ca1cc7493445892d74 components/dnakhla/SOURCE_MANIFEST.json
|
| 10 |
01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b components/dnakhla/runtime/common/__init__.py
|
| 11 |
b1e1429208e84aefc2422ee1d2400ad793c43cd5c0e8db213a3b669fe0947ce1 components/dnakhla/runtime/common/contracts.py
|
| 12 |
6a1ac8e55af6168d3fdd6b17c700a15cf0546b6154773aa3c59c97d6bffa2ffd components/dnakhla/runtime/common/models.py
|
|
|
|
| 66 |
6bf7658ec8ad07dda230a01fd893091a9b87df18ebf6af25af6c35965ed01fd8 components/dnakhla/upstream/terminal_desk/server/app.py
|
| 67 |
8e92f991e14098a0858490fe5beb43ca9b0ee2cfbddb36e73ecf987ba3922902 components/dnakhla/upstream/terminal_desk/server/environment.py
|
| 68 |
10993deaaa8553929fa0b3b6bf3c1ad100baaaf9ff10ae8ed139a8ec4279a3c4 schema.json
|
| 69 |
+
d86495b21e4322e5265bff6a2f920b7237278522f0a5c076bf279ba63d9d3d82 tasks.jsonl
|
| 70 |
+
e62ac01d70ca2c5682089a0713a127a8bcccb5fdf9c5ca53e81ddd8b6f94aaba validate_dataset.py
|
SOURCE_LOCK.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
"revision": "08fab0beb50b665b42f0ac73840f03140f4ad1c9",
|
| 6 |
"license": "Apache-2.0",
|
| 7 |
"source_file": "SOURCE_MANIFEST.json",
|
| 8 |
-
"record_sha256": "
|
| 9 |
}
|
| 10 |
}
|
| 11 |
}
|
|
|
|
| 5 |
"revision": "08fab0beb50b665b42f0ac73840f03140f4ad1c9",
|
| 6 |
"license": "Apache-2.0",
|
| 7 |
"source_file": "SOURCE_MANIFEST.json",
|
| 8 |
+
"record_sha256": "2fc003f012c04e9897d8a629e9b9d6b937154f0646f083ca1cc7493445892d74"
|
| 9 |
}
|
| 10 |
}
|
| 11 |
}
|
components/dnakhla/NOTICE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
Terminal Desk by dnakhla
|
| 2 |
Source: https://huggingface.co/datasets/dnakhla/terminal-desk/tree/08fab0beb50b665b42f0ac73840f03140f4ad1c9
|
| 3 |
License declaration: Apache-2.0. The accompanying standard license text was added by this distribution.
|
| 4 |
-
This distribution adds a shared Arena interface and a
|
|
|
|
| 1 |
Terminal Desk by dnakhla
|
| 2 |
Source: https://huggingface.co/datasets/dnakhla/terminal-desk/tree/08fab0beb50b665b42f0ac73840f03140f4ad1c9
|
| 3 |
License declaration: Apache-2.0. The accompanying standard license text was added by this distribution.
|
| 4 |
+
This distribution adds a shared Arena interface and a four-task registry. Original task source remains unchanged.
|
components/dnakhla/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
Original Terminal Desk tasks by dnakhla. The shared adapter preserves original tools, random resets and artifact grading. Registered IDs are listed in SOURCE_MANIFEST.json.
|
| 2 |
|
| 3 |
Run: `python -m dnakhla_compat.server`
|
|
|
|
|
|
|
|
|
| 1 |
Original Terminal Desk tasks by dnakhla. The shared adapter preserves original tools, random resets and artifact grading. Registered IDs are listed in SOURCE_MANIFEST.json.
|
| 2 |
|
| 3 |
Run: `python -m dnakhla_compat.server`
|
| 4 |
+
|
| 5 |
+
Run one episode per sandbox, with one active session.
|
components/dnakhla/SOURCE_MANIFEST.json
CHANGED
|
@@ -58,11 +58,9 @@
|
|
| 58 |
"terminal_desk/server/environment.py": "8e92f991e14098a0858490fe5beb43ca9b0ee2cfbddb36e73ecf987ba3922902"
|
| 59 |
},
|
| 60 |
"selected_tasks": [
|
| 61 |
-
"sci3_stoich_batch-L2",
|
| 62 |
-
"math3_exam_slots-L1",
|
| 63 |
-
"sec3_fw_verdicts-L2",
|
| 64 |
"math3_exam_slots-L2",
|
| 65 |
-
"
|
| 66 |
-
"
|
|
|
|
| 67 |
]
|
| 68 |
}
|
|
|
|
| 58 |
"terminal_desk/server/environment.py": "8e92f991e14098a0858490fe5beb43ca9b0ee2cfbddb36e73ecf987ba3922902"
|
| 59 |
},
|
| 60 |
"selected_tasks": [
|
|
|
|
|
|
|
|
|
|
| 61 |
"math3_exam_slots-L2",
|
| 62 |
+
"off3_meeting_slot-L2",
|
| 63 |
+
"med3_subtitle_retime-L2",
|
| 64 |
+
"med3_silence_report-L2"
|
| 65 |
]
|
| 66 |
}
|
tasks.jsonl
CHANGED
|
@@ -1,6 +1,4 @@
|
|
| 1 |
-
{"component":"dnakhla","task_id":"
|
| 2 |
-
{"component":"dnakhla","task_id":"
|
| 3 |
-
{"component":"dnakhla","task_id":"
|
| 4 |
-
{"component":"dnakhla","task_id":"
|
| 5 |
-
{"component":"dnakhla","task_id":"sec3_auth_triage-L2","split":"train","domain":"cybersecurity","skill_family":"sec3_auth_triage","difficulty":2,"behavior":"Block SSH brute-force sources","source_dataset":"dnakhla/terminal-desk","source_revision":"08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_url":"https://huggingface.co/datasets/dnakhla/terminal-desk/tree/08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_record":"components/dnakhla/SOURCE_MANIFEST.json","original_task_definition":"components/dnakhla/upstream/terminal_desk/families/security3.py","original_task_definition_sha256":"6f5ec9c2dfe9aad81ba382d4f6ffdb7f64493d92cd7fe5d653134ef0dac107af","instance_policy":"Original random instance generation at reset.","reward":"One if all original artifact checks pass; zero otherwise."}
|
| 6 |
-
{"component":"dnakhla","task_id":"sec3_exfil_flows-L2","split":"train","domain":"cybersecurity","skill_family":"sec3_exfil_flows","difficulty":2,"behavior":"Flag off-hours exfiltration flows","source_dataset":"dnakhla/terminal-desk","source_revision":"08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_url":"https://huggingface.co/datasets/dnakhla/terminal-desk/tree/08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_record":"components/dnakhla/SOURCE_MANIFEST.json","original_task_definition":"components/dnakhla/upstream/terminal_desk/families/security3.py","original_task_definition_sha256":"6f5ec9c2dfe9aad81ba382d4f6ffdb7f64493d92cd7fe5d653134ef0dac107af","instance_policy":"Original random instance generation at reset.","reward":"One if all original artifact checks pass; zero otherwise."}
|
|
|
|
| 1 |
+
{"component":"dnakhla","task_id":"math3_exam_slots-L2","split":"train","domain":"mathematics-or-formal-reasoning","skill_family":"math3_exam_slots","difficulty":2,"behavior":"Sequence exam blocks into slots","source_dataset":"dnakhla/terminal-desk","source_revision":"08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_url":"https://huggingface.co/datasets/dnakhla/terminal-desk/tree/08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_record":"components/dnakhla/SOURCE_MANIFEST.json","original_task_definition":"components/dnakhla/upstream/terminal_desk/families/mathematics3.py","original_task_definition_sha256":"9dc54710cd826aadbe5de55d9093959e38c59dc59ae080e40d379cc4db1987c1","instance_policy":"Original random instance generation at reset; production ignores client seed.","reward":"One if all original artifact checks pass; zero otherwise."}
|
| 2 |
+
{"component":"dnakhla","task_id":"off3_meeting_slot-L2","split":"train","domain":"office-white-collar","skill_family":"off3_meeting_slot","difficulty":2,"behavior":"Earliest meeting slot across time zones","source_dataset":"dnakhla/terminal-desk","source_revision":"08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_url":"https://huggingface.co/datasets/dnakhla/terminal-desk/tree/08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_record":"components/dnakhla/SOURCE_MANIFEST.json","original_task_definition":"components/dnakhla/upstream/terminal_desk/families/office3.py","original_task_definition_sha256":"1926c4a6e600cabb4cd35fab9528b4e4d55ef4adc1623b7229ac356ef28c987b","instance_policy":"Original random instance generation at reset; production ignores client seed.","reward":"One if all original artifact checks pass; zero otherwise."}
|
| 3 |
+
{"component":"dnakhla","task_id":"med3_subtitle_retime-L2","split":"train","domain":"media-content-production","skill_family":"med3_subtitle_retime","difficulty":2,"behavior":"Retime subtitles through an edit decision list","source_dataset":"dnakhla/terminal-desk","source_revision":"08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_url":"https://huggingface.co/datasets/dnakhla/terminal-desk/tree/08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_record":"components/dnakhla/SOURCE_MANIFEST.json","original_task_definition":"components/dnakhla/upstream/terminal_desk/families/media3.py","original_task_definition_sha256":"9c91cfbde8ad60da034c15ba3418e21ae5891a12ce3932ecaf8035fcd6eef4bd","instance_policy":"Original random instance generation at reset; production ignores client seed.","reward":"One if all original artifact checks pass; zero otherwise."}
|
| 4 |
+
{"component":"dnakhla","task_id":"med3_silence_report-L2","split":"train","domain":"media-content-production","skill_family":"med3_silence_report","difficulty":2,"behavior":"Report silent segments in a lecture recording","source_dataset":"dnakhla/terminal-desk","source_revision":"08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_url":"https://huggingface.co/datasets/dnakhla/terminal-desk/tree/08fab0beb50b665b42f0ac73840f03140f4ad1c9","source_record":"components/dnakhla/SOURCE_MANIFEST.json","original_task_definition":"components/dnakhla/upstream/terminal_desk/families/media3.py","original_task_definition_sha256":"9c91cfbde8ad60da034c15ba3418e21ae5891a12ce3932ecaf8035fcd6eef4bd","instance_policy":"Original random instance generation at reset; production ignores client seed.","reward":"One if all original artifact checks pass; zero otherwise."}
|
|
|
|
|
|
validate_dataset.py
CHANGED
|
@@ -1,32 +1,79 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
SECRET=re.compile(rb'(?<![A-Za-z0-9])(?:hf_[A-Za-z0-9]{25,}|ghp_[A-Za-z0-9]{25,}|github_pat_[A-Za-z0-9_]{25,}|sk-or-v1-[A-Za-z0-9]{20,}|-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----)')
|
| 5 |
-
def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest()
|
| 6 |
def validate(root):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
for
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Offline inventory and provenance checks for this four-task dataset."""
|
| 2 |
+
import hashlib
|
| 3 |
+
import json
|
| 4 |
+
import re
|
| 5 |
+
from pathlib import Path, PurePosixPath
|
| 6 |
+
|
| 7 |
+
SECRET = re.compile(rb'(?<![A-Za-z0-9])(?:hf_[A-Za-z0-9]{25,}|ghp_[A-Za-z0-9]{25,}|github_pat_[A-Za-z0-9_]{25,}|sk-or-v1-[A-Za-z0-9]{20,}|-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----)')
|
| 8 |
+
TASK_IDS = ('math3_exam_slots-L2', 'off3_meeting_slot-L2', 'med3_subtitle_retime-L2', 'med3_silence_report-L2')
|
| 9 |
+
PIN = '08fab0beb50b665b42f0ac73840f03140f4ad1c9'
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def require(condition, message):
|
| 13 |
+
if not condition:
|
| 14 |
+
raise ValueError(message)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def sha(path):
|
| 18 |
+
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def member(root, relative):
|
| 22 |
+
part = PurePosixPath(relative)
|
| 23 |
+
require(isinstance(relative, str) and not part.is_absolute() and '..' not in part.parts,
|
| 24 |
+
'Unsafe inventory path')
|
| 25 |
+
target = Path(root) / relative
|
| 26 |
+
require(target.resolve().is_relative_to(Path(root).resolve()), 'Path leaves dataset')
|
| 27 |
+
require(target.is_file() and not target.is_symlink(), 'Missing or symlink member: ' + relative)
|
| 28 |
+
return target
|
| 29 |
+
|
| 30 |
|
|
|
|
|
|
|
| 31 |
def validate(root):
|
| 32 |
+
root = Path(root)
|
| 33 |
+
require(root.is_dir() and not root.is_symlink(), 'Dataset directory missing or symlink')
|
| 34 |
+
for path in root.rglob('*'):
|
| 35 |
+
require(not path.is_symlink(), 'Symlink in dataset: ' + str(path))
|
| 36 |
+
manifest = json.loads(member(root, 'MANIFEST.json').read_text())['files']
|
| 37 |
+
actual = {p.relative_to(root).as_posix() for p in root.rglob('*') if p.is_file()
|
| 38 |
+
and p.relative_to(root).as_posix() not in {'MANIFEST.json', 'SHA256SUMS'}}
|
| 39 |
+
require(actual == set(manifest), 'Dataset inventory mismatch')
|
| 40 |
+
for name, record in manifest.items():
|
| 41 |
+
path = member(root, name)
|
| 42 |
+
require(path.stat().st_size == record['bytes'] and sha(path) == record['sha256'],
|
| 43 |
+
'Dataset member hash mismatch: ' + name)
|
| 44 |
+
require(path.suffix not in {'.pyc', '.pem', '.key'}
|
| 45 |
+
and path.name not in {'.env', 'token', 'config_private.json'}, 'Forbidden member: ' + name)
|
| 46 |
+
require(not SECRET.search(path.read_bytes()), 'Credential-shaped content: ' + name)
|
| 47 |
+
sums = ''.join(f"{value['sha256']} {key}\n" for key, value in manifest.items())
|
| 48 |
+
require(member(root, 'SHA256SUMS').read_text() == sums, 'SHA256SUMS mismatch')
|
| 49 |
+
rows = [json.loads(line) for line in member(root, 'tasks.jsonl').read_text().splitlines()]
|
| 50 |
+
require(tuple(row['task_id'] for row in rows) == TASK_IDS, 'Exact four-task order mismatch')
|
| 51 |
+
require({row['component'] for row in rows} == {'dnakhla'}, 'Component mismatch')
|
| 52 |
+
source = json.loads(member(root, 'components/dnakhla/SOURCE_MANIFEST.json').read_text())
|
| 53 |
+
require(source['selected_tasks'] == list(TASK_IDS) and source['revision'] == PIN,
|
| 54 |
+
'Source registry or revision mismatch')
|
| 55 |
+
require(len(source['original_files']) == 52, 'Original file count mismatch')
|
| 56 |
+
for relative, digest in source['original_files'].items():
|
| 57 |
+
path = member(root, 'components/dnakhla/upstream/' + relative)
|
| 58 |
+
require(sha(path) == digest, 'Original source mismatch: ' + relative)
|
| 59 |
+
lock = json.loads(member(root, 'SOURCE_LOCK.json').read_text())['components']['dnakhla']
|
| 60 |
+
require(lock['record_sha256'] == sha(root / 'components/dnakhla/SOURCE_MANIFEST.json'),
|
| 61 |
+
'Source-lock digest mismatch')
|
| 62 |
+
for row in rows:
|
| 63 |
+
for field in ('source_record', 'original_task_definition'):
|
| 64 |
+
require(row[field] in manifest, 'Unlisted task source reference')
|
| 65 |
+
require(sha(root / row['original_task_definition']) == row['original_task_definition_sha256'],
|
| 66 |
+
'Task-definition digest mismatch')
|
| 67 |
+
require(row['source_revision'] == source['revision'] and row['source_dataset'] == source['dataset'],
|
| 68 |
+
'Task provenance mismatch')
|
| 69 |
+
for name in ('README.md', 'tasks.jsonl', 'components/dnakhla/README.md'):
|
| 70 |
+
text = (root / name).read_text()
|
| 71 |
+
require(not re.search('[\u4e00-\u9fff]', text), 'Public documentation must be English')
|
| 72 |
+
require(not re.search(r'(?i)api.key|credential|calibration results|research round|co-authored-by|generated by', text),
|
| 73 |
+
'Unexpected public documentation content')
|
| 74 |
+
return {'passed': True, 'scope': 'offline_dataset_inventory_only', 'tasks': 4,
|
| 75 |
+
'components': 1, 'original_files': 52, 'files': len(manifest)}
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
if __name__ == '__main__':
|
| 79 |
+
print(json.dumps(validate(Path(__file__).resolve().parent)))
|