dsh-thinking-lang 1.0.6 → 1.0.8

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/client/client.js CHANGED
@@ -23,30 +23,43 @@ window.__ModuleLoader__.load({
23
23
  tag: "zh-CN",
24
24
  nativeName: "简体中文",
25
25
  section: "推理规则:思考、推理与规划一律使用简体中文。回复用户时使用用户所用的语言。",
26
- reminder: "继续用简体中文思考、推理与规划。"
26
+ reminder: "注意:思考、推理与规划用简体中文,即使上文不是",
27
+ tail: "下文请使用简体中文思考"
27
28
  },
28
29
  {
29
30
  tag: "zh-TW",
30
31
  nativeName: "繁體中文",
31
32
  section: "推理規則:思考、推理與規劃一律使用繁體中文。回覆使用者時使用使用者所用的語言。",
32
- reminder: "繼續用繁體中文思考、推理與規劃。"
33
+ reminder: "注意:思考、推理與規劃用繁體中文,即使上文不是",
34
+ tail: "下文請使用繁體中文思考"
33
35
  },
34
36
  {
35
37
  tag: "en",
36
38
  nativeName: "English",
37
39
  section: "Reasoning rules: think, reason, and plan in English. Reply to the user in the language they use.",
38
- reminder: "Keep thinking, reasoning, and planning in English."
40
+ reminder: "Note: think, reason, and plan in English, even if the text above is not",
41
+ tail: "Think in English from here on"
39
42
  }
40
43
  ];
41
44
  /** The sentinel meaning "follow the host locale". / 表示「跟随宿主语言」的哨兵值。 */
42
45
  const AUTO = "auto";
43
46
  /** Settings namespace owned by this plugin. / 本插件拥有的设置命名空间。 */
44
47
  const SETTINGS_NAMESPACE = "ay-dsh-tk-lang";
45
- /** The one field this plugin stores. / 本插件唯一保存的字段。 */
48
+ /** The language field this plugin stores. / 本插件保存的语言字段。 */
46
49
  const FIELD_LANGUAGE = "language";
50
+ /** The reminder field this plugin stores. / 本插件保存的提醒字段。 */
51
+ const FIELD_REMINDER = "reminderMinutes";
52
+ /** The extra-injection field this plugin stores. / 本插件保存的额外注入字段。 */
53
+ const FIELD_EXTRA = "extraInjection";
54
+ /** Largest accepted reminder interval. / 允许的最大提醒间隔(分钟)。 */
55
+ const MAX_REMINDER_MINUTES = 1440;
47
56
  CATALOGUE.map((language) => language.tag);
48
- /** Configuration applied when the field is absent. / 字段缺失时采用的配置。 */
49
- const DEFAULTS = { language: AUTO };
57
+ /** Configuration applied when the fields are absent. / 字段缺失时采用的配置。 */
58
+ const DEFAULTS = {
59
+ language: AUTO,
60
+ reminderMinutes: 30,
61
+ extraInjection: true
62
+ };
50
63
  /** Catalogue lookup keyed by lower-cased tag. / 以小写标签为键的目录索引。 */
51
64
  const BY_TAG = new Map(CATALOGUE.map((language) => [language.tag.toLowerCase(), language]));
52
65
  /**
@@ -68,38 +81,81 @@ window.__ModuleLoader__.load({
68
81
  * Coerce an untrusted settings section into a complete configuration.
69
82
  * 把不可信的设置段强制转换为完整配置。
70
83
  */
84
+ /** Clamp one untrusted reminder value into the accepted range; any negative value disables it. / 把不可信的提醒值收敛到允许范围;负数一律视为关闭。 */
85
+ function normalizeReminder(raw) {
86
+ const numeric = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
87
+ if (!Number.isFinite(numeric)) return 30;
88
+ const rounded = Math.round(numeric);
89
+ if (rounded < 0) return -1;
90
+ return rounded > 1440 ? MAX_REMINDER_MINUTES : rounded;
91
+ }
92
+ /** Coerce one untrusted extra-injection value; only an explicit false turns it off. / 把不可信的额外注入值收敛为布尔;只有明确的 false 视为关闭。 */
93
+ function normalizeExtra(raw) {
94
+ return raw !== false && raw !== "false";
95
+ }
71
96
  function normalizeSettings(raw) {
72
- const stored = raw !== null && typeof raw === "object" && !Array.isArray(raw) ? raw[FIELD_LANGUAGE] : void 0;
73
- return { language: typeof stored === "string" && stored !== "" ? stored : DEFAULTS.language };
97
+ const section = raw !== null && typeof raw === "object" && !Array.isArray(raw) ? raw : void 0;
98
+ const stored = section?.[FIELD_LANGUAGE];
99
+ return {
100
+ language: typeof stored === "string" && stored !== "" ? stored : DEFAULTS.language,
101
+ reminderMinutes: normalizeReminder(section?.[FIELD_REMINDER]),
102
+ extraInjection: normalizeExtra(section?.[FIELD_EXTRA])
103
+ };
74
104
  }
75
105
  /** Dictionaries keyed by UI locale, handed to the host locale service. / 以界面语言为键、交给宿主 locale 服务的字典。 */
76
106
  const dictionaries = {
77
107
  zh: {
78
108
  heading: "思考语言",
79
109
  description: "内部推理与规划使用的语言。「自动」优先跟随操作系统语言,其次是界面语言。",
80
- autoLabel: "自动"
110
+ autoLabel: "自动",
111
+ reminderHeading: "提醒间隔",
112
+ reminderDescription: "两次提醒之间的最小间隔;关闭后只保留系统提示里的规则。",
113
+ reminderOff: "关闭",
114
+ reminderTurn: "每轮",
115
+ reminderCustom: "自定义",
116
+ reminderUnit: "分钟",
117
+ reminderCustomHint: "1–1440 分钟",
118
+ extraHeading: "额外提醒注入",
119
+ extraDescription: "开启后把提醒同时并入技能目录;提醒间隔为「关闭」时,此项也一并关闭。",
120
+ extraOn: "开启",
121
+ extraOff: "关闭"
81
122
  },
82
123
  en: {
83
124
  heading: "Thinking language",
84
125
  description: "Language used for internal reasoning and planning. Automatic follows the operating-system language first, then the UI language.",
85
- autoLabel: "Automatic"
126
+ autoLabel: "Automatic",
127
+ reminderHeading: "Reminder interval",
128
+ reminderDescription: "Minimum gap between reminders. Off keeps only the system-prompt rule.",
129
+ reminderOff: "Off",
130
+ reminderTurn: "Every turn",
131
+ reminderCustom: "Custom",
132
+ reminderUnit: "min",
133
+ reminderCustomHint: "1–1440 minutes",
134
+ extraHeading: "Extra reminder injection",
135
+ extraDescription: "Also folds the reminder into the skill catalogue. Switching the reminder interval off turns this off too.",
136
+ extraOn: "On",
137
+ extraOff: "Off"
86
138
  }
87
139
  };
88
140
  //#endregion
89
141
  //#region src/client/panel.ts
90
142
  /**
91
- * The settings row: one language picker bound to the plugin's settings document.
92
- * 设置行:一个绑定到本插件设置文档的语言选择器。
143
+ * Settings UI: the General row and the plugin's configuration card.
144
+ * 设置界面:「通用」页的设置行,以及插件详情页的配置卡片。
93
145
  *
94
- * It is registered into the General settings page (see `./index.ts`) rather than
95
- * as a section of its own, so it sits directly under the host's language row.
96
- * 它注册进「通用」设置页(见 `./index.ts`)而不是自成菜单,因此紧邻宿主自身的
97
- * 语言设置项下方。
146
+ * Both surfaces bind to the same host settings document, so a change in either
147
+ * place is visible in the other. / 两个入口绑定同一份宿主设置文档,任一处修改
148
+ * 另一处都会看到。
98
149
  *
99
- * The row owns no state of its own: it reads the host's settings document,
100
- * subscribes to it, and writes the single field back.
101
- * 本行不持有自己的状态:它读取宿主的设置文档、订阅其变化,并回写那唯一一个字段。
150
+ * The row owns no state of its own: it reads the document, subscribes to it, and
151
+ * writes the fields back. / 控件不持有自己的状态:读取文档、订阅变化、回写字段。
102
152
  */
153
+ /** Preset reminder intervals in minutes. / 预设提醒间隔(分钟)。 */
154
+ const PRESET_MINUTES = [
155
+ 10,
156
+ 30,
157
+ 60
158
+ ];
103
159
  /**
104
160
  * Read and normalize the current settings, falling back to defaults on refusal.
105
161
  * 读取并归一化当前设置;被拒绝时回退到默认值。
@@ -112,12 +168,8 @@ window.__ModuleLoader__.load({
112
168
  }
113
169
  }
114
170
  /**
115
- * Write one field back, swallowing a refusal so a read-only host cannot break the row.
116
- * 回写单个字段,并吞掉拒绝异常,使只读宿主不会让这一行崩溃。
117
- *
118
- * A host may return a promise instead of a value; an unhandled rejection from a
119
- * read-only document is not worth surfacing, so it is discarded here.
120
- * 宿主可能返回 promise 而不是值;只读文档产生的未处理拒绝不值得上抛,因此在此丢弃。
171
+ * Write one field back, swallowing a refusal so a read-only host cannot break the UI.
172
+ * 回写单个字段,并吞掉拒绝异常,使只读宿主不会让控件崩溃。
121
173
  */
122
174
  function writeField(doc, field, value) {
123
175
  try {
@@ -125,24 +177,26 @@ window.__ModuleLoader__.load({
125
177
  if (typeof outcome?.then === "function") outcome.then(void 0, () => {});
126
178
  } catch {}
127
179
  }
180
+ /** Subscribe one component to the document and re-read it on every revision. / 订阅设置文档,并在每次修订时重新读取。 */
181
+ function useSettings(doc) {
182
+ const [settings, setSettings] = (0, react.useState)(() => readSettings(doc));
183
+ (0, react.useEffect)(() => {
184
+ const sync = () => setSettings(readSettings(doc));
185
+ sync();
186
+ return doc.subscribe(sync);
187
+ }, [doc]);
188
+ return settings;
189
+ }
128
190
  /**
129
- * Build the row component bound to the host's UI primitives.
130
- * 构建绑定到宿主 UI 原语的行组件。
191
+ * Build the language picker bound to the host's UI primitives.
192
+ * 构建绑定到宿主 UI 原语的语言选择器。
131
193
  */
132
- function createRow(primitives) {
194
+ function createLanguagePicker(primitives) {
133
195
  const Menu = primitives?.Menu;
134
196
  const Chevron = primitives?.IconChevronDownOutlineRegular ?? primitives?.IconChevronDownOutline14 ?? primitives?.IconChevronDownOutlineMedium;
135
- return function ThinkingLanguageRow(props) {
136
- const { doc, t: hostT } = props;
137
- const [settings, setSettings] = (0, react.useState)(() => readSettings(doc));
197
+ return function LanguagePicker(props) {
198
+ const { doc, t, settings } = props;
138
199
  const [open, setOpen] = (0, react.useState)(false);
139
- settings.language;
140
- const t = (key) => hostT(key);
141
- (0, react.useEffect)(() => {
142
- const sync = () => setSettings(readSettings(doc));
143
- sync();
144
- return doc.subscribe(sync);
145
- }, [doc]);
146
200
  const items = [{
147
201
  id: AUTO,
148
202
  label: t("autoLabel")
@@ -152,7 +206,6 @@ window.__ModuleLoader__.load({
152
206
  }))];
153
207
  const activeLabel = settings.language === "auto" ? t("autoLabel") : nativeNameFor(settings.language) ?? settings.language;
154
208
  const close = () => setOpen(false);
155
- const toggle = () => setOpen((value) => !value);
156
209
  const choose = (id) => {
157
210
  writeField(doc, FIELD_LANGUAGE, id);
158
211
  close();
@@ -162,9 +215,10 @@ window.__ModuleLoader__.load({
162
215
  className: "dsh_desk_lang_picker",
163
216
  "aria-haspopup": "menu",
164
217
  "aria-expanded": open,
165
- onClick: toggle
218
+ onClick: () => setOpen((value) => !value)
166
219
  }, activeLabel, Chevron === void 0 ? null : (0, react.createElement)(Chevron, { className: "dsh_desk_lang_chevron" }));
167
- const control = Menu ? (0, react.createElement)(Menu, {
220
+ if (!Menu) return picker;
221
+ return (0, react.createElement)(Menu, {
168
222
  open,
169
223
  anchor: picker,
170
224
  items,
@@ -173,33 +227,213 @@ window.__ModuleLoader__.load({
173
227
  portal: true,
174
228
  onClose: close,
175
229
  onSelect: choose
230
+ });
231
+ };
232
+ }
233
+ /** Map a stored minute count onto the picker id it should show. / 把存储的分钟数映射成选择器应显示的选项 id。 */
234
+ function derivedPreset(minutes) {
235
+ if (minutes < 0) return "off";
236
+ if (minutes === 0) return "turn";
237
+ const preset = PRESET_MINUTES.find((candidate) => candidate === minutes);
238
+ return preset === void 0 ? "custom" : String(preset);
239
+ }
240
+ /**
241
+ * Build the reminder picker: presets, every turn, off, and a custom minute count.
242
+ * 构建提醒选择器:预设、每轮、关闭,以及自定义分钟数。
243
+ *
244
+ * It uses the host Menu like the language picker, so the two controls match;
245
+ * a native `<select>` renders its own list chrome and breaks the row style.
246
+ * 与语言选择器一样使用宿主 Menu,两个控件因此外观一致;原生 `<select>` 的下拉列表
247
+ * 自带浏览器样式,会破坏这一行。
248
+ */
249
+ function createReminderPicker(primitives) {
250
+ const Menu = primitives?.Menu;
251
+ const Chevron = primitives?.IconChevronDownOutlineRegular ?? primitives?.IconChevronDownOutline14 ?? primitives?.IconChevronDownOutlineMedium;
252
+ return function ReminderPicker(props) {
253
+ const { doc, t, settings } = props;
254
+ const derived = derivedPreset(settings.reminderMinutes);
255
+ const current = settings.reminderMinutes > 0 ? settings.reminderMinutes : 30;
256
+ const [selected, setSelected] = (0, react.useState)(derived);
257
+ const [open, setOpen] = (0, react.useState)(false);
258
+ const [draft, setDraft] = (0, react.useState)(String(current));
259
+ (0, react.useEffect)(() => {
260
+ setSelected(derived);
261
+ }, [derived]);
262
+ (0, react.useEffect)(() => {
263
+ setDraft(String(current));
264
+ }, [current]);
265
+ const labelOf = (id) => {
266
+ if (id === "off") return t("reminderOff");
267
+ if (id === "turn") return t("reminderTurn");
268
+ if (id === "custom") return t("reminderCustom");
269
+ return `${id} ${t("reminderUnit")}`;
270
+ };
271
+ const items = [
272
+ "off",
273
+ "turn",
274
+ ...PRESET_MINUTES.map(String),
275
+ "custom"
276
+ ].map((id) => ({
277
+ id,
278
+ label: labelOf(id)
279
+ }));
280
+ const choose = (id) => {
281
+ setOpen(false);
282
+ setSelected(id);
283
+ if (id === "off") writeField(doc, FIELD_REMINDER, -1);
284
+ else if (id === "turn") writeField(doc, FIELD_REMINDER, 0);
285
+ else if (id !== "custom") writeField(doc, FIELD_REMINDER, Number(id));
286
+ };
287
+ const commit = () => {
288
+ const minutes = Math.round(Number(draft));
289
+ if (!Number.isFinite(minutes) || draft.trim() === "") {
290
+ setDraft(String(current));
291
+ return;
292
+ }
293
+ const clamped = Math.min(MAX_REMINDER_MINUTES, Math.max(1, minutes));
294
+ writeField(doc, FIELD_REMINDER, clamped);
295
+ setDraft(String(clamped));
296
+ };
297
+ const picker = (0, react.createElement)("button", {
298
+ type: "button",
299
+ className: "dsh_desk_lang_picker",
300
+ "aria-haspopup": "menu",
301
+ "aria-expanded": open,
302
+ onClick: () => setOpen((value) => !value)
303
+ }, labelOf(selected), Chevron === void 0 ? null : (0, react.createElement)(Chevron, { className: "dsh_desk_lang_chevron" }));
304
+ const control = Menu ? (0, react.createElement)(Menu, {
305
+ open,
306
+ anchor: picker,
307
+ items,
308
+ selectedId: selected,
309
+ align: "end",
310
+ portal: true,
311
+ onClose: () => setOpen(false),
312
+ onSelect: choose
176
313
  }) : picker;
177
- return (0, react.createElement)("div", { className: "dsh_desk_lang_row" }, (0, react.createElement)("div", { className: "dsh_desk_lang_text" }, (0, react.createElement)("div", { className: "dsh_desk_lang_title" }, t("heading")), (0, react.createElement)("div", { className: "dsh_desk_lang_desc" }, t("description"))), control);
314
+ if (selected !== "custom") return control;
315
+ return (0, react.createElement)("div", { className: "dsh_desk_lang_control" }, control, (0, react.createElement)("input", {
316
+ type: "number",
317
+ className: "dsh_desk_lang_input",
318
+ min: 1,
319
+ max: MAX_REMINDER_MINUTES,
320
+ placeholder: String(settings.reminderMinutes > 0 ? settings.reminderMinutes : 30),
321
+ value: draft,
322
+ onChange: (event) => setDraft(event.currentTarget.value),
323
+ onBlur: commit,
324
+ onKeyDown: (event) => {
325
+ if (event.key === "Enter") commit();
326
+ }
327
+ }), (0, react.createElement)("span", { className: "dsh_desk_lang_hint" }, t("reminderCustomHint")));
328
+ };
329
+ }
330
+ /**
331
+ * Build the extra-injection picker: on or off.
332
+ * 构建额外注入选择器:开启或关闭。
333
+ *
334
+ * It shares the host Menu with the other controls, so the three read as one column.
335
+ * 与另外两个控件共用宿主 Menu,三者在视觉上成一列。
336
+ */
337
+ function createExtraPicker(primitives) {
338
+ const Menu = primitives?.Menu;
339
+ const Chevron = primitives?.IconChevronDownOutlineRegular ?? primitives?.IconChevronDownOutline14 ?? primitives?.IconChevronDownOutlineMedium;
340
+ return function ExtraPicker(props) {
341
+ const { doc, t, settings, disabled = false } = props;
342
+ const [open, setOpen] = (0, react.useState)(false);
343
+ const items = [{
344
+ id: "on",
345
+ label: t("extraOn")
346
+ }, {
347
+ id: "off",
348
+ label: t("extraOff")
349
+ }];
350
+ const close = () => setOpen(false);
351
+ const choose = (id) => {
352
+ writeField(doc, FIELD_EXTRA, id === "on");
353
+ close();
354
+ };
355
+ const picker = (0, react.createElement)("button", {
356
+ type: "button",
357
+ className: "dsh_desk_lang_picker",
358
+ "aria-haspopup": "menu",
359
+ "aria-expanded": open,
360
+ disabled,
361
+ onClick: () => setOpen((value) => !value)
362
+ }, settings.extraInjection ? t("extraOn") : t("extraOff"), Chevron === void 0 ? null : (0, react.createElement)(Chevron, { className: "dsh_desk_lang_chevron" }));
363
+ if (!Menu) return picker;
364
+ return (0, react.createElement)(Menu, {
365
+ open,
366
+ anchor: picker,
367
+ items,
368
+ selectedId: settings.extraInjection ? "on" : "off",
369
+ align: "end",
370
+ portal: true,
371
+ onClose: close,
372
+ onSelect: choose
373
+ });
374
+ };
375
+ }
376
+ /**
377
+ * Build the General settings row: heading, description and the language picker.
378
+ * 构建「通用」设置行:标题、说明与语言选择器。
379
+ */
380
+ function createRow(primitives) {
381
+ const LanguagePicker = createLanguagePicker(primitives);
382
+ return function ThinkingLanguageRow(props) {
383
+ const settings = useSettings(props.doc);
384
+ return (0, react.createElement)("div", { className: "dsh_desk_lang_row" }, (0, react.createElement)("div", { className: "dsh_desk_lang_text" }, (0, react.createElement)("div", { className: "dsh_desk_lang_title" }, props.t("heading")), (0, react.createElement)("div", { className: "dsh_desk_lang_desc" }, props.t("description"))), (0, react.createElement)(LanguagePicker, {
385
+ doc: props.doc,
386
+ t: props.t,
387
+ settings
388
+ }));
389
+ };
390
+ }
391
+ /**
392
+ * Build the plugin configuration card: language and reminder interval.
393
+ * 构建插件配置卡片:思考语言与提醒间隔。
394
+ *
395
+ * The host renders this inside the plugin's detail page; `view: 'summary'` is the
396
+ * one-line form a card may ask for, which this plugin leaves empty.
397
+ * 宿主把它渲染在插件详情页里;`view: 'summary'` 是卡片可能请求的单行形式,本插件
398
+ * 留空。
399
+ */
400
+ function createConfigCard(primitives) {
401
+ const LanguagePicker = createLanguagePicker(primitives);
402
+ const ReminderPicker = createReminderPicker(primitives);
403
+ const ExtraPicker = createExtraPicker(primitives);
404
+ return function ThinkingLanguageCard(props) {
405
+ const settings = useSettings(props.doc);
406
+ if (props.view === "summary") return null;
407
+ const binding = {
408
+ doc: props.doc,
409
+ t: props.t,
410
+ settings
411
+ };
412
+ const reminderOff = settings.reminderMinutes < 0;
413
+ return (0, react.createElement)("div", null, (0, react.createElement)("div", { className: "dsh_desk_lang_row" }, (0, react.createElement)("div", { className: "dsh_desk_lang_text" }, (0, react.createElement)("div", { className: "dsh_desk_lang_title" }, props.t("heading")), (0, react.createElement)("div", { className: "dsh_desk_lang_desc" }, props.t("description"))), (0, react.createElement)(LanguagePicker, binding)), (0, react.createElement)("div", { className: "dsh_desk_lang_row" }, (0, react.createElement)("div", { className: "dsh_desk_lang_text" }, (0, react.createElement)("div", { className: "dsh_desk_lang_title" }, props.t("reminderHeading")), (0, react.createElement)("div", { className: "dsh_desk_lang_desc" }, props.t("reminderDescription"))), (0, react.createElement)(ReminderPicker, binding)), (0, react.createElement)("div", { className: reminderOff ? "dsh_desk_lang_row dsh_desk_lang_row_disabled" : "dsh_desk_lang_row" }, (0, react.createElement)("div", { className: "dsh_desk_lang_text" }, (0, react.createElement)("div", { className: "dsh_desk_lang_title" }, props.t("extraHeading")), (0, react.createElement)("div", { className: "dsh_desk_lang_desc" }, props.t("extraDescription"))), (0, react.createElement)(ExtraPicker, {
414
+ ...binding,
415
+ disabled: reminderOff
416
+ })));
178
417
  };
179
418
  }
180
419
  const rowCss = [
181
420
  ".dsh_desk_lang_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}",
421
+ ".dsh_desk_lang_row_disabled{opacity:.45;pointer-events:none}",
182
422
  ".dsh_desk_lang_text{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}",
183
423
  ".dsh_desk_lang_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}",
184
424
  ".dsh_desk_lang_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}",
185
425
  ".dsh_desk_lang_picker{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex;flex:none}",
186
426
  ".dsh_desk_lang_picker:hover{background:var(--dsw-alias-interactive-bg-hover)}",
187
- ".dsh_desk_lang_chevron{flex:none}"
427
+ ".dsh_desk_lang_chevron{flex:none}",
428
+ ".dsh_desk_lang_control{align-items:center;gap:8px;display:flex;flex:none}",
429
+ ".dsh_desk_lang_input{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);height:36px;width:88px;font:inherit;color:var(--dsw-alias-label-primary);border:none;padding:0 12px;font-size:14px}",
430
+ ".dsh_desk_lang_hint{color:var(--dsw-alias-label-tertiary);font-size:12px;white-space:nowrap}"
188
431
  ].join("\n");
189
432
  /** Marks the injected stylesheet, so a second mount can detect the first. / 标记已注入的样式表,使第二次挂载能发现第一次。 */
190
433
  const STYLE_MARKER = "dsh-thinking-lang";
191
434
  /**
192
- * Inject the row stylesheet once per document, replacing a stale one.
193
- * 每份文档只注入一次行样式表,已过期的那张会被替换。
194
- *
195
- * The guard reads the document rather than a module-level flag: a client plugin
196
- * can be mounted more than once against the same page, and only the DOM knows
197
- * whether this sheet is already there. Content is compared as well, because a
198
- * hot-reloaded bundle keeps its marker while its CSS changes; skipping on the
199
- * marker alone would leave the row styled by class names that no longer exist.
200
- * 判重依据是文档本身而不是模块级标志:客户端插件可能被重复挂载到同一页面,只有 DOM
201
- * 知道这张样式表是否已经存在。同时比对内容:热重载的 bundle 标记不变而 CSS 已变,
202
- * 只看标记就跳过会让这一行按已不存在的类名取样式。
435
+ * Inject the settings stylesheet once per document, replacing a stale one.
436
+ * 每份文档只注入一次设置样式表,已过期的那张会被替换。
203
437
  */
204
438
  function mountRowStyles() {
205
439
  if (typeof document === "undefined") return;
@@ -228,6 +462,8 @@ window.__ModuleLoader__.load({
228
462
  */
229
463
  /** Stable Cordis plugin name. / 稳定的 Cordis 插件名。 */
230
464
  const name = "ay-dsh-tk-lang";
465
+ /** Package name; the key Plugins page uses to find a bundle's configuration page. / 包名;插件页用它查找某个 bundle 的配置页。 */
466
+ const PACKAGE_NAME = "dsh-thinking-lang";
231
467
  /** The one client service this plugin requires. / 本插件唯一需要的客户端服务。 */
232
468
  const inject = ["slots"];
233
469
  /** Locale namespace holding the row copy. / 保存行文案的 locale 命名空间。 */
@@ -298,6 +534,21 @@ window.__ModuleLoader__.load({
298
534
  })
299
535
  }, Row);
300
536
  });
537
+ const whileServed = typeof forms.whileServed === "function" ? forms.whileServed.bind(forms) : void 0;
538
+ if (whileServed === void 0) {
539
+ report(uiCtx, "configForms.whileServed unavailable; plugin configuration page disabled");
540
+ return;
541
+ }
542
+ const Card = createConfigCard(primitives);
543
+ uiCtx.effect(() => whileServed([SETTINGS_NAMESPACE], () => uiCtx.slots.inject("plugins.bundle.config", () => uiCtx.slots.register({
544
+ name: "plugins.bundle.config",
545
+ key: PACKAGE_NAME,
546
+ locale: LOCALE_NS,
547
+ inject: () => ({
548
+ doc,
549
+ t
550
+ })
551
+ }, Card))), "dsh-thinking-lang: plugin configuration page");
301
552
  });
302
553
  }
303
554
  //#endregion