minecodex 1.0.5 → 1.0.7
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.
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"maxVisibleItems": 6,
|
|
18
18
|
"favoriteStorageKey": "codex-model-slider:favorites:v1",
|
|
19
19
|
"reasoningEffortOverrides": {
|
|
20
|
+
"command-code/Qwen-Qwen3.8-Flash": ["low", "medium", "xhigh"],
|
|
21
|
+
"command-code/xai-grok-4.6": ["low", "medium", "high", "xhigh"],
|
|
22
|
+
"command-code/xiaomi-mimo-v2.5": ["low", "medium", "high", "xhigh"],
|
|
20
23
|
"opencode-go/hy3": ["low", "medium", "high"],
|
|
21
24
|
"opencode-go/muse-spark-1.2-contributor": ["low", "medium", "high", "xhigh"]
|
|
22
25
|
},
|
package/package.json
CHANGED
|
@@ -308,7 +308,6 @@ export function createInjectionSource(features, {
|
|
|
308
308
|
let nativeTabCapabilityPromise = null;
|
|
309
309
|
let nativeTabCapability = null;
|
|
310
310
|
let nativeTabCapabilityError = null;
|
|
311
|
-
const modelSelectorOriginalItems = new Map();
|
|
312
311
|
const modelSelectorOriginalToggleLabels = new Map();
|
|
313
312
|
const modelSelectorGenericContainers = new Map();
|
|
314
313
|
const modelSelectorNativeToggleHandlers = new Map();
|
|
@@ -1112,7 +1111,9 @@ export function createInjectionSource(features, {
|
|
|
1112
1111
|
})).filter((level) => level.effort);
|
|
1113
1112
|
const allowed = selector?.reasoningEffortOverrides?.[identity.raw.toLowerCase()];
|
|
1114
1113
|
const supportedReasoningLevels = allowed
|
|
1115
|
-
? nativeReasoningLevels.
|
|
1114
|
+
? (nativeReasoningLevels.length
|
|
1115
|
+
? nativeReasoningLevels.filter((level) => allowed.includes(level.effort))
|
|
1116
|
+
: allowed.map((effort) => ({ effort })))
|
|
1116
1117
|
: nativeReasoningLevels;
|
|
1117
1118
|
const currentReasoningLevel = String(controller?.reasoningEffort ?? "").toLowerCase();
|
|
1118
1119
|
return {
|
|
@@ -1508,6 +1509,16 @@ export function createInjectionSource(features, {
|
|
|
1508
1509
|
if (!items.length) return;
|
|
1509
1510
|
const favorites = loadModelFavorites(selector);
|
|
1510
1511
|
items.forEach((item) => { item.style.display = ""; });
|
|
1512
|
+
if (!menu.hasAttribute("data-codex-model-slider-controller-menu")) {
|
|
1513
|
+
if (!modelSelectorMenuSizeFrames.has(menu)) {
|
|
1514
|
+
const frame = requestAnimationFrame(() => {
|
|
1515
|
+
modelSelectorMenuSizeFrames.delete(menu);
|
|
1516
|
+
sizeModelMenuViewport(menu, selector.maxVisibleItems);
|
|
1517
|
+
});
|
|
1518
|
+
modelSelectorMenuSizeFrames.set(menu, frame);
|
|
1519
|
+
}
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1511
1522
|
const starred = items.filter((item) => favorites.has(item.dataset.codexModelSliderRaw));
|
|
1512
1523
|
const ordinary = items.filter((item) => !favorites.has(item.dataset.codexModelSliderRaw));
|
|
1513
1524
|
const desired = items.slice().sort((a, b) => compareEnhancedModelItems(a, b, favorites));
|
|
@@ -1585,6 +1596,7 @@ export function createInjectionSource(features, {
|
|
|
1585
1596
|
rawValue = null,
|
|
1586
1597
|
selected = null,
|
|
1587
1598
|
scheduleReturn = true,
|
|
1599
|
+
owned = false,
|
|
1588
1600
|
} = {}) {
|
|
1589
1601
|
const observedRaw = rawValue ?? modelItemRawValue(item);
|
|
1590
1602
|
if (!observedRaw) return;
|
|
@@ -1598,16 +1610,21 @@ export function createInjectionSource(features, {
|
|
|
1598
1610
|
item.dataset.codexModelSliderOrder = String(index);
|
|
1599
1611
|
item.dataset.codexModelSliderIdentitySource = catalogModel ? "catalog" : nativeDescriptor ? "native" : "visible";
|
|
1600
1612
|
if (item.querySelector("[data-codex-model-slider-row]")) return;
|
|
1601
|
-
if (!modelSelectorOriginalItems.has(item)) modelSelectorOriginalItems.set(item, item.innerHTML);
|
|
1602
|
-
|
|
1603
|
-
const identity = modelIdentity(raw);
|
|
1604
|
-
const display = modelDisplayLabel(identity, selector);
|
|
1605
|
-
const provider = providerLabel(identity.provider, selector);
|
|
1606
|
-
const brand = brandForModel(identity, selector);
|
|
1607
1613
|
item.toggleAttribute(
|
|
1608
1614
|
"data-codex-model-slider-selected",
|
|
1609
1615
|
selected ?? Boolean(item.querySelector("svg")),
|
|
1610
1616
|
);
|
|
1617
|
+
if (!owned) {
|
|
1618
|
+
if (scheduleReturn && !item.hasAttribute("data-codex-model-slider-return-listener")) {
|
|
1619
|
+
item.setAttribute("data-codex-model-slider-return-listener", "");
|
|
1620
|
+
item.addEventListener("click", scheduleModelSliderReturn);
|
|
1621
|
+
}
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
const identity = modelIdentity(raw);
|
|
1625
|
+
const display = modelDisplayLabel(identity, selector);
|
|
1626
|
+
const provider = providerLabel(identity.provider, selector);
|
|
1627
|
+
const brand = brandForModel(identity, selector);
|
|
1611
1628
|
const favorites = loadModelFavorites(selector);
|
|
1612
1629
|
const starred = favorites.has(raw);
|
|
1613
1630
|
const row = document.createElement("span");
|
|
@@ -1788,13 +1805,12 @@ export function createInjectionSource(features, {
|
|
|
1788
1805
|
const placeholder = document.querySelector(
|
|
1789
1806
|
'[data-codex-intelligence-trigger] [class*="_ModelPickerTriggerPlaceholder_"]',
|
|
1790
1807
|
);
|
|
1791
|
-
if (placeholder && record.placeholderText != null) {
|
|
1792
|
-
placeholder.
|
|
1808
|
+
if (placeholder?.firstChild && record.placeholderText != null) {
|
|
1809
|
+
placeholder.firstChild.nodeValue = record.placeholderText;
|
|
1793
1810
|
}
|
|
1794
1811
|
record.button.setAttribute("aria-expanded", "false");
|
|
1795
1812
|
record.parentMenu.style.position = record.position;
|
|
1796
1813
|
record.parentMenu.style.overflow = record.overflow;
|
|
1797
|
-
for (const item of modelMenuItems(record.menu)) modelSelectorOriginalItems.delete(item);
|
|
1798
1814
|
record.menu.remove();
|
|
1799
1815
|
modelSelectorControllerMenu = null;
|
|
1800
1816
|
return true;
|
|
@@ -1835,6 +1851,7 @@ export function createInjectionSource(features, {
|
|
|
1835
1851
|
rawValue: String(model.model),
|
|
1836
1852
|
selected: String(model.model) === String(controller.model),
|
|
1837
1853
|
scheduleReturn: false,
|
|
1854
|
+
owned: true,
|
|
1838
1855
|
});
|
|
1839
1856
|
menu.append(item);
|
|
1840
1857
|
});
|
|
@@ -1875,8 +1892,13 @@ export function createInjectionSource(features, {
|
|
|
1875
1892
|
const placeholder = document.querySelector(
|
|
1876
1893
|
'[data-codex-intelligence-trigger] [class*="_ModelPickerTriggerPlaceholder_"]',
|
|
1877
1894
|
);
|
|
1878
|
-
const placeholderText = placeholder?.
|
|
1879
|
-
|
|
1895
|
+
const placeholderText = placeholder?.firstChild?.nodeValue ?? null;
|
|
1896
|
+
// 保留产品行为:模型列表打开时 chip 显示 Select model。只能原地更新
|
|
1897
|
+
// 同一个文本节点(nodeValue),不能 textContent 替换整个节点,否则
|
|
1898
|
+
// React 卸载菜单时 removeChild 找不到旧文本节点会触发错误边界。
|
|
1899
|
+
if (placeholder?.firstChild) {
|
|
1900
|
+
placeholder.firstChild.nodeValue = locale === "zh-CN" ? "选择模型" : "Select model";
|
|
1901
|
+
}
|
|
1880
1902
|
|
|
1881
1903
|
modelSelectorControllerMenu = {
|
|
1882
1904
|
menu,
|
|
@@ -2391,10 +2413,20 @@ export function createInjectionSource(features, {
|
|
|
2391
2413
|
const identity = modelIdentity(nativeModelValue(parentMenu));
|
|
2392
2414
|
const model = modelDefinitionFor(identity, selector);
|
|
2393
2415
|
const catalogModel = catalogModelFor(identity, selector);
|
|
2416
|
+
const catalogedLevels = model?.supportedReasoningLevels ?? catalogModel?.supportedReasoningLevels ?? [];
|
|
2417
|
+
// 外部模型在菜单中的 identity 常是 displayName(如 commandcode-auth/xai-grok-4.6),
|
|
2418
|
+
// 而 reasoningEffortOverrides 按 catalog slug(command-code/xai-grok-4.6)声明;
|
|
2419
|
+
// 先按 catalog slug 匹配,再退回菜单原始值,确保档位兜底能命中。
|
|
2420
|
+
const overrideLevels = selector?.reasoningEffortOverrides?.[catalogModel?.slug.toLowerCase()]
|
|
2421
|
+
?? selector?.reasoningEffortOverrides?.[identity.raw.toLowerCase()];
|
|
2394
2422
|
const modelWithCapability = model?.modelSelectorCapability ? model : {
|
|
2395
2423
|
...(model ?? {}),
|
|
2396
2424
|
...(catalogModel ?? {}),
|
|
2397
|
-
|
|
2425
|
+
// 外部模型 catalog 的 supported_reasoning_levels 可能为空;此时用
|
|
2426
|
+
// modelSelector.reasoningEffortOverrides 补齐档位,否则滑条没有刻度。
|
|
2427
|
+
supportedReasoningLevels: catalogedLevels.length
|
|
2428
|
+
? catalogedLevels
|
|
2429
|
+
: (overrideLevels?.map((effort) => ({ effort })) ?? []),
|
|
2398
2430
|
};
|
|
2399
2431
|
const efforts = visibleReasoningLevelsFor(modelWithCapability);
|
|
2400
2432
|
if (!model) return false;
|
|
@@ -2445,7 +2477,15 @@ export function createInjectionSource(features, {
|
|
|
2445
2477
|
existing?.remove();
|
|
2446
2478
|
const nativeContainer = parentMenu.firstElementChild;
|
|
2447
2479
|
if (!nativeContainer) return false;
|
|
2448
|
-
|
|
2480
|
+
// 使用聚合了 override 兜底档位的 modelWithCapability,空目录档位的外部
|
|
2481
|
+
// 模型才能渲染滑条刻度;原始 model 只负责身份/默认值。
|
|
2482
|
+
const shell = createGenericModelSlider(
|
|
2483
|
+
parentMenu,
|
|
2484
|
+
selector,
|
|
2485
|
+
identity,
|
|
2486
|
+
modelWithCapability,
|
|
2487
|
+
selectedEffortValue,
|
|
2488
|
+
);
|
|
2449
2489
|
if (!shell) return false;
|
|
2450
2490
|
if (!modelSelectorGenericContainers.has(nativeContainer)) {
|
|
2451
2491
|
modelSelectorGenericContainers.set(nativeContainer, nativeContainer.style.display);
|
|
@@ -2635,9 +2675,7 @@ export function createInjectionSource(features, {
|
|
|
2635
2675
|
modelSelectorSuppressOutsidePointerSequence = false;
|
|
2636
2676
|
modelSelectorPendingReturn = false;
|
|
2637
2677
|
document.documentElement.removeAttribute("data-codex-model-slider-selecting-effort");
|
|
2638
|
-
for (const
|
|
2639
|
-
if (!item.isConnected) continue;
|
|
2640
|
-
item.innerHTML = html;
|
|
2678
|
+
for (const item of document.querySelectorAll("[data-codex-model-slider-item]")) {
|
|
2641
2679
|
item.style.removeProperty("display");
|
|
2642
2680
|
for (const name of [
|
|
2643
2681
|
"data-codex-model-slider-raw",
|
|
@@ -2674,7 +2712,6 @@ export function createInjectionSource(features, {
|
|
|
2674
2712
|
document.querySelectorAll("[data-codex-model-slider-trigger-label]").forEach((element) => element.remove());
|
|
2675
2713
|
document.documentElement.removeAttribute("data-codex-model-slider-catalog-ready");
|
|
2676
2714
|
modelSelectorStyle.remove();
|
|
2677
|
-
modelSelectorOriginalItems.clear();
|
|
2678
2715
|
modelSelectorOriginalToggleLabels.clear();
|
|
2679
2716
|
modelSelectorGenericContainers.clear();
|
|
2680
2717
|
modelSelectorNativeToggleHandlers.clear();
|
|
@@ -4006,7 +4043,7 @@ export function createInjectionSource(features, {
|
|
|
4006
4043
|
"data-[state=open]:bg-token-list-hover-background",
|
|
4007
4044
|
);
|
|
4008
4045
|
const originalIcon = button.querySelector("svg");
|
|
4009
|
-
const featureIcon = createFeatureIcon(feature, originalIcon?.getAttribute("class"),
|
|
4046
|
+
const featureIcon = createFeatureIcon(feature, originalIcon?.getAttribute("class"), 16);
|
|
4010
4047
|
if (originalIcon && featureIcon) originalIcon.replaceWith(featureIcon);
|
|
4011
4048
|
button.addEventListener("click", (event) => {
|
|
4012
4049
|
event.preventDefault();
|