xa.service¶
FastAPI service for xa.
build_api(...) returns a mountable FastAPI app that reimplements
the edualc route surface on top of the xa primitives. The service
is deliberately a function (not a module that imports-and-runs) so it can
be embedded into larger hosts (enlace / tw_platform) or launched
standalone via xa serve.
FastAPI is an optional dependency. Import xa.service only when you
have installed xa[service] (pulls in fastapi + uvicorn).
Module Attributes
How long POST /sessions/{id}/remote-control waits for claude to write its bridge id after the command is sent. |
Functions
No-op auth dependency. |
|
|
Return a |
|
Build a FastAPI dependency that enforces HTTP Basic auth. |
Classes
|
Stateless 4-letter captcha with an HMAC-signed token. |
- class xa.service.Captcha(*, key, ttl_sec=120)[source]¶
Bases:
objectStateless 4-letter captcha with an HMAC-signed token.
The signing key never leaves the server. Tokens are
b64(CHALLENGE.EXPIRY).SIGwhere SIG = HMAC-SHA256(key, payload). Multi-worker safe; no server-side state. Pass one instance of this class tobuild_api()to enable captcha-gated deletes.
- xa.service.RC_ENABLE_TIMEOUT_SEC = 15.0¶
How long POST /sessions/{id}/remote-control waits for claude to write its bridge id after the command is sent. The TUI acks well before the session file is rewritten, so a bare read would always miss.
- xa.service.allow_all()[source]¶
No-op auth dependency. Useful when the service is behind an external auth layer (enlace, reverse-proxy mTLS) that already gated the request.
FastAPI inspects the signature to decide what to inject; keep this nullary so it isn’t treated as query-parameter binding.
- Return type:
- xa.service.build_api(*, auth=<function allow_all>, events_store=None, pane_store=None, captcha=None, claude_home=PosixPath('/home/runner/.claude'), claude_bin='claude', session_prefix='xa-', title='xa', version='0.1', include_webui=False, default_folder=None)[source]¶
Return a
FastAPIapp exposingxa’s session + archive surface.The caller composes this app into whatever process they have: mount under
/api/xa/inside enlace, or run standalone viauvicorn.