linkshell-cli 0.3.17 → 0.3.18

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.
@@ -1083,10 +1083,13 @@ function runtimeCommands(provider, value) {
1083
1083
  function parseModelListCapabilities(value) {
1084
1084
  const raw = asRecord(value);
1085
1085
  const modelsValue = Array.isArray(value) ? value :
1086
- Array.isArray(raw?.models) ? raw.models :
1087
- Array.isArray(raw?.items) ? raw.items :
1088
- Array.isArray(raw?.modelOptions) ? raw.modelOptions :
1089
- [];
1086
+ Array.isArray(raw?.data) ? raw.data :
1087
+ Array.isArray(raw?.models) ? raw.models :
1088
+ Array.isArray(raw?.items) ? raw.items :
1089
+ Array.isArray(raw?.modelOptions) ? raw.modelOptions :
1090
+ [];
1091
+ const effortSet = new Set();
1092
+ let defaultModelFromEntry;
1090
1093
  const models = modelsValue
1091
1094
  .map((entry, index) => {
1092
1095
  const model = asRecord(entry);
@@ -1096,24 +1099,49 @@ function parseModelListCapabilities(value) {
1096
1099
  : undefined;
1097
1100
  }
1098
1101
  const modelId = firstString(model, ["id", "model", "name", "value"]) ?? `model-${index + 1}`;
1099
- const label = firstString(model, ["label", "title", "displayName", "name"]) ?? modelId;
1100
- return { id: modelId, label };
1102
+ const label = firstString(model, ["displayName", "label", "title", "name", "model"]) ?? modelId;
1103
+ if (model.hidden === true)
1104
+ return undefined;
1105
+ const modelEfforts = arrayFromKeys(model, ["supportedReasoningEfforts", "reasoningEfforts"])
1106
+ .map((effort) => {
1107
+ const rawEffort = asRecord(effort);
1108
+ return firstString(rawEffort, ["reasoningEffort", "id", "value"]) ?? (typeof effort === "string" ? effort : undefined);
1109
+ })
1110
+ .filter((effort) => Boolean(effort) && ALL_REASONING_EFFORTS.includes(effort));
1111
+ modelEfforts.forEach((effort) => effortSet.add(effort));
1112
+ const defaultReasoningEffort = firstString(model, ["defaultReasoningEffort", "default_reasoning_effort"]);
1113
+ if (defaultReasoningEffort && ALL_REASONING_EFFORTS.includes(defaultReasoningEffort)) {
1114
+ effortSet.add(defaultReasoningEffort);
1115
+ }
1116
+ const modalities = arrayFromKeys(model, ["inputModalities", "modalities"]);
1117
+ if (model.isDefault === true)
1118
+ defaultModelFromEntry = modelId;
1119
+ return {
1120
+ id: modelId,
1121
+ label,
1122
+ ...(modelEfforts.length > 0 ? { reasoningEfforts: modelEfforts } : {}),
1123
+ ...(defaultReasoningEffort ? { defaultReasoningEffort } : {}),
1124
+ ...(modalities.length > 0 ? { supportsImages: modalities.includes("image") } : {}),
1125
+ ...(firstString(model, ["description"]) ? { description: firstString(model, ["description"]) } : {}),
1126
+ };
1101
1127
  })
1102
1128
  .filter((entry) => Boolean(entry));
1103
1129
  const defaultModel = firstString(raw, ["defaultModel", "default_model", "currentModel"]) ??
1104
- firstString(asRecord(raw?.defaults), ["model"]);
1130
+ firstString(asRecord(raw?.defaults), ["model"]) ??
1131
+ defaultModelFromEntry;
1105
1132
  const effortsValue = Array.isArray(raw?.reasoningEfforts) ? raw.reasoningEfforts :
1106
1133
  Array.isArray(raw?.reasoning_efforts) ? raw.reasoning_efforts :
1107
1134
  Array.isArray(raw?.efforts) ? raw.efforts :
1108
1135
  undefined;
1109
1136
  const reasoningEfforts = effortsValue
1110
1137
  ?.filter((entry) => typeof entry === "string" && ALL_REASONING_EFFORTS.includes(entry));
1111
- if (models.length === 0 && !defaultModel && !reasoningEfforts?.length)
1138
+ const resolvedReasoningEfforts = reasoningEfforts?.length ? reasoningEfforts : [...effortSet];
1139
+ if (models.length === 0 && !defaultModel && resolvedReasoningEfforts.length === 0)
1112
1140
  return undefined;
1113
1141
  return {
1114
- ...(models.length > 0 ? { models: [{ id: "default", label: "默认模型" }, ...models] } : {}),
1142
+ ...(models.length > 0 ? { models } : {}),
1115
1143
  ...(defaultModel ? { defaultModel } : {}),
1116
- ...(reasoningEfforts?.length ? { reasoningEfforts } : {}),
1144
+ ...(resolvedReasoningEfforts.length > 0 ? { reasoningEfforts: resolvedReasoningEfforts } : {}),
1117
1145
  };
1118
1146
  }
1119
1147
  function parseTimestamp(value) {