This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-18 01:00:12 -04:00
1 parent 988582f548
commit bbe3912e79
8 files changed
+106 -123

No files matched your search

+2 -17
View File
@@ -21,27 +21,12 @@ from cptr.utils.agents.events import (
AgentTextDelta,
AgentToolUpdate,
)
from cptr.utils.agents.prompts import latest_user_text
CURSOR_CAPABILITIES = {"_meta": {"parameterizedModelPicker": True}}
def _prompt_from_messages(messages: list[dict[str, Any]]) -> str:
parts: list[str] = []
for message in messages:
role = message.get("role", "user")
content = message.get("content", "")
if isinstance(content, list):
text = "\n".join(
str(block.get("text", "")) for block in content if isinstance(block, dict)
)
else:
text = str(content or "")
if text:
parts.append(f"[{role}]\n{text}")
return "\n\n".join(parts)
def _auto_approve(chat_params: dict[str, Any]) -> bool:
if chat_params.get("tool_approval_mode") == "full":
return True
@@ -88,7 +73,7 @@ async def run_cursor_agent(
if model != "default":
await client.set_model(model)
prompt = _prompt_from_messages(messages)
prompt = latest_user_text(messages)
if system_prompt:
prompt = f"{system_prompt}\n\n{prompt}" if prompt else system_prompt