feat: add remote workspaces and verified deliverables
This commit is contained in:
+28
-2
@@ -60,10 +60,18 @@ class StubHandler(BaseHTTPRequestHandler):
|
||||
messages = payload.get("messages") or []
|
||||
tools = payload.get("tools") or []
|
||||
has_tool_result = any(message.get("role") == "tool" for message in messages)
|
||||
called_tools = {
|
||||
str((call.get("function") or {}).get("name", ""))
|
||||
for message in messages
|
||||
if message.get("role") == "assistant"
|
||||
for call in (message.get("tool_calls") or [])
|
||||
}
|
||||
available_names = {
|
||||
str((tool.get("function") or {}).get("name", "")) for tool in tools if isinstance(tool, dict)
|
||||
}
|
||||
is_work = "update_plan" in available_names
|
||||
|
||||
if tools and not has_tool_result:
|
||||
names = {str((tool.get("function") or {}).get("name", "")) for tool in tools if isinstance(tool, dict)}
|
||||
is_work = "update_plan" in names
|
||||
path = "work-proof.txt" if is_work else "chat-proof.txt"
|
||||
arguments = json.dumps(
|
||||
{"path": path, "content": _last_user_text(messages) or "e2e"},
|
||||
@@ -83,6 +91,24 @@ class StubHandler(BaseHTTPRequestHandler):
|
||||
self._respond(payload, _completion(model, message, "tool_calls"))
|
||||
return
|
||||
|
||||
if is_work and "write_file" in called_tools and "read_file" not in called_tools:
|
||||
message = {
|
||||
"role": "assistant",
|
||||
"content": None,
|
||||
"tool_calls": [
|
||||
{
|
||||
"id": "call_e2e_verify",
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "read_file",
|
||||
"arguments": json.dumps({"path": "work-proof.txt"}),
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
self._respond(payload, _completion(model, message, "tool_calls"))
|
||||
return
|
||||
|
||||
text = "E2E provider completed after tool execution." if has_tool_result else "E2E provider response."
|
||||
self._respond(payload, _completion(model, {"role": "assistant", "content": text}, "stop"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user