Spaces:
Sleeping
Sleeping
Download src/modules/orchestrator/api.py from dellweb3/VibeCoding: direct link, hf CLI and curl.
- Browser
- Download file 2.04 kB
-
https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/modules/orchestrator/api.py
- Command line
-
hf download hf://spaces/dellweb3/VibeCoding/src/modules/orchestrator/api.py
-
curl -L -o api.py https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/modules/orchestrator/api.py
2.04 kB
| from fastapi import APIRouter, Depends, Header | |
| from pydantic import Field | |
| from src.modules.skill.domain.models import Contract, Identifier | |
| class StartRun(Contract): | |
| release_ref: str = Field(min_length=1, max_length=110) | |
| project_id: Identifier | |
| source_digest: str = Field(pattern=r'^[a-f0-9]{64}$') | |
| requirement: str = Field(min_length=1, max_length=6000) | |
| query: str = Field(min_length=1, max_length=300) | |
| class ApproveRun(Contract): | |
| expected_digest: str = Field(pattern=r'^[a-f0-9]{64}$') | |
| def build_router(runtime, principal): | |
| router = APIRouter(prefix='/api/v1/coding/runs', tags=['ZKCoding Runtime']) | |
| def readiness(actor=Depends(principal)): | |
| return runtime.readiness(actor) | |
| def create(data: StartRun, actor=Depends(principal), key: str = Header(alias='Idempotency-Key', min_length=8, max_length=128)): | |
| return runtime.create(actor, data.model_dump(), key) | |
| def get(run_id: str, actor=Depends(principal)): | |
| return runtime.get(actor, run_id) | |
| def advance(run_id: str, actor=Depends(principal)): | |
| return runtime.advance(actor, run_id) | |
| def approve(run_id: str, data: ApproveRun, actor=Depends(principal)): | |
| return runtime.approve(actor, run_id, data.expected_digest) | |
| def cancel(run_id: str, actor=Depends(principal)): | |
| return runtime.cancel(actor, run_id) | |
| def repair(run_id: str, actor=Depends(principal)): | |
| return runtime.repair(actor, run_id) | |
| def recover(run_id: str, actor=Depends(principal)): | |
| return runtime.recover(actor, run_id) | |
| def validation_evidence(run_id: str, actor=Depends(principal)): | |
| return runtime.validation_evidence(actor, run_id) | |
| return router | |