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/lib/core.js CHANGED
@@ -42,19 +42,22 @@ export const CATALOGUE = [
42
42
  tag: "zh-CN",
43
43
  nativeName: "简体中文",
44
44
  section: "推理规则:思考、推理与规划一律使用简体中文。回复用户时使用用户所用的语言。",
45
- reminder: "继续用简体中文思考、推理与规划。"
45
+ reminder: "注意:思考、推理与规划用简体中文,即使上文不是",
46
+ tail: "下文请使用简体中文思考"
46
47
  },
47
48
  {
48
49
  tag: "zh-TW",
49
50
  nativeName: "繁體中文",
50
51
  section: "推理規則:思考、推理與規劃一律使用繁體中文。回覆使用者時使用使用者所用的語言。",
51
- reminder: "繼續用繁體中文思考、推理與規劃。"
52
+ reminder: "注意:思考、推理與規劃用繁體中文,即使上文不是",
53
+ tail: "下文請使用繁體中文思考"
52
54
  },
53
55
  {
54
56
  tag: "en",
55
57
  nativeName: "English",
56
58
  section: "Reasoning rules: think, reason, and plan in English. Reply to the user in the language they use.",
57
- reminder: "Keep thinking, reasoning, and planning in English."
59
+ reminder: "Note: think, reason, and plan in English, even if the text above is not",
60
+ tail: "Think in English from here on"
58
61
  }
59
62
  ];
60
63
  /** The sentinel meaning "follow the host locale". / 表示「跟随宿主语言」的哨兵值。 */
@@ -63,12 +66,28 @@ export const AUTO = "auto";
63
66
  const FALLBACK_TAG = "zh-CN";
64
67
  /** Settings namespace owned by this plugin. / 本插件拥有的设置命名空间。 */
65
68
  export const SETTINGS_NAMESPACE = "ay-dsh-tk-lang";
66
- /** The one field this plugin stores. / 本插件唯一保存的字段。 */
69
+ /** The language field this plugin stores. / 本插件保存的语言字段。 */
67
70
  export const FIELD_LANGUAGE = "language";
71
+ /** The reminder field this plugin stores. / 本插件保存的提醒字段。 */
72
+ export const FIELD_REMINDER = "reminderMinutes";
73
+ /** The extra-injection field this plugin stores. / 本插件保存的额外注入字段。 */
74
+ export const FIELD_EXTRA = "extraInjection";
75
+ /** Reminder value that disables the per-turn reminder. / 关闭每轮提醒的取值。 */
76
+ export const REMINDER_OFF = -1;
77
+ /** Reminder value that injects on every turn. / 每轮都注入的取值。 */
78
+ export const REMINDER_EVERY_TURN = 0;
79
+ /** Reminder interval applied when the field is absent. / 字段缺失时的提醒间隔(分钟)。 */
80
+ export const DEFAULT_REMINDER_MINUTES = 30;
81
+ /** Largest accepted reminder interval. / 允许的最大提醒间隔(分钟)。 */
82
+ export const MAX_REMINDER_MINUTES = 1440;
68
83
  /** Every value the picker offers besides {@link AUTO}. / 选择器在 {@link AUTO} 之外提供的全部取值。 */
69
84
  export const SELECTABLE_TAGS = CATALOGUE.map((language) => language.tag);
70
- /** Configuration applied when the field is absent. / 字段缺失时采用的配置。 */
71
- export const DEFAULTS = { language: AUTO };
85
+ /** Configuration applied when the fields are absent. / 字段缺失时采用的配置。 */
86
+ export const DEFAULTS = {
87
+ language: AUTO,
88
+ reminderMinutes: DEFAULT_REMINDER_MINUTES,
89
+ extraInjection: true
90
+ };
72
91
  /** Catalogue lookup keyed by lower-cased tag. / 以小写标签为键的目录索引。 */
73
92
  const BY_TAG = new Map(CATALOGUE.map((language) => [language.tag.toLowerCase(), language]));
74
93
  /**
@@ -172,10 +191,42 @@ function tagForLocale(raw) {
172
191
  * Coerce an untrusted settings section into a complete configuration.
173
192
  * 把不可信的设置段强制转换为完整配置。
174
193
  */
194
+ /** Clamp one untrusted reminder value into the accepted range; any negative value disables it. / 把不可信的提醒值收敛到允许范围;负数一律视为关闭。 */
195
+ function normalizeReminder(raw) {
196
+ const numeric = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
197
+ if (!Number.isFinite(numeric))
198
+ return DEFAULT_REMINDER_MINUTES;
199
+ const rounded = Math.round(numeric);
200
+ if (rounded < 0)
201
+ return REMINDER_OFF;
202
+ return rounded > MAX_REMINDER_MINUTES ? MAX_REMINDER_MINUTES : rounded;
203
+ }
204
+ /** Coerce one untrusted extra-injection value; only an explicit false turns it off. / 把不可信的额外注入值收敛为布尔;只有明确的 false 视为关闭。 */
205
+ function normalizeExtra(raw) {
206
+ return raw !== false && raw !== "false";
207
+ }
208
+ /**
209
+ * Convert stored minutes into the minimum gap between reminders.
210
+ * 把存储的分钟数换算成两次提醒之间的最小间隔。
211
+ *
212
+ * Returns {@link REMINDER_OFF} when the reminder is disabled and `0` when it runs
213
+ * on every turn. / 关闭时返回 {@link REMINDER_OFF},每轮注入时返回 `0`。
214
+ */
215
+ export function reminderDelayMs(minutes) {
216
+ if (minutes < 0)
217
+ return REMINDER_OFF;
218
+ if (minutes === REMINDER_EVERY_TURN)
219
+ return 0;
220
+ return minutes * 60_000;
221
+ }
175
222
  export function normalizeSettings(raw) {
176
- const isSection = raw !== null && typeof raw === "object" && !Array.isArray(raw);
177
- const stored = isSection ? raw[FIELD_LANGUAGE] : undefined;
178
- return { language: typeof stored === "string" && stored !== "" ? stored : DEFAULTS.language };
223
+ const section = raw !== null && typeof raw === "object" && !Array.isArray(raw) ? raw : undefined;
224
+ const stored = section?.[FIELD_LANGUAGE];
225
+ return {
226
+ language: typeof stored === "string" && stored !== "" ? stored : DEFAULTS.language,
227
+ reminderMinutes: normalizeReminder(section?.[FIELD_REMINDER]),
228
+ extraInjection: normalizeExtra(section?.[FIELD_EXTRA])
229
+ };
179
230
  }
180
231
  /**
181
232
  * Resolve the effective language for `auto`, most authoritative source first.
@@ -219,3 +270,10 @@ export function sectionText(code) {
219
270
  export function reminderText(code) {
220
271
  return languageOf(code)?.reminder ?? "";
221
272
  }
273
+ /**
274
+ * Build the closing reminder appended as the request's last message.
275
+ * 生成追加在请求最后一条消息里的收尾提醒。
276
+ */
277
+ export function tailText(code) {
278
+ return languageOf(code)?.tail ?? "";
279
+ }
package/lib/index.d.ts CHANGED
@@ -29,6 +29,7 @@ interface HostContext {
29
29
  on(event: "agent/pre-step", listener: (payload: PreStepPayload, next: () => Promise<PreStepDecision>) => Promise<PreStepDecision>, options?: {
30
30
  prepend?: boolean;
31
31
  }): unknown;
32
+ on(event: "agent/created", listener: (payload: unknown) => unknown): unknown;
32
33
  systemPrompt: {
33
34
  section(section: {
34
35
  name: string;
package/lib/index.js CHANGED
@@ -6,10 +6,14 @@
6
6
  * 注入形态(设计理由见 README):
7
7
  *
8
8
  * section order 1 → the authoritative rule, once per session
9
- * pre-step step 1 → a short reminder, at most once per turn (10 min apart)
9
+ * pre-step step 1 → a short reminder at the head of the batch, at most once per turn
10
+ * (interval configurable, default 30 min)
11
+ * pre-step step 1 → the closing rule, folded into the skill catalogue when the
12
+ * extra-injection setting is on
10
13
  *
11
14
  * section order 1 → 权威规则,每会话组装一次
12
- * pre-step step 1 → 短提醒,每轮最多一次(间隔 10 分钟)
15
+ * pre-step step 1 → 批次开头的短提醒,每轮最多一次(间隔可配置,默认 30 分钟)
16
+ * pre-step step 1 → 收尾规则,额外注入开启时折进技能目录
13
17
  *
14
18
  * The host context is described by a local structural interface rather than the
15
19
  * `@deepseek-ai/cordis` type, so this package carries no DSH type dependency.
@@ -18,7 +22,7 @@
18
22
  */
19
23
  import { randomUUID } from "node:crypto";
20
24
  import z from "@deepseek-ai/schemastery";
21
- import { AUTO, FIELD_LANGUAGE, SELECTABLE_TAGS, SETTINGS_NAMESPACE, effectiveCode, nativeNameFor, normalizeSettings, reminderText, sectionText } from "./core.js";
25
+ import { AUTO, DEFAULT_REMINDER_MINUTES, DEFAULTS, FIELD_EXTRA, FIELD_LANGUAGE, FIELD_REMINDER, REMINDER_OFF, SELECTABLE_TAGS, SETTINGS_NAMESPACE, effectiveCode, nativeNameFor, normalizeSettings, reminderDelayMs, reminderText, tailText, sectionText } from "./core.js";
22
26
  /** Stable Cordis plugin name. / 稳定的 Cordis 插件名。 */
23
27
  export const name = "ay-dsh-tk-lang";
24
28
  /** Plugin-level service requirements; services are acquired per branch below. / 插件级服务声明;服务在下方逐分支获取。 */
@@ -31,8 +35,6 @@ export const inject = [];
31
35
  * persona 前缀放在 0、第一个策略段放在 500,因此取 1 就紧跟在 persona 那行之后。
32
36
  */
33
37
  const SECTION_ORDER = 1;
34
- /** Minimum milliseconds between two per-turn reminders in one session. / 同一会话中两次每轮提醒之间的最小毫秒数。 */
35
- const REMINDER_INTERVAL_MS = 600_000;
36
38
  /** Settings namespace holding the desktop UI locale. / 保存桌面 UI 语言的设置命名空间。 */
37
39
  const LOCALE_NAMESPACE = "locale";
38
40
  /** Field of {@link LOCALE_NAMESPACE} holding the UI locale. / {@link LOCALE_NAMESPACE} 中保存 UI 语言的字段。 */
@@ -91,7 +93,11 @@ function labelled(node, label) {
91
93
  */
92
94
  function buildSchema() {
93
95
  const choices = [AUTO, ...SELECTABLE_TAGS].map((value) => labelled(z.const(value), nativeNameFor(value)));
94
- return z.object({ [FIELD_LANGUAGE]: live(z.union(choices).default(AUTO)) });
96
+ return z.object({
97
+ [FIELD_LANGUAGE]: live(z.union(choices).default(AUTO)),
98
+ [FIELD_REMINDER]: live(z.number().default(DEFAULT_REMINDER_MINUTES)),
99
+ [FIELD_EXTRA]: live(z.boolean().default(DEFAULTS.extraInjection))
100
+ });
95
101
  }
96
102
  /** Durable settings schema; the field defaults to {@link AUTO}. / 持久化设置 schema;字段默认为 {@link AUTO}。 */
97
103
  export const Config = buildSchema();
@@ -219,13 +225,16 @@ function osLocale() {
219
225
  return value;
220
226
  }
221
227
  /**
222
- * Resolve the effective language for one prompt build.
223
- * 为一次提示词构建解析出生效语言。
228
+ * Resolve the configuration in effect for one prompt build.
229
+ * 为一次提示词构建解析出当前生效的配置。
224
230
  */
225
- function currentLanguage(reader) {
231
+ function currentSettings(reader) {
226
232
  const settings = normalizeSettings(sectionOf(reader, SETTINGS_NAMESPACE));
227
233
  const desktop = sectionOf(reader, LOCALE_NAMESPACE)?.[LOCALE_FIELD];
228
- return effectiveCode(settings, osLocale(), typeof desktop === "string" ? desktop : undefined);
234
+ return {
235
+ ...settings,
236
+ language: effectiveCode(settings, osLocale(), typeof desktop === "string" ? desktop : undefined)
237
+ };
229
238
  }
230
239
  /**
231
240
  * Build the durable user message carrying one reminder.
@@ -243,6 +252,40 @@ function reminderMessage(text) {
243
252
  source: { kind: name, form: "snapshot", sections: [{ name, text }] }
244
253
  };
245
254
  }
255
+ /**
256
+ * Put the rule in front of the text a message already carries.
257
+ * 把规则放到消息已有文本的前面。
258
+ */
259
+ function prefixPrompt(message, text) {
260
+ const content = Array.isArray(message.content) ? message.content : [];
261
+ const head = content[0];
262
+ if (head && head.type === "text" && typeof head.text === "string" && head.text.startsWith(text))
263
+ return message;
264
+ return { ...message, content: [{ type: "text", text: `${text}\n` }, ...content] };
265
+ }
266
+ /**
267
+ * Rewrite the skill-catalog injection so the rule opens a block the model reads as
268
+ * instruction, not as the text it has to answer. Falls back to the last injected
269
+ * message when no skill catalogue is present. / 改写 skill-catalog 注入,让规则出现在
270
+ * 模型读作指令的块开头;没有技能目录时退回最后一条注入消息。
271
+ */
272
+ function prefixInjected(messages, text) {
273
+ let index = messages.findIndex((message) => message.source?.kind === "skill-catalog");
274
+ if (index < 0) {
275
+ for (let cursor = messages.length - 1; cursor >= 0; cursor -= 1) {
276
+ const source = messages[cursor].source;
277
+ if (messages[cursor].role === "user" && source?.kind !== name) {
278
+ index = cursor;
279
+ break;
280
+ }
281
+ }
282
+ }
283
+ if (index < 0)
284
+ return messages;
285
+ const next = [...messages];
286
+ next[index] = prefixPrompt(messages[index], text);
287
+ return next;
288
+ }
246
289
  /**
247
290
  * Register the settings consumer, the prompt section, and the per-turn reminder.
248
291
  * 注册设置消费方、提示词段,以及每轮一次的提醒。
@@ -258,24 +301,50 @@ export function apply(ctx) {
258
301
  promptCtx.systemPrompt.section({
259
302
  name: "app:tk-lang",
260
303
  order: SECTION_ORDER,
261
- text: () => sectionText(currentLanguage(reader()))
304
+ text: () => sectionText(currentSettings(reader()).language)
262
305
  });
263
- // The reminder runs before the other pre-step listeners, so its message is
264
- // appended after theirs and stays closest to the end of the request.
265
- // 该提醒先于其它 pre-step 监听器执行,因此它的消息追加在它们之后,离请求末尾最近。
266
- promptCtx.on("agent/pre-step", async (payload, next) => {
306
+ /**
307
+ * Wrap the batch in two reminders: one before the prompt, one after every injection.
308
+ * 用两条提醒夹住批次:一条在提问之前,一条在全部注入之后。
309
+ */
310
+ const rewrite = async (payload, next) => {
267
311
  const decision = await next();
268
312
  if (decision.kind !== "enter" || payload.signal.aborted || payload.step !== 1)
269
313
  return decision;
314
+ const settings = currentSettings(reader());
315
+ const delay = reminderDelayMs(settings.reminderMinutes);
316
+ if (delay === REMINDER_OFF)
317
+ return decision;
270
318
  const now = Date.now();
271
319
  const previous = lastReminderAt.get(payload.agent.session.id);
272
- if (previous !== undefined && now - previous < REMINDER_INTERVAL_MS)
320
+ if (delay > 0 && previous !== undefined && now - previous < delay)
273
321
  return decision;
274
- const text = reminderText(currentLanguage(reader()));
275
- if (text === "")
322
+ const head = reminderText(settings.language);
323
+ if (head === "")
276
324
  return decision;
277
325
  lastReminderAt.set(payload.agent.session.id, now);
278
- return { ...decision, messages: [...decision.messages, reminderMessage(text)] };
279
- }, { prepend: true });
326
+ // The closing rule rides on the same switch as the reminder: turning the
327
+ // reminder off skips this whole listener, so both injections stop together.
328
+ // 收尾规则与提醒共用一个开关:提醒关闭时本段不执行,两处注入一起停。
329
+ const tail = settings.extraInjection ? tailText(settings.language) : "";
330
+ const messages = tail === "" ? decision.messages : prefixInjected(decision.messages, tail);
331
+ return { ...decision, messages: [reminderMessage(head), ...messages] };
332
+ };
333
+ /**
334
+ * `prepend` unshifts, so the listener prepended last runs first and returns last:
335
+ * only it sees every message the other pre-step listeners appended, including the
336
+ * trailing `time-context` batch.
337
+ * `prepend` 是 unshift:最后 prepend 的监听器最先执行、最后返回,只有它能看见其它
338
+ * pre-step 监听器追加的全部消息,包括压在最后的 `time-context`。
339
+ */
340
+ let disposeStep;
341
+ const bindOutermost = () => {
342
+ disposeStep?.();
343
+ disposeStep = promptCtx.on("agent/pre-step", rewrite, { prepend: true });
344
+ };
345
+ bindOutermost();
346
+ promptCtx.on("agent/created", () => {
347
+ bindOutermost();
348
+ });
280
349
  });
281
350
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-thinking-lang",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "DSH plugin: set the agent's reasoning language (Settings → General)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,6 +39,7 @@
39
39
  "assets",
40
40
  "cordis.patch.yml",
41
41
  "README.md",
42
+ "DEVELOPMENT.md",
42
43
  "PROVENANCE.md",
43
44
  "LICENSE"
44
45
  ],
@@ -10,11 +10,14 @@
10
10
  */
11
11
  import { SETTINGS_NAMESPACE } from "../core.js";
12
12
  import { dictionaries, type Dict } from "./locales.js";
13
- import { createRow, mountRowStyles, type SettingsDoc, type UiPrimitives } from "./panel.js";
13
+ import { createConfigCard, createRow, mountRowStyles, type SettingsDoc, type UiPrimitives } from "./panel.js";
14
14
 
15
15
  /** Stable Cordis plugin name. / 稳定的 Cordis 插件名。 */
16
16
  export const name = "ay-dsh-tk-lang";
17
17
 
18
+ /** Package name; the key Plugins page uses to find a bundle's configuration page. / 包名;插件页用它查找某个 bundle 的配置页。 */
19
+ const PACKAGE_NAME = "dsh-thinking-lang";
20
+
18
21
  /** The one client service this plugin requires. / 本插件唯一需要的客户端服务。 */
19
22
  export const inject = ["slots"];
20
23
 
@@ -36,6 +39,8 @@ declare const require: (specifier: string) => unknown;
36
39
  /** The slice of the config-forms service used to reach the settings document. / 用于取得设置文档的 config-forms 服务切片。 */
37
40
  interface ConfigFormsService {
38
41
  get(ns: string): SettingsDoc;
42
+ /** Run `callback` while the namespace is served; returns its disposer. / 命名空间处于服务状态时执行回调,返回其回收函数。 */
43
+ whileServed?(namespaces: string[], callback: () => unknown): () => void;
39
44
  }
40
45
 
41
46
  /** The slice of the locale service used for row copy. / 用于行文案的 locale 服务切片。 */
@@ -126,5 +131,31 @@ export function apply(ctx: UiContext): void {
126
131
  Row
127
132
  );
128
133
  });
134
+
135
+ // The Plugins page renders a bundle's configuration through this slot,
136
+ // keyed by the package name. / 插件页按包名通过该插槽渲染 bundle 的配置页。
137
+ const whileServed = typeof forms.whileServed === "function" ? forms.whileServed.bind(forms) : undefined;
138
+ if (whileServed === undefined) {
139
+ report(uiCtx, "configForms.whileServed unavailable; plugin configuration page disabled");
140
+ return;
141
+ }
142
+ const Card = createConfigCard(primitives);
143
+ uiCtx.effect(
144
+ () =>
145
+ whileServed([SETTINGS_NAMESPACE], () =>
146
+ uiCtx.slots.inject("plugins.bundle.config", () =>
147
+ uiCtx.slots.register(
148
+ {
149
+ name: "plugins.bundle.config",
150
+ key: PACKAGE_NAME,
151
+ locale: LOCALE_NS,
152
+ inject: () => ({ doc, t })
153
+ },
154
+ Card
155
+ )
156
+ )
157
+ ),
158
+ "dsh-thinking-lang: plugin configuration page"
159
+ );
129
160
  });
130
161
  }
@@ -1,44 +1,60 @@
1
1
  /**
2
- * Settings-row copy, in every language the plugin can think in.
3
- * 设置行文案,覆盖本插件支持的每一种思考语言。
2
+ * Settings copy for the General row and the plugin's configuration card.
3
+ * 「通用」设置行与插件配置卡片使用的文案。
4
4
  *
5
- * Two indexes point at the same dictionaries, and they answer different
6
- * questions:
7
- * 两份索引指向同一批字典,各自回答不同的问题:
8
- *
9
- * - {@link dictionaries} is keyed by UI locale and handed to the host locale
10
- * service. The host resolves it against the *interface* language.
11
- * - {@link DICTIONARIES} is keyed by thinking-language tag and read by the row
12
- * itself, so the copy can follow the *thinking* language instead.
13
- *
14
- * - {@link dictionaries} 以界面语言为键,交给宿主的 locale 服务,由宿主按
15
- * **界面语言**解析。
16
- * - {@link DICTIONARIES} 以思考语言标签为键,由设置行自己读取,使文案可以跟随
17
- * **思考语言**。
5
+ * The host resolves {@link dictionaries} against the interface language; the
6
+ * settings card renders its own controls from the same keys.
7
+ * 宿主按界面语言解析 {@link dictionaries};配置卡片用同一批键渲染自己的控件。
18
8
  */
19
9
 
20
- /** One dictionary of settings-row copy. / 一份设置行文案字典。 */
10
+ /** One dictionary of settings copy. / 一份设置文案字典。 */
21
11
  export interface Dict {
22
12
  /** Row heading. / 行标题。 */
23
13
  heading: string;
24
- /** Row description, rendered under the heading. / 行说明,渲染在标题下方。 */
14
+ /** Row description. / 行说明。 */
25
15
  description: string;
26
16
  /** Label of the "follow the host locale" option. / 「跟随宿主语言」选项的标签。 */
27
17
  autoLabel: string;
18
+ /** Reminder row heading. / 提醒行标题。 */
19
+ reminderHeading: string;
20
+ /** Reminder row description. / 提醒行说明。 */
21
+ reminderDescription: string;
22
+ /** Label of the "disabled" reminder option. / 关闭提醒的选项标签。 */
23
+ reminderOff: string;
24
+ /** Label of the "every turn" reminder option. / 每轮提醒的选项标签。 */
25
+ reminderTurn: string;
26
+ /** Label of the custom interval option. / 自定义间隔的选项标签。 */
27
+ reminderCustom: string;
28
+ /** Suffix for a preset interval. / 预设间隔的单位后缀。 */
29
+ reminderUnit: string;
30
+ /** Hint under the custom interval input. / 自定义间隔输入框的提示。 */
31
+ reminderCustomHint: string;
32
+ /** Extra-injection row heading. / 额外注入行的标题。 */
33
+ extraHeading: string;
34
+ /** Extra-injection row description. / 额外注入行的说明。 */
35
+ extraDescription: string;
36
+ /** Label of the enabled option. / 开启选项的标签。 */
37
+ extraOn: string;
38
+ /** Label of the disabled option. / 关闭选项的标签。 */
39
+ extraOff: string;
28
40
  }
29
41
 
30
42
  /** Simplified Chinese copy. / 简体中文文案。 */
31
43
  export const zh: Dict = {
32
44
  heading: "思考语言",
33
45
  description: "内部推理与规划使用的语言。「自动」优先跟随操作系统语言,其次是界面语言。",
34
- autoLabel: "自动"
35
- };
36
-
37
- /** Traditional Chinese copy. / 繁體中文文案。 */
38
- const zhTW: Dict = {
39
- heading: "思考語言",
40
- description: "內部推理與規劃使用的語言。「自動」優先跟隨作業系統語言,其次是介面語言。",
41
- autoLabel: "自動"
46
+ autoLabel: "自动",
47
+ reminderHeading: "提醒间隔",
48
+ reminderDescription: "两次提醒之间的最小间隔;关闭后只保留系统提示里的规则。",
49
+ reminderOff: "关闭",
50
+ reminderTurn: "每轮",
51
+ reminderCustom: "自定义",
52
+ reminderUnit: "分钟",
53
+ reminderCustomHint: "1–1440 分钟",
54
+ extraHeading: "额外提醒注入",
55
+ extraDescription: "开启后把提醒同时并入技能目录;提醒间隔为「关闭」时,此项也一并关闭。",
56
+ extraOn: "开启",
57
+ extraOff: "关闭"
42
58
  };
43
59
 
44
60
  /** English copy. / 英文文案。 */
@@ -46,43 +62,20 @@ export const en: Dict = {
46
62
  heading: "Thinking language",
47
63
  description:
48
64
  "Language used for internal reasoning and planning. Automatic follows the operating-system language first, then the UI language.",
49
- autoLabel: "Automatic"
65
+ autoLabel: "Automatic",
66
+ reminderHeading: "Reminder interval",
67
+ reminderDescription: "Minimum gap between reminders. Off keeps only the system-prompt rule.",
68
+ reminderOff: "Off",
69
+ reminderTurn: "Every turn",
70
+ reminderCustom: "Custom",
71
+ reminderUnit: "min",
72
+ reminderCustomHint: "1–1440 minutes",
73
+ extraHeading: "Extra reminder injection",
74
+ extraDescription:
75
+ "Also folds the reminder into the skill catalogue. Switching the reminder interval off turns this off too.",
76
+ extraOn: "On",
77
+ extraOff: "Off"
50
78
  };
51
79
 
52
- /**
53
- * Whether the row copy follows the thinking language instead of the UI language.
54
- * 行文案是否跟随思考语言,而不是界面语言。
55
- *
56
- * Reserved and currently OFF: the whole mechanism is implemented and wired up,
57
- * but this stays `false` so the row keeps following the interface language.
58
- * Flip it to `true` to switch the behaviour on — no other file needs to change.
59
- * 预留中,当前关闭:整套机制已实现并接线完毕,但此处保持 `false`,使设置行继续
60
- * 跟随界面语言。改为 `true` 即可启用,无需改动任何其它文件。
61
- */
62
- export const COPY_FOLLOWS_THINKING_LANGUAGE = false;
63
-
64
- /** Dictionaries keyed by thinking-language tag, read by the row. / 以思考语言标签为键、由设置行读取的字典。 */
65
- const DICTIONARIES: Record<string, Dict> = {
66
- "zh-CN": zh,
67
- "zh-TW": zhTW,
68
- en
69
- };
70
-
71
- /**
72
- * Pick the dictionary the row should use, honouring the feature flag.
73
- * 依据功能开关,挑选设置行应当使用的字典。
74
- *
75
- * Returns `undefined` whenever the host dictionary should win: the flag is off,
76
- * or the language is `auto` and is therefore resolved by the host against the
77
- * interface language.
78
- * 返回 `undefined` 表示应当采用宿主字典:开关关闭,或语言为 `auto`(此时由宿主按
79
- * 界面语言解析)。
80
- */
81
- export function dictionaryFor(language: string, autoValue: string): Dict | undefined {
82
- if (!COPY_FOLLOWS_THINKING_LANGUAGE) return undefined;
83
- if (language === autoValue) return undefined;
84
- return DICTIONARIES[language];
85
- }
86
-
87
80
  /** Dictionaries keyed by UI locale, handed to the host locale service. / 以界面语言为键、交给宿主 locale 服务的字典。 */
88
81
  export const dictionaries: Record<string, Dict> = { zh, en };