dsh-codex-subscription 3.2.22 → 3.2.24
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.
- package/README.de.md +12 -5
- package/README.en.md +13 -6
- package/README.es.md +12 -5
- package/README.fr.md +12 -5
- package/README.ja.md +13 -6
- package/README.md +13 -6
- package/README.pt.md +12 -5
- package/README.ru.md +12 -5
- package/README.zh-CN.md +13 -6
- package/lib/client.js +429 -309
- package/lib/index.js +60 -37
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -832,9 +832,15 @@ window.__ModuleLoader__.load({
|
|
|
832
832
|
const maxTop = minTop + (viewport?.height ?? win.innerHeight) - height - margin * 2;
|
|
833
833
|
const anchorX = align === "end" ? right - width : align === "center" ? (left + right - width) / 2 : left;
|
|
834
834
|
const above = top - height - gap, below = bottom + gap;
|
|
835
|
+
const before = left - width - gap, after = right + gap;
|
|
836
|
+
let x = anchorX, y = below > maxTop && above >= minTop ? above : below;
|
|
837
|
+
if (side === "left" && (before >= minLeft || after <= maxLeft)) {
|
|
838
|
+
x = before >= minLeft ? before : after;
|
|
839
|
+
y = (top + bottom - height) / 2;
|
|
840
|
+
} else if (side === "top" || side === "left") y = above < minTop && below <= maxTop ? below : above;
|
|
835
841
|
const next = {
|
|
836
|
-
left: Math.max(minLeft, Math.min(
|
|
837
|
-
top: Math.max(minTop, Math.min(
|
|
842
|
+
left: Math.max(minLeft, Math.min(x, maxLeft)),
|
|
843
|
+
top: Math.max(minTop, Math.min(y, maxTop))
|
|
838
844
|
};
|
|
839
845
|
setPosition((previous) => previous?.left === next.left && previous?.top === next.top ? previous : next);
|
|
840
846
|
};
|
|
@@ -888,7 +894,7 @@ window.__ModuleLoader__.load({
|
|
|
888
894
|
panel
|
|
889
895
|
]);
|
|
890
896
|
}
|
|
891
|
-
function Tooltip({ label, children, side = "bottom", delayMs = 0, maxWidth, openOnClick = false }) {
|
|
897
|
+
function Tooltip({ label, children, side = "bottom", delayMs = 0, maxWidth, openOnClick = false, keyboardFocusOnly = false }) {
|
|
892
898
|
const anchor = (0, react.useRef)(null), panel = (0, react.useRef)(null), timer = (0, react.useRef)();
|
|
893
899
|
const [open, setOpen] = (0, react.useState)(false), [pinned, setPinned] = (0, react.useState)(false);
|
|
894
900
|
const id = (0, react.useId)();
|
|
@@ -951,7 +957,7 @@ window.__ModuleLoader__.load({
|
|
|
951
957
|
},
|
|
952
958
|
onFocus: (event) => {
|
|
953
959
|
children.props.onFocus?.(event);
|
|
954
|
-
show(0);
|
|
960
|
+
if (!keyboardFocusOnly || event.currentTarget.matches(":focus-visible")) show(0);
|
|
955
961
|
},
|
|
956
962
|
onBlur: (event) => {
|
|
957
963
|
children.props.onBlur?.(event);
|
|
@@ -1072,28 +1078,35 @@ window.__ModuleLoader__.load({
|
|
|
1072
1078
|
children: item.text
|
|
1073
1079
|
}, item.id);
|
|
1074
1080
|
const selected = item.id === selectedId, expanded = submenu === item.id;
|
|
1081
|
+
const option = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1082
|
+
type: "button",
|
|
1083
|
+
role: item.submenu ? "menuitem" : "menuitemradio",
|
|
1084
|
+
tabIndex: -1,
|
|
1085
|
+
"aria-checked": item.submenu ? void 0 : selected,
|
|
1086
|
+
"aria-haspopup": item.submenu ? "menu" : void 0,
|
|
1087
|
+
"aria-expanded": item.submenu ? expanded : void 0,
|
|
1088
|
+
"data-submenu-item": nested || void 0,
|
|
1089
|
+
disabled: item.disabled,
|
|
1090
|
+
onClick: () => {
|
|
1091
|
+
if (item.submenu) {
|
|
1092
|
+
setSubmenu(expanded ? void 0 : item.id);
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
setSubmenu(void 0);
|
|
1096
|
+
trigger.current?.focus();
|
|
1097
|
+
onSelect(item.id);
|
|
1098
|
+
},
|
|
1099
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.label }), item.submenu ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronRightOutline14, {}) : selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheckOutline16, {}) : null]
|
|
1100
|
+
});
|
|
1075
1101
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1076
1102
|
role: "none",
|
|
1077
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
"data-submenu-item": nested || void 0,
|
|
1085
|
-
disabled: item.disabled,
|
|
1086
|
-
onClick: () => {
|
|
1087
|
-
if (item.submenu) {
|
|
1088
|
-
setSubmenu(expanded ? void 0 : item.id);
|
|
1089
|
-
return;
|
|
1090
|
-
}
|
|
1091
|
-
setSubmenu(void 0);
|
|
1092
|
-
trigger.current?.focus();
|
|
1093
|
-
onSelect(item.id);
|
|
1094
|
-
},
|
|
1095
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.label }), item.submenu ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronRightOutline14, {}) : selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheckOutline16, {}) : null]
|
|
1096
|
-
}), item.submenu && expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1103
|
+
children: [item.description && !item.disabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip, {
|
|
1104
|
+
label: item.description,
|
|
1105
|
+
side: "left",
|
|
1106
|
+
delayMs: 350,
|
|
1107
|
+
keyboardFocusOnly: true,
|
|
1108
|
+
children: option
|
|
1109
|
+
}) : option, item.submenu && expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1097
1110
|
role: "menu",
|
|
1098
1111
|
"aria-label": typeof item.label === "string" ? item.label : void 0,
|
|
1099
1112
|
className: "dcsMenuChildren",
|
|
@@ -1215,6 +1228,7 @@ window.__ModuleLoader__.load({
|
|
|
1215
1228
|
"default-model/select",
|
|
1216
1229
|
"default-model/reset",
|
|
1217
1230
|
"predictions/generate",
|
|
1231
|
+
"predictions/models",
|
|
1218
1232
|
"runtime/status",
|
|
1219
1233
|
"runtime/install",
|
|
1220
1234
|
"runtime/remove",
|
|
@@ -2099,20 +2113,11 @@ window.__ModuleLoader__.load({
|
|
|
2099
2113
|
description: options.description ?? "Describe an image to generate or edit"
|
|
2100
2114
|
});
|
|
2101
2115
|
//#endregion
|
|
2102
|
-
//#region src/composer-prediction-models.js
|
|
2103
|
-
const models = /* @__PURE__ */ new Map([
|
|
2104
|
-
["gpt-6-astra", "GPT-6 Astra"],
|
|
2105
|
-
["gpt-6.1-sol", "GPT-6.1 Sol"],
|
|
2106
|
-
["gpt-6.1-terra", "GPT-6.1 Terra"]
|
|
2107
|
-
]);
|
|
2108
|
-
const composerPredictionModelNames = [...models.values()].join(", ");
|
|
2109
|
-
const supportsComposerPrediction = (model) => models.has(model);
|
|
2110
|
-
//#endregion
|
|
2111
2116
|
//#region src/client-languages.js
|
|
2112
2117
|
const dictionaries = {
|
|
2113
2118
|
zh: {
|
|
2114
2119
|
speedShortcutTitle: "输入栏速度切换",
|
|
2115
|
-
speedShortcut_off: "
|
|
2120
|
+
speedShortcut_off: "原有显示",
|
|
2116
2121
|
speedShortcut_icon: "闪电",
|
|
2117
2122
|
speedShortcut_hover: "悬停显示",
|
|
2118
2123
|
speedShortcut_label: "速度名称",
|
|
@@ -2271,7 +2276,8 @@ window.__ModuleLoader__.load({
|
|
|
2271
2276
|
composerPredictions: "输入预测",
|
|
2272
2277
|
composerPredictionAccept: "接受建议",
|
|
2273
2278
|
composerPredictionsShortHint: "Tab 填入草稿",
|
|
2274
|
-
composerPredictionsHint: `支持的 Codex
|
|
2279
|
+
composerPredictionsHint: `支持的 Codex 模型在一轮对话完成、草稿为空时,基于当前会话建议下一条消息。Tab 填入草稿,不会自动发送。会产生额外预测请求。官方 Codex 生成预测不计额度或 Credits;DSH 第三方接入是否享有相同豁免尚未确认。接受后发送消息仍正常计量。`,
|
|
2280
|
+
composerPredictionModels: "此账号可用的模型:{models}",
|
|
2275
2281
|
featureLoading: "正在加载…",
|
|
2276
2282
|
featureLoadFailed: "加载失败,点击重试",
|
|
2277
2283
|
featureRetry: "重试",
|
|
@@ -2985,6 +2991,12 @@ window.__ModuleLoader__.load({
|
|
|
2985
2991
|
fetchTitle: "网页读取来源",
|
|
2986
2992
|
fetchDshHint: "使用 DSH 当前配置的网页读取服务;与上面的搜索来源分别设置。",
|
|
2987
2993
|
fetchCodexHint: "通过 Codex 订阅读取可访问的网页文本。失败会直接提示,不会转到 DeepSeek API。",
|
|
2994
|
+
fetchHttpCost: "不按次收费",
|
|
2995
|
+
fetchDeepSeekCost: "每 1,000 次成功读取 5 元",
|
|
2996
|
+
fetchCodexCost: "通过 Codex 订阅",
|
|
2997
|
+
searchDeepSeekLegacy: "DeepSeek(旧版)",
|
|
2998
|
+
searchLegacyCost: "搜索不另收费,仅按 DeepSeek 模型 Token 计费。",
|
|
2999
|
+
searchApiCost: "每 1,000 次成功搜索 5 元。",
|
|
2988
3000
|
fetchUnavailableHint: "当前 DSH 不支持切换到 Codex 网页读取,请先升级宿主。",
|
|
2989
3001
|
quotaForecastCalibrating: "续航正在校准",
|
|
2990
3002
|
quotaForecastIdle: "近期剩余额度百分比未变化",
|
|
@@ -3065,7 +3077,7 @@ window.__ModuleLoader__.load({
|
|
|
3065
3077
|
},
|
|
3066
3078
|
en: {
|
|
3067
3079
|
speedShortcutTitle: "Composer speed shortcut",
|
|
3068
|
-
speedShortcut_off: "
|
|
3080
|
+
speedShortcut_off: "Original",
|
|
3069
3081
|
speedShortcut_icon: "Lightning",
|
|
3070
3082
|
speedShortcut_hover: "On hover",
|
|
3071
3083
|
speedShortcut_label: "Speed name",
|
|
@@ -3224,7 +3236,8 @@ window.__ModuleLoader__.load({
|
|
|
3224
3236
|
composerPredictions: "Input predictions",
|
|
3225
3237
|
composerPredictionAccept: "Accept suggestion",
|
|
3226
3238
|
composerPredictionsShortHint: "Tab fills draft",
|
|
3227
|
-
composerPredictionsHint: `Supported Codex models
|
|
3239
|
+
composerPredictionsHint: `Supported Codex models suggest your next message from the current conversation after a completed turn, when the draft is empty. Tab fills the draft without sending. Makes additional prediction requests. Official Codex predictions do not count toward usage limits or credits; the same exemption for this third-party integration is unconfirmed. Sending an accepted draft still counts normally.`,
|
|
3240
|
+
composerPredictionModels: "Available models for this account: {models}",
|
|
3228
3241
|
featureLoading: "Loading…",
|
|
3229
3242
|
featureLoadFailed: "Could not load. Click to retry",
|
|
3230
3243
|
featureRetry: "Retry",
|
|
@@ -3938,6 +3951,12 @@ window.__ModuleLoader__.load({
|
|
|
3938
3951
|
fetchTitle: "Webpage reading source",
|
|
3939
3952
|
fetchDshHint: "Use the webpage reader configured in DSH, independently of the search source above.",
|
|
3940
3953
|
fetchCodexHint: "Read accessible webpage text with your Codex subscription. Failures are reported directly, without falling back to the DeepSeek API.",
|
|
3954
|
+
fetchHttpCost: "No per-fetch fee",
|
|
3955
|
+
fetchDeepSeekCost: "CNY 5 per 1,000 successful fetches",
|
|
3956
|
+
fetchCodexCost: "Uses your Codex subscription",
|
|
3957
|
+
searchDeepSeekLegacy: "DeepSeek (Legacy)",
|
|
3958
|
+
searchLegacyCost: "No separate search fee. DeepSeek model tokens are billed.",
|
|
3959
|
+
searchApiCost: "CNY 5 per 1,000 successful searches.",
|
|
3941
3960
|
fetchUnavailableHint: "This DSH version cannot switch to the Codex webpage reader. Update DSH first.",
|
|
3942
3961
|
quotaForecastCalibrating: "Runway calibrating",
|
|
3943
3962
|
quotaForecastIdle: "No recent change in the reported percentage",
|
|
@@ -4171,7 +4190,8 @@ window.__ModuleLoader__.load({
|
|
|
4171
4190
|
"composerPredictions": "入力予測",
|
|
4172
4191
|
"composerPredictionAccept": "候補を採用",
|
|
4173
4192
|
"composerPredictionsShortHint": "Tab で下書きを補完",
|
|
4174
|
-
"composerPredictionsHint": `対応する Codex
|
|
4193
|
+
"composerPredictionsHint": `対応する Codex モデルは、ターン完了後、下書きが空の場合に現在の会話から次のメッセージを提案します。Tab で下書きを補完しますが、送信はされません。予測リクエストが追加で発生します。公式 Codex の予測は利用上限や利用クレジットに含まれませんが、このサードパーティ連携にも同じ免除が適用されるかは確認されていません。候補を採用した下書きを送信すると、通常どおり利用分に含まれます。`,
|
|
4194
|
+
"composerPredictionModels": "このアカウントで利用できるモデル — {models}",
|
|
4175
4195
|
"featureLoading": "読み込み中…",
|
|
4176
4196
|
"featureLoadFailed": "読み込めませんでした。クリックして再試行してください",
|
|
4177
4197
|
"featureRetry": "再試行",
|
|
@@ -4884,6 +4904,12 @@ window.__ModuleLoader__.load({
|
|
|
4884
4904
|
"historyTotalUnavailable": "この期間の公式な利用総量は確認できません",
|
|
4885
4905
|
"historyNoBreakdown": "この期間の公式な内訳はまだ確認できません",
|
|
4886
4906
|
"fetchTitle": "ウェブページの読み取り元",
|
|
4907
|
+
"fetchHttpCost": "追加の取得料金なし",
|
|
4908
|
+
"fetchDeepSeekCost": "成功1,000件あたり5元",
|
|
4909
|
+
"fetchCodexCost": "Codex サブスクリプション経由",
|
|
4910
|
+
"searchDeepSeekLegacy": "DeepSeek(旧版)",
|
|
4911
|
+
"searchLegacyCost": "検索ごとの追加料金なし。DeepSeek のモデル使用分はトークン課金。",
|
|
4912
|
+
"searchApiCost": "成功1,000件あたり5元。",
|
|
4887
4913
|
"fetchDshHint": "上記の検索元とは別に、DSH で設定したウェブページリーダーを使います。",
|
|
4888
4914
|
"fetchCodexHint": "Codex サブスクリプションを使って、アクセス可能なウェブページのテキストを読み取ります。失敗時はそのまま通知され、DeepSeek API にはフォールバックしません。",
|
|
4889
4915
|
"fetchUnavailableHint": "このバージョンの DSH では Codex のウェブページリーダーに切り替えられません。先に DSH を更新してください。",
|
|
@@ -4900,7 +4926,7 @@ window.__ModuleLoader__.load({
|
|
|
4900
4926
|
"composerMenuHost": "DSH または他のプラグインのメニューを使用",
|
|
4901
4927
|
"legacyModelPicker": "入力欄のモデルメニュー",
|
|
4902
4928
|
"speedShortcutTitle": "入力欄の速度切り替え",
|
|
4903
|
-
"speedShortcut_off": "
|
|
4929
|
+
"speedShortcut_off": "従来どおり",
|
|
4904
4930
|
"speedShortcut_icon": "稲妻",
|
|
4905
4931
|
"speedShortcut_hover": "ホバーで表示",
|
|
4906
4932
|
"speedShortcut_label": "速度名",
|
|
@@ -4971,7 +4997,7 @@ window.__ModuleLoader__.load({
|
|
|
4971
4997
|
},
|
|
4972
4998
|
es: {
|
|
4973
4999
|
"speedShortcutTitle": "Atajo de velocidad en el cuadro de entrada",
|
|
4974
|
-
"speedShortcut_off": "
|
|
5000
|
+
"speedShortcut_off": "Como antes",
|
|
4975
5001
|
"speedShortcut_icon": "Rayo",
|
|
4976
5002
|
"speedShortcut_hover": "Al pasar el puntero",
|
|
4977
5003
|
"speedShortcut_label": "Nombre de la velocidad",
|
|
@@ -5129,7 +5155,8 @@ window.__ModuleLoader__.load({
|
|
|
5129
5155
|
"composerPredictions": "Predicciones de entrada",
|
|
5130
5156
|
"composerPredictionAccept": "Aceptar sugerencia",
|
|
5131
5157
|
"composerPredictionsShortHint": "Tab completa el borrador",
|
|
5132
|
-
"composerPredictionsHint": `Después de completar un turno, los modelos de Codex compatibles
|
|
5158
|
+
"composerPredictionsHint": `Después de completar un turno, los modelos de Codex compatibles sugieren el siguiente mensaje según la conversación actual, si el borrador está vacío. Pulsa Tab para completar el borrador sin enviarlo. Esto genera solicitudes de predicción adicionales. Las predicciones oficiales de Codex no cuentan para los límites de uso ni para los créditos; no se ha confirmado que la misma exención se aplique a esta integración de terceros. El envío de un borrador aceptado sí cuenta normalmente.`,
|
|
5159
|
+
"composerPredictionModels": "Modelos disponibles en esta cuenta: {models}",
|
|
5133
5160
|
"featureLoading": "Cargando…",
|
|
5134
5161
|
"featureLoadFailed": "No se pudo cargar. Haz clic para reintentar",
|
|
5135
5162
|
"featureRetry": "Reintentar",
|
|
@@ -5842,6 +5869,12 @@ window.__ModuleLoader__.load({
|
|
|
5842
5869
|
"historyTotalUnavailable": "El total oficial de uso no está disponible para este período",
|
|
5843
5870
|
"historyNoBreakdown": "El desglose oficial aún no está disponible para este período",
|
|
5844
5871
|
"fetchTitle": "Fuente de lectura de páginas web",
|
|
5872
|
+
"fetchHttpCost": "Sin cargo por lectura",
|
|
5873
|
+
"fetchDeepSeekCost": "5 CNY por 1000 lecturas correctas",
|
|
5874
|
+
"fetchCodexCost": "Con tu suscripción a Codex",
|
|
5875
|
+
"searchDeepSeekLegacy": "DeepSeek (versión anterior)",
|
|
5876
|
+
"searchLegacyCost": "La búsqueda no tiene coste adicional. Se cobran los tokens del modelo de DeepSeek.",
|
|
5877
|
+
"searchApiCost": "5 CNY por 1000 búsquedas correctas.",
|
|
5845
5878
|
"fetchDshHint": "Usa el lector de páginas web configurado en DSH, independientemente de la fuente de búsqueda anterior.",
|
|
5846
5879
|
"fetchCodexHint": "Lee el texto accesible de las páginas web con tu suscripción a Codex. Los errores se indican directamente, sin recurrir a la API de DeepSeek.",
|
|
5847
5880
|
"fetchUnavailableHint": "Esta versión de DSH no permite cambiar al lector de páginas web de Codex. Actualiza DSH primero.",
|
|
@@ -5924,7 +5957,7 @@ window.__ModuleLoader__.load({
|
|
|
5924
5957
|
},
|
|
5925
5958
|
fr: {
|
|
5926
5959
|
"speedShortcutTitle": "Raccourci de vitesse dans la zone de saisie",
|
|
5927
|
-
"speedShortcut_off": "
|
|
5960
|
+
"speedShortcut_off": "Comme avant",
|
|
5928
5961
|
"speedShortcut_icon": "Éclair",
|
|
5929
5962
|
"speedShortcut_hover": "Au survol",
|
|
5930
5963
|
"speedShortcut_label": "Nom de la vitesse",
|
|
@@ -6082,7 +6115,8 @@ window.__ModuleLoader__.load({
|
|
|
6082
6115
|
"composerPredictions": "Suggestions de saisie",
|
|
6083
6116
|
"composerPredictionAccept": "Accepter la suggestion",
|
|
6084
6117
|
"composerPredictionsShortHint": "Tab complète le brouillon",
|
|
6085
|
-
"composerPredictionsHint": `Après un tour terminé, les modèles Codex compatibles
|
|
6118
|
+
"composerPredictionsHint": `Après un tour terminé, les modèles Codex compatibles suggèrent votre prochain message à partir de la conversation en cours, si le brouillon est vide. Tab complète le brouillon sans l’envoyer. Cela génère des requêtes de prédiction supplémentaires. Les prédictions officielles de Codex ne sont pas comptabilisées dans les limites d’utilisation ni les crédits ; l’exemption pour cette intégration tierce n’est pas confirmée. L’envoi d’un brouillon accepté est comptabilisé normalement.`,
|
|
6119
|
+
"composerPredictionModels": "Modèles disponibles pour ce compte : {models}",
|
|
6086
6120
|
"featureLoading": "Chargement…",
|
|
6087
6121
|
"featureLoadFailed": "Échec du chargement. Cliquez pour réessayer",
|
|
6088
6122
|
"featureRetry": "Réessayer",
|
|
@@ -6795,6 +6829,12 @@ window.__ModuleLoader__.load({
|
|
|
6795
6829
|
"historyTotalUnavailable": "Le total officiel d’utilisation n’est pas disponible pour cette période",
|
|
6796
6830
|
"historyNoBreakdown": "La ventilation officielle n’est pas encore disponible pour cette période",
|
|
6797
6831
|
"fetchTitle": "Source de lecture des pages Web",
|
|
6832
|
+
"fetchHttpCost": "Sans frais par lecture",
|
|
6833
|
+
"fetchDeepSeekCost": "5 CNY pour 1 000 lectures réussies",
|
|
6834
|
+
"fetchCodexCost": "Avec votre abonnement Codex",
|
|
6835
|
+
"searchDeepSeekLegacy": "DeepSeek (ancienne version)",
|
|
6836
|
+
"searchLegacyCost": "La recherche est sans frais supplémentaires. Les jetons du modèle DeepSeek sont facturés.",
|
|
6837
|
+
"searchApiCost": "5 CNY pour 1 000 recherches réussies.",
|
|
6798
6838
|
"fetchDshHint": "Utiliser le lecteur de pages Web configuré dans DSH, indépendamment de la source de recherche ci-dessus.",
|
|
6799
6839
|
"fetchCodexHint": "Lire le texte accessible des pages Web avec votre abonnement Codex. Les échecs sont signalés directement, sans recours à l’API DeepSeek.",
|
|
6800
6840
|
"fetchUnavailableHint": "Cette version de DSH ne permet pas de passer au lecteur de pages Web Codex. Mettez d’abord DSH à jour.",
|
|
@@ -6877,7 +6917,7 @@ window.__ModuleLoader__.load({
|
|
|
6877
6917
|
},
|
|
6878
6918
|
de: {
|
|
6879
6919
|
"speedShortcutTitle": "Tempo-Kürzel im Eingabefeld",
|
|
6880
|
-
"speedShortcut_off": "
|
|
6920
|
+
"speedShortcut_off": "Wie bisher",
|
|
6881
6921
|
"speedShortcut_icon": "Blitzsymbol",
|
|
6882
6922
|
"speedShortcut_hover": "Beim Zeigen",
|
|
6883
6923
|
"speedShortcut_label": "Temponame",
|
|
@@ -7035,7 +7075,8 @@ window.__ModuleLoader__.load({
|
|
|
7035
7075
|
"composerPredictions": "Eingabevorschläge",
|
|
7036
7076
|
"composerPredictionAccept": "Vorschlag übernehmen",
|
|
7037
7077
|
"composerPredictionsShortHint": "Tab fügt den Entwurf ein",
|
|
7038
|
-
"composerPredictionsHint": `Unterstützte Codex-Modelle
|
|
7078
|
+
"composerPredictionsHint": `Unterstützte Codex-Modelle schlagen nach einem abgeschlossenen Gesprächsschritt deine nächste Nachricht auf Grundlage des aktuellen Gesprächs vor, sofern der Entwurf leer ist. Tab fügt den Entwurf ein, ohne ihn zu senden. Dafür werden zusätzliche Vorhersageanfragen gestellt. Offizielle Codex-Vorhersagen werden nicht auf Nutzungslimits oder Nutzungsguthaben angerechnet; ob dieselbe Ausnahme für diese Drittanbieterintegration gilt, ist nicht bestätigt. Ein gesendeter übernommener Entwurf wird normal angerechnet.`,
|
|
7079
|
+
"composerPredictionModels": "Verfügbare Modelle für dieses Konto: {models}",
|
|
7039
7080
|
"featureLoading": "Wird geladen…",
|
|
7040
7081
|
"featureLoadFailed": "Laden fehlgeschlagen. Zum erneuten Versuchen klicken",
|
|
7041
7082
|
"featureRetry": "Erneut versuchen",
|
|
@@ -7748,6 +7789,12 @@ window.__ModuleLoader__.load({
|
|
|
7748
7789
|
"historyTotalUnavailable": "Der offizielle Gesamtverbrauch ist für diesen Zeitraum nicht verfügbar",
|
|
7749
7790
|
"historyNoBreakdown": "Eine offizielle Aufschlüsselung ist für diesen Zeitraum noch nicht verfügbar",
|
|
7750
7791
|
"fetchTitle": "Quelle für das Lesen von Webseiten",
|
|
7792
|
+
"fetchHttpCost": "Keine Gebühr pro Abruf",
|
|
7793
|
+
"fetchDeepSeekCost": "5 CNY je 1.000 erfolgreiche Abrufe",
|
|
7794
|
+
"fetchCodexCost": "Über dein Codex-Abo",
|
|
7795
|
+
"searchDeepSeekLegacy": "DeepSeek (ältere Version)",
|
|
7796
|
+
"searchLegacyCost": "Keine zusätzliche Suchgebühr. DeepSeek berechnet die Modell-Tokens.",
|
|
7797
|
+
"searchApiCost": "5 CNY je 1.000 erfolgreiche Suchanfragen.",
|
|
7751
7798
|
"fetchDshHint": "Verwende den in DSH eingerichteten Webseitenleser, unabhängig von der oben ausgewählten Suchquelle.",
|
|
7752
7799
|
"fetchCodexHint": "Liest zugängliche Webseitentexte mit deinem Codex-Abo. Fehler werden direkt gemeldet; es gibt keinen Rückgriff auf die DeepSeek-API.",
|
|
7753
7800
|
"fetchUnavailableHint": "Diese DSH-Version kann nicht zum Codex-Webseitenleser wechseln. Aktualisiere zuerst DSH.",
|
|
@@ -7830,7 +7877,7 @@ window.__ModuleLoader__.load({
|
|
|
7830
7877
|
},
|
|
7831
7878
|
ru: {
|
|
7832
7879
|
"speedShortcutTitle": "Переключатель скорости в поле ввода",
|
|
7833
|
-
"speedShortcut_off": "
|
|
7880
|
+
"speedShortcut_off": "Как раньше",
|
|
7834
7881
|
"speedShortcut_icon": "Молния",
|
|
7835
7882
|
"speedShortcut_hover": "При наведении",
|
|
7836
7883
|
"speedShortcut_label": "Название скорости",
|
|
@@ -7988,7 +8035,8 @@ window.__ModuleLoader__.load({
|
|
|
7988
8035
|
"composerPredictions": "Предсказания ввода",
|
|
7989
8036
|
"composerPredictionAccept": "Принять предложение",
|
|
7990
8037
|
"composerPredictionsShortHint": "Tab вставляет в черновик",
|
|
7991
|
-
"composerPredictionsHint": `После завершённого ответа поддерживаемые модели Codex
|
|
8038
|
+
"composerPredictionsHint": `После завершённого ответа поддерживаемые модели Codex предлагают следующее сообщение на основе текущей беседы, если черновик пуст. Нажмите Tab, чтобы вставить предложение в черновик, не отправляя его. При этом отправляются дополнительные запросы для предсказания. Официальные предсказания Codex не учитываются в лимитах использования или кредитах; неизвестно, действует ли такое же исключение для этой сторонней интеграции. Отправка принятого черновика учитывается как обычно.`,
|
|
8039
|
+
"composerPredictionModels": "Доступные для этого аккаунта модели: {models}",
|
|
7992
8040
|
"featureLoading": "Загрузка…",
|
|
7993
8041
|
"featureLoadFailed": "Не удалось загрузить. Нажмите, чтобы повторить попытку",
|
|
7994
8042
|
"featureRetry": "Повторить",
|
|
@@ -8701,6 +8749,12 @@ window.__ModuleLoader__.load({
|
|
|
8701
8749
|
"historyTotalUnavailable": "Официальные данные об общем расходе за этот период недоступны",
|
|
8702
8750
|
"historyNoBreakdown": "Официальная разбивка за этот период пока недоступна",
|
|
8703
8751
|
"fetchTitle": "Источник для чтения веб-страниц",
|
|
8752
|
+
"fetchHttpCost": "Без платы за загрузку",
|
|
8753
|
+
"fetchDeepSeekCost": "5 CNY за 1 000 успешных загрузок",
|
|
8754
|
+
"fetchCodexCost": "По подписке Codex",
|
|
8755
|
+
"searchDeepSeekLegacy": "DeepSeek (прежняя версия)",
|
|
8756
|
+
"searchLegacyCost": "Без отдельной платы за поиск. Оплачиваются токены модели DeepSeek.",
|
|
8757
|
+
"searchApiCost": "5 CNY за 1 000 успешных запросов.",
|
|
8704
8758
|
"fetchDshHint": "Использовать средство чтения веб-страниц, настроенное в DSH, независимо от выбранного выше источника поиска.",
|
|
8705
8759
|
"fetchCodexHint": "Читать доступный текст веб-страниц с подпиской Codex. Об ошибках сообщается напрямую, без перехода на API DeepSeek.",
|
|
8706
8760
|
"fetchUnavailableHint": "Эта версия DSH не поддерживает переключение на средство чтения веб-страниц Codex. Сначала обновите DSH.",
|
|
@@ -8783,7 +8837,7 @@ window.__ModuleLoader__.load({
|
|
|
8783
8837
|
},
|
|
8784
8838
|
pt: {
|
|
8785
8839
|
"speedShortcutTitle": "Atalho de velocidade no campo de mensagem",
|
|
8786
|
-
"speedShortcut_off": "
|
|
8840
|
+
"speedShortcut_off": "Como antes",
|
|
8787
8841
|
"speedShortcut_icon": "Raio",
|
|
8788
8842
|
"speedShortcut_hover": "Ao passar o cursor",
|
|
8789
8843
|
"speedShortcut_label": "Nome da velocidade",
|
|
@@ -8941,7 +8995,8 @@ window.__ModuleLoader__.load({
|
|
|
8941
8995
|
"composerPredictions": "Previsões de texto",
|
|
8942
8996
|
"composerPredictionAccept": "Aceitar sugestão",
|
|
8943
8997
|
"composerPredictionsShortHint": "Tab completa o rascunho",
|
|
8944
|
-
"composerPredictionsHint": `Modelos Codex compatíveis
|
|
8998
|
+
"composerPredictionsHint": `Modelos Codex compatíveis sugerem sua próxima mensagem com base na conversa atual após a conclusão de uma resposta, quando o rascunho está vazio. Tab completa o rascunho sem enviá-lo. Isso gera solicitações adicionais de previsão. As previsões oficiais do Codex não contam para os limites de uso nem consomem créditos de uso; não está confirmado se a mesma isenção vale para esta integração de terceiros. O envio de um rascunho aceito conta normalmente.`,
|
|
8999
|
+
"composerPredictionModels": "Modelos disponíveis nesta conta: {models}",
|
|
8945
9000
|
"featureLoading": "Carregando…",
|
|
8946
9001
|
"featureLoadFailed": "Não foi possível carregar. Clique para tentar novamente",
|
|
8947
9002
|
"featureRetry": "Tentar novamente",
|
|
@@ -9654,6 +9709,12 @@ window.__ModuleLoader__.load({
|
|
|
9654
9709
|
"historyTotalUnavailable": "O total oficial de uso não está disponível para este período",
|
|
9655
9710
|
"historyNoBreakdown": "O detalhamento oficial ainda não está disponível para este período",
|
|
9656
9711
|
"fetchTitle": "Fonte de leitura de páginas da web",
|
|
9712
|
+
"fetchHttpCost": "Sem cobrança por leitura",
|
|
9713
|
+
"fetchDeepSeekCost": "5 CNY por 1.000 leituras bem-sucedidas",
|
|
9714
|
+
"fetchCodexCost": "Com sua assinatura do Codex",
|
|
9715
|
+
"searchDeepSeekLegacy": "DeepSeek (versão anterior)",
|
|
9716
|
+
"searchLegacyCost": "A busca não tem cobrança adicional. Os tokens do modelo DeepSeek são cobrados.",
|
|
9717
|
+
"searchApiCost": "5 CNY por 1.000 buscas bem-sucedidas.",
|
|
9657
9718
|
"fetchDshHint": "Usar o leitor de páginas configurado no DSH, independentemente da fonte de pesquisa acima.",
|
|
9658
9719
|
"fetchCodexHint": "Ler o texto acessível das páginas da web usando sua assinatura do Codex. Falhas são informadas diretamente, sem recorrer à API do DeepSeek.",
|
|
9659
9720
|
"fetchUnavailableHint": "Esta versão do DSH não permite usar o leitor de páginas do Codex. Atualize o DSH primeiro.",
|
|
@@ -9791,6 +9852,8 @@ window.__ModuleLoader__.load({
|
|
|
9791
9852
|
.codexSubscriptionAdvancedPreferences{display:flex;flex-direction:column;gap:10px}
|
|
9792
9853
|
.codexSubscriptionAdvancedPreferences[data-others-off=true]>[data-governed=true]{opacity:.55;transition:opacity .15s}
|
|
9793
9854
|
.codexSubscriptionSearchChoices.codexSubscriptionQuotaModes{display:flex;flex:0 0 auto;gap:0;grid-template-columns:none}
|
|
9855
|
+
.codexSubscriptionWebProviderTrigger{max-width:100%}
|
|
9856
|
+
.codexSubscriptionWebProviderTrigger>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
9794
9857
|
.codexSubscriptionSettingsDisclosure>summary{display:flex;align-items:center;gap:10px;min-height:28px;cursor:pointer;list-style:none;font-size:14px;font-weight:500}
|
|
9795
9858
|
.codexSubscriptionSettingsDisclosure>summary::-webkit-details-marker{display:none}
|
|
9796
9859
|
.codexSubscriptionSettingsDisclosure>summary>.codexSubscriptionPreferenceHint{margin-left:auto;font-weight:400}
|
|
@@ -10167,6 +10230,8 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
10167
10230
|
.codexFlat .codexSubscriptionPreferenceCopy{gap:0}
|
|
10168
10231
|
.codexFlat .codexComposerMenuGroup>.codexSubscriptionPreference:not(:last-child){border-bottom:0;padding-bottom:0}
|
|
10169
10232
|
.codexFlat .codexComposerMenuOption{padding-inline-start:16px;min-height:40px}
|
|
10233
|
+
.codexComposerSpeedShortcutSetting>.codexSubscriptionPreferenceCopy{flex:1 1 auto}
|
|
10234
|
+
.codexComposerSpeedShortcutSetting>.codexSubscriptionQuotaModes{margin-inline-start:auto}
|
|
10170
10235
|
.codexFlat .codexSubscriptionDivider{display:none}
|
|
10171
10236
|
.codexFlat .codexSubscriptionQuotaModes{background:var(--dsw-alias-bg-module-platform);border-radius:10px;padding:2px;gap:2px;min-height:32px;box-sizing:border-box}
|
|
10172
10237
|
.codexFlat .codexSubscriptionQuotaMode{min-height:28px;border-radius:8px;padding:0 10px;font-size:13px;white-space:nowrap}
|
|
@@ -11841,7 +11906,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11841
11906
|
}
|
|
11842
11907
|
//#endregion
|
|
11843
11908
|
//#region src/version.js
|
|
11844
|
-
const PACKAGE_VERSION = "3.2.
|
|
11909
|
+
const PACKAGE_VERSION = "3.2.24";
|
|
11845
11910
|
//#endregion
|
|
11846
11911
|
//#region src/client-recovery.js
|
|
11847
11912
|
async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = endpoint === "usage" || endpoint.startsWith("usage/") ? 3e4 : 1e4) {
|
|
@@ -12232,12 +12297,20 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
12232
12297
|
ultrafast: "speedUltrafast"
|
|
12233
12298
|
};
|
|
12234
12299
|
function CodexSpeedShortcut({ directory, preference, t, locked }) {
|
|
12235
|
-
const { current } = (0, react.useSyncExternalStore)(directory.subscribe, directory.getSnapshot);
|
|
12300
|
+
const { current } = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
|
|
12236
12301
|
const status = usePreferenceSnapshot(preference);
|
|
12237
12302
|
const mode = status[SPEED_SHORTCUT_FIELD];
|
|
12238
12303
|
const modelId = current?.model;
|
|
12239
12304
|
const supportsFast = status.fastModels?.includes(modelId) ?? supportsCodexFastMode(modelId);
|
|
12240
|
-
|
|
12305
|
+
const visible = mode !== "off" && current?.provider === "openai-codex" && supportsFast && status.status === "ready";
|
|
12306
|
+
(0, react.useLayoutEffect)(() => {
|
|
12307
|
+
if (!visible) return;
|
|
12308
|
+
const style = document.createElement("style");
|
|
12309
|
+
style.textContent = SPEED_SHORTCUT_CSS;
|
|
12310
|
+
document.head.append(style);
|
|
12311
|
+
return () => style.remove();
|
|
12312
|
+
}, [visible]);
|
|
12313
|
+
if (!visible) return null;
|
|
12241
12314
|
const speed = effectiveCodexSpeedMode(status.speedMode, modelId, {
|
|
12242
12315
|
supportsFast,
|
|
12243
12316
|
supportsUltrafast: status.ultrafastModels?.includes(modelId)
|
|
@@ -12286,13 +12359,11 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
12286
12359
|
div:has(>[data-slot="conversation.input.right"]>.codexSpeedShortcutSeat:is([data-layout=icon],[data-layout=hover])):has(>[data-slot="conversation.input.model"]){column-gap:0}
|
|
12287
12360
|
|
|
12288
12361
|
@media(hover:hover) and (pointer:fine){
|
|
12289
|
-
|
|
12362
|
+
/* The composer group stays hovered across the seam between the model and shortcut. */
|
|
12290
12363
|
[data-slot="conversation.input.right"]:has(+[data-slot="conversation.input.model"])>.codexSpeedShortcutSeat[data-layout=hover][data-speed=standard]>.codexSpeedShortcut{
|
|
12291
|
-
|
|
12292
|
-
transition:opacity 150ms,visibility 0s 150ms
|
|
12364
|
+
opacity:0;pointer-events:none;transition:opacity 150ms
|
|
12293
12365
|
}
|
|
12294
|
-
div:
|
|
12295
|
-
.codexSpeedShortcutSeat[data-layout=hover][data-speed=standard]:is(:hover,:focus-within)>.codexSpeedShortcut{opacity:1;visibility:visible;transition:none}
|
|
12366
|
+
div:is(:hover,:focus-within)>[data-slot="conversation.input.right"]:has(+[data-slot="conversation.input.model"])>.codexSpeedShortcutSeat[data-layout=hover][data-speed=standard]>.codexSpeedShortcut{opacity:1;pointer-events:auto;transition:none}
|
|
12296
12367
|
}
|
|
12297
12368
|
|
|
12298
12369
|
/* Keep the labelled shortcut next to the native model trigger. */
|
|
@@ -14848,14 +14919,38 @@ void main(){
|
|
|
14848
14919
|
}
|
|
14849
14920
|
//#endregion
|
|
14850
14921
|
//#region src/composer-prediction-preferences.jsx
|
|
14851
|
-
function ComposerPredictionPreference({ preference, t }) {
|
|
14922
|
+
function ComposerPredictionPreference({ preference, t, rpc, active, accountKey }) {
|
|
14852
14923
|
const snapshot = usePreferenceSnapshot(preference);
|
|
14924
|
+
const [availability, setAvailability] = (0, react.useState)();
|
|
14925
|
+
(0, react.useEffect)(() => {
|
|
14926
|
+
if (!rpc || !active || !accountKey) return;
|
|
14927
|
+
const request = new AbortController();
|
|
14928
|
+
Promise.resolve().then(() => {
|
|
14929
|
+
request.signal.throwIfAborted();
|
|
14930
|
+
return rpc.call(CHANNEL, "predictions/models", {}, request.signal);
|
|
14931
|
+
}).then(unwrap).then((names) => {
|
|
14932
|
+
if (!request.signal.aborted) setAvailability({
|
|
14933
|
+
accountKey,
|
|
14934
|
+
names
|
|
14935
|
+
});
|
|
14936
|
+
}).catch(() => {
|
|
14937
|
+
if (!request.signal.aborted) setAvailability(void 0);
|
|
14938
|
+
});
|
|
14939
|
+
return () => request.abort();
|
|
14940
|
+
}, [
|
|
14941
|
+
rpc,
|
|
14942
|
+
active,
|
|
14943
|
+
accountKey,
|
|
14944
|
+
snapshot.availableModels
|
|
14945
|
+
]);
|
|
14946
|
+
const names = availability?.accountKey === accountKey ? availability?.names : void 0;
|
|
14947
|
+
const detail = names?.length ? fill(t("composerPredictionModels"), { models: names.join(", ") }) : void 0;
|
|
14853
14948
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14854
14949
|
className: "codexSubscriptionPreference",
|
|
14855
14950
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14856
14951
|
className: "codexSubscriptionPreferenceCopy",
|
|
14857
14952
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SettingsLabel, {
|
|
14858
|
-
description: t("composerPredictionsHint"),
|
|
14953
|
+
description: [t("composerPredictionsHint"), detail].filter(Boolean).join("\n\n"),
|
|
14859
14954
|
children: [
|
|
14860
14955
|
t("composerPredictions"),
|
|
14861
14956
|
" ",
|
|
@@ -17758,19 +17853,82 @@ void main(){
|
|
|
17758
17853
|
"codex-subscription-auto": "Codex Subscription (Auto)",
|
|
17759
17854
|
"codex-subscription-dsh": "DSH (Codex Subscription)"
|
|
17760
17855
|
};
|
|
17761
|
-
const webProviderTitle = (id) => nativeTitles[id]
|
|
17856
|
+
const webProviderTitle = (id, t) => id === "deepseek-official" && t ? t("searchDeepSeekLegacy") : Object.hasOwn(nativeTitles, id) ? nativeTitles[id] : id;
|
|
17857
|
+
const options = {
|
|
17858
|
+
search: {
|
|
17859
|
+
"deepseek-official": ["searchDeepSeekLegacy", "searchLegacyCost"],
|
|
17860
|
+
"deepseek-search-api": ["DeepSeek Search API", "searchApiCost"],
|
|
17861
|
+
"codex-subscription": ["Codex", "searchCodexHint"],
|
|
17862
|
+
"codex-subscription-auto": ["searchAuto", "searchAutoHint"],
|
|
17863
|
+
"codex-subscription-dsh": ["searchDsh", "searchDshHint"]
|
|
17864
|
+
},
|
|
17865
|
+
fetch: {
|
|
17866
|
+
http: ["HTTP", "fetchHttpCost"],
|
|
17867
|
+
"deepseek-fetch-api": ["DeepSeek Fetch API", "fetchDeepSeekCost"],
|
|
17868
|
+
"codex-subscription-fetch": ["Codex", "fetchCodexCost"]
|
|
17869
|
+
}
|
|
17870
|
+
};
|
|
17871
|
+
function ProviderChoice({ kind, title, current, providers, writable, saving, t, change }) {
|
|
17872
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
17873
|
+
const names = options[kind];
|
|
17874
|
+
const registered = new Map(providers?.map((provider) => [provider.id, provider]));
|
|
17875
|
+
const ids = /* @__PURE__ */ new Set([...Object.keys(names).filter((id) => registered.has(id)), ...registered.keys()]);
|
|
17876
|
+
if (current) ids.add(current);
|
|
17877
|
+
const describe = (id) => {
|
|
17878
|
+
if (!Object.hasOwn(names, id)) return { label: registered.get(id)?.title ?? webProviderTitle(id, t) };
|
|
17879
|
+
const [name, detail] = names[id];
|
|
17880
|
+
return {
|
|
17881
|
+
label: name.startsWith("search") ? t(name) : name,
|
|
17882
|
+
description: t(detail)
|
|
17883
|
+
};
|
|
17884
|
+
};
|
|
17885
|
+
const selected = describe(current);
|
|
17886
|
+
const hasNativeSearch = kind === "search" && [...registered.keys()].some((id) => !Object.hasOwn(names, id) || id === "deepseek-official" || id === "deepseek-search-api");
|
|
17887
|
+
const items = [...ids].filter((id) => id !== "codex-subscription-dsh" || id === current || !hasNativeSearch).map((id) => ({
|
|
17888
|
+
id,
|
|
17889
|
+
disabled: !registered.has(id),
|
|
17890
|
+
...describe(id)
|
|
17891
|
+
}));
|
|
17892
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
17893
|
+
className: "codexSubscriptionPreference",
|
|
17894
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
17895
|
+
className: "codexSubscriptionPreferenceCopy",
|
|
17896
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsLabel, {
|
|
17897
|
+
description: selected.description,
|
|
17898
|
+
children: title
|
|
17899
|
+
})
|
|
17900
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Menu, {
|
|
17901
|
+
open,
|
|
17902
|
+
items,
|
|
17903
|
+
selectedId: current,
|
|
17904
|
+
align: "end",
|
|
17905
|
+
onClose: () => setOpen(false),
|
|
17906
|
+
onSelect: (id) => {
|
|
17907
|
+
setOpen(false);
|
|
17908
|
+
if (id !== current) change(kind + "Provider", id);
|
|
17909
|
+
},
|
|
17910
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
17911
|
+
className: "codexSubscriptionContextTrigger codexSubscriptionWebProviderTrigger",
|
|
17912
|
+
type: "button",
|
|
17913
|
+
"aria-label": title,
|
|
17914
|
+
"aria-expanded": open,
|
|
17915
|
+
"aria-busy": saving || void 0,
|
|
17916
|
+
disabled: !writable || !items.some((item) => !item.disabled),
|
|
17917
|
+
onClick: () => setOpen((value) => !value),
|
|
17918
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selected.label ?? "—" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutline14, {})]
|
|
17919
|
+
})
|
|
17920
|
+
})]
|
|
17921
|
+
});
|
|
17922
|
+
}
|
|
17762
17923
|
function useWebProviderForm(ctx) {
|
|
17763
17924
|
return useProviderSnapshot(ctx?.get("configForms")?.get("web"));
|
|
17764
17925
|
}
|
|
17765
17926
|
function useProviderSnapshot(form) {
|
|
17766
17927
|
return (0, react.useSyncExternalStore)(form ? (listener) => form.subscribe(listener) : idle, form ? () => form.getSnapshot() : snapshot);
|
|
17767
17928
|
}
|
|
17768
|
-
function WebProviderSettings({ ctx, t
|
|
17769
|
-
const radioId = (0, react.useId)();
|
|
17929
|
+
function WebProviderSettings({ ctx, t }) {
|
|
17770
17930
|
const form = ctx?.get("configForms")?.get("web");
|
|
17771
17931
|
const section = useProviderSnapshot(form);
|
|
17772
|
-
const subscription = useProviderSnapshot(ctx?.get("configForms")?.get("codex-subscription"));
|
|
17773
|
-
const preferences = preference.getSnapshot();
|
|
17774
17932
|
const [providers, setProviders] = (0, react.useState)();
|
|
17775
17933
|
const [failed, setFailed] = (0, react.useState)(false);
|
|
17776
17934
|
const [saving, setSaving] = (0, react.useState)(false);
|
|
@@ -17819,64 +17977,21 @@ void main(){
|
|
|
17819
17977
|
setSaving(false);
|
|
17820
17978
|
}
|
|
17821
17979
|
};
|
|
17822
|
-
const
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
children: label
|
|
17838
|
-
}), section.status === "ready" && showProvider ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Hint, { children: providerName }) : null]
|
|
17839
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
17840
|
-
className: "codexSubscriptionSearchChoices codexSubscriptionQuotaModes",
|
|
17841
|
-
role: "radiogroup",
|
|
17842
|
-
"aria-label": label,
|
|
17843
|
-
"aria-busy": saving || void 0,
|
|
17844
|
-
children: Object.entries(ids).map(([mode, target]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
17845
|
-
className: "codexSubscriptionQuotaMode",
|
|
17846
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
17847
|
-
type: "radio",
|
|
17848
|
-
name: `${radioId}-${field}`,
|
|
17849
|
-
checked: section.status === "ready" && selected === mode,
|
|
17850
|
-
disabled: section.status !== "ready" || !section.writable || saving,
|
|
17851
|
-
onChange: () => {
|
|
17852
|
-
change(field, target);
|
|
17853
|
-
}
|
|
17854
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: mode === "auto" ? t("searchAuto") : mode === "codex" ? "Codex" : "DSH" })]
|
|
17855
|
-
}, mode))
|
|
17856
|
-
})]
|
|
17857
|
-
});
|
|
17858
|
-
};
|
|
17859
|
-
const search = section.value?.searchProvider;
|
|
17860
|
-
const fetch = section.value?.fetchProvider;
|
|
17861
|
-
const baseFetch = section.base?.fetchProvider;
|
|
17862
|
-
const nativeSearch = subscription.user?.webSearchFallbackProvider ?? preferences.webSearchFallbackProvider;
|
|
17863
|
-
const nativeFetch = subscription.user?.webFetchFallbackProvider ?? preferences.webFetchFallbackProvider;
|
|
17864
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
17865
|
-
row("search", t("searchTitle"), {
|
|
17866
|
-
auto: "codex-subscription-auto",
|
|
17867
|
-
dsh: nativeSearch ?? "codex-subscription-dsh",
|
|
17868
|
-
codex: "codex-subscription"
|
|
17869
|
-
}, search === "codex-subscription-auto" ? "auto" : search === "codex-subscription" ? "codex" : "dsh"),
|
|
17870
|
-
row("fetch", t("fetchTitle"), {
|
|
17871
|
-
dsh: nativeFetch ?? (baseFetch === "codex-subscription-fetch" ? "http" : baseFetch),
|
|
17872
|
-
codex: "codex-subscription-fetch"
|
|
17873
|
-
}, fetch === "codex-subscription-fetch" ? "codex" : "dsh"),
|
|
17874
|
-
failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
17875
|
-
className: "codexSubscriptionError",
|
|
17876
|
-
role: "alert",
|
|
17877
|
-
children: t("preferenceFailed")
|
|
17878
|
-
}) : null
|
|
17879
|
-
] });
|
|
17980
|
+
const writable = section.status === "ready" && section.writable && !saving;
|
|
17981
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [["search", "fetch"].map((kind) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderChoice, {
|
|
17982
|
+
kind,
|
|
17983
|
+
title: t(kind + "Title"),
|
|
17984
|
+
current: section.value?.[kind + "Provider"],
|
|
17985
|
+
providers: providers?.[kind],
|
|
17986
|
+
writable,
|
|
17987
|
+
saving,
|
|
17988
|
+
t,
|
|
17989
|
+
change
|
|
17990
|
+
}, kind)), failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
17991
|
+
className: "codexSubscriptionError",
|
|
17992
|
+
role: "alert",
|
|
17993
|
+
children: t("preferenceFailed")
|
|
17994
|
+
}) : null] });
|
|
17880
17995
|
}
|
|
17881
17996
|
//#endregion
|
|
17882
17997
|
//#region src/context-draft-state.js
|
|
@@ -17998,8 +18113,7 @@ void main(){
|
|
|
17998
18113
|
className: "codexSubscriptionSearch",
|
|
17999
18114
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(WebProviderSettings, {
|
|
18000
18115
|
ctx: webSettingsContext,
|
|
18001
|
-
t
|
|
18002
|
-
preference
|
|
18116
|
+
t
|
|
18003
18117
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CapabilityPreferences, {
|
|
18004
18118
|
preference,
|
|
18005
18119
|
t,
|
|
@@ -18588,7 +18702,7 @@ void main(){
|
|
|
18588
18702
|
function FeatureOverview({ preference, t, go, webSettingsContext }) {
|
|
18589
18703
|
const snapshot = usePreferenceSnapshot(preference);
|
|
18590
18704
|
const web = useWebProviderForm(webSettingsContext);
|
|
18591
|
-
const searchStatus = snapshot.webProvidersManagedByDsh ? web.status === "ready" ? webProviderTitle(web.value?.searchProvider) ?? t("searchAuto") : void 0 : `${t(`searchSource_${snapshot.searchProvider}`)} · ${t(`searchMode_${snapshot.searchMode}`)}`;
|
|
18705
|
+
const searchStatus = snapshot.webProvidersManagedByDsh ? web.status === "ready" ? webProviderTitle(web.value?.searchProvider, t) ?? t("searchAuto") : void 0 : `${t(`searchSource_${snapshot.searchProvider}`)} · ${t(`searchMode_${snapshot.searchMode}`)}`;
|
|
18592
18706
|
const writable = ready(snapshot);
|
|
18593
18707
|
const set = (patch) => {
|
|
18594
18708
|
preference.set(patch);
|
|
@@ -18788,7 +18902,7 @@ void main(){
|
|
|
18788
18902
|
})]
|
|
18789
18903
|
});
|
|
18790
18904
|
}
|
|
18791
|
-
function ModelsPage({ preference, t, defaultModel }) {
|
|
18905
|
+
function ModelsPage({ preference, t, defaultModel, rpc, active, accountKey }) {
|
|
18792
18906
|
const snapshot = usePreferenceSnapshot(preference);
|
|
18793
18907
|
const loaded = snapshot.status === "ready";
|
|
18794
18908
|
const customMenu = snapshot.composerModelPickerActive;
|
|
@@ -18855,7 +18969,7 @@ void main(){
|
|
|
18855
18969
|
t
|
|
18856
18970
|
}) : null,
|
|
18857
18971
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18858
|
-
className: "codexSubscriptionPreference",
|
|
18972
|
+
className: "codexSubscriptionPreference codexComposerSpeedShortcutSetting",
|
|
18859
18973
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
18860
18974
|
className: "codexSubscriptionPreferenceCopy",
|
|
18861
18975
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsLabel, { children: t("speedShortcutTitle") })
|
|
@@ -18877,7 +18991,10 @@ void main(){
|
|
|
18877
18991
|
}),
|
|
18878
18992
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerPredictionPreference, {
|
|
18879
18993
|
preference,
|
|
18880
|
-
t
|
|
18994
|
+
t,
|
|
18995
|
+
rpc,
|
|
18996
|
+
active,
|
|
18997
|
+
accountKey
|
|
18881
18998
|
})
|
|
18882
18999
|
]
|
|
18883
19000
|
}),
|
|
@@ -19267,6 +19384,185 @@ void main(){
|
|
|
19267
19384
|
});
|
|
19268
19385
|
}
|
|
19269
19386
|
//#endregion
|
|
19387
|
+
//#region src/composer-prediction-controller.js
|
|
19388
|
+
const EMPTY = Object.freeze({
|
|
19389
|
+
prediction: null,
|
|
19390
|
+
status: "idle"
|
|
19391
|
+
});
|
|
19392
|
+
const textOf = (blocks, field) => (Array.isArray(blocks) ? blocks : []).filter((block) => block?.[field] === "text" && typeof block.text === "string").map((block) => block.text).join("\n");
|
|
19393
|
+
/** Account identity is local admission state, never part of the prediction payload. */
|
|
19394
|
+
function composerPredictionAccountKey(snapshot) {
|
|
19395
|
+
if (snapshot?.status !== "ready" || snapshot.account?.authenticated !== true) return void 0;
|
|
19396
|
+
const accounts = snapshot.account.accounts;
|
|
19397
|
+
if (!Array.isArray(accounts) || accounts.length === 0) return "authenticated";
|
|
19398
|
+
const active = accounts.find((account) => account.active === true) ?? (accounts.length === 1 ? accounts[0] : void 0);
|
|
19399
|
+
return typeof active?.id === "string" && active.id ? active.id : void 0;
|
|
19400
|
+
}
|
|
19401
|
+
/** Read only the text that the public Chat view presents, never provider history. */
|
|
19402
|
+
function composerPredictionContext(chat) {
|
|
19403
|
+
if (!Array.isArray(chat?.order) || typeof chat.nodes?.get !== "function") return null;
|
|
19404
|
+
const messages = [];
|
|
19405
|
+
let latest;
|
|
19406
|
+
let remaining = 24e3;
|
|
19407
|
+
for (let index = chat.order.length - 1; index >= 0; index -= 1) {
|
|
19408
|
+
const node = chat.nodes.get(chat.order[index]);
|
|
19409
|
+
if (node?.visibility !== "visible") continue;
|
|
19410
|
+
if (node.kind !== "user" && node.kind !== "assistant-step") continue;
|
|
19411
|
+
const assistant = node.kind === "assistant-step";
|
|
19412
|
+
const data = node.data;
|
|
19413
|
+
const text = assistant ? textOf(data?.blocks, "kind") : textOf(data?.content, "type");
|
|
19414
|
+
if (!latest) {
|
|
19415
|
+
if (!assistant || data?.status !== "settled" || !data.finalNode || data.finalNode.interrupted || !text.trim()) return null;
|
|
19416
|
+
if ((chat.timeline?.turns?.get(data.turn))?.status !== "closed" || chat.timeline?.turnOrder?.at(-1) !== data.turn) return null;
|
|
19417
|
+
latest = { turnId: String(data.turn) };
|
|
19418
|
+
}
|
|
19419
|
+
if (assistant && data?.status !== "settled") continue;
|
|
19420
|
+
if (!text.trim()) continue;
|
|
19421
|
+
const bounded = text.slice(-remaining);
|
|
19422
|
+
messages.unshift({
|
|
19423
|
+
role: assistant ? "assistant" : "user",
|
|
19424
|
+
text: bounded
|
|
19425
|
+
});
|
|
19426
|
+
remaining -= bounded.length;
|
|
19427
|
+
if (messages.length >= 12 || remaining <= 0) break;
|
|
19428
|
+
}
|
|
19429
|
+
return latest && messages.length >= 2 && messages.some((message) => message.role === "user") && messages.at(-1).role === "assistant" ? {
|
|
19430
|
+
...latest,
|
|
19431
|
+
messages
|
|
19432
|
+
} : null;
|
|
19433
|
+
}
|
|
19434
|
+
const eligibleDraft = (state) => state?.enabled === true && state.provider === "openai-codex" && typeof state.accountKey === "string" && state.accountKey.length > 0 && validModelKey(state.model) && state.sessionId && state.composing !== true && state.input?.phase === "plain" && typeof state.input.draft === "string" && !state.input.draft.trim() && !state.input.attachmentIds?.length && !state.input.occurrences?.length && state.span?.draftRev === state.input.draftRev && state.span.start === state.span.end && state.span.end === state.input.draft.length && state.context;
|
|
19435
|
+
const eligible = (state) => eligibleDraft(state) && state.visible === true && state.focused === true;
|
|
19436
|
+
const sameDraft = (a, b) => a?.sessionId === b?.sessionId && a?.model === b?.model && a?.accountKey === b?.accountKey && a?.context?.turnId === b?.context?.turnId && a?.input?.draftRev === b?.input?.draftRev && a?.input?.draft === b?.input?.draft && a?.span?.start === b?.span?.start && a?.span?.end === b?.span?.end;
|
|
19437
|
+
const contextKey = (value) => value?.enabled === true && value.accountKey && value.sessionId && value.context ? JSON.stringify([
|
|
19438
|
+
value.accountKey,
|
|
19439
|
+
value.sessionId,
|
|
19440
|
+
value.provider,
|
|
19441
|
+
value.model,
|
|
19442
|
+
value.context.turnId
|
|
19443
|
+
]) : void 0;
|
|
19444
|
+
/** One cancellable prediction per completed turn; late work cannot edit or revive a draft. */
|
|
19445
|
+
function createComposerPredictionController(rpc, { now = Date.now } = {}) {
|
|
19446
|
+
let snapshot = EMPTY;
|
|
19447
|
+
let state;
|
|
19448
|
+
let anchor;
|
|
19449
|
+
let pending;
|
|
19450
|
+
let cached;
|
|
19451
|
+
let generation = 0;
|
|
19452
|
+
let disposed = false;
|
|
19453
|
+
const attempted = /* @__PURE__ */ new Set();
|
|
19454
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
19455
|
+
const publish = (next) => {
|
|
19456
|
+
if (disposed || snapshot.prediction === next.prediction && snapshot.status === next.status) return;
|
|
19457
|
+
snapshot = Object.freeze(next);
|
|
19458
|
+
for (const listener of [...listeners]) if (!disposed) listener();
|
|
19459
|
+
};
|
|
19460
|
+
const clear = () => {
|
|
19461
|
+
generation += 1;
|
|
19462
|
+
pending?.abort();
|
|
19463
|
+
pending = void 0;
|
|
19464
|
+
anchor = void 0;
|
|
19465
|
+
publish(EMPTY);
|
|
19466
|
+
};
|
|
19467
|
+
const update = (next) => {
|
|
19468
|
+
if (disposed) return;
|
|
19469
|
+
state = next;
|
|
19470
|
+
const key = contextKey(next);
|
|
19471
|
+
if (cached && (cached.key !== key || now() - cached.at >= 3e5)) {
|
|
19472
|
+
cached = void 0;
|
|
19473
|
+
clear();
|
|
19474
|
+
}
|
|
19475
|
+
if (!eligibleDraft(next)) {
|
|
19476
|
+
clear();
|
|
19477
|
+
return;
|
|
19478
|
+
}
|
|
19479
|
+
if (anchor && sameDraft(anchor, next)) return;
|
|
19480
|
+
clear();
|
|
19481
|
+
if (next.visible !== true) return;
|
|
19482
|
+
if (cached?.key === key) {
|
|
19483
|
+
anchor = next;
|
|
19484
|
+
publish({
|
|
19485
|
+
prediction: cached.prediction,
|
|
19486
|
+
status: "ready"
|
|
19487
|
+
});
|
|
19488
|
+
return;
|
|
19489
|
+
}
|
|
19490
|
+
if (attempted.has(key)) return;
|
|
19491
|
+
anchor = next;
|
|
19492
|
+
const request = ++generation;
|
|
19493
|
+
const abort = new AbortController();
|
|
19494
|
+
pending = abort;
|
|
19495
|
+
publish({
|
|
19496
|
+
prediction: null,
|
|
19497
|
+
status: "loading"
|
|
19498
|
+
});
|
|
19499
|
+
Promise.resolve().then(() => {
|
|
19500
|
+
if (disposed || generation !== request || abort.signal.aborted) return;
|
|
19501
|
+
attempted.add(key);
|
|
19502
|
+
if (attempted.size > 128) attempted.delete(attempted.values().next().value);
|
|
19503
|
+
return rpc.call(CHANNEL, "predictions/generate", {
|
|
19504
|
+
sessionId: next.sessionId,
|
|
19505
|
+
model: next.model,
|
|
19506
|
+
turnId: next.context.turnId,
|
|
19507
|
+
messages: next.context.messages
|
|
19508
|
+
}, abort.signal);
|
|
19509
|
+
}).then((response) => {
|
|
19510
|
+
if (disposed || generation !== request || abort.signal.aborted || !eligibleDraft(state) || !sameDraft(anchor, state)) return;
|
|
19511
|
+
const value = unwrap(response);
|
|
19512
|
+
const prediction = typeof value?.prediction === "string" ? value.prediction.trim() : "";
|
|
19513
|
+
if (prediction && prediction.length <= 4e3) {
|
|
19514
|
+
cached = {
|
|
19515
|
+
key,
|
|
19516
|
+
prediction,
|
|
19517
|
+
at: now()
|
|
19518
|
+
};
|
|
19519
|
+
publish({
|
|
19520
|
+
prediction,
|
|
19521
|
+
status: "ready"
|
|
19522
|
+
});
|
|
19523
|
+
} else publish(EMPTY);
|
|
19524
|
+
}).catch(() => {
|
|
19525
|
+
if (!disposed && generation === request) publish(EMPTY);
|
|
19526
|
+
}).finally(() => {
|
|
19527
|
+
if (generation === request) pending = void 0;
|
|
19528
|
+
});
|
|
19529
|
+
};
|
|
19530
|
+
return Object.freeze({
|
|
19531
|
+
getSnapshot: () => snapshot,
|
|
19532
|
+
subscribe: (listener) => {
|
|
19533
|
+
if (disposed) return () => {};
|
|
19534
|
+
listeners.add(listener);
|
|
19535
|
+
return () => listeners.delete(listener);
|
|
19536
|
+
},
|
|
19537
|
+
update,
|
|
19538
|
+
cancel: clear,
|
|
19539
|
+
accept(inputActions, current) {
|
|
19540
|
+
if (disposed || !snapshot.prediction || !eligible(current) || !sameDraft(anchor, current)) return false;
|
|
19541
|
+
const span = inputActions.captureInsertion();
|
|
19542
|
+
if (span.draftRev !== anchor.span.draftRev || span.start !== anchor.span.start || span.end !== anchor.span.end) {
|
|
19543
|
+
clear();
|
|
19544
|
+
return false;
|
|
19545
|
+
}
|
|
19546
|
+
const prediction = snapshot.prediction;
|
|
19547
|
+
clear();
|
|
19548
|
+
if (!inputActions.insertText(prediction, span)) return false;
|
|
19549
|
+
inputActions.persistDraft?.();
|
|
19550
|
+
return true;
|
|
19551
|
+
},
|
|
19552
|
+
dispose() {
|
|
19553
|
+
if (disposed) return;
|
|
19554
|
+
disposed = true;
|
|
19555
|
+
generation += 1;
|
|
19556
|
+
pending?.abort();
|
|
19557
|
+
pending = void 0;
|
|
19558
|
+
anchor = void 0;
|
|
19559
|
+
cached = void 0;
|
|
19560
|
+
listeners.clear();
|
|
19561
|
+
attempted.clear();
|
|
19562
|
+
}
|
|
19563
|
+
});
|
|
19564
|
+
}
|
|
19565
|
+
//#endregion
|
|
19270
19566
|
//#region src/login-progress.js
|
|
19271
19567
|
/** Reconcile a login flow with the credential store without exposing credentials. */
|
|
19272
19568
|
async function readLoginProgress({ flow, readFlow, readAccount }) {
|
|
@@ -21007,7 +21303,10 @@ void main(){
|
|
|
21007
21303
|
children: visited.has("models") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelsPage, {
|
|
21008
21304
|
preference,
|
|
21009
21305
|
t,
|
|
21010
|
-
defaultModel
|
|
21306
|
+
defaultModel,
|
|
21307
|
+
rpc,
|
|
21308
|
+
active: tab === "models",
|
|
21309
|
+
accountKey: composerPredictionAccountKey(accountSnapshot)
|
|
21011
21310
|
})
|
|
21012
21311
|
}),
|
|
21013
21312
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -21416,185 +21715,6 @@ void main(){
|
|
|
21416
21715
|
};
|
|
21417
21716
|
}
|
|
21418
21717
|
//#endregion
|
|
21419
|
-
//#region src/composer-prediction-controller.js
|
|
21420
|
-
const EMPTY = Object.freeze({
|
|
21421
|
-
prediction: null,
|
|
21422
|
-
status: "idle"
|
|
21423
|
-
});
|
|
21424
|
-
const textOf = (blocks, field) => (Array.isArray(blocks) ? blocks : []).filter((block) => block?.[field] === "text" && typeof block.text === "string").map((block) => block.text).join("\n");
|
|
21425
|
-
/** Account identity is local admission state, never part of the prediction payload. */
|
|
21426
|
-
function composerPredictionAccountKey(snapshot) {
|
|
21427
|
-
if (snapshot?.status !== "ready" || snapshot.account?.authenticated !== true) return void 0;
|
|
21428
|
-
const accounts = snapshot.account.accounts;
|
|
21429
|
-
if (!Array.isArray(accounts) || accounts.length === 0) return "authenticated";
|
|
21430
|
-
const active = accounts.find((account) => account.active === true) ?? (accounts.length === 1 ? accounts[0] : void 0);
|
|
21431
|
-
return typeof active?.id === "string" && active.id ? active.id : void 0;
|
|
21432
|
-
}
|
|
21433
|
-
/** Read only the text that the public Chat view presents, never provider history. */
|
|
21434
|
-
function composerPredictionContext(chat) {
|
|
21435
|
-
if (!Array.isArray(chat?.order) || typeof chat.nodes?.get !== "function") return null;
|
|
21436
|
-
const messages = [];
|
|
21437
|
-
let latest;
|
|
21438
|
-
let remaining = 24e3;
|
|
21439
|
-
for (let index = chat.order.length - 1; index >= 0; index -= 1) {
|
|
21440
|
-
const node = chat.nodes.get(chat.order[index]);
|
|
21441
|
-
if (node?.visibility !== "visible") continue;
|
|
21442
|
-
if (node.kind !== "user" && node.kind !== "assistant-step") continue;
|
|
21443
|
-
const assistant = node.kind === "assistant-step";
|
|
21444
|
-
const data = node.data;
|
|
21445
|
-
const text = assistant ? textOf(data?.blocks, "kind") : textOf(data?.content, "type");
|
|
21446
|
-
if (!latest) {
|
|
21447
|
-
if (!assistant || data?.status !== "settled" || !data.finalNode || data.finalNode.interrupted || !text.trim()) return null;
|
|
21448
|
-
if ((chat.timeline?.turns?.get(data.turn))?.status !== "closed" || chat.timeline?.turnOrder?.at(-1) !== data.turn) return null;
|
|
21449
|
-
latest = { turnId: String(data.turn) };
|
|
21450
|
-
}
|
|
21451
|
-
if (assistant && data?.status !== "settled") continue;
|
|
21452
|
-
if (!text.trim()) continue;
|
|
21453
|
-
const bounded = text.slice(-remaining);
|
|
21454
|
-
messages.unshift({
|
|
21455
|
-
role: assistant ? "assistant" : "user",
|
|
21456
|
-
text: bounded
|
|
21457
|
-
});
|
|
21458
|
-
remaining -= bounded.length;
|
|
21459
|
-
if (messages.length >= 12 || remaining <= 0) break;
|
|
21460
|
-
}
|
|
21461
|
-
return latest && messages.length >= 2 && messages.some((message) => message.role === "user") && messages.at(-1).role === "assistant" ? {
|
|
21462
|
-
...latest,
|
|
21463
|
-
messages
|
|
21464
|
-
} : null;
|
|
21465
|
-
}
|
|
21466
|
-
const eligibleDraft = (state) => state?.enabled === true && state.provider === "openai-codex" && typeof state.accountKey === "string" && state.accountKey.length > 0 && supportsComposerPrediction(state.model) && state.sessionId && state.composing !== true && state.input?.phase === "plain" && typeof state.input.draft === "string" && !state.input.draft.trim() && !state.input.attachmentIds?.length && !state.input.occurrences?.length && state.span?.draftRev === state.input.draftRev && state.span.start === state.span.end && state.span.end === state.input.draft.length && state.context;
|
|
21467
|
-
const eligible = (state) => eligibleDraft(state) && state.visible === true && state.focused === true;
|
|
21468
|
-
const sameDraft = (a, b) => a?.sessionId === b?.sessionId && a?.model === b?.model && a?.accountKey === b?.accountKey && a?.context?.turnId === b?.context?.turnId && a?.input?.draftRev === b?.input?.draftRev && a?.input?.draft === b?.input?.draft && a?.span?.start === b?.span?.start && a?.span?.end === b?.span?.end;
|
|
21469
|
-
const contextKey = (value) => value?.enabled === true && value.accountKey && value.sessionId && value.context ? JSON.stringify([
|
|
21470
|
-
value.accountKey,
|
|
21471
|
-
value.sessionId,
|
|
21472
|
-
value.provider,
|
|
21473
|
-
value.model,
|
|
21474
|
-
value.context.turnId
|
|
21475
|
-
]) : void 0;
|
|
21476
|
-
/** One cancellable prediction per completed turn; late work cannot edit or revive a draft. */
|
|
21477
|
-
function createComposerPredictionController(rpc, { now = Date.now } = {}) {
|
|
21478
|
-
let snapshot = EMPTY;
|
|
21479
|
-
let state;
|
|
21480
|
-
let anchor;
|
|
21481
|
-
let pending;
|
|
21482
|
-
let cached;
|
|
21483
|
-
let generation = 0;
|
|
21484
|
-
let disposed = false;
|
|
21485
|
-
const attempted = /* @__PURE__ */ new Set();
|
|
21486
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
21487
|
-
const publish = (next) => {
|
|
21488
|
-
if (disposed || snapshot.prediction === next.prediction && snapshot.status === next.status) return;
|
|
21489
|
-
snapshot = Object.freeze(next);
|
|
21490
|
-
for (const listener of [...listeners]) if (!disposed) listener();
|
|
21491
|
-
};
|
|
21492
|
-
const clear = () => {
|
|
21493
|
-
generation += 1;
|
|
21494
|
-
pending?.abort();
|
|
21495
|
-
pending = void 0;
|
|
21496
|
-
anchor = void 0;
|
|
21497
|
-
publish(EMPTY);
|
|
21498
|
-
};
|
|
21499
|
-
const update = (next) => {
|
|
21500
|
-
if (disposed) return;
|
|
21501
|
-
state = next;
|
|
21502
|
-
const key = contextKey(next);
|
|
21503
|
-
if (cached && (cached.key !== key || now() - cached.at >= 3e5)) {
|
|
21504
|
-
cached = void 0;
|
|
21505
|
-
clear();
|
|
21506
|
-
}
|
|
21507
|
-
if (!eligibleDraft(next)) {
|
|
21508
|
-
clear();
|
|
21509
|
-
return;
|
|
21510
|
-
}
|
|
21511
|
-
if (anchor && sameDraft(anchor, next)) return;
|
|
21512
|
-
clear();
|
|
21513
|
-
if (next.visible !== true) return;
|
|
21514
|
-
if (cached?.key === key) {
|
|
21515
|
-
anchor = next;
|
|
21516
|
-
publish({
|
|
21517
|
-
prediction: cached.prediction,
|
|
21518
|
-
status: "ready"
|
|
21519
|
-
});
|
|
21520
|
-
return;
|
|
21521
|
-
}
|
|
21522
|
-
if (attempted.has(key)) return;
|
|
21523
|
-
anchor = next;
|
|
21524
|
-
const request = ++generation;
|
|
21525
|
-
const abort = new AbortController();
|
|
21526
|
-
pending = abort;
|
|
21527
|
-
publish({
|
|
21528
|
-
prediction: null,
|
|
21529
|
-
status: "loading"
|
|
21530
|
-
});
|
|
21531
|
-
Promise.resolve().then(() => {
|
|
21532
|
-
if (disposed || generation !== request || abort.signal.aborted) return;
|
|
21533
|
-
attempted.add(key);
|
|
21534
|
-
if (attempted.size > 128) attempted.delete(attempted.values().next().value);
|
|
21535
|
-
return rpc.call(CHANNEL, "predictions/generate", {
|
|
21536
|
-
sessionId: next.sessionId,
|
|
21537
|
-
model: next.model,
|
|
21538
|
-
turnId: next.context.turnId,
|
|
21539
|
-
messages: next.context.messages
|
|
21540
|
-
}, abort.signal);
|
|
21541
|
-
}).then((response) => {
|
|
21542
|
-
if (disposed || generation !== request || abort.signal.aborted || !eligibleDraft(state) || !sameDraft(anchor, state)) return;
|
|
21543
|
-
const value = unwrap(response);
|
|
21544
|
-
const prediction = typeof value?.prediction === "string" ? value.prediction.trim() : "";
|
|
21545
|
-
if (prediction && prediction.length <= 4e3) {
|
|
21546
|
-
cached = {
|
|
21547
|
-
key,
|
|
21548
|
-
prediction,
|
|
21549
|
-
at: now()
|
|
21550
|
-
};
|
|
21551
|
-
publish({
|
|
21552
|
-
prediction,
|
|
21553
|
-
status: "ready"
|
|
21554
|
-
});
|
|
21555
|
-
} else publish(EMPTY);
|
|
21556
|
-
}).catch(() => {
|
|
21557
|
-
if (!disposed && generation === request) publish(EMPTY);
|
|
21558
|
-
}).finally(() => {
|
|
21559
|
-
if (generation === request) pending = void 0;
|
|
21560
|
-
});
|
|
21561
|
-
};
|
|
21562
|
-
return Object.freeze({
|
|
21563
|
-
getSnapshot: () => snapshot,
|
|
21564
|
-
subscribe: (listener) => {
|
|
21565
|
-
if (disposed) return () => {};
|
|
21566
|
-
listeners.add(listener);
|
|
21567
|
-
return () => listeners.delete(listener);
|
|
21568
|
-
},
|
|
21569
|
-
update,
|
|
21570
|
-
cancel: clear,
|
|
21571
|
-
accept(inputActions, current) {
|
|
21572
|
-
if (disposed || !snapshot.prediction || !eligible(current) || !sameDraft(anchor, current)) return false;
|
|
21573
|
-
const span = inputActions.captureInsertion();
|
|
21574
|
-
if (span.draftRev !== anchor.span.draftRev || span.start !== anchor.span.start || span.end !== anchor.span.end) {
|
|
21575
|
-
clear();
|
|
21576
|
-
return false;
|
|
21577
|
-
}
|
|
21578
|
-
const prediction = snapshot.prediction;
|
|
21579
|
-
clear();
|
|
21580
|
-
if (!inputActions.insertText(prediction, span)) return false;
|
|
21581
|
-
inputActions.persistDraft?.();
|
|
21582
|
-
return true;
|
|
21583
|
-
},
|
|
21584
|
-
dispose() {
|
|
21585
|
-
if (disposed) return;
|
|
21586
|
-
disposed = true;
|
|
21587
|
-
generation += 1;
|
|
21588
|
-
pending?.abort();
|
|
21589
|
-
pending = void 0;
|
|
21590
|
-
anchor = void 0;
|
|
21591
|
-
cached = void 0;
|
|
21592
|
-
listeners.clear();
|
|
21593
|
-
attempted.clear();
|
|
21594
|
-
}
|
|
21595
|
-
});
|
|
21596
|
-
}
|
|
21597
|
-
//#endregion
|
|
21598
21718
|
//#region src/composer-prediction-layout.js
|
|
21599
21719
|
const pixels = (value) => Number.parseFloat(value) || 0;
|
|
21600
21720
|
/** Convert the mirror's border-box height to the editor's CSS min-height. */
|
|
@@ -21992,7 +22112,7 @@ void main(){
|
|
|
21992
22112
|
ctx.effect(() => {
|
|
21993
22113
|
const tag = document.createElement("style");
|
|
21994
22114
|
tag.dataset.plugin = "dsh-codex-subscription";
|
|
21995
|
-
tag.textContent = STYLE + IMAGE_PREVIEWS_CSS + PREDICTION_CSS
|
|
22115
|
+
tag.textContent = STYLE + IMAGE_PREVIEWS_CSS + PREDICTION_CSS;
|
|
21996
22116
|
document.head.append(tag);
|
|
21997
22117
|
return () => tag.remove();
|
|
21998
22118
|
}, "codex-subscription: style");
|