@goodandready/dsh-agent-loop-guard 0.2.28 → 0.3.0

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.0] - 2026-11-14
4
+
5
+ ### Added
6
+ - **Error Thrashing Guard (#141)**: Automatic detection and cancellation of tool failure loops (`LOOP_GUARD_ERROR_THRASHING`). Extracts normalized error signatures (`FS_ENOENT`, `FS_EPERM`, `FS_ENOSPC`, `EXIT_*`, `HTTP_*`, `TIMEOUT`, `CONN_REFUSED`) across tool calls with different parameters. Halts runaway retry cycles when failures exceed `maxConsecutiveFailures` (default: 4, configurable). Resets immediately on productive tool progress.
7
+ - **Smart Steering (#142)**: 2-stage defensive mechanism that provides actionable steering directives (`[LOOP_GUARD_STEER] Warning: ...`) before hard cancellation. Injects contextual guidance prompting the agent to change tool parameters, switch tools, diagnose root causes, or provide a text answer. Escalates to hard stop (`answerOnly`) if the agent ignores the directive. Configurable via `adaptiveSteering` (boolean, default: true).
8
+ - **Incident Journal & Post-Mortem in UI (#143)**: Circular buffer (capacity 30) capturing all violations and steering events with timestamp, session, code, tool name, reason, and call chain history. Exposed via `/api/@goodandready/dsh-agent-loop-guard/telemetry` with reverse chronological order (last 20). Integrated into DSH Web UI Settings Card with incident list and 1-click "Copy Diagnostic Dump" button for rapid troubleshooting and bug reports.
9
+ - **Sensitivity Presets (#144)**: 1-click preset selector in DSH Web UI Settings Card offering 3 tuned profiles: `Strict` (tight limits for small or hallucinating models), `Balanced` (default optimal limits for production workloads), and `Autonomous Coding` (expanded limits for deep multi-file refactoring). Exported `GUARD_PRESETS` in public API. Complete localization in EN, RU, and ZH.
10
+
11
+
12
+ ## [0.2.29] - 2026-11-12
13
+
14
+ ### Added
15
+ - **Canonical Entry Points & Documentation (#136)**: Added standard project entry files `AGENTS.md` (agent workflow constraints, identity invariants, build commands), `index.md` (project roadmap, architecture, commands, test matrix), and `deploy.sh` (canonical test, identity, and profile installation script). Added `.gitattributes` with `export-ignore` rules, ensuring internal documentation is strictly excluded from npm releases and public GitHub mirrors.
16
+ - **Package Cleanliness & Root Artifact Guard (#137)**: Added `scripts/pack-check.mjs` and `npm run pack:check` script. Enforces that untracked `.tgz` archives cannot reside in the repository root (moved to persistent `~/.dsh/artifacts/`) and validates the strict file size budget (<= 256 KiB) across all packaged files. Added automated unit tests in `test/pack-release.test.js`.
17
+
18
+ ### Fixed
19
+ - **Security Vulnerability Remediations (#138)**: Resolved high-severity vulnerability in `zod` (GHSA-mrhx-c7xc-m3w5) and moderate-severity vulnerability in `fast-uri` (GHSA-w74x-v6f9-j3xg) via explicit `overrides` in `package.json` (`zod >= 4.6.6`, `fast-uri >= 3.1.9`). Cleaned `npm audit --omit=dev` down to 0 vulnerabilities.
20
+ - **Dead Export Removal & Architecture Modularization (#139)**: Removed unused and dead export `DEFAULT_STOP_PATTERNS` from `lib/guard-state.js` in favor of anchored regular expressions `EXPLICIT_STOP_EN` / `EXPLICIT_STOP_ZH` in `isDefaultStopRequest()`. Modularized helper functions, pattern compilers, and fingerprint generators into `lib/guard-helpers.js` with full backward-compatible re-exports, bringing all server files strictly under the 600-line limit and eliminating preflight warnings.
21
+
3
22
  ## [0.2.28] - 2026-11-10
4
23
 
5
24
  ### Added
package/README.md CHANGED
@@ -44,7 +44,11 @@ When autonomous AI coding agents encounter unexpected tool failures, ambiguous i
44
44
  1. **Progress-Aware Tool-Call Guard**: Employs epoch-based state tracking so that repeated calls are blocked *only* when no meaningful state changes or new evidence appear. Legitimate productive iterations (e.g. `read` ➔ `edit` ➔ `read` ➔ `edit`) remain fully unrestricted.
45
45
  2. **Assistant Output Loop Breaker**: Detects text-only repetition (identical streaming lines or multi-line markdown blocks) across turns and steps, cleanly canceling runaway generation without damaging session history.
46
46
  3. **Answer-Only Graceful Fallback**: Instead of terminating abruptly, the plugin triggers structured DSH denials that guide the LLM into answering with text explaining the bottleneck.
47
- 4. **Zero Core Modifications**: Implemented purely through Cordis lifecycle hooks (`ctx.tools.guard`, `agent/pre-step`, `tools/execute`, `session/event`).
47
+ 4. **Error Thrashing Guard**: Halts runaway failure cycles sharing normalized error signatures (`FS_ENOENT`, `FS_EPERM`, `EXIT_*`, `HTTP_*`, etc.) even when parameters vary.
48
+ 5. **Smart Steering**: 2-stage defense injecting actionable self-correction directives (`[LOOP_GUARD_STEER]`) before escalating to hard cancellation.
49
+ 6. **Incident Journal & Diagnostic Dump**: Circular telemetry buffer tracking recent incidents with execution chains and 1-click dump copying in Web UI.
50
+ 7. **Sensitivity Presets**: 1-click preset selector (`Strict`, `Balanced`, `Autonomous Coding`) for immediate threshold configuration.
51
+ 8. **Zero Core Modifications**: Implemented purely through Cordis lifecycle hooks (`ctx.tools.guard`, `agent/pre-step`, `tools/execute`, `session/event`).
48
52
 
49
53
  ---
50
54
 
package/README.ru.md CHANGED
@@ -44,7 +44,11 @@
44
44
  1. **Контроль прогресса инструментов (Progress-Aware Epochs)**: повторные вызовы инструментов блокируются *только тогда*, когда с прошлой попытки не изменилось состояние системы или результат. Легитимные продуктивные циклы (например, `чтение` ➔ `правка` ➔ `чтение` ➔ `правка`) выполняются абсолютно свободно.
45
45
  2. **Предохранитель генерации текста (Assistant Output Loop Guard)**: отслеживает повторение отдельных строк и целых многострочных абзацев между шагами и ходами, выполняя мягкую отмену генерации без потери истории диалога.
46
46
  3. **Безопасный переход в режим ответа (Answer-Only Mode)**: при фиксации зацикливания инструмент не просто падает с ошибкой, а возвращает структурированный отказ, обязывающий модель сформулировать текстовый ответ пользователю с объяснением проблемы.
47
- 4. **Маскирование секретов в журналах**: любые ключи доступа, токены и пароли автоматически заменяются на `[redacted]` в диагностических логах.
47
+ 4. **Error Thrashing Guard**: Предотвращение серий одинаковых ошибок инструментов (`FS_ENOENT`, `FS_EPERM`, `EXIT_*`, `HTTP_*` и др.) даже при разных параметрах.
48
+ 5. **Smart Steering**: Двухступенчатая защита с упреждающей подсказкой самоисправления (`[LOOP_GUARD_STEER]`) до применения жесткого cancel.
49
+ 6. **Журнал инцидентов и дамп диагностики**: Кольцевой буфер инцидентов с цепочками вызовов и кнопка быстрого копирования дампа в Web UI.
50
+ 7. **Пресеты чувствительности**: Переключение профилей в один клик (`Strict`, `Balanced`, `Autonomous Coding`) в карточке настроек.
51
+ 8. **Маскирование секретов в журналах**: любые ключи доступа, токены и пароли автоматически заменяются на `[redacted]` в диагностических логах.
48
52
 
49
53
  ---
50
54
 
package/README.zh.md CHANGED
@@ -44,7 +44,11 @@
44
44
  1. **进度感知型工具防循环(Progress-Aware Epochs)**:仅在工具调用未产生任何状态变化或新证据时判定为死循环。合法的有效迭代(如 `读` ➔ `写` ➔ `读` ➔ `写`)完全不受限制。
45
45
  2. **文本输出流防死循环(Assistant Output Guard)**:实时监测智能体流式输出,精准识别跨回合或跨步骤的单行及多行 Markdown 段落重复,安全中断生成而不破坏历史对话。
46
46
  3. **平滑降级至仅回答模式(Answer-Only Mode)**:触发死循环拦截时,向模型返回结构化 DSH 拒绝信息,强制要求模型输出文本向用户说明当前遇到的瓶颈。
47
- 4. **日志隐私脱敏**:所有安全警告日志自动对 Token、密码、API Key 等敏感数据进行 `[redacted]` 掩码处理。
47
+ 4. **工具重复报错拦截(Error Thrashing Guard)**:即使调用参数不同,也能归一化识别相同错误类型(`FS_ENOENT`、`EXIT_*`、`HTTP_*` 等)并阻断无效重试。
48
+ 5. **智能自纠正引导(Smart Steering)**:两阶段保护机制,在硬熔断前提供纠偏提示(`[LOOP_GUARD_STEER]`),引导模型自主改变策略。
49
+ 6. **拦截日志与一键诊断包**:环形遥测缓冲区记录最近事件及其调用链,并在设置面板提供一键复制诊断数据功能。
50
+ 7. **灵敏度预设(Presets)**:设置卡片提供 Strict / Balanced / Autonomous 一键预设切换。
51
+ 8. **日志隐私脱敏**:所有安全警告日志自动对 Token、密码、API Key 等敏感数据进行 `[redacted]` 掩码处理。
48
52
 
49
53
  ---
50
54