dsh-thinking-levels 3.4.1 → 3.4.3

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-thinking-levels",
3
- "version": "3.3.1",
3
+ "version": "3.4.3",
4
4
  "main": "./lib/index.js",
5
5
  "description": "thinking-level (reasoning_effort) control — auto-adjust per tool round, with optional manual lock and per-tool timing telemetry.",
6
6
  "engines": {
package/lib/client.js CHANGED
@@ -82,6 +82,9 @@ window.__ModuleLoader__.load({
82
82
  "model.panel.empty": "没有可用模型",
83
83
  "model.panel.window": "窗口",
84
84
  "model.panel.noTarget": "该模型没有可写的配置项",
85
+ "model.panel.unavailable": "当前会话的模型目录不可用",
86
+ "input.effort.title": "思考强度",
87
+ "input.effort.default": "提供方默认",
85
88
  "card.capabilities.failed": "保存失败:配置被拒绝或冲突,请检查值。"
86
89
  };
87
90
  /** English dictionary (keys mirror zh). */
@@ -156,6 +159,9 @@ window.__ModuleLoader__.load({
156
159
  "model.panel.empty": "No models available",
157
160
  "model.panel.window": "Window",
158
161
  "model.panel.noTarget": "No writable config entry for this model",
162
+ "model.panel.unavailable": "The model directory is unavailable for this session",
163
+ "input.effort.title": "Reasoning effort",
164
+ "input.effort.default": "Provider default",
159
165
  "card.capabilities.failed": "Save failed: the value was rejected or conflicted. Check it."
160
166
  };
161
167
  /** Japanese dictionary (keys mirror zh). */
@@ -230,6 +236,9 @@ window.__ModuleLoader__.load({
230
236
  "model.panel.empty": "利用可能なモデルがありません",
231
237
  "model.panel.window": "ウィンドウ",
232
238
  "model.panel.noTarget": "このモデルには書き込み可能な設定項目がありません",
239
+ "model.panel.unavailable": "このセッションのモデルディレクトリは利用できません",
240
+ "input.effort.title": "思考レベル",
241
+ "input.effort.default": "プロバイダーの既定",
233
242
  "card.capabilities.failed": "保存に失敗しました:値が拒否されたか競合しています。確認してください。"
234
243
  };
235
244
  /** Korean dictionary (keys mirror zh). */
@@ -304,6 +313,9 @@ window.__ModuleLoader__.load({
304
313
  "model.panel.empty": "사용 가능한 모델이 없습니다",
305
314
  "model.panel.window": "창",
306
315
  "model.panel.noTarget": "이 모델에는 쓰기 가능한 설정 항목이 없습니다",
316
+ "model.panel.unavailable": "이 세션의 모델 디렉터리를 사용할 수 없습니다",
317
+ "input.effort.title": "추론 강도",
318
+ "input.effort.default": "공급자 기본값",
307
319
  "card.capabilities.failed": "저장 실패: 값이 거부되었거나 충돌합니다. 확인하세요."
308
320
  };
309
321
  /** The multi-level context-window presets, in ascending order. */
@@ -405,6 +417,13 @@ window.__ModuleLoader__.load({
405
417
  const DEEPSEEK_DEFAULT_WINDOW = 1e6;
406
418
  /** Slider stop an unset window parks on: the thumb needs a position, the readout stays "unset". */
407
419
  const UNSET_STOP_INDEX = CONTEXT_WINDOW_PRESETS.findIndex((preset) => preset.value === 256e3);
420
+ /** Snapshot shown when the session's directory face is unavailable. */
421
+ const UNAVAILABLE_STATE = {
422
+ status: "loading",
423
+ groups: [],
424
+ current: null,
425
+ error: null
426
+ };
408
427
  const rootStyle = {
409
428
  position: "relative",
410
429
  display: "inline-flex"
@@ -415,7 +434,7 @@ window.__ModuleLoader__.load({
415
434
  gap: "6px",
416
435
  height: "26px",
417
436
  padding: "0 10px",
418
- background: "var(--dsw-alias-bg-surface, #fff)",
437
+ background: "var(--dsw-alias-bg-layer-1)",
419
438
  color: "var(--dsw-alias-label-primary)",
420
439
  border: "1px solid var(--dsw-alias-border-l2)",
421
440
  borderRadius: "8px",
@@ -430,6 +449,13 @@ window.__ModuleLoader__.load({
430
449
  overflow: "hidden",
431
450
  textOverflow: "ellipsis"
432
451
  };
452
+ const triggerEffortStyle = {
453
+ flex: "0 0 auto",
454
+ maxWidth: "72px",
455
+ overflow: "hidden",
456
+ textOverflow: "ellipsis",
457
+ color: "var(--dsw-alias-label-tertiary)"
458
+ };
433
459
  const chevronStyle = {
434
460
  flex: "0 0 auto",
435
461
  fontSize: "9px",
@@ -442,7 +468,7 @@ window.__ModuleLoader__.load({
442
468
  zIndex: 1200,
443
469
  width: "320px",
444
470
  padding: "8px",
445
- background: "var(--dsw-alias-bg-layer-3, rgba(127,127,127,0.05))",
471
+ background: "var(--dsw-alias-bg-layer-3)",
446
472
  color: "var(--dsw-alias-label-primary)",
447
473
  border: "1px solid var(--dsw-alias-border-l2)",
448
474
  borderRadius: "10px",
@@ -487,14 +513,29 @@ window.__ModuleLoader__.load({
487
513
  color: "var(--dsw-alias-label-tertiary)",
488
514
  fontSize: "11px"
489
515
  };
516
+ /** The model-line row CONTAINER: highlight surface + flex parent of pick/select/chip.
517
+ * Wraps so the inline window editor (a flex item too) takes its own full line. */
490
518
  const modelRowStyle$1 = {
491
519
  display: "flex",
520
+ flexWrap: "wrap",
492
521
  alignItems: "center",
493
522
  gap: "6px",
494
523
  width: "100%",
495
- padding: "6px 8px 6px 18px",
524
+ borderRadius: "6px"
525
+ };
526
+ const modelRowActiveStyle = {
527
+ ...modelRowStyle$1,
528
+ background: "var(--dsw-alias-state-business-primary-weak, var(--dsw-alias-interactive-bg-hover, transparent))"
529
+ };
530
+ /** The pick button inside the row: name/description/✓, keeps the row's old padding. */
531
+ const modelPickStyle = {
532
+ flex: "1 1 auto",
533
+ minWidth: 0,
534
+ display: "flex",
535
+ alignItems: "center",
536
+ gap: "6px",
537
+ padding: "6px 4px 6px 18px",
496
538
  border: "none",
497
- borderRadius: "6px",
498
539
  background: "transparent",
499
540
  color: "var(--dsw-alias-label-primary)",
500
541
  font: "inherit",
@@ -502,10 +543,6 @@ window.__ModuleLoader__.load({
502
543
  cursor: "pointer",
503
544
  textAlign: "left"
504
545
  };
505
- const modelRowActiveStyle = {
506
- ...modelRowStyle$1,
507
- background: "var(--dsw-alias-state-business-primary-weak, rgba(77,107,254,0.10))"
508
- };
509
546
  const modelCopyStyle = {
510
547
  flex: "1 1 auto",
511
548
  minWidth: 0,
@@ -518,13 +555,6 @@ window.__ModuleLoader__.load({
518
555
  textOverflow: "ellipsis",
519
556
  whiteSpace: "nowrap"
520
557
  };
521
- const modelDescriptionStyle = {
522
- overflow: "hidden",
523
- textOverflow: "ellipsis",
524
- whiteSpace: "nowrap",
525
- fontSize: "11px",
526
- color: "var(--dsw-alias-label-tertiary)"
527
- };
528
558
  const checkStyle = {
529
559
  flex: "0 0 auto",
530
560
  color: "var(--dsw-alias-state-business-primary)"
@@ -535,21 +565,38 @@ window.__ModuleLoader__.load({
535
565
  padding: "0 6px",
536
566
  border: "1px solid var(--dsw-alias-border-l2)",
537
567
  borderRadius: "5px",
538
- background: "var(--dsw-alias-bg-surface, #fff)",
568
+ background: "var(--dsw-alias-bg-layer-1)",
539
569
  color: "var(--dsw-alias-label-secondary)",
540
570
  fontSize: "11px",
541
571
  lineHeight: "16px",
542
572
  fontFamily: "var(--ds-font-family-code, monospace)",
543
573
  fontVariantNumeric: "tabular-nums",
544
574
  cursor: "pointer",
545
- whiteSpace: "nowrap"
575
+ whiteSpace: "nowrap",
576
+ marginRight: "8px"
546
577
  };
547
578
  const chipDisabledStyle = {
548
579
  ...chipStyle,
549
580
  cursor: "default",
550
581
  opacity: .55
551
582
  };
583
+ const selectStyle = {
584
+ flex: "0 0 auto",
585
+ height: "18px",
586
+ maxWidth: "96px",
587
+ padding: "0 2px",
588
+ border: "1px solid var(--dsw-alias-border-l2)",
589
+ borderRadius: "5px",
590
+ background: "var(--dsw-alias-bg-layer-1)",
591
+ color: "var(--dsw-alias-label-secondary)",
592
+ font: "inherit",
593
+ fontSize: "11px",
594
+ lineHeight: "16px",
595
+ cursor: "pointer",
596
+ colorScheme: "dark light"
597
+ };
552
598
  const editorRowStyle = {
599
+ flex: "1 1 100%",
553
600
  display: "flex",
554
601
  alignItems: "center",
555
602
  gap: "6px",
@@ -557,7 +604,7 @@ window.__ModuleLoader__.load({
557
604
  padding: "6px",
558
605
  border: "1px solid var(--dsw-alias-border-l2)",
559
606
  borderRadius: "6px",
560
- background: "var(--dsw-alias-bg-surface, #fff)",
607
+ background: "var(--dsw-alias-bg-layer-1)",
561
608
  fontSize: "12px"
562
609
  };
563
610
  const labelStyle$1 = {
@@ -599,13 +646,13 @@ window.__ModuleLoader__.load({
599
646
  padding: "2px 6px",
600
647
  border: "1px solid var(--dsw-alias-border-l2)",
601
648
  borderRadius: "5px",
602
- background: "var(--dsw-alias-bg-surface, #fff)",
649
+ background: "var(--dsw-alias-bg-layer-1)",
603
650
  color: "var(--dsw-alias-label-primary)",
604
651
  font: "inherit"
605
652
  };
606
653
  const errorStyle = {
607
654
  flex: "0 0 auto",
608
- color: "var(--dsw-alias-danger, #e5484d)",
655
+ color: "var(--dsw-alias-state-error-primary)",
609
656
  fontSize: "11px"
610
657
  };
611
658
  const statusStyle = {
@@ -616,8 +663,8 @@ window.__ModuleLoader__.load({
616
663
  const errorBannerStyle = {
617
664
  padding: "6px 8px",
618
665
  borderRadius: "6px",
619
- background: "var(--dsw-alias-danger-weak, rgba(229,72,77,0.10))",
620
- color: "var(--dsw-alias-danger, #e5484d)",
666
+ background: "var(--dsw-alias-interactive-bg-hover-danger)",
667
+ color: "var(--dsw-alias-state-error-primary)",
621
668
  fontSize: "11px"
622
669
  };
623
670
  /** The user-layer `providers` value of the llm-pi-ai namespace, when present. */
@@ -672,7 +719,7 @@ window.__ModuleLoader__.load({
672
719
  * @param props - injected directory + config forms, session seat, copy.
673
720
  */
674
721
  function ModelPanel({ directory, piAiScope, deepseekScope, t }) {
675
- const state = (0, react.useSyncExternalStore)((listener) => directory.store.subscribe(listener), () => directory.store.getSnapshot());
722
+ const state = (0, react.useSyncExternalStore)((listener) => directory?.store.subscribe(listener) ?? (() => {}), () => directory?.store.getSnapshot() ?? UNAVAILABLE_STATE);
676
723
  const piSnapshot = (0, react.useSyncExternalStore)((listener) => piAiScope.subscribe(listener), () => piAiScope.getSnapshot());
677
724
  const dsSnapshot = (0, react.useSyncExternalStore)((listener) => deepseekScope.subscribe(listener), () => deepseekScope.getSnapshot());
678
725
  const [open, setOpen] = (0, react.useState)(false);
@@ -686,7 +733,7 @@ window.__ModuleLoader__.load({
686
733
  const rootRef = (0, react.useRef)(null);
687
734
  (0, react.useEffect)(() => {
688
735
  if (!open) return;
689
- directory.load().catch(() => {});
736
+ directory?.load().catch(() => {});
690
737
  }, [directory, open]);
691
738
  const close = (0, react.useCallback)(() => {
692
739
  setOpen(false);
@@ -804,7 +851,7 @@ window.__ModuleLoader__.load({
804
851
  });
805
852
  };
806
853
  const chooseModel = (provider, model) => {
807
- if (busy) return;
854
+ if (busy || directory === void 0) return;
808
855
  setBusy(true);
809
856
  directory.select({
810
857
  provider,
@@ -816,7 +863,24 @@ window.__ModuleLoader__.load({
816
863
  setBusy(false);
817
864
  });
818
865
  };
866
+ /** Commit one model line's reasoning effort; empty string = provider default (omit the field). */
867
+ const chooseEffort = (provider, model, effort) => {
868
+ if (busy || directory === void 0) return;
869
+ setBusy(true);
870
+ directory.select({
871
+ provider,
872
+ model,
873
+ ...effort === "" ? {} : { reasoningEffort: effort }
874
+ }).then(() => {
875
+ setBusy(false);
876
+ }).catch(() => {
877
+ setBusy(false);
878
+ });
879
+ };
819
880
  const triggerLabel = current?.name ?? state.current?.model ?? t("model.panel.choose");
881
+ const currentReasoning = current?.model.reasoning;
882
+ const effectiveEffort = state.current?.reasoningEffort ?? currentReasoning?.defaultEffort;
883
+ const effortLabel = currentReasoning === void 0 ? void 0 : effectiveEffort === void 0 ? t("input.effort.default") : currentReasoning.efforts.find((level) => level.id === effectiveEffort)?.name ?? effectiveEffort;
820
884
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
821
885
  ref: rootRef,
822
886
  style: rootStyle,
@@ -834,13 +898,20 @@ window.__ModuleLoader__.load({
834
898
  setError(null);
835
899
  }
836
900
  },
837
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
838
- style: triggerNameStyle,
839
- children: triggerLabel
840
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
841
- style: chevronStyle,
842
- children: open ? "▲" : "▼"
843
- })]
901
+ children: [
902
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
903
+ style: triggerNameStyle,
904
+ children: triggerLabel
905
+ }),
906
+ effortLabel !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
907
+ style: triggerEffortStyle,
908
+ children: effortLabel
909
+ }),
910
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
911
+ style: chevronStyle,
912
+ children: open ? "▲" : "▼"
913
+ })
914
+ ]
844
915
  }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
845
916
  style: backdropStyle,
846
917
  onClick: close
@@ -851,11 +922,15 @@ window.__ModuleLoader__.load({
851
922
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
852
923
  style: modelsStyle,
853
924
  children: [
854
- state.status === "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
925
+ directory === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
926
+ style: statusStyle,
927
+ children: t("model.panel.unavailable")
928
+ }),
929
+ directory !== void 0 && state.status === "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
855
930
  style: statusStyle,
856
931
  children: t("model.panel.loading")
857
932
  }),
858
- state.groups.map((group) => {
933
+ directory !== void 0 && state.groups.map((group) => {
859
934
  const isExpanded = expanded.has(group.id);
860
935
  const name = group.name ?? group.label ?? group.id;
861
936
  const activeModel = state.current?.provider === group.id ? state.current.model : void 0;
@@ -883,28 +958,57 @@ window.__ModuleLoader__.load({
883
958
  const lineWritable = writableLine(group.id, model.id);
884
959
  const lineWindow = windowOf(group.id, model.id);
885
960
  const isEditing = editing !== null && editing.provider === group.id && editing.model === model.id;
886
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
887
- type: "button",
888
- role: "option",
889
- "aria-selected": active,
961
+ const lineEffort = active ? state.current?.reasoningEffort ?? model.reasoning?.defaultEffort : model.reasoning?.defaultEffort;
962
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
890
963
  style: active ? modelRowActiveStyle : modelRowStyle$1,
891
- disabled: busy,
892
- onClick: () => chooseModel(group.id, model.id),
893
964
  children: [
894
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
895
- style: modelCopyStyle,
965
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
966
+ type: "button",
967
+ role: "option",
968
+ "aria-selected": active,
969
+ style: modelPickStyle,
970
+ disabled: busy,
971
+ onClick: () => chooseModel(group.id, model.id),
896
972
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
897
- style: modelNameStyle,
898
- children: model.name
899
- }), model.description !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
900
- style: modelDescriptionStyle,
901
- children: model.description
973
+ style: modelCopyStyle,
974
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
975
+ style: modelNameStyle,
976
+ children: model.name
977
+ })
978
+ }), active && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
979
+ style: checkStyle,
980
+ "aria-hidden": "true",
981
+ children: "✓"
902
982
  })]
903
983
  }),
904
- active && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
905
- style: checkStyle,
906
- "aria-hidden": "true",
907
- children: "✓"
984
+ model.reasoning !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
985
+ "aria-label": t("input.effort.title"),
986
+ title: t("input.effort.title"),
987
+ style: selectStyle,
988
+ disabled: busy,
989
+ value: lineEffort ?? "",
990
+ onClick: (event) => event.stopPropagation(),
991
+ onChange: (event) => {
992
+ event.stopPropagation();
993
+ const value = event.currentTarget.value;
994
+ const target = value === "" ? model.reasoning?.defaultEffort : value;
995
+ if (target !== void 0) chooseEffort(group.id, model.id, target);
996
+ },
997
+ children: [
998
+ model.reasoning.defaultEffort !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
999
+ value: "",
1000
+ children: t("input.effort.default")
1001
+ }),
1002
+ model.reasoning.defaultEffort === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1003
+ value: "",
1004
+ hidden: true,
1005
+ children: t("input.effort.default")
1006
+ }),
1007
+ model.reasoning.efforts.map((level) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1008
+ value: level.id,
1009
+ children: level.name
1010
+ }, level.id))
1011
+ ]
908
1012
  }),
909
1013
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
910
1014
  role: "button",
@@ -929,100 +1033,101 @@ window.__ModuleLoader__.load({
929
1033
  openEditor(group.id, model.id);
930
1034
  },
931
1035
  children: lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow)
932
- })
933
- ]
934
- }), isEditing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
935
- style: editorRowStyle,
936
- children: [
937
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
938
- style: labelStyle$1,
939
- title: t("input.context.globalHint"),
940
- children: t("model.panel.window")
941
1036
  }),
942
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
943
- type: "range",
944
- min: 0,
945
- max: CONTEXT_WINDOW_PRESETS.length - 1,
946
- step: 1,
947
- value: draft ?? stopIndexOf(lineWindow),
948
- disabled: busy,
949
- "aria-label": t("input.context.title"),
950
- style: sliderStyle,
951
- onChange: (event) => {
952
- setDraft(Number(event.currentTarget.value));
953
- },
954
- onPointerUp: () => {
955
- if (draft === null) return;
956
- commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
957
- },
958
- onKeyUp: () => {
959
- if (draft === null) return;
960
- commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
961
- }
962
- }),
963
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
964
- style: valueStyle,
965
- children: draft === null ? lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow) : formatContextWindow(CONTEXT_WINDOW_PRESETS[draft]?.value ?? 0)
966
- }),
967
- custom ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
968
- type: "text",
969
- inputMode: "numeric",
970
- value: raw,
971
- disabled: busy,
972
- placeholder: t("input.context.customPlaceholder"),
973
- "aria-label": t("input.context.customPlaceholder"),
974
- style: inputStyle,
975
- onChange: (event) => {
976
- setRaw(event.currentTarget.value);
977
- },
978
- onKeyDown: (event) => {
979
- if (event.key === "Enter") applyCustom();
980
- }
981
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
982
- type: "button",
983
- disabled: busy,
984
- style: actionButtonStyle,
985
- onClick: applyCustom,
986
- children: t("input.context.apply")
987
- })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
988
- type: "button",
989
- disabled: busy,
990
- "aria-label": t("input.context.custom"),
991
- title: t("input.context.custom"),
992
- style: actionButtonStyle,
993
- onClick: () => {
994
- setCustom(true);
995
- setError(null);
996
- },
997
- children: "⋯"
998
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
999
- type: "button",
1000
- disabled: busy || lineWindow === void 0,
1001
- style: {
1002
- ...actionButtonStyle,
1003
- opacity: lineWindow === void 0 ? .55 : 1
1004
- },
1005
- onClick: () => {
1006
- setDraft(null);
1007
- setError(null);
1008
- commitWindow(group.id, model.id, void 0);
1009
- },
1010
- children: t("input.context.clear")
1011
- })] }),
1012
- error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1013
- style: errorStyle,
1014
- children: error
1037
+ isEditing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1038
+ style: editorRowStyle,
1039
+ children: [
1040
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1041
+ style: labelStyle$1,
1042
+ title: t("input.context.globalHint"),
1043
+ children: t("model.panel.window")
1044
+ }),
1045
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1046
+ type: "range",
1047
+ min: 0,
1048
+ max: CONTEXT_WINDOW_PRESETS.length - 1,
1049
+ step: 1,
1050
+ value: draft ?? stopIndexOf(lineWindow),
1051
+ disabled: busy,
1052
+ "aria-label": t("input.context.title"),
1053
+ style: sliderStyle,
1054
+ onChange: (event) => {
1055
+ setDraft(Number(event.currentTarget.value));
1056
+ },
1057
+ onPointerUp: () => {
1058
+ if (draft === null) return;
1059
+ commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
1060
+ },
1061
+ onKeyUp: () => {
1062
+ if (draft === null) return;
1063
+ commitWindow(group.id, model.id, CONTEXT_WINDOW_PRESETS[draft]?.value);
1064
+ }
1065
+ }),
1066
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1067
+ style: valueStyle,
1068
+ children: draft === null ? lineWindow === void 0 ? t("input.context.unset") : formatContextWindow(lineWindow) : formatContextWindow(CONTEXT_WINDOW_PRESETS[draft]?.value ?? 0)
1069
+ }),
1070
+ custom ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1071
+ type: "text",
1072
+ inputMode: "numeric",
1073
+ value: raw,
1074
+ disabled: busy,
1075
+ placeholder: t("input.context.customPlaceholder"),
1076
+ "aria-label": t("input.context.customPlaceholder"),
1077
+ style: inputStyle,
1078
+ onChange: (event) => {
1079
+ setRaw(event.currentTarget.value);
1080
+ },
1081
+ onKeyDown: (event) => {
1082
+ if (event.key === "Enter") applyCustom();
1083
+ }
1084
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1085
+ type: "button",
1086
+ disabled: busy,
1087
+ style: actionButtonStyle,
1088
+ onClick: applyCustom,
1089
+ children: t("input.context.apply")
1090
+ })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1091
+ type: "button",
1092
+ disabled: busy,
1093
+ "aria-label": t("input.context.custom"),
1094
+ title: t("input.context.custom"),
1095
+ style: actionButtonStyle,
1096
+ onClick: () => {
1097
+ setCustom(true);
1098
+ setError(null);
1099
+ },
1100
+ children: "⋯"
1101
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1102
+ type: "button",
1103
+ disabled: busy || lineWindow === void 0,
1104
+ style: {
1105
+ ...actionButtonStyle,
1106
+ opacity: lineWindow === void 0 ? .55 : 1
1107
+ },
1108
+ onClick: () => {
1109
+ setDraft(null);
1110
+ setError(null);
1111
+ commitWindow(group.id, model.id, void 0);
1112
+ },
1113
+ children: t("input.context.clear")
1114
+ })] }),
1115
+ error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1116
+ style: errorStyle,
1117
+ children: error
1118
+ })
1119
+ ]
1015
1120
  })
1016
1121
  ]
1017
- })] }, group.id + ":" + model.id);
1122
+ }, group.id + ":" + model.id);
1018
1123
  })] }, group.id);
1019
1124
  }),
1020
- state.status !== "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1125
+ directory !== void 0 && state.status !== "loading" && state.groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1021
1126
  style: statusStyle,
1022
1127
  children: t("model.panel.empty")
1023
1128
  })
1024
1129
  ]
1025
- }), state.error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1130
+ }), directory !== void 0 && state.error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1026
1131
  style: errorBannerStyle,
1027
1132
  role: "status",
1028
1133
  children: state.error
@@ -2299,7 +2404,12 @@ window.__ModuleLoader__.load({
2299
2404
  for (const dispose of disposers) dispose();
2300
2405
  };
2301
2406
  }, "dsh-thinking-levels: dictionaries");
2302
- ctx.inject(["modelDirectories"], (scope) => {
2407
+ ctx.inject([
2408
+ "modelDirectories",
2409
+ "sessions",
2410
+ "remote",
2411
+ "remote.session"
2412
+ ], (scope) => {
2303
2413
  const directories = scope.modelDirectories;
2304
2414
  if (directories === void 0) return;
2305
2415
  ctx.slots.inject("conversation.input.model", function* () {
@@ -2309,8 +2419,14 @@ window.__ModuleLoader__.load({
2309
2419
  priority: -1,
2310
2420
  locale: NS,
2311
2421
  inject: (sessionId) => {
2422
+ let directory;
2423
+ try {
2424
+ directory = directories.directoryFor(sessionId);
2425
+ } catch {
2426
+ directory = void 0;
2427
+ }
2312
2428
  return {
2313
- directory: directories.directoryFor(sessionId),
2429
+ directory,
2314
2430
  piAiScope: ctx.configForms.get("llm-pi-ai"),
2315
2431
  deepseekScope: ctx.configForms.get("llm-deepseek")
2316
2432
  };