diff --git a/ui/src/components/AgentConfigForm.tsx b/ui/src/components/AgentConfigForm.tsx index abfc04fb..81b8b4e3 100644 --- a/ui/src/components/AgentConfigForm.tsx +++ b/ui/src/components/AgentConfigForm.tsx @@ -60,6 +60,10 @@ type AgentConfigFormProps = { onSaveActionChange?: (save: (() => void) | null) => void; onCancelActionChange?: (cancel: (() => void) | null) => void; hideInlineSave?: boolean; + showAdapterTypeField?: boolean; + showAdapterTestEnvironmentButton?: boolean; + showCreateRunPolicySection?: boolean; + hideInstructionsFile?: boolean; /** "cards" renders each section as heading + bordered card (for settings pages). Default: "inline" (border-b dividers). */ sectionLayout?: "inline" | "cards"; } & ( @@ -163,6 +167,10 @@ export function AgentConfigForm(props: AgentConfigFormProps) { const { mode, adapterModels: externalModels } = props; const isCreate = mode === "create"; const cards = props.sectionLayout === "cards"; + const showAdapterTypeField = props.showAdapterTypeField ?? true; + const showAdapterTestEnvironmentButton = props.showAdapterTestEnvironmentButton ?? true; + const showCreateRunPolicySection = props.showCreateRunPolicySection ?? true; + const hideInstructionsFile = props.hideInstructionsFile ?? false; const { selectedCompanyId } = useCompany(); const queryClient = useQueryClient(); @@ -285,6 +293,7 @@ export function AgentConfigForm(props: AgentConfigFormProps) { adapterType === "codex_local" || adapterType === "gemini_local" || adapterType === "opencode_local" || + adapterType === "pi_local" || adapterType === "cursor"; const uiAdapter = useMemo(() => getUIAdapter(adapterType), [adapterType]); @@ -312,6 +321,7 @@ export function AgentConfigForm(props: AgentConfigFormProps) { eff: eff as (group: "adapterConfig", field: string, original: T) => T, mark: mark as (group: "adapterConfig", field: string, value: unknown) => void, models, + hideInstructionsFile, }; // Section toggle state — advanced always starts collapsed @@ -478,69 +488,73 @@ export function AgentConfigForm(props: AgentConfigFormProps) { ?

Adapter

: Adapter } - + {showAdapterTestEnvironmentButton && ( + + )}
- - { - if (isCreate) { - // Reset all adapter-specific fields to defaults when switching adapter type - const { adapterType: _at, ...defaults } = defaultCreateValues; - const nextValues: CreateConfigValues = { ...defaults, adapterType: t }; - if (t === "codex_local") { - nextValues.model = DEFAULT_CODEX_LOCAL_MODEL; - nextValues.dangerouslyBypassSandbox = - DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX; - } else if (t === "gemini_local") { - nextValues.model = DEFAULT_GEMINI_LOCAL_MODEL; - } else if (t === "cursor") { - nextValues.model = DEFAULT_CURSOR_LOCAL_MODEL; - } else if (t === "opencode_local") { - nextValues.model = ""; + {showAdapterTypeField && ( + + { + if (isCreate) { + // Reset all adapter-specific fields to defaults when switching adapter type + const { adapterType: _at, ...defaults } = defaultCreateValues; + const nextValues: CreateConfigValues = { ...defaults, adapterType: t }; + if (t === "codex_local") { + nextValues.model = DEFAULT_CODEX_LOCAL_MODEL; + nextValues.dangerouslyBypassSandbox = + DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX; + } else if (t === "gemini_local") { + nextValues.model = DEFAULT_GEMINI_LOCAL_MODEL; + } else if (t === "cursor") { + nextValues.model = DEFAULT_CURSOR_LOCAL_MODEL; + } else if (t === "opencode_local") { + nextValues.model = ""; + } + set!(nextValues); + } else { + // Clear all adapter config and explicitly blank out model + effort/mode keys + // so the old adapter's values don't bleed through via eff() + setOverlay((prev) => ({ + ...prev, + adapterType: t, + adapterConfig: { + model: + t === "codex_local" + ? DEFAULT_CODEX_LOCAL_MODEL + : t === "gemini_local" + ? DEFAULT_GEMINI_LOCAL_MODEL + : t === "cursor" + ? DEFAULT_CURSOR_LOCAL_MODEL + : "", + effort: "", + modelReasoningEffort: "", + variant: "", + mode: "", + ...(t === "codex_local" + ? { + dangerouslyBypassApprovalsAndSandbox: + DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX, + } + : {}), + }, + })); } - set!(nextValues); - } else { - // Clear all adapter config and explicitly blank out model + effort/mode keys - // so the old adapter's values don't bleed through via eff() - setOverlay((prev) => ({ - ...prev, - adapterType: t, - adapterConfig: { - model: - t === "codex_local" - ? DEFAULT_CODEX_LOCAL_MODEL - : t === "gemini_local" - ? DEFAULT_GEMINI_LOCAL_MODEL - : t === "cursor" - ? DEFAULT_CURSOR_LOCAL_MODEL - : "", - effort: "", - modelReasoningEffort: "", - variant: "", - mode: "", - ...(t === "codex_local" - ? { - dangerouslyBypassApprovalsAndSandbox: - DEFAULT_CODEX_LOCAL_BYPASS_APPROVALS_AND_SANDBOX, - } - : {}), - }, - })); - } - }} - /> - + }} + /> + + )} {testEnvironment.error && (
@@ -634,8 +648,10 @@ export function AgentConfigForm(props: AgentConfigFormProps) { ? "codex" : adapterType === "gemini_local" ? "gemini" - : adapterType === "cursor" - ? "agent" + : adapterType === "pi_local" + ? "pi" + : adapterType === "cursor" + ? "agent" : adapterType === "opencode_local" ? "opencode" : "claude" @@ -794,7 +810,7 @@ export function AgentConfigForm(props: AgentConfigFormProps) { )} {/* ---- Run Policy ---- */} - {isCreate ? ( + {isCreate && showCreateRunPolicySection ? (
{cards ?

Run Policy

@@ -815,7 +831,7 @@ export function AgentConfigForm(props: AgentConfigFormProps) { />
- ) : ( + ) : !isCreate ? (
{cards ?

Run Policy

@@ -881,7 +897,7 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
- )} + ) : null} ); diff --git a/ui/src/pages/CompanyImport.tsx b/ui/src/pages/CompanyImport.tsx index 2f874c05..124ae4fd 100644 --- a/ui/src/pages/CompanyImport.tsx +++ b/ui/src/pages/CompanyImport.tsx @@ -14,6 +14,7 @@ import { queryKeys } from "../lib/queryKeys"; import { MarkdownBody } from "../components/MarkdownBody"; import { Button } from "@/components/ui/button"; import { EmptyState } from "../components/EmptyState"; +import { AgentConfigForm } from "../components/AgentConfigForm"; import { cn } from "../lib/utils"; import { ArrowRight, @@ -27,7 +28,6 @@ import { import { Field, adapterLabels } from "../components/agent-config-primitives"; import { defaultCreateValues } from "../components/agent-config-defaults"; import { getUIAdapter, listUIAdapters } from "../adapters"; -import { ClaudeLocalAdvancedFields } from "../adapters/claude-local/config-fields"; import type { CreateConfigValues } from "@paperclipai/adapter-utils"; import { type FileTreeNode, @@ -488,7 +488,6 @@ function AdapterPickerList({ {agents.map((agent) => { const selectedType = adapterOverrides[agent.slug] ?? agent.adapterType; const isExpanded = expandedSlugs.has(agent.slug); - const uiAdapter = getUIAdapter(selectedType); const vals = configValues[agent.slug] ?? { ...defaultCreateValues, adapterType: selectedType }; return ( @@ -531,31 +530,16 @@ function AdapterPickerList({ {isExpanded && (
- onChangeConfig(agent.slug, patch)} - config={{}} - eff={() => "" as any} - mark={() => {}} - models={[]} + onChange={(patch) => onChangeConfig(agent.slug, patch)} + showAdapterTypeField={false} + showAdapterTestEnvironmentButton={false} + showCreateRunPolicySection={false} hideInstructionsFile + sectionLayout="cards" /> - {selectedType === "claude_local" && ( - onChangeConfig(agent.slug, patch)} - config={{}} - eff={() => "" as any} - mark={() => {}} - models={[]} - /> - )}
)}