import { IconCode } from "@tabler/icons-react" import { Link } from "@tanstack/react-router" import { useTranslation } from "react-i18next" import { type CoreConfigForm, DM_SCOPE_OPTIONS, type LauncherForm, } from "@/components/config/form-model" import { Field, SwitchCardField } from "@/components/shared-form" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" import { Textarea } from "@/components/ui/textarea" type UpdateCoreField = ( key: K, value: CoreConfigForm[K], ) => void type UpdateLauncherField = ( key: K, value: LauncherForm[K], ) => void interface AgentDefaultsSectionProps { form: CoreConfigForm onFieldChange: UpdateCoreField } export function AgentDefaultsSection({ form, onFieldChange, }: AgentDefaultsSectionProps) { const { t } = useTranslation() return (
onFieldChange("workspace", e.target.value)} placeholder="~/.picoclaw/workspace" /> onFieldChange("restrictToWorkspace", checked) } /> onFieldChange("maxTokens", e.target.value)} /> onFieldChange("maxToolIterations", e.target.value)} /> onFieldChange("summarizeMessageThreshold", e.target.value) } /> onFieldChange("summarizeTokenPercent", e.target.value) } />
) } interface RuntimeSectionProps { form: CoreConfigForm onFieldChange: UpdateCoreField } export function RuntimeSection({ form, onFieldChange }: RuntimeSectionProps) { const { t } = useTranslation() const selectedDmScopeOption = DM_SCOPE_OPTIONS.find( (scope) => scope.value === form.dmScope, ) return (
onFieldChange("heartbeatEnabled", checked) } /> {form.heartbeatEnabled && ( onFieldChange("heartbeatInterval", e.target.value) } /> )}
) } interface LauncherSectionProps { launcherForm: LauncherForm onFieldChange: UpdateLauncherField launcherHint: string disabled: boolean } export function LauncherSection({ launcherForm, onFieldChange, launcherHint, disabled, }: LauncherSectionProps) { const { t } = useTranslation() return (
onFieldChange("port", e.target.value)} /> onFieldChange("publicAccess", checked)} />