Add GUI visual smoke and bounded actions

This commit is contained in:
Meta Vens 2026-04-29 16:50:18 +01:00
commit 21a05368d3
14 changed files with 620 additions and 32 deletions

View file

@ -0,0 +1,31 @@
import { invoke } from "@tauri-apps/api/core";
import type { OperatorAction, OperatorActionResult, OperatorSnapshot, StatusRequest } from "./types";
export async function loadOperatorSnapshot(request: StatusRequest): Promise<OperatorSnapshot> {
if (hasTauriRuntime()) {
return invoke<OperatorSnapshot>("load_operator_snapshot", { request });
}
const response = await fetch("/operator-snapshot.sample.json", { cache: "no-store" });
if (!response.ok) {
throw new Error(`sample operator snapshot failed: ${response.status}`);
}
return (await response.json()) as OperatorSnapshot;
}
export async function runOperatorAction(action: OperatorAction, request: StatusRequest): Promise<OperatorActionResult> {
if (hasTauriRuntime()) {
return invoke<OperatorActionResult>("run_operator_action", { action, request });
}
await new Promise((resolve) => setTimeout(resolve, 250));
return {
action,
artifactPath: "E:\\Projects\\EpiphanyAgent\\.epiphany-gui\\sample-action",
summary: `${action} sample completed.`,
};
}
function hasTauriRuntime(): boolean {
return typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;
}