linkshell-cli 0.5.0 → 0.5.1

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.
@@ -766,16 +766,12 @@ interface ProviderRuntimeCapabilities {
766
766
  const ALL_REASONING_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh"] as const;
767
767
  const ALL_PERMISSION_MODES = ["read_only", "workspace_write", "full_access"] as const;
768
768
 
769
+ // Codex `model/list` is the source of truth — these are only used when the RPC
770
+ // returns nothing so mobile still sees a usable picker.
769
771
  const CODEX_FALLBACK_MODELS: AgentModelOption[] = [
770
772
  { id: "default", label: "默认模型" },
771
- { id: "gpt-5", label: "GPT-5" },
772
- { id: "gpt-5-codex", label: "GPT-5 Codex" },
773
- { id: "gpt-5-pro", label: "GPT-5 Pro" },
774
- { id: "gpt-5-high", label: "GPT-5 High" },
775
- { id: "o3", label: "o3" },
776
- { id: "o3-mini", label: "o3-mini" },
777
773
  ];
778
- const CODEX_FALLBACK_DEFAULT_MODEL = "gpt-5";
774
+ const CODEX_FALLBACK_DEFAULT_MODEL = "default";
779
775
  const CODEX_COMMAND_NAMES = ["plan", "exit-plan", "compact", "clear", "status", "review", "subagents"] as const;
780
776
  const CLAUDE_REMOTE_HIDDEN_COMMANDS = new Set([
781
777
  "add-dir",
@@ -1161,10 +1157,13 @@ function parseModelListCapabilities(value: unknown): ProviderRuntimeCapabilities
1161
1157
  const raw = asRecord(value);
1162
1158
  const modelsValue =
1163
1159
  Array.isArray(value) ? value :
1160
+ Array.isArray(raw?.data) ? raw.data :
1164
1161
  Array.isArray(raw?.models) ? raw.models :
1165
1162
  Array.isArray(raw?.items) ? raw.items :
1166
1163
  Array.isArray(raw?.modelOptions) ? raw.modelOptions :
1167
1164
  [];
1165
+ let inferredDefault: string | undefined;
1166
+ const efforts = new Set<string>();
1168
1167
  const models = modelsValue
1169
1168
  .map((entry, index) => {
1170
1169
  const model = asRecord(entry);
@@ -1173,24 +1172,44 @@ function parseModelListCapabilities(value: unknown): ProviderRuntimeCapabilities
1173
1172
  ? { id: entry, label: entry }
1174
1173
  : undefined;
1175
1174
  }
1175
+ if (model.hidden === true) return undefined;
1176
1176
  const modelId = firstString(model, ["id", "model", "name", "value"]) ?? `model-${index + 1}`;
1177
- const label = firstString(model, ["label", "title", "displayName", "name"]) ?? modelId;
1177
+ const label = firstString(model, ["displayName", "label", "title", "name"]) ?? modelId;
1178
+ if (model.isDefault === true && !inferredDefault) inferredDefault = modelId;
1179
+ const supported = Array.isArray(model.supportedReasoningEfforts) ? model.supportedReasoningEfforts : [];
1180
+ for (const item of supported) {
1181
+ const effort = typeof item === "string"
1182
+ ? item
1183
+ : firstString(asRecord(item), ["reasoningEffort", "id", "value"]);
1184
+ if (effort && ALL_REASONING_EFFORTS.includes(effort as typeof ALL_REASONING_EFFORTS[number])) {
1185
+ efforts.add(effort);
1186
+ }
1187
+ }
1178
1188
  return { id: modelId, label };
1179
1189
  })
1180
1190
  .filter((entry): entry is AgentModelOption => Boolean(entry));
1181
1191
  const defaultModel =
1182
1192
  firstString(raw, ["defaultModel", "default_model", "currentModel"]) ??
1183
- firstString(asRecord(raw?.defaults), ["model"]);
1184
- const effortsValue =
1193
+ firstString(asRecord(raw?.defaults), ["model"]) ??
1194
+ inferredDefault;
1195
+ const explicitEffortsValue =
1185
1196
  Array.isArray(raw?.reasoningEfforts) ? raw.reasoningEfforts :
1186
1197
  Array.isArray(raw?.reasoning_efforts) ? raw.reasoning_efforts :
1187
1198
  Array.isArray(raw?.efforts) ? raw.efforts :
1188
1199
  undefined;
1189
- const reasoningEfforts = effortsValue
1190
- ?.filter((entry): entry is string => typeof entry === "string" && ALL_REASONING_EFFORTS.includes(entry as typeof ALL_REASONING_EFFORTS[number]));
1200
+ if (explicitEffortsValue) {
1201
+ for (const item of explicitEffortsValue) {
1202
+ if (typeof item === "string" && ALL_REASONING_EFFORTS.includes(item as typeof ALL_REASONING_EFFORTS[number])) {
1203
+ efforts.add(item);
1204
+ }
1205
+ }
1206
+ }
1207
+ const reasoningEfforts = efforts.size
1208
+ ? ALL_REASONING_EFFORTS.filter((effort) => efforts.has(effort))
1209
+ : undefined;
1191
1210
  if (models.length === 0 && !defaultModel && !reasoningEfforts?.length) return undefined;
1192
1211
  return {
1193
- ...(models.length > 0 ? { models: [{ id: "default", label: "默认模型" }, ...models] } : {}),
1212
+ ...(models.length > 0 ? { models } : {}),
1194
1213
  ...(defaultModel ? { defaultModel } : {}),
1195
1214
  ...(reasoningEfforts?.length ? { reasoningEfforts } : {}),
1196
1215
  };