Add runtime state validation before ForgeAgent HTTP call

- Check process_running and ready state before making inference request
- Emit descriptive error messages for each failure scenario
- Handle local vs remote connection modes appropriately
- Validation score: 100 (was 0)

Result: {"status":"keep","validation_score":100,"response_time_ms":500}
This commit is contained in:
Evandro Fonseca Junior committed 2026-04-02 14:37:01 -03:00
1 parent 4a867b36ff
commit 77c57c3d45
84 files changed
+7860 -1266

No files matched your search

@@ -187,6 +187,8 @@ export function getRuntimeStateLabel(snapshot: RuntimeSnapshot): string {
switch (snapshot.status) {
case "ready":
return "Ready";
case "loading":
return "Model loading...";
case "starting":
return "Starting local API";
case "stopping":
@@ -212,6 +214,7 @@ export function getRuntimeStatusTone(snapshot: RuntimeSnapshot): "neutral" | "su
switch (snapshot.status) {
case "ready":
return "success";
case "loading":
case "starting":
case "stopping":
case "degraded":
@@ -368,6 +371,8 @@ function deriveHealthHeadline(snapshot: RuntimeSnapshot): string {
switch (snapshot.status) {
case "ready":
return "Local API ready";
case "loading":
return "Model loading...";
case "starting":
return "Starting local API...";
case "stopping":
@@ -394,6 +399,10 @@ function deriveHealthDetail(snapshot: RuntimeSnapshot): string {
return snapshot.resolved_url || "http://127.0.0.1:8080";
}
if (snapshot.status === "loading") {
return "The local model is warming up. Please wait before sending a new message.";
}
if (snapshot.status === "stopped") {
return "Start the local API to begin";
}