@ai-matrx/agents 0.59.189 → 0.59.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,9 +22,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  // settings/react/index.ts
23
23
  var react_exports = {};
24
24
  __export(react_exports, {
25
- ENUM_OFF_VALUE: () => ENUM_OFF_VALUE,
25
+ ExtraSettingRow: () => ExtraSettingRow,
26
26
  InputCapabilitiesEditor: () => InputCapabilitiesEditor,
27
+ ModelSettingsPanel: () => ModelSettingsPanel,
27
28
  SettingControlInput: () => SettingControlInput,
29
+ SettingRowFrame: () => SettingRowFrame,
30
+ SettingRowLabel: () => RowLabel,
31
+ SettingsGroupSection: () => SettingsGroupSection,
32
+ formatSettingValue: () => formatSettingValue,
28
33
  useEffectiveSettings: () => useEffectiveSettings,
29
34
  useSettingsEntry: () => useSettingsEntry,
30
35
  useSettingsSelector: () => useSettingsSelector
@@ -211,9 +216,19 @@ function readEffectiveSettings(entry) {
211
216
  var import_react = require("react");
212
217
  var import_design_system = require("@ai-matrx/design-system");
213
218
  var import_controls = require("@ai-matrx/design-system/controls");
214
- var import_text_case = require("@ai-matrx/kit/text-case");
215
- var import_jsx_runtime = require("react/jsx-runtime");
219
+
220
+ // settings/setting-state.ts
216
221
  var ENUM_OFF_VALUE = "none";
222
+ function isOffValue(value, control) {
223
+ if (value === false) return true;
224
+ if (value === ENUM_OFF_VALUE) {
225
+ return !control || control.type === "enum";
226
+ }
227
+ return false;
228
+ }
229
+
230
+ // settings/react/SettingControlInput.tsx
231
+ var import_jsx_runtime = require("react/jsx-runtime");
217
232
  var SELECT_MAX_OPTIONS = 12;
218
233
  function choiceFor(options) {
219
234
  if ((0, import_controls.isAspectRatioOptionSet)(options)) return "aspect-ratio";
@@ -235,16 +250,13 @@ function flattenTypeObject(value) {
235
250
  }
236
251
  function SettingControlInput({
237
252
  settingKey,
238
- explicitState = false,
239
253
  control,
240
254
  value,
241
255
  onChange,
242
256
  disabled = false,
243
- id,
244
- size = "dense"
257
+ id
245
258
  }) {
246
259
  const inputId = id ?? `setting-control-${settingKey}`;
247
- const comfortable = size === "comfortable";
248
260
  if (control.type === "enum" && control.enum?.length) {
249
261
  const flattened = settingKey === "response_format" ? flattenTypeObject(value) : value;
250
262
  const stringValue = flattened === void 0 || flattened === null ? "" : String(flattened);
@@ -260,7 +272,7 @@ function SettingControlInput({
260
272
  variant: "inline",
261
273
  disabled,
262
274
  id: inputId,
263
- placeholder: explicitState ? "Not set" : "Default"
275
+ placeholder: "Default"
264
276
  }
265
277
  ) : choice === "searchable" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
266
278
  import_controls.OptionCombobox,
@@ -268,11 +280,10 @@ function SettingControlInput({
268
280
  value: isValueMismatch ? "" : stringValue,
269
281
  onChange: emit,
270
282
  options: control.enum,
271
- getLabel: explicitState ? import_text_case.humanizeIdentifier : void 0,
272
283
  variant: "inline",
273
284
  disabled,
274
285
  id: inputId,
275
- placeholder: explicitState ? "Not set" : "Default"
286
+ placeholder: "Default"
276
287
  }
277
288
  ) : null;
278
289
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-1 items-center gap-1.5", children: [
@@ -287,21 +298,16 @@ function SettingControlInput({
287
298
  import_design_system.SelectTrigger,
288
299
  {
289
300
  id: inputId,
290
- className: comfortable ? "h-9 flex-1 rounded-lg border-border bg-background px-2.5 text-sm text-foreground shadow-none focus:ring-0 pointer-coarse:h-11 [&_svg]:h-4 [&_svg]:w-4" : "h-7 flex-1 border-0 bg-transparent px-1 text-xs font-medium text-foreground/80 shadow-none hover:bg-transparent hover:text-foreground focus:ring-0 [&_svg]:h-3 [&_svg]:w-3",
291
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
292
- import_design_system.SelectValue,
293
- {
294
- placeholder: isValueMismatch ? stringValue : explicitState ? "Not set" : "Default"
295
- }
296
- )
301
+ className: "h-7 flex-1 border-0 bg-transparent px-1 text-xs font-medium text-foreground shadow-none hover:bg-transparent focus:ring-0 pointer-coarse:h-11 [&_svg]:h-3 [&_svg]:w-3",
302
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.SelectValue, { placeholder: isValueMismatch ? stringValue : "Default" })
297
303
  }
298
304
  ),
299
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.SelectContent, { className: comfortable ? "text-sm" : "text-xs", children: control.enum.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
305
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.SelectContent, { className: "text-xs", children: control.enum.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
300
306
  import_design_system.SelectItem,
301
307
  {
302
308
  value: option,
303
- className: comfortable ? "text-sm" : "py-1 text-xs",
304
- children: option === ENUM_OFF_VALUE ? "Off" : explicitState ? (0, import_text_case.humanizeIdentifier)(option) : option
309
+ className: "py-1 text-xs",
310
+ children: option === ENUM_OFF_VALUE ? "Off" : option
305
311
  },
306
312
  option
307
313
  )) })
@@ -319,22 +325,12 @@ function SettingControlInput({
319
325
  ] });
320
326
  }
321
327
  if (control.type === "boolean") {
322
- if (comfortable && !explicitState)
323
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
324
- import_design_system.Switch,
325
- {
326
- id: inputId,
327
- checked: value === true,
328
- onCheckedChange: (next) => onChange(next),
329
- disabled
330
- }
331
- ) });
332
328
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
333
329
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
334
330
  import_design_system.Checkbox,
335
331
  {
336
332
  id: inputId,
337
- checked: explicitState && value == null ? "indeterminate" : value === true,
333
+ checked: value === true,
338
334
  onCheckedChange: (c) => onChange(c === true),
339
335
  disabled,
340
336
  className: "cursor-pointer"
@@ -345,30 +341,12 @@ function SettingControlInput({
345
341
  {
346
342
  htmlFor: inputId,
347
343
  className: "cursor-pointer text-xs text-muted-foreground",
348
- children: explicitState ? value == null ? "Unknown" : value === true ? "Yes" : "No" : value === true ? "On" : "Off"
344
+ children: value === true ? "On" : "Off"
349
345
  }
350
346
  )
351
347
  ] });
352
348
  }
353
349
  if (control.type === "number" || control.type === "integer") {
354
- if (explicitState && typeof value !== "number")
355
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
356
- import_design_system.Input,
357
- {
358
- id: inputId,
359
- type: "number",
360
- value: "",
361
- placeholder: "Not set",
362
- min: control.min,
363
- max: control.max,
364
- step: control.type === "integer" ? 1 : "any",
365
- disabled,
366
- onChange: (event) => {
367
- if (event.target.value !== "") onChange(Number(event.target.value));
368
- },
369
- className: "h-8 text-sm"
370
- }
371
- );
372
350
  const numeric = typeof value === "number" ? value : void 0;
373
351
  const hasRange = control.min !== void 0 && control.max !== void 0;
374
352
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -383,8 +361,7 @@ function SettingControlInput({
383
361
  step: control.type === "integer" ? 1 : 0.01,
384
362
  isInteger: control.type === "integer",
385
363
  disabled,
386
- withSlider: hasRange,
387
- size
364
+ withSlider: hasRange
388
365
  }
389
366
  );
390
367
  }
@@ -421,7 +398,7 @@ function SettingControlInput({
421
398
  value: value === void 0 || value === null ? "" : String(value),
422
399
  onChange: (e) => onChange(e.target.value),
423
400
  disabled,
424
- className: comfortable ? "h-9 w-full px-2.5 text-sm pointer-coarse:h-11" : "h-7 w-full px-2 text-base sm:text-xs"
401
+ className: "h-7 w-full px-2 text-base pointer-coarse:h-11 sm:text-xs"
425
402
  }
426
403
  );
427
404
  }
@@ -479,11 +456,9 @@ function NumberInput({
479
456
  step = 1,
480
457
  isInteger = false,
481
458
  disabled = false,
482
- withSlider = false,
483
- size = "dense"
459
+ withSlider = false
484
460
  }) {
485
- const comfortable = size === "comfortable";
486
- const boxClass = comfortable ? "h-9 px-2.5 text-sm tabular-nums pointer-coarse:h-11" : "h-7 px-2 text-xs";
461
+ const boxClass = "h-7 px-2 text-xs tabular-nums pointer-coarse:h-11";
487
462
  const [draftState, setDraftState] = (0, import_react.useState)(() => ({
488
463
  sourceValue: value,
489
464
  text: value === void 0 ? "" : String(value)
@@ -505,7 +480,7 @@ function NumberInput({
505
480
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
506
481
  "div",
507
482
  {
508
- className: comfortable ? "grid grid-cols-[1fr_6rem] items-center gap-3" : "grid grid-cols-[1fr_4rem] items-center gap-2",
483
+ className: "grid grid-cols-[1fr_4.5rem] items-center gap-2",
509
484
  children: [
510
485
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
511
486
  import_design_system.Slider,
@@ -566,157 +541,566 @@ function NumberInput({
566
541
  }
567
542
 
568
543
  // settings/react/InputCapabilitiesEditor.tsx
569
- var import_design_system2 = require("@ai-matrx/design-system");
544
+ var import_design_system3 = require("@ai-matrx/design-system");
545
+ var import_controls2 = require("@ai-matrx/design-system/controls");
546
+
547
+ // settings/react/settings-icons.tsx
570
548
  var import_jsx_runtime2 = require("react/jsx-runtime");
571
- var cn = (...parts) => parts.filter(Boolean).join(" ");
572
549
  function Svg({ className, children }) {
573
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", className, children });
550
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
551
+ "svg",
552
+ {
553
+ xmlns: "http://www.w3.org/2000/svg",
554
+ viewBox: "0 0 24 24",
555
+ fill: "none",
556
+ stroke: "currentColor",
557
+ strokeWidth: 2,
558
+ strokeLinecap: "round",
559
+ strokeLinejoin: "round",
560
+ "aria-hidden": "true",
561
+ className,
562
+ children
563
+ }
564
+ );
574
565
  }
575
- var ImageIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
566
+ var CircleCheckGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
567
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
568
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m16 9-5.5 5.5L8 12" })
569
+ ] });
570
+ var TriangleAlertGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
571
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
572
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 9v4" }),
573
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 17h.01" })
574
+ ] });
575
+ var VariableGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
576
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 21s-4-3-4-9 4-9 4-9" }),
577
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M16 3s4 3 4 9-4 9-4 9" }),
578
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "15", x2: "9", y1: "9", y2: "15" }),
579
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "9", x2: "15", y1: "9", y2: "15" })
580
+ ] });
581
+ var UnlinkGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
582
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" }),
583
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" }),
584
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "8", x2: "8", y1: "2", y2: "5" }),
585
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "2", x2: "5", y1: "8", y2: "8" }),
586
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "16", x2: "16", y1: "19", y2: "22" }),
587
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "19", x2: "22", y1: "16", y2: "16" })
588
+ ] });
589
+ var WrenchGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Svg, { className, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z" }) });
590
+ var Trash2Glyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
591
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M10 11v6" }),
592
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M14 11v6" }),
593
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
594
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 6h18" }),
595
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
596
+ ] });
597
+ var RotateCcwGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
598
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
599
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 3v5h5" })
600
+ ] });
601
+ var ImageGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
576
602
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2" }),
577
603
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "9", cy: "9", r: "2" }),
578
604
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
579
605
  ] });
580
- var FileText = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
606
+ var FileTextGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
581
607
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
582
608
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
583
609
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M10 9H8" }),
584
610
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M16 13H8" }),
585
611
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M16 17H8" })
586
612
  ] });
587
- var Youtube = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
613
+ var YoutubeGlyph = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
588
614
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17" }),
589
615
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m10 15 5-3-5-3z" })
590
616
  ] });
591
- var RotateCcw = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { className, children: [
592
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
593
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 3v5h5" })
594
- ] });
617
+
618
+ // settings/react/SettingRowFrame.tsx
619
+ var import_design_system2 = require("@ai-matrx/design-system");
620
+ var import_jsx_runtime3 = require("react/jsx-runtime");
621
+ var cn = (...parts) => parts.filter(Boolean).join(" ");
622
+ function formatSettingValue(value) {
623
+ if (typeof value === "boolean") return value ? "On" : "Off";
624
+ if (value !== null && typeof value === "object") return JSON.stringify(value);
625
+ return String(value);
626
+ }
627
+ function SettingRowFrame({ rowKey, state, leading, label, children, actions }) {
628
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
629
+ "div",
630
+ {
631
+ "data-setting-row": rowKey,
632
+ "data-setting-state": state,
633
+ className: "grid grid-cols-[1rem_minmax(0,1fr)_auto] items-start gap-x-2 gap-y-1 py-1 @md:grid-cols-[1rem_9rem_minmax(0,1fr)_auto]",
634
+ children: [
635
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex h-7 items-center", children: leading }),
636
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex min-h-7 min-w-0 items-center", children: label }),
637
+ children !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "col-span-2 col-start-2 row-start-2 min-w-0 @md:col-span-1 @md:col-start-3 @md:row-start-1", children }) : null,
638
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "col-start-3 row-start-1 flex min-h-7 items-center justify-end @md:col-start-4", children: actions })
639
+ ]
640
+ }
641
+ );
642
+ }
643
+ function RowLabel({ htmlFor, muted, children }) {
644
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system2.Label, { htmlFor, className: cn("min-w-0 truncate type-body", muted ? "text-muted-foreground" : "text-foreground"), children });
645
+ }
646
+ function RowText({ children, mono }) {
647
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn("flex min-h-7 items-center truncate type-secondary text-muted-foreground", mono && "font-mono"), children });
648
+ }
649
+ function SettingsGroupSection({ id, title, children }) {
650
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { "data-settings-group": id, className: title ? "mt-2 border-t border-border pt-2" : void 0, children: [
651
+ title ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "pb-1 type-title text-foreground", children: title }) : null,
652
+ children
653
+ ] });
654
+ }
655
+
656
+ // settings/react/InputCapabilitiesEditor.tsx
657
+ var import_jsx_runtime4 = require("react/jsx-runtime");
595
658
  var GATE_META = {
596
659
  image_urls: {
597
660
  label: "Image URLs",
598
661
  description: "Offer the image-URL attachment input in chat.",
599
- Icon: ImageIcon
662
+ Icon: ImageGlyph
600
663
  },
601
664
  file_urls: {
602
665
  label: "File URLs",
603
666
  description: "Offer the file-URL attachment input in chat.",
604
- Icon: FileText
667
+ Icon: FileTextGlyph
605
668
  },
606
669
  youtube_videos: {
607
670
  label: "YouTube videos",
608
671
  description: "Offer the YouTube-URL attachment input in chat.",
609
- Icon: Youtube
672
+ Icon: YoutubeGlyph
610
673
  }
611
674
  };
612
675
  function InputCapabilitiesEditor({
613
676
  values,
614
677
  onChange,
615
- overriddenKeys,
678
+ changedKeys,
616
679
  onReset,
680
+ resetLabel = "Reset to agent",
681
+ error,
617
682
  idPrefix,
618
683
  title = "Input Capabilities",
619
- variant = "settings"
684
+ disabled = false
620
685
  }) {
621
- if (variant === "menu")
622
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "border-t border-border px-3 pb-3", children: [
623
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "pb-1 pt-3 type-secondary font-medium text-muted-foreground", children: title }),
624
- UI_GATE_EDITABLE_KEYS.map((key) => {
625
- const { label, Icon } = GATE_META[key];
626
- const overridden = overriddenKeys?.has(key) === true;
627
- const switchId = `${idPrefix}-${key}`;
628
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
629
- "div",
630
- {
631
- className: cn(
632
- "-mx-1.5 flex min-h-9 items-center gap-2.5 rounded-lg px-1.5 pointer-coarse:min-h-11",
633
- overridden && "bg-primary/5"
634
- ),
635
- children: [
636
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
637
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
638
- import_design_system2.Label,
639
- {
640
- htmlFor: switchId,
641
- className: "min-w-0 flex-1 cursor-pointer truncate text-sm font-normal text-foreground",
642
- children: label
643
- }
644
- ),
645
- overridden && onReset ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
646
- "button",
647
- {
648
- type: "button",
649
- "aria-label": `Reset ${label} to agent default`,
650
- title: "Reset override",
651
- onClick: () => onReset(key),
652
- className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
653
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RotateCcw, { className: "h-4 w-4" })
654
- }
655
- ) : null,
656
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
657
- import_design_system2.Switch,
658
- {
659
- id: switchId,
660
- checked: values[key] === true,
661
- onCheckedChange: (next) => onChange(key, next),
662
- className: "shrink-0"
663
- }
664
- )
665
- ]
666
- },
667
- key
668
- );
669
- })
670
- ] });
671
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "border-t pt-2 mt-2", children: [
672
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "mb-2 type-secondary font-semibold text-foreground", children: title }),
673
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "space-y-1", children: UI_GATE_EDITABLE_KEYS.map((key) => {
686
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(SettingsGroupSection, { id: "input-capabilities", title, children: [
687
+ UI_GATE_EDITABLE_KEYS.map((key) => {
674
688
  const { label, description, Icon } = GATE_META[key];
675
- const checked = values[key] === true;
676
- const overridden = overriddenKeys?.has(key) === true;
677
689
  const switchId = `${idPrefix}-${key}`;
678
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
679
- "div",
690
+ const changed = changedKeys?.has(key) === true;
691
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
692
+ SettingRowFrame,
680
693
  {
681
- className: "flex items-center gap-2 rounded px-1 py-1 hover:bg-muted/20",
682
- children: [
683
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
684
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
685
- import_design_system2.Label,
686
- {
687
- htmlFor: switchId,
688
- className: "min-w-0 flex-1 cursor-pointer text-xs text-foreground",
689
- children: [
690
- label,
691
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "block type-meta font-normal leading-tight text-muted-foreground", children: description })
692
- ]
693
- }
694
- ),
695
- overridden && onReset ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
696
- import_design_system2.Button,
694
+ rowKey: key,
695
+ state: values[key] === true ? "on" : "off",
696
+ leading: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { className: "h-4 w-4 text-muted-foreground" }),
697
+ label: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RowLabel, { htmlFor: switchId, children: label }),
698
+ actions: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
699
+ changed && onReset ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
700
+ import_controls2.Button,
697
701
  {
698
- variant: "ghost",
699
- size: "icon",
700
- className: "h-6 w-6",
701
- "aria-label": `Reset ${label} to agent default`,
702
+ variant: "quiet",
703
+ icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RotateCcwGlyph, {}),
702
704
  onClick: () => onReset(key),
703
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RotateCcw, { className: "h-3 w-3" })
705
+ disabled,
706
+ "aria-label": `${resetLabel}: ${label}`,
707
+ title: resetLabel,
708
+ "data-setting-reset": key
704
709
  }
705
710
  ) : null,
706
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
707
- import_design_system2.Switch,
711
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
712
+ import_design_system3.Switch,
708
713
  {
709
714
  id: switchId,
710
- checked,
715
+ checked: values[key] === true,
711
716
  onCheckedChange: (next) => onChange(key, next),
712
- className: "shrink-0 data-[state=checked]:bg-primary"
717
+ disabled,
718
+ className: "shrink-0"
713
719
  }
714
720
  )
715
- ]
721
+ ] }),
722
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RowText, { children: description })
716
723
  },
717
724
  key
718
725
  );
719
- }) })
726
+ }),
727
+ error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { role: "alert", className: "py-1 type-meta text-destructive", children: error }) : null
728
+ ] });
729
+ }
730
+
731
+ // settings/react/ModelSettingsPanel.tsx
732
+ var import_design_system4 = require("@ai-matrx/design-system");
733
+ var import_controls3 = require("@ai-matrx/design-system/controls");
734
+
735
+ // settings/settings-catalogue.ts
736
+ var import_text_case = require("@ai-matrx/kit/text-case");
737
+ var CONTROL_TYPES = [
738
+ "number",
739
+ "integer",
740
+ "boolean",
741
+ "string",
742
+ "enum",
743
+ "array",
744
+ "string_array",
745
+ "object_array"
746
+ ];
747
+ function isControlDefinitionShape(value) {
748
+ return typeof value.type === "string" && CONTROL_TYPES.includes(value.type);
749
+ }
750
+ var TEXT_GROUP = [
751
+ { key: "response_format", label: "Response Format" },
752
+ { key: "stop_sequences", label: "Stop Sequences" },
753
+ { key: "temperature", label: "Temperature" },
754
+ { key: "max_output_tokens", label: "Max Output Tokens" },
755
+ { key: "top_p", label: "Top P" },
756
+ { key: "top_k", label: "Top K" },
757
+ { key: "thinking_budget", label: "Thinking Budget" },
758
+ { key: "thinking_level", label: "Thinking Level" },
759
+ { key: "reasoning_effort", label: "Reasoning Effort" },
760
+ { key: "reasoning_summary", label: "Reasoning Summary" },
761
+ // Deep Research agents: charts and images inside the report.
762
+ { key: "visualization", label: "Charts and Images" },
763
+ { key: "verbosity", label: "Verbosity" },
764
+ { key: "tool_choice", label: "Tool Choice" }
765
+ ];
766
+ var FEATURE_FLAGS_GROUP = [
767
+ { key: "stream", label: "Stream Response" },
768
+ { key: "store", label: "Store Conversation" },
769
+ { key: "parallel_tool_calls", label: "Parallel Tool Calls" },
770
+ { key: "include_thoughts", label: "Include Thoughts" },
771
+ { key: "internal_web_search", label: "Internal Web Search" },
772
+ { key: "internal_url_context", label: "Internal URL Context" },
773
+ { key: "disable_safety_checker", label: "Disable Safety Checker" },
774
+ { key: "clear_thinking", label: "Clear Thinking" },
775
+ { key: "disable_reasoning", label: "Disable Reasoning" },
776
+ { key: "generate_audio", label: "Generate Audio" },
777
+ { key: "enhance_prompt", label: "Enhance Prompt" },
778
+ { key: "include_rai_reason", label: "Include RAI Reason" }
779
+ ];
780
+ var IMAGE_VIDEO_GROUP = [
781
+ { key: "size", label: "Size" },
782
+ { key: "quality", label: "Quality" },
783
+ { key: "count", label: "Count" },
784
+ { key: "steps", label: "Steps" },
785
+ { key: "guidance_scale", label: "Guidance Scale" },
786
+ { key: "seed", label: "Seed" },
787
+ { key: "width", label: "Width" },
788
+ { key: "height", label: "Height" },
789
+ { key: "fps", label: "FPS" },
790
+ { key: "seconds", label: "Duration (s) [legacy string]" },
791
+ { key: "output_quality", label: "Output Quality" },
792
+ { key: "negative_prompt", label: "Negative Prompt" },
793
+ { key: "aspect_ratio", label: "Aspect Ratio" },
794
+ { key: "ratio", label: "Aspect Ratio (Together/Runway)" },
795
+ { key: "resolution", label: "Resolution" },
796
+ { key: "image_size", label: "Image Size" },
797
+ { key: "num_outputs", label: "Outputs" },
798
+ { key: "number_of_images", label: "Number of Images" },
799
+ { key: "render_quality", label: "Render Quality" },
800
+ { key: "background", label: "Background" },
801
+ { key: "input_fidelity", label: "Input Fidelity" },
802
+ { key: "output_compression", label: "Output Compression" },
803
+ { key: "moderation", label: "Moderation" },
804
+ { key: "partial_images", label: "Partial Images" },
805
+ { key: "output_mime_type", label: "Output MIME Type" },
806
+ { key: "person_generation", label: "Person Generation" },
807
+ { key: "image_format", label: "Image Format" },
808
+ { key: "style", label: "Style" },
809
+ { key: "reference_strength", label: "Reference Strength" },
810
+ { key: "duration_seconds", label: "Duration (s)" },
811
+ { key: "duration", label: "Duration" },
812
+ { key: "encode_quality", label: "Encode Quality" },
813
+ { key: "video_action", label: "Video Action" },
814
+ { key: "reference_images", label: "Reference Images" },
815
+ { key: "frame_images", label: "Frame Images" },
816
+ { key: "image_loras", label: "Image LoRAs" }
817
+ ];
818
+ var AUDIO_GROUP = [
819
+ { key: "tts_voice", label: "Voice" },
820
+ { key: "performance_direction", label: "Performance Direction" },
821
+ { key: "speech_speed", label: "Speed" },
822
+ { key: "turn_pause_ms", label: "Pause Between Turns (ms)" },
823
+ { key: "language_code", label: "Language" },
824
+ { key: "audio_format", label: "Audio Format" }
825
+ ];
826
+ var SETTINGS_CATALOGUE = [
827
+ { id: "text", label: "", entries: TEXT_GROUP },
828
+ { id: "featureFlags", label: "Feature Flags", entries: FEATURE_FLAGS_GROUP },
829
+ { id: "imageVideo", label: "Image / Video Settings", entries: IMAGE_VIDEO_GROUP },
830
+ { id: "audio", label: "Audio Settings", entries: AUDIO_GROUP }
831
+ ];
832
+ var CATALOGUE_KEYS = new Set(
833
+ SETTINGS_CATALOGUE.flatMap((g) => g.entries.map((e) => e.key))
834
+ );
835
+ var CATCHALL_EXCLUDED = /* @__PURE__ */ new Set([
836
+ "rawControls",
837
+ "unmappedControls",
838
+ "model_id",
839
+ "model",
840
+ // chosen via the dedicated model picker, never a generic settings row
841
+ "multi_speaker",
842
+ // edited via the Voice editor alongside tts_voice
843
+ // Model-gated UI flags live in the ui_gates column + UiGatesEditor, never as
844
+ // settings rows — even when the model declares them as controls (e.g. every
845
+ // model now declares `tools` for the tool-support capability).
846
+ ...UI_GATE_KEYS
847
+ ]);
848
+ function lookupControl(controls, key) {
849
+ if (!controls) return null;
850
+ if (CATCHALL_EXCLUDED.has(key)) {
851
+ if (key === "rawControls" || key === "unmappedControls") return null;
852
+ }
853
+ const candidate = controls[key];
854
+ if (candidate && typeof candidate === "object" && !Array.isArray(candidate)) {
855
+ const c = candidate;
856
+ if (isControlDefinitionShape(c)) {
857
+ return c;
858
+ }
859
+ }
860
+ return null;
861
+ }
862
+ function hasMeaningfulValue(settings, key) {
863
+ if (!settings) return false;
864
+ const v = settings[key];
865
+ return v !== void 0 && v !== null;
866
+ }
867
+ function buildSettingsRows(controls, settings) {
868
+ const groups = SETTINGS_CATALOGUE.map((group) => ({
869
+ id: group.id,
870
+ label: group.label,
871
+ rows: group.entries.flatMap((entry) => {
872
+ const control = lookupControl(controls, entry.key);
873
+ if (!control) return [];
874
+ return [
875
+ {
876
+ key: entry.key,
877
+ label: entry.label,
878
+ group: group.id,
879
+ control,
880
+ supported: true,
881
+ hasValue: hasMeaningfulValue(settings, entry.key)
882
+ }
883
+ ];
884
+ })
885
+ }));
886
+ const declaredExtra = [];
887
+ if (controls) {
888
+ for (const key of Object.keys(controls)) {
889
+ if (CATALOGUE_KEYS.has(key) || CATCHALL_EXCLUDED.has(key)) continue;
890
+ if (lookupControl(controls, key)) declaredExtra.push(key);
891
+ }
892
+ }
893
+ if (declaredExtra.length > 0) {
894
+ const rows = declaredExtra.sort().map((key) => ({
895
+ key,
896
+ label: (0, import_text_case.humanizeIdentifier)(key),
897
+ group: "other",
898
+ control: lookupControl(controls, key),
899
+ supported: true,
900
+ hasValue: hasMeaningfulValue(settings, key)
901
+ }));
902
+ groups.push({ id: "other", label: "Other Settings", rows });
903
+ }
904
+ return groups;
905
+ }
906
+
907
+ // settings/react/ModelSettingsPanel.tsx
908
+ var import_jsx_runtime5 = require("react/jsx-runtime");
909
+ function StatusGlyph({ issue, source }) {
910
+ const title = issue ? issue.message : source ? `Valid \xB7 ${source}` : "Valid";
911
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
912
+ "span",
913
+ {
914
+ className: cn("inline-flex h-7 w-6 shrink-0 items-center justify-center", issue ? "text-warning" : "text-success"),
915
+ role: "img",
916
+ "aria-label": title,
917
+ title,
918
+ children: issue ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TriangleAlertGlyph, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CircleCheckGlyph, { className: "h-3.5 w-3.5" })
919
+ }
920
+ );
921
+ }
922
+ function ModelSettingRow({ row, control, target, idPrefix, disabled }) {
923
+ const read = target.read(row.key, control);
924
+ const resetLabel = target.resetLabel ?? "Reset to agent";
925
+ const reset = read.changedHere && target.resetToInherited ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
926
+ import_controls3.Button,
927
+ {
928
+ variant: "quiet",
929
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RotateCcwGlyph, {}),
930
+ onClick: () => target.resetToInherited?.(row.key),
931
+ disabled,
932
+ "aria-label": `${resetLabel}: ${row.label}`,
933
+ title: resetLabel,
934
+ "data-setting-reset": row.key
935
+ }
936
+ ) : null;
937
+ if (read.state === "bound") {
938
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
939
+ SettingRowFrame,
940
+ {
941
+ rowKey: row.key,
942
+ state: "bound",
943
+ leading: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system4.Checkbox, { checked: true, disabled: true, "aria-label": `${row.label} is a run input` }),
944
+ label: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RowLabel, { children: row.label }),
945
+ actions: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
946
+ reset,
947
+ target.unbind ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
948
+ import_controls3.Button,
949
+ {
950
+ variant: "quiet",
951
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UnlinkGlyph, {}),
952
+ onClick: () => target.unbind?.(row.key, control),
953
+ disabled,
954
+ "aria-label": `Make ${row.label} a fixed setting`,
955
+ title: "Make a fixed setting"
956
+ }
957
+ ) : null
958
+ ] }),
959
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex min-h-7 min-w-0 items-center gap-2", "data-bound-control": row.key, children: [
960
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls3.Chip, { tone: "primary", icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VariableGlyph, {}), label: `{{${read.variableName}}}` }),
961
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate type-meta text-muted-foreground", children: read.value === void 0 || read.value === null || read.value === "" ? "Model default" : formatSettingValue(read.value) })
962
+ ] })
963
+ }
964
+ );
965
+ }
966
+ const isSet = read.state === "set";
967
+ const value = isSet ? read.value : void 0;
968
+ const isOff = isSet && isOffValue(value, control);
969
+ const checkboxId = `${idPrefix}-setting-${row.key}`;
970
+ const canBind = Boolean(target.bind) && (target.canBind?.(row.key) ?? true);
971
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
972
+ SettingRowFrame,
973
+ {
974
+ rowKey: row.key,
975
+ state: isOff ? "off" : read.state,
976
+ leading: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
977
+ import_design_system4.Checkbox,
978
+ {
979
+ id: checkboxId,
980
+ checked: isSet,
981
+ disabled,
982
+ onCheckedChange: (next) => next === true ? target.turnOn(row.key, control) : target.clear(row.key)
983
+ }
984
+ ),
985
+ label: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RowLabel, { htmlFor: checkboxId, muted: !isSet, children: row.label }),
986
+ actions: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
987
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusGlyph, { issue: read.issue, source: read.source }),
988
+ canBind ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
989
+ import_controls3.Button,
990
+ {
991
+ variant: "quiet",
992
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VariableGlyph, {}),
993
+ onClick: () => target.bind?.(row.key, control),
994
+ disabled,
995
+ "aria-label": `Make ${row.label} a run input`,
996
+ title: "Make a run input",
997
+ "data-bind-control": row.key
998
+ }
999
+ ) : null,
1000
+ isSet && read.issue?.fixable && target.fix ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1001
+ import_controls3.Button,
1002
+ {
1003
+ variant: "quiet",
1004
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WrenchGlyph, {}),
1005
+ onClick: () => target.fix?.(row.key),
1006
+ disabled,
1007
+ "aria-label": `Fix ${row.label} automatically`,
1008
+ title: "Fix automatically"
1009
+ }
1010
+ ) : null,
1011
+ reset,
1012
+ isSet ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1013
+ import_controls3.Button,
1014
+ {
1015
+ variant: "quiet",
1016
+ removes: true,
1017
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Trash2Glyph, {}),
1018
+ onClick: () => target.clear(row.key),
1019
+ disabled,
1020
+ "aria-label": `Clear ${row.label} to not set`,
1021
+ title: "Clear to not set",
1022
+ "data-setting-clear": row.key
1023
+ }
1024
+ ) : null
1025
+ ] }),
1026
+ children: isSet ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1027
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1028
+ SettingControlInput,
1029
+ {
1030
+ settingKey: row.key,
1031
+ control,
1032
+ value,
1033
+ onChange: (next) => target.change(row.key, next, control),
1034
+ disabled,
1035
+ id: `${idPrefix}-control-${row.key}`
1036
+ }
1037
+ ),
1038
+ read.issue ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "pt-1 type-meta text-warning-ink", children: read.issue.message }) : null
1039
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RowText, { children: read.modelDefault !== void 0 && read.modelDefault !== null ? `Not set \xB7 Model default: ${formatSettingValue(read.modelDefault)}` : "Not set" })
1040
+ }
1041
+ );
1042
+ }
1043
+ function ExtraSettingRow({ rowKey, label, value, kind, onClear, onReset, resetLabel = "Reset to agent", disabled = false }) {
1044
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1045
+ SettingRowFrame,
1046
+ {
1047
+ rowKey,
1048
+ state: kind,
1049
+ label: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RowLabel, { children: label }),
1050
+ actions: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1051
+ kind === "translated" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls3.Chip, { tone: "sky", label: "Translated", title: "Kept as set and sent as this model's closest equivalent" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls3.Chip, { tone: "warning", label: "Not on this model", title: "This model has no such setting" }),
1052
+ onReset ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls3.Button, { variant: "quiet", icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RotateCcwGlyph, {}), onClick: onReset, disabled, "aria-label": `${resetLabel}: ${label}`, title: resetLabel }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_controls3.Button, { variant: "quiet", removes: true, icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Trash2Glyph, {}), onClick: onClear, disabled, "aria-label": `Clear ${label}`, title: "Clear to not set" })
1053
+ ] }),
1054
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RowText, { mono: true, children: isOffValue(value, null) ? "Off" : formatSettingValue(value) })
1055
+ }
1056
+ );
1057
+ }
1058
+ function ModelSettingsPanel({
1059
+ controls,
1060
+ values,
1061
+ target,
1062
+ idPrefix,
1063
+ model,
1064
+ notices,
1065
+ renderRow,
1066
+ capabilities,
1067
+ emptyNote,
1068
+ disabled = false
1069
+ }) {
1070
+ const groups = controls ? buildSettingsRows(controls, values).filter((group) => group.rows.length > 0) : [];
1071
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-model-settings-panel": "", className: "@container flex min-w-0 flex-col", children: [
1072
+ model ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SettingRowFrame, { rowKey: "model", label: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RowLabel, { children: "Model" }), children: model }) : null,
1073
+ notices,
1074
+ groups.length === 0 && emptyNote ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "py-2 type-secondary text-muted-foreground", children: emptyNote }) : null,
1075
+ groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SettingsGroupSection, { id: group.id, title: group.label || void 0, children: group.rows.map((row) => {
1076
+ const custom = renderRow?.(row);
1077
+ if (custom !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: custom }, row.key);
1078
+ if (!row.control) return null;
1079
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1080
+ ModelSettingRow,
1081
+ {
1082
+ row,
1083
+ control: row.control,
1084
+ target,
1085
+ idPrefix,
1086
+ disabled
1087
+ },
1088
+ row.key
1089
+ );
1090
+ }) }, group.id)),
1091
+ capabilities ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1092
+ InputCapabilitiesEditor,
1093
+ {
1094
+ values: capabilities.values,
1095
+ onChange: capabilities.change,
1096
+ changedKeys: capabilities.changedKeys,
1097
+ onReset: capabilities.resetToInherited,
1098
+ resetLabel: target.resetLabel,
1099
+ error: capabilities.error,
1100
+ idPrefix: `${idPrefix}-capability`,
1101
+ disabled
1102
+ }
1103
+ ) : null
720
1104
  ] });
721
1105
  }
722
1106