betterwithage commited on
Commit
0bb0de4
·
verified ·
1 Parent(s): 667becc

fix(amaru): register native /v1/honest + /v1/lambda BEFORE app.mount(/api/amaru) so the sub-app no longer shadows them (404->200). Doctrine v11. ADDITIVE. Opus HF cleanup.

Browse files
Files changed (1) hide show
  1. serve.py +45 -44
serve.py CHANGED
@@ -107,6 +107,51 @@ async def healthz_wire_d(request: Request) -> JSONResponse:
107
  })
108
 
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  # ---------------------------------------------------------------------------
111
  # PER-APP BRAIN (amaru = cortex / reasoning) + UNIFIED LLM ROUTER + Wire E/F.
112
  # Registered on the ROOT app BEFORE the /api/amaru mount so they take precedence.
@@ -486,50 +531,6 @@ if _codeproxy is not None:
486
  print(f"[amaru.code] code proxy registration degraded: {_e}")
487
 
488
 
489
- # ---------------------------------------------------------------------------
490
- # Native doctrine surfaces /api/amaru/v1/honest + /v1/lambda (ADDITIVE, Doctrine
491
- # v11). Registered on main app BEFORE the SPA catch-all so they resolve as JSON
492
- # (previously /v1/honest 404'd and /v1/lambda fell through to the SPA shell).
493
- # ZERO BANDAID: 13-axis geometric-mean Λ, canonical numbers 749/14/163.
494
- # ---------------------------------------------------------------------------
495
- _AMARU_AXIS_NAMES = [
496
- "soundness", "calibration", "robustness", "provenance", "consent", "reversibility",
497
- "transparency", "fairness", "containment", "attestation", "freshness", "authority", "auditability",
498
- ]
499
-
500
-
501
- @app.get("/api/amaru/v1/honest")
502
- async def amaru_honest() -> JSONResponse:
503
- return JSONResponse({
504
- "doctrine": "v11",
505
- "declarations": 749, "axioms_unique": 14, "axioms_raw": 15, "sorries_total": 163,
506
- "sorries_baseline": 112, "sorries_putnam": 51, "trust_axes": 13,
507
- "lambda_uniqueness": "Conjecture, not a closed theorem (open CAUCHY_ND sorry + missing symmetry axiom)",
508
- "slsa": "L1 (honest)",
509
- "receipts": "DSSE envelopes from the amaru tick endpoint; Sigstore CI signing PENDING (PLACEHOLDER).",
510
- "memory": "7-chakra cortex; Cardano-anchored receipts are demo-seeded, not on-chain mainnet.",
511
- "hatun_willay": True,
512
- })
513
-
514
-
515
- @app.get("/api/amaru/v1/lambda")
516
- async def amaru_lambda() -> JSONResponse:
517
- import math as _m
518
- axes = [0.92, 0.91, 0.93, 0.90, 0.94, 0.91, 0.92, 0.93, 0.90, 0.91, 0.94, 0.92, 0.93]
519
- floor = 0.90
520
- clamped = [min(1.0, max(1e-9, float(x))) for x in axes]
521
- L = _m.exp(sum(_m.log(x) for x in clamped) / len(clamped))
522
- return JSONResponse({
523
- "trust_axes": 13,
524
- "axes": [{"name": n, "score": s} for n, s in zip(_AMARU_AXIS_NAMES, axes)],
525
- "lambda": round(L, 6), "lambda_floor": floor, "pass": L >= floor,
526
- "aggregate": "geometric mean (yuyay_v3 canonical, 13-axis)",
527
- "uniqueness": "Conjecture, not a Theorem (open CAUCHY_ND sorry + missing symmetry axiom)",
528
- "declarations": 749, "axioms_unique": 14, "axioms_raw": 15, "sorries_total": 163,
529
- "doctrine": "v11",
530
- })
531
-
532
-
533
  @app.get("/{path:path}")
534
  async def serve_spa(path: str):
535
  file_path = STATIC_DIR / path
 
107
  })
108
 
109
 
110
+ # ---------------------------------------------------------------------------
111
+ # Native doctrine surfaces /api/amaru/v1/honest + /v1/lambda (ADDITIVE, Doctrine
112
+ # v11). MUST be registered BEFORE app.mount("/api/amaru", amaru_app) below — the
113
+ # mounted sub-app would otherwise shadow these paths (it 404'd them). Same
114
+ # precedence trick the healthz route above uses. ZERO BANDAID: 13-axis
115
+ # geometric-mean Λ, canonical numbers 749/14/163. (Opus HF cleanup.)
116
+ # ---------------------------------------------------------------------------
117
+ _AMARU_AXIS_NAMES = [
118
+ "soundness", "calibration", "robustness", "provenance", "consent", "reversibility",
119
+ "transparency", "fairness", "containment", "attestation", "freshness", "authority", "auditability",
120
+ ]
121
+
122
+
123
+ @app.get("/api/amaru/v1/honest")
124
+ async def amaru_honest() -> JSONResponse:
125
+ return JSONResponse({
126
+ "doctrine": "v11",
127
+ "declarations": 749, "axioms_unique": 14, "axioms_raw": 15, "sorries_total": 163,
128
+ "sorries_baseline": 112, "sorries_putnam": 51, "trust_axes": 13,
129
+ "lambda_uniqueness": "Conjecture, not a closed theorem (open CAUCHY_ND sorry + missing symmetry axiom)",
130
+ "slsa": "L1 (honest)",
131
+ "receipts": "DSSE envelopes from the amaru tick endpoint; Sigstore CI signing PENDING (PLACEHOLDER).",
132
+ "memory": "7-chakra cortex; Cardano-anchored receipts are demo-seeded, not on-chain mainnet.",
133
+ "hatun_willay": True,
134
+ })
135
+
136
+
137
+ @app.get("/api/amaru/v1/lambda")
138
+ async def amaru_lambda() -> JSONResponse:
139
+ import math as _m
140
+ axes = [0.92, 0.91, 0.93, 0.90, 0.94, 0.91, 0.92, 0.93, 0.90, 0.91, 0.94, 0.92, 0.93]
141
+ floor = 0.90
142
+ clamped = [min(1.0, max(1e-9, float(x))) for x in axes]
143
+ L = _m.exp(sum(_m.log(x) for x in clamped) / len(clamped))
144
+ return JSONResponse({
145
+ "trust_axes": 13,
146
+ "axes": [{"name": n, "score": s} for n, s in zip(_AMARU_AXIS_NAMES, axes)],
147
+ "lambda": round(L, 6), "lambda_floor": floor, "pass": L >= floor,
148
+ "aggregate": "geometric mean (yuyay_v3 canonical, 13-axis)",
149
+ "uniqueness": "Conjecture, not a Theorem (open CAUCHY_ND sorry + missing symmetry axiom)",
150
+ "declarations": 749, "axioms_unique": 14, "axioms_raw": 15, "sorries_total": 163,
151
+ "doctrine": "v11",
152
+ })
153
+
154
+
155
  # ---------------------------------------------------------------------------
156
  # PER-APP BRAIN (amaru = cortex / reasoning) + UNIFIED LLM ROUTER + Wire E/F.
157
  # Registered on the ROOT app BEFORE the /api/amaru mount so they take precedence.
 
531
  print(f"[amaru.code] code proxy registration degraded: {_e}")
532
 
533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
  @app.get("/{path:path}")
535
  async def serve_spa(path: str):
536
  file_path = STATIC_DIR / path