Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ProviderSettingsForm.tsx

713 lines24.2 KB

1import { useState, type ReactNode } from "react";
2import * as Option from "effect/Option";
3import * as Schema from "effect/Schema";
4import {
5 acceptsSecretReference,
6 isSecretReference,
7 isSecretSetting,
8 type EnvironmentId,
9 type ProviderSettingsFormAnnotation,
10 type ProviderSettingsFormControl,
11 type ProviderSettingsFormOption,
12 type ProviderSettingsFormSchemaAnnotation,
13 type SecretReference,
14} from "@t3tools/contracts";
15import { PlusIcon, XIcon } from "lucide-react";
16​
17import { cn } from "../../lib/utils";
18import { Button } from "../ui/button";
19import { DraftInput } from "../ui/draft-input";
20import { Input } from "../ui/input";
21import { SecretInput } from "./SecretInput";
22import { SecretSourceInput, useSecretSources } from "./SecretSourceInput";
23import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
24import { Switch } from "../ui/switch";
25import { Textarea } from "../ui/textarea";
26import type { ProviderClientDefinition } from "@t3tools/provider-core/client";
27​
28export type SettingsFormDefinition = Pick<ProviderClientDefinition, "settingsSchema"> & {
29 readonly driverKind?: ProviderClientDefinition["driverKind"];
30};
31import { SettingsRow } from "./settingsLayout";
32​
33export interface ProviderSettingsFieldModel {
34 readonly key: string;
35 readonly control: ProviderSettingsFormControl;
36 readonly label: string;
37 readonly description?: string | undefined;
38 readonly placeholder?: string | undefined;
39 readonly clearWhenEmpty: "omit" | "persist";
40 /** Kept in the server's secret store: a saved value arrives as `SECRET_REDACTED` and never shows. */
41 readonly secret?: boolean | undefined;
42 /** Typed `SettingsSecretValue`: may name a secret provider reference instead of a value. */
43 readonly acceptsSecretReference?: boolean | undefined;
44 readonly defaultBooleanValue?: boolean | undefined;
45​
46 readonly options?: ReadonlyArray<ProviderSettingsFormOption> | undefined;
48​
49function titleizeFieldKey(key: string): string {
50 return key
51 .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
52 .replace(/[-_]+/g, " ")
53 .replace(/^./, (char) => char.toUpperCase());
55​
56function readFieldAnnotations(
57 fieldSchema: ProviderClientDefinition["settingsSchema"]["fields"][string],
58) {
59 return Schema.resolveAnnotationsKey(fieldSchema) ?? Schema.resolveAnnotations(fieldSchema);
61​
62function readFieldAnnotationString(
63 fieldSchema: ProviderClientDefinition["settingsSchema"]["fields"][string],
64 key: "title" | "description",
65): string | undefined {
66 const annotations = readFieldAnnotations(fieldSchema);
67 const value = annotations?.[key];
68 return typeof value === "string" ? value : undefined;
70​
71function readProviderSettingsFormAnnotation(
72 fieldSchema: ProviderClientDefinition["settingsSchema"]["fields"][string],
73): ProviderSettingsFormAnnotation {
74 const annotation = readFieldAnnotations(fieldSchema)?.providerSettingsForm;
75 return annotation ?? {};
77​
78function readProviderSettingsFormSchemaAnnotation(
79 definition: SettingsFormDefinition,
80): ProviderSettingsFormSchemaAnnotation {
81 return Schema.resolveAnnotations(definition.settingsSchema)?.providerSettingsFormSchema ?? {};
83​
84function readFieldBooleanDefault(
85 fieldSchema: ProviderClientDefinition["settingsSchema"]["fields"][string],
86): boolean | undefined {
87 const decodeDefault = Schema.decodeUnknownOption(fieldSchema as Schema.Decoder<unknown>);
88 const decoded = decodeDefault(undefined);
89 return Option.isSome(decoded) && typeof decoded.value === "boolean" ? decoded.value : undefined;
91​
92export function deriveProviderSettingsFields(
93 definition: SettingsFormDefinition,
94 value?: unknown,
95): ReadonlyArray<ProviderSettingsFieldModel> {
96 const isLocalAcp =
97 definition.driverKind === "acpRegistry" &&
98 readProviderConfigString(value, "source") === "local";
99 const schemaAnnotation = readProviderSettingsFormSchemaAnnotation(definition);
100 const orderedKeys = new Map(
101 (schemaAnnotation.order ?? []).map((key, index) => [key, index] as const),
102 );
103 const orderFallbackOffset = orderedKeys.size;
104​
105 return Object.keys(definition.settingsSchema.fields)
106 .map((key, index) => ({ key, index }))
107 .toSorted((left, right) => {
108 return (
109 (orderedKeys.get(left.key) ?? orderFallbackOffset + left.index) -
110 (orderedKeys.get(right.key) ?? orderFallbackOffset + right.index)
111 );
112 })
113 .flatMap(({ key }) => {
114 const fieldSchema = definition.settingsSchema.fields[key]!;
115 const formAnnotation = readProviderSettingsFormAnnotation(fieldSchema);
116 if (formAnnotation.hidden) return [];
117 if (isLocalAcp && key !== "source" && key !== "commandPath") return [];
118​
119 const annotatedTitle = readFieldAnnotationString(fieldSchema, "title");
120 const annotatedDescription = readFieldAnnotationString(fieldSchema, "description");
121 return [
122 {
123 key,
124 control: formAnnotation.control ?? "text",
125 label:
126 isLocalAcp && key === "commandPath"
127 ? "Executable"
128 : (annotatedTitle ?? titleizeFieldKey(key)),
129 ...(isLocalAcp && key === "commandPath"
130 ? { description: "Executable name or path on this environment." }
131 : annotatedDescription !== undefined
132 ? { description: annotatedDescription }
133 : {}),
134 ...(isLocalAcp && key === "commandPath"
135 ? { placeholder: "e.g. dsh" }
136 : formAnnotation.placeholder !== undefined
137 ? { placeholder: formAnnotation.placeholder }
138 : {}),
139 clearWhenEmpty: formAnnotation.clearWhenEmpty ?? "omit",
140 ...(isSecretSetting(fieldSchema) ? { secret: true } : {}),
141 ...(acceptsSecretReference(fieldSchema) ? { acceptsSecretReference: true } : {}),
142 ...(formAnnotation.control === "switch"
143 ? { defaultBooleanValue: readFieldBooleanDefault(fieldSchema) }
144 : {}),
145 ...(formAnnotation.control === "select" && formAnnotation.options
146 ? { options: formAnnotation.options }
147 : {}),
148 } satisfies ProviderSettingsFieldModel,
149 ];
150 });
152​
153let commandArgumentDraftId = 0;
154/**
155 * Editable rows seeded from a configured value. `seen` is the value the rows
156 * were last reconciled against; `lastPublished` is what the rows last sent to
157 * the owner, so its echo does not reseed rows (and drop their ids) mid-edit.
158 */
159export interface RowsDraft<V, R> {
160 readonly rows: ReadonlyArray<R>;
161 readonly seen: V;
162 readonly lastPublished: V | undefined;
164​
165export function seedRowsDraft<V, R>(
166 value: V,
167 toRows: (value: V) => ReadonlyArray<R>,
168): RowsDraft<V, R> {
169 return { rows: toRows(value), seen: value, lastPublished: undefined };
171​
172/** Reseeds the rows when the configured value changes from outside this editor. */
173export function reconcileRowsDraft<V, R>(
174 draft: RowsDraft<V, R>,
175 incoming: V,
176 equal: (left: V, right: V) => boolean,
177 toRows: (value: V) => ReadonlyArray<R>,
178): RowsDraft<V, R> {
179 if (draft.seen === incoming || equal(draft.seen, incoming)) return draft;
180 const echo = draft.lastPublished !== undefined && equal(draft.lastPublished, incoming);
181 return { rows: echo ? draft.rows : toRows(incoming), seen: incoming, lastPublished: undefined };
183​
184const makeCommandArgumentDraftRow = (value: string) => ({
185 id: `provider-argument-${commandArgumentDraftId++}`,
186 value,
187});
188​
189const toCommandArgumentRows = (args: ReadonlyArray<string>) =>
190 args.map(makeCommandArgumentDraftRow);
191​
192function commandArgumentsEqual(left: ReadonlyArray<string>, right: ReadonlyArray<string>) {
193 return left.length === right.length && left.every((argument, index) => argument === right[index]);
195​
196function configuredCommandArgs(value: ProviderSettingsFormProps["value"]) {
197 const configured =
198 value !== null && typeof value === "object"
199 ? (value as Record<string, unknown>).commandArgs
200 : undefined;
201 return Array.isArray(configured)
202 ? configured.filter((argument): argument is string => typeof argument === "string")
203 : [];
205​
206function ProviderCommandArguments({
207 value,
208 onChange,
209 managedReason,
210}: Pick<ProviderSettingsFormProps, "value" | "onChange"> & {
211 readonly managedReason: string | undefined;
212}) {
213 const args = configuredCommandArgs(value);
214 const [storedDraft, setDraft] = useState(() => seedRowsDraft(args, toCommandArgumentRows));
215 const draft = reconcileRowsDraft(storedDraft, args, commandArgumentsEqual, toCommandArgumentRows);
216 if (draft !== storedDraft) setDraft(draft);
217 const rows = draft.rows;
218​
219 const updateArguments = (nextRows: typeof rows) => {
220 const next = nextRows.map((row) => row.value);
221 setDraft({ rows: nextRows, seen: draft.seen, lastPublished: next });
222 const config =
223 value !== null && typeof value === "object" ? { ...(value as Record<string, unknown>) } : {};
224 onChange({ ...config, commandArgs: next });
225 };
226​
227 return (
228 <SettingsRow
229 title="Arguments"
230 description="One literal argument per row, in launch order."
231 managed={managedReason}
232 control={
233 <Button
234 type="button"
235 size="sm"
236 variant="outline"
237 onClick={() => updateArguments([...rows, makeCommandArgumentDraftRow("")])}
238 >
239 <PlusIcon />
240 Add argument
241 </Button>
242 }
243 >
244 {rows.length > 0 ? (
245 <div className="mt-3 min-w-0 space-y-2 pb-2">
246 {rows.map((argument, index) =>
247 managedReason !== undefined ? (
248 <code key={argument.id} className="block min-w-0 truncate text-xs">
249 {argument.value}
250 </code>
251 ) : (
252 <div key={argument.id} className="flex min-w-0 items-center gap-1.5">
253 <DraftInput
254 size="sm"
255 font="mono"
256 value={argument.value}
257 onCommit={(next) =>
258 updateArguments(
259 rows.map((current) =>
260 current.id === argument.id ? { ...current, value: next } : current,
261 ),
262 )
263 }
264 aria-label={`Argument ${index + 1}`}
265 spellCheck={false}
266 />
267 <Button
268 type="button"
269 size="icon-micro"
270 variant="ghost-destructive"
271 onClick={() =>
272 updateArguments(rows.filter((current) => current.id !== argument.id))
273 }
274 aria-label={`Remove argument ${index + 1}`}
275 >
276 <XIcon />
277 </Button>
278 </div>
279 ),
280 )}
281 </div>
282 ) : null}
283 </SettingsRow>
284 );
286​
287function readProviderConfigString(config: unknown, key: string): string {
288 if (config === null || typeof config !== "object") return "";
289 const value = (config as Record<string, unknown>)[key];
290 return typeof value === "string" ? value : "";
292​
293function readProviderConfigBoolean(config: unknown, key: string, defaultValue = false): boolean {
294 if (config === null || typeof config !== "object") return defaultValue;
295 const value = (config as Record<string, unknown>)[key];
296 return typeof value === "boolean" ? value : defaultValue;
298​
299export function nextProviderConfigWithFieldValue(
300 config: unknown,
301 field: ProviderSettingsFieldModel,
302 value: string | boolean | SecretReference,
303): Record<string, unknown> | undefined {
304 const base: Record<string, unknown> =
305 config !== null && typeof config === "object" ? { ...(config as Record<string, unknown>) } : {};
306​
307 if (typeof value === "object") {
308 base[field.key] = value;
309 return base;
310 }
311​
312 if (typeof value === "boolean") {
313 const emptyBooleanValue = field.defaultBooleanValue ?? false;
314 if (field.clearWhenEmpty === "omit" && value === emptyBooleanValue) {
315 delete base[field.key];
316 } else {
317 base[field.key] = value;
318 }
319 return Object.keys(base).length > 0 ? base : undefined;
320 }
321​
322 const trimmed = value.trim();
323 if (field.clearWhenEmpty === "omit" && trimmed.length === 0) {
324 delete base[field.key];
325 } else {
326 base[field.key] = value;
327 }
328 return Object.keys(base).length > 0 ? base : undefined;
330​
331interface ProviderSettingsFormProps {
332 readonly definition: SettingsFormDefinition;
333 readonly value: unknown;
334 readonly idPrefix: string;
335 readonly variant: "card" | "dialog" | "settings";
336 readonly onChange: (nextConfig: Record<string, unknown> | undefined) => void;
337 /** Config keys an administrator's policy pins, shown inert with the reason. */
338 readonly managed?: { readonly keys: ReadonlySet<string>; readonly reason: string } | undefined;
339 /** Where the secret providers offered for `SettingsSecretValue` fields are configured. */
340 readonly environmentId?: EnvironmentId | undefined;
342​
343function SecretSettingsControl({
344 field,
345 value,
346 inputId,
347 descriptionId,
348 environmentId,
349 onChange,
350}: {
351 readonly field: ProviderSettingsFieldModel;
352 readonly value: unknown;
353 readonly inputId: string;
354 readonly descriptionId: string | undefined;
355 readonly environmentId: EnvironmentId;
356 readonly onChange: ProviderSettingsFormProps["onChange"];
357}) {
358 const sources = useSecretSources(environmentId);
359 const saved =
360 value !== null && typeof value === "object"
361 ? (value as Record<string, unknown>)[field.key]
362 : undefined;
363 const reference = isSecretReference(saved) ? saved : undefined;
364 const configured = reference !== undefined || (typeof saved === "string" && saved.length > 0);
365 return (
366 <div className="flex w-full min-w-0 items-start gap-2 @min-[32rem]/settings-row:w-80">
367 <SecretSourceInput
368 id={inputId}
369 aria-describedby={descriptionId}
370 aria-label={field.label}
371 size="sm"
372 className="min-w-0 flex-1"
373 value={reference ?? ""}
374 configured={reference === undefined && configured}
375 sources={sources}
376 onCommit={(next) => onChange(nextProviderConfigWithFieldValue(value, field, next))}
377 onSecretChange={(secret) =>
378 onChange(nextProviderConfigWithFieldValue(value, field, secret ?? ""))
379 }
380 />
381 {configured ? (
382 <Button
383 type="button"
384 size="icon-sm"
385 variant="ghost-destructive"
386 onClick={() => onChange(nextProviderConfigWithFieldValue(value, field, ""))}
387 aria-label={`Clear ${field.label}`}
388 >
389 <XIcon className="size-3.5" />
390 </Button>
391 ) : null}
392 </div>
393 );
395​
396function ProviderSettingsSelect({
397 field,
398 value,
399 inputId,
400 size,
401 className,
402 onChange,
403}: {
404 readonly field: ProviderSettingsFieldModel;
405 readonly value: unknown;
406 readonly inputId: string;
407 readonly size: "sm" | "xs";
408 readonly className?: string | undefined;
409 readonly onChange: ProviderSettingsFormProps["onChange"];
410}) {
411 const options = field.options ?? [];
412 const fallback = options[0]?.value ?? "";
413 const current = readProviderConfigString(value, field.key) || fallback;
414 const label = options.find((option) => option.value === current)?.label ?? current;
415 return (
416 <Select
417 value={current}
418 onValueChange={(next) => {
419 if (typeof next !== "string") return;
420 onChange(nextProviderConfigWithFieldValue(value, field, next === fallback ? "" : next));
421 }}
422 >
423 <SelectTrigger id={inputId} size={size} className={className} aria-label={field.label}>
424 <SelectValue>{label}</SelectValue>
425 </SelectTrigger>
426 <SelectPopup align="start" alignItemWithTrigger={false}>
427 {options.map((option) => (
428 <SelectItem key={option.value} value={option.value}>
429 {option.label}
430 </SelectItem>
431 ))}
432 </SelectPopup>
433 </Select>
434 );
436​
437function FieldFrame(props: {
438 readonly variant: ProviderSettingsFormProps["variant"];
439 readonly children: ReactNode;
440}) {
441 if (props.variant === "card") {
442 return <div>{props.children}</div>;
443 }
444 return <div className="grid gap-1.5">{props.children}</div>;
446​
447interface ProviderSettingsFieldRowProps {
448 readonly field: ProviderSettingsFieldModel;
449 readonly value: unknown;
450 readonly idPrefix: string;
451 readonly variant: ProviderSettingsFormProps["variant"];
452 readonly onChange: ProviderSettingsFormProps["onChange"];
453 readonly managedReason?: string | undefined;
454 readonly environmentId: EnvironmentId | undefined;
456​
457function ProviderSettingsFieldRow({
458 field,
459 value,
460 idPrefix,
461 variant,
462 onChange,
463 managedReason,
464 environmentId,
465}: ProviderSettingsFieldRowProps) {
466 const inputId = `${idPrefix}-${field.key}`;
467 const descriptionClassName =
468 variant === "dialog"
469 ? "text-2xs text-muted-foreground"
470 : "mt-1 block text-xs text-muted-foreground";
471 const label = <span className="text-xs font-medium text-foreground">{field.label}</span>;
472 const description = field.description ? (
473 <span className={descriptionClassName}>{field.description}</span>
474 ) : null;
475​
476 if (variant === "settings") {
477 const descriptionId = field.description ? `${inputId}-description` : undefined;
478 const secretConfigured =
479 field.secret === true && readProviderConfigString(value, field.key).length > 0;
480 const control =
481 field.control === "switch" ? (
482 <Switch
483 checked={readProviderConfigBoolean(value, field.key, field.defaultBooleanValue)}
484 onCheckedChange={(checked) =>
485 onChange(nextProviderConfigWithFieldValue(value, field, Boolean(checked)))
486 }
487 aria-label={field.label}
488 aria-describedby={descriptionId}
489 />
490 ) : field.control === "select" ? (
491 <ProviderSettingsSelect
492 field={field}
493 value={value}
494 inputId={inputId}
495 size="sm"
496 className="w-full max-w-full @min-[32rem]/settings-row:w-56"
497 onChange={onChange}
498 />
499 ) : field.control === "textarea" ? (
500 <Textarea
501 id={inputId}
502 aria-describedby={descriptionId}
503 className="w-full max-w-full @min-[32rem]/settings-row:w-[min(24rem,50cqw)]"
504 value={readProviderConfigString(value, field.key)}
505 onChange={(event) =>
506 onChange(nextProviderConfigWithFieldValue(value, field, event.target.value))
507 }
508 placeholder={field.placeholder}
509 spellCheck={false}
510 />
511 ) : field.acceptsSecretReference && environmentId !== undefined ? (
512 <SecretSettingsControl
513 field={field}
514 value={value}
515 inputId={inputId}
516 descriptionId={descriptionId}
517 environmentId={environmentId}
518 onChange={onChange}
519 />
520 ) : field.secret ? (
521 <div className="flex w-full min-w-0 items-center gap-2 @min-[32rem]/settings-row:w-56">
522 <SecretInput
523 id={inputId}
524 aria-describedby={descriptionId}
525 size="sm"
526 className="min-w-0 flex-1"
527 configured={secretConfigured}
528 value=""
529 onCommit={(next) => onChange(nextProviderConfigWithFieldValue(value, field, next))}
530 />
531 {secretConfigured ? (
532 <Button
533 type="button"
534 size="icon-sm"
535 variant="ghost-destructive"
536 onClick={() => onChange(nextProviderConfigWithFieldValue(value, field, ""))}
537 aria-label={`Clear ${field.label}`}
538 >
539 <XIcon className="size-3.5" />
540 </Button>
541 ) : null}
542 </div>
543 ) : (
544 <DraftInput
545 id={inputId}
546 aria-describedby={descriptionId}
547 size="sm"
548 className="w-full max-w-full @min-[32rem]/settings-row:w-56"
549 type={field.control === "password" ? "password" : undefined}
550 autoComplete={field.control === "password" ? "off" : undefined}
551 value={readProviderConfigString(value, field.key)}
552 placeholder={field.placeholder}
553 onCommit={(next) => {
554 onChange(nextProviderConfigWithFieldValue(value, field, next));
555 }}
556 spellCheck={false}
557 />
558 );
559​
560 return (
561 <SettingsRow
562 title={
563 field.control === "switch" ? field.label : <label htmlFor={inputId}>{field.label}</label>
564 }
565 description={
566 field.description ? <span id={descriptionId}>{field.description}</span> : undefined
567 }
568 control={control}
569 managed={managedReason}
570 />
571 );
572 }
573​
574 if (field.control === "switch") {
575 return (
576 <FieldFrame variant={variant}>
577 <div className="flex items-center justify-between gap-3">
578 <div className="min-w-0">
579 {label}
580 {description}
581 </div>
582 <Switch
583 checked={readProviderConfigBoolean(value, field.key, field.defaultBooleanValue)}
584 onCheckedChange={(checked) =>
585 onChange(nextProviderConfigWithFieldValue(value, field, Boolean(checked)))
586 }
587 aria-label={field.label}
588 />
589 </div>
590 </FieldFrame>
591 );
592 }
593​
594 if (field.control === "select") {
595 return (
596 <FieldFrame variant={variant}>
597 <label htmlFor={inputId} className={cn(variant === "card" && "block")}>
598 {label}
599 <ProviderSettingsSelect
600 field={field}
601 value={value}
602 inputId={inputId}
603 size="sm"
604 className={cn("w-full", variant === "card" && "mt-1.5")}
605 onChange={onChange}
606 />
607 {description}
608 </label>
609 </FieldFrame>
610 );
611 }
612​
613 if (field.control === "textarea") {
614 return (
615 <FieldFrame variant={variant}>
616 <label htmlFor={inputId} className={cn(variant === "card" && "block")}>
617 {label}
618 <Textarea
619 id={inputId}
620 className={cn(variant === "card" && "mt-1.5")}
621 value={readProviderConfigString(value, field.key)}
622 onChange={(event) =>
623 onChange(nextProviderConfigWithFieldValue(value, field, event.target.value))
624 }
625 placeholder={field.placeholder}
626 spellCheck={false}
627 />
628 {description}
629 </label>
630 </FieldFrame>
631 );
632 }
633​
634 const type = field.control === "password" ? "password" : undefined;
635 const BufferedInput = field.secret ? SecretInput : DraftInput;
636 const ControlledInput = field.secret ? SecretInput : Input;
637 return (
638 <FieldFrame variant={variant}>
639 <label htmlFor={inputId} className={cn(variant === "card" && "block")}>
640 {label}
641 {variant === "card" ? (
642 <BufferedInput
643 id={inputId}
644 size="sm"
645 className="mt-1.5"
646 type={field.secret ? undefined : type}
647 autoComplete={!field.secret && field.control === "password" ? "off" : undefined}
648 value={readProviderConfigString(value, field.key)}
649 onCommit={(next) => onChange(nextProviderConfigWithFieldValue(value, field, next))}
650 placeholder={field.placeholder}
651 spellCheck={false}
652 />
653 ) : (
654 <ControlledInput
655 id={inputId}
656 type={field.secret ? undefined : type}
657 autoComplete={!field.secret && field.control === "password" ? "off" : undefined}
658 value={readProviderConfigString(value, field.key)}
659 onChange={(event) =>
660 onChange(nextProviderConfigWithFieldValue(value, field, event.target.value))
661 }
662 placeholder={field.placeholder}
663 spellCheck={false}
664 />
665 )}
666 {description}
667 </label>
668 </FieldFrame>
669 );
671​
672export function ProviderSettingsForm({
673 definition,
674 value,
675 idPrefix,
676 variant,
677 onChange,
678 managed,
679 environmentId,
680}: ProviderSettingsFormProps) {
681 const fields = deriveProviderSettingsFields(definition, value);
682 const isLocalAcp =
683 definition.driverKind === "acpRegistry" &&
684 readProviderConfigString(value, "source") === "local";
685​
686 if (fields.length === 0) {
687 return null;
688 }
689​
690 return (
691 <>
692 {fields.map((field) => (
693 <ProviderSettingsFieldRow
694 key={field.key}
695 field={field}
696 value={value}
697 idPrefix={idPrefix}
698 variant={variant}
699 onChange={onChange}
700 managedReason={managed?.keys.has(field.key) ? managed.reason : undefined}
701 environmentId={environmentId}
702 />
703 ))}
704 {isLocalAcp ? (
705 <ProviderCommandArguments
706 value={value}
707 onChange={onChange}
708 managedReason={managed?.keys.has("commandArgs") ? managed.reason : undefined}
709 />
710 ) : null}
711 </>
712 );