dsh-codex-subscription 2.1.3-beta.1 → 2.1.4

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/lib/client.js CHANGED
@@ -31,6 +31,7 @@ window.__ModuleLoader__.load({
31
31
  let react_jsx_runtime = require("react/jsx-runtime");
32
32
  let react_dom = require("react-dom");
33
33
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
34
+ _deepseek_ai_dsh_client_ui_primitives = __toESM(_deepseek_ai_dsh_client_ui_primitives, 1);
34
35
  //#region src/sketch-curves.js
35
36
  const cached = /* @__PURE__ */ new WeakMap();
36
37
  const midpoint = (a, b) => ({
@@ -872,6 +873,10 @@ window.__ModuleLoader__.load({
872
873
  "preferences/status",
873
874
  "preferences/models",
874
875
  "preferences/update",
876
+ "runtime/status",
877
+ "runtime/install",
878
+ "runtime/remove",
879
+ "runtime/cancel",
875
880
  "reset-credit/inspect",
876
881
  "reset-credit/prepare",
877
882
  "reset-credit/consume",
@@ -4413,6 +4418,23 @@ window.__ModuleLoader__.load({
4413
4418
  }) });
4414
4419
  }
4415
4420
  //#endregion
4421
+ //#region src/client-primitives.js
4422
+ const Input = _deepseek_ai_dsh_client_ui_primitives.Input;
4423
+ const Button = _deepseek_ai_dsh_client_ui_primitives.Button;
4424
+ const useAnchoredPosition = _deepseek_ai_dsh_client_ui_primitives.useAnchoredPosition;
4425
+ const useDismissOnOutsidePointer = _deepseek_ai_dsh_client_ui_primitives.useDismissOnOutsidePointer;
4426
+ const IconCheckOutline16 = _deepseek_ai_dsh_client_ui_primitives.IconCheckOutline16 ?? _deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular;
4427
+ const IconChevronDownOutline14 = _deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14 ?? _deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular;
4428
+ const IconChevronRightOutline14 = _deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutline14 ?? _deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular;
4429
+ const Menu = _deepseek_ai_dsh_client_ui_primitives.Menu;
4430
+ const Tooltip = _deepseek_ai_dsh_client_ui_primitives.Tooltip;
4431
+ const IconChevronLeftOutline14 = _deepseek_ai_dsh_client_ui_primitives.IconChevronLeftOutline14 ?? _deepseek_ai_dsh_client_ui_primitives.IconChevronLeftOutlineRegular;
4432
+ const IconCloseOutline16 = _deepseek_ai_dsh_client_ui_primitives.IconCloseOutline16 ?? _deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular;
4433
+ const IconCopyOutline16 = _deepseek_ai_dsh_client_ui_primitives.IconCopyOutline16 ?? _deepseek_ai_dsh_client_ui_primitives.IconCopyOutlineRegular;
4434
+ const IconDownloadOutline16 = _deepseek_ai_dsh_client_ui_primitives.IconDownloadOutline16 ?? _deepseek_ai_dsh_client_ui_primitives.IconDownloadOutlineRegular;
4435
+ const IconEditOutline16 = _deepseek_ai_dsh_client_ui_primitives.IconEditOutline16 ?? _deepseek_ai_dsh_client_ui_primitives.IconEditOutlineRegular;
4436
+ const IconFullscreenOutline16 = _deepseek_ai_dsh_client_ui_primitives.IconFullscreenOutline16 ?? _deepseek_ai_dsh_client_ui_primitives.IconFullscreenOutlineRegular;
4437
+ //#endregion
4416
4438
  //#region src/image-workspace.jsx
4417
4439
  function ImageWorkspace(props) {
4418
4440
  const { preference, t, registerOpen } = props;
@@ -4426,9 +4448,9 @@ window.__ModuleLoader__.load({
4426
4448
  dispose();
4427
4449
  };
4428
4450
  }, [registerOpen]);
4429
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [settings.imageSketch && settings.imageEditing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
4451
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [settings.imageSketch && settings.imageEditing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip, {
4430
4452
  label: t("sketch"),
4431
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
4453
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
4432
4454
  variant: "toolbar",
4433
4455
  size: "sm",
4434
4456
  "aria-label": t("sketch"),
@@ -4502,6 +4524,26 @@ window.__ModuleLoader__.load({
4502
4524
  //#endregion
4503
4525
  //#region src/client-locales.js
4504
4526
  const zh = {
4527
+ runtimeIncompatible: "检测到不兼容的 Codex 子任务组件,请卸载后重启,再安装受支持版本。",
4528
+ runtimeManagedElsewhere: "此组件由宿主或其他依赖管理,请在 DSH 插件管理中查看;这里不能直接卸载。",
4529
+ runtimeLoading: "正在检查组件…",
4530
+ runtimeRestart: "组件已更新,请重启 DSH 后使用。",
4531
+ runtime_installing: "正在通过 DSH 安装组件…",
4532
+ runtime_removing: "正在通过 DSH 卸载组件…",
4533
+ runtime_applying: "正在应用安装结果…",
4534
+ runtimeInstall: "安装组件",
4535
+ runtimeRemove: "卸载组件",
4536
+ runtimeCancel: "取消安装",
4537
+ runtimeKeep: "保留",
4538
+ runtimeConfirmRemove: "确认卸载",
4539
+ runtimeRefresh: "刷新状态",
4540
+ runtimeActive: "有 Codex 子任务正在运行,结束后才能安装或卸载。",
4541
+ runtimeConfirm: "卸载后将切回 DSH 子任务。普通订阅聊天、生图、登录和草稿保留。确定卸载可选组件?",
4542
+ runtimeFailed: "操作未完成。请刷新状态后重试;详细原因可在 DSH 插件管理中查看。",
4543
+ runtimeBuildBlocked: "DSH 拦截了依赖安装脚本。请在官方插件管理中审核后再安装。",
4544
+ runtimeCancelled: "安装已取消,可重新安装。",
4545
+ runtimeUnavailable: "当前宿主未提供组件管理接口,请更新 DSH 或按说明手动管理。",
4546
+ runtimeInstallHint: "此处只管理官方 Codex 子任务组件,由 DSH 负责安装与卸载。安装后不会自动开启子任务;仅切回 DSH 不会卸载组件。",
4505
4547
  compactionTitle: "云端压缩",
4506
4548
  compaction_dsh: "关闭",
4507
4549
  compaction_cloud: "开启",
@@ -4514,6 +4556,11 @@ window.__ModuleLoader__.load({
4514
4556
  connectionHint: "默认 SSE。WebSocket 实验性复用连接与上下文传输;连接失败可回退 SSE。下次请求生效,不扩大上下文容量。",
4515
4557
  subagentBackendHint: "Codex 复用订阅登录和工作区权限;默认继承当前订阅模型。开启 DSH 子任务模型选择并新建会话后,可在聊天中指定允许的订阅模型与推理档位;非订阅会话需指定。共享上下文子任务仍用 DSH。",
4516
4558
  subagentBackendUnavailable: "当前宿主缺少子代理服务,请更新 DSH。",
4559
+ subagentRuntimeMissing: "尚未准备 Codex 子任务运行时,仅影响此选项。普通订阅对话无需安装。",
4560
+ subagentRuntimePrepare: "准备方法(含离线说明)",
4561
+ subagentRuntimeInstalled: "已检测到 Codex 子任务组件;启动时会检查可执行文件。",
4562
+ subagentRuntimeManage: "安装、卸载与存储",
4563
+ subagentRuntimeCacheHint: "卸载后安装缓存可能仍保留,由 DSH 或 Portable 统一管理。此处不会删除登录、草稿或生成图片。",
4517
4564
  sketchRecovered: "已恢复未保存草稿",
4518
4565
  sketchRecoveryFailed: "恢复检查点保存失败,请手动保存或导出草稿。",
4519
4566
  sketchStorageBlocked: "草稿正被其他窗口占用,请关闭其他草图窗口后重试。",
@@ -4930,6 +4977,26 @@ window.__ModuleLoader__.load({
4930
4977
  imageRemoveAnnotation: "删除标注"
4931
4978
  };
4932
4979
  const en = {
4980
+ runtimeIncompatible: "An incompatible Codex subtask component was found. Uninstall it, restart DSH, then install the supported version.",
4981
+ runtimeManagedElsewhere: "This component is managed by the host or another dependency. Check DSH plugin management; it cannot be removed here.",
4982
+ runtimeLoading: "Checking component…",
4983
+ runtimeRestart: "Component changed. Restart DSH before using it.",
4984
+ runtime_installing: "Installing through DSH…",
4985
+ runtime_removing: "Uninstalling through DSH…",
4986
+ runtime_applying: "Applying installation…",
4987
+ runtimeInstall: "Install component",
4988
+ runtimeRemove: "Uninstall component",
4989
+ runtimeCancel: "Cancel installation",
4990
+ runtimeKeep: "Keep",
4991
+ runtimeConfirmRemove: "Confirm uninstall",
4992
+ runtimeRefresh: "Refresh status",
4993
+ runtimeActive: "Codex subtasks are running. Wait for them to finish before installing or uninstalling.",
4994
+ runtimeConfirm: "Uninstalling switches subtasks back to DSH. Subscription chat, images, sign-in and sketches stay available. Uninstall this optional component?",
4995
+ runtimeFailed: "The operation did not complete. Refresh and retry; see DSH plugin management for details.",
4996
+ runtimeBuildBlocked: "DSH blocked dependency build scripts. Review them in the official plugin manager before installing.",
4997
+ runtimeCancelled: "Installation cancelled. You can try again.",
4998
+ runtimeUnavailable: "This host has no component management interface. Update DSH or use the manual instructions.",
4999
+ runtimeInstallHint: "DSH installs and removes the official Codex subtask component here. Installation does not enable subtasks automatically. Switching to DSH alone does not uninstall it.",
4933
5000
  compactionTitle: "Cloud compaction",
4934
5001
  compaction_dsh: "Off",
4935
5002
  compaction_cloud: "On",
@@ -4942,6 +5009,11 @@ window.__ModuleLoader__.load({
4942
5009
  connectionHint: "SSE by default. Experimental WebSocket reuses connections and context transfers and can fall back to SSE on connection failure. Applies to the next request; context limits stay the same.",
4943
5010
  subagentBackendHint: "Codex reuses subscription login and workspace permissions, inheriting the current subscription model by default. Enable DSH subtask model selection and start a new session to request an allowed subscription model and reasoning effort in chat; other model sessions require an explicit selection. Shared-context subtasks stay in DSH.",
4944
5011
  subagentBackendUnavailable: "Subagent services are unavailable. Update DSH to use this option.",
5012
+ subagentRuntimeMissing: "Codex subtask runtime is not prepared. Subscription chat does not require it.",
5013
+ subagentRuntimePrepare: "Setup and offline instructions",
5014
+ subagentRuntimeInstalled: "Codex subtask component detected; its executable is checked on startup.",
5015
+ subagentRuntimeManage: "Install, uninstall and storage",
5016
+ subagentRuntimeCacheHint: "Package caches may remain after uninstalling. DSH or Portable manages them centrally. Sign-in, sketches and generated images are not deleted here.",
4945
5017
  sketchRecovered: "Unsaved sketch recovered",
4946
5018
  sketchRecoveryFailed: "Recovery checkpoint failed. Save or export your draft.",
4947
5019
  sketchStorageBlocked: "Draft storage is in use. Close other sketch windows and retry.",
@@ -5576,6 +5648,14 @@ window.__ModuleLoader__.load({
5576
5648
  @container (max-width:480px){.codexSubscriptionAccountRow,.codexSubscriptionSectionHead{align-items:flex-start;flex-direction:column}
5577
5649
  .codexSubscriptionActions{width:100%}
5578
5650
  .codexSubscriptionSearchChoices{grid-template-columns:1fr}}
5651
+ .codexSubscriptionRuntime{font-size:12px;line-height:1.6;margin-top:12px;color:var(--dsw-alias-label-secondary)}
5652
+ .codexSubscriptionRuntime summary{cursor:pointer;width:fit-content;color:var(--dsw-alias-label-primary);border-radius:6px}
5653
+ .codexSubscriptionRuntime summary:focus-visible{outline:2px solid currentColor;outline-offset:4px}
5654
+ .codexSubscriptionRuntime p{margin:8px 0}
5655
+ .codexSubscriptionRuntime .codexSubscriptionPreference{flex-wrap:wrap;align-items:flex-start}
5656
+ .codexSubscriptionRuntime .codexSubscriptionPreference>span{flex:1;min-width:180px;font-size:12px;color:var(--dsw-alias-label-secondary)}
5657
+ .codexSubscriptionRuntime button{flex-shrink:0;white-space:nowrap}
5658
+ .codexSubscriptionRuntime code{display:block;overflow-wrap:anywhere;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;user-select:text}
5579
5659
  @media(max-width:640px){.codexSubscriptionCard{padding:14px}}
5580
5660
  `;
5581
5661
  //#endregion
@@ -5943,7 +6023,7 @@ window.__ModuleLoader__.load({
5943
6023
  invoke();
5944
6024
  },
5945
6025
  children: [
5946
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, {}),
6026
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconEditOutline16, {}),
5947
6027
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5948
6028
  className: "dcsiv-label",
5949
6029
  children: label ?? t("imageEdit")
@@ -5997,7 +6077,7 @@ window.__ModuleLoader__.load({
5997
6077
  onClick: () => {
5998
6078
  invoke();
5999
6079
  },
6000
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDownloadOutline16, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6080
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconDownloadOutline16, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6001
6081
  className: "dcsiv-label",
6002
6082
  children: state === "pending" ? `${label} ${progress}% · ${t("cancel")}` : label
6003
6083
  })]
@@ -6186,7 +6266,7 @@ window.__ModuleLoader__.load({
6186
6266
  resetGesture();
6187
6267
  setAnnotating((value) => !value);
6188
6268
  },
6189
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconEditOutline16, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6269
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconEditOutline16, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6190
6270
  className: "dcsiv-label",
6191
6271
  children: annotating ? t("imageAnnotateCancel") : t("imageAnnotate")
6192
6272
  })]
@@ -6214,7 +6294,7 @@ window.__ModuleLoader__.load({
6214
6294
  className: "dcsiv-button",
6215
6295
  "aria-label": t("imageFit"),
6216
6296
  onClick: fit,
6217
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFullscreenOutline16, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6297
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconFullscreenOutline16, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6218
6298
  className: "dcsiv-label",
6219
6299
  children: t("imageFit")
6220
6300
  })]
@@ -6233,7 +6313,7 @@ window.__ModuleLoader__.load({
6233
6313
  className: "dcsiv-download",
6234
6314
  href: item.src,
6235
6315
  download: downloadName(item.name),
6236
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDownloadOutline16, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6316
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconDownloadOutline16, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6237
6317
  className: "dcsiv-label",
6238
6318
  children: t("imageDownload")
6239
6319
  })]
@@ -6258,7 +6338,7 @@ window.__ModuleLoader__.load({
6258
6338
  className: "dcsiv-close-floating",
6259
6339
  "aria-label": t("imageClosePreview"),
6260
6340
  onClick: () => service.close(),
6261
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutline16, {})
6341
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCloseOutline16, {})
6262
6342
  }),
6263
6343
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6264
6344
  className: "dcsiv-workspace",
@@ -6348,7 +6428,7 @@ window.__ModuleLoader__.load({
6348
6428
  setAnnotations((current) => current.filter((entry) => entry.id !== annotation.id));
6349
6429
  setSelected(void 0);
6350
6430
  },
6351
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutline16, {})
6431
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCloseOutline16, {})
6352
6432
  })
6353
6433
  ]
6354
6434
  }) : null]
@@ -6362,7 +6442,7 @@ window.__ModuleLoader__.load({
6362
6442
  event.stopPropagation();
6363
6443
  setIndex((value) => (value - 1 + request.items.length) % request.items.length);
6364
6444
  },
6365
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronLeftOutline14, {})
6445
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronLeftOutline14, {})
6366
6446
  }),
6367
6447
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6368
6448
  type: "button",
@@ -6372,7 +6452,7 @@ window.__ModuleLoader__.load({
6372
6452
  event.stopPropagation();
6373
6453
  setIndex((value) => (value + 1) % request.items.length);
6374
6454
  },
6375
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutline14, {})
6455
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronRightOutline14, {})
6376
6456
  }),
6377
6457
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
6378
6458
  className: "dcsiv-counter",
@@ -6396,7 +6476,7 @@ window.__ModuleLoader__.load({
6396
6476
  onClick: () => {
6397
6477
  copyNotes();
6398
6478
  },
6399
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCopyOutline16, {}), copied ? t("imageCopied") : t("imageCopyNotes")]
6479
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCopyOutline16, {}), copied ? t("imageCopied") : t("imageCopyNotes")]
6400
6480
  }) : null]
6401
6481
  })
6402
6482
  ]
@@ -6605,9 +6685,6 @@ window.__ModuleLoader__.load({
6605
6685
  limitId: limit.id
6606
6686
  }))).filter((window) => Number.isFinite(window.remainingPercent) && window.remainingPercent >= 0 && window.remainingPercent <= (mode === "custom" ? readCapabilitySettings(thresholds)[window.windowSeconds > 0 && window.windowSeconds <= 6 * 3600 ? "quotaShortThreshold" : "quotaLongThreshold"] : mode === "early" && window.windowSeconds > 0 && window.windowSeconds <= 6 * 3600 ? 50 : 20) && (!Number.isFinite(window.resetsAt) || window.resetsAt * 1e3 > now)).sort((a, b) => a.remainingPercent - b.remainingPercent)[0];
6607
6687
  }
6608
- //#endregion
6609
- //#region src/settings-contract.js
6610
- const SETTINGS_NAMESPACE = "codex-subscription";
6611
6688
  const QUICK_QUOTA_MODE_FIELD = "quickQuotaMode";
6612
6689
  const LEGACY_QUICK_QUOTA_FIELD = "quickQuotaVisible";
6613
6690
  const QUICK_QUOTA_MODE_PERCENT = "percent";
@@ -6712,6 +6789,7 @@ window.__ModuleLoader__.load({
6712
6789
  let modelRefreshStarted = false;
6713
6790
  let disposed = false;
6714
6791
  let subagentBackendAvailable = false;
6792
+ let subagentRuntimeInstalled = false;
6715
6793
  const sameModels = (left, right) => left.length === right.length && left.every((model, index) => JSON.stringify(model) === JSON.stringify(right[index]));
6716
6794
  const nativeSnapshot = () => scope.getSnapshot();
6717
6795
  const read = () => {
@@ -6729,6 +6807,7 @@ window.__ModuleLoader__.load({
6729
6807
  compactionMode: value?.compactionMode === "cloud" ? "cloud" : "dsh",
6730
6808
  subagentBackend: value?.subagentBackend === "codex" ? "codex" : "dsh",
6731
6809
  subagentBackendAvailable,
6810
+ subagentRuntimeInstalled,
6732
6811
  quickQuotaMode: normalizeQuickQuotaMode(value?.[QUICK_QUOTA_MODE_FIELD], value?.[LEGACY_QUICK_QUOTA_FIELD]),
6733
6812
  searchProvider: normalizeSearchProvider(value?.[SEARCH_PROVIDER_FIELD]),
6734
6813
  speedMode: normalizeSpeedMode(value?.[SPEED_MODE_FIELD]),
@@ -6763,6 +6842,7 @@ window.__ModuleLoader__.load({
6763
6842
  });
6764
6843
  const acceptFallback = (value) => {
6765
6844
  subagentBackendAvailable = value?.subagentBackendAvailable === true;
6845
+ subagentRuntimeInstalled = value?.subagentRuntimeInstalled === true;
6766
6846
  if (!modelRefreshStarted) {
6767
6847
  contextModels = Array.isArray(value?.contextModels) ? value.contextModels : [];
6768
6848
  verbosityModels = Array.isArray(value?.verbosityModels) ? value.verbosityModels : [];
@@ -6800,6 +6880,7 @@ window.__ModuleLoader__.load({
6800
6880
  const value = unwrap(await rpc.call(CHANNEL, "preferences/status", {}));
6801
6881
  if (current !== generation || disposed) return;
6802
6882
  subagentBackendAvailable = value?.subagentBackendAvailable === true;
6883
+ subagentRuntimeInstalled = value?.subagentRuntimeInstalled === true;
6803
6884
  if (nativeSnapshot().status === "ready") {
6804
6885
  if (!modelRefreshStarted) {
6805
6886
  contextModels = Array.isArray(value?.contextModels) ? value.contextModels : [];
@@ -7172,12 +7253,19 @@ window.__ModuleLoader__.load({
7172
7253
  //#region src/sidebar-quota.js
7173
7254
  const isDisplayableWindow = (window) => Number.isFinite(window?.remainingPercent) && window.remainingPercent >= 0 && window.remainingPercent <= 100 && Number.isFinite(window?.windowSeconds) && window.windowSeconds > 0;
7174
7255
  const normalized = (value) => String(value ?? "").toLocaleLowerCase("en-US").replaceAll(/[^a-z0-9]+/gu, "-");
7175
- const limitMatchesModel = (limit, model) => {
7256
+ const exactModelLimit = (limit, model) => {
7257
+ const id = normalized(model);
7258
+ return id.length > 0 && [limit?.id, limit?.name].some((value) => typeof value === "string" && normalized(value) === id);
7259
+ };
7260
+ const limitMatchesModel = (limit, model, hasExactLimit) => {
7261
+ if (hasExactLimit) return exactModelLimit(limit, model);
7262
+ if (normalized(model) === "gpt-reserve") return false;
7176
7263
  if (/\bspark\b/u.test(normalized(model))) return /\bspark\b/u.test(normalized(`${limit?.id ?? ""} ${limit?.name ?? ""}`));
7177
7264
  return limit?.id === "codex";
7178
7265
  };
7179
7266
  function selectModelQuotaWindows(usage, model) {
7180
- return (Array.isArray(usage?.rateLimits) ? usage.rateLimits.filter((limit) => limitMatchesModel(limit, model) && Array.isArray(limit.windows)).flatMap((limit) => limit.windows).filter(isDisplayableWindow) : []).map((selected) => ({
7267
+ const hasExactLimit = Array.isArray(usage?.rateLimits) && usage.rateLimits.some((limit) => exactModelLimit(limit, model));
7268
+ return (Array.isArray(usage?.rateLimits) ? usage.rateLimits.filter((limit) => limitMatchesModel(limit, model, hasExactLimit) && Array.isArray(limit.windows)).flatMap((limit) => limit.windows).filter(isDisplayableWindow) : []).map((selected) => ({
7181
7269
  remainingPercent: selected.remainingPercent,
7182
7270
  windowSeconds: selected.windowSeconds,
7183
7271
  ...Number.isSafeInteger(selected.resetsAt) ? { resetsAt: selected.resetsAt } : {},
@@ -7186,7 +7274,7 @@ window.__ModuleLoader__.load({
7186
7274
  }
7187
7275
  //#endregion
7188
7276
  //#region src/version.js
7189
- const PACKAGE_VERSION = "2.1.3-beta.1";
7277
+ const PACKAGE_VERSION = "2.1.4";
7190
7278
  //#endregion
7191
7279
  //#region src/client-recovery.js
7192
7280
  async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = 1e4) {
@@ -7290,7 +7378,7 @@ window.__ModuleLoader__.load({
7290
7378
  (0, react.useEffect)(() => () => clearTimeout(dismissTimer.current), []);
7291
7379
  const id = (0, react.useId)();
7292
7380
  const visible = open && quotaEnabled && !!quotas?.length;
7293
- const position = (0, _deepseek_ai_dsh_client_ui_primitives.useAnchoredPosition)({
7381
+ const position = useAnchoredPosition({
7294
7382
  open: visible,
7295
7383
  anchorRef: trigger,
7296
7384
  panelRef: panel,
@@ -7298,7 +7386,7 @@ window.__ModuleLoader__.load({
7298
7386
  gap: 8,
7299
7387
  margin: 12
7300
7388
  });
7301
- (0, _deepseek_ai_dsh_client_ui_primitives.useDismissOnOutsidePointer)(trigger, visible, dismiss, panel);
7389
+ useDismissOnOutsidePointer(trigger, visible, dismiss, panel);
7302
7390
  (0, react.useEffect)(() => {
7303
7391
  setOpen(false);
7304
7392
  }, [current?.model, quotaEnabled]);
@@ -7571,7 +7659,7 @@ window.__ModuleLoader__.load({
7571
7659
  })]
7572
7660
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7573
7661
  className: "codexModelSelectCheck",
7574
- children: selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutline16, {}) : null
7662
+ children: selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheckOutline16, {}) : null
7575
7663
  })]
7576
7664
  }, key);
7577
7665
  const cell = (target, label, value) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -7591,7 +7679,7 @@ window.__ModuleLoader__.load({
7591
7679
  className: "codexModelSelectCellValue",
7592
7680
  children: value
7593
7681
  }),
7594
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutline14, { className: "codexModelSelectCellChevron" })
7682
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronRightOutline14, { className: "codexModelSelectCellChevron" })
7595
7683
  ]
7596
7684
  });
7597
7685
  let submenu = null;
@@ -7731,7 +7819,7 @@ window.__ModuleLoader__.load({
7731
7819
  className: "codexModelSelectEffort",
7732
7820
  children: effortLabel
7733
7821
  }),
7734
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: "codexModelSelectChevron" })
7822
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutline14, { className: "codexModelSelectChevron" })
7735
7823
  ]
7736
7824
  }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7737
7825
  className: "codexModelSelectMenu",
@@ -7793,7 +7881,7 @@ window.__ModuleLoader__.load({
7793
7881
  className: "codexSubscriptionPreferenceHint",
7794
7882
  children: hint
7795
7883
  }) : null]
7796
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
7884
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Menu, {
7797
7885
  open: open && !disabled,
7798
7886
  items,
7799
7887
  selectedId: value,
@@ -7815,7 +7903,7 @@ window.__ModuleLoader__.load({
7815
7903
  "aria-expanded": open && !disabled,
7816
7904
  disabled,
7817
7905
  onClick: () => setOpen((current) => !current),
7818
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: text }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, {})]
7906
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: text }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutline14, {})]
7819
7907
  })
7820
7908
  })]
7821
7909
  });
@@ -7836,7 +7924,7 @@ window.__ModuleLoader__.load({
7836
7924
  className: "codexSubscriptionPreferenceHint",
7837
7925
  children: active ? modelLabel(snapshot.imageModel) : t("imageCapability_off")
7838
7926
  }),
7839
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, {})
7927
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutline14, {})
7840
7928
  ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7841
7929
  className: "codexSubscriptionSettingsDisclosureBody",
7842
7930
  children: [
@@ -7975,7 +8063,7 @@ window.__ModuleLoader__.load({
7975
8063
  className: "codexSubscriptionPreferenceCopy",
7976
8064
  children: [
7977
8065
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("searchDomains") }),
7978
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
8066
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
7979
8067
  "aria-label": t("searchDomains"),
7980
8068
  "aria-invalid": invalid,
7981
8069
  value: domains,
@@ -8020,7 +8108,7 @@ window.__ModuleLoader__.load({
8020
8108
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
8021
8109
  t(field),
8022
8110
  " ",
8023
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
8111
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
8024
8112
  type: "number",
8025
8113
  min: 1,
8026
8114
  max: 100,
@@ -8043,6 +8131,162 @@ window.__ModuleLoader__.load({
8043
8131
  ] });
8044
8132
  }
8045
8133
  //#endregion
8134
+ //#region src/client-runtime-management.jsx
8135
+ function RuntimeManagement({ rpc, preference, t }) {
8136
+ const [state, setState] = (0, react.useState)();
8137
+ const [error, setError] = (0, react.useState)(false);
8138
+ const [sending, setSending] = (0, react.useState)(false);
8139
+ const [confirm, setConfirm] = (0, react.useState)(false);
8140
+ const alive = (0, react.useRef)(false);
8141
+ const busy = [
8142
+ "installing",
8143
+ "removing",
8144
+ "applying"
8145
+ ].includes(state?.phase);
8146
+ const read = async () => {
8147
+ try {
8148
+ const result = await rpc.call(CHANNEL, "runtime/status", {});
8149
+ if (!alive.current) return;
8150
+ if (!result.ok) {
8151
+ setError(true);
8152
+ return;
8153
+ }
8154
+ setState(result.value);
8155
+ setError(false);
8156
+ } catch {
8157
+ if (alive.current) setError(true);
8158
+ }
8159
+ };
8160
+ (0, react.useEffect)(() => {
8161
+ alive.current = true;
8162
+ read();
8163
+ return () => {
8164
+ alive.current = false;
8165
+ };
8166
+ }, [rpc]);
8167
+ (0, react.useEffect)(() => {
8168
+ if (!busy) return;
8169
+ let stopped = false, timer;
8170
+ const poll = async () => {
8171
+ await read();
8172
+ if (!stopped) timer = setTimeout(poll, 1500);
8173
+ };
8174
+ timer = setTimeout(poll, 1500);
8175
+ return () => {
8176
+ stopped = true;
8177
+ clearTimeout(timer);
8178
+ };
8179
+ }, [busy, rpc]);
8180
+ const act = async (action) => {
8181
+ if (sending) return;
8182
+ setSending(true);
8183
+ setError(false);
8184
+ setConfirm(false);
8185
+ try {
8186
+ const result = await rpc.call(CHANNEL, `runtime/${action}`, {});
8187
+ if (!alive.current) return;
8188
+ if (!result.ok) {
8189
+ await read();
8190
+ if (alive.current) setError(true);
8191
+ return;
8192
+ }
8193
+ setState(result.value);
8194
+ if (action === "remove") preference.load();
8195
+ } catch {
8196
+ if (alive.current) setError(true);
8197
+ } finally {
8198
+ if (alive.current) setSending(false);
8199
+ }
8200
+ };
8201
+ (0, react.useEffect)(() => {
8202
+ if (state?.phase === "done") preference.load();
8203
+ }, [state?.phase]);
8204
+ const locked = sending || busy || state?.restartRequired || state?.active > 0;
8205
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8206
+ className: "codexSubscriptionRuntime",
8207
+ children: [
8208
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8209
+ className: "codexSubscriptionPreference",
8210
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8211
+ role: "status",
8212
+ children: t(!state ? "runtimeLoading" : state.restartRequired ? "runtimeRestart" : busy ? `runtime_${state.phase}` : state.installed ? "subagentRuntimeInstalled" : state.present ? "runtimeIncompatible" : "subagentRuntimeMissing")
8213
+ }), state?.available ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8214
+ type: "button",
8215
+ variant: "outline",
8216
+ disabled: locked || state.present && !state.removable,
8217
+ onClick: () => state.present ? setConfirm(true) : void act("install"),
8218
+ children: t(state.present ? "runtimeRemove" : "runtimeInstall")
8219
+ }) : null]
8220
+ }),
8221
+ state?.present && state.available && !state.removable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("runtimeManagedElsewhere") }) : null,
8222
+ state?.active > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("runtimeActive") }) : null,
8223
+ busy && state.phase === "installing" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8224
+ type: "button",
8225
+ variant: "outline",
8226
+ disabled: sending,
8227
+ onClick: () => {
8228
+ act("cancel");
8229
+ },
8230
+ children: t("runtimeCancel")
8231
+ }) : null,
8232
+ confirm ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8233
+ role: "group",
8234
+ "aria-label": t("runtimeRemove"),
8235
+ children: [
8236
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("runtimeConfirm") }),
8237
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8238
+ type: "button",
8239
+ variant: "outline",
8240
+ onClick: () => setConfirm(false),
8241
+ children: t("runtimeKeep")
8242
+ }),
8243
+ " ",
8244
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8245
+ type: "button",
8246
+ variant: "outline",
8247
+ disabled: locked,
8248
+ onClick: () => {
8249
+ act("remove");
8250
+ },
8251
+ children: t("runtimeConfirmRemove")
8252
+ })
8253
+ ]
8254
+ }) : null,
8255
+ error || state?.phase === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8256
+ role: "alert",
8257
+ children: t(state?.error === "build-blocked" ? "runtimeBuildBlocked" : "runtimeFailed")
8258
+ }) : null,
8259
+ state?.phase === "cancelled" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8260
+ role: "status",
8261
+ children: t("runtimeCancelled")
8262
+ }) : null,
8263
+ !busy ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8264
+ type: "button",
8265
+ variant: "outline",
8266
+ disabled: sending,
8267
+ onClick: () => {
8268
+ read();
8269
+ preference.load();
8270
+ },
8271
+ children: t("runtimeRefresh")
8272
+ }) : null,
8273
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [
8274
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("subagentRuntimeManage") }),
8275
+ state && !state.available ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("runtimeUnavailable") }) : null,
8276
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("runtimeInstallHint") }),
8277
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: "@deepseek-ai/dsh-subagent-codex@0.1.5-rc.2" }),
8278
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("subagentRuntimeCacheHint") }),
8279
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
8280
+ href: "https://github.com/WSL043/dsh-codex-subscription/blob/main/README.md#codex-subtask-runtime",
8281
+ target: "_blank",
8282
+ rel: "noreferrer",
8283
+ children: t("subagentRuntimePrepare")
8284
+ })
8285
+ ] })
8286
+ ]
8287
+ });
8288
+ }
8289
+ //#endregion
8046
8290
  //#region src/context-draft-state.js
8047
8291
  const hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value ?? {}, key);
8048
8292
  /**
@@ -8222,7 +8466,7 @@ window.__ModuleLoader__.load({
8222
8466
  className: "codexSubscriptionContextHint",
8223
8467
  children: hint
8224
8468
  })]
8225
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
8469
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Menu, {
8226
8470
  open: menuOpen,
8227
8471
  items: contextModeItems,
8228
8472
  selectedId: snapshot.contextMode,
@@ -8243,7 +8487,7 @@ window.__ModuleLoader__.load({
8243
8487
  "aria-expanded": menuOpen,
8244
8488
  disabled: !writable,
8245
8489
  onClick: () => setMenuOpen((value) => !value),
8246
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedMode }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, {})]
8490
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectedMode }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutline14, {})]
8247
8491
  })
8248
8492
  })]
8249
8493
  }),
@@ -8257,7 +8501,7 @@ window.__ModuleLoader__.load({
8257
8501
  minimum: String(Math.min(MIN_CUSTOM_CONTEXT_WINDOW, model.maximum)),
8258
8502
  value: String(model.maximum)
8259
8503
  }) })]
8260
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
8504
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
8261
8505
  "aria-label": `${model.label} ${t("contextTokens")}`,
8262
8506
  className: "codexSubscriptionContextInput",
8263
8507
  type: "number",
@@ -8295,7 +8539,7 @@ window.__ModuleLoader__.load({
8295
8539
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8296
8540
  className: "codexSubscriptionPreferenceHint",
8297
8541
  children: t(snapshot.catalogStatus?.source === "online" ? "catalogOnline" : "catalogFallback")
8298
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
8542
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8299
8543
  type: "button",
8300
8544
  variant: "outline",
8301
8545
  disabled: snapshot.modelsLoading,
@@ -8314,7 +8558,7 @@ window.__ModuleLoader__.load({
8314
8558
  ]
8315
8559
  });
8316
8560
  }
8317
- function PreferencesCard({ preference, t, section = "display" }) {
8561
+ function PreferencesCard({ preference, rpc, t, section = "display" }) {
8318
8562
  const snapshot = usePreferenceSnapshot(preference);
8319
8563
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8320
8564
  className: section === "advanced" ? "codexSubscriptionAdvancedPreferences" : "codexSubscriptionCard codexSubscriptionPreferencesCard",
@@ -8411,10 +8655,10 @@ window.__ModuleLoader__.load({
8411
8655
  })]
8412
8656
  })
8413
8657
  }),
8414
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
8658
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
8415
8659
  className: "codexSubscriptionCard codexSubscriptionPreferencesCard",
8416
8660
  "aria-label": t("subagentBackendTitle"),
8417
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8661
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8418
8662
  className: "codexSubscriptionPreference",
8419
8663
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8420
8664
  className: "codexSubscriptionPreferenceCopy",
@@ -8440,14 +8684,18 @@ window.__ModuleLoader__.load({
8440
8684
  type: "radio",
8441
8685
  name: "codex-subagent-backend",
8442
8686
  checked: snapshot.subagentBackend === value,
8443
- disabled: !snapshot.writable || !snapshot.subagentBackendAvailable,
8687
+ disabled: !snapshot.writable || !snapshot.subagentBackendAvailable || value === "codex" && !snapshot.subagentRuntimeInstalled,
8444
8688
  onChange: () => {
8445
8689
  preference.set({ subagentBackend: value });
8446
8690
  }
8447
8691
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t(`subagentBackend_${value}`) })]
8448
8692
  }, value))
8449
8693
  })]
8450
- })
8694
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuntimeManagement, {
8695
+ rpc,
8696
+ preference,
8697
+ t
8698
+ })]
8451
8699
  })
8452
8700
  ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuickQuotaPreference, {
8453
8701
  preference,
@@ -8462,7 +8710,7 @@ window.__ModuleLoader__.load({
8462
8710
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8463
8711
  className: "codexSubscriptionError",
8464
8712
  children: t("preferenceFailed")
8465
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
8713
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8466
8714
  type: "button",
8467
8715
  variant: "outline",
8468
8716
  onClick: () => {
@@ -8702,7 +8950,7 @@ window.__ModuleLoader__.load({
8702
8950
  }), accountReady ? signedIn ? t("connected") : t("disconnected") : t("accountLoading")]
8703
8951
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8704
8952
  className: "codexSubscriptionActions",
8705
- children: signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
8953
+ children: signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8706
8954
  type: "button",
8707
8955
  variant: "outline",
8708
8956
  disabled: busy || loginVisible,
@@ -8711,19 +8959,19 @@ window.__ModuleLoader__.load({
8711
8959
  setAdding(true);
8712
8960
  },
8713
8961
  children: t("addAccount")
8714
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
8962
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8715
8963
  type: "button",
8716
8964
  variant: "outline",
8717
8965
  disabled: busy || loginVisible,
8718
8966
  onClick: logout,
8719
8967
  children: t("signOutAll")
8720
- })] }) : accountReady && (flow === void 0 || ["failed", "cancelled"].includes(flow.phase)) ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
8968
+ })] }) : accountReady && (flow === void 0 || ["failed", "cancelled"].includes(flow.phase)) ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8721
8969
  type: "button",
8722
8970
  variant: "primary",
8723
8971
  disabled: busy,
8724
8972
  onClick: () => begin("browser"),
8725
8973
  children: t("browserLogin")
8726
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
8974
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8727
8975
  type: "button",
8728
8976
  variant: "outline",
8729
8977
  disabled: busy,
@@ -8746,21 +8994,21 @@ window.__ModuleLoader__.load({
8746
8994
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8747
8995
  className: "codexSubscriptionActions",
8748
8996
  children: [
8749
- candidate.active ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
8997
+ candidate.active ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8750
8998
  type: "button",
8751
8999
  variant: "outline",
8752
9000
  disabled: busy || loginVisible,
8753
9001
  onClick: () => selectAccount(candidate.id),
8754
9002
  children: t("switchAccount")
8755
9003
  }),
8756
- accounts.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9004
+ accounts.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8757
9005
  type: "button",
8758
9006
  variant: "outline",
8759
9007
  disabled: busy || loginVisible,
8760
9008
  onClick: () => removeAccount(candidate.id),
8761
9009
  children: removeId === candidate.id ? t("removeConfirm") : t("removeAccount")
8762
9010
  }) : null,
8763
- removeId === candidate.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9011
+ removeId === candidate.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8764
9012
  type: "button",
8765
9013
  variant: "outline",
8766
9014
  disabled: busy,
@@ -8776,21 +9024,21 @@ window.__ModuleLoader__.load({
8776
9024
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8777
9025
  className: "codexSubscriptionActions",
8778
9026
  children: [
8779
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9027
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8780
9028
  type: "button",
8781
9029
  variant: "primary",
8782
9030
  disabled: busy,
8783
9031
  onClick: () => begin("browser"),
8784
9032
  children: t("browserLogin")
8785
9033
  }),
8786
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9034
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8787
9035
  type: "button",
8788
9036
  variant: "outline",
8789
9037
  disabled: busy,
8790
9038
  onClick: () => begin("device_code"),
8791
9039
  children: t("deviceLogin")
8792
9040
  }),
8793
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9041
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8794
9042
  type: "button",
8795
9043
  variant: "outline",
8796
9044
  disabled: busy,
@@ -8815,7 +9063,7 @@ window.__ModuleLoader__.load({
8815
9063
  children: t("openLogin")
8816
9064
  }),
8817
9065
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("waiting") }),
8818
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9066
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8819
9067
  type: "button",
8820
9068
  variant: "outline",
8821
9069
  disabled: busy,
@@ -8829,7 +9077,7 @@ window.__ModuleLoader__.load({
8829
9077
  onSubmit: submit,
8830
9078
  children: [
8831
9079
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("manualCode") }),
8832
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
9080
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
8833
9081
  className: "codexSubscriptionInput",
8834
9082
  value: manualCode,
8835
9083
  onChange: (event) => setManualCode(event.currentTarget.value),
@@ -8838,12 +9086,12 @@ window.__ModuleLoader__.load({
8838
9086
  }),
8839
9087
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8840
9088
  className: "codexSubscriptionActions",
8841
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9089
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8842
9090
  type: "submit",
8843
9091
  variant: "primary",
8844
9092
  disabled: busy || manualCode.trim() === "",
8845
9093
  children: t("submit")
8846
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9094
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8847
9095
  type: "button",
8848
9096
  variant: "outline",
8849
9097
  disabled: busy,
@@ -8863,7 +9111,7 @@ window.__ModuleLoader__.load({
8863
9111
  rel: "noreferrer",
8864
9112
  children: t("openLogin")
8865
9113
  }),
8866
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9114
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8867
9115
  type: "button",
8868
9116
  variant: "outline",
8869
9117
  disabled: busy,
@@ -8915,7 +9163,7 @@ window.__ModuleLoader__.load({
8915
9163
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8916
9164
  className: "codexSubscriptionActions",
8917
9165
  children: [
8918
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9166
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8919
9167
  type: "button",
8920
9168
  variant: "outline",
8921
9169
  disabled: retrying || busy,
@@ -8925,14 +9173,14 @@ window.__ModuleLoader__.load({
8925
9173
  },
8926
9174
  children: retrying ? t("accountRetrying") : t("accountRetry")
8927
9175
  }),
8928
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9176
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8929
9177
  type: "button",
8930
9178
  variant: "outline",
8931
9179
  disabled: busy || retrying,
8932
9180
  onClick: () => void clear(),
8933
9181
  children: busy ? t("accountRetrying") : t(confirm ? "recoveryClearConfirm" : "recoveryClear")
8934
9182
  }),
8935
- confirm ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9183
+ confirm ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8936
9184
  type: "button",
8937
9185
  variant: "outline",
8938
9186
  disabled: busy,
@@ -8983,14 +9231,14 @@ window.__ModuleLoader__.load({
8983
9231
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8984
9232
  className: "codexSubscriptionActions",
8985
9233
  children: [
8986
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9234
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8987
9235
  type: "button",
8988
9236
  variant: "outline",
8989
9237
  disabled: busy,
8990
9238
  onClick: load,
8991
9239
  children: busy ? t("diagnosticsLoading") : t("diagnosticsLoad")
8992
9240
  }),
8993
- report === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9241
+ report === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
8994
9242
  type: "button",
8995
9243
  variant: "outline",
8996
9244
  onClick: copy,
@@ -9147,7 +9395,7 @@ window.__ModuleLoader__.load({
9147
9395
  })]
9148
9396
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9149
9397
  className: "codexSubscriptionActions",
9150
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9398
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
9151
9399
  className: "codexSubscriptionResetUse",
9152
9400
  type: "button",
9153
9401
  variant: "outline",
@@ -9193,13 +9441,13 @@ window.__ModuleLoader__.load({
9193
9441
  }) : null,
9194
9442
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9195
9443
  className: "codexSubscriptionActions",
9196
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9444
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
9197
9445
  type: "button",
9198
9446
  variant: "outline",
9199
9447
  disabled: resetBusy,
9200
9448
  onClick: cancelReset,
9201
9449
  children: t("cancel")
9202
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9450
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
9203
9451
  className: "codexSubscriptionResetFinal",
9204
9452
  type: "button",
9205
9453
  variant: "outline",
@@ -9292,7 +9540,7 @@ window.__ModuleLoader__.load({
9292
9540
  dateTime: fetchedAt.toISOString(),
9293
9541
  children: fill(t("usageUpdated"), { value: fetchedAt.toLocaleString() })
9294
9542
  })]
9295
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9543
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
9296
9544
  className: "codexSubscriptionRefresh",
9297
9545
  type: "button",
9298
9546
  variant: "outline",
@@ -9493,6 +9741,7 @@ window.__ModuleLoader__.load({
9493
9741
  preference
9494
9742
  }, resetKey),
9495
9743
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PreferencesCard, {
9744
+ rpc,
9496
9745
  preference,
9497
9746
  t
9498
9747
  })
@@ -9505,6 +9754,7 @@ window.__ModuleLoader__.load({
9505
9754
  hidden: tab !== "advanced",
9506
9755
  children: [
9507
9756
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PreferencesCard, {
9757
+ rpc,
9508
9758
  preference,
9509
9759
  t,
9510
9760
  section: "advanced"
@@ -9529,7 +9779,6 @@ window.__ModuleLoader__.load({
9529
9779
  "locale",
9530
9780
  "connection",
9531
9781
  "remote",
9532
- "settingsScope",
9533
9782
  "modelDirectories",
9534
9783
  "conversation",
9535
9784
  "uiConversation",
@@ -9549,7 +9798,10 @@ window.__ModuleLoader__.load({
9549
9798
  return () => tag.remove();
9550
9799
  }, "codex-subscription: style");
9551
9800
  const rpc = createSubscriptionRpcClient(ctx.get("connection").rpc);
9552
- const preference = createPreferenceController(ctx.settingsScope.bind({ namespace: SETTINGS_NAMESPACE }), rpc);
9801
+ const preference = createPreferenceController(ctx.get("settingsScope")?.bind({ namespace: "codex-subscription" }) ?? {
9802
+ getSnapshot: () => ({ status: "unavailable" }),
9803
+ subscribe: () => () => {}
9804
+ }, rpc);
9553
9805
  ctx.effect(() => {
9554
9806
  let previous = JSON.stringify(preference.getSnapshot(), (key, value) => key.startsWith("image") || key === "" ? value : void 0);
9555
9807
  return preference.subscribe(() => {