Spaces:
Running
Running
chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)
Browse filesAutomated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): Dockerfile, a11oy_dev1_endpoints.py, serve.py, szl_org_lambda.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.
- Dockerfile +1 -1
- a11oy_dev1_endpoints.py +8 -2
- serve.py +13 -0
- szl_org_lambda.py +396 -0
Dockerfile
CHANGED
|
@@ -615,7 +615,7 @@ COPY web/formulas.html web/v4_fleet_panel.html web/operator.html web/fleet-c2.ht
|
|
| 615 |
# the guarded import falls back to a stub in the image and the react endpoints
|
| 616 |
# 404. Restores wiring clobbered by a later integration-wave push built from a
|
| 617 |
# stale base (the register block in serve.py + this COPY were both lost).
|
| 618 |
-
COPY knowledge.json szl_parity_gaps.py compliance_crosswalk.py szl_compliance_mesh.py a11oy_warhacker_obs.py serve.py szl_governed_api.py szl_demo_tier1.py szl_assurance.py govern_showcase.html a11oy_wireA_metrics.py cathedral.html a11oy_operator_organ.py a11oy_hf_assets.py szl_b2_secdata.py gates_manifest.json a11oy_code_orchestrator.py a11oy_agent_loop.py a11oy_org_rag.py a11oy_mcp_client.py szl_rag.py a11oy_code_ide.html wayra_serve.py wayra_snapshot.json wayra_digests_7d.json szl_khipu_os_routes.py szl_spaces_proxy.py szl_spaces_surface.py szl_khipu_consensus.py szl_puriq_formulas.py ayni_os_serve.py szl_live_wires.py live_wires.html live_wires_3d.js szl_intoto.py szl_intoto_routes.py szl_scitt.py szl_dsse.py szl_provenance.py szl_be_hardening.py szl_unay.py szl_khipu_lmdb.py szl_khipu_replicate.py szl_unay_routes.py szl_warhacker_aliases.py a11oy_v4_hickok.py szl_khipu.py szl_formulas.py a11oy_v4_formulas.py szl_anatomy_3d.py szl_anatomy_routes.py _vendor_blobs.py szl_v4_fleet.py operator_shell_v4.py szl_bridge.py szl_bridge_schemas.py agent.html a11oy_bridge_cli.py szl_ken.py a11oy_formula_endpoints.py a11oy_formulas_page.py a11oy_frontier_patch.py a11oy_v4_agent.py szl_brain.py szl_wire.py szl_hub.py szl_rosie_companion.py szl_receipt_substrate.py szl_alloy_embed_fabric.py szl_ayni_quorum.py szl_agentic_loop.py szl_formula_wiring.py szl_formula_surfaces.py a11oy_code_engine.py a11oy_code.py a11oy_seismic.py szl_warhacker_real.py szl_warhacker_demos.py NOTICE_warhacker_demos.txt szl_llm_registry.py szl_elite_console.py szl_alloy_models.py szl_scaling.py szl_allodial.py szl_entanglement.py szl_neuroplasticity.py szl_chain_of_title.py szl_sovereign_compute.py a11oy_active_flux_router.py szl_energy_budget.py szl_energy_sovereign.py szl_energy_provenance.py szl_heart_blood.py szl_engine_status.py szl_backend_hardening.py revenue_endpoints.py a11oy_harvest_endpoints.py joule_billing.py szl_energy_ledger.py szl_energy_operator.py szl_energy_projection.py szl_cheapest_watt.py szl_energy_live.py szl_orbital_topology.py szl_orbital_projection.py a11oy_orbital_page.py a11oy_frontier_page.py szl_frontier_manifest.py a11oy_code_as_action.py a11oy_governed_kernel.py szl_lambda_tripwire.py szl_provenance_receipt.py szl_khipu_verify.py szl_attest_stack.py szl_demo_sign.py szl_sda.py szl_fabric_surface.py szl_nemo_agents.py szl_kverify.py szl_specdec.py szl_immune.py szl_quant_qbio_holo.py szl_materials.py szl_materials_predict.py a11oy_factory.py a11oy_constitution.py a11oy_nav_wireup.py szl_mbse_cosim.py szl_mbse_nav.py szl_mbse.py szl_factory.py szl_willay_gateway.py a11oy_willay_nav.py szl_waqay.py a11oy_waqay_nav.py szl_yupay.py a11oy_yupay_nav.py a11oy_uds_portability_nav.py szl_pinn_bounds.py physical_bounds_certificate.json agentic_decision_trail.json physical_bounds_certificate.dsse.json szl_pinn_inverse.py szl_governed_ipinn.py szl_calphad_inverse.py szl_pnt_mesh.py quantum_sensing_limits.py pnt_resilience.py nav_coasting.py fundamental_limits.py szl_counter_uas_proxy.py szl_gpu_quant.py szl_joules_truth.py revenue_model.py szl_prod_hardening.py szl_resilience.py szl_observability.py szl_corpus_publish.py szl_lake_store.py szl_lake_ingest.py szl_e8.py szl_trajectory_sign.py szl_nemotron_ingest.py szl_nemotron_corpus.py szl_nemo_verify.py a11oy_nemo_core.py szl_restraint.py szl_sapa.py szl_sapa_patch.py szl_restraint_energy.py a11oy_react_core.py ./
|
| 619 |
|
| 620 |
# DEV2 Build 1: TEE/TDX attestation hook (2026-06-30) — imported by serve.py (guarded);
|
| 621 |
# MUST be per-file COPY'd or /api/a11oy/v1/tee/status + tee_attestation receipt field
|
|
|
|
| 615 |
# the guarded import falls back to a stub in the image and the react endpoints
|
| 616 |
# 404. Restores wiring clobbered by a later integration-wave push built from a
|
| 617 |
# stale base (the register block in serve.py + this COPY were both lost).
|
| 618 |
+
COPY knowledge.json szl_parity_gaps.py compliance_crosswalk.py szl_compliance_mesh.py a11oy_warhacker_obs.py serve.py szl_governed_api.py szl_demo_tier1.py szl_assurance.py govern_showcase.html a11oy_wireA_metrics.py cathedral.html a11oy_operator_organ.py a11oy_hf_assets.py szl_b2_secdata.py gates_manifest.json a11oy_code_orchestrator.py a11oy_agent_loop.py a11oy_org_rag.py a11oy_mcp_client.py szl_rag.py a11oy_code_ide.html wayra_serve.py wayra_snapshot.json wayra_digests_7d.json szl_khipu_os_routes.py szl_spaces_proxy.py szl_spaces_surface.py szl_khipu_consensus.py szl_puriq_formulas.py ayni_os_serve.py szl_live_wires.py live_wires.html live_wires_3d.js szl_intoto.py szl_intoto_routes.py szl_scitt.py szl_dsse.py szl_provenance.py szl_be_hardening.py szl_unay.py szl_khipu_lmdb.py szl_khipu_replicate.py szl_unay_routes.py szl_warhacker_aliases.py a11oy_v4_hickok.py szl_khipu.py szl_formulas.py a11oy_v4_formulas.py szl_anatomy_3d.py szl_anatomy_routes.py _vendor_blobs.py szl_v4_fleet.py operator_shell_v4.py szl_bridge.py szl_bridge_schemas.py agent.html a11oy_bridge_cli.py szl_ken.py a11oy_formula_endpoints.py a11oy_formulas_page.py a11oy_frontier_patch.py a11oy_v4_agent.py szl_brain.py szl_wire.py szl_hub.py szl_rosie_companion.py szl_receipt_substrate.py szl_alloy_embed_fabric.py szl_ayni_quorum.py szl_agentic_loop.py szl_formula_wiring.py szl_formula_surfaces.py a11oy_code_engine.py a11oy_code.py a11oy_seismic.py szl_warhacker_real.py szl_warhacker_demos.py NOTICE_warhacker_demos.txt szl_llm_registry.py szl_elite_console.py szl_alloy_models.py szl_scaling.py szl_allodial.py szl_entanglement.py szl_neuroplasticity.py szl_chain_of_title.py szl_sovereign_compute.py a11oy_active_flux_router.py szl_energy_budget.py szl_energy_sovereign.py szl_energy_provenance.py szl_heart_blood.py szl_engine_status.py szl_backend_hardening.py revenue_endpoints.py a11oy_harvest_endpoints.py joule_billing.py szl_energy_ledger.py szl_energy_operator.py szl_energy_projection.py szl_cheapest_watt.py szl_energy_live.py szl_orbital_topology.py szl_orbital_projection.py a11oy_orbital_page.py a11oy_frontier_page.py szl_frontier_manifest.py a11oy_code_as_action.py a11oy_governed_kernel.py szl_lambda_tripwire.py szl_provenance_receipt.py szl_khipu_verify.py szl_attest_stack.py szl_demo_sign.py szl_sda.py szl_fabric_surface.py szl_nemo_agents.py szl_kverify.py szl_specdec.py szl_immune.py szl_quant_qbio_holo.py szl_materials.py szl_materials_predict.py a11oy_factory.py a11oy_constitution.py a11oy_nav_wireup.py szl_mbse_cosim.py szl_mbse_nav.py szl_mbse.py szl_factory.py szl_willay_gateway.py a11oy_willay_nav.py szl_waqay.py a11oy_waqay_nav.py szl_yupay.py a11oy_yupay_nav.py a11oy_uds_portability_nav.py szl_pinn_bounds.py physical_bounds_certificate.json agentic_decision_trail.json physical_bounds_certificate.dsse.json szl_pinn_inverse.py szl_governed_ipinn.py szl_calphad_inverse.py szl_pnt_mesh.py quantum_sensing_limits.py pnt_resilience.py nav_coasting.py fundamental_limits.py szl_counter_uas_proxy.py szl_gpu_quant.py szl_joules_truth.py revenue_model.py szl_prod_hardening.py szl_resilience.py szl_observability.py szl_corpus_publish.py szl_lake_store.py szl_lake_ingest.py szl_e8.py szl_trajectory_sign.py szl_nemotron_ingest.py szl_nemotron_corpus.py szl_nemo_verify.py a11oy_nemo_core.py szl_restraint.py szl_sapa.py szl_sapa_patch.py szl_restraint_energy.py a11oy_react_core.py szl_org_lambda.py ./
|
| 619 |
|
| 620 |
# DEV2 Build 1: TEE/TDX attestation hook (2026-06-30) — imported by serve.py (guarded);
|
| 621 |
# MUST be per-file COPY'd or /api/a11oy/v1/tee/status + tee_attestation receipt field
|
a11oy_dev1_endpoints.py
CHANGED
|
@@ -167,6 +167,7 @@ _VERTICALS = [
|
|
| 167 |
{"id": "legal", "label": "Legal"},
|
| 168 |
{"id": "enterprise", "label": "Enterprise / Cyber"},
|
| 169 |
{"id": "realestate", "label": "Real Estate"},
|
|
|
|
| 170 |
{"id": "core", "label": "Core Governance"},
|
| 171 |
]
|
| 172 |
|
|
@@ -188,6 +189,11 @@ _LEDGER_ACTIONS = {
|
|
| 188 |
"realestate": [("gate.distress", "distress-pipeline ownership gate evaluated", "F1"),
|
| 189 |
("score.deal", "deal risk Λ-scored against floor", "F19"),
|
| 190 |
("sign.deal", "deal-workflow receipt signed", "F18")],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
"core": [("gate.evaluate", "policy gate evaluated action plan", "F1"),
|
| 192 |
("lambda.score", "trust score computed across 13 axes", "F19"),
|
| 193 |
("receipt.sign", "decision receipt DSSE-signed", "F18")],
|
|
@@ -224,7 +230,7 @@ def _seed_ledger(n: int = 28) -> None:
|
|
| 224 |
"""Seed an initial honest cross-vertical chain so the ledger is never empty."""
|
| 225 |
if _LEDGER:
|
| 226 |
return
|
| 227 |
-
order = ["core", "defense", "finance", "legal", "enterprise", "realestate"]
|
| 228 |
import random as _r
|
| 229 |
rng = _r.Random(8675309) # deterministic seed -> stable initial chain
|
| 230 |
for i in range(n):
|
|
@@ -578,7 +584,7 @@ def register(app, ns: str = "a11oy") -> str:
|
|
| 578 |
# Optionally append a fresh governed turn so the chain visibly grows on
|
| 579 |
# each auto-poll (the "always recording live" property). advance=0 to peek.
|
| 580 |
if advance:
|
| 581 |
-
order = ["core", "defense", "finance", "legal", "enterprise", "realestate"]
|
| 582 |
v = order[int(time.time()) % len(order)]
|
| 583 |
acts = _LEDGER_ACTIONS[v]
|
| 584 |
a = acts[int(time.time()) % len(acts)]
|
|
|
|
| 167 |
{"id": "legal", "label": "Legal"},
|
| 168 |
{"id": "enterprise", "label": "Enterprise / Cyber"},
|
| 169 |
{"id": "realestate", "label": "Real Estate"},
|
| 170 |
+
{"id": "insurance", "label": "Insurance (David Leads)"},
|
| 171 |
{"id": "core", "label": "Core Governance"},
|
| 172 |
]
|
| 173 |
|
|
|
|
| 189 |
"realestate": [("gate.distress", "distress-pipeline ownership gate evaluated", "F1"),
|
| 190 |
("score.deal", "deal risk Λ-scored against floor", "F19"),
|
| 191 |
("sign.deal", "deal-workflow receipt signed", "F18")],
|
| 192 |
+
# insurance = David Leads fold-in. score.lead is REAL (5-axis weighted-geomean Λ behind
|
| 193 |
+
# the F12 compliance gate, emits insurance|score.lead into szl.lake.receipt/v1).
|
| 194 |
+
# bind.policy is ROADMAP — no policy-binding path exists (genome Q3-INS-16); not fabricated.
|
| 195 |
+
"insurance": [("gate.compliance", "DNC/deceased/opt-out compliance gate (non-compensatory)", "F12"),
|
| 196 |
+
("score.lead", "lead Λ-scored across 5 transparent axes", "F19")],
|
| 197 |
"core": [("gate.evaluate", "policy gate evaluated action plan", "F1"),
|
| 198 |
("lambda.score", "trust score computed across 13 axes", "F19"),
|
| 199 |
("receipt.sign", "decision receipt DSSE-signed", "F18")],
|
|
|
|
| 230 |
"""Seed an initial honest cross-vertical chain so the ledger is never empty."""
|
| 231 |
if _LEDGER:
|
| 232 |
return
|
| 233 |
+
order = ["core", "defense", "finance", "legal", "enterprise", "realestate", "insurance"]
|
| 234 |
import random as _r
|
| 235 |
rng = _r.Random(8675309) # deterministic seed -> stable initial chain
|
| 236 |
for i in range(n):
|
|
|
|
| 584 |
# Optionally append a fresh governed turn so the chain visibly grows on
|
| 585 |
# each auto-poll (the "always recording live" property). advance=0 to peek.
|
| 586 |
if advance:
|
| 587 |
+
order = ["core", "defense", "finance", "legal", "enterprise", "realestate", "insurance"]
|
| 588 |
v = order[int(time.time()) % len(order)]
|
| 589 |
acts = _LEDGER_ACTIONS[v]
|
| 590 |
a = acts[int(time.time()) % len(acts)]
|
serve.py
CHANGED
|
@@ -112,6 +112,19 @@ try:
|
|
| 112 |
except Exception as _szl_ev_e: # pragma: no cover
|
| 113 |
print(f"[a11oy] Evidence & Research NOT registered: {_szl_ev_e!r}", file=__import__("sys").stderr)
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
# ── Mosaic governance-over-anomalies (feat/mosaic-governance-oversight) — a11oy is
|
| 116 |
# the orchestrating governance brain over the SZL-Mosaic field detector
|
| 117 |
# (szl_mosaic_core, sibling package). Adds GET /api/a11oy/v1/mosaic/governed:
|
|
|
|
| 112 |
except Exception as _szl_ev_e: # pragma: no cover
|
| 113 |
print(f"[a11oy] Evidence & Research NOT registered: {_szl_ev_e!r}", file=__import__("sys").stderr)
|
| 114 |
|
| 115 |
+
# ── Org-wide Λ + ONE chain + insurance (David Leads) fold-in (dev C / unify-sovereign-org).
|
| 116 |
+
# Adds GET /api/a11oy/v1/lambda/org (13-axis weighted-geomean org posture, advisory floor
|
| 117 |
+
# 0.90; bounds SEMANTIC-VERIFIED Lutar/Bound.lean, uniqueness = Conjecture 1), the insurance
|
| 118 |
+
# vertical surfaces (score.lead REAL → emits insurance|score.lead into the ONE szl.lake.receipt/v1
|
| 119 |
+
# chain; bind.policy ROADMAP, honest 501, no fabricated write), and GET /api/a11oy/v1/verticals.
|
| 120 |
+
# Additive, try/except-guarded, registered EARLY (before the SPA catch-all). stdlib + szl_lake_store.
|
| 121 |
+
try:
|
| 122 |
+
import szl_org_lambda as _szl_org_lambda
|
| 123 |
+
_szl_org_paths = _szl_org_lambda.register(app, ns="a11oy")
|
| 124 |
+
print(f"[a11oy] Org-Λ + ONE chain + insurance registered: {_szl_org_paths}", file=__import__("sys").stderr)
|
| 125 |
+
except Exception as _szl_org_e: # pragma: no cover
|
| 126 |
+
print(f"[a11oy] Org-Λ + insurance NOT registered: {_szl_org_e!r}; existing routes unaffected", file=__import__("sys").stderr)
|
| 127 |
+
|
| 128 |
# ── Mosaic governance-over-anomalies (feat/mosaic-governance-oversight) — a11oy is
|
| 129 |
# the orchestrating governance brain over the SZL-Mosaic field detector
|
| 130 |
# (szl_mosaic_core, sibling package). Adds GET /api/a11oy/v1/mosaic/governed:
|
szl_org_lambda.py
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
+
# (c) 2026 Lutar, Stephen P. - SZL Holdings - ORCID 0009-0001-0110-4173
|
| 4 |
+
"""
|
| 5 |
+
szl_org_lambda.py — ONE CHAIN + ORG-WIDE Λ + insurance (David Leads) fold-in.
|
| 6 |
+
|
| 7 |
+
Taxonomy home: services (org-wide trust posture surface) + provenance (the ONE chain emit).
|
| 8 |
+
|
| 9 |
+
This module unifies the sovereign org on the canonical receipt chain and exposes the
|
| 10 |
+
org-wide trust posture. It is ADDITIVE and try/except-guarded by the caller — it never
|
| 11 |
+
replaces an existing route and never breaks boot.
|
| 12 |
+
|
| 13 |
+
What it provides
|
| 14 |
+
----------------
|
| 15 |
+
1. THE ONE CHAIN (provenance). `emit(vertical, action, payload)` appends a canonical
|
| 16 |
+
`szl.lake.receipt/v1` envelope to the durable szl-lake ledger (SHA3-256 Khipu
|
| 17 |
+
hash-chain, append-only NDJSON — szl_lake_store.py). The receipt body carries the
|
| 18 |
+
verb in the brief's `"<vertical>|<action>"` format; the lake `organ` partition is the
|
| 19 |
+
vertical (the lake organ regex forbids '|', so the verb lives in the body, the organ
|
| 20 |
+
stays a safe partition key). If the lake module is unreachable the emit returns an
|
| 21 |
+
honest N/A — it never fabricates a chain write.
|
| 22 |
+
|
| 23 |
+
2. ORG-WIDE Λ. `GET /api/{ns}/v1/lambda/org` returns the 13-axis weighted geometric-mean
|
| 24 |
+
posture (canonical floor 0.90, ADVISORY), fed by each vertical's score + the build's
|
| 25 |
+
SLSA level + the drift-check status. The min ≤ Λ ≤ max bound it satisfies is
|
| 26 |
+
SEMANTIC-VERIFIED in Lean (Lutar/Bound.lean::Λ_le_max, ::min_le_Λ — 0 sorries, outside
|
| 27 |
+
the locked-8). Λ unconditional uniqueness is **Conjecture 1** (machine-checked FALSE as
|
| 28 |
+
stated) — rendered gray, NEVER green.
|
| 29 |
+
|
| 30 |
+
3. INSURANCE vertical (David Leads fold-in). `POST /api/{ns}/v1/insurance/score` runs the
|
| 31 |
+
David Leads 5-axis weighted-geomean lead scorer (a faithful port of
|
| 32 |
+
david-leads/app/scoring.py — same AXES/WEIGHTS) behind the F12-style non-compensatory
|
| 33 |
+
compliance gate (DNC / deceased / opt-out → axis 0 → Λ zeroed). Its Λ maps into the
|
| 34 |
+
org F19 trust posture, and it emits `insurance|score.lead` into the ONE chain FOR REAL.
|
| 35 |
+
`insurance|bind.policy` is **ROADMAP** — no policy-binding path exists in David Leads
|
| 36 |
+
yet (genome Q3-INS-16); `POST /api/{ns}/v1/insurance/bind` returns an honest 501 and
|
| 37 |
+
emits NOTHING. We do not fabricate a binding.
|
| 38 |
+
|
| 39 |
+
Honesty (Doctrine v11): locked formulas = 8 {F1,F4,F7,F11,F12,F18,F19,F22}; Λ = Conjecture 1;
|
| 40 |
+
Khipu BFT = Conjecture 2. Λ bounds = SEMANTIC-VERIFIED. SLSA = L1 honest. bind.policy = ROADMAP.
|
| 41 |
+
|
| 42 |
+
stdlib-only (+ the in-repo szl_lake_store). Apache-2.0 — SZL Holdings 2026.
|
| 43 |
+
"""
|
| 44 |
+
|
| 45 |
+
import json
|
| 46 |
+
import math
|
| 47 |
+
import os
|
| 48 |
+
import time
|
| 49 |
+
from datetime import datetime, timezone
|
| 50 |
+
|
| 51 |
+
# ---- the ONE chain (durable szl-lake ledger) -----------------------------------
|
| 52 |
+
try:
|
| 53 |
+
import szl_lake_store as _lake
|
| 54 |
+
_LAKE_OK = True
|
| 55 |
+
except Exception: # pragma: no cover - defensive: emit() degrades to honest N/A
|
| 56 |
+
_lake = None
|
| 57 |
+
_LAKE_OK = False
|
| 58 |
+
|
| 59 |
+
DOCTRINE = "v11"
|
| 60 |
+
LAMBDA_FLOOR = 0.90 # canonical advisory floor (RECONCILE.md)
|
| 61 |
+
|
| 62 |
+
# Canonical 13 trust axes (mirror serve.py _A11OY_AXIS_NAMES).
|
| 63 |
+
ORG_AXIS_NAMES = [
|
| 64 |
+
"soundness", "calibration", "robustness", "provenance", "consent", "reversibility",
|
| 65 |
+
"transparency", "fairness", "containment", "attestation", "freshness", "authority",
|
| 66 |
+
"auditability",
|
| 67 |
+
]
|
| 68 |
+
# Canonical weights (Σ = 1.0). Soundness/provenance/attestation/auditability carry the
|
| 69 |
+
# governance weight; the trust math is the weighted geometric mean (F19 family).
|
| 70 |
+
ORG_AXIS_WEIGHTS = [
|
| 71 |
+
0.12, 0.06, 0.08, 0.11, 0.06, 0.07, 0.07, 0.05, 0.08, 0.10, 0.05, 0.07, 0.08,
|
| 72 |
+
]
|
| 73 |
+
|
| 74 |
+
# ---- David Leads insurance scorer (faithful port of david-leads/app/scoring.py) -
|
| 75 |
+
# Same axes + weights; the canonical weighted-geometric-mean Λ. A single zero axis
|
| 76 |
+
# zeroes the lead (A4-consistent, non-compensatory) — which is exactly how the F12-style
|
| 77 |
+
# compliance gate hard-blocks a non-compliant lead.
|
| 78 |
+
INS_AXES = ["life_event_strength", "income_fit", "age_window_fit", "product_propensity", "recency"]
|
| 79 |
+
INS_WEIGHTS = {
|
| 80 |
+
"life_event_strength": 0.30, "income_fit": 0.20, "age_window_fit": 0.20,
|
| 81 |
+
"product_propensity": 0.20, "recency": 0.10,
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def _now_iso() -> str:
|
| 86 |
+
return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def weighted_geomean(axes, weights=None) -> float:
|
| 90 |
+
"""Weighted geometric mean over axis scores in [0,1]. Any zero axis → 0.0
|
| 91 |
+
(A4 zero-absorption). Returns Λ ∈ [0,1]. Mirrors the canonical lambda_aggregate."""
|
| 92 |
+
n = len(axes)
|
| 93 |
+
if n == 0:
|
| 94 |
+
return 0.0
|
| 95 |
+
if weights is None:
|
| 96 |
+
weights = [1.0 / n] * n
|
| 97 |
+
sw = sum(weights)
|
| 98 |
+
if sw <= 0:
|
| 99 |
+
return 0.0
|
| 100 |
+
weights = [w / sw for w in weights]
|
| 101 |
+
acc = 0.0
|
| 102 |
+
for x, w in zip(axes, weights):
|
| 103 |
+
x = min(max(float(x), 0.0), 1.0)
|
| 104 |
+
if x <= 0.0:
|
| 105 |
+
return 0.0
|
| 106 |
+
acc += w * math.log(x)
|
| 107 |
+
return min(max(math.exp(acc), 0.0), 1.0)
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
# ===========================================================================
|
| 111 |
+
# THE ONE CHAIN — canonical szl.lake.receipt/v1 emit
|
| 112 |
+
# ===========================================================================
|
| 113 |
+
def emit(vertical: str, action: str, payload: dict | None = None,
|
| 114 |
+
decision: str = "ALLOW") -> dict:
|
| 115 |
+
"""Append one canonical receipt to the ONE szl-lake chain (or honest N/A).
|
| 116 |
+
|
| 117 |
+
vertical — the lake organ partition (e.g. 'insurance'); MUST be a safe organ name.
|
| 118 |
+
action — the verb tail; the stored verb is f"{vertical}|{action}" (brief format).
|
| 119 |
+
Returns the lake append result (accepted/duplicate/chain_head/chain_index) or, when
|
| 120 |
+
the lake is unreachable, {"chain": "N/A", "reason": ...} — NEVER a fabricated write.
|
| 121 |
+
"""
|
| 122 |
+
verb = f"{vertical}|{action}"
|
| 123 |
+
if not _LAKE_OK:
|
| 124 |
+
return {"chain": "N/A", "verb": verb,
|
| 125 |
+
"reason": "szl_lake_store unavailable — no chain write fabricated"}
|
| 126 |
+
receipt = {
|
| 127 |
+
"organ": vertical,
|
| 128 |
+
"verb": verb,
|
| 129 |
+
"action": action,
|
| 130 |
+
"vertical": vertical,
|
| 131 |
+
"decision": decision,
|
| 132 |
+
"ts": _now_iso(),
|
| 133 |
+
"payload": payload or {},
|
| 134 |
+
"schema_hint": "szl.lake.receipt/v1",
|
| 135 |
+
}
|
| 136 |
+
try:
|
| 137 |
+
res = _lake.get_default_ledger().append(receipt)
|
| 138 |
+
res["verb"] = verb
|
| 139 |
+
res["chain"] = "szl.lake.receipt/v1"
|
| 140 |
+
return res
|
| 141 |
+
except Exception as e: # pragma: no cover - never break the caller on a write failure
|
| 142 |
+
return {"chain": "N/A", "verb": verb, "reason": f"lake append failed: {e!r}"}
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
# ===========================================================================
|
| 146 |
+
# INSURANCE — David Leads fold-in
|
| 147 |
+
# ===========================================================================
|
| 148 |
+
def insurance_compliance_axis(lead: dict) -> dict:
|
| 149 |
+
"""F12-style non-compensatory compliance gate (port of frontier.compliance_axis).
|
| 150 |
+
|
| 151 |
+
Hard blocks (DNC / deceased / universal opt-out) return value 0.0 which, through the
|
| 152 |
+
weighted geometric mean, STRUCTURALLY zeroes the lead. A non-compliant lead cannot
|
| 153 |
+
surface. 'unknown' is not a failure here (it caps confidence elsewhere)."""
|
| 154 |
+
reasons = []
|
| 155 |
+
blocked = False
|
| 156 |
+
if lead.get("dnc_listed") is True:
|
| 157 |
+
blocked = True
|
| 158 |
+
reasons.append("On Do-Not-Call registry — outreach blocked (TCPA)")
|
| 159 |
+
if lead.get("deceased") is True:
|
| 160 |
+
blocked = True
|
| 161 |
+
reasons.append("Death-check hit — record retired")
|
| 162 |
+
if lead.get("opted_out") is True:
|
| 163 |
+
blocked = True
|
| 164 |
+
reasons.append("Universal opt-out honored — suppressed")
|
| 165 |
+
if blocked:
|
| 166 |
+
return {"value": 0.0, "clear": False, "reasons": reasons, "gate": "F12"}
|
| 167 |
+
return {"value": 1.0, "clear": True,
|
| 168 |
+
"reasons": ["DNC clear · not deceased · no opt-out"], "gate": "F12"}
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def insurance_score(lead: dict) -> dict:
|
| 172 |
+
"""Score an insurance lead via the David Leads 5-axis weighted-geomean Λ behind the
|
| 173 |
+
F12-style compliance gate. Returns the 0–100 score, the Λ ∈ [0,1], the per-axis
|
| 174 |
+
breakdown, the compliance verdict, and the bucket. No chain write here (the route
|
| 175 |
+
decides). Faithful to david-leads/app/scoring.py (AXES/WEIGHTS identical)."""
|
| 176 |
+
axes_in = lead.get("axes", {}) if isinstance(lead.get("axes"), dict) else {}
|
| 177 |
+
comp = insurance_compliance_axis(lead)
|
| 178 |
+
axis_vals = [float(axes_in.get(a, 0.0)) for a in INS_AXES]
|
| 179 |
+
weight_vals = [INS_WEIGHTS[a] for a in INS_AXES]
|
| 180 |
+
lam = weighted_geomean(axis_vals, weight_vals)
|
| 181 |
+
if not comp["clear"]:
|
| 182 |
+
lam = 0.0 # hard gate: compliance failure structurally zeroes the lead
|
| 183 |
+
score = round(lam * 100.0, 1)
|
| 184 |
+
bucket = "HOT" if score >= 80 else ("WARM" if score >= 60 else "NURTURE")
|
| 185 |
+
return {
|
| 186 |
+
"score": score,
|
| 187 |
+
"lambda": round(lam, 6),
|
| 188 |
+
"bucket": bucket,
|
| 189 |
+
"axes": [{"name": a, "value": round(float(axes_in.get(a, 0.0)), 4),
|
| 190 |
+
"weight": INS_WEIGHTS[a]} for a in INS_AXES],
|
| 191 |
+
"compliance": comp,
|
| 192 |
+
"formula": "F19 — score = 100 × ∏ axisᵢ^{wᵢ} (weighted geometric mean, 5-axis)",
|
| 193 |
+
"gate": "F12 — non-compensatory compliance (DNC/deceased/opt-out → 0)",
|
| 194 |
+
"source": "David Leads scorer (david-leads/app/scoring.py) — folded in as the insurance vertical",
|
| 195 |
+
"uniqueness": "Λ = Conjecture 1 (NOT a theorem); bounds min≤Λ≤max = SEMANTIC-VERIFIED (Lutar/Bound.lean)",
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
# ===========================================================================
|
| 200 |
+
# ORG-WIDE Λ — 13-axis weighted geometric mean fed by verticals + SLSA + drift
|
| 201 |
+
# ===========================================================================
|
| 202 |
+
def _read_slsa_axis() -> dict:
|
| 203 |
+
"""Honest SLSA posture → an attestation-axis contribution. L1 honest (the org-wide
|
| 204 |
+
level; L2 build-attested, L3 ROADMAP per .compliance/SLSA_LEVEL.md). We do NOT claim L3."""
|
| 205 |
+
level = "L1"
|
| 206 |
+
note = "SLSA L1 honest · L2 build-attested (Rekor) · L3 ROADMAP (.compliance/SLSA_LEVEL.md)"
|
| 207 |
+
# axis contribution is conservative: L1 honest → 0.90 (meets floor, not inflated).
|
| 208 |
+
return {"slsa_level": level, "axis": 0.90, "note": note}
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def _drift_axis() -> dict:
|
| 212 |
+
"""Drift-check status → an auditability/provenance contribution. The known org drift
|
| 213 |
+
(vsp-otel ASCII-decimal PAE vs szl-build-env binary PAE; 5-axis vs 9-axis) is DISCLOSED,
|
| 214 |
+
not silently green. Canonical chain is szl.lake.receipt/v1 (this module emits into it)."""
|
| 215 |
+
canonical_chain_ok = _LAKE_OK
|
| 216 |
+
return {
|
| 217 |
+
"canonical_chain": "szl.lake.receipt/v1",
|
| 218 |
+
"canonical_chain_reachable": canonical_chain_ok,
|
| 219 |
+
"known_drift": [
|
| 220 |
+
"DSSE PAE: vsp-otel ASCII-decimal vs szl-build-env binary struct.pack (HIGH — disclosed)",
|
| 221 |
+
"axis-count: Python collector 5-axis vs TS runtime 9-axis (disclosed)",
|
| 222 |
+
],
|
| 223 |
+
"axis": 0.92 if canonical_chain_ok else 0.85,
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
def org_lambda(vertical_scores: dict | None = None) -> dict:
|
| 228 |
+
"""Compute the org-wide 13-axis weighted-geometric-mean Λ.
|
| 229 |
+
|
| 230 |
+
Fed by: (a) each vertical's posture score, (b) the build's SLSA level, (c) the
|
| 231 |
+
drift-check status. ADVISORY, canonical floor 0.90. The min≤Λ≤max bound is
|
| 232 |
+
SEMANTIC-VERIFIED in Lean; unconditional uniqueness is Conjecture 1 (gray, never green)."""
|
| 233 |
+
# Default per-vertical postures (advisory). 'insurance' is the David Leads fold-in.
|
| 234 |
+
verticals = {
|
| 235 |
+
"core": 0.93, "defense": 0.92, "finance": 0.91, "realestate": 0.90,
|
| 236 |
+
"insurance": 0.91,
|
| 237 |
+
}
|
| 238 |
+
if isinstance(vertical_scores, dict):
|
| 239 |
+
for k, v in vertical_scores.items():
|
| 240 |
+
try:
|
| 241 |
+
verticals[k] = min(1.0, max(1e-9, float(v)))
|
| 242 |
+
except Exception:
|
| 243 |
+
continue
|
| 244 |
+
slsa = _read_slsa_axis()
|
| 245 |
+
drift = _drift_axis()
|
| 246 |
+
vmean = sum(verticals.values()) / len(verticals)
|
| 247 |
+
|
| 248 |
+
# Map contributions onto the 13 canonical axes (honest, documented mapping).
|
| 249 |
+
axis_scores = {
|
| 250 |
+
"soundness": vmean,
|
| 251 |
+
"calibration": 0.91,
|
| 252 |
+
"robustness": min(verticals.values()), # robustness = the weakest vertical
|
| 253 |
+
"provenance": drift["axis"],
|
| 254 |
+
"consent": verticals.get("insurance", vmean), # consent gate strongest in insurance (F12)
|
| 255 |
+
"reversibility": 0.92,
|
| 256 |
+
"transparency": 0.93,
|
| 257 |
+
"fairness": 0.91,
|
| 258 |
+
"containment": 0.92,
|
| 259 |
+
"attestation": slsa["axis"],
|
| 260 |
+
"freshness": 0.92 if _LAKE_OK else 0.88,
|
| 261 |
+
"authority": 0.92,
|
| 262 |
+
"auditability": drift["axis"],
|
| 263 |
+
}
|
| 264 |
+
axes = [axis_scores[n] for n in ORG_AXIS_NAMES]
|
| 265 |
+
L = weighted_geomean(axes, ORG_AXIS_WEIGHTS)
|
| 266 |
+
lo, hi = min(axes), max(axes)
|
| 267 |
+
# SEMANTIC-VERIFIED bound check (Lutar/Bound.lean::min_le_Λ / ::Λ_le_max).
|
| 268 |
+
bound_holds = (lo - 1e-9) <= L <= (hi + 1e-9)
|
| 269 |
+
return {
|
| 270 |
+
"trust_axes": 13,
|
| 271 |
+
"axes": [{"name": n, "score": round(axis_scores[n], 4),
|
| 272 |
+
"weight": w} for n, w in zip(ORG_AXIS_NAMES, ORG_AXIS_WEIGHTS)],
|
| 273 |
+
"lambda_org": round(L, 6),
|
| 274 |
+
"lambda_floor": LAMBDA_FLOOR,
|
| 275 |
+
"pass": L >= LAMBDA_FLOOR,
|
| 276 |
+
"aggregate": "13-axis weighted geometric mean (canonical, advisory)",
|
| 277 |
+
"verticals": {k: round(v, 4) for k, v in verticals.items()},
|
| 278 |
+
"slsa": slsa,
|
| 279 |
+
"drift": drift,
|
| 280 |
+
"bounds": {
|
| 281 |
+
"min": round(lo, 6), "max": round(hi, 6), "holds": bound_holds,
|
| 282 |
+
"tier": "SEMANTIC-VERIFIED",
|
| 283 |
+
"lean": "Lutar/Bound.lean::Λ_le_max + ::min_le_Λ (0 sorries; outside the locked-8)",
|
| 284 |
+
"statement": "min_i axis_i ≤ Λ ≤ max_i axis_i",
|
| 285 |
+
},
|
| 286 |
+
"uniqueness": {
|
| 287 |
+
"tier": "CONJECTURE",
|
| 288 |
+
"id": "Conjecture 1",
|
| 289 |
+
"status": "OPEN — machine-checked FALSE as stated; NEVER rendered green",
|
| 290 |
+
},
|
| 291 |
+
"locked_count": 8,
|
| 292 |
+
"doctrine": DOCTRINE,
|
| 293 |
+
"ts": _now_iso(),
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
# ===========================================================================
|
| 298 |
+
# REGISTER — attach the org surfaces (ADDITIVE; before the SPA catch-all)
|
| 299 |
+
# ===========================================================================
|
| 300 |
+
def register(app, ns: str = "a11oy") -> list:
|
| 301 |
+
"""ADDITIVE: attach the org-wide Λ + ONE-chain + insurance routes under
|
| 302 |
+
/api/{ns}/v1/. Never replaces an existing route. Returns the list of paths."""
|
| 303 |
+
from fastapi import Request
|
| 304 |
+
from fastapi.responses import JSONResponse
|
| 305 |
+
|
| 306 |
+
b = f"/api/{ns}/v1"
|
| 307 |
+
paths = []
|
| 308 |
+
|
| 309 |
+
@app.get(f"{b}/lambda/org")
|
| 310 |
+
async def _org_lambda(): # noqa: ANN202
|
| 311 |
+
"""Org-wide 13-axis weighted-geometric-mean Λ. Advisory, floor 0.90. Bounds
|
| 312 |
+
SEMANTIC-VERIFIED; uniqueness = Conjecture 1 (gray, never green)."""
|
| 313 |
+
return JSONResponse(org_lambda())
|
| 314 |
+
paths.append(f"{b}/lambda/org")
|
| 315 |
+
|
| 316 |
+
@app.get(f"{b}/insurance/health")
|
| 317 |
+
async def _ins_health(): # noqa: ANN202
|
| 318 |
+
"""Honest probe for the insurance (David Leads) vertical fold-in."""
|
| 319 |
+
return JSONResponse({
|
| 320 |
+
"vertical": "insurance", "status": "ok",
|
| 321 |
+
"scorer": "David Leads 5-axis weighted-geomean Λ (folded in)",
|
| 322 |
+
"verbs": {
|
| 323 |
+
"score.lead": "REAL — emits insurance|score.lead into szl.lake.receipt/v1",
|
| 324 |
+
"bind.policy": "ROADMAP — no policy-binding path exists (genome Q3-INS-16); not fabricated",
|
| 325 |
+
},
|
| 326 |
+
"chain_reachable": _LAKE_OK,
|
| 327 |
+
"doctrine": DOCTRINE,
|
| 328 |
+
})
|
| 329 |
+
paths.append(f"{b}/insurance/health")
|
| 330 |
+
|
| 331 |
+
@app.post(f"{b}/insurance/score")
|
| 332 |
+
async def _ins_score(request: Request): # noqa: ANN202
|
| 333 |
+
"""Score an insurance lead (David Leads 5-axis Λ behind the F12 compliance gate)
|
| 334 |
+
and emit insurance|score.lead into the ONE chain FOR REAL."""
|
| 335 |
+
try:
|
| 336 |
+
lead = await request.json()
|
| 337 |
+
except Exception:
|
| 338 |
+
lead = {}
|
| 339 |
+
if not isinstance(lead, dict):
|
| 340 |
+
lead = {}
|
| 341 |
+
result = insurance_score(lead)
|
| 342 |
+
decision = "ALLOW" if (result["compliance"]["clear"] and result["lambda"] >= LAMBDA_FLOOR) \
|
| 343 |
+
else ("BLOCK" if not result["compliance"]["clear"] else "HOLD")
|
| 344 |
+
chain = emit("insurance", "score.lead", {
|
| 345 |
+
"score": result["score"], "lambda": result["lambda"],
|
| 346 |
+
"bucket": result["bucket"], "compliance_clear": result["compliance"]["clear"],
|
| 347 |
+
"lead_id": lead.get("id"),
|
| 348 |
+
}, decision=decision)
|
| 349 |
+
result["decision"] = decision
|
| 350 |
+
result["chain_receipt"] = chain
|
| 351 |
+
return JSONResponse(result)
|
| 352 |
+
paths.append(f"{b}/insurance/score")
|
| 353 |
+
|
| 354 |
+
@app.post(f"{b}/insurance/bind")
|
| 355 |
+
async def _ins_bind(request: Request): # noqa: ANN202
|
| 356 |
+
"""insurance|bind.policy is ROADMAP — no policy-binding path exists in David Leads
|
| 357 |
+
(genome Q3-INS-16). Honest 501; emits NOTHING into the chain. We do not fabricate."""
|
| 358 |
+
return JSONResponse({
|
| 359 |
+
"verb": "insurance|bind.policy",
|
| 360 |
+
"status": "ROADMAP",
|
| 361 |
+
"implemented": False,
|
| 362 |
+
"reason": "No policy-binding path exists in David Leads yet (genome Q3-INS-16). "
|
| 363 |
+
"score.lead is REAL; bind.policy is honestly not built. No chain write.",
|
| 364 |
+
"doctrine": DOCTRINE,
|
| 365 |
+
}, status_code=501)
|
| 366 |
+
paths.append(f"{b}/insurance/bind")
|
| 367 |
+
|
| 368 |
+
@app.get(f"{b}/verticals")
|
| 369 |
+
async def _verticals(): # noqa: ANN202
|
| 370 |
+
"""The org vertical roster incl. the insurance (David Leads) fold-in. Each entry
|
| 371 |
+
states its real verbs vs ROADMAP verbs — honest by construction."""
|
| 372 |
+
return JSONResponse({
|
| 373 |
+
"verticals": [
|
| 374 |
+
{"id": "core", "label": "Core Governance"},
|
| 375 |
+
{"id": "defense", "label": "Defense / Gov"},
|
| 376 |
+
{"id": "finance", "label": "Finance"},
|
| 377 |
+
{"id": "realestate", "label": "Real Estate"},
|
| 378 |
+
{"id": "insurance", "label": "Insurance (David Leads)",
|
| 379 |
+
"verbs": {"score.lead": "REAL", "bind.policy": "ROADMAP"},
|
| 380 |
+
"scorer": "5-axis weighted-geomean Λ + F12 compliance gate"},
|
| 381 |
+
],
|
| 382 |
+
"chain": "szl.lake.receipt/v1",
|
| 383 |
+
"doctrine": DOCTRINE,
|
| 384 |
+
})
|
| 385 |
+
paths.append(f"{b}/verticals")
|
| 386 |
+
|
| 387 |
+
return paths
|
| 388 |
+
|
| 389 |
+
|
| 390 |
+
if __name__ == "__main__":
|
| 391 |
+
print(json.dumps(org_lambda(), indent=2))
|
| 392 |
+
demo = {"id": "demo-1", "axes": {"life_event_strength": 0.95, "income_fit": 0.75,
|
| 393 |
+
"age_window_fit": 0.85, "product_propensity": 0.90, "recency": 0.90}}
|
| 394 |
+
print(json.dumps(insurance_score(demo), indent=2))
|
| 395 |
+
blocked = {"id": "demo-2", "dnc_listed": True, "axes": demo["axes"]}
|
| 396 |
+
print(json.dumps(insurance_score(blocked), indent=2))
|