Problem context ready
SUPER_PROBLEM_SOLVER_RESULT={"summary":"I couldn\u2019t find any post reference in the conversation. Could you please share the link or describe the workflow you'd like me to build the app from? That way I can create an interactive prototype that matches exactly what you need.","code":"import json\nimport os\nimport sys\nimport urllib.request\nimport re\n\ndef main():\n # Load problem_context\n with open('problem_context.json', 'r') as f:\n ctx = json.load(f)\n\n user_text = ctx.get('user_text', '')\n analysis = ctx.get('analysis', {})\n preview_port = ctx.get('preview_port', 45671)\n\n # Read full transcript if available\n transcript_path = 'full/recent_sms_transcript'\n post_content = None\n post_url = None\n if os.path.exists(transcript_path):\n with open(transcript_path, 'r') as f:\n transcript = f.read()\n # Look for URLs in the transcript (simple regex)\n urls = re.findall(r'https?://[^\\s\"]+', transcript)\n if urls:\n # Take the first URL\n post_url = urls[0]\n try:\n req = urllib.request.Request(post_url, headers={'User-Agent': 'Mozilla/5.0'})\n with urllib.request.urlopen(req, timeout=10) as resp:\n post_content = resp.read().decode('utf-8', errors='ignore')\n except Exception:\n pass # fail silently, will ask for more info\n\n # Check if we have enough to build\n if not post_content and not post_url:\n # No post reference found\n result = {\n \"success\": False,\n \"status\": \"missing_info\",\n \"answer\": \"I couldn\u2019t find any post reference in the conversation. Could you please share the link or describe the workflow you'd like me to build the app from? That way I can create an interactive prototype that matches exactly what you need.\",\n \"reasoning_summary\": \"The request mentions a specific post, but no post URL or content was found in the available context. I need the actual workflow to build a custom app.\",\n \"tool_summary\": \"No tools were run because the required input was missing.\",\n \"logs\": [\"Missing post reference \u2013 asked user for clarification.\"],\n \"missing_info\": [\"Link or description of the post/workflow to base the app on\"],\n \"next_step\": \"Share the original post or outline the workflow steps you want the tool to implement.\"\n }\n else:\n # We have a post \u2013 attempt to parse a workflow (simplified: treat the page title/body as steps)\n # For real implementation we would extract structured steps, but for demo we create a generic task tracker\n if post_content:\n # Truncate for safety\n workflow_title = \"Workflow from post\"\n # Try to extract a title from HTML\n title_match = re.search(r']*>(.*?)', post_content, re.IGNORECASE)\n if title_match:\n workflow_title = title_match.group(1).strip()\n else:\n workflow_title = \"Referenced Workflow\"\n\n # Build an interactive HTML tool that lets users explore a hypothetical workflow\n html = f\"\"\"\n\n\n \n \n {workflow_title} \u2013 Interactive Prototype\n \n\n\n
\n
\ud83d\udccb {workflow_title}
\n
Interactive workflow prototype \u2013 try it out below