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.
|
@@ -555,16 +555,12 @@ function providerLabel(provider) {
|
|
|
555
555
|
}
|
|
556
556
|
const ALL_REASONING_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh"];
|
|
557
557
|
const ALL_PERMISSION_MODES = ["read_only", "workspace_write", "full_access"];
|
|
558
|
+
// Codex `model/list` is the source of truth — these are only used when the RPC
|
|
559
|
+
// returns nothing so mobile still sees a usable picker.
|
|
558
560
|
const CODEX_FALLBACK_MODELS = [
|
|
559
561
|
{ id: "default", label: "默认模型" },
|
|
560
|
-
{ id: "gpt-5", label: "GPT-5" },
|
|
561
|
-
{ id: "gpt-5-codex", label: "GPT-5 Codex" },
|
|
562
|
-
{ id: "gpt-5-pro", label: "GPT-5 Pro" },
|
|
563
|
-
{ id: "gpt-5-high", label: "GPT-5 High" },
|
|
564
|
-
{ id: "o3", label: "o3" },
|
|
565
|
-
{ id: "o3-mini", label: "o3-mini" },
|
|
566
562
|
];
|
|
567
|
-
const CODEX_FALLBACK_DEFAULT_MODEL = "
|
|
563
|
+
const CODEX_FALLBACK_DEFAULT_MODEL = "default";
|
|
568
564
|
const CODEX_COMMAND_NAMES = ["plan", "exit-plan", "compact", "clear", "status", "review", "subagents"];
|
|
569
565
|
const CLAUDE_REMOTE_HIDDEN_COMMANDS = new Set([
|
|
570
566
|
"add-dir",
|
|
@@ -937,10 +933,13 @@ function runtimeCommands(provider, value) {
|
|
|
937
933
|
function parseModelListCapabilities(value) {
|
|
938
934
|
const raw = asRecord(value);
|
|
939
935
|
const modelsValue = Array.isArray(value) ? value :
|
|
940
|
-
Array.isArray(raw?.
|
|
941
|
-
Array.isArray(raw?.
|
|
942
|
-
Array.isArray(raw?.
|
|
943
|
-
|
|
936
|
+
Array.isArray(raw?.data) ? raw.data :
|
|
937
|
+
Array.isArray(raw?.models) ? raw.models :
|
|
938
|
+
Array.isArray(raw?.items) ? raw.items :
|
|
939
|
+
Array.isArray(raw?.modelOptions) ? raw.modelOptions :
|
|
940
|
+
[];
|
|
941
|
+
let inferredDefault;
|
|
942
|
+
const efforts = new Set();
|
|
944
943
|
const models = modelsValue
|
|
945
944
|
.map((entry, index) => {
|
|
946
945
|
const model = asRecord(entry);
|
|
@@ -949,23 +948,45 @@ function parseModelListCapabilities(value) {
|
|
|
949
948
|
? { id: entry, label: entry }
|
|
950
949
|
: undefined;
|
|
951
950
|
}
|
|
951
|
+
if (model.hidden === true)
|
|
952
|
+
return undefined;
|
|
952
953
|
const modelId = firstString(model, ["id", "model", "name", "value"]) ?? `model-${index + 1}`;
|
|
953
|
-
const label = firstString(model, ["
|
|
954
|
+
const label = firstString(model, ["displayName", "label", "title", "name"]) ?? modelId;
|
|
955
|
+
if (model.isDefault === true && !inferredDefault)
|
|
956
|
+
inferredDefault = modelId;
|
|
957
|
+
const supported = Array.isArray(model.supportedReasoningEfforts) ? model.supportedReasoningEfforts : [];
|
|
958
|
+
for (const item of supported) {
|
|
959
|
+
const effort = typeof item === "string"
|
|
960
|
+
? item
|
|
961
|
+
: firstString(asRecord(item), ["reasoningEffort", "id", "value"]);
|
|
962
|
+
if (effort && ALL_REASONING_EFFORTS.includes(effort)) {
|
|
963
|
+
efforts.add(effort);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
954
966
|
return { id: modelId, label };
|
|
955
967
|
})
|
|
956
968
|
.filter((entry) => Boolean(entry));
|
|
957
969
|
const defaultModel = firstString(raw, ["defaultModel", "default_model", "currentModel"]) ??
|
|
958
|
-
firstString(asRecord(raw?.defaults), ["model"])
|
|
959
|
-
|
|
970
|
+
firstString(asRecord(raw?.defaults), ["model"]) ??
|
|
971
|
+
inferredDefault;
|
|
972
|
+
const explicitEffortsValue = Array.isArray(raw?.reasoningEfforts) ? raw.reasoningEfforts :
|
|
960
973
|
Array.isArray(raw?.reasoning_efforts) ? raw.reasoning_efforts :
|
|
961
974
|
Array.isArray(raw?.efforts) ? raw.efforts :
|
|
962
975
|
undefined;
|
|
963
|
-
|
|
964
|
-
|
|
976
|
+
if (explicitEffortsValue) {
|
|
977
|
+
for (const item of explicitEffortsValue) {
|
|
978
|
+
if (typeof item === "string" && ALL_REASONING_EFFORTS.includes(item)) {
|
|
979
|
+
efforts.add(item);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
const reasoningEfforts = efforts.size
|
|
984
|
+
? ALL_REASONING_EFFORTS.filter((effort) => efforts.has(effort))
|
|
985
|
+
: undefined;
|
|
965
986
|
if (models.length === 0 && !defaultModel && !reasoningEfforts?.length)
|
|
966
987
|
return undefined;
|
|
967
988
|
return {
|
|
968
|
-
...(models.length > 0 ? { models
|
|
989
|
+
...(models.length > 0 ? { models } : {}),
|
|
969
990
|
...(defaultModel ? { defaultModel } : {}),
|
|
970
991
|
...(reasoningEfforts?.length ? { reasoningEfforts } : {}),
|
|
971
992
|
};
|