allow forces direct provider; provider_mode in telemetry; eval refuses mixed modes (closes #17)

This commit is contained in:
hermes committed 2026-11-13 19:06:13 +00:00
1 parent 374cf28aed
commit 2ff8abe7a3
8 files changed
+219 -10

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
"""Fake `claude -p` for the claude_cli provider (orch tests). It is the process that "executes tools": it reads the
file named in $FAKE_CLAUDE_READ the way the real claude would (directly, no hx involved) and writes what it saw to
./claude-read.txt, then answers. Logs argv to $FAKE_CLAUDE_LOG."""
import json, os, sys
if "--version" in sys.argv:
print("fake")
sys.exit(0)
open(os.environ.get("FAKE_CLAUDE_LOG", "/dev/null"), "a").write(json.dumps(sys.argv[1:]) + "\n")
out = lambda o: print(json.dumps(o), flush=True)
target = os.environ.get("FAKE_CLAUDE_READ")
if target:
try:
open("claude-read.txt", "w").write(open(target).read())
except OSError as e:
open("claude-read.txt", "w").write("ERR " + str(e))
out({"type": "system", "subtype": "init", "session_id": "S1"})
out({"type": "stream_event", "session_id": "S1", "event": {"type": "content_block_delta", "delta": {"type": "text_delta", "text": "done"}}})
out({"type": "result", "session_id": "S1", "is_error": False, "result": "done", "usage": {"input_tokens": 3, "output_tokens": 4}})