Download Task/E4-deploy-002/simulator/server.py from TraceLite-AI/TraceTrial-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/datasets/TraceLite-AI/TraceTrial-Bench/resolve/main/Task/E4-deploy-002/simulator/server.py
- Command line
-
hf download hf://datasets/TraceLite-AI/TraceTrial-Bench/Task/E4-deploy-002/simulator/server.py
-
curl -L -o server.py https://huggingface.co/datasets/TraceLite-AI/TraceTrial-Bench/resolve/main/Task/E4-deploy-002/simulator/server.py
1.88 kB
| def initial_state(scenario): | |
| return {"briefed": [], "submitted": []} | |
| def handle(request, state, scenario): | |
| argv = request.get("argv", []) | |
| action = argv[0] if argv else "help" | |
| items = scenario.get("items", {}) | |
| if action == "dep_brief" and len(argv) == 2: | |
| item = argv[1] | |
| row = items.get(item) | |
| if row is None: | |
| return {"ok": False, "text": "NO_SUCH_ITEM known=" + ",".join(items)} | |
| state["briefed"].append(item) | |
| return { | |
| "ok": True, | |
| "text": ( | |
| "ITEM " | |
| + item | |
| + "\nBroadcast playout deployment shell-state type: " | |
| + row["label"] | |
| + ".\nFirst native exec call; run exactly:\n " | |
| + row["setup"] | |
| + "\nSecond, separate native exec call; run exactly:\n " | |
| + row["readback"] | |
| + "\nThe setup is confirmed only by HBSET_" | |
| + item | |
| + "=<planted-value>. Submit only after that confirmation and a complete readback. Submit the exact text after HBSTATE_" | |
| + item | |
| + "= with: taskctl dep_submit " | |
| + item | |
| + " <observed-value>. Quote an empty value as \"\"." | |
| ), | |
| "setup": row["setup"], | |
| "readback": row["readback"], | |
| } | |
| if action == "dep_submit" and len(argv) == 3: | |
| item, value = argv[1], argv[2] | |
| row = items.get(item) | |
| if row is None: | |
| return {"ok": False, "text": "NO_SUCH_ITEM"} | |
| state["submitted"].append({"item": item, "observed": value}) | |
| return { | |
| "ok": True, | |
| "text": "RECEIPT item=" + item + " code=" + row["code"], | |
| } | |
| return { | |
| "ok": False, | |
| "text": "usage: taskctl dep_brief M01 | taskctl dep_submit M01 VALUE", | |
| } | |