feat(tcs): establish five-domain mother brain runtime

This commit is contained in:
冰朔 2026-08-12 14:46:34 +08:00
commit 55a4d77248
29 changed files with 904 additions and 12 deletions

View file

@ -37,8 +37,19 @@ async function check(target) {
const timer = setTimeout(() => controller.abort(), target.timeout_ms || 8000);
try {
const response = await fetch(target.url, { method: "GET", redirect: "manual", signal: controller.signal, headers: { "user-agent": "Guanghu-State-Change-Sentinel/1.0" } });
const ok = (target.accept || [200]).includes(response.status);
return { ok, detail: `HTTP ${response.status}`, observed_at: new Date().toISOString() };
let ok = (target.accept || [200]).includes(response.status);
let detail = `HTTP ${response.status}`;
if (target.json_expect && response.headers.get("content-type")?.includes("application/json")) {
const body = await response.json();
for (const [field, expected] of Object.entries(target.json_expect)) {
const observed = field.split(".").reduce((value, key) => value && value[key], body);
if (observed !== expected) {
ok = false;
detail += ` ${field}=${JSON.stringify(observed)}`;
}
}
}
return { ok, detail, observed_at: new Date().toISOString() };
} catch (error) {
return { ok: false, detail: error.name === "AbortError" ? "timeout" : "connection-failed", observed_at: new Date().toISOString() };
} finally { clearTimeout(timer); }

View file

@ -1,6 +1,29 @@
{
"targets": [
{ "id": "BS-GZ-006-front-door", "url": "https://guanghulab.com/", "accept": [200], "timeout_ms": 8000 },
{ "id": "JD-Lake-Lamp-public-route", "url": "https://guanghulab.com/authz/health", "accept": [200], "timeout_ms": 8000 }
{ "id": "JD-Lake-Lamp-public-route", "url": "https://guanghulab.com/authz/health", "accept": [200], "timeout_ms": 8000 },
{
"id": "REPO-012-public-atomic-snapshot",
"url": "https://guanghulab.com/api/ai/health",
"accept": [200],
"timeout_ms": 8000,
"json_expect": {
"ok": true,
"navigation_source.source_degraded": false,
"navigation_source.anchor_id": "GLW-PUBLIC-NAV-ANCHOR-001"
}
},
{
"id": "JD-TCS-mother-brain-loopback",
"url": "http://127.0.0.1:3931/health",
"accept": [200],
"timeout_ms": 5000,
"json_expect": {
"ok": true,
"runtime_id": "TCS-MOTHER-BRAIN-RUNTIME-0001",
"automatic_stable_promotion": false,
"reality_action_authority": "NONE"
}
}
]
}