dsh-thinking-levels 3.0.1 → 3.1.0

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
@@ -344,1168 +344,6 @@ window.__ModuleLoader__.load({
344
344
  };
345
345
  }
346
346
  //#endregion
347
- //#region src/client/card.tsx
348
- /**
349
- * Thinking-levels settings card — the `settings.plugin.item` face of the
350
- * dsh-thinking-levels plugin.
351
- *
352
- * The card binds the `thinking-levels` settings namespace through the
353
- * `settingsScope` cordis service and renders its fields: the level picker
354
- * (off / on / minimal / low / medium / high / xhigh / max / auto) plus the
355
- * scheduler toggles. Every change commits immediately through the scope (no
356
- * staged form): the decision is read per model request, so a committed change
357
- * applies to the next request without a restart.
358
- *
359
- * Below the scheduler rows, a "model capabilities" block edits the
360
- * `llm-pi-ai` namespace directly (read + write through the same settings
361
- * transport), borrowing dsh-thinking-effort's presentation: providers group
362
- * their models, each model row shows capability badges and expands into a
363
- * per-level editor where a level is ticked and its gateway wire value entered
364
- * (e.g. `high` → `ultra`); `off` left empty means "do not send". A search box
365
- * filters models and one-click presets apply official/generic level sets to
366
- * every thinking model.
367
- *
368
- * Kept dependency-free beyond react: the scopes are subscribed with
369
- * `useSyncExternalStore`, and the controls are plain HTML so the client bundle
370
- * needs no CSS modules and no primitives value import.
371
- */
372
- /** The user-facing levels, in picker order: eight standard levels plus the auto scheduler sentinel. */
373
- const EFFORT_OPTIONS = [
374
- "off",
375
- "on",
376
- "minimal",
377
- "low",
378
- "medium",
379
- "high",
380
- "xhigh",
381
- "max",
382
- "auto"
383
- ];
384
- /**
385
- * The levels the capability editor offers. This is the llm-pi-ai
386
- * `reasoningEfforts` table-key space — pi-ai's fixed seven levels (schema
387
- * rejects any other key). `on` (the enable-thinking toggle) is a selector /
388
- * injection-level concept, expressed here by the `off` + `high` pair
389
- * (enable_thinking false/true), so it has no table key of its own.
390
- */
391
- const CAPABILITY_LEVELS = [
392
- "off",
393
- "minimal",
394
- "low",
395
- "medium",
396
- "high",
397
- "xhigh",
398
- "max"
399
- ];
400
- /** One-click presets, mirroring dsh-thinking-effort: official DeepSeek style and a generic set. */
401
- const PRESETS = [{
402
- key: "official",
403
- levels: {
404
- off: null,
405
- high: "high",
406
- max: "max"
407
- }
408
- }, {
409
- key: "generic",
410
- levels: {
411
- off: null,
412
- low: "low",
413
- medium: "medium",
414
- high: "high"
415
- }
416
- }];
417
- /** The wire thinking formats offered (llm-pi-ai's nameable set, incl. qwen-chat-template). */
418
- const THINKING_FORMATS = [
419
- "openai",
420
- "deepseek",
421
- "openrouter",
422
- "together",
423
- "zai",
424
- "qwen",
425
- "qwen-chat-template",
426
- "string-thinking",
427
- "ant-ling"
428
- ];
429
- const rowStyle$1 = {
430
- display: "flex",
431
- alignItems: "center",
432
- justifyContent: "space-between",
433
- gap: "12px",
434
- padding: "6px 0",
435
- fontSize: "13px",
436
- lineHeight: "20px"
437
- };
438
- const labelStyle$1 = {
439
- margin: 0,
440
- color: "var(--dsw-alias-label-primary)"
441
- };
442
- const controlStyle = {
443
- background: "var(--dsw-alias-bg-surface, #fff)",
444
- color: "var(--dsw-alias-label-primary)",
445
- border: "1px solid var(--dsw-alias-border-l2)",
446
- borderRadius: "4px",
447
- padding: "3px 8px",
448
- fontSize: "13px"
449
- };
450
- const sectionStyle = {
451
- marginTop: "14px",
452
- paddingTop: "12px",
453
- borderTop: "1px solid var(--dsw-alias-border-l2)"
454
- };
455
- const fieldStyle = {
456
- display: "flex",
457
- flexDirection: "column",
458
- gap: "4px"
459
- };
460
- const fieldLabelStyle = {
461
- margin: 0,
462
- fontSize: "12px",
463
- lineHeight: "18px",
464
- color: "var(--dsw-alias-label-tertiary)"
465
- };
466
- const hintStyle = {
467
- margin: "6px 0 0",
468
- fontSize: "12px",
469
- lineHeight: "18px",
470
- color: "var(--dsw-alias-label-tertiary)"
471
- };
472
- /** Provider group shell: an outlined row grouping its models. */
473
- const providerStyle = {
474
- border: "1px solid var(--dsw-alias-border-l2)",
475
- borderRadius: "8px",
476
- margin: "8px 0 0",
477
- overflow: "hidden"
478
- };
479
- const providerHeadStyle = {
480
- display: "flex",
481
- alignItems: "center",
482
- gap: "8px",
483
- padding: "7px 10px",
484
- background: "var(--dsw-alias-bg-layer-2, rgba(127,127,127,0.06))"
485
- };
486
- const providerNameStyle = {
487
- margin: 0,
488
- flex: "1 1 auto",
489
- minWidth: 0,
490
- fontFamily: "var(--ds-font-family-code, monospace)",
491
- fontSize: "12px",
492
- lineHeight: "18px",
493
- fontWeight: 600,
494
- color: "var(--dsw-alias-label-primary)",
495
- overflowWrap: "anywhere"
496
- };
497
- const providerBadgeStyle = {
498
- margin: 0,
499
- fontSize: "10px",
500
- lineHeight: "16px",
501
- color: "var(--dsw-alias-label-tertiary)",
502
- border: "1px solid var(--dsw-alias-border-l2)",
503
- borderRadius: "4px",
504
- padding: "0 5px",
505
- whiteSpace: "nowrap"
506
- };
507
- const iconButtonStyle = {
508
- background: "none",
509
- border: "none",
510
- color: "var(--dsw-alias-label-tertiary)",
511
- cursor: "pointer",
512
- padding: "2px 4px",
513
- display: "inline-flex",
514
- alignItems: "center"
515
- };
516
- /** One model row inside a provider group. */
517
- const modelRowStyle = {
518
- display: "flex",
519
- alignItems: "center",
520
- gap: "8px",
521
- padding: "7px 10px",
522
- borderTop: "1px solid var(--dsw-alias-border-l2)"
523
- };
524
- const modelIdStyle = {
525
- margin: 0,
526
- flex: "1 1 auto",
527
- minWidth: 0,
528
- fontFamily: "var(--ds-font-family-code, monospace)",
529
- fontSize: "12px",
530
- lineHeight: "18px",
531
- color: "var(--dsw-alias-label-secondary)",
532
- overflowWrap: "anywhere"
533
- };
534
- /** Capability badge chips (text / image / context). */
535
- const badgeStyle = {
536
- fontSize: "10px",
537
- lineHeight: "16px",
538
- color: "var(--dsw-alias-label-tertiary)",
539
- border: "1px solid var(--dsw-alias-border-l2)",
540
- borderRadius: "4px",
541
- padding: "0 5px",
542
- whiteSpace: "nowrap"
543
- };
544
- /** The per-level editor grid: one row per level with a toggle, a label and a wire input. */
545
- const levelRowStyle = {
546
- display: "grid",
547
- gridTemplateColumns: "auto 92px minmax(0, 1fr)",
548
- alignItems: "center",
549
- gap: "8px",
550
- padding: "4px 0",
551
- fontSize: "13px"
552
- };
553
- const levelNameStyle = {
554
- margin: 0,
555
- fontSize: "12px",
556
- lineHeight: "18px",
557
- color: "var(--dsw-alias-label-secondary)"
558
- };
559
- const wireInputStyle = {
560
- background: "var(--dsw-alias-bg-surface, #fff)",
561
- color: "var(--dsw-alias-label-primary)",
562
- border: "1px solid var(--dsw-alias-border-l2)",
563
- borderRadius: "4px",
564
- padding: "3px 8px",
565
- fontSize: "12px",
566
- width: "100%",
567
- boxSizing: "border-box"
568
- };
569
- /** A row's `reasoningEfforts` as stored in the user layer. */
570
- function effortsOf(model) {
571
- const value = model["reasoningEfforts"];
572
- if (value === false) return false;
573
- if (typeof value === "object" && value !== null && !Array.isArray(value)) return value;
574
- }
575
- /**
576
- * Build a `reasoningEfforts` table from a level→wire draft. `off` maps to
577
- * `null` (omit the reasoning option → enable_thinking false) unless the user
578
- * typed a wire value; every other ticked level keeps its typed wire value.
579
- * pi-ai rejects a table offering nothing beyond `off`, so a selection of only
580
- * `off` falls back to the default `high` level.
581
- */
582
- function effortTableOf(draft) {
583
- const table = {};
584
- for (const level of CAPABILITY_LEVELS) {
585
- const wire = draft[level];
586
- if (wire === void 0 || wire === null) continue;
587
- const trimmed = typeof wire === "string" ? wire.trim() : "";
588
- if (level === "off") table[level] = trimmed === "" ? null : trimmed;
589
- else if (trimmed !== "") table[level] = trimmed;
590
- }
591
- if (Object.keys(table).length === 0 || Object.keys(table).every((level) => table[level] === null)) return {
592
- ...table,
593
- high: "high"
594
- };
595
- return table;
596
- }
597
- /** Whether a row declares `compat.supportsReasoningEffort` (the wire sends reasoning_effort). */
598
- function supportsEffortOf(model) {
599
- const compat = model["compat"];
600
- if (typeof compat !== "object" || compat === null || Array.isArray(compat)) return false;
601
- return compat["supportsReasoningEffort"] === true;
602
- }
603
- /** Patch one row's `compat` object, merging rather than replacing sibling fields. */
604
- function patchCompat(row, patch) {
605
- const compat = typeof row["compat"] === "object" && row["compat"] !== null && !Array.isArray(row["compat"]) ? { ...row["compat"] } : {};
606
- patch(compat);
607
- if (Object.keys(compat).length === 0) delete row["compat"];
608
- else row["compat"] = compat;
609
- }
610
- /** The user-layer `providers` value of the llm-pi-ai namespace, when present. */
611
- function providersOf$1(snapshot) {
612
- if (typeof snapshot !== "object" || snapshot === null) return {};
613
- const user = snapshot.user;
614
- if (typeof user !== "object" || user === null || Array.isArray(user)) return {};
615
- const providers = user["providers"];
616
- return typeof providers === "object" && providers !== null && !Array.isArray(providers) ? providers : {};
617
- }
618
- /** Whether a route-level profile declares `compat.supportsDeveloperRole: false`. */
619
- function developerRoleDisabledOf(profile) {
620
- if (typeof profile !== "object" || profile === null) return false;
621
- const compat = profile["compat"];
622
- if (typeof compat !== "object" || compat === null || Array.isArray(compat)) return false;
623
- return compat["supportsDeveloperRole"] === false;
624
- }
625
- /** The effective `compat` of an entry: its own `compat` merged over the provider-level `compat`. */
626
- function compatOf(entry) {
627
- const base = typeof entry.providerCompat === "object" && entry.providerCompat !== null ? entry.providerCompat : {};
628
- const own = entry.model["compat"];
629
- return typeof own === "object" && own !== null && !Array.isArray(own) ? {
630
- ...base,
631
- ...own
632
- } : base;
633
- }
634
- /** Flatten the user-layer providers into capability entries (models arrays only). */
635
- function entriesOf(providers) {
636
- return Object.entries(providers).flatMap(([providerId, profile]) => {
637
- const raw = profile;
638
- const models = raw["models"];
639
- if (!Array.isArray(models)) return [];
640
- const providerCompat = raw["compat"];
641
- const providerInput = Array.isArray(raw["defaultInput"]) ? raw["defaultInput"] : void 0;
642
- return models.map((model, index) => ({
643
- providerId,
644
- index,
645
- model: typeof model === "object" && model !== null && !Array.isArray(model) ? model : {},
646
- modelId: typeof model === "object" && model !== null && typeof model["id"] === "string" ? model["id"] : `#${index + 1}`,
647
- providerCompat,
648
- providerInput
649
- }));
650
- });
651
- }
652
- /** Human-readable capability summary of one entry (input modalities + declared context window). */
653
- function summaryOf(entry) {
654
- const input = Array.isArray(entry.model["input"]) ? entry.model["input"] : entry.providerInput;
655
- const text = !Array.isArray(input) || input.length === 0 || input.includes("text");
656
- const image = Array.isArray(input) && input.includes("image");
657
- const contextWindow = entry.model["contextWindow"];
658
- return {
659
- text,
660
- image,
661
- context: typeof contextWindow === "number" && Number.isFinite(contextWindow) && contextWindow > 0 ? formatContextWindow(contextWindow) : null
662
- };
663
- }
664
- /** A tiny inline chevron icon (no CSS modules). */
665
- function ChevronIcon({ open }) {
666
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
667
- width: "12",
668
- height: "12",
669
- viewBox: "0 0 16 16",
670
- "aria-hidden": true,
671
- style: {
672
- transform: open ? "rotate(180deg)" : "none",
673
- transition: "transform 0.16s"
674
- },
675
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
676
- d: "M4 6l4 4 4-4",
677
- fill: "none",
678
- stroke: "currentColor",
679
- strokeWidth: "1.5",
680
- strokeLinecap: "round",
681
- strokeLinejoin: "round"
682
- })
683
- });
684
- }
685
- /**
686
- * The llm-pi-ai model-capability editor block (dsh-thinking-effort style:
687
- * provider groups, model rows with badges, per-level wire editors, search and
688
- * one-click presets).
689
- * @param scope - the `llm-pi-ai` namespace scope.
690
- * @param t - copy lookup.
691
- * @param readonly - whether writes are forbidden.
692
- * @returns the capabilities block, or a placeholder when nothing is configured.
693
- */
694
- function ModelCapabilities(props) {
695
- const { scope, t, readonly } = props;
696
- const snapshot = (0, react.useSyncExternalStore)((listener) => scope.subscribe(listener), () => scope.getSnapshot());
697
- const unavailable = snapshot.status === "unavailable";
698
- const providers = snapshot.status === "ready" ? providersOf$1(snapshot) : {};
699
- const allEntries = entriesOf(providers);
700
- const [query, setQuery] = (0, react.useState)("");
701
- const [expandedProviders, setExpandedProviders] = (0, react.useState)({});
702
- const [expandedModels, setExpandedModels] = (0, react.useState)({});
703
- const [drafts, setDrafts] = (0, react.useState)({});
704
- const [busy, setBusy] = (0, react.useState)(false);
705
- const [contextRaw, setContextRaw] = (0, react.useState)({});
706
- const [contextError, setContextError] = (0, react.useState)({});
707
- const entryKey = (entry) => `${entry.providerId}\u0000${entry.index}`;
708
- /** Commit one patch over the user-layer providers. */
709
- const commitProviders = (mutate) => {
710
- if (snapshot.status !== "ready" || readonly) return;
711
- setBusy(true);
712
- scope.set("providers", mutate(structuredClone(providers))).then(() => {
713
- setBusy(false);
714
- }).catch(() => {
715
- setBusy(false);
716
- });
717
- };
718
- /** Toggle the route-level official compat flag: unchecked = inherit (unset). */
719
- const toggleDeveloperRole = (providerId, next) => {
720
- commitProviders((current) => {
721
- const profile = current[providerId];
722
- if (profile === void 0) return current;
723
- const compat = typeof profile["compat"] === "object" && profile["compat"] !== null && !Array.isArray(profile["compat"]) ? { ...profile["compat"] } : {};
724
- if (next) compat["supportsDeveloperRole"] = false;
725
- else delete compat["supportsDeveloperRole"];
726
- if (Object.keys(compat).length === 0) delete profile["compat"];
727
- else profile["compat"] = compat;
728
- return current;
729
- });
730
- };
731
- /** Patch one model row of one provider. */
732
- const patchModel = (providerId, index, patch) => {
733
- commitProviders((current) => {
734
- const profile = current[providerId];
735
- if (profile === void 0 || !Array.isArray(profile.models)) return current;
736
- const model = profile.models[index];
737
- if (typeof model !== "object" || model === null) return current;
738
- patch(model);
739
- return current;
740
- });
741
- };
742
- /** Toggle whether a model is a thinking model (reasoningEfforts table vs false). */
743
- const toggleThinking = (entry, next) => {
744
- patchModel(entry.providerId, entry.index, (row) => {
745
- if (next) {
746
- const effortCapable = supportsEffortOf(row);
747
- row["reasoningEfforts"] = effortCapable ? effortTableOf({ high: "high" }) : {
748
- off: null,
749
- high: "high"
750
- };
751
- if (!effortCapable) patchCompat(row, (compat) => {
752
- if (compat["thinkingFormat"] === void 0) compat["thinkingFormat"] = "qwen-chat-template";
753
- });
754
- } else row["reasoningEfforts"] = false;
755
- });
756
- };
757
- /** Toggle whether a model accepts reasoning_effort levels. */
758
- const toggleEffortCapable = (entry, next) => {
759
- patchModel(entry.providerId, entry.index, (row) => {
760
- patchCompat(row, (compat) => {
761
- compat["supportsReasoningEffort"] = next;
762
- if (next && compat["thinkingFormat"] === "qwen-chat-template") delete compat["thinkingFormat"];
763
- });
764
- });
765
- };
766
- /** Apply one model's wire draft as its `reasoningEfforts` table. */
767
- const applyDraft = (entry) => {
768
- const key = entryKey(entry);
769
- const draft = drafts[key];
770
- if (draft === void 0) return;
771
- const table = effortTableOf(draft);
772
- patchModel(entry.providerId, entry.index, (row) => {
773
- row["reasoningEfforts"] = table;
774
- const extended = Object.keys(table).some((level) => level !== "off" && level !== "on" && level !== "high");
775
- if (supportsEffortOf(row) || extended) patchCompat(row, (compat) => {
776
- compat["supportsReasoningEffort"] = true;
777
- });
778
- });
779
- };
780
- /** Reset a model's draft to its persisted table (or the default high set). */
781
- const resetDraft = (entry) => {
782
- const key = entryKey(entry);
783
- setDrafts((current) => {
784
- const next = { ...current };
785
- const table = effortsOf(entry.model);
786
- if (typeof table === "object" && table !== null) next[key] = Object.fromEntries(CAPABILITY_LEVELS.map((level) => [level, table[level] === void 0 ? null : table[level] === null ? "" : String(table[level])]));
787
- else next[key] = {
788
- off: "",
789
- high: "high"
790
- };
791
- return next;
792
- });
793
- };
794
- /** Seed a model's draft when it is first expanded. */
795
- const ensureDraft = (entry) => {
796
- const key = entryKey(entry);
797
- setDrafts((current) => {
798
- if (current[key] !== void 0) return current;
799
- const next = { ...current };
800
- const table = effortsOf(entry.model);
801
- if (typeof table === "object" && table !== null) next[key] = Object.fromEntries(CAPABILITY_LEVELS.map((level) => [level, table[level] === void 0 ? null : table[level] === null ? "" : String(table[level])]));
802
- else next[key] = {
803
- off: "",
804
- high: "high"
805
- };
806
- return next;
807
- });
808
- };
809
- /** Apply a one-click preset to every thinking model. */
810
- const applyPreset = (levels) => {
811
- commitProviders((current) => {
812
- for (const entry of entriesOf(current)) {
813
- const profile = current[entry.providerId];
814
- if (profile === void 0 || !Array.isArray(profile.models)) continue;
815
- const model = profile.models[entry.index];
816
- if (typeof model !== "object" || model === null) continue;
817
- const row = model;
818
- if (effortsOf(row) === void 0) continue;
819
- row["reasoningEfforts"] = levels;
820
- }
821
- return current;
822
- });
823
- };
824
- /** Seed a model's context-window input when it is first expanded. */
825
- const seedContext = (entry) => {
826
- const key = entryKey(entry);
827
- setContextRaw((current) => {
828
- if (current[key] !== void 0) return current;
829
- const value = entry.model["contextWindow"];
830
- return {
831
- ...current,
832
- [key]: typeof value === "number" && Number.isFinite(value) ? String(value) : ""
833
- };
834
- });
835
- };
836
- /** Write (or delete) a model's `contextWindow` in the llm-pi-ai entry. */
837
- const commitContextWindow = (entry, value) => {
838
- const key = entryKey(entry);
839
- patchModel(entry.providerId, entry.index, (row) => {
840
- if (value === void 0) delete row["contextWindow"];
841
- else row["contextWindow"] = value;
842
- });
843
- setContextError((current) => {
844
- const next = { ...current };
845
- delete next[key];
846
- return next;
847
- });
848
- };
849
- /** Apply one preset immediately. */
850
- const applyContextPreset = (entry, value) => {
851
- const key = entryKey(entry);
852
- setContextRaw((current) => ({
853
- ...current,
854
- [key]: String(value)
855
- }));
856
- commitContextWindow(entry, value);
857
- };
858
- /** Validate and commit the custom input (blur / Enter); empty clears it. */
859
- const applyContextInput = (entry) => {
860
- const key = entryKey(entry);
861
- const raw = (contextRaw[key] ?? "").trim();
862
- if (raw === "") {
863
- commitContextWindow(entry, void 0);
864
- return;
865
- }
866
- const validation = validateContextWindow(raw);
867
- if (!validation.ok) {
868
- setContextError((current) => ({
869
- ...current,
870
- [key]: t(validation.reason === "integer" ? "card.capabilities.contextInteger" : "card.capabilities.contextRange")
871
- }));
872
- return;
873
- }
874
- commitContextWindow(entry, validation.value);
875
- };
876
- /** Clear the model's context-window declaration (delete the field). */
877
- const clearContext = (entry) => {
878
- const key = entryKey(entry);
879
- setContextRaw((current) => ({
880
- ...current,
881
- [key]: ""
882
- }));
883
- commitContextWindow(entry, void 0);
884
- };
885
- if (unavailable) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
886
- style: sectionStyle,
887
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
888
- style: hintStyle,
889
- children: t("card.capabilities.unavailable")
890
- })
891
- });
892
- if (allEntries.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
893
- style: sectionStyle,
894
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
895
- style: fieldLabelStyle,
896
- children: t("card.capabilities")
897
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
898
- style: hintStyle,
899
- children: t("card.capabilities.empty")
900
- })]
901
- });
902
- const needle = query.trim().toLowerCase();
903
- const visible = needle === "" ? allEntries : allEntries.filter((entry) => entry.modelId.toLowerCase().includes(needle) || entry.providerId.toLowerCase().includes(needle));
904
- const providerIds = [...new Set(visible.map((entry) => entry.providerId))];
905
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
906
- style: sectionStyle,
907
- children: [
908
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
909
- style: fieldLabelStyle,
910
- children: t("card.capabilities")
911
- }),
912
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
913
- style: hintStyle,
914
- children: t("card.capabilities.hint")
915
- }),
916
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
917
- style: {
918
- display: "flex",
919
- gap: "8px",
920
- flexWrap: "wrap",
921
- alignItems: "center",
922
- margin: "8px 0 2px"
923
- },
924
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
925
- type: "text",
926
- value: query,
927
- placeholder: t("card.capabilities.search"),
928
- disabled: readonly || busy,
929
- style: {
930
- ...controlStyle,
931
- flex: "1 1 160px",
932
- minWidth: "140px"
933
- },
934
- onChange: (event) => setQuery(event.currentTarget.value)
935
- }), PRESETS.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
936
- type: "button",
937
- disabled: readonly || busy,
938
- onClick: () => applyPreset(preset.levels),
939
- style: {
940
- ...controlStyle,
941
- cursor: readonly || busy ? "default" : "pointer",
942
- opacity: readonly || busy ? .5 : 1
943
- },
944
- children: t(`card.capabilities.preset${preset.key === "official" ? "Official" : "Generic"}`)
945
- }, preset.key))]
946
- }),
947
- visible.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
948
- style: hintStyle,
949
- children: t("card.capabilities.noMatches")
950
- }) : providerIds.map((providerId) => {
951
- const providerEntries = visible.filter((entry) => entry.providerId === providerId);
952
- const providerOpen = expandedProviders[providerId] === true || needle !== "";
953
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
954
- style: providerStyle,
955
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
956
- style: providerHeadStyle,
957
- children: [
958
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
959
- type: "button",
960
- "aria-expanded": providerOpen,
961
- disabled: readonly || busy,
962
- onClick: () => setExpandedProviders((current) => ({
963
- ...current,
964
- [providerId]: current[providerId] !== true
965
- })),
966
- style: {
967
- ...iconButtonStyle,
968
- cursor: readonly || busy ? "default" : "pointer"
969
- },
970
- title: providerOpen ? t("card.capabilities.collapseProvider") : t("card.capabilities.expandProvider"),
971
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronIcon, { open: providerOpen })
972
- }),
973
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
974
- style: providerNameStyle,
975
- children: providerId
976
- }),
977
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
978
- style: {
979
- display: "inline-flex",
980
- alignItems: "center",
981
- gap: "5px",
982
- fontSize: "11px",
983
- whiteSpace: "nowrap",
984
- color: "var(--dsw-alias-label-secondary)"
985
- },
986
- title: t("card.capabilities.developerRoleHint"),
987
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
988
- type: "checkbox",
989
- checked: developerRoleDisabledOf(providers[providerId]),
990
- disabled: readonly || busy,
991
- onChange: (event) => toggleDeveloperRole(providerId, event.currentTarget.checked)
992
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.developerRole") })]
993
- }),
994
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
995
- style: providerBadgeStyle,
996
- children: providerEntries.length
997
- })
998
- ]
999
- }), providerOpen ? providerEntries.map((entry) => {
1000
- const key = entryKey(entry);
1001
- const modelOpen = expandedModels[key] === true;
1002
- const thinking = typeof effortsOf(entry.model) === "object";
1003
- const compat = compatOf(entry);
1004
- const supportsEffort = compat["supportsReasoningEffort"] === true;
1005
- const meta = summaryOf(entry);
1006
- const format = typeof compat["thinkingFormat"] === "string" ? compat["thinkingFormat"] : void 0;
1007
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1008
- style: modelRowStyle,
1009
- children: [
1010
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1011
- type: "button",
1012
- "aria-expanded": modelOpen,
1013
- disabled: readonly || busy,
1014
- onClick: () => {
1015
- const next = expandedModels[key] !== true;
1016
- setExpandedModels((current) => ({
1017
- ...current,
1018
- [key]: next
1019
- }));
1020
- if (next) {
1021
- ensureDraft(entry);
1022
- seedContext(entry);
1023
- }
1024
- },
1025
- style: {
1026
- ...iconButtonStyle,
1027
- cursor: readonly || busy ? "default" : "pointer"
1028
- },
1029
- title: modelOpen ? t("card.capabilities.closeModelSettings") : t("card.capabilities.openModelSettings"),
1030
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronIcon, { open: modelOpen })
1031
- }),
1032
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1033
- style: modelIdStyle,
1034
- children: entry.modelId
1035
- }),
1036
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1037
- style: badgeStyle,
1038
- title: "text",
1039
- children: meta.text ? "T" : "–"
1040
- }),
1041
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1042
- style: badgeStyle,
1043
- title: "image",
1044
- children: meta.image ? "IMG" : "–"
1045
- }),
1046
- meta.context !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1047
- style: badgeStyle,
1048
- children: meta.context
1049
- }),
1050
- thinking && !supportsEffort && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1051
- style: badgeStyle,
1052
- children: "On/Off"
1053
- })
1054
- ]
1055
- }), modelOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1056
- style: {
1057
- padding: "4px 10px 10px",
1058
- borderTop: "1px solid var(--dsw-alias-border-l2)"
1059
- },
1060
- children: [
1061
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1062
- style: {
1063
- display: "flex",
1064
- gap: "16px",
1065
- flexWrap: "wrap",
1066
- margin: "2px 0 8px"
1067
- },
1068
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1069
- style: {
1070
- display: "inline-flex",
1071
- alignItems: "center",
1072
- gap: "6px",
1073
- fontSize: "12px"
1074
- },
1075
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1076
- type: "checkbox",
1077
- checked: thinking,
1078
- disabled: readonly || busy,
1079
- onChange: (event) => toggleThinking(entry, event.currentTarget.checked)
1080
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.thinking") })]
1081
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1082
- style: {
1083
- display: "inline-flex",
1084
- alignItems: "center",
1085
- gap: "6px",
1086
- fontSize: "12px"
1087
- },
1088
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1089
- type: "checkbox",
1090
- checked: meta.image,
1091
- disabled: readonly || busy,
1092
- onChange: (event) => {
1093
- patchModel(entry.providerId, entry.index, (row) => {
1094
- row["input"] = event.currentTarget.checked ? ["text", "image"] : ["text"];
1095
- });
1096
- }
1097
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.vision") })]
1098
- })]
1099
- }),
1100
- thinking ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1101
- style: {
1102
- display: "inline-flex",
1103
- alignItems: "center",
1104
- gap: "6px",
1105
- fontSize: "12px",
1106
- margin: "0 0 8px"
1107
- },
1108
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1109
- type: "checkbox",
1110
- checked: supportsEffort,
1111
- disabled: readonly || busy,
1112
- onChange: (event) => toggleEffortCapable(entry, event.currentTarget.checked)
1113
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("card.capabilities.supportsEffort") })]
1114
- }) : null,
1115
- thinking && supportsEffort ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1116
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1117
- style: fieldLabelStyle,
1118
- children: t("card.capabilities.efforts")
1119
- }),
1120
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1121
- style: { margin: "4px 0 6px" },
1122
- children: CAPABILITY_LEVELS.map((level) => {
1123
- const wire = drafts[key]?.[level];
1124
- const on = wire !== void 0 && wire !== null;
1125
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1126
- style: levelRowStyle,
1127
- children: [
1128
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1129
- style: {
1130
- display: "inline-flex",
1131
- alignItems: "center",
1132
- gap: "6px",
1133
- fontSize: "12px"
1134
- },
1135
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1136
- type: "checkbox",
1137
- checked: on,
1138
- disabled: readonly || busy,
1139
- onChange: (event) => {
1140
- const checked = event.currentTarget.checked;
1141
- setDrafts((current) => {
1142
- const draft = { ...current[key] ?? {} };
1143
- draft[level] = checked ? level === "off" ? "" : level : null;
1144
- return {
1145
- ...current,
1146
- [key]: draft
1147
- };
1148
- });
1149
- }
1150
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: level })]
1151
- }),
1152
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1153
- style: levelNameStyle,
1154
- children: level === "off" ? t("card.capabilities.offPlaceholder") : "→"
1155
- }),
1156
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1157
- type: "text",
1158
- value: wire ?? "",
1159
- disabled: readonly || busy || !on,
1160
- placeholder: t("card.capabilities.wirePlaceholder"),
1161
- style: wireInputStyle,
1162
- onChange: (event) => {
1163
- setDrafts((current) => {
1164
- const draft = { ...current[key] ?? {} };
1165
- draft[level] = event.currentTarget.value;
1166
- return {
1167
- ...current,
1168
- [key]: draft
1169
- };
1170
- });
1171
- }
1172
- })
1173
- ]
1174
- }, level);
1175
- })
1176
- }),
1177
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1178
- style: {
1179
- display: "flex",
1180
- gap: "8px",
1181
- flexWrap: "wrap"
1182
- },
1183
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1184
- type: "button",
1185
- disabled: readonly || busy,
1186
- onClick: () => applyDraft(entry),
1187
- style: {
1188
- ...controlStyle,
1189
- cursor: readonly || busy ? "default" : "pointer",
1190
- opacity: readonly || busy ? .5 : 1
1191
- },
1192
- children: t("card.capabilities.applyLevel")
1193
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1194
- type: "button",
1195
- disabled: readonly || busy,
1196
- onClick: () => resetDraft(entry),
1197
- style: {
1198
- ...controlStyle,
1199
- cursor: readonly || busy ? "default" : "pointer",
1200
- opacity: readonly || busy ? .5 : 1
1201
- },
1202
- children: t("card.capabilities.restoreDefault")
1203
- })]
1204
- })
1205
- ] }) : null,
1206
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1207
- style: {
1208
- display: "flex",
1209
- gap: "16px",
1210
- flexWrap: "wrap",
1211
- marginTop: "10px"
1212
- },
1213
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1214
- style: fieldStyle,
1215
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1216
- style: fieldLabelStyle,
1217
- children: t("card.capabilities.thinkingFormat")
1218
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
1219
- style: controlStyle,
1220
- value: format ?? "inherit",
1221
- disabled: readonly || busy,
1222
- onChange: (event) => {
1223
- const next = event.currentTarget.value;
1224
- patchModel(entry.providerId, entry.index, (row) => {
1225
- patchCompat(row, (compat) => {
1226
- if (next === "inherit") delete compat["thinkingFormat"];
1227
- else compat["thinkingFormat"] = next;
1228
- });
1229
- });
1230
- },
1231
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1232
- value: "inherit",
1233
- children: t("card.capabilities.thinkingFormat.inherit")
1234
- }), THINKING_FORMATS.map((formatOption) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1235
- value: formatOption,
1236
- children: formatOption
1237
- }, formatOption))]
1238
- })]
1239
- })
1240
- }),
1241
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1242
- style: {
1243
- display: "flex",
1244
- gap: "16px",
1245
- flexWrap: "wrap",
1246
- marginTop: "10px"
1247
- },
1248
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1249
- style: fieldStyle,
1250
- children: [
1251
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1252
- style: fieldLabelStyle,
1253
- children: t("card.capabilities.contextWindow")
1254
- }),
1255
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1256
- style: {
1257
- display: "flex",
1258
- gap: "6px",
1259
- flexWrap: "wrap",
1260
- alignItems: "center"
1261
- },
1262
- children: [
1263
- CONTEXT_WINDOW_PRESETS.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1264
- type: "button",
1265
- disabled: readonly || busy,
1266
- onClick: () => applyContextPreset(entry, preset.value),
1267
- style: {
1268
- ...controlStyle,
1269
- padding: "2px 8px",
1270
- cursor: readonly || busy ? "default" : "pointer",
1271
- opacity: readonly || busy ? .5 : 1
1272
- },
1273
- children: preset.label
1274
- }, preset.value)),
1275
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1276
- type: "text",
1277
- value: contextRaw[key] ?? "",
1278
- disabled: readonly || busy,
1279
- placeholder: t("card.capabilities.contextCustomPlaceholder"),
1280
- style: {
1281
- ...controlStyle,
1282
- width: "120px"
1283
- },
1284
- onChange: (event) => {
1285
- const next = event.currentTarget.value;
1286
- setContextRaw((current) => ({
1287
- ...current,
1288
- [key]: next
1289
- }));
1290
- },
1291
- onBlur: () => applyContextInput(entry),
1292
- onKeyDown: (event) => {
1293
- if (event.key === "Enter") event.currentTarget.blur();
1294
- }
1295
- }),
1296
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1297
- type: "button",
1298
- disabled: readonly || busy,
1299
- onClick: () => clearContext(entry),
1300
- style: {
1301
- ...controlStyle,
1302
- cursor: readonly || busy ? "default" : "pointer",
1303
- opacity: readonly || busy ? .5 : 1
1304
- },
1305
- children: t("card.capabilities.contextClear")
1306
- })
1307
- ]
1308
- }),
1309
- contextError[key] !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1310
- style: {
1311
- margin: 0,
1312
- fontSize: "12px",
1313
- lineHeight: "18px",
1314
- color: "var(--dsw-alias-danger, #e5484d)"
1315
- },
1316
- children: contextError[key]
1317
- }) : null
1318
- ]
1319
- })
1320
- })
1321
- ]
1322
- }) : null] }, key);
1323
- }) : null]
1324
- }, providerId);
1325
- }),
1326
- readonly ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1327
- style: hintStyle,
1328
- children: t("card.readonly")
1329
- }) : null
1330
- ]
1331
- });
1332
- }
1333
- /**
1334
- * The card body, wrapped in a disclosure shell like every peer settings card:
1335
- * a header (name + description + chevron) that toggles the body, collapsed by
1336
- * default so the plugin tab stays a tidy list of drawers.
1337
- * @param props - locale copy and the injected scopes.
1338
- */
1339
- function ThinkingLevelsCard({ t, scope, piAiScope }) {
1340
- const [open, setOpen] = (0, react.useState)(false);
1341
- const snapshot = (0, react.useSyncExternalStore)((listener) => scope.subscribe(listener), () => scope.getSnapshot());
1342
- const unavailable = snapshot.status === "unavailable";
1343
- const readonly = unavailable || !snapshot.writable;
1344
- const value = snapshot.value ?? {};
1345
- const level = EFFORT_OPTIONS.includes(value.level) ? value.level : "auto";
1346
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1347
- style: {
1348
- border: "1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))",
1349
- background: "var(--dsw-alias-bg-layer-3, rgba(127,127,127,0.05))",
1350
- borderRadius: "12px",
1351
- transition: "border-color 0.16s, background 0.16s"
1352
- },
1353
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1354
- type: "button",
1355
- "aria-expanded": open,
1356
- style: {
1357
- appearance: "none",
1358
- width: "100%",
1359
- font: "inherit",
1360
- color: "inherit",
1361
- textAlign: "left",
1362
- cursor: "pointer",
1363
- background: "none",
1364
- border: 0,
1365
- borderRadius: "12px",
1366
- display: "flex",
1367
- alignItems: "center",
1368
- gap: "12px",
1369
- padding: "14px 16px"
1370
- },
1371
- onClick: () => {
1372
- setOpen((current) => !current);
1373
- },
1374
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1375
- style: {
1376
- flex: "1 1 0%",
1377
- minWidth: 0
1378
- },
1379
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1380
- style: {
1381
- fontSize: "14px",
1382
- fontWeight: 600,
1383
- color: "var(--dsw-alias-label-primary)"
1384
- },
1385
- children: t("card.title")
1386
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1387
- style: {
1388
- color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
1389
- fontSize: "13px",
1390
- lineHeight: 1.5
1391
- },
1392
- children: t("card.description")
1393
- })]
1394
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1395
- width: "16",
1396
- height: "16",
1397
- viewBox: "0 0 16 16",
1398
- "aria-hidden": true,
1399
- style: {
1400
- color: "var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))",
1401
- flex: "0 0 auto",
1402
- transition: "transform 0.16s",
1403
- transform: open ? "rotate(180deg)" : "none"
1404
- },
1405
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
1406
- d: "M4 6l4 4 4-4",
1407
- fill: "none",
1408
- stroke: "currentColor",
1409
- strokeWidth: "1.5",
1410
- strokeLinecap: "round",
1411
- strokeLinejoin: "round"
1412
- })
1413
- })]
1414
- }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1415
- style: { padding: "12px 16px" },
1416
- children: unavailable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1417
- style: {
1418
- fontSize: "13px",
1419
- color: "var(--dsw-alias-label-tertiary)"
1420
- },
1421
- children: t("card.unavailable")
1422
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1423
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1424
- style: rowStyle$1,
1425
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1426
- htmlFor: "plugin-config-thinking-levels-level",
1427
- style: labelStyle$1,
1428
- children: t("card.level")
1429
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
1430
- id: "plugin-config-thinking-levels-level",
1431
- value: level,
1432
- disabled: readonly,
1433
- style: controlStyle,
1434
- onChange: (event) => {
1435
- scope.set("level", event.currentTarget.value);
1436
- },
1437
- children: EFFORT_OPTIONS.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
1438
- value: option,
1439
- children: t(`card.level.${option}`)
1440
- }, option))
1441
- })]
1442
- }),
1443
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1444
- style: rowStyle$1,
1445
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1446
- htmlFor: "plugin-config-thinking-levels-enabled",
1447
- style: labelStyle$1,
1448
- children: t("card.enabled")
1449
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1450
- id: "plugin-config-thinking-levels-enabled",
1451
- type: "checkbox",
1452
- checked: value.enabled ?? true,
1453
- disabled: readonly,
1454
- onChange: (event) => {
1455
- scope.set("enabled", event.currentTarget.checked);
1456
- }
1457
- })]
1458
- }),
1459
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1460
- style: rowStyle$1,
1461
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1462
- htmlFor: "plugin-config-thinking-levels-downgrade",
1463
- style: labelStyle$1,
1464
- children: t("card.allowDowngrade")
1465
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1466
- id: "plugin-config-thinking-levels-downgrade",
1467
- type: "checkbox",
1468
- checked: value.allowDowngrade ?? true,
1469
- disabled: readonly || value.level !== "auto",
1470
- onChange: (event) => {
1471
- scope.set("allowDowngrade", event.currentTarget.checked);
1472
- }
1473
- })]
1474
- }),
1475
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1476
- style: rowStyle$1,
1477
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
1478
- htmlFor: "plugin-config-thinking-levels-upgrade",
1479
- style: labelStyle$1,
1480
- children: t("card.allowUpgrade")
1481
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1482
- id: "plugin-config-thinking-levels-upgrade",
1483
- type: "checkbox",
1484
- checked: value.allowUpgrade ?? false,
1485
- disabled: readonly || value.level !== "auto",
1486
- onChange: (event) => {
1487
- scope.set("allowUpgrade", event.currentTarget.checked);
1488
- }
1489
- })]
1490
- }),
1491
- !snapshot.writable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1492
- style: {
1493
- margin: "8px 0 0",
1494
- fontSize: "12px",
1495
- color: "var(--dsw-alias-label-tertiary)"
1496
- },
1497
- children: t("card.readonly")
1498
- }),
1499
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelCapabilities, {
1500
- scope: piAiScope,
1501
- t,
1502
- readonly
1503
- })
1504
- ] })
1505
- }) : null]
1506
- });
1507
- }
1508
- //#endregion
1509
347
  //#region src/client/context-quick.tsx
1510
348
  /**
1511
349
  * Context-window quick control for the composer tool row
@@ -1528,16 +366,16 @@ window.__ModuleLoader__.load({
1528
366
  * whole slot entry down. A harness that provides neither seat renders nothing
1529
367
  * here instead of a dead control.
1530
368
  *
1531
- * Two model families are served, each with its own writable settings
1532
- * namespace (both consumed live by `resolveModelInfo(...).context.contextWindow`,
369
+ * Two model families are served, each with its own writable config form
370
+ * (both consumed live by `resolveModelInfo(...).context.contextWindow`,
1533
371
  * so a write takes effect on the next request without a restart):
1534
372
  * - Custom gateways (`llm-pi-ai` providers): writes the model entry's
1535
373
  * `contextWindow` under `providers[provider].models[i]`.
1536
374
  * - Official DeepSeek models (`deepseek-official`, the `llm-deepseek`
1537
- * namespace): writes the catalog model's `contextWindow` when the model is
375
+ * entry): writes the catalog model's `contextWindow` when the model is
1538
376
  * listed, otherwise caps via `defaultContextWindow`.
1539
377
  *
1540
- * Write discipline: dragging the slider only moves a local draft; the settings
378
+ * Write discipline: dragging the slider only moves a local draft; the config
1541
379
  * write happens once per gesture (pointer release, key release, blur), so a
1542
380
  * drag never floods the host with intermediate values.
1543
381
  *
@@ -2019,16 +857,14 @@ window.__ModuleLoader__.load({
2019
857
  }
2020
858
  //#endregion
2021
859
  //#region src/client/index.ts
2022
- /** The settings namespace the host half registers (kept in lockstep with src/index.ts). */
2023
- const THINKING_LEVELS_NS = "thinking-levels";
2024
860
  /** Services required by the browser half. */
2025
861
  const inject = [
2026
862
  "slots",
2027
863
  "locale",
2028
- "settingsScope"
864
+ "configForms"
2029
865
  ];
2030
866
  /**
2031
- * Client plugin body: dictionaries plus the settings card registration.
867
+ * Client plugin body: dictionaries plus the composer quick-control slot.
2032
868
  * @param ctx - client root context.
2033
869
  */
2034
870
  function apply(ctx) {
@@ -2045,20 +881,6 @@ window.__ModuleLoader__.load({
2045
881
  for (const dispose of disposers) dispose();
2046
882
  };
2047
883
  }, "dsh-thinking-levels: dictionaries");
2048
- ctx.slots.inject("settings.plugin.item", function* () {
2049
- yield ctx.slots.register({
2050
- name: "settings.plugin.item",
2051
- id: THINKING_LEVELS_NS,
2052
- key: THINKING_LEVELS_NS,
2053
- locale: NS,
2054
- inject: () => {
2055
- return {
2056
- scope: ctx.settingsScope.bind({ namespace: THINKING_LEVELS_NS }),
2057
- piAiScope: ctx.settingsScope.bind({ namespace: "llm-pi-ai" })
2058
- };
2059
- }
2060
- }, ThinkingLevelsCard);
2061
- });
2062
884
  ctx.slots.inject("conversation.input.right", function* () {
2063
885
  yield ctx.slots.register({
2064
886
  name: "conversation.input.right",
@@ -2066,8 +888,8 @@ window.__ModuleLoader__.load({
2066
888
  locale: NS,
2067
889
  inject: () => {
2068
890
  return {
2069
- piAiScope: ctx.settingsScope.bind({ namespace: "llm-pi-ai" }),
2070
- deepseekScope: ctx.settingsScope.bind({ namespace: "llm-deepseek" })
891
+ piAiScope: ctx.configForms.get("llm-pi-ai"),
892
+ deepseekScope: ctx.configForms.get("llm-deepseek")
2071
893
  };
2072
894
  }
2073
895
  }, ContextQuick);