fix: hide instructions file and show advanced fields in import adapter config

- Added hideInstructionsFile prop to AdapterConfigFieldsProps
- All adapter config-fields now conditionally hide the instructions file
  field when hideInstructionsFile is set (used during import since the
  AGENTS.md is automatically set as promptTemplate)
- Import adapter config panel now renders ClaudeLocalAdvancedFields
  (Chrome, skip permissions, max turns) when claude_local is selected

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Dotta 2026-03-16 11:09:36 -05:00
parent 1548b73b77
commit 0763e2eb20
6 changed files with 75 additions and 48 deletions

View file

@ -25,33 +25,36 @@ export function ClaudeLocalConfigFields({
eff, eff,
mark, mark,
models, models,
hideInstructionsFile,
}: AdapterConfigFieldsProps) { }: AdapterConfigFieldsProps) {
return ( return (
<> <>
<Field label="Agent instructions file" hint={instructionsFileHint}> {!hideInstructionsFile && (
<div className="flex items-center gap-2"> <Field label="Agent instructions file" hint={instructionsFileHint}>
<DraftInput <div className="flex items-center gap-2">
value={ <DraftInput
isCreate value={
? values!.instructionsFilePath ?? "" isCreate
: eff( ? values!.instructionsFilePath ?? ""
"adapterConfig", : eff(
"instructionsFilePath", "adapterConfig",
String(config.instructionsFilePath ?? ""), "instructionsFilePath",
) String(config.instructionsFilePath ?? ""),
} )
onCommit={(v) => }
isCreate onCommit={(v) =>
? set!({ instructionsFilePath: v }) isCreate
: mark("adapterConfig", "instructionsFilePath", v || undefined) ? set!({ instructionsFilePath: v })
} : mark("adapterConfig", "instructionsFilePath", v || undefined)
immediate }
className={inputClass} immediate
placeholder="/absolute/path/to/AGENTS.md" className={inputClass}
/> placeholder="/absolute/path/to/AGENTS.md"
<ChoosePathButton /> />
</div> <ChoosePathButton />
</Field> </div>
</Field>
)}
<LocalWorkspaceRuntimeFields <LocalWorkspaceRuntimeFields
isCreate={isCreate} isCreate={isCreate}
values={values} values={values}

View file

@ -23,36 +23,39 @@ export function CodexLocalConfigFields({
eff, eff,
mark, mark,
models, models,
hideInstructionsFile,
}: AdapterConfigFieldsProps) { }: AdapterConfigFieldsProps) {
const bypassEnabled = const bypassEnabled =
config.dangerouslyBypassApprovalsAndSandbox === true || config.dangerouslyBypassSandbox === true; config.dangerouslyBypassApprovalsAndSandbox === true || config.dangerouslyBypassSandbox === true;
return ( return (
<> <>
<Field label="Agent instructions file" hint={instructionsFileHint}> {!hideInstructionsFile && (
<div className="flex items-center gap-2"> <Field label="Agent instructions file" hint={instructionsFileHint}>
<DraftInput <div className="flex items-center gap-2">
value={ <DraftInput
isCreate value={
? values!.instructionsFilePath ?? "" isCreate
: eff( ? values!.instructionsFilePath ?? ""
"adapterConfig", : eff(
"instructionsFilePath", "adapterConfig",
String(config.instructionsFilePath ?? ""), "instructionsFilePath",
) String(config.instructionsFilePath ?? ""),
} )
onCommit={(v) => }
isCreate onCommit={(v) =>
? set!({ instructionsFilePath: v }) isCreate
: mark("adapterConfig", "instructionsFilePath", v || undefined) ? set!({ instructionsFilePath: v })
} : mark("adapterConfig", "instructionsFilePath", v || undefined)
immediate }
className={inputClass} immediate
placeholder="/absolute/path/to/AGENTS.md" className={inputClass}
/> placeholder="/absolute/path/to/AGENTS.md"
<ChoosePathButton /> />
</div> <ChoosePathButton />
</Field> </div>
</Field>
)}
<ToggleField <ToggleField
label="Bypass sandbox" label="Bypass sandbox"
hint={help.dangerouslyBypassSandbox} hint={help.dangerouslyBypassSandbox}

View file

@ -17,7 +17,9 @@ export function CursorLocalConfigFields({
config, config,
eff, eff,
mark, mark,
hideInstructionsFile,
}: AdapterConfigFieldsProps) { }: AdapterConfigFieldsProps) {
if (hideInstructionsFile) return null;
return ( return (
<Field label="Agent instructions file" hint={instructionsFileHint}> <Field label="Agent instructions file" hint={instructionsFileHint}>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">

View file

@ -17,7 +17,9 @@ export function OpenCodeLocalConfigFields({
config, config,
eff, eff,
mark, mark,
hideInstructionsFile,
}: AdapterConfigFieldsProps) { }: AdapterConfigFieldsProps) {
if (hideInstructionsFile) return null;
return ( return (
<Field label="Agent instructions file" hint={instructionsFileHint}> <Field label="Agent instructions file" hint={instructionsFileHint}>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">

View file

@ -20,6 +20,8 @@ export interface AdapterConfigFieldsProps {
mark: (group: "adapterConfig", field: string, value: unknown) => void; mark: (group: "adapterConfig", field: string, value: unknown) => void;
/** Available models for dropdowns */ /** Available models for dropdowns */
models: { id: string; label: string }[]; models: { id: string; label: string }[];
/** When true, hides the instructions file path field (e.g. during import where it's set automatically) */
hideInstructionsFile?: boolean;
} }
export interface UIAdapterModule { export interface UIAdapterModule {

View file

@ -27,6 +27,7 @@ import {
import { Field, adapterLabels } from "../components/agent-config-primitives"; import { Field, adapterLabels } from "../components/agent-config-primitives";
import { defaultCreateValues } from "../components/agent-config-defaults"; import { defaultCreateValues } from "../components/agent-config-defaults";
import { getUIAdapter } from "../adapters"; import { getUIAdapter } from "../adapters";
import { ClaudeLocalAdvancedFields } from "../adapters/claude-local/config-fields";
import type { CreateConfigValues } from "@paperclipai/adapter-utils"; import type { CreateConfigValues } from "@paperclipai/adapter-utils";
import { import {
type FileTreeNode, type FileTreeNode,
@ -542,7 +543,21 @@ function AdapterPickerList({
eff={() => "" as any} eff={() => "" as any}
mark={() => {}} mark={() => {}}
models={[]} models={[]}
hideInstructionsFile
/> />
{selectedType === "claude_local" && (
<ClaudeLocalAdvancedFields
mode="create"
isCreate
adapterType={selectedType}
values={vals}
set={(patch) => onChangeConfig(agent.slug, patch)}
config={{}}
eff={() => "" as any}
mark={() => {}}
models={[]}
/>
)}
</div> </div>
)} )}
</div> </div>