Three supported ways to extend Nova Coder (per reports/Plugin and Extension SDK.md). Pick by where the behavior lives.
1. Route module (new HTTP surface)
# novacoder/api/routes_mysurface.py
from fastapi import APIRouter
router = APIRouter()
@router.get("/api/mysurface/hello")
async def hello() -> dict:
return {"ok": True}
- Register the module name in
_ROUTE_MODULE_NAMES(novacoder/api/app.py), unregistered modules 404 silently. /api/*paths are token-gated automatically; anything outside/apimust be added tonon_api_protectedor is public (scanner-enforced).- Route handlers returning
FileResponse|JSONResponseneedresponse_model=None.
2. Kernel service (lifecycle + DI)
from novacoder.kernel.service import NovaService
class MyService(NovaService):
name = "myservice"
def initialize(self) -> None: ...
def start(self) -> None: ... # must not run async work
def stop(self) -> None: ...
- Register in
SERVICE_ORDER(app.py); resolve deps viacontainer. start()runs inside synchronous_boot(), async health checks at boot deadlock the API (ADR-002).- Heavy work belongs on the scheduler, not in
initialize().
3. Capability (model-facing tool)
from novacoder.capabilities.base import Capability
from novacoder.capabilities.descriptor import CapabilityDescriptor, CapabilityResult
class MyCap(Capability):
descriptor = CapabilityDescriptor(
id="mine.thing", name="My Thing", description="…",
keywords=["do my thing"], # feeds the IntentRouter
requires_approval=True, # if it mutates
)
async def run(self, args, ctx) -> CapabilityResult: ...
- Register in
builtins/__init__.py::register_builtins(or adopt a legacy tool). - Honor the gates: SSRF for egress, path confinement for filesystem,
deviceops surface for host actions, never raw fs/subprocess. - Missing backends must report
unavailable, not crash.