MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / parseAutomationSetupPluginList

Function parseAutomationSetupPluginList

src/api/automation-setup-plugins.ts:31–51  ·  view source on GitHub ↗
(
  value: string | undefined,
)

Source from the content-addressed store, hash-verified

29 * cannot throw while the panel is opening.
30 */
31export function parseAutomationSetupPluginList(
32 value: string | undefined,
33): AutomationSetupPluginEntry[] {
34 if (!value?.trim()) return [];
35 try {
36 const parsed = JSON.parse(value) as unknown;
37 if (!Array.isArray(parsed)) return [];
38 return parsed.flatMap((entry) => {
39 if (!entry || typeof entry !== "object") return [];
40 const record = entry as Record<string, unknown>;
41 return [
42 {
43 source: typeof record.source === "string" ? record.source : "",
44 ref: typeof record.ref === "string" ? record.ref : "",
45 },
46 ];
47 });
48 } catch {
49 return [];
50 }
51}
52
53/** Serialize plugin rows for the string form field. */
54export function serializeAutomationSetupPluginList(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected