diff --git a/apps/agent/agent/webapp.py b/apps/agent/agent/webapp.py index c6d41a58..24467688 100644 --- a/apps/agent/agent/webapp.py +++ b/apps/agent/agent/webapp.py @@ -17,6 +17,7 @@ from langgraph_sdk import get_client # Local import for encryption from .encryption import encrypt_token from .utils.comments import get_recent_comments +from .utils.linear import comment_on_linear_issue from .utils.multimodal import dedupe_urls, extract_image_urls, fetch_image_block logger = logging.getLogger(__name__) @@ -272,52 +273,6 @@ async def react_to_linear_comment(comment_id: str, emoji: str = "👀") -> bool: return False -async def comment_on_linear_issue(issue_id: str, comment_body: str) -> bool: - """Add a comment to a Linear issue. - - Args: - issue_id: The Linear issue ID - comment_body: The comment text - - Returns: - True if successful, False otherwise - """ - if not LINEAR_API_KEY: - return False - - url = "https://api.linear.app/graphql" - - mutation = """ - mutation CommentCreate($issueId: String!, $body: String!) { - commentCreate(input: { issueId: $issueId, body: $body }) { - success - comment { - id - } - } - } - """ - - async with httpx.AsyncClient() as client: - try: - response = await client.post( - url, - headers={ - "Authorization": LINEAR_API_KEY, - "Content-Type": "application/json", - }, - json={ - "query": mutation, - "variables": {"issueId": issue_id, "body": comment_body}, - }, - ) - response.raise_for_status() - result = response.json() - return bool(result.get("data", {}).get("commentCreate", {}).get("success")) - except Exception: # noqa: BLE001 - return False - - async def fetch_linear_issue_details(issue_id: str) -> dict[str, Any] | None: """Fetch full issue details from Linear API including description and comments.