import type { AdapterConfigFieldsProps } from "../types"; import { Field, DraftInput, help, } from "../../components/agent-config-primitives"; const inputClass = "w-full rounded-md border border-border px-2.5 py-1.5 bg-transparent outline-none text-sm font-mono placeholder:text-muted-foreground/40"; function formatArgList(value: unknown): string { if (Array.isArray(value)) { return value .filter((item): item is string => typeof item === "string") .join(", "); } return typeof value === "string" ? value : ""; } function parseCommaArgs(value: string): string[] { return value .split(",") .map((item) => item.trim()) .filter(Boolean); } export function ProcessConfigFields({ isCreate, values, set, config, eff, mark, }: AdapterConfigFieldsProps) { return ( <> isCreate ? set!({ command: v }) : mark("adapterConfig", "command", v || undefined) } immediate className={inputClass} placeholder="e.g. node, python" /> isCreate ? set!({ args: v }) : mark( "adapterConfig", "args", v ? parseCommaArgs(v) : undefined, ) } immediate className={inputClass} placeholder="e.g. script.js, --flag" /> ); }