d5da853db2
Zweiter, dezenter Schalter (nur bei IDE): Ziel = LXC (Standard) oder Docker. Die Wahl fliesst als 'ZIEL-PLATTFORM'-Zeile in den Auftrag, dazu immer ein Infrastruktur-Steckbrief (Proxmox/LXC, PBS-Backups, systemd, self-hosted Gitea, alles lokal) — sonst plant jedes Modell nach Industrie-Default Docker/Cloud. Skill: Ziel + Infrastruktur sind bindend; traegt die Wahl nicht, muss das Konzept es ausdruecklich sagen statt sie still zu ignorieren. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
100 lines
2.6 KiB
Python
100 lines
2.6 KiB
Python
"""Ideen-Queue-Endpoints — dünner REST-Layer über services/ideen.py (natives Hermes-Kanban).
|
|
LAN-only wie alle MC2-Endpoints; das Mensch-Gate bleibt die Karte im Auftragsbuch."""
|
|
|
|
from fastapi import APIRouter, HTTPException
|
|
from pydantic import BaseModel
|
|
|
|
from services import ideen
|
|
|
|
router = APIRouter(prefix="/api")
|
|
|
|
|
|
class IdeeIn(BaseModel):
|
|
titel: str
|
|
notiz: str = ""
|
|
welt: str = "box" # "box" = Werkstatt baut · "ide" = vorbereiten für Zed
|
|
tiefe: str = "" # nur ide: "simpel" | "gruendlich" (leer = Box schätzt selbst)
|
|
ziel: str = "" # nur ide: "lxc" | "docker" (leer = Box entscheidet)
|
|
|
|
|
|
class TaskIn(BaseModel):
|
|
id: str
|
|
|
|
|
|
class AntwortIn(BaseModel):
|
|
id: str
|
|
antwort: str
|
|
|
|
|
|
@router.get("/ideen")
|
|
def list_queue() -> dict:
|
|
return ideen.list_queue()
|
|
|
|
|
|
@router.post("/ideen")
|
|
def add_idea(body: IdeeIn) -> dict:
|
|
res = ideen.add_idea(body.titel, body.notiz, welt=body.welt, tiefe=body.tiefe, ziel=body.ziel)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Idee konnte nicht angelegt werden."))
|
|
return res
|
|
|
|
|
|
@router.post("/ideen/antwort")
|
|
def answer(body: AntwortIn) -> dict:
|
|
res = ideen.answer_task(body.id, body.antwort)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Antwort konnte nicht gesendet werden."))
|
|
return res
|
|
|
|
|
|
class PrioIn(BaseModel):
|
|
id: str
|
|
richtung: str # hoch | runter
|
|
|
|
|
|
@router.post("/ideen/stopp")
|
|
def stop(body: TaskIn) -> dict:
|
|
res = ideen.stop_task(body.id)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Stoppen fehlgeschlagen."))
|
|
return res
|
|
|
|
|
|
@router.post("/ideen/retry")
|
|
def retry(body: TaskIn) -> dict:
|
|
res = ideen.retry_task(body.id)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Neuer Versuch fehlgeschlagen."))
|
|
return res
|
|
|
|
|
|
@router.post("/ideen/prio")
|
|
def prio(body: PrioIn) -> dict:
|
|
res = ideen.prio_task(body.id, body.richtung)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Prio-Änderung fehlgeschlagen."))
|
|
return res
|
|
|
|
|
|
@router.post("/ideen/archivieren")
|
|
def archive(body: TaskIn) -> dict:
|
|
res = ideen.archive_task(body.id)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Archivieren fehlgeschlagen."))
|
|
return res
|
|
|
|
|
|
@router.get("/ideen/{id}/log")
|
|
def get_log(id: str) -> dict:
|
|
return ideen.log_of(id)
|
|
|
|
|
|
@router.get("/ideen/{id}/ergebnis")
|
|
def get_ergebnis(id: str) -> dict:
|
|
return ideen.ergebnis_of(id)
|
|
|
|
|
|
@router.get("/ideen/{id}/konzept")
|
|
def get_konzept(id: str) -> dict:
|
|
return ideen.konzept_of(id)
|