@goodandready/dsh-context-lens 0.1.17 → 0.1.19
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 +107 -0
- package/README.md +86 -112
- package/README.ru.md +95 -110
- package/README.zh.md +99 -4
- package/lib/client.js +207 -20
- package/lib/http.js +114 -0
- package/lib/index.js +121 -203
- package/lib/tokens/tracker.js +0 -4
- package/lib/tools.js +179 -0
- package/lib/updater.js +237 -0
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@goodandready/dsh-context-lens` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.19] - 2026-09-18
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **UI Slot Registration Error Diagnostics (#76)**: Replaced silent/empty `catch` blocks in `lib/client.js` for `sidebar.right.pane.tab`, `conversation.session.header.utilities`, and `betterSidebar` slot registrations with descriptive `console.warn` diagnostic logs. Added explicit fallback intention comments for locale snapshot handling.
|
|
12
|
+
|
|
13
|
+
### Refactored
|
|
14
|
+
- **Tracker Dead Code Cleanup (#77)**: Removed redundant, test-only `clearHistory` export from `lib/tokens/tracker.js`. History clearing is canonically and safely handled by `reset()`.
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
- **Keep a Changelog Standardization (#74)**: Extracted chronological release notes (`## Changed in v...`) from `README.md`, `README.ru.md`, and `README.zh.md` into centralized `CHANGELOG.md`. Consolidated all product feature documentation into comprehensive thematic sections. Included `CHANGELOG.md` in package distribution manifest (`package.json` files list).
|
|
18
|
+
|
|
19
|
+
## [0.1.18] - 2026-09-17
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- **AI Tool ContentBlock Format (GH #2 / Gitea #71)**: Fixed output formatting across all 5 AI tools (`context_lens_status`, `context_lens_compress_preview`, `context_lens_skeletonize`, `context_lens_track`, `context_lens_clear_focus`). All tools now return structured `ContentBlock[]` arrays (`[{ type: 'text', text: ... }]`) instead of raw JSON strings, preventing session-poisoning `TypeError: content.some is not a function` exceptions in `@deepseek-ai/dsh-llm`.
|
|
23
|
+
- **HTTP Parameter Validation (#70)**: Replaced silent error swallows with explicit 400 Bad Request responses and diagnostic warning logging when parsing malformed URL queries or invalid session parameters.
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **In-App One-Click Auto-Updater (#61)**: Added standard updater module (`lib/updater.js`) with `/api/dsh-context-lens/update` endpoint and an in-app update banner with version badge and update button in the settings card.
|
|
27
|
+
|
|
28
|
+
### Security
|
|
29
|
+
- **HTTP Endpoint Hardening (#62, #63)**:
|
|
30
|
+
- `/clear-focus` strictly requires `POST` method (returns 405 on GET) and validates loopback / same-origin trusted source (403 on untrusted).
|
|
31
|
+
- `/compress-preview` strictly requires `POST`, verifies loopback / same-origin, caps request body at 256KB (413 on exceed), and validates `maxLines` parameter (clamped between 1 and 5000).
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- **UI Design System & Theme Alignment (#67, #68)**: Replaced text fallback chevron `▼` with an animated SVG 14x14 icon with smooth 180° rotation. Removed all hardcoded `rgba()` values in favor of DeepSeek Harness `--dsw-alias-*` theme variables.
|
|
35
|
+
- **Settings & Cordis Lifecycle (#64, #66)**: Injected `settingsScope` directly into client plugin dependencies and removed foreign `lanSettings` fallback. Wrapped settings and locale registrations in `ctx.effect` with disposable cleanups.
|
|
36
|
+
- **Code Decomposition (#69)**: Modularized server half into `lib/http.js`, `lib/tools.js`, `lib/updater.js`, and a compact `lib/index.js`.
|
|
37
|
+
- **Repository Hygiene (#65)**: Purged internal agent artifacts (`AGENTS.md`, `index.md`, `docs/plans/`) from tracked git tree and updated `.gitignore`.
|
|
38
|
+
|
|
39
|
+
## [0.1.17] - 2026-09-15
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- **Focus Management UI**: Added active session focus path chips (`focus.paths`) and an instant "Clear focus" button in `StatusPanel`.
|
|
43
|
+
- **Configurable Budget Alert Threshold**: Added `budgetAlertPercent` (50–99%, default 90%) to `Config` and the settings card, allowing customizable budget alert levels.
|
|
44
|
+
- **Expanded AST Syntax**: Added pure regex AST skeletonization for C/C++ (`class`, methods, `#include`) and SQL DDL (`CREATE/ALTER TABLE`, `INDEX`).
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
- **Multi-Language Standard**: Client bundle now strictly contains only canonical English (`en`) and Chinese (`zh`) dictionaries. Russian translations are provided externally via `dsh-russian-lang`.
|
|
48
|
+
|
|
49
|
+
## [0.1.16] - 2026-09-13
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
- **UI Error Boundary**: Wrapped visual components (`PluginCard`, `LensTab`, `StatusPanel`) in native React error boundaries with retry buttons, preventing parent crashes and React Error 310.
|
|
53
|
+
- **Reactive Settings Synchronization**: Added support for reading settings snapshots via `scope.getSnapshot()` and reactive subscriptions via `scope.subscribe()`.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
- **ClineBot Unified Style**: Migrated UI classes to the unified `.cl-*` design system with `--dsw-alias-*` CSS tokens.
|
|
57
|
+
- **Input Validation**: Added defensive input validation across all compression, skeletonization, and tracking functions.
|
|
58
|
+
|
|
59
|
+
## [0.1.15] - 2026-09-11
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
- **Native DSH Right Sidebar**: Added support for DeepSeek Harness 0.1.5-alpha.1+ native right sidebar via `ctx.sidebarRightTabs` and `sidebar.right.pane.tab` slot.
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
- **Sidebar Coexistence**: Preserved legacy `dsh-better-sidebar` integration with deterministic, non-conflicting IDs (`@goodandready/dsh-context-lens` vs `dsh-context-lens:tab`) and graceful fallback across all 4 layouts.
|
|
66
|
+
|
|
67
|
+
## [0.1.14] - 2026-09-09
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
- **AST Multiline Signatures**: Added multiline function and method signature parsing for TypeScript, JavaScript, Rust, and Go.
|
|
71
|
+
- **Reset Tool**: Added `context_lens_reset` tool to reset token tracker statistics and compression history.
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
- **Adaptive Polling**: Header chip pauses polling on hidden browser tabs (`visibilitychange`) and polls actively (4s) only when the popover is open.
|
|
75
|
+
- **Settings Atomicity**: Added atomic settings patch saving in `PluginCard`.
|
|
76
|
+
|
|
77
|
+
## [0.1.13] - 2026-09-07
|
|
78
|
+
|
|
79
|
+
### Fixed
|
|
80
|
+
- **Cordis Proxy Safety**: Guarded optional `betterSidebar` tab registration via `ctx.inject(['betterSidebar'], ...)` instead of direct property access on Cordis context proxy.
|
|
81
|
+
- **Settings Scope Guard**: Protected `_ctx.settingsScope` access in `PluginCard` with try/catch to avoid proxy errors on older hosts.
|
|
82
|
+
|
|
83
|
+
## [0.1.12] - 2026-09-05
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
- **Component Refactoring**: Extracted shared `StatusPanel` component reused by `LensTab` and the `HeaderChip` popover.
|
|
87
|
+
|
|
88
|
+
## [0.1.11] - 2026-09-03
|
|
89
|
+
|
|
90
|
+
### Fixed
|
|
91
|
+
- **Audit Fixes**: Auto-compress honors configured `compressionMode`, `budgetLimit` halts token accumulation once exceeded, focus state is tracked per-session (`sessionId`), and Python imports are properly retained.
|
|
92
|
+
|
|
93
|
+
## [0.1.10] - 2026-08-30
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
- **Session Header Chip**: Registered header chip in `conversation.session.header.utilities` (`order: 7`) with interactive dropdown popover showing live token savings, budget progress, and recent operations.
|
|
97
|
+
|
|
98
|
+
## [0.1.9] - 2026-08-25
|
|
99
|
+
|
|
100
|
+
### Changed
|
|
101
|
+
- **Compatibility**: Removed obsolete kernel modules from client injects for DSH 0.1.2-rc.1.
|
|
102
|
+
|
|
103
|
+
## [0.1.8] - 2026-08-20
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
- **Tool Arguments**: Supported both `text` and `log` parameter names in `context_lens_compress_log`.
|
|
107
|
+
- **Tracker & Parsing**: Fixed cross-platform path resolution on Windows, dynamic `budgetLimit` propagation, ANSI terminal escape sequence stripping, and Rust `pub async fn` syntax support.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
<h3>
|
|
5
|
+
<h3>AST Code Skeletonizer, Terminal Log Condenser & Token Budget Guard for DeepSeek Harness</h3>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/@goodandready/dsh-context-lens"><img src="https://img.shields.io/npm/v/@goodandready/dsh-context-lens.svg?style=for-the-badge&color=6366f1&labelColor=1e1b4b" alt="npm version"></a>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node-20%2B-f59e0b.svg?style=for-the-badge&labelColor=451a03" alt="Node version"></a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
-
<!-- Showcase
|
|
14
|
+
<!-- Showcase Button -->
|
|
15
15
|
<p align="center">
|
|
16
16
|
<a href="https://goodandready.app/"><img src="https://img.shields.io/badge/All_Author_Projects-goodandready.app-ff4500.svg?style=for-the-badge&logo=rocket&logoColor=white&labelColor=1a1a2e" alt="All Author Projects"></a>
|
|
17
17
|
</p>
|
|
@@ -36,169 +36,143 @@
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
-
## ⚡ Overview
|
|
39
|
+
## ⚡ Overview & The Problem
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Large codebase contexts and verbose build/test logs quickly fill the LLM context window, waste token budget, slow down inference, and cause agent hallucination.
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
**`dsh-context-lens`** solves this by providing:
|
|
44
|
+
1. **Active Focus Scoping**: Keeping full fidelity for files currently being edited, while collapsing surrounding workspace files into lightweight AST skeletons.
|
|
45
|
+
2. **Multi-Language AST Skeletonization**: Extracting structural types, classes, and method signatures across TypeScript, JavaScript, Python, Go, C/C++, Rust, and SQL, cutting raw code size by **70–85%**.
|
|
46
|
+
3. **Intelligent Terminal Log Compression**: Stripping noisy passing test lines and build boilerplate while preserving critical error stack traces and failure windows, cutting log size by up to **90%**.
|
|
47
|
+
4. **Session Token Telemetry & Budget Guard**: Live tracking of token savings with configurable budget alerts and visual indicators in the DSH Web UI.
|
|
46
48
|
|
|
47
49
|
```mermaid
|
|
48
50
|
graph LR
|
|
49
|
-
subgraph RawContext [
|
|
50
|
-
Code[📁
|
|
51
|
-
Logs[📋 Test
|
|
51
|
+
subgraph RawContext [Raw Context Streams]
|
|
52
|
+
Code[📁 Source Code: Lengthy Implementation Details] --> LensEngine[dsh-context-lens Engine]
|
|
53
|
+
Logs[📋 Build/Test Logs: Verbose Success Noise] --> LensEngine
|
|
52
54
|
end
|
|
53
55
|
|
|
54
|
-
subgraph LensEngine [Context
|
|
55
|
-
LensEngine --> Focus{
|
|
56
|
-
Focus -->|Focused
|
|
57
|
-
Focus -->|Surrounding Workspace| AST[AST Skeletonizer:
|
|
58
|
-
LensEngine --> LogFilter[
|
|
56
|
+
subgraph LensEngine [Context Processing Pipeline]
|
|
57
|
+
LensEngine --> Focus{Focus Evaluator}
|
|
58
|
+
Focus -->|Focused File| RawKeep[Full Code Details Retained]
|
|
59
|
+
Focus -->|Surrounding Workspace| AST[AST Skeletonizer: Signatures & Types]
|
|
60
|
+
LensEngine --> LogFilter[Log Condenser: Stack Traces & Errors Only]
|
|
59
61
|
end
|
|
60
62
|
|
|
61
|
-
subgraph
|
|
62
|
-
AST --> Agent[🤖 DSH Agent:
|
|
63
|
+
subgraph Output [Optimized Agent Context]
|
|
64
|
+
AST --> Agent[🤖 DSH Agent Context: Compact High-Value Prompt]
|
|
63
65
|
RawKeep --> Agent
|
|
64
66
|
LogFilter --> Agent
|
|
65
|
-
Agent --> Tracker[📊 Live Token Budget
|
|
67
|
+
Agent --> Tracker[📊 Live Token Telemetry & Budget Guard]
|
|
66
68
|
end
|
|
67
69
|
|
|
68
70
|
style RawContext fill:#1e1e2e,stroke:#89b4fa,stroke-width:2px,color:#cdd6f4
|
|
69
71
|
style LensEngine fill:#181825,stroke:#cba6f7,stroke-width:2px,color:#cdd6f4
|
|
70
|
-
style
|
|
72
|
+
style Output fill:#11111b,stroke:#a6e3a1,stroke-width:2px,color:#cdd6f4
|
|
71
73
|
```
|
|
72
74
|
|
|
73
75
|
---
|
|
74
76
|
|
|
75
|
-
## ✨
|
|
77
|
+
## ✨ Full Feature Breakdown
|
|
76
78
|
|
|
77
|
-
### 1. 🧬 Multi-Language AST
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* Allows the agent to understand entire multi-package repository architectures without loading tens of thousands of implementation tokens.
|
|
79
|
+
### 1. 🧬 Multi-Language AST Structural Skeletonizer
|
|
80
|
+
* **Supported Languages**: TypeScript, JavaScript, Python, Go, C/C++, Rust, and SQL DDL.
|
|
81
|
+
* **Structural Preservation**: Retains imports, classes, structs, interfaces, exported types, function signatures, and doc comments while discarding inner implementation bodies.
|
|
82
|
+
* **Multiline Signature Support**: Seamlessly accumulates complex multiline generic arguments, return types, and parameter lists up to block delimiters.
|
|
83
|
+
* **Pure Regex Implementation**: Zero heavy native dependencies or binary parser overhead; runs lightning-fast across any platform.
|
|
83
84
|
|
|
84
|
-
### 2.
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
### 2. 📋 Heuristic Test & Build Log Condenser
|
|
86
|
+
* **Supported Test Runners & Tools**: Jest, Vitest, Pytest, Go test, Cargo, Webpack, Vite, TSC, Maven, Gradle.
|
|
87
|
+
* **Targeted Extraction**: Identifies and preserves critical error messages, stack traces, assertion differences (`Expected ... Received ...`), and failure context windows.
|
|
88
|
+
* **3 Aggressiveness Modes**:
|
|
89
|
+
- `raw`: Removes simple noise lines while keeping general execution order.
|
|
90
|
+
- `balanced`: Preserves failure sections with surrounding context windows (default).
|
|
91
|
+
- `aggressive`: Extracts strictly error lines and stack frames.
|
|
92
|
+
* **ANSI Stripping**: Cleans terminal escape codes and color formatting before processing.
|
|
90
93
|
|
|
91
94
|
### 3. 🎯 Active Path Focus Scoping (`context_lens_focus`)
|
|
92
|
-
*
|
|
93
|
-
* Files
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
* Calculates
|
|
98
|
-
*
|
|
95
|
+
* Allows designating specific files or folders as active working targets for the current task.
|
|
96
|
+
* Files inside focus remain uncompressed; non-focused dependencies are automatically served as structural skeletons.
|
|
97
|
+
* Focus state is strictly scoped per session (`sessionId`) and can be inspected or cleared instantly via UI or API.
|
|
98
|
+
|
|
99
|
+
### 4. 📊 Token Savings Tracking & Budget Telemetry
|
|
100
|
+
* Calculates exact tokens before and after compression using accurate token estimation.
|
|
101
|
+
* Tracks cumulative tokens saved, compression ratio, and session budget percentage.
|
|
102
|
+
* Configurable warning threshold (`budgetAlertPercent`) dynamically alerts when the session budget approaches depletion.
|
|
103
|
+
|
|
104
|
+
### 5. 🖥️ Visual Surfaces & Dual Sidebar Integration
|
|
105
|
+
Context Lens shares the unified `.cl-*` design language and `--dsw-alias-*` token system with `dsh-clinebot`:
|
|
106
|
+
* **Conversation Header Chip**: Mounted in `conversation.session.header.utilities` (`order: 7`). Always displays efficiency badges (`◐ Lens`, `◐ <N>%`, or `⚠` alert) with an interactive dropdown Popover showing savings details and recent operations.
|
|
107
|
+
* **Dual Sidebar Compatibility**: Supports both native DeepSeek Harness right sidebar (`ctx.sidebarRightTabs` + `sidebar.right.pane.tab` slot) and legacy `dsh-better-sidebar` with non-conflicting IDs.
|
|
108
|
+
* **ErrorBoundary Protection**: Every UI component (`PluginCard`, `LensTab`, `StatusPanel`) is isolated inside React error boundaries with instant retry buttons, preventing parent UI crashes.
|
|
109
|
+
* **One-Click In-App Updater**: Settings card displays live version checks against npm with a single-click update trigger.
|
|
99
110
|
|
|
100
111
|
---
|
|
101
112
|
|
|
102
|
-
## 🛠️ Agent Tools Reference (
|
|
113
|
+
## 🛠️ Agent Tools Reference (5 Tools)
|
|
114
|
+
|
|
115
|
+
All tools strictly conform to the DeepSeek Harness tool specification by providing `output.render` returning structured `ContentBlock[]` arrays (`[{ type: 'text', text: ... }]`), ensuring 100% session stability with core LLM stream processors.
|
|
103
116
|
|
|
104
117
|
| Tool Name | Parameters | Description |
|
|
105
118
|
|---|---|---|
|
|
106
|
-
| `context_lens_focus` | `paths: string[]`, `
|
|
107
|
-
| `context_lens_compress_log` | `text: string` *(or `log`)*, `mode?: "raw"
|
|
108
|
-
| `context_lens_compress_code` | `code: string`, `language?: string`, `maxDepth?: number`, `filePath?: string` | Generates a clean structural AST skeleton from raw source code |
|
|
109
|
-
| `
|
|
119
|
+
| `context_lens_focus` | `paths: string[]`, `sessionId?: string` | Sets active focus files/folders for the session; collapses surrounding workspace into AST skeletons |
|
|
120
|
+
| `context_lens_compress_log` | `text: string` *(or `log`)*, `mode?: "raw"|"balanced"|"aggressive"`, `maxLines?: number`, `auto?: boolean` | Condenses terminal and test outputs, keeping only stack traces and failure windows |
|
|
121
|
+
| `context_lens_compress_code` | `code: string`, `language?: string`, `maxDepth?: number`, `filePath?: string`, `sessionId?: string` | Generates a clean structural AST skeleton from raw source code |
|
|
122
|
+
| `context_lens_track` | `sessionId?: string` | Returns real-time cumulative token savings, history, and budget status for the session |
|
|
123
|
+
| `context_lens_reset` | `sessionId?: string` | Resets token tracker counters and compression history at the start of new tasks |
|
|
110
124
|
|
|
111
125
|
---
|
|
112
126
|
|
|
113
|
-
##
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
dsh plugin --profile web add @goodandready/dsh-context-lens
|
|
117
|
-
```
|
|
127
|
+
## 🔌 HTTP API Reference
|
|
118
128
|
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
| Endpoint | Method | Security Checks | Description |
|
|
130
|
+
|---|---|---|---|
|
|
131
|
+
| `/dsh-context-lens/status` | `GET` | Open (safe read) | Returns session token savings stats, active focus paths, and compression history |
|
|
132
|
+
| `/dsh-context-lens/clear-focus` | `POST` | Loopback / Same-Origin | Clears focused paths for the specified session (rejects GET with 405) |
|
|
133
|
+
| `/dsh-context-lens/compress-preview` | `POST` | Loopback / Same-Origin | Preview log compression with 256KB body size limit and `maxLines` clamping (1–5000) |
|
|
134
|
+
| `/api/dsh-context-lens/update` | `GET`, `POST` | Loopback + Security Header | In-app plugin updater checking npm registry and executing safe background updates |
|
|
121
135
|
|
|
122
136
|
---
|
|
123
137
|
|
|
124
138
|
## ⚙️ Configuration Reference (`settings.yaml`)
|
|
125
139
|
|
|
140
|
+
Settings can be modified via `settings.yaml` or directly in the DSH Web UI under **Settings → Plugins → Context Lens**.
|
|
141
|
+
|
|
126
142
|
```yaml
|
|
127
143
|
dsh-context-lens:
|
|
128
|
-
compressionMode: balanced # 'raw', 'balanced', or 'aggressive'
|
|
144
|
+
compressionMode: balanced # Log compression mode: 'raw', 'balanced', or 'aggressive'
|
|
129
145
|
astSkeletonMaxDepth: 3 # Maximum depth level for AST signature traversal (1..10)
|
|
130
146
|
tokenSavingsTracking: true # Track and display live token savings
|
|
131
147
|
autoCompressThreshold: 4000 # Auto-compression character threshold (0 to disable)
|
|
132
148
|
budgetLimit: 100000 # Session token budget limit
|
|
133
|
-
|
|
149
|
+
budgetAlertPercent: 90 # Budget percentage threshold triggering warning badge (50..99)
|
|
150
|
+
autoCollapse: true # Display warning in UI when budget is nearly exhausted
|
|
134
151
|
```
|
|
135
152
|
|
|
136
|
-
|
|
153
|
+
| Parameter | Type | Default | Description |
|
|
154
|
+
|---|---|---|---|
|
|
155
|
+
| `compressionMode` | `string` | `balanced` | Default log compression aggressiveness (`raw`, `balanced`, `aggressive`) |
|
|
156
|
+
| `astSkeletonMaxDepth` | `number` | `3` | Maximum nesting depth for AST signature parsing (1 to 10) |
|
|
157
|
+
| `tokenSavingsTracking` | `boolean` | `true` | Track token savings before/after compression |
|
|
158
|
+
| `autoCompressThreshold` | `number` | `4000` | Auto-compress terminal logs exceeding this character length (0 to disable) |
|
|
159
|
+
| `budgetLimit` | `number` | `100000` | Total token budget limit allocated per session |
|
|
160
|
+
| `budgetAlertPercent` | `number` | `90` | Budget alert threshold percentage triggering warnings (50 to 99) |
|
|
161
|
+
| `autoCollapse` | `boolean` | `true` | Display low-budget warning badge in settings card and header chip |
|
|
137
162
|
|
|
138
|
-
|
|
163
|
+
---
|
|
139
164
|
|
|
140
|
-
|
|
141
|
-
* **Fix**: Register session header chip in `conversation.session.header.utilities` (`order: 7`).
|
|
142
|
-
* **Fix**: Ensure chip is always visible (`◐ Lens` on initial session, `◐ <N>%` when savings available, `⚠` on low budget).
|
|
143
|
-
* **Feature**: Interactive dropdown Popover on chip click: token savings breakdown, budget progress bar, recent operations, and refresh button.
|
|
165
|
+
## 📦 Quick Installation
|
|
144
166
|
|
|
145
|
-
|
|
146
|
-
|
|
167
|
+
```bash
|
|
168
|
+
dsh plugin --profile web add @goodandready/dsh-context-lens
|
|
169
|
+
```
|
|
147
170
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* **Fix**: Cross-platform path resolution in unit tests on Windows (`fileURLToPath`).
|
|
151
|
-
* **Fix**: Dynamic propagation of `budgetLimit` configuration into token tracker.
|
|
152
|
-
* **Fix**: ANSI terminal escape sequence stripping for colored logs.
|
|
153
|
-
* **Fix**: Expanded Rust syntax support (`pub async fn`, `pub(crate)`) and proper `#` comment prefix for Python.
|
|
171
|
+
> [!TIP]
|
|
172
|
+
> After installation, reload the DSH Web UI or restart the service (`systemctl --user restart dsh-web`) to activate context compression tools.
|
|
154
173
|
|
|
155
174
|
---
|
|
156
175
|
|
|
157
176
|
## 📄 License
|
|
158
177
|
|
|
159
178
|
MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
|
|
160
|
-
|
|
161
|
-
## Changed in v0.1.11
|
|
162
|
-
|
|
163
|
-
Audit fixes (#33–#47, #18):
|
|
164
|
-
|
|
165
|
-
- Auto-compress no longer forces `balanced`; uses configured `compressionMode`.
|
|
166
|
-
- `budgetLimit` stops token counting after the limit (matches settings description).
|
|
167
|
-
- Focus state is per-session (`sessionId`), not process-global.
|
|
168
|
-
- Settings card exposes `budgetLimit`, `autoCollapse`, `autoCompressThreshold`; low-budget shows a warning instead of force-closing the card.
|
|
169
|
-
- Client `betterSidebar` inject is optional; preview uses server `/dsh-context-lens/compress-preview`.
|
|
170
|
-
- Python imports kept in skeletons; Java locals no longer mistaken for signatures.
|
|
171
|
-
- Shared `estimateTokens` helper; unused `dsh-credentials` peer removed.
|
|
172
|
-
|
|
173
|
-
## Changed in v0.1.12
|
|
174
|
-
|
|
175
|
-
#43: extract shared `StatusPanel` used by LensTab and HeaderChip popover (budget bar, history, refresh).
|
|
176
|
-
|
|
177
|
-
## Changed in v0.1.13
|
|
178
|
-
|
|
179
|
-
- **Fix (#50)**: Guard optional `betterSidebar` tab registration via `ctx.inject(['betterSidebar'], ...)` instead of direct property access on Cordis context proxy, resolving `cannot get property "betterSidebar" without inject` on client boot.
|
|
180
|
-
- **Fix (#50)**: Safely guard `_ctx.settingsScope` access in `PluginCard` with try/catch to prevent proxy property errors.
|
|
181
|
-
- **Test**: Added regression test suite simulating strict Cordis Context Proxy behavior.
|
|
182
|
-
|
|
183
|
-
## Changed in v0.1.15
|
|
184
|
-
|
|
185
|
-
- **Feature (#54)**: Support native DSH right sidebar (`ctx.sidebarRightTabs` + `sidebar.right.pane.tab` slot) introduced in DSH 0.1.5-alpha.1.
|
|
186
|
-
- **Compatibility (#54)**: Preserve legacy `dsh-better-sidebar` integration with deterministic, non-conflicting IDs (`@goodandready/dsh-context-lens` vs `dsh-context-lens:tab`).
|
|
187
|
-
- **Resilience (#54)**: Clean boot and graceful fallback across all 4 layouts (Native only, Legacy only, Both active, Neither active).
|
|
188
|
-
- **Tests (#54)**: Added comprehensive test matrix in `test/sidebar-matrix-54.test.mjs`.
|
|
189
|
-
|
|
190
|
-
## Changed in v0.1.14
|
|
191
|
-
|
|
192
|
-
- **Fix (#52)**: Multiline AST signature parsing in `skeletonizer.js` for TypeScript, JavaScript, Rust, and Go with complex parameter types and return annotations.
|
|
193
|
-
- **Feature (#52)**: Registered `context_lens_reset` tool to allow resetting tracker statistics and history at the start of new tasks.
|
|
194
|
-
- **Quality & UX (#52)**: Dynamic RU/EN locale detection in `HeaderChip`, `LensTab`, and `StatusPanel` via `ctx.locale` for seamless UI integration.
|
|
195
|
-
- **Perf & Stability (#52)**: Adaptive polling in `HeaderChip` pausing on hidden tabs (`visibilitychange`) and polling actively (4s) only when popover is open.
|
|
196
|
-
- **Reliability (#52)**: Atomic settings save (`scope.patch` / `scope.setAll`) in `PluginCard` with graceful fallback.
|
|
197
|
-
|
|
198
|
-
### UI & Styling System (v0.1.16+)
|
|
199
|
-
|
|
200
|
-
Context Lens shares its visual language and component architecture with `dsh-clinebot`:
|
|
201
|
-
- **Native Design System**: 100% theme integration using `--dsw-alias-*` tokens.
|
|
202
|
-
- **Resilient UI Surfaces**: Every component (`PluginCard`, `LensTab`, `StatusPanel`) is protected by an `ErrorBoundary` with instant retry capability.
|
|
203
|
-
- **Reactive Settings**: Live updates via `scope.subscribe()` and zero-delay reads via `scope.getSnapshot()`.
|
|
204
|
-
- **Adaptive Telemetry**: Popover and tab display metric cards for tokens saved, percentage reduced, and live budget utilization.
|