api-relay-audit
toby-bridges
Local security audit for AI API relays and LLM proxies: detects prompt injection, model substitution, tool-call rewriting, SSE anomalies, error leakage, and Web3 wallet risks.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:GooDAnDReaDY/dsh-context-lens
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
🇬🇧 English • 🇷🇺 Русский • 🇨🇳 中文说明
|
⭐ If you like this plugin, please star it on GitHub — it shows me that the plugin is useful to you and motivates me to keep developing it.
🐛 If you find a bug or would like to request a feature, open a GitHub issue in any language — I will review your proposal and implement useful suggestions in a future plugin version. |
Large codebase contexts and verbose build/test logs quickly fill the LLM context window, waste token budget, slow down inference, and cause agent hallucination.
dsh-context-lens solves this by providing:
graph LR
subgraph RawContext [Raw Context Streams]
Code[📁 Source Code: Lengthy Implementation Details] --> LensEngine[dsh-context-lens Engine]
Logs[📋 Build/Test Logs: Verbose Success Noise] --> LensEngine
end
subgraph LensEngine [Context Processing Pipeline]
LensEngine --> Focus{Focus Evaluator}
Focus -->|Focused File| RawKeep[Full Code Details Retained]
Focus -->|Surrounding Workspace| AST[AST Skeletonizer: Signatures & Types]
LensEngine --> LogFilter[Log Condenser: Stack Traces & Errors Only]
end
subgraph Output [Optimized Agent Context]
AST --> Agent[🤖 DSH Agent Context: Compact High-Value Prompt]
RawKeep --> Agent
LogFilter --> Agent
Agent --> Tracker[📊 Live Token Telemetry & Budget Guard]
end
style RawContext fill:#1e1e2e,stroke:#89b4fa,stroke-width:2px,color:#cdd6f4
style LensEngine fill:#181825,stroke:#cba6f7,stroke-width:2px,color:#cdd6f4
style Output fill:#11111b,stroke:#a6e3a1,stroke-width:2px,color:#cdd6f4
Expected ... Received ...), and failure context windows.raw: Removes simple noise lines while keeping general execution order.balanced: Preserves failure sections with surrounding context windows (default).aggressive: Extracts strictly error lines and stack frames.context_lens_focus)sessionId) and can be inspected or cleared instantly via UI or API.budgetAlertPercent) dynamically alerts when the session budget approaches depletion.Context Lens shares the unified .cl-* design language and --dsw-alias-* token system with dsh-clinebot:
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.ctx.sidebarRightTabs + sidebar.right.pane.tab slot) and legacy dsh-better-sidebar with non-conflicting IDs.PluginCard, LensTab, StatusPanel) is isolated inside React error boundaries with instant retry buttons, preventing parent UI crashes.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.
| Tool Name | Parameters | Description |
|---|---|---|
context_lens_focus |
paths: string[], sessionId?: string |
Sets active focus files/folders for the session; collapses surrounding workspace into AST skeletons |
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 |
context_lens_compress_code |
code: string, language?: string, maxDepth?: number, filePath?: string, sessionId?: string |
Generates a clean structural AST skeleton from raw source code |
context_lens_track |
sessionId?: string |
Returns real-time cumulative token savings, history, and budget status for the session |
context_lens_reset |
sessionId?: string |
Resets token tracker counters and compression history at the start of new tasks |
| Endpoint | Method | Security Checks | Description |
|---|---|---|---|
/dsh-context-lens/status |
GET |
Open (safe read) | Returns session token savings stats, active focus paths, and compression history |
/dsh-context-lens/clear-focus |
POST |
Loopback / Same-Origin | Clears focused paths for the specified session (rejects GET with 405) |
/dsh-context-lens/compress-preview |
POST |
Loopback / Same-Origin | Preview log compression with 256KB body size limit and maxLines clamping (1–5000) |
/api/dsh-context-lens/update |
GET, POST |
Loopback + Security Header | In-app plugin updater checking npm registry and executing safe background updates |
settings.yaml)Settings can be modified via settings.yaml or directly in the DSH Web UI under Settings → Plugins → Context Lens.
dsh-context-lens:
compressionMode: balanced # Log compression mode: 'raw', 'balanced', or 'aggressive'
astSkeletonMaxDepth: 3 # Maximum depth level for AST signature traversal (1..10)
tokenSavingsTracking: true # Track and display live token savings
autoCompressThreshold: 4000 # Auto-compression character threshold (0 to disable)
budgetLimit: 100000 # Session token budget limit
budgetAlertPercent: 90 # Budget percentage threshold triggering warning badge (50..99)
autoCollapse: true # Display warning in UI when budget is nearly exhausted
| Parameter | Type | Default | Description |
|---|---|---|---|
compressionMode |
string |
balanced |
Default log compression aggressiveness (raw, balanced, aggressive) |
astSkeletonMaxDepth |
number |
3 |
Maximum nesting depth for AST signature parsing (1 to 10) |
tokenSavingsTracking |
boolean |
true |
Track token savings before/after compression |
autoCompressThreshold |
number |
4000 |
Auto-compress terminal logs exceeding this character length (0 to disable) |
budgetLimit |
number |
100000 |
Total token budget limit allocated per session |
budgetAlertPercent |
number |
90 |
Budget alert threshold percentage triggering warnings (50 to 99) |
autoCollapse |
boolean |
true |
Display low-budget warning badge in settings card and header chip |
dsh plugin --profile web add @goodandready/dsh-context-lens
[!TIP] After installation, reload the DSH Web UI or restart the service (
systemctl --user restart dsh-web) to activate context compression tools.
MIT © GooDAnDReaDY
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: context、token-guard。