@ai-matrx/agents 0.59.190 → 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.
@@ -892,9 +892,87 @@ function readConflictSummary(entry) {
892
892
  function readEffectiveVariableValues(entry) {
893
893
  return entry ? mergeVariableValues(entry.variable_defaults, entry.variable_overrides) : {};
894
894
  }
895
+
896
+ // settings/setting-state.ts
897
+ var ENUM_OFF_VALUE = "none";
898
+ function offValueFor(control) {
899
+ if (!control) return void 0;
900
+ if (control.type === "boolean") return false;
901
+ if (control.type === "enum" && control.enum?.includes(ENUM_OFF_VALUE)) {
902
+ return ENUM_OFF_VALUE;
903
+ }
904
+ return void 0;
905
+ }
906
+ function isOffValue(value, control) {
907
+ if (value === false) return true;
908
+ if (value === ENUM_OFF_VALUE) {
909
+ return !control || control.type === "enum";
910
+ }
911
+ return false;
912
+ }
913
+ function settingStateOf(settings, key, control) {
914
+ const value = settings?.[key];
915
+ if (value === void 0 || value === null) return "unset";
916
+ return isOffValue(value, control) ? "off" : "value";
917
+ }
918
+ function withSettingState(settings, key, state, control, value) {
919
+ if (state === "unset") {
920
+ const { [key]: _removed, ...rest } = settings;
921
+ return rest;
922
+ }
923
+ if (state === "off") {
924
+ const off = offValueFor(control);
925
+ if (off === void 0) return settings;
926
+ return { ...settings, [key]: off };
927
+ }
928
+ if (value === void 0 || value === null) {
929
+ const { [key]: _removed, ...rest } = settings;
930
+ return rest;
931
+ }
932
+ return { ...settings, [key]: value };
933
+ }
934
+
935
+ // settings/auto-means-unset.ts
936
+ var AUTO_VALUE = "auto";
937
+ var AUTO_MEANS_UNSET_KEYS = /* @__PURE__ */ new Set([
938
+ "reasoning_effort",
939
+ "visualization"
940
+ ]);
941
+ function isUnsetChoice(key, value) {
942
+ if (value === void 0 || value === null) return true;
943
+ return value === AUTO_VALUE && AUTO_MEANS_UNSET_KEYS.has(key);
944
+ }
945
+
946
+ // settings/starting-value.ts
947
+ function startingValueFor(key, control) {
948
+ let value = control.default;
949
+ if (value === null || value === void 0) {
950
+ if (control.type === "number" || control.type === "integer") {
951
+ value = control.min ?? 0;
952
+ } else if (control.type === "string" || control.type === "string_array") {
953
+ value = "";
954
+ } else if (control.type === "boolean") {
955
+ value = false;
956
+ } else if (control.type === "enum" && control.enum?.length) {
957
+ value = control.enum[0];
958
+ } else if (control.type === "array" || control.type === "object_array") {
959
+ value = [];
960
+ }
961
+ }
962
+ if (isUnsetChoice(key, value) && control.type === "enum" && control.enum?.length) {
963
+ value = control.enum.find((choice) => !isUnsetChoice(key, choice));
964
+ }
965
+ if (key === "response_format" && typeof value === "string") {
966
+ value = value === "" ? void 0 : { type: value };
967
+ }
968
+ return value;
969
+ }
895
970
  export {
971
+ AUTO_MEANS_UNSET_KEYS,
972
+ AUTO_VALUE,
896
973
  CATALOGUE_KEYS,
897
974
  EMPTY_UI_GATES,
975
+ ENUM_OFF_VALUE,
898
976
  PARAM_ALIASES,
899
977
  SETTINGS_CATALOGUE,
900
978
  UI_GATE_EDITABLE_KEYS,
@@ -908,9 +986,12 @@ export {
908
986
  extractModelDefaults,
909
987
  gateEnabled,
910
988
  getActionForMode,
989
+ isOffValue,
911
990
  isUiGateKey,
991
+ isUnsetChoice,
912
992
  mergeEffectiveSettings,
913
993
  mergeVariableValues,
994
+ offValueFor,
914
995
  parseModelControls,
915
996
  parseUiGates,
916
997
  readApiPayload,
@@ -922,5 +1003,8 @@ export {
922
1003
  readPreviewedResolution,
923
1004
  readSettingsEntry,
924
1005
  resolveConflicts,
925
- sanitizeSettings
1006
+ sanitizeSettings,
1007
+ settingStateOf,
1008
+ startingValueFor,
1009
+ withSettingState
926
1010
  };