dsh-checklist-mode 0.1.0 → 0.1.1
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/README.md +7 -4
- package/client.js +39 -15
- package/docs/DETAIL.en.md +2 -2
- package/docs/DETAIL.md +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,8 @@ Type `/` in the composer and pick **Checklist**, or type the command directly:
|
|
|
46
46
|
| `/checklist off` | Turns the mode off. |
|
|
47
47
|
|
|
48
48
|
The menu row shows an icon (a sheet with two lines: the first has a checked box, the second an
|
|
49
|
-
empty one), a
|
|
49
|
+
empty one), a title in the DSH interface language (it follows the language picked in
|
|
50
|
+
Settings → General and switches without a reload) and the English command name.
|
|
50
51
|
|
|
51
52
|
## How the menu row is made
|
|
52
53
|
|
|
@@ -56,9 +57,11 @@ contract covers fully client-side commands and behavioral decorations — neithe
|
|
|
56
57
|
host command row.
|
|
57
58
|
|
|
58
59
|
So the client half (`client.js`) wraps `CommandUiRuntime.candidates`, the single place where
|
|
59
|
-
menu rows are assembled, and adds `label`/`description`/`icon` to its own `checklist` row.
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
menu rows are assembled, and adds `label`/`description`/`icon` to its own `checklist` row. The
|
|
61
|
+
label comes from a `checklist` locale namespace registered through `ctx.locale`, so it follows the
|
|
62
|
+
language selected in DSH rather than the operating system language. The wrap is deliberately soft:
|
|
63
|
+
if a future DSH changes or renames that private method, the icon and title simply do not appear
|
|
64
|
+
(a warning is logged), and the command keeps working.
|
|
62
65
|
|
|
63
66
|
If you are upgrading DSH beyond the range above, expect the cosmetic part to need a small
|
|
64
67
|
update; `engines.dsh` states the tested range.
|
package/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Клиентская половина dsh-checklist-mode.
|
|
2
2
|
//
|
|
3
3
|
// Задача: в меню «Команды» строка /checklist должна выглядеть как штатные
|
|
4
|
-
// команды — иконка, название на языке
|
|
4
|
+
// команды — иконка, название на языке интерфейса DSH и (рядом) английское имя.
|
|
5
5
|
//
|
|
6
6
|
// В DSH 2026-11 иконка и локализованное название есть только у встроенных
|
|
7
7
|
// команд: клиент держит их в таблице HOST_FACES
|
|
@@ -57,32 +57,48 @@ window.__ModuleLoader__.load({
|
|
|
57
57
|
)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// Язык системы (navigator.language), как у штатных подписей меню.
|
|
61
|
-
const LANG = String(
|
|
62
|
-
(typeof navigator !== "undefined" && navigator.language) || "en",
|
|
63
|
-
).toLowerCase()
|
|
64
|
-
const RU = LANG.startsWith("ru")
|
|
65
|
-
const LABEL = RU ? "Чеклист" : "Checklist"
|
|
66
|
-
const DESCRIPTION = RU
|
|
67
|
-
? "Строгий режим: план по пунктам, без переделок, вопросы при выборе"
|
|
68
|
-
: "Strict mode: a numbered plan, one step at a time"
|
|
69
|
-
|
|
70
60
|
const COMMAND = "checklist"
|
|
71
61
|
const MARK = "__dshChecklistFace"
|
|
62
|
+
const NS = "checklist"
|
|
63
|
+
|
|
64
|
+
// Название и описание берём из словаря DSH по активному языку интерфейса
|
|
65
|
+
// (ctx.locale), а не из navigator.language: язык в DSH переключается в
|
|
66
|
+
// настройках и не обязан совпадать с языком системы. Русский/английский —
|
|
67
|
+
// то, что реально используется; zh — базовый локаль для остальных языков,
|
|
68
|
+
// которые падают на en.
|
|
69
|
+
const DICTIONARY = {
|
|
70
|
+
en: {
|
|
71
|
+
label: "Checklist",
|
|
72
|
+
description: "Strict mode: a numbered plan, one step at a time",
|
|
73
|
+
},
|
|
74
|
+
ru: {
|
|
75
|
+
label: "Чеклист",
|
|
76
|
+
description: "Строгий режим: план по пунктам, без переделок, вопросы при выборе",
|
|
77
|
+
},
|
|
78
|
+
zh: {
|
|
79
|
+
label: "清单模式",
|
|
80
|
+
description: "严格模式:编号计划,逐项执行",
|
|
81
|
+
},
|
|
82
|
+
}
|
|
72
83
|
|
|
73
84
|
/** Добавить нашей строке иконку и локализованное название; чужие строки не трогаем. */
|
|
74
|
-
function faceRows(rows) {
|
|
85
|
+
function faceRows(rows, t) {
|
|
75
86
|
if (!Array.isArray(rows)) return rows
|
|
76
87
|
let changed = false
|
|
77
88
|
const next = rows.map((row) => {
|
|
78
89
|
if (!row || row.name !== COMMAND || row.icon !== undefined) return row
|
|
79
90
|
changed = true
|
|
80
|
-
return {
|
|
91
|
+
return {
|
|
92
|
+
...row,
|
|
93
|
+
label: t("label"),
|
|
94
|
+
description: t("description"),
|
|
95
|
+
icon: ChecklistIcon,
|
|
96
|
+
}
|
|
81
97
|
})
|
|
82
98
|
return changed ? next : rows
|
|
83
99
|
}
|
|
84
100
|
|
|
85
|
-
exports.inject = ["commandUi"]
|
|
101
|
+
exports.inject = ["commandUi", "locale"]
|
|
86
102
|
|
|
87
103
|
exports.apply = (ctx) => {
|
|
88
104
|
const ui = ctx.commandUi
|
|
@@ -94,9 +110,17 @@ window.__ModuleLoader__.load({
|
|
|
94
110
|
)
|
|
95
111
|
return
|
|
96
112
|
}
|
|
113
|
+
ctx.effect(
|
|
114
|
+
() => ctx.locale.register(NS, DICTIONARY),
|
|
115
|
+
"dsh-checklist: dictionaries",
|
|
116
|
+
)
|
|
117
|
+
// bind возвращает стабильную функцию, читающую активный язык в момент
|
|
118
|
+
// вызова, поэтому смена языка в настройках DSH применяется к следующему
|
|
119
|
+
// открытию меню без перезагрузки страницы.
|
|
120
|
+
const t = ctx.locale.bind(NS)
|
|
97
121
|
if (original[MARK] === true) return
|
|
98
122
|
const wrapped = async function candidatesWithChecklistFace(...args) {
|
|
99
|
-
return faceRows(await original.apply(this, args))
|
|
123
|
+
return faceRows(await original.apply(this, args), t)
|
|
100
124
|
}
|
|
101
125
|
wrapped[MARK] = true
|
|
102
126
|
proto.candidates = wrapped
|
package/docs/DETAIL.en.md
CHANGED
|
@@ -26,8 +26,8 @@ While the mode is active, a `checklist:policy` section is added to the agent's s
|
|
|
26
26
|
## How the menu row looks
|
|
27
27
|
|
|
28
28
|
The `/checklist` row is dressed like the built-in commands: an icon (a sheet with two lines —
|
|
29
|
-
the first with a checked box, the second with an empty one), a title in the
|
|
30
|
-
the English command name.
|
|
29
|
+
the first with a checked box, the second with an empty one), a title in the DSH interface language
|
|
30
|
+
(it follows Settings → General and switches without a reload), and the English command name.
|
|
31
31
|
|
|
32
32
|
This is done by the plugin's client half — [`client.js`](../client.js):
|
|
33
33
|
|
package/docs/DETAIL.md
CHANGED
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
|
|
28
28
|
Строка `/checklist` в меню «Команды» оформлена как штатные команды: иконка
|
|
29
29
|
(лист с двумя строками — у первой чекбокс с галочкой, у второй пустой),
|
|
30
|
-
название на языке
|
|
30
|
+
название на языке интерфейса DSH (следует за настройкой «Язык» и меняется без
|
|
31
|
+
перезагрузки) и английское имя команды.
|
|
31
32
|
|
|
32
33
|
Сделано клиентской половиной плагина — [`client.js`](../client.js):
|
|
33
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-checklist-mode",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Strict checklist mode for DeepSeek Harness: /checklist adds a numbered-plan policy to the agent's system prompt and can send the task in one step.",
|
|
6
6
|
"license": "MIT",
|