betterwithage commited on
Commit
c6ae7fe
·
verified ·
1 Parent(s): 0779003

chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)

Browse files

Automated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): szl_brain_capabilities.py
Deleted (gone from the repo + Dockerfile COPY set): (none)

Keeps the Space-built backend (serve.py + the Dockerfile-COPY'd .py
modules) identical to GitHub main so the Space never rebuilds from a
stale backend, new endpoints don't 404 there, and orphaned modules
removed from the repo don't linger in the Space tree.

Files changed (1) hide show
  1. szl_brain_capabilities.py +20 -3
szl_brain_capabilities.py CHANGED
@@ -280,17 +280,34 @@ def register(
280
  ns: str = "a11oy",
281
  runtime_status: dict[str, bool] | None = None,
282
  ) -> str:
 
283
  from fastapi.responses import JSONResponse
284
 
285
  base = f"/api/{ns}/v1/brain/capabilities"
286
  runtime_snapshot = dict(runtime_status or {})
287
 
288
- @app.get(f"{base}/info")
289
  def _brain_capabilities_info():
290
  return JSONResponse(build_info(ns))
291
 
292
- @app.get(base)
293
  def _brain_capabilities():
294
  return JSONResponse(build_manifest(ns, runtime_snapshot))
295
 
296
- return "brain-capabilities-wired:3"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  ns: str = "a11oy",
281
  runtime_status: dict[str, bool] | None = None,
282
  ) -> str:
283
+ from fastapi import Response
284
  from fastapi.responses import JSONResponse
285
 
286
  base = f"/api/{ns}/v1/brain/capabilities"
287
  runtime_snapshot = dict(runtime_status or {})
288
 
289
+ @app.api_route(f"{base}/info", methods=["GET", "HEAD"])
290
  def _brain_capabilities_info():
291
  return JSONResponse(build_info(ns))
292
 
293
+ @app.api_route(base, methods=["GET", "HEAD"])
294
  def _brain_capabilities():
295
  return JSONResponse(build_manifest(ns, runtime_snapshot))
296
 
297
+ # FastAPI does not synthesize HEAD for GET routes. These explicit, bodyless
298
+ # operational contracts let load balancers and independent verifiers probe
299
+ # the existing read-only surfaces without invoking mutation or duplicating
300
+ # their GET implementations.
301
+ @app.head("/api/livez", include_in_schema=False)
302
+ def _livez_head():
303
+ return Response(status_code=200, headers={"Cache-Control": "no-store"})
304
+
305
+ @app.head("/api/build-info", include_in_schema=False)
306
+ def _build_info_head():
307
+ return Response(status_code=200, headers={"Cache-Control": "no-store"})
308
+
309
+ @app.head(f"/api/{ns}/v1/readiness/tab-matrix", include_in_schema=False)
310
+ def _readiness_head():
311
+ return Response(status_code=200, headers={"Cache-Control": "no-store"})
312
+
313
+ return "brain-capabilities-wired:4"