checkpoint: finished test curation
This commit is contained in:
@@ -18,6 +18,20 @@ def main():
|
||||
if "run" not in sys.argv:
|
||||
return
|
||||
|
||||
# If the prompt contains tool results (indicated by "role": "tool"),
|
||||
# it means we are in the second round and should provide a final answer.
|
||||
if '"role": "tool"' in prompt:
|
||||
print(json.dumps({
|
||||
"type": "message",
|
||||
"text": "I have processed the tool results. Everything looks good!"
|
||||
}), flush=True)
|
||||
print(json.dumps({
|
||||
"type": "result",
|
||||
"usage": {"total_tokens": 100},
|
||||
"session_id": "mock-session-final"
|
||||
}), flush=True)
|
||||
return
|
||||
|
||||
# Simulate the 'BeforeTool' hook by calling the bridge directly.
|
||||
bridge_path = os.path.abspath("scripts/cli_tool_bridge.py")
|
||||
|
||||
@@ -35,7 +49,8 @@ def main():
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True
|
||||
text=True,
|
||||
env=os.environ # Ensure environment variables are inherited
|
||||
)
|
||||
stdout, stderr = process.communicate(input=json.dumps(tool_call))
|
||||
|
||||
@@ -70,11 +85,11 @@ def main():
|
||||
}), flush=True)
|
||||
else:
|
||||
print(json.dumps({
|
||||
"type": "message",
|
||||
"type": "message",
|
||||
"text": f"Tool execution was denied. Decision: {decision}"
|
||||
}), flush=True)
|
||||
print(json.dumps({
|
||||
"type": "result",
|
||||
"type": "result",
|
||||
"usage": {"total_tokens": 10},
|
||||
"session_id": "mock-session-denied"
|
||||
}), flush=True)
|
||||
|
||||
Reference in New Issue
Block a user