Spaces:
Sleeping
Sleeping
Download src/modules/execution/scenarios/business_app.py from dellweb3/VibeCoding: direct link, hf CLI and curl.
- Browser
- Download file 3.07 kB
-
https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/modules/execution/scenarios/business_app.py
- Command line
-
hf download hf://spaces/dellweb3/VibeCoding/src/modules/execution/scenarios/business_app.py
-
curl -L -o business_app.py https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/modules/execution/scenarios/business_app.py
3.07 kB
| """Business-neutral Java and browser framework; domain comes from the user.""" | |
| from src.modules.execution.contracts import HttpCase,SandboxConfig | |
| PROFILE='java17-requirement-business' | |
| SKILL='requirement-java-business' | |
| JAVA='src/main/java/demo/App.java' | |
| PAGE='website/index.html' | |
| CONTRACT='''Create a Java17 standard-library HttpServer in demo.App on 127.0.0.1:8080 and one self-contained website/index.html. | |
| The user requirement and model's explicitly labelled assumptions define business entities, fields, operations and display. | |
| For list-oriented management tasks, use a responsive admin layout with a title, compact search/filter toolbar, data table and relevant actions; adapt it to the current requirement. | |
| The Skill does not prescribe domain fields, records or business actions. Never inherit purchase orders, inventory, returns or payments unless requested. For a local demo, use a CSV file under /tmp; | |
| when no sample size is specified for a list, assume 1000 rows and state that assumption. Do not use external databases or networks. | |
| GET /health -> 200 {"status":"ok"}; GET /api/app/meta -> 200 {"status":"ready"}; GET /unknown -> 404 {"error":"NOT_FOUND"}. | |
| Each JSON response must fit the existing 65536-byte protected transport limit. Large collections require bounded server pagination with total counts and matching browser pagination; do not return all 1000 records in one response. | |
| Business GET requests use /api/app/list with URL-safe query parameters; business POST requests use /api/app/action with URL-safe query parameters. | |
| Return JSON for every endpoint. Support Authorization: Bearer demo-sales for the business routes. Unknown methods and bad input return JSON errors. | |
| Use standard UTF-8 percent-encoded query parameters; decode exchange.getRequestURI().getRawQuery() exactly once using URLDecoder. Never guess whether plain ASCII identifiers are Base64. Do not send JSON bodies. Model-generated page uses await window.zkRequest(method,path), | |
| which returns parsed JSON through a trusted preview bridge; do not use fetch, XMLHttpRequest, WebSocket, external resources or nested frames. | |
| The page has inline CSS and JS, implements the current business, and never exposes tokens. File data lives only for the VM preview lease. | |
| Output exactly src/main/java/demo/App.java and website/index.html. The independent platform checks Java compilation, health, meta and a nonempty list; | |
| business functionality must be checked separately against the user requirement.''' | |
| def scenario(image): | |
| health=HttpCase(path='/health',status=200,expected_json={'status':'ok'}) | |
| return SandboxConfig(image=image,skill_ids=[SKILL],api_contract=CONTRACT,command_seconds=120,health=health, | |
| tests=[health,HttpCase(path='/api/app/meta',headers={'Authorization':'Bearer demo-sales'},status=200,expected_json={'status':'ready'}), | |
| HttpCase(path='/api/app/list',headers={'Authorization':'Bearer demo-sales'},status=200,expected_json={},check='nonempty-list'), | |
| HttpCase(path='/unknown',status=404,expected_json={'error':'NOT_FOUND'})]) | |