feat(agent): refine ready state actions

This commit is contained in:
2026-07-15 18:30:21 +08:00
parent 055335e404
commit df2fb3ca38
10 changed files with 149 additions and 41 deletions
+1 -7
View File
@@ -5,8 +5,7 @@ import type { UIEnvelope, UIEnvelopePayload, UIRegistry, UISurface } from "./typ
const surfaces = new Set<UISurface>(["chat_inline", "side_panel", "canvas", "map_overlay"]);
const MAX_ID_LENGTH = 128;
const LOCAL_COMPONENT_SURFACES = new Map<string, UISurface[]>([
["HistoryPanel", ["side_panel", "canvas"]],
["ScadaPanel", ["side_panel", "canvas"]]
["HistoryPanel", ["side_panel", "canvas"]]
]);
const LOCAL_ACTION_SURFACES = new Map<string, UISurface[]>([
["locate_features", ["map_overlay"]],
@@ -183,11 +182,6 @@ function isValidComponentProps(component: string, props: unknown) {
items.every((item) => Array.isArray(item) && item.length === 2 && item.every((part) => boundedString(part, 128))) &&
(props.data_type === "realtime" || props.data_type === "scheme" || props.data_type === "none");
}
if (component === "ScadaPanel") {
if (!hasOnlyKeys(props, ["reason", "device_ids", "device_id", "start_time", "end_time"])) return false;
const ids = Array.isArray(props.device_ids) ? props.device_ids : props.device_id ? [props.device_id] : [];
return ids.length > 0 && ids.length <= 100 && ids.every((id) => Boolean(boundedString(id, 128)));
}
return false;
}