O3: task sources and result sinks, cmd adapter protocol (closes #4)

This commit is contained in:
hermes committed 2026-11-12 23:24:56 +00:00
1 parent 2f79b69977
commit 6e1979fe7a
10 files changed
+594 -76

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env python3
"""Fake cmd adapter for tests/e2e.py. State/log in $ADAPTER_DIR. Implements the protocol in docs/cmd-protocol.md."""
import json, os, sys
d = os.environ["ADAPTER_DIR"]
op = sys.argv[1]
data = json.load(sys.stdin)
open(f"{d}/calls.log", "a").write(json.dumps({"op": op, "in": data}) + "\n")
if os.environ.get("BREAK") == op:
print("not json")
sys.exit(0)
if op == "list":
out = {"tasks": [
{"id": "t-good", "title": "Good", "body": "WRITE", "repo": os.environ["REPO"], "number": 7},
{"id": "t-taken", "title": "Taken", "body": "WRITE", "repo": os.environ["REPO"]},
{"id": "t-bad", "title": "Bad", "body": "FAIL", "repo": os.environ["REPO"]},
]}
elif op == "claim":
out = {"claimed": data["task"]["id"] != "t-taken"}
elif op == "publish":
out = {"url": "http://example/pr/1"}
else:
out = {}
print(json.dumps(out))