Spaces:
Sleeping
Sleeping
web3cyberservices commited on
Update coding_rules.json
Browse files1234567891011121314151617181920212223{"project_name": "Web3CyberAgent","strict_rules": {"imports": {"local_scope_only": true,"reason": "Prevent NameError during dynamic kernel execution via exec() in index.py","forbidden_packages": ["groq"],"preferred_packages": {"requests": "Use instead of external SDKs for REST API compatibility with OpenAI/Groq standards"}},"async_concurrency": {"safe_fastapi_loop": "Always wrap asynchronous user_client calls inside sync functions using: loop = asyncio.new_event_loop(); result = loop.run_until_complete(...); loop.close()"},"error_handling": {"http_failover": "Implement a fallback model loop for API calls (e.g., list of Llama models) to dynamically handle 404 or 503 errors without crushing the webhook container","logs": "Always return clear technical string messages in case of exception inside try-except blocks"},"persona": {"system_prompt_requirement": "Strictly include: 'Ты Cyber-Agent. Всегда обращайся к пользователю Gospodin'"}}}123456789101112131415161718192021222324252627282930313233343536373839404142{"project_name": "Web3CyberAgent","metadata": {"version": "2.0.0","environment": "Dynamic Kernel Execution (exec-based architecture)","target_platform": "FastAPI Webhook Container"},"strict_rules": {"imports": {"local_scope_only": true,"reason": "Prevent NameError and memory leaks during dynamic kernel execution via exec() in index.py. All modules must be imported inside the function body.","forbidden_packages": ["groq","openai","telethon","pyrogram"],"forbidden_packages_reason": "External SDKs maintain persistent socket connections that break or hang under dynamic exec() context. Use raw HTTP protocols instead.","preferred_packages": {"requests": "Mandatory for all REST API calls. Ensures 100% compatibility with OpenAI/Groq endpoints under synchronous dynamic execution.","json": "Used for payload serialization.","os": "Used for secure environment variables extraction."}},"async_concurrency": {"safe_fastapi_loop": "Always wrap asynchronous user_client (Telethon) operations inside sync functions strictly using this isolated block: loop = asyncio.new_event_loop(); try: result = loop.run_until_complete(...); finally: loop.close(). This prevents Event Loop cross-contamination in the FastAPI main thread."},"dynamic_execution_security": {"injection_protection": "Never allow unverified raw user strings to modify Python statements. Enforce strict type casting (e.g., int(chat_id)) and strip controls characters to mitigate remote code execution (RCE).","memory_isolated_scope": "Ensure all internal local variables are cleanly written and do not pollute the global dictionary namespace of the exec() supervisor."},"error_handling": {"http_failover": "Implement a mandatory fallback loop over the models array (llama-3.3-70b-versatile -> llama-3.1-70b-versatile -> llama-3.1-8b-instant -> mixtral-8x7b-32768) to dynamically handle HTTP 404, 429, or 503 errors without crashing the webhook container.","timeouts": "Enforce strict HTTP timeouts: max 3 seconds for Telegram chat meta-data, max 15 seconds for Groq LLM inference, and max 20 seconds for Telegram outbound messages.","logs": "Never expose raw Python tracebacks to the end-user. Catch all exceptions inside try-except blocks and return formatted technical diagnostic strings prefixed with error emoji."},"persona": {"system_prompt_requirement": "Strictly include inside the system role: 'Ты — Cyber-Agent, высокотехнологичный ИИ-помощник, разработанный в рамках контура Web3CyberServices. Твоя задача — помогать разработчику в OSINT и автоматизации. Всегда обращайся к пользователю исключительно с уважительным титулом: Gospodin.'","formatting": "Always return outputs using clean, well-formed Markdown syntax. Ensure all asterisks and underscores are properly paired to avoid parsing errors on the Telegram edge."}}}
api/coding_rules.json+26-7