@goodandready/dsh-agent-loop-guard 0.2.9 → 0.2.11

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 ADDED
@@ -0,0 +1,90 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.11] - 2026-09-18
9
+
10
+ - **Settings reachable again**: the settings card registered into
11
+ `settings.plugin.item`, a slot the current DSH core no longer renders, so the
12
+ guard's settings were unreachable. The surface now registers into the Plugins
13
+ page row seat `plugins.row.config`, keyed
14
+ `@goodandready/dsh-agent-loop-guard#@goodandready/dsh-agent-loop-guard` (row id
15
+ as `cordis.patch.yml` declares it): the plugin's row gains a configure control
16
+ whose page is the settings form (`view: 'page'`, rendered bare — `PluginCard`
17
+ accepts a `bare` prop and drops the card chrome because the host page draws the
18
+ title, icon, crumb and padding) plus a one-line state under the title
19
+ (`view: 'summary'`). The legacy seat stays registered as a fallback for older
20
+ cores.
21
+ - **Row-seat guard** (`test/row-config-seat.test.js`): checks the row key against
22
+ `package.json` and `cordis.patch.yml`, the seat order (row seat first) and the
23
+ bare page render.
24
+
25
+ ## [0.2.10] - 2026-09-18
26
+
27
+ - **Documentation & Packaging Architecture**:
28
+ - Migrated cumulative version changelogs from all three README files (`README.md`, `README.ru.md`, `README.zh.md`) to canonical root `CHANGELOG.md` adhering to Keep a Changelog standard (#56).
29
+ - Explicitly added `CHANGELOG.md` to `files` whitelist in `package.json` for npm distribution.
30
+ - Expanded thematic feature sections across all three language documentations with dedicated coverage of Native WebUI Settings Card, Protection Telemetry, and One-Click In-Place Updater.
31
+ - Synchronized automated test count to 51 tests across Russian and Chinese documentations.
32
+ - Updated design contract status and documentation standards in `docs/design/DESIGN.md`.
33
+
34
+ ## [0.2.9] - 2026-09-18
35
+
36
+ - **Theme Guard & Token Integrity**: eliminated 100% of hardcoded hex and rgba colors from `lib/client.js` in both CSS styles and JSX inline markup, switching entirely to DSH design tokens (`var(--dsw-alias-*)`) and `color-mix(in srgb, ...)`; added automated regression test `test/theme-guard.test.js` enforcing zero hex/rgba literals (#53, #39).
37
+ - **Updater Resilience**: hardened `currentVersion` and status endpoint against corrupted, non-JSON or missing manifests, returning safe fallback status without throwing unhandled exceptions (#47).
38
+ - **Distribution & Package Hygiene**: removed internal `docs` directory from npm distribution package `files` whitelist; added diagnostic warning with `bestEffort` annotation to client primitives loader; pruned stale branches and worktrees (#54).
39
+ - **Test Suite**: expanded to 51 automated tests covering theme token compliance and manifest corruption handling.
40
+
41
+ ## [0.2.8] - 2026-09-18
42
+
43
+ - **Host & Security Engine Hardening**:
44
+ - Expanded stop keyword detector with Russian keyword `'стоп'` for multilingual interrupt safety (#43).
45
+ - Enforced loopback and same-origin validation on `/telemetry` endpoint (#37).
46
+ - Eliminated dead `if(true)` branch and unused `releaseCall` method in core guard engine (#44).
47
+ - Deprecated legacy alias `maxCallsPerToolPerTurn` in configuration schema per standard (#48).
48
+ - Replaced empty catch blocks with structured debug logging via `ctx.logger('loop-guard')` (#49).
49
+ - **WebUI Client & Design System Alignment**:
50
+ - Aligned settings card with DSH standard CSS variables `--dsw-alias-*` and primitive chevron icon with smooth 180° rotation (#39).
51
+ - Removed emoji headers (`🛑`, `📊`) for a clean, professional interface (#39).
52
+ - Fixed localization reactivity by resolving locale from `ctx.locale.getLocale()` and registering within `ctx.effect` lifecycle (#40, #41).
53
+ - Removed hardcoded version strings; version is dynamically verified from updater endpoint (#42).
54
+ - Enhanced accessibility: all form controls now link `<label>` with `<input>` using `htmlFor` and explicit IDs (#45).
55
+ - Added robust HTTP error checking (`res.ok`) and user-facing error indicators for updater and telemetry actions (#49).
56
+ - **Distribution & Repository Hygiene**:
57
+ - Cleaned repository root from temporary tarballs and pruned 15 merged branches (#46).
58
+ - Removed internal planning and architectural documentation from the public package (#35, #36).
59
+ - Documented canonical updater architecture and rationale in `DESIGN.md` (#47).
60
+ - Full automated test suite expanded to 49 comprehensive unit and integration tests.
61
+
62
+ ## [0.2.7] - 2026-09-17
63
+
64
+ - **Deferred Slot Injection**: wrapped `settings.plugin.item` registration in `registerSlotWhenReady` with `ctx.slots.inject` to prevent `slot "settings.plugin.item" is not declared` crash during early plugin initialization (#33).
65
+ - **Slot Specification Compliance**: aligned slot registration descriptor to use `key: NS` and `inject: () => ({ ctx })` according to `dsh-plugin-authoring` standard (#33).
66
+ - **Automated Client Suite**: added tests in `test/client.test.js` validating deferred slot injection and safe fallback (#33).
67
+
68
+ ## [0.2.6] - 2026-09-16
69
+
70
+ - **Browser ModuleLoader Fix**: added explicit `var exports = module.exports;` in `lib/client.js` factory function to prevent `ReferenceError: exports is not defined` when client bundle is imported by DSH WebUI ModuleLoader (#31).
71
+ - **Client Test Suite**: added automated VM test in `test/client.test.js` validating client script execution in strict ModuleLoader environment (#31).
72
+
73
+ ## [0.2.5] - 2026-09-15
74
+
75
+ - **One-Click Updater**: integrated reusable host-side updater (`lib/plugin-updater.js`) with endpoint `/api/@goodandready/dsh-agent-loop-guard/update` and settings UI button/status (#29).
76
+ - **Strict Tools & Adaptive Budgets**: added `strictTools` and `strictToolLimit` to impose tighter quotas on sensitive or mutating commands (#29).
77
+ - **Dry-Run / Audit-Only Mode**: added `dryRunMode` setting to audit agent execution and record metrics without breaking active tool calls (#29).
78
+ - **Protection Telemetry & Observability**: live incident counters (`LOOP_GUARD_DUPLICATE`, `LOOP_GUARD_REPEAT`, `LOOP_GUARD_LIMIT`, `LOOP_GUARD_OUTPUT`) exposed via endpoint `/api/@goodandready/dsh-agent-loop-guard/telemetry` and rendered in the UI card with one-click reset (#29).
79
+ - **Smart Recovery Guidance**: violation messages now provide structured steering instructions for LLMs (e.g. DeepSeek-R1 / V3) indicating exact corrective actions (#29).
80
+ - **Strict Multilingual Standards**: codebase cleaned to canonical English (`en`) and complete Chinese (`zh`) with zero internal Russian code, registered translation issue #197 in `goodandready/dsh-russian-lang` (#29).
81
+ - **Design Contract**: created mandatory `docs/design/DESIGN.md` per `project-design-contract` standard (#29).
82
+ - **Expanded Test Suite**: 37 automated tests covering updater semver/security, telemetry tracking, strict tool thresholds, and dry-run mode (#29).
83
+
84
+ ## [0.2.4] - 2026-09-14
85
+
86
+ - **Settings UI**: allow saving `0` for `maxToolAttemptsPerTurn` to cleanly disable aggregate turn budget (#28).
87
+ - **Outcome Analysis**: recognize `{ error: null }` and `{ error: false }` as non-failures in execution outcome evaluation (#28).
88
+ - **Alternating Loop Breaker**: track prior results per tool fingerprint (`state.lastResults`) to block alternating non-productive loops (A ➔ B ➔ A ➔ B) (#28).
89
+ - **Settings Card**: add reactive `settings.plugin.item` card in DSH Settings with live configuration updates (#26).
90
+ - **Test Suite**: expanded to 31 automated tests covering error edge cases and alternating loop enforcement (#28).
package/README.md CHANGED
@@ -123,6 +123,13 @@ All loop guard warning logs automatically redact sensitive credentials:
123
123
  * Bearer tokens, passwords, cookies, and query parameter secrets (`token=`, `api-key=`, `secret=`) are replaced with `[redacted]` before reaching logs.
124
124
  * Deeply nested argument trees are bounded to prevent memory leaks during massive JSON payloads.
125
125
 
126
+ ### 5. Native WebUI Settings, Telemetry & One-Click Updater
127
+
128
+ * **Integrated Settings Card**: Placed directly inside DSH Web UI under *Settings ➔ Plugins ➔ Plugin Settings* (`settings.plugin.item`, order 95).
129
+ * **Native DSH Design System**: Styled exclusively using standard DSH design variables (`--dsw-alias-*`), accessible `<label>`/`<input>` associations (`htmlFor`/`id`), and smooth chevron rotation without external UI dependencies.
130
+ * **Live Protection Telemetry**: Real-time counters of blocked loops (`LOOP_GUARD_DUPLICATE`, `LOOP_GUARD_REPEAT`, `LOOP_GUARD_LIMIT`, `LOOP_GUARD_OUTPUT`) with instant statistics reset via `/api/@goodandready/dsh-agent-loop-guard/telemetry`.
131
+ * **One-Click In-Place Updater**: Seamless version verification against the npm registry and one-click upgrades via authenticated loopback API (`/api/@goodandready/dsh-agent-loop-guard/update`).
132
+
126
133
  ---
127
134
 
128
135
  ## 📦 Installation
@@ -189,62 +196,6 @@ npm run check
189
196
 
190
197
  ## 📄 License
191
198
 
192
- MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
193
-
194
- ## Changed in v0.2.9
195
-
196
- - **Theme Guard & Token Integrity**: eliminated 100% of hardcoded hex and rgba colors from `lib/client.js` in both CSS styles and JSX inline markup, switching entirely to DSH design tokens (`var(--dsw-alias-*)`) and `color-mix(in srgb, ...)`; added automated regression test `test/theme-guard.test.js` enforcing zero hex/rgba literals (#53, #39).
197
- - **Updater Resilience**: hardened `currentVersion` and status endpoint against corrupted, non-JSON or missing manifests, returning safe fallback status without throwing unhandled exceptions (#47).
198
- - **Distribution & Package Hygiene**: removed internal `docs` directory from npm distribution package `files` whitelist; added diagnostic warning with `bestEffort` annotation to client primitives loader; pruned stale branches and worktrees (#54).
199
- - **Test Suite**: expanded to 51 automated tests covering theme token compliance and manifest corruption handling.
200
-
201
- ## Changed in v0.2.8
202
-
203
- - **Host & Security Engine Hardening**:
204
- - Expanded stop keyword detector with Russian keyword `'стоп'` for multilingual interrupt safety (#43).
205
- - Enforced loopback and same-origin validation on `/telemetry` endpoint (#37).
206
- - Eliminated dead `if(true)` branch and unused `releaseCall` method in core guard engine (#44).
207
- - Deprecated legacy alias `maxCallsPerToolPerTurn` in configuration schema per standard (#48).
208
- - Replaced empty catch blocks with structured debug logging via `ctx.logger('loop-guard')` (#49).
209
- - **WebUI Client & Design System Alignment**:
210
- - Aligned settings card with DSH standard CSS variables `--dsw-alias-*` and primitive chevron icon with smooth 180° rotation (#39).
211
- - Removed emoji headers (`🛑`, `📊`) for a clean, professional interface (#39).
212
- - Fixed localization reactivity by resolving locale from `ctx.locale.getLocale()` and registering within `ctx.effect` lifecycle (#40, #41).
213
- - Removed hardcoded version strings; version is dynamically verified from updater endpoint (#42).
214
- - Enhanced accessibility: all form controls now link `<label>` with `<input>` using `htmlFor` and explicit IDs (#45).
215
- - Added robust HTTP error checking (`res.ok`) and user-facing error indicators for updater and telemetry actions (#49).
216
- - **Distribution & Repository Hygiene**:
217
- - Cleaned repository root from temporary tarballs and pruned 15 merged branches (#46).
218
- - Removed internal planning and architectural documentation from the public package (#35, #36).
219
- - Documented canonical updater architecture and rationale in `DESIGN.md` (#47).
220
- - Full automated test suite expanded to 49 comprehensive unit and integration tests.
221
-
222
- ## Changed in v0.2.7
223
-
224
- - **Deferred Slot Injection**: wrapped `settings.plugin.item` registration in `registerSlotWhenReady` with `ctx.slots.inject` to prevent `slot "settings.plugin.item" is not declared` crash during early plugin initialization (#33).
225
- - **Slot Specification Compliance**: aligned slot registration descriptor to use `key: NS` and `inject: () => ({ ctx })` according to `dsh-plugin-authoring` standard (#33).
226
- - **Automated Client Suite**: added tests in `test/client.test.js` validating deferred slot injection and safe fallback (#33).
227
-
228
- ## Changed in v0.2.6
229
-
230
- - **Browser ModuleLoader Fix**: added explicit `var exports = module.exports;` in `lib/client.js` factory function to prevent `ReferenceError: exports is not defined` when client bundle is imported by DSH WebUI ModuleLoader (#31).
231
- - **Client Test Suite**: added automated VM test in `test/client.test.js` validating client script execution in strict ModuleLoader environment (#31).
232
-
233
- ## Changed in v0.2.5
234
-
235
- - **One-Click Updater**: integrated reusable host-side updater (`lib/plugin-updater.js`) with endpoint `/api/@goodandready/dsh-agent-loop-guard/update` and settings UI button/status (#29).
236
- - **Strict Tools & Adaptive Budgets**: added `strictTools` and `strictToolLimit` to impose tighter quotas on sensitive or mutating commands (#29).
237
- - **Dry-Run / Audit-Only Mode**: added `dryRunMode` setting to audit agent execution and record metrics without breaking active tool calls (#29).
238
- - **Protection Telemetry & Observability**: live incident counters (`LOOP_GUARD_DUPLICATE`, `LOOP_GUARD_REPEAT`, `LOOP_GUARD_LIMIT`, `LOOP_GUARD_OUTPUT`) exposed via endpoint `/api/@goodandready/dsh-agent-loop-guard/telemetry` and rendered in the UI card with one-click reset (#29).
239
- - **Smart Recovery Guidance**: violation messages now provide structured steering instructions for LLMs (e.g. DeepSeek-R1 / V3) indicating exact corrective actions (#29).
240
- - **Strict Multilingual Standards**: codebase cleaned to canonical English (`en`) and complete Chinese (`zh`) with zero internal Russian code, registered translation issue #197 in `goodandready/dsh-russian-lang` (#29).
241
- - **Design Contract**: created mandatory `docs/design/DESIGN.md` per `project-design-contract` standard (#29).
242
- - **Expanded Test Suite**: 37 automated tests covering updater semver/security, telemetry tracking, strict tool thresholds, and dry-run mode (#29).
243
-
244
- ## Changed in v0.2.4
245
-
246
- - **Settings UI**: allow saving `0` for `maxToolAttemptsPerTurn` to cleanly disable aggregate turn budget (#28).
247
- - **Outcome Analysis**: recognize `{ error: null }` and `{ error: false }` as non-failures in execution outcome evaluation (#28).
248
- - **Alternating Loop Breaker**: track prior results per tool fingerprint (`state.lastResults`) to block alternating non-productive loops (A ➔ B ➔ A ➔ B) (#28).
249
- - **Settings Card**: add reactive `settings.plugin.item` card in DSH Settings with live configuration updates (#26).
250
- - **Test Suite**: expanded to 31 automated tests covering error edge cases and alternating loop enforcement (#28).
199
+ * **License**: MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
200
+ * **Changelog**: Detailed release history and migration notes are maintained in [CHANGELOG.md](CHANGELOG.md).
201
+
package/README.ru.md CHANGED
@@ -115,6 +115,19 @@ graph TD
115
115
  * **Иммунитет во время выполнения инструментов**: пока агент ждёт завершения длительной команды, отмена текста временно блокируется.
116
116
  * **Чистый сброс**: при отправке нового сообщения пользователем состояние детектора полностью очищается.
117
117
 
118
+ ### 4. Санитизация журналов и защита приватности
119
+
120
+ Все предупреждающие записи журнала автоматически маскируют чувствительные учетные данные:
121
+ * Токены Bearer, пароли, cookie и секреты в query-параметрах (`token=`, `api-key=`, `secret=`) заменяются на `[redacted]` до записи в лог.
122
+ * Ограничена глубина вложенности деревьев аргументов для предотвращения утечек памяти при разборе крупных JSON-структур.
123
+
124
+ ### 5. Веб-интерфейс, живая телеметрия и обновление в один клик
125
+
126
+ * **Интегрированная карточка настроек**: нативно встроена во вкладку *«Настройки → Плагины → Настройки плагинов»* (`settings.plugin.item`, order 95).
127
+ * **Дизайн-система DSH**: построена строго на системных переменных DSH (`--dsw-alias-*`), доступных связках `<label>`/`<input>` (`htmlFor`/`id`) и нативном шевроне с плавной анимацией без тяжёлых сторонних UI-библиотек.
128
+ * **Телеметрия инцидентов**: живые счётчики заблокированных петель (`LOOP_GUARD_DUPLICATE`, `LOOP_GUARD_REPEAT`, `LOOP_GUARD_LIMIT`, `LOOP_GUARD_OUTPUT`) с возможностью мгновенного сброса через защищённый маршрут `/api/@goodandready/dsh-agent-loop-guard/telemetry`.
129
+ * **One-Click Updater**: проверка актуальных версий в реестре npm и обновление плагина в один клик через защищённый loopback API (`/api/@goodandready/dsh-agent-loop-guard/update`).
130
+
118
131
  ---
119
132
 
120
133
  ## 📦 Установка
@@ -170,7 +183,7 @@ dsh-agent-loop-guard:
170
183
 
171
184
  ## 🧪 Тестирование
172
185
 
173
- Запуск набора из 37 автоматизированных тестов и статической проверки:
186
+ Запуск полного набора из 51 автоматизированного теста и статической проверки:
174
187
 
175
188
  ```bash
176
189
  npm test
@@ -181,64 +194,6 @@ npm run check
181
194
 
182
195
  ## 📄 Лицензия
183
196
 
184
- MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
185
-
186
- ---
187
-
188
- ## Изменения в версии v0.2.9
189
-
190
- - **Дизайн-система и тест-страж**: устранены 100% хардкод-цветов (hex и rgba) в `lib/client.js` в CSS-стилях и инлайн-разметке JSX, выполнен полный переход на CSS-переменные DSH (`var(--dsw-alias-*)`) и `color-mix(in srgb, ...)`; добавлен тест-страж `test/theme-guard.test.js`, гарантирующий нулевое присутствие hex/rgba в клиенте (#53, #39).
191
- - **Отказоустойчивость апдейтера**: защищён разбор `currentVersion` и эндпоинта обновлений при повреждённых или не-JSON файлах манифеста, возвращается безопасный статус вместо неотловленного исключения (#47).
192
- - **Чистота репозитория и пакета**: каталог `docs` исключён из распространяемого npm-пакета через белый список `files` в `package.json`; в `lib/client.js` пустой `catch` заменён на диагностический warning с аннотацией `bestEffort`; удалена смерженная ветка и очищены устаревшие `.worktrees` (#54).
193
- - **Тесты**: тестовый набор расширен до 51 автотеста, включая проверку дизайн-токенов и отказоустойчивости манифеста.
194
-
195
- ## Изменения в версии v0.2.8
196
-
197
- - **Усиление серверного движка и безопасности**:
198
- - Расширен список стоп-слов русским ключевым словом `'стоп'` для мультиязычного безопасного прерывания циклов (#43).
199
- - Реализована строгая валидация loopback и same-origin для эндпоинта `/telemetry` (#37).
200
- - Удалена мертвая ветка `if(true)` и неиспользуемый метод `releaseCall` в ядре guard (#44).
201
- - Устаревший алиас `maxCallsPerToolPerTurn` корректно помечен как deprecated в схеме параметров (#48).
202
- - Пустые блоки `catch {}` заменены структурированным логированием через `ctx.logger('loop-guard')` (#49).
203
- - **Клиентский интерфейс и дизайн-система DSH**:
204
- - Карточка настроек переведена на стандартные CSS-переменные DSH `--dsw-alias-*` и системный шеврон с плавной ротацией на 180° (#39).
205
- - Удалены эмодзи из заголовков (`🛑`, `📊`) для соответствия строгому нативному стилю DSH (#39).
206
- - Исправлена реактивность локализации через `ctx.locale.getLocale()` и регистрацию в жизненном цикле `ctx.effect` (#40, #41).
207
- - Удалены захардкоженные версии; актуальная версия динамически проверяется через эндпоинт обновления (#42).
208
- - Доступность (a11y): все поля формы связывают `<label>` и `<input>` через `htmlFor` и явные ID (#45).
209
- - Добавлена проверка `res.ok` и отображение понятных сообщений об ошибках при сбое сети в обновлении и телеметрии (#49).
210
- - **Дистрибуция и репозиторий**:
211
- - Очищен корень проекта от временных `.tgz` архивов, удалены 15 смерженных устаревших веток (#46).
212
- - Внутренние архитектурные и проектные черновики исключены из публичного пакета (#35, #36).
213
- - Зафиксирована архитектура канонического апдейтера в `DESIGN.md` (#47).
214
- - Полный набор автоматических тестов расширен до 49 тестов.
215
-
216
- ## Изменения в версии v0.2.7
217
-
218
- - **Отложенная инъекция слота настроек**: регистрация карточки `settings.plugin.item` обёрнута в `registerSlotWhenReady` с использованием `ctx.slots.inject`, что исключает ошибку `slot "settings.plugin.item" is not declared` при ранней загрузке плагина в браузере (#33).
219
- - **Соответствие стандарту слотов DSH**: дескриптор слота переведён на `key: NS` и `inject: () => ({ ctx })` согласно стандарту `dsh-plugin-authoring` (#33).
220
- - **Автотесты клиента**: расширен тестовый набор `test/client.test.js` с проверкой подписки через `slots.inject` и безопасного fallback-поведения (#33).
221
-
222
- ## Изменения в версии v0.2.6
223
-
224
- - **Исправление загрузчика браузера**: добавлена явная инициализация `var exports = module.exports;` в функции factory `lib/client.js`, исключающая ошибку `ReferenceError: exports is not defined` при импорте клиентского бандла загрузчиком веб-интерфейса DSH ModuleLoader (#31).
225
- - **Тестирование клиентского бандла**: добавлен автоматический тест `test/client.test.js` с изолированным контекстом Node VM для проверки клиентского скрипта (#31).
226
-
227
- ## Изменения в версии v0.2.5
228
-
229
- - **Обновление в один клик**: интеграция хостового модуля обновления (`lib/plugin-updater.js`), эндпоинта `/api/@goodandready/dsh-agent-loop-guard/update` и кнопки/индикатора в карточке настроек (#29).
230
- - **Строгий контроль чувствительных инструментов**: добавлены настройки `strictTools` и `strictToolLimit` для ужесточения лимитов на мутирующие операции (#29).
231
- - **Режим аудита (Dry-Run)**: добавлен параметр `dryRunMode` для аудита работы агента и сбора телеметрии без блокировки вызовов (#29).
232
- - **Телеметрия инцидентов**: фиксация счетчиков нарушений (`LOOP_GUARD_DUPLICATE`, `LOOP_GUARD_REPEAT`, `LOOP_GUARD_LIMIT`, `LOOP_GUARD_OUTPUT`), эндпоинт `/api/@goodandready/dsh-agent-loop-guard/telemetry`, панель метрик в карточке и кнопка сброса (#29).
233
- - **Инструкции по восстановлению для LLM**: при блокировках агенту отправляются структурированные подсказки по изменению стратегии (#29).
234
- - **Строгая локализация EN/ZH**: кодовая база очищена до канонического английского (`en`) и китайского (`zh`), русификация выделена в Issue #197 проекта `goodandready/dsh-russian-lang` (#29).
235
- - **Дизайн-контракт**: оформлен документ `docs/design/DESIGN.md` согласно стандарту `project-design-contract` (#29).
236
- - **Расширенный тестовый набор**: 37 тестов, покрывающих обновление, безопасность, квоты и аудит (#29).
237
-
238
- ## Изменения в версии v0.2.4
239
-
240
- - **Интерфейс настроек**: исправлено сохранение `0` для `maxToolAttemptsPerTurn` — теперь общий лимит попыток можно отключить через карточку плагина (#28).
241
- - **Анализ результатов**: возвращаемые объектами поля `{ error: null }` и `{ error: false }` больше не считаются ошибками и не блокируют продвижение эпохи (#28).
242
- - **Защита от чередующихся циклов**: добавлено отслеживание результатов по каждому инструменту (`state.lastResults`), исключающее зацикливание агента вида A ➔ B ➔ A ➔ B без изменения состояния (#28).
243
- - **Карточка настроек**: внедрена стандартная карточка `settings.plugin.item` с динамическим обновлением параметров на лету (#26).
244
- - **Набор тестов**: расширен до 31 автоматизированного теста.
197
+ * **Лицензия**: MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
198
+ * **История изменений**: Подробная хронология всех релизов и миграций ведётся в [CHANGELOG.md](CHANGELOG.md).
199
+
package/README.zh.md CHANGED
@@ -113,6 +113,19 @@ graph TD
113
113
  * **长耗时工具豁免**:在工具实际执行期间,文本中断检测自动保持静默,避免长任务被误杀。
114
114
  * **用户输入无损重置**:用户发起新对话轮次时,检测状态自动全量清理重置。
115
115
 
116
+ ### 4. 凭证脱敏与日志隐私防护
117
+
118
+ 所有防护告警日志均会自动针对敏感凭证执行脱敏处理:
119
+ * Bearer 令牌、密码、Cookie 与查询参数凭据(`token=`, `api-key=`, `secret=`)在写入日志前一律替换为 `[redacted]`。
120
+ * 对深度嵌套的参数对象执行深度与宽度截断,杜绝超大 JSON 解析引发的内存泄漏。
121
+
122
+ ### 5. 原生 WebUI 设置卡片、实时防护遥测与一键平滑更新
123
+
124
+ * **原生设置面板集成**:直接内嵌于 DSH Web 控制台「设置 ➔ 插件 ➔ 插件设置」卡片列表中(`settings.plugin.item`, order 95)。
125
+ * **对齐 DSH 设计规范**:完全基于 DSH 标准设计令牌变量(`--dsw-alias-*`)与无障碍标签绑定(`htmlFor`/`id`),搭配轻量级平滑展开 Chevron 图标,零外部重型 UI 库依赖。
126
+ * **实时防护遥测看板**:在设置卡片中直观呈现当前运行时拦截的死循环总数(`LOOP_GUARD_DUPLICATE`, `LOOP_GUARD_REPEAT`, `LOOP_GUARD_LIMIT`, `LOOP_GUARD_OUTPUT`),支持通过 `/api/@goodandready/dsh-agent-loop-guard/telemetry` 安全端点一键重置计数。
127
+ * **一键无缝在线更新**:卡片自动联动 npm 官方源检查最新版本,支持通过经过鉴权的本地环回 API(`/api/@goodandready/dsh-agent-loop-guard/update`)在后台安全完成版本升级。
128
+
116
129
  ---
117
130
 
118
131
  ## 📦 快速安装
@@ -168,7 +181,7 @@ dsh-agent-loop-guard:
168
181
 
169
182
  ## 🧪 测试与校验
170
183
 
171
- 运行全部 37 个自动化单元测试及静态代码检查:
184
+ 运行全部 51 个自动化单元与集成测试及静态代码检查:
172
185
 
173
186
  ```bash
174
187
  npm test
@@ -179,64 +192,5 @@ npm run check
179
192
 
180
193
  ## 📄 开源许可证
181
194
 
182
- MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
183
-
184
- ---
185
-
186
- ## v0.2.9 更新日志
187
-
188
- - **设计规范与主题守卫**:彻底移除 `lib/client.js` 中 CSS 与 JSX 内联样式的所有硬编码十六进制与 rgba 颜色,全面接入 DSH 官方设计变量(`var(--dsw-alias-*)` 与 `color-mix(in srgb, ...)`);新增自动化守卫测试 `test/theme-guard.test.js`,严格确保客户端零硬编码颜色 (#53, #39)。
189
- - **更新器容错防护**:对 `currentVersion` 与更新状态端点的清单解析增加 `try/catch` 保护,防止损坏的非 JSON 清单导致未捕获异常 (#47)。
190
- - **包体精简与清理**:从 `package.json` 的 `files` 白名单中移除 `docs` 目录,防止内部文档打包至 npm 发行包中;客户端 primitives 加载处的空 catch 替换为具备 `bestEffort` 注释的诊断警告;清理已合并分支与过期 worktrees (#54)。
191
- - **自动化测试**:测试集扩展至 51 个单元与集成测试。
192
-
193
- ## v0.2.8 更新日志
194
-
195
- - **服务端引擎与安全强化**:
196
- - 停止关键词识别器支持俄语关键词 `'стоп'`,增强跨语言安全熔断保护 (#43)。
197
- - `/telemetry` 接口严格强制本地环回 (loopback) 与同源 (same-origin) 校验 (#37)。
198
- - 移除核心防护引擎中的冗余 `if(true)` 代码块与未使用的 `releaseCall` 方法 (#44)。
199
- - 在配置模型中将旧版别名 `maxCallsPerToolPerTurn` 规范标记为 deprecated 弃用 (#48)。
200
- - 将空异常捕获代码块替换为结构化调试日志 `ctx.logger('loop-guard')` (#49)。
201
- - **WebUI 客户端与设计规范对齐**:
202
- - 设置卡片完全适配 DSH 规范 CSS 变量 `--dsw-alias-*`,并采用原生 Chevron 图标(带 180° 展开旋转动效)(#39)。
203
- - 移除标题表情符号(`🛑`、`📊`),符合沉稳的原生界面风格 (#39)。
204
- - 修复语言切换响应性:通过 `ctx.locale.getLocale()` 获取语言快照并在 `ctx.effect` 生命周期内正确注册 (#40, #41)。
205
- - 移除硬编码版本号,版本信息通过更新接口动态验证 (#42)。
206
- - 可访问性强化:所有表单控件通过 `htmlFor` 与显式 ID 绑定 `<label>` 与 `<input>` (#45)。
207
- - 完善网络请求验证 (`res.ok`),在更新与遥测接口异常时向用户展示友好错误提示 (#49)。
208
- - **发布规范与仓库清理**:
209
- - 清理根目录残留 `.tgz` 打包产物,安全删除 15 个已合入的陈旧分支 (#46)。
210
- - 从公开发布包中剔除内部架构与规划文档 (#35, #36)。
211
- - 在 `DESIGN.md` 中规范记录更新器架构与设计决策 (#47)。
212
- - 全自动化测试集扩充至 49 个单元与集成测试。
213
-
214
- ## v0.2.7 更新日志
215
-
216
- - **延迟插槽注入机制**:使用 `registerSlotWhenReady` 与 `ctx.slots.inject` 包装 `settings.plugin.item` 注册逻辑,防止插件在浏览器前端初始化时因插槽未提前声明而抛出 `slot "settings.plugin.item" is not declared` 崩溃异常 (#33)。
217
- - **插槽规范对齐**:根据 `dsh-plugin-authoring` 标准,将插槽注册参数调整为 `key: NS` 并注入 `inject: () => ({ ctx })` (#33)。
218
- - **客户端自动化测试**:扩展 `test/client.test.js`,全面验证插槽延迟注入逻辑与缺失回退机制 (#33)。
219
-
220
- ## v0.2.6 更新日志
221
-
222
- - **浏览器 ModuleLoader 导入修复**:在 `lib/client.js` 的 factory 函数中显式声明 `var exports = module.exports;`,彻底修复 DSH 网页端 ModuleLoader 动态加载时抛出的 `ReferenceError: exports is not defined` 异常 (#31)。
223
- - **客户端测试用例**:新增 `test/client.test.js`,通过 Node.js VM 模拟浏览器端模块加载环境并自动化验证 (#31)。
224
-
225
- ## v0.2.5 更新日志
226
-
227
- - **一键平滑更新**:集成宿主端更新器(`lib/plugin-updater.js`),提供 `/api/@goodandready/dsh-agent-loop-guard/update` 接口与设置界面更新状态/按钮 (#29)。
228
- - **敏感工具严格配额**:新增 `strictTools` 与 `strictToolLimit` 配置,强化对高危/文件修改工具的重复调用限制 (#29)。
229
- - **审计模式 (Dry-Run)**:新增 `dryRunMode` 配置,支持在不阻断智能体调用的前提下记录告警与度量数据 (#29)。
230
- - **防护遥测与监控**:实时统计拦截指标(`LOOP_GUARD_DUPLICATE`, `LOOP_GUARD_REPEAT`, `LOOP_GUARD_LIMIT`, `LOOP_GUARD_OUTPUT`),提供 `/api/@goodandready/dsh-agent-loop-guard/telemetry` 接口与一键重置 (#29)。
231
- - **LLM 智能恢复引导**:在拦截消息中为 DeepSeek-R1 / V3 等模型提供结构化的破局指导与操作建议 (#29)。
232
- - **严格多语言规范**:代码库仅保留标准英文(`en`)与中文(`zh`),俄语本地化转入 Issue #197 (`goodandready/dsh-russian-lang`) 处理 (#29)。
233
- - **设计契约**:按照 `project-design-contract` 标准建立 `docs/design/DESIGN.md` (#29)。
234
- - **扩展自动化测试**:总测试用例扩充至 37 个,涵盖更新器语义版本、请求安全性、严格工具配额与审计模式 (#29)。
235
-
236
- ## v0.2.4 更新日志
237
-
238
- - **设置界面**:修复 `maxToolAttemptsPerTurn` 保存为 `0` 的问题,允许正常禁用单回合工具调用上限 (#28)。
239
- - **结果解析**:对象中的 `{ error: null }` 与 `{ error: false }` 正确识别为非错误,不再阻碍进展推进 (#28)。
240
- - **交替循环拦截**:通过 `state.lastResults` 跟踪每个工具的先前结果,有效拦截无实质进展的交替循环调用 (A ➔ B ➔ A ➔ B) (#28)。
241
- - **设置卡片**:集成标准 `settings.plugin.item` 配置卡片,支持动态热重载 (#26)。
242
- - **测试用例**:自动化测试扩展至 31 个测试。
195
+ * **开源许可证**: MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
196
+ * **更新历史**: 完整版本演进历史与特性发布记录详见 [CHANGELOG.md](CHANGELOG.md)。
package/lib/client.js CHANGED
@@ -6,6 +6,12 @@ window.__ModuleLoader__.load({
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7
7
  const React = require('react');
8
8
  const NS = '@goodandready/dsh-agent-loop-guard';
9
+ // Row seat on the Plugins page: the row's "configure" control opens this
10
+ // entry, keyed `<package name>#<row id>` exactly as cordis.patch.yml
11
+ // declares the row (kernel: rowConfigKey(bundle, rowId)).
12
+ const PKG = '@goodandready/dsh-agent-loop-guard';
13
+ const ROW_ID = '@goodandready/dsh-agent-loop-guard';
14
+ const ROW_CONFIG_KEY = PKG + '#' + ROW_ID;
9
15
 
10
16
  let PrimitivesChevron = null;
11
17
  try {
@@ -19,6 +25,11 @@ window.__ModuleLoader__.load({
19
25
  }
20
26
 
21
27
  const CSS_STYLES = `
28
+ /* Row seat on the Plugins page: the page owns the frame and the padding. */
29
+ .alg-page {
30
+ width: 100%;
31
+ min-width: 0;
32
+ }
22
33
  .alg-card {
23
34
  border: 1px solid var(--dsw-alias-border-l2);
24
35
  background: var(--dsw-alias-bg-layer-3);
@@ -245,7 +256,7 @@ window.__ModuleLoader__.load({
245
256
  maxAssistantBlockChars: 16384,
246
257
  };
247
258
 
248
- function PluginCard({ ctx: _ctx, t }) {
259
+ function PluginCard({ ctx: _ctx, t, bare }) {
249
260
  const [expanded, setExpanded] = React.useState(false);
250
261
  const [draft, setDraft] = React.useState({
251
262
  ...DEFAULTS,
@@ -517,10 +528,7 @@ window.__ModuleLoader__.load({
517
528
  tt(key)
518
529
  );
519
530
 
520
- return React.createElement('li', {
521
- className: 'alg-card',
522
- },
523
- React.createElement('button', {
531
+ const header = React.createElement('button', {
524
532
  className: 'alg-header-btn',
525
533
  onClick: () => setExpanded(!expanded),
526
534
  'aria-expanded': expanded,
@@ -533,8 +541,8 @@ window.__ModuleLoader__.load({
533
541
  React.createElement('span', { style: { color: 'var(--dsw-alias-label-secondary)', fontSize: 13 } }, tt('sub'))
534
542
  ),
535
543
  renderChevron()
536
- ),
537
- expanded && React.createElement('div', {
544
+ );
545
+ const body = React.createElement('div', {
538
546
  className: 'alg-body',
539
547
  },
540
548
  // Section: One-Click Updater
@@ -608,8 +616,24 @@ window.__ModuleLoader__.load({
608
616
  }, saving ? tt('saving') : tt('ready')),
609
617
  msg && React.createElement('span', { style: { fontSize: 13, color: msg === tt('saved') || msg === tt('statsResetDone') ? 'var(--dsw-alias-status-success)' : 'var(--dsw-alias-status-danger)' } }, msg)
610
618
  )
611
- )
612
- );
619
+ );
620
+
621
+ // The Plugins page renders this entry bare: it draws the title, the icon
622
+ // and the crumb itself, so the row seat must not add a second card frame.
623
+ if (bare) {
624
+ return React.createElement('div', { className: 'alg-page' }, body);
625
+ }
626
+ return React.createElement('li', { className: 'alg-card' }, header, expanded && body);
627
+ }
628
+
629
+ // Row seat component: summary one-liner plus the bare form on the page.
630
+ function PluginItem(props) {
631
+ if (props && props.view === 'summary') {
632
+ return React.createElement('div', {
633
+ style: { color: 'var(--dsw-alias-label-secondary)', fontSize: 13 }
634
+ }, en.sub);
635
+ }
636
+ return React.createElement(PluginCard, { ...props, bare: true });
613
637
  }
614
638
 
615
639
  exports.inject = ['slots', 'settingsScope', 'locale'];
@@ -647,6 +671,22 @@ window.__ModuleLoader__.load({
647
671
  }
648
672
  }
649
673
 
674
+ // Row seat first: the current core renders the Plugins page and opens
675
+ // this entry from the row's configure control. The older seats stay as
676
+ // fallbacks for hosts that only declare them.
677
+ registerSlotWhenReady('plugins.row.config', () =>
678
+ ctx.slots.register(
679
+ {
680
+ name: 'plugins.row.config',
681
+ key: ROW_CONFIG_KEY,
682
+ order: 10,
683
+ locale: NS,
684
+ inject: () => ({ ctx }),
685
+ },
686
+ (props) => React.createElement(PluginItem, { ...props, ctx: (props && props.ctx) || ctx })
687
+ )
688
+ );
689
+
650
690
  registerSlotWhenReady('settings.plugin.item', () =>
651
691
  ctx.slots.register(
652
692
  {
@@ -663,4 +703,4 @@ window.__ModuleLoader__.load({
663
703
 
664
704
  return module.exports;
665
705
  },
666
- });
706
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-agent-loop-guard",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Fail-closed runtime tool-call loop guard for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -16,6 +16,7 @@
16
16
  "README.md",
17
17
  "README.ru.md",
18
18
  "README.zh.md",
19
+ "CHANGELOG.md",
19
20
  "LICENSE"
20
21
  ],
21
22
  "scripts": {