mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 09:02:55 +00:00
Extract shared normalization/coercion helpers into private @openclaw/normalization-core workspace package while preserving existing plugin SDK helper subpaths.\n\nAlso keeps direct normalization-core imports internal, wires UI/build/loader resolution, and replaces the slow PR network CodeQL lane with a fast added-line boundary scan while retaining full CodeQL for scheduled/manual runs.\n\nVerification: local moved tests, plugin SDK boundary tests, extension loader tests, agents-support shard, UI build/test, build artifacts, lint, workflow guards, autoreview, and GitHub CI passed on PR head 963d893715.
25 lines
787 B
TypeScript
25 lines
787 B
TypeScript
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
|
|
|
|
export const NODE_PRESENCE_ALIVE_EVENT = "node.presence.alive";
|
|
|
|
const NODE_PRESENCE_ALIVE_REASONS = [
|
|
"background",
|
|
"silent_push",
|
|
"bg_app_refresh",
|
|
"significant_location",
|
|
"manual",
|
|
"connect",
|
|
] as const;
|
|
|
|
export type NodePresenceAliveReason = (typeof NODE_PRESENCE_ALIVE_REASONS)[number];
|
|
|
|
const NODE_PRESENCE_ALIVE_REASON_SET = new Set<string>(NODE_PRESENCE_ALIVE_REASONS);
|
|
|
|
export function normalizeNodePresenceAliveReason(value: unknown): NodePresenceAliveReason {
|
|
const normalized = normalizeOptionalString(value)?.toLowerCase();
|
|
if (normalized && NODE_PRESENCE_ALIVE_REASON_SET.has(normalized)) {
|
|
return normalized as NodePresenceAliveReason;
|
|
}
|
|
return "background";
|
|
}
|