dsh-injection-manager 0.0.0-stage → 1.10.4
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/CHANGELOG.md +375 -0
- package/CONTRIBUTING.md +49 -0
- package/LICENSE +21 -0
- package/README.md +183 -2
- package/README.zh.md +191 -0
- package/SECURITY.md +35 -0
- package/client.js +1898 -0
- package/cordis.patch.yml +4 -0
- package/docs/ARCHITECTURE.md +108 -0
- package/docs/COMPATIBILITY.md +39 -0
- package/docs/DETAIL.de.md +1 -0
- package/docs/DETAIL.es.md +1 -0
- package/docs/DETAIL.fr.md +1 -0
- package/docs/DETAIL.ja.md +1 -0
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.pt.md +1 -0
- package/docs/DETAIL.ru.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/FAQ.md +54 -0
- package/docs/PERFORMANCE.md +19 -0
- package/docs/images/demo.gif +0 -0
- package/docs/images/panel-about.png +0 -0
- package/docs/images/panel-budget.png +0 -0
- package/docs/images/panel-dark.png +0 -0
- package/docs/images/panel-policy.png +0 -0
- package/docs/images/panel-settings.png +0 -0
- package/docs/images/panel-sidebar.png +0 -0
- package/docs/images/panel-suites.png +0 -0
- package/docs/preview.svg +24 -0
- package/icon.svg +6 -0
- package/index.js +218 -0
- package/lib/actions.js +25 -0
- package/lib/apply.js +218 -0
- package/lib/group.js +141 -0
- package/lib/history.js +47 -0
- package/lib/hostinfo.js +83 -0
- package/lib/instructions.js +142 -0
- package/lib/measure.js +51 -0
- package/lib/policy.js +189 -0
- package/lib/presets.js +45 -0
- package/lib/routes.js +593 -0
- package/lib/settings.js +32 -0
- package/lib/snapshot.js +558 -0
- package/lib/text.js +132 -0
- package/locale/de.json +168 -0
- package/locale/en.json +168 -0
- package/locale/es.json +168 -0
- package/locale/fr.json +168 -0
- package/locale/ja.json +168 -0
- package/locale/pt.json +168 -0
- package/locale/ru.json +168 -0
- package/locale/zh.json +168 -0
- package/package.json +72 -4
- package/screenshots.json +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.10.4 — 2026-11-16
|
|
4
|
+
|
|
5
|
+
- When the current session was created before the saved policy, the panel now
|
|
6
|
+
says so under the KPI strip: "本会话在策略保存前创建,不受新策略影响;「策略后」是
|
|
7
|
+
下一个新会话的预估。" Previously only the Notes tab mentioned it, so a switch
|
|
8
|
+
that changed "策略后" but not "首轮注入" looked like a refresh bug.
|
|
9
|
+
- Eight locales gained `sessionNotApplied`.
|
|
10
|
+
|
|
11
|
+
## 1.10.3 — 2026-11-16
|
|
12
|
+
|
|
13
|
+
- Fixed "I switched it off but the panel still shows the old numbers": the panel's
|
|
14
|
+
snapshot fetch used a single in-flight flag, so a poll that started before your
|
|
15
|
+
click could swallow the fresh reload, leaving the old summary until the next
|
|
16
|
+
poll. Responses now carry a sequence ticket and only the newest one is applied,
|
|
17
|
+
so a post-write reload always wins.
|
|
18
|
+
|
|
19
|
+
## 1.10.2 — 2026-11-16
|
|
20
|
+
|
|
21
|
+
- Fixed the plugin metadata error `ENOENT ... D:\DSH\dsh-context-injection\locale\de.json`:
|
|
22
|
+
the profile kept a junction `node_modules/dsh-context-injection` pointing at the
|
|
23
|
+
directory's pre-rename location. The junction is gone; the only link now points
|
|
24
|
+
at `D:\DSH\dsh-injection-manager`.
|
|
25
|
+
- Repaired the mojibake in `package.json`'s description (two `??` where the em
|
|
26
|
+
dashes were) that came from an early PowerShell edit.
|
|
27
|
+
|
|
28
|
+
## 1.10.1 — 2026-11-16
|
|
29
|
+
|
|
30
|
+
- Fixed the "switched-off suite becomes unfindable" bug: items that leave the
|
|
31
|
+
assembled prompt because the policy excludes them are remembered (per agent
|
|
32
|
+
and by name across agents) and listed again under 「已关闭」 with their size and
|
|
33
|
+
a 「恢复整套」 button. Restoration goes through a new `names` action, because
|
|
34
|
+
item/group toggles cannot address names the assembly no longer contains.
|
|
35
|
+
- The item list also gained sorting: 按 token / 按名称, applied to both flat rows
|
|
36
|
+
and suite order, remembered per browser.
|
|
37
|
+
- The closed-index used the wrong policy shape (`policy.channels` instead of the
|
|
38
|
+
flat `policy.<channel>`), which is why it always came back empty; two new tests
|
|
39
|
+
cover a tool disappearing between builds and the cross-agent name memory.
|
|
40
|
+
|
|
41
|
+
## 1.10.0 — 2026-11-16
|
|
42
|
+
|
|
43
|
+
- The composer chip is quieter: muted text with a dot, no border until hover,
|
|
44
|
+
`83.8k 97%` instead of `注入 83.8k · 可关闭 97%`, plus a hover × to hide it.
|
|
45
|
+
Hiding is per browser (localStorage) and the Notes tab can switch it back on.
|
|
46
|
+
The chip now carries its own stylesheet — it used to render as a native
|
|
47
|
+
button because the panel's `<style>` only mounted with the panel.
|
|
48
|
+
- The panel refreshes itself: a silent `/summary` poll every 5 s (chip: 15 s)
|
|
49
|
+
while the page is visible, paused when hidden, plus an immediate broadcast on
|
|
50
|
+
every write. A policy changed by `/inject`, another window or a plugin reload
|
|
51
|
+
now shows up without pressing 刷新.
|
|
52
|
+
|
|
53
|
+
## 1.9.10 — 2026-11-15
|
|
54
|
+
|
|
55
|
+
- Corrected a stale limitation line: sections are filtered through the scoped
|
|
56
|
+
`system-prompt/assemble` waterfall, not "shadowed with an empty same-name
|
|
57
|
+
section" (that was the first approach and it threw).
|
|
58
|
+
- README version callouts updated to 1.9.9 with the current feature list.
|
|
59
|
+
|
|
60
|
+
## 1.9.9 — 2026-11-15
|
|
61
|
+
|
|
62
|
+
- Both READMEs gained a "60-second tour" / 「60 秒演示」: five steps with the
|
|
63
|
+
expected numbers, including the part people misread (an existing session is
|
|
64
|
+
not affected by a policy saved later).
|
|
65
|
+
|
|
66
|
+
## 1.9.8 — 2026-11-15
|
|
67
|
+
|
|
68
|
+
- "最近一次应用" now says what the policy actually did to each channel:
|
|
69
|
+
`段落 2/25 · 上下文 0/9 · 技能 0/38 · 工具 9/280`. Counts are recorded in the
|
|
70
|
+
apply report via a shared `countChannelState()`, with three unit tests.
|
|
71
|
+
- Real check: a new agent created under the minimal preset reported
|
|
72
|
+
`sections 2/25, contexts 0/9, skills 0/38, tools 9/280, saved 78,799`; the
|
|
73
|
+
policy was then restored to `all` with undo.
|
|
74
|
+
|
|
75
|
+
## 1.9.7 — 2026-11-15
|
|
76
|
+
|
|
77
|
+
- Item list shows what the current budget plan would switch off: a small
|
|
78
|
+
"预算外" tag per row and "129 预算外" on the suite header, so the list and the
|
|
79
|
+
budget page tell the same story. Tags only appear when a budget target is set.
|
|
80
|
+
- Eight locales gained `outsideBudget` / `outsideBudgetHint`; a one-line
|
|
81
|
+
formatting glitch in `groupLabelOf` was tidied while nearby.
|
|
82
|
+
|
|
83
|
+
## 1.9.6 — 2026-11-15
|
|
84
|
+
|
|
85
|
+
- The Policy tab now warns before a preset switch replaces manual choices:
|
|
86
|
+
"当前有 229 项手动关闭;切换预设会重算并覆盖这些选择。" The count comes from
|
|
87
|
+
a shared `excludedCountOf()` used by both the policy and budget pages.
|
|
88
|
+
- FAQ says presets behave the same way as applying a budget.
|
|
89
|
+
|
|
90
|
+
## 1.9.5 — 2026-11-15
|
|
91
|
+
|
|
92
|
+
- Budget page warns before it overwrites manual choices: "当前有 N 项被手动关闭;
|
|
93
|
+
应用建议会按预算重算,并覆盖这些选择。" with the real count (229 after one
|
|
94
|
+
REA switch in the fixture).
|
|
95
|
+
- FAQ explains that applying a budget recomputes instead of stacking, and what
|
|
96
|
+
to do if you want to keep manual exclusions.
|
|
97
|
+
|
|
98
|
+
## 1.9.4 — 2026-11-15
|
|
99
|
+
|
|
100
|
+
- The render boundary now shows what failed, offers Reload and Copy error, and
|
|
101
|
+
says the error is recorded at `/diag` (and that `/inject` still works) instead
|
|
102
|
+
of printing a bare message. Its copy is bilingual on purpose: the boundary can
|
|
103
|
+
render before locale data loads.
|
|
104
|
+
- Empty list: "没有匹配的条目" plus a Clear filters button that resets search,
|
|
105
|
+
channel and the switchable-only filter in one click.
|
|
106
|
+
- Eight locales gained `noMatch` / `clearFilters`.
|
|
107
|
+
|
|
108
|
+
## 1.9.3 — 2026-11-15
|
|
109
|
+
|
|
110
|
+
- Budget page: quick targets (24k / 48k / 80k), a sort switch for the suggestion
|
|
111
|
+
list (by tokens / by suite name, remembered), and a plain "还有 N 组未列出"
|
|
112
|
+
instead of a bare `+N`.
|
|
113
|
+
- Real host check: setting 24000 yields `plan.after = 23945`, 147 drops in 7
|
|
114
|
+
groups; clearing the budget returns to 0 drops.
|
|
115
|
+
|
|
116
|
+
## 1.9.2 — 2026-11-15
|
|
117
|
+
|
|
118
|
+
- Keyboard: `/` focuses the search box from anywhere outside a text field.
|
|
119
|
+
- The item list exposes `role="group"` with a count label, so screen readers
|
|
120
|
+
announce "条目 · 352" instead of an unnamed region.
|
|
121
|
+
- Accessibility sweep over all four tabs (headless Chromium): 0 buttons without
|
|
122
|
+
an accessible name, 0 unlabeled inputs, 0 switches without a name, proper
|
|
123
|
+
`aria-pressed` / `aria-expanded`, H1 → H2 heading order.
|
|
124
|
+
|
|
125
|
+
## 1.9.1 — 2026-11-15
|
|
126
|
+
|
|
127
|
+
- The tool/command text report ends with `宿主 DSH … · 撤销栈 N 步 · 策略文件 …`,
|
|
128
|
+
so a pasted report carries the host version, undo depth and policy path.
|
|
129
|
+
- Both READMEs gained "At a glance" / 「能力一览」: nine capabilities and where to
|
|
130
|
+
find each one.
|
|
131
|
+
|
|
132
|
+
## 1.9.0 — 2026-11-15
|
|
133
|
+
|
|
134
|
+
- Host compatibility probe: the plugin reads the running DSH version
|
|
135
|
+
(`DSH_INSTALL_DIR`, then `@deepseek-ai/dsh` from the profile) and shows a
|
|
136
|
+
banner when it is older than the tested 0.2.2. Unknown versions stay unknown.
|
|
137
|
+
`/diag` exposes `host`, `/summary` carries it to the panel.
|
|
138
|
+
- Three `hostinfo` tests cover rc suffixes, a newer manifest and an unknown host.
|
|
139
|
+
|
|
140
|
+
## 1.8.8 — 2026-11-15
|
|
141
|
+
|
|
142
|
+
- Restoring an earlier step now asks once ("确认回退?" / Cancel): it discards
|
|
143
|
+
newer history, so a stray click should not be enough.
|
|
144
|
+
- Eight locales gained `confirmRestore` / `cancel`; the demo GIF was re-recorded
|
|
145
|
+
with the corrected custom-preset label after a suite switch.
|
|
146
|
+
|
|
147
|
+
## 1.8.7 — 2026-11-15
|
|
148
|
+
|
|
149
|
+
- Multi-step undo: the Policy tab lists the last 20 remembered steps with their
|
|
150
|
+
label and time, and a Restore button jumps back to any of them (discarding the
|
|
151
|
+
newer ones). `/summary` exposes `undo.entries`; a new `restore` action drives
|
|
152
|
+
it. Restoring does not push a new history entry — it is an undo.
|
|
153
|
+
- Route test covers two actions, the entry list, restore-to-first and an empty
|
|
154
|
+
history afterwards.
|
|
155
|
+
|
|
156
|
+
## 1.8.6 — 2026-11-15
|
|
157
|
+
|
|
158
|
+
- Undo history entries carry the action label, so the footer button reads
|
|
159
|
+
"撤销上一步 · 已关闭 REA · 229 条目" instead of a bare button. The label comes
|
|
160
|
+
from the client (already localized) with a server-side fallback for API calls.
|
|
161
|
+
- `/summary` exposes `undo.last` / `undo.lastAt`; route tests cover the fallback.
|
|
162
|
+
|
|
163
|
+
## 1.8.5 — 2026-11-15
|
|
164
|
+
|
|
165
|
+
- Toasts now say what happened: "已关闭 REA · 229 条目" with Undo, instead of a
|
|
166
|
+
generic "已写入". Item, group, channel and preset actions each carry their own
|
|
167
|
+
message; undo says "已撤销".
|
|
168
|
+
- Eight locales gained `turnedOn` / `turnedOff` / `undone`; the demo GIF was
|
|
169
|
+
re-recorded.
|
|
170
|
+
|
|
171
|
+
## 1.8.4 — 2026-11-15
|
|
172
|
+
|
|
173
|
+
- "Switchable only" filter in the item toolbar: hides read-only entries
|
|
174
|
+
(workspace rules, required contexts), 34 groups become 31 on the reference
|
|
175
|
+
snapshot. The footer shows `31/34` while the filter is on, and the choice is
|
|
176
|
+
remembered like the view mode.
|
|
177
|
+
- Eight locales gained `onlySwitchable` / `onlySwitchableHint`.
|
|
178
|
+
|
|
179
|
+
## 1.8.3 — 2026-11-15
|
|
180
|
+
|
|
181
|
+
- The Notes tab now carries the effective-assembly check: one button calls
|
|
182
|
+
`/verify`, shows whether this session was created with the policy, and prints
|
|
183
|
+
the effective section/context/tool counts next to the panel's own numbers.
|
|
184
|
+
- Eight locales gained the `verify*` keys; the about screenshot was refreshed.
|
|
185
|
+
|
|
186
|
+
## 1.8.2 — 2026-11-15
|
|
187
|
+
|
|
188
|
+
- Search highlights the matched substring in group labels and item names.
|
|
189
|
+
The helper is named `HitMark` on purpose: `Highlight` is a DOM global (CSS
|
|
190
|
+
Custom Highlight API), and the first version crashed every row by shadowing
|
|
191
|
+
it — caught while verifying with real page errors, not by reading the code.
|
|
192
|
+
|
|
193
|
+
## 1.8.1 — 2026-11-15
|
|
194
|
+
|
|
195
|
+
- The success toast now carries an inline Undo for six seconds, so a mistaken
|
|
196
|
+
suite switch can be reverted without scrolling to the footer.
|
|
197
|
+
- Policy tab: Copy report (clipboard), next to export/import; the settings
|
|
198
|
+
screenshot was regenerated with the new buttons.
|
|
199
|
+
- Eight locales gained `copyReport` / `copied` / `copyFailed`.
|
|
200
|
+
|
|
201
|
+
## 1.8.0 — 2026-11-15
|
|
202
|
+
|
|
203
|
+
- Policy import: the Policy tab accepts a JSON file — either a bare policy or a
|
|
204
|
+
whole exported manifest — validates it, writes it atomically, and records it
|
|
205
|
+
on the undo stack, so an import can be reverted with one click.
|
|
206
|
+
- Action bodies may be up to 1 MiB so an exported manifest can be pasted back;
|
|
207
|
+
imports that are not objects are rejected with `invalid-policy`.
|
|
208
|
+
- Route tests cover bare policy, exported manifest, undo after import and the
|
|
209
|
+
invalid shape.
|
|
210
|
+
|
|
211
|
+
## 1.7.0 — 2026-11-15
|
|
212
|
+
|
|
213
|
+
- `/inject apply [tokens]`: turn the current (or given) budget into a policy from
|
|
214
|
+
the terminal, with the per-suite summary in the reply.
|
|
215
|
+
- `/inject undo`: revert the last policy write from the command line.
|
|
216
|
+
- Command writes now share the panel's undo history. The new command tests
|
|
217
|
+
caught that they previously bypassed it, so `/inject undo` after
|
|
218
|
+
`/inject apply` used to fail with "nothing-to-undo".
|
|
219
|
+
- Six command tests cover budget, apply, undo, an already-fitting target and
|
|
220
|
+
unknown subcommands.
|
|
221
|
+
|
|
222
|
+
## 1.6.1 — 2026-11-15
|
|
223
|
+
|
|
224
|
+
- The group/flat view and the selected tab persist across reloads (localStorage,
|
|
225
|
+
per browser). Private windows fall back to the defaults.
|
|
226
|
+
- The fourth KPI now answers "how big is the first request next to the whole
|
|
227
|
+
session": `697.6k` with `占本会话 12%` instead of a bare "not comparable" note.
|
|
228
|
+
- Screenshots and the demo GIF re-recorded with the new toolbar and KPI.
|
|
229
|
+
|
|
230
|
+
## 1.6.0 — 2026-11-15
|
|
231
|
+
|
|
232
|
+
- The KPI shows the preset by name (全开 / 极简 / 自定义 / Everything / Minimal)
|
|
233
|
+
instead of the raw id, and carries the saved percentage when a policy is active.
|
|
234
|
+
- Group view gained 展开全部 / 折叠全部; the toolbar now reads search → view mode
|
|
235
|
+
→ channel filter → expand controls.
|
|
236
|
+
- Tried a per-row size bar behind each row; it read as stray underlines, so it
|
|
237
|
+
was removed before release rather than shipped as decoration.
|
|
238
|
+
|
|
239
|
+
## 1.5.1 — 2026-11-15
|
|
240
|
+
|
|
241
|
+
- Budget suggestions are summarised per suite: a 130-item "turn REA off"
|
|
242
|
+
suggestion is one row instead of a flat list of 147 items, and the same suite
|
|
243
|
+
is never listed twice across channels. The plan still applies item names, so
|
|
244
|
+
applying it remains a normal policy write.
|
|
245
|
+
|
|
246
|
+
## 1.5.0 — 2026-11-15
|
|
247
|
+
|
|
248
|
+
- `npm run smoke`: runs the whole snapshot pipeline against a fake context and
|
|
249
|
+
prints the text report, so the plugin can be sanity-checked without DSH. CI
|
|
250
|
+
runs it too.
|
|
251
|
+
- SECURITY.md: reporting channel, verifiable boundaries (no eval, no network,
|
|
252
|
+
no workspace writes), accepted risks.
|
|
253
|
+
- GitHub issue templates (bug / feature) and a pull-request template ask for the
|
|
254
|
+
`/diag` fields and the locale-key check that actually matter.
|
|
255
|
+
- Locale parity is now tested: every language must match English's key paths,
|
|
256
|
+
have non-empty values, keep identical `{placeholders}`, and ship its detail
|
|
257
|
+
document.
|
|
258
|
+
|
|
259
|
+
## 1.4.1 — 2026-11-15
|
|
260
|
+
|
|
261
|
+
- Market screenshots extended to six: suites, budget, policy, sidebar, settings
|
|
262
|
+
and the dark theme; `screenshots.json` updated.
|
|
263
|
+
- `docs/PERFORMANCE.md`: measured timings on the real 352-item snapshot
|
|
264
|
+
(panel ready 168–240 ms, 229-row expand 61–120 ms, search 37–54 ms) and the
|
|
265
|
+
conclusion that a virtual list is unnecessary.
|
|
266
|
+
- README shows the dark theme and links the performance page.
|
|
267
|
+
|
|
268
|
+
## 1.4.0 — 2026-11-15
|
|
269
|
+
|
|
270
|
+
- Security: JSON responses carry `nosniff` / `DENY` / `no-store`; writes also
|
|
271
|
+
check that a present `Origin` matches the serving host (on top of the
|
|
272
|
+
`sec-fetch-site` and JSON content-type checks). Covered by tests.
|
|
273
|
+
- Release pipeline: `.github/workflows/release.yml` runs on `v*` tags, verifies
|
|
274
|
+
the tag matches `package.json`, runs the full suite, checks the pack contents
|
|
275
|
+
and publishes to npm with the `NPM_TOKEN` secret (provenance enabled).
|
|
276
|
+
- CONTRIBUTING.md: local loop, pre-commit checks, design constraints, release.
|
|
277
|
+
- Search input is deferred (`useDeferredValue`) so typing stays responsive on a
|
|
278
|
+
350-row table.
|
|
279
|
+
|
|
280
|
+
## 1.3.1 — 2026-11-15
|
|
281
|
+
|
|
282
|
+
- Integration tests: a fake context drives `applyPolicyForAgent` through all
|
|
283
|
+
four channels; route tests cover suite toggles, undo, export and the
|
|
284
|
+
cross-site guard (27 tests total).
|
|
285
|
+
- Docs: architecture (channels, snapshot pipeline, apply timing) and a FAQ.
|
|
286
|
+
- README demo GIF: switching the REA suite off and undoing it, recorded from
|
|
287
|
+
the fixture against real snapshot data.
|
|
288
|
+
|
|
289
|
+
## 1.3.0 — 2026-11-15
|
|
290
|
+
|
|
291
|
+
- Eight UI languages: Simplified Chinese, English, Japanese, Spanish, French,
|
|
292
|
+
German, Russian and Portuguese. The panel follows the browser language, and
|
|
293
|
+
the host locale service receives every dictionary, so switching the
|
|
294
|
+
application language works too. Units (`chars`/`items`/`groups`, the AGENTS.md
|
|
295
|
+
chain line, the "required" badge) are localized instead of hard-coded.
|
|
296
|
+
- New screenshot of the Policy tab, now listed in `screenshots.json`.
|
|
297
|
+
|
|
298
|
+
## 1.2.1 — 2026-11-15
|
|
299
|
+
|
|
300
|
+
- Accessibility: visible `:focus-visible` rings on every control, `role="alert"`
|
|
301
|
+
for failed actions and `role="status"` for confirmations, Escape closes the
|
|
302
|
+
sidebar panel, transitions respect `prefers-reduced-motion`, and the read-only
|
|
303
|
+
badge got a higher-contrast colour.
|
|
304
|
+
- Policy tab: fixed-height text areas instead of stretching to the card.
|
|
305
|
+
|
|
306
|
+
## 1.2.0 — 2026-11-15
|
|
307
|
+
|
|
308
|
+
- Export the manifest: `GET /plugins/dsh-injection-manager/export?format=md|json`
|
|
309
|
+
and two buttons in the Policy tab. Markdown for a ticket, JSON for comparing
|
|
310
|
+
two machines; same snapshot as the panel.
|
|
311
|
+
- Text rendering tests (suite list, missing instruction files, session anchor).
|
|
312
|
+
|
|
313
|
+
## 1.1.0 — 2026-11-15
|
|
314
|
+
|
|
315
|
+
- Undo: every policy write remembers the previous policy (20 deep), so a whole
|
|
316
|
+
229-item suite switch is one click away from being reverted. The panel shows
|
|
317
|
+
an Undo button whenever history is available.
|
|
318
|
+
|
|
319
|
+
- Plugin configuration card (Plugins → Configuration): hide the composer chip,
|
|
320
|
+
refresh on window focus, show raw key names, and seed a first-run token budget.
|
|
321
|
+
The plugin keeps working when the schema library cannot be resolved (Config is
|
|
322
|
+
then omitted instead of failing activation).
|
|
323
|
+
- The panel now reports a failed switch instead of silently doing nothing, and
|
|
324
|
+
confirms a successful write briefly.
|
|
325
|
+
- Settings loader is covered by unit tests.
|
|
326
|
+
|
|
327
|
+
## 1.0.1 — 2026-11-15
|
|
328
|
+
|
|
329
|
+
- Renamed to `dsh-injection-manager` (from the 1.0.0 development name
|
|
330
|
+
`dsh-context-injection`, itself from `dsh-context-preflight`). The name owns
|
|
331
|
+
the "injection" word — DSH's own tool is `context_injection` — instead of
|
|
332
|
+
competing with 83 `context-*` plugins. Old policy files are still imported.
|
|
333
|
+
- README: install command in the first screen, CI/license/dsh badges, three real
|
|
334
|
+
panel screenshots, `screenshots.json` for the plugin market, and a
|
|
335
|
+
compatibility document.
|
|
336
|
+
- CI workflow: syntax check + unit tests on Node 20/22 + bundle metadata check.
|
|
337
|
+
- Policy data directory is now `$DSH_HOME/injection-manager/`; both earlier
|
|
338
|
+
locations are read once on first upgrade.
|
|
339
|
+
|
|
340
|
+
## 1.0.0 — 2026-11-15
|
|
341
|
+
|
|
342
|
+
First release under the new name and package id `dsh-injection-manager`
|
|
343
|
+
(previously developed as `dsh-context-preflight`).
|
|
344
|
+
|
|
345
|
+
- One snapshot of the first request: prompt sections, runtime contexts, skill
|
|
346
|
+
catalog, tool schemas and the workspace-rule chain, each with characters and
|
|
347
|
+
estimated tokens.
|
|
348
|
+
- Suites: entries cluster into switchable groups (one MCP server = one suite,
|
|
349
|
+
otherwise shared naming prefixes, skills by provider, sections/contexts by
|
|
350
|
+
namespace), so 229 REA tools become a single switch with a tri-state state.
|
|
351
|
+
- Per-item switches, per-channel master switches, `all` / `only` / `except`
|
|
352
|
+
modes, two presets, a greedy token budget and custom persona prefix/suffix.
|
|
353
|
+
- Effects are session-scoped registrations: prompt sections and runtime
|
|
354
|
+
contexts through a scoped `system-prompt/assemble` filter, skills by shadow
|
|
355
|
+
registration, tools through `tools.restrict`. No user file is read or
|
|
356
|
+
written.
|
|
357
|
+
- Read-only model tool `context_injection`, `/inject` command, sidebar icon,
|
|
358
|
+
composer chip, management page, and a `/verify` route that re-assembles a
|
|
359
|
+
live session to prove the policy landed.
|
|
360
|
+
- Policy is imported once from `dsh-context-preflight` when only the old file
|
|
361
|
+
exists.
|
|
362
|
+
|
|
363
|
+
### Fixed compared with the pre-1.0 development line
|
|
364
|
+
|
|
365
|
+
- Never renames `AGENTS.md` or rewrites `SKILL.md`; disabling a rule no longer
|
|
366
|
+
mutates the workspace.
|
|
367
|
+
- Required runtime contexts (working directory, subagent identity) can no
|
|
368
|
+
longer be dropped by a policy.
|
|
369
|
+
- Section/context exclusion no longer fails with "already registered in this
|
|
370
|
+
scope" (agent presets own those names); it uses the scoped assemble filter.
|
|
371
|
+
- One implementation of the preview math, so the panel and the applied policy
|
|
372
|
+
cannot disagree.
|
|
373
|
+
- Policy writes are atomic and per-action; two open panels cannot overwrite
|
|
374
|
+
each other's switches.
|
|
375
|
+
- Cross-site POSTs are rejected; the action API requires same-origin JSON.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 参与开发
|
|
2
|
+
|
|
3
|
+
## 本地跑
|
|
4
|
+
|
|
5
|
+
```powershell
|
|
6
|
+
# 只跑逻辑,不需要 DSH
|
|
7
|
+
node --test
|
|
8
|
+
|
|
9
|
+
# 装到当前 profile(链接安装,改完文件刷新页面即可)
|
|
10
|
+
# 在 DSH 里:Plugins → Add plugin → 选这个目录
|
|
11
|
+
# 或:dsh plugin add D:/path/to/dsh-injection-manager
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
改宿主机代码(`index.js`、`lib/*`)后需要让插件重新加载:Plugins 里关掉再打开,或重启 DSH。改 `client.js` / `locale/*.json` 刷新页面即可。
|
|
15
|
+
|
|
16
|
+
## 提交前
|
|
17
|
+
|
|
18
|
+
```powershell
|
|
19
|
+
node --check index.js
|
|
20
|
+
node --check client.js
|
|
21
|
+
Get-ChildItem lib/*.js | ForEach-Object { node --check $_.FullName }
|
|
22
|
+
node --test
|
|
23
|
+
npm pack --dry-run # 确认 locale/docs/icon 都进包
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 设计约束(改之前先读)
|
|
27
|
+
|
|
28
|
+
1. **一份快照**:面板、工具、导出、生效策略都从 `buildSnapshot()` 来;不要在浏览器里重算 token 或策略。
|
|
29
|
+
2. **不写 workspace 文件**:任何开关只能是会话作用域注册。
|
|
30
|
+
3. **只影响新会话**:策略在 `agent/created`(`startup` / `clear`)应用。
|
|
31
|
+
4. **必填上下文不可关**:`working-directory:current`、`subagent:identity`。
|
|
32
|
+
5. **段落不能同名 shadow**:agent preset 已占用这些名字,必须走 scoped `system-prompt/assemble`。
|
|
33
|
+
|
|
34
|
+
更细的时序与通道表见 [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)。
|
|
35
|
+
|
|
36
|
+
## 发布
|
|
37
|
+
|
|
38
|
+
版本号写在 `package.json`,CHANGELOG 加一节,然后:
|
|
39
|
+
|
|
40
|
+
```powershell
|
|
41
|
+
git tag v1.3.2
|
|
42
|
+
git push origin v1.3.2
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`.github/workflows/release.yml` 会校验 tag 与版本一致、跑测试、`npm pack --dry-run`,最后用仓库 secret `NPM_TOKEN` 发布到 npm。没有该 secret 时发布会失败,其余步骤照常给出信号。
|
|
46
|
+
|
|
47
|
+
## 语言
|
|
48
|
+
|
|
49
|
+
界面词条在 `locale/<code>.json` 的 `client` 段,键集必须与 `locale/en.json` 完全一致;`meta` 段给插件市场展示用。新增语言 = 一个 JSON + 一个 `docs/DETAIL.<code>.md`(一行图片)。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 IWHB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,184 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Context injection · dsh-injection-manager
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/IWHBIWHB/dsh-injection-manager/actions/workflows/ci.yml)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](docs/COMPATIBILITY.md)
|
|
6
|
+
|
|
7
|
+
Manages everything a DeepSeek Harness session receives before its first request: system-prompt sections, runtime contexts, the skill catalog, tool schemas and workspace rules. Items are clustered into suites, so a whole MCP server is one switch, and the result can be held to a token budget.
|
|
8
|
+
|
|
9
|
+
> **1.9.9**: eight UI languages, multi-step undo history, manifest export/import, suite clustering, over-budget markers, host check, /inject apply and undo.
|
|
10
|
+
> See the [changelog](CHANGELOG.md).
|
|
11
|
+
|
|
12
|
+
```powershell
|
|
13
|
+
dsh plugin add github:IWHBIWHB/dsh-injection-manager
|
|
14
|
+
# or: Plugins → Add plugin → pick this directory
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Refresh the page; the "Injection" icon appears in the left panel list.
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
## Screens
|
|
22
|
+
|
|
23
|
+
| Items, clustered by suite | Budget, target 24k |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
|  |  |
|
|
26
|
+
|
|
27
|
+
The sidebar shows the same snapshot compactly, and the composer carries a one-line chip:
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
Policy tab: presets, four channel masters, custom prefix/suffix, export and undoable policy import, and the
|
|
32
|
+
last application record.
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
Dark theme follows the host:
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
Switching the REA suite off moves the first request from 83.8k to 17.8k tokens;
|
|
41
|
+
Undo brings it back (real data, interactions recorded against the fixture):
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
## Plugin configuration
|
|
46
|
+
|
|
47
|
+
Plugins → dsh-injection-manager → Configuration exposes four presentation and
|
|
48
|
+
first-run options:
|
|
49
|
+
|
|
50
|
+
| Setting | Default | Effect |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `dock` | on | Show the "injection 84k · 97% switchable" chip next to the composer |
|
|
53
|
+
| `refreshOnFocus` | on | Refresh the panel when the window regains focus |
|
|
54
|
+
| `showRawNames` | on | Show the raw key (`harness:identity`) next to the readable label |
|
|
55
|
+
| `budgetTokens` | 0 | Initial budget before a policy file exists; 0 = none |
|
|
56
|
+
|
|
57
|
+
Actual switches stay in the policy file, so there is never a second source of
|
|
58
|
+
truth that disagrees with the panel.
|
|
59
|
+
|
|
60
|
+
## Why
|
|
61
|
+
|
|
62
|
+
In a typical DSH session the biggest part of the first request is not your prompt but the tool schemas. On a machine with one large MCP server, 280 tool definitions can cost 75k tokens out of an 84k first request. None of it is visible, and there is no single place to turn it off.
|
|
63
|
+
|
|
64
|
+
This plugin flattens that first request into a list and actually applies the switches — not by editing your files, but by registering a nearer layer inside each new session's scope.
|
|
65
|
+
|
|
66
|
+
## Clusters: switch a whole suite
|
|
67
|
+
|
|
68
|
+
The list groups by suite by default instead of showing hundreds of rows:
|
|
69
|
+
|
|
70
|
+
- One MCP server is one suite. On the machine this was built on, 229 `mcp__rea__*` tools collapse into "REA" — 65,979 tokens, 78.7% of the first request — and one switch turns the whole server off.
|
|
71
|
+
- Non-MCP tools cluster by naming prefix (`agentero_*`, `office_*`, `schedule_*`); singletons fall back to "core tools".
|
|
72
|
+
- Skills group by provider (for example 33 `filesystem` skills in one group).
|
|
73
|
+
- Sections and contexts group by namespace; the `mcp:rea` instructions section joins the REA group instead of standing alone.
|
|
74
|
+
- A group row shows item count, tokens, share and a tri-state switch; a partially disabled group shows the mixed state.
|
|
75
|
+
|
|
76
|
+
Search and the channel filter work inside the grouped view and expand matching groups; a flat view remains for one-by-one tuning.
|
|
77
|
+
|
|
78
|
+
## What it manages
|
|
79
|
+
|
|
80
|
+
| Channel | Mechanism | Effect when switched off |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| Prompt sections | A session-scoped `system-prompt/assemble` filter drops the named section | That text disappears from the system prompt |
|
|
83
|
+
| Runtime contexts | Same filter by name (required entries excluded) | Approval/sandbox snapshots stop entering the first request |
|
|
84
|
+
| Skill catalog | A same-name, non-invocable skill registered in the session scope | The skill disappears from the model-visible catalog |
|
|
85
|
+
| Tool schemas | `tools.restrict({ deny })` | The definition and parameters are no longer sent |
|
|
86
|
+
| Workspace rules | **Read-only display** | — |
|
|
87
|
+
|
|
88
|
+
Workspace rules (`AGENTS.md` / `CLAUDE.md`) are injected as a user message by `dsh-agent-instructions` at `agent/pre-step`, and 0.2.2 exposes no public suppression hook. The plugin never renames, deletes or edits those files: the panel marks them read-only and reports whether each candidate is actually on the load path and within budget.
|
|
89
|
+
|
|
90
|
+
Required contexts (working directory, subagent identity) are read-only too; no policy can drop them.
|
|
91
|
+
|
|
92
|
+
## Five entry points
|
|
93
|
+
|
|
94
|
+
| Entry | Where | What |
|
|
95
|
+
| --- | --- | --- |
|
|
96
|
+
| Sidebar icon | Left panel list, "Injection" | Opens the management page |
|
|
97
|
+
| Management page | Main area | Items / Policy / Budget / Notes |
|
|
98
|
+
| Composer chip | Under the input | First-turn total and switchable share, deliberately muted; × hides it, Notes can bring it back |
|
|
99
|
+
| `context_injection` tool | Model-callable | Read-only snapshot with a Markdown card |
|
|
100
|
+
| `/inject` command | Composer | Text report; `/inject minimal`, `/inject all`, `/inject budget 20000`, `/inject apply [20000]`, `/inject undo` |
|
|
101
|
+
|
|
102
|
+
The model-facing tool is read-only: the model cannot loosen or tighten the policy. Every write comes from a click in the panel.
|
|
103
|
+
|
|
104
|
+
## At a glance
|
|
105
|
+
|
|
106
|
+
| Capability | Where |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| Items and switches | Items: four channels in one list, clustered into suites (one MCP server = one switch) |
|
|
109
|
+
| Presets and budget | Policy / Budget: everything, minimal, custom; greedy trim against a token budget, undoable |
|
|
110
|
+
| Undo and history | Footer "undo"; Policy tab lists the last 20 steps and can restore any of them (asks once) |
|
|
111
|
+
| Export / import / copy | Policy tab: Markdown and JSON export, undoable policy import, copy report |
|
|
112
|
+
| Verify it landed | Notes tab "check this session", or `GET /verify?session=` |
|
|
113
|
+
| Command line | `/inject all|minimal|budget N|apply [N]|undo` |
|
|
114
|
+
| Model-side tool | `context_injection`: the same snapshot the panel shows |
|
|
115
|
+
| Eight languages / dark / keyboard | Follows host language and theme; / focuses search, Esc closes, switches are tabbable |
|
|
116
|
+
| Host check | Banner when the running DSH is older than 0.2.2 |
|
|
117
|
+
|
|
118
|
+
## 60-second tour
|
|
119
|
+
|
|
120
|
+
1. Install, restart DSH, open "Injection" in the left panel list. The Items tab shows four channels and suite-clustered entries (reference snapshot: REA's 229 tools are 78.7%).
|
|
121
|
+
2. Switch the whole REA suite off: the "after policy" KPI drops from 83.8k to 17.8k, the toast says "Disabled REA · 229 items", and it carries an undo.
|
|
122
|
+
3. Open Notes and press "Check this session": the current session reports that it predates the saved policy. That is expected — a policy only affects sessions created after it is saved.
|
|
123
|
+
4. Create a new session (or run `/inject` anywhere): the first request should only carry what you left on, and `/inject` prints the same numbers.
|
|
124
|
+
5. To revert: the toast's undo, the footer's undo, or Notes → Undo history for an earlier step.
|
|
125
|
+
|
|
126
|
+
Five steps is usually enough to decide whether it earns a place in your setup.
|
|
127
|
+
|
|
128
|
+
## Policy semantics
|
|
129
|
+
|
|
130
|
+
The policy lives in `$DSH_HOME/injection-manager/policy.json`, one file, written atomically.
|
|
131
|
+
|
|
132
|
+
Each channel has three modes: `all`, `only` (keep the listed names), `except` (drop the listed names). A single switch in the panel lands in `except`, or removes the entry from an `only` list, so manual switches and presets never fight each other.
|
|
133
|
+
|
|
134
|
+
- **Everything** — no policy.
|
|
135
|
+
- **Minimal** — identity, persona prefix, and the file/terminal tools only. On the machine this was built on, it moves the first request from 84k to 5k tokens.
|
|
136
|
+
- **Budget** — enter a target; the plugin greedily picks the largest switchable items and summarises them per suite (one row for turning REA off, 130 items), then applies the suggestion on click. Required contexts and workspace rules never participate; an unreachable target is reported as unreachable instead of silently failing.
|
|
137
|
+
- **Custom prefix/suffix** — free text that replaces `deployment:persona-prefix` / `deployment:persona-suffix`. Empty means nothing is injected. Both change the prompt prefix and therefore cache reuse; the panel says so.
|
|
138
|
+
|
|
139
|
+
## Install
|
|
140
|
+
|
|
141
|
+
```powershell
|
|
142
|
+
dsh plugin add github:IWHBIWHB/dsh-injection-manager
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Or locally: DSH → Plugins → Add plugin → pick this directory, or
|
|
146
|
+
`dsh plugin add D:/path/to/dsh-injection-manager`. Refresh the page; the "Injection" icon appears in the left panel list.
|
|
147
|
+
|
|
148
|
+
Upgrading from `dsh-context-preflight` / `dsh-context-injection`: if only an old policy file exists, it is read once and used as the current policy. Writes always go to `$DSH_HOME/injection-manager/policy.json`.
|
|
149
|
+
|
|
150
|
+
Version support and required APIs: [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
|
|
151
|
+
|
|
152
|
+
## Design choices
|
|
153
|
+
|
|
154
|
+
- **No user files touched.** The old plugin renamed `AGENTS.md` and rewrote `SKILL.md` frontmatter to "disable" a rule. Everything here is a session-scoped registration: reversible, and it cannot edit the wrong project when two sessions have different working directories.
|
|
155
|
+
- **New sessions only.** The policy applies at `agent/created`; a running conversation is never rewritten. The panel states whether the current session was created with the policy.
|
|
156
|
+
- **One snapshot.** The list, the tool card and the applied policy all come from the same snapshot, so the preview is the number that takes effect. No second implementation in the browser.
|
|
157
|
+
- **Honest numbers.** Tokens are estimates: ASCII ÷ 4, other characters ÷ 1.6. Not tokenizer output; the composer's own statistics remain authoritative.
|
|
158
|
+
|
|
159
|
+
## Self-check
|
|
160
|
+
|
|
161
|
+
- `GET /plugins/dsh-injection-manager/ping`
|
|
162
|
+
- `GET /plugins/dsh-injection-manager/summary?session=<id>` — the snapshot the panel renders.
|
|
163
|
+
- `GET /plugins/dsh-injection-manager/verify?session=<id>` — re-assembles a live session and returns the **effective** sections, contexts and tool names. This proves the policy landed, not just that a file changed. The Notes tab has the same check behind a button.
|
|
164
|
+
- `GET /plugins/dsh-injection-manager/diag` — client module presence in the boot table, last application result, how many times the assemble filter ran, and the before/after section counts.
|
|
165
|
+
|
|
166
|
+
## Docs
|
|
167
|
+
|
|
168
|
+
- [Architecture](docs/ARCHITECTURE.md): the four injection channels, the snapshot pipeline, and when a policy takes effect
|
|
169
|
+
- [FAQ](docs/FAQ.md): why AGENTS.md cannot be switched off, unreachable budgets, relation to dsh-context
|
|
170
|
+
- [Compatibility](docs/COMPATIBILITY.md): tested versions, required APIs, upgrade checks
|
|
171
|
+
- [Performance](docs/PERFORMANCE.md): measured timings for 352 items, 34 suites, a 229-row expand
|
|
172
|
+
- [Security](SECURITY.md): reporting, verifiable boundaries, accepted risks
|
|
173
|
+
- [Contributing](CONTRIBUTING.md): local loop, pre-commit checks, release steps (`npm run smoke` runs the pipeline offline)
|
|
174
|
+
|
|
175
|
+
## Limitations
|
|
176
|
+
|
|
177
|
+
- 0.2.2 has no ordering API for contributions; the budget is a greedy largest-first heuristic, not a global optimum.
|
|
178
|
+
- The skill catalog is a pre-step message, so granularity is per-skill (or the whole catalog via the `skill` tool).
|
|
179
|
+
- User-message channels such as workspace rules and time context cannot be switched off; the plugin shows them instead of pretending otherwise.
|
|
180
|
+
- UI ships in Simplified Chinese, English, Japanese, Spanish, French, German, Russian and Portuguese; adding a language is one JSON file in `locale/`.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT
|