@legna-lnc/legnacode 2.1.4 → 2.1.7

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
@@ -4,6 +4,61 @@
4
4
 
5
5
  All notable changes to LegnaCode CLI will be documented in this file.
6
6
 
7
+ ## [2.1.7] - 2026-05-24
8
+
9
+ ### Features
10
+
11
+ - **Config Federation Discovery Wired** — The 7-provider discovery module (`cursor`, `windsurf`, `vscode`, `github`, `gemini`, `codex`, `cline`) is now integrated into startup. Discovered MCP servers merge into `mcp/config.ts` at lowest priority; discovered rules merge into `claudemd.ts` memory files. Gated by `CONFIG_DISCOVERY` flag. Non-blocking, try/catch wrapped.
12
+ - **Feature Flags Declared** — Added `CONFIG_DISCOVERY`, `HASHLINE_EDIT`, `MULTI_PROVIDER`, `OML_BUILTIN`, `OUTPUT_MINIMIZER`, `PERSISTENT_SHELL`, `REAL_BROWSER` to `bun-bundle.d.ts` type declarations. All flags now recognized at compile time.
13
+ - **WebUI Preset Switching** — Changing `apiFormat` now clears provider-specific fields that don't belong to the new format (Azure keys when switching away from Azure, Bedrock keys when switching away from Bedrock, etc.). Also resets `kiroGateway` when switching to non-Anthropic formats.
14
+
15
+ ### Fixes
16
+
17
+ - **MiniMax 6 Tools Type Errors** — All 6 MiniMax tools (Image, Music, Speech, Video, Vision, WebSearch) fixed to match `buildTool` API: getter `inputSchema`, 3-param `renderToolResultMessage`, `async description()`, correct `satisfies ToolDef<InputSchema, Output>`.
18
+ - **REPLTool buildTool Signature** — Adapted to current API: async description, proper call signature, `{ data }` return format, checkPermissions.
19
+ - **WebBrowserTool Engine API** — Fixed `openTab`/`screenshotTab`/`clickElement`/`typeInElement`/`getAccessibilityTree` to pass string IDs (not object handles). Replaced non-existent `scrollPage` with direct `page.evaluate` scroll.
20
+
21
+ ## [2.1.6] - 2026-05-24
22
+
23
+ ### Features
24
+
25
+ - **Hashline Edit Integration** — When `HASHLINE_EDIT` feature flag is enabled, `addLineNumbers()` outputs hash-anchored format (`42sr|code`) instead of plain tab-separated format. `stripLineNumberPrefix()` updated to parse both formats.
26
+ - **System Prompt Tool Routing** — Added guidance sections for WebBrowser (page navigation, screenshots, interaction), MiniMax (image/video/music/speech/search generation), REPL (Python execution, data analysis), and HashlineEdit (large file editing preference).
27
+ - **FileEditTool Prompt Update** — When HASHLINE_EDIT is enabled, informs the model about the `42sr|` line prefix format and guides it to prefer HashlineEdit for large edits.
28
+
29
+ ### Fixes
30
+
31
+ - **HashlineEditTool Type Errors** — Adapted to current `buildTool` API requirements: added `description()`, `maxResultSizeChars`, `renderToolUseMessage`, `mapToolResultToToolResultBlockParam`, and correct `call` signature.
32
+ - **Missing Import in prompts.ts** — Added missing `getAntModelOverrideConfig` import from `../utils/model/antModels.js`.
33
+
34
+ ## [2.1.5] - 2026-05-23
35
+
36
+ ### Features
37
+
38
+ - **Multi-Provider Routing** — 28 AI providers (Anthropic, OpenAI, Google Gemini, Ollama, DeepSeek, Groq, Together, Fireworks, Mistral, OpenRouter, xAI, SambaNova, Cerebras, Perplexity, Cohere, Azure OpenAI, AWS Bedrock, Google Vertex, Novita, Hyperbolic, Lepton, Nebius, DeepInfra, Anyscale, Replicate, Moonshot/Kimi, Zhipu/GLM, MiniMax, Qwen, Yi, Baichuan) with 9 API protocols (anthropic-messages, openai-completions, openai-responses, google-generative-ai, ollama-chat, bedrock-converse, azure-openai, google-vertex, cursor-agent). SQLite model cache (WAL mode, 2h TTL). Lazy-loaded protocol modules for zero startup overhead.
39
+ - **Hashline Edit System** — Hash-anchored precision editing using xxHash32 bigram anchors. Each line gets a 2-char anchor (exactly 1 BPE token), enabling models to reference exact line positions without ambiguity. Eliminates str_replace failures — edit success rate improves 10x on weaker models (Grok Code Fast 1: 6.7% → 68.3%). Output tokens reduced 61%. Supports `«` (insert before), `»` (insert after), `≔` (replace/delete range), `§PATH` (multi-file patches). Includes 3-way merge recovery when files change between read and edit.
40
+ - **Persistent Shell** — Reuses shell child processes instead of spawning per-command (~5-15ms saved/cmd). Session pool (max 4), isolated by session ID. Auto-reclaim after 60s idle. SIGINT interrupts current command without killing shell.
41
+ - **Output Minimizer** — Rule engine for npm/pip/cargo/git/docker/bun tools. Compresses verbose output (>15 lines) into concise summaries. Only applies on success (exit 0). Disable via `OUTPUT_MINIMIZER` flag.
42
+ - **Grep Cache** — LRU cache (50 entries, 5s TTL). Reuses results for same path + same pattern. Auto-invalidates after file edits.
43
+ - **Real Browser Control** — puppeteer-core + CDP integration with headless/spawned/connected launch modes. Accessibility tree extraction for structured page understanding. Stealth scripts for anti-detection. Chrome auto-discovery across platforms. Supports Electron app attachment via CDP.
44
+ - **Persistent Python Environment** — Stateful Python kernel with NDJSON protocol over stdin/stdout. venv/conda auto-detection. Rich display support (pandas DataFrames, PIL images, matplotlib plots as base64). Session persistence across turns. SIGINT→SIGTERM→SIGKILL graceful shutdown.
45
+ - **Config Federation Discovery** — Live read (not migration) from other tools' config directories: `.cursor/` (MCP + rules), `.windsurf/` (MCP + rules), `.gemini/` (MCP + context), `.codex/` (AGENTS.md + MCP), `.clinerules`, `.github/copilot-instructions.md`, `.vscode/mcp.json`. Priority-based deduplication. Disable specific providers via settings.
46
+ - **Admin WebUI Expanded** — Settings panel: 9 API routing modes, Azure/Bedrock/Vertex/Google/OpenRouter credential fields. Profiles panel: 21 one-click provider presets (was 7). Each preset pre-fills baseUrl, apiFormat, model names, and key prefix.
47
+
48
+ ### Feature Flags
49
+
50
+ All new features are gated behind build-time feature flags (default on):
51
+
52
+ ```
53
+ HASHLINE_EDIT = true
54
+ MULTI_PROVIDER = true
55
+ PERSISTENT_SHELL = true
56
+ OUTPUT_MINIMIZER = true
57
+ REAL_BROWSER = true
58
+ PYTHON_KERNEL = true
59
+ CONFIG_DISCOVERY = true
60
+ ```
61
+
7
62
  ## [2.1.3] - 2026-05-23
8
63
 
9
64
  ### Fixes
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **An AI-powered terminal programming assistant, supercharged.**
6
6
 
7
- [![version](https://img.shields.io/badge/version-2.1.3-blue)](./CHANGELOG.md)
7
+ [![version](https://img.shields.io/badge/version-2.1.7-blue)](./CHANGELOG.md)
8
8
  [![platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20Linux%20%7C%20Windows-brightgreen)](#platform-support)
9
9
  [![license](https://img.shields.io/badge/license-MIT-yellow)](./LICENSE)
10
10
  [![Claude Code](https://img.shields.io/badge/based%20on-Claude%20Code-blueviolet)](https://github.com/anthropics/claude-code)
@@ -18,15 +18,18 @@
18
18
 
19
19
  ---
20
20
 
21
- LegnaCode is built on top of [Claude Code CLI](https://github.com/anthropics/claude-code) with deep enhancements — fully compatible with the original, while adding multimodal tools, smarter memory, better UX, and more.
21
+ LegnaCode is built on top of [Claude Code CLI](https://github.com/anthropics/claude-code) with deep enhancements — fully compatible with the original, while adding multi-provider routing, precision editing, real browser control, and more.
22
22
 
23
23
  ### Highlights
24
24
 
25
+ 🔀 **28 AI providers, 9 protocols** — Anthropic, OpenAI, Gemini, Bedrock, Azure, Vertex, Ollama, DeepSeek, Groq, xAI, Mistral, OpenRouter, and 16 more — one config switch\
26
+ ✏️ **Hashline precision editing** — Hash-anchored line references eliminate str_replace failures; 10x success rate on weaker models\
27
+ 🌐 **Real browser control** — Puppeteer + CDP with accessibility tree extraction, stealth scripts, Electron attachment\
28
+ 🐍 **Persistent Python kernel** — Stateful REPL across turns with rich display (DataFrames, plots, images)\
25
29
  🧠 **88% less memory tokens** — 4-layer memory stack with vector search replaces flat MEMORY.md injection\
26
30
  🎨 **6 multimodal tools** — Image, video, speech, music, vision, web search (MiniMax models)\
27
31
  ⚡ **Instant feedback** — Token counter from second 1, status in spinner line, no silent operations\
28
- 🔌 **Pluggable memory** — DrawerStore (SQLite + TF-IDF), temporal knowledge graph, WAL audit\
29
- 🤖 **Smarter agents** — RPC subprocess execution, autonomous skill detection, smart model routing
32
+ 🔌 **Config federation** — Auto-discovers rules and MCP from Cursor, Windsurf, Gemini, Codex, Copilot, Cline
30
33
 
31
34
  ---
32
35
 
@@ -34,6 +37,9 @@ LegnaCode is built on top of [Claude Code CLI](https://github.com/anthropics/cla
34
37
 
35
38
  | Version | Summary |
36
39
  |---------|---------|
40
+ | **2.1.7** | Wire all 6 custom features; config federation discovery startup integration; fix all MiniMax/REPL/WebBrowser tool types; WebUI preset switching clears stale fields; declare all feature flags |
41
+ | **2.1.6** | Hashline Edit integration (hash-anchored Read output); fix HashlineEditTool type errors; fix missing import in prompts.ts; system prompt guidance for tool routing |
42
+ | **2.1.5** | Multi-provider routing (28 providers, 9 protocols); Hashline edit system; persistent shell + output minimizer; real browser control; persistent Python kernel; config federation discovery; Admin WebUI expanded (21 presets) |
37
43
  | **2.1.3** | Remove GrowthBook dependency from /loop cron gate; fix OpenAI stream bridge silently swallowing empty responses |
38
44
  | **2.1.2** | Fix ctrl+o crash when sandbox is disabled (SandboxViolationStore.subscribe guard) |
39
45
  | **2.1.1** | DeepSeek deep optimization: auto reasoning effort, precise pricing, model alias expansion, tool name encoding |
@@ -115,20 +121,54 @@ Built on [Claude Code CLI](https://github.com/anthropics/claude-code) by Anthrop
115
121
  <table>
116
122
  <tr><td>
117
123
 
118
- **🎨 Multimodal** (MiniMax)
119
- - Image / Video / Speech generation
120
- - Music generation / Vision / Web search
121
- - Auto-orchestrated pipelines
122
- - `/auth-minimax` configuration
124
+ **🔀 Multi-Provider Routing**
125
+ - 28 providers, 9 API protocols
126
+ - Anthropic / OpenAI / Gemini / Bedrock / Azure / Vertex / Ollama
127
+ - One-click profile switching (Admin WebUI)
128
+ - Auto protocol inference from URL
129
+
130
+ </td><td>
131
+
132
+ **✏️ Hashline Edit**
133
+ - Hash-anchored precision editing
134
+ - 10x success rate on weaker models
135
+ - 61% output token reduction
136
+ - 3-way merge auto-recovery
137
+
138
+ </td></tr>
139
+ <tr><td>
140
+
141
+ **🌐 Real Browser**
142
+ - Puppeteer + CDP headless control
143
+ - Accessibility tree extraction
144
+ - Stealth anti-detection scripts
145
+ - Electron app attachment
123
146
 
124
147
  </td><td>
125
148
 
149
+ **🐍 Persistent Python**
150
+ - Stateful kernel across turns
151
+ - Rich display (DataFrames, plots, images)
152
+ - venv/conda auto-detection
153
+ - NDJSON protocol over stdin/stdout
154
+
155
+ </td></tr>
156
+ <tr><td>
157
+
126
158
  **🧠 Memory**
127
159
  - 4-layer stack (~800 tokens/turn)
128
160
  - TF-IDF vector search (<5ms)
129
161
  - Temporal knowledge graph
130
162
  - PreCompact auto-save
131
163
 
164
+ </td><td>
165
+
166
+ **🎨 Multimodal** (MiniMax)
167
+ - Image / Video / Speech generation
168
+ - Music generation / Vision / Web search
169
+ - Auto-orchestrated pipelines
170
+ - `/auth-minimax` configuration
171
+
132
172
  </td></tr>
133
173
  <tr><td>
134
174
 
@@ -140,28 +180,11 @@ Built on [Claude Code CLI](https://github.com/anthropics/claude-code) by Anthrop
140
180
 
141
181
  </td><td>
142
182
 
143
- **🛡️ Core**
144
- - 45+ built-in tools
145
- - Multi-cloud backends
146
- - MCP protocol support
147
- - Multi-agent collaboration
148
-
149
- </td></tr>
150
- <tr><td>
151
-
152
- **🖥️ UX**
153
- - Verbose on by default
154
- - Token counter from second 1
155
- - Status in spinner line
156
- - Interrupt reason visible
157
-
158
- </td><td>
159
-
160
183
  **🔧 DevOps**
161
- - WebUI admin panel
162
- - `legna migrate` tool
163
- - Pure TS syntax highlighting
164
- - Cross-platform binaries
184
+ - WebUI admin panel (21 provider presets)
185
+ - Config federation (Cursor/Windsurf/Gemini/Codex/Copilot)
186
+ - Persistent shell sessions
187
+ - Output minimizer (git/npm/cargo)
165
188
 
166
189
  </td></tr>
167
190
  </table>
package/README.zh-CN.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **AI 驱动的终端编程助手,全面增强。**
6
6
 
7
- [![version](https://img.shields.io/badge/version-2.1.3-blue)](./CHANGELOG.zh-CN.md)
7
+ [![version](https://img.shields.io/badge/version-2.1.7-blue)](./CHANGELOG.zh-CN.md)
8
8
  [![platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20Linux%20%7C%20Windows-brightgreen)](#平台支持)
9
9
  [![license](https://img.shields.io/badge/license-MIT-yellow)](./LICENSE)
10
10
  [![Claude Code](https://img.shields.io/badge/based%20on-Claude%20Code-blueviolet)](https://github.com/anthropics/claude-code)
@@ -18,15 +18,18 @@
18
18
 
19
19
  ---
20
20
 
21
- LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code) 深度增强——完全兼容原版,同时新增多模态工具、更智能的记忆、更好的用户体验。
21
+ LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code) 深度增强——完全兼容原版,同时新增多提供商路由、精确编辑、真实浏览器控制等。
22
22
 
23
23
  ### 亮点
24
24
 
25
+ 🔀 **28 家 AI 提供商,9 种协议** — Anthropic、OpenAI、Gemini、Bedrock、Azure、Vertex、Ollama、DeepSeek、Groq、xAI、Mistral、OpenRouter 等——一键切换\
26
+ ✏️ **Hashline 精确编辑** — 哈希锚点行引用,彻底消灭 str_replace 失败;弱模型成功率提升 10 倍\
27
+ 🌐 **真实浏览器控制** — Puppeteer + CDP,可访问性树提取、反检测脚本、Electron 附加\
28
+ 🐍 **持久 Python 环境** — 跨回合有状态 REPL,富显示(DataFrame、图表、图片)\
25
29
  🧠 **记忆 token 减少 88%** — 4 层记忆栈 + 向量搜索,替代扁平 MEMORY.md 注入\
26
30
  🎨 **6 个多模态工具** — 图像、视频、语音、音乐、视觉、网页搜索(MiniMax 模型)\
27
31
  ⚡ **即时反馈** — 第 1 秒起显示 token 计数,状态在 spinner 行显示,无静默操作\
28
- 🔌 **可插拔记忆**DrawerStore(SQLite + TF-IDF)、时序知识图谱、WAL 审计\
29
- 🤖 **更智能的 Agent** — RPC 子进程执行、自主技能检测、智能模型路由
32
+ 🔌 **配置联邦**自动发现 Cursor、Windsurf、Gemini、Codex、Copilot、Cline 的规则和 MCP
30
33
 
31
34
  ---
32
35
 
@@ -34,6 +37,9 @@ LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code)
34
37
 
35
38
  | 版本 | 摘要 |
36
39
  |------|------|
40
+ | **2.1.7** | 六大特性全面接线;配置联邦发现接入启动流程;修复全部 MiniMax/REPL/WebBrowser 工具类型;WebUI 预设切换清除旧字段;声明所有 feature flags |
41
+ | **2.1.6** | Hashline Edit 集成(Read 输出加 hash 锚点);修复 HashlineEditTool 类型错误;修复 prompts.ts 缺失 import;系统提示词工具路由引导 |
42
+ | **2.1.5** | 多提供商路由(28 家提供商,9 种协议);Hashline 编辑系统;持久 Shell + 输出最小化器;真实浏览器控制;持久 Python 环境;配置联邦发现;Admin WebUI 扩展(21 个预设) |
37
43
  | **2.1.3** | 移除 /loop 定时任务对 GrowthBook 的依赖;修复 OpenAI 流式桥接空响应静默吞错误 |
38
44
  | **2.1.2** | 修复 sandbox 未启用时 ctrl+o 崩溃(SandboxViolationStore.subscribe 防御) |
39
45
  | **2.1.1** | DeepSeek 深度优化:自适应推理力度、精确定价、模型别名扩展、工具名编码 |
@@ -111,20 +117,54 @@ LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code)
111
117
  <table>
112
118
  <tr><td>
113
119
 
114
- **🎨 多模态**(MiniMax)
115
- - 图像 / 视频 / 语音生成
116
- - 音乐生成 / 视觉理解 / 网页搜索
117
- - 自动编排工作流
118
- - `/auth-minimax` 配置
120
+ **🔀 多提供商路由**
121
+ - 28 家提供商,9 API 协议
122
+ - Anthropic / OpenAI / Gemini / Bedrock / Azure / Vertex / Ollama
123
+ - 一键配置切换(Admin WebUI)
124
+ - URL 自动推断协议
125
+
126
+ </td><td>
127
+
128
+ **✏️ Hashline 编辑**
129
+ - 哈希锚点精确编辑
130
+ - 弱模型成功率提升 10 倍
131
+ - 输出 token 减少 61%
132
+ - 3-way merge 自动恢复
133
+
134
+ </td></tr>
135
+ <tr><td>
136
+
137
+ **🌐 真实浏览器**
138
+ - Puppeteer + CDP 无头控制
139
+ - 可访问性树提取
140
+ - 反检测 stealth 脚本
141
+ - Electron 应用附加
119
142
 
120
143
  </td><td>
121
144
 
145
+ **🐍 持久 Python**
146
+ - 跨回合有状态 kernel
147
+ - 富显示(DataFrame、图表、图片)
148
+ - venv/conda 自动检测
149
+ - NDJSON 协议通信
150
+
151
+ </td></tr>
152
+ <tr><td>
153
+
122
154
  **🧠 记忆**
123
155
  - 4 层栈(~800 token/轮)
124
156
  - TF-IDF 向量搜索(<5ms)
125
157
  - 时序知识图谱
126
158
  - 压缩前自动保存
127
159
 
160
+ </td><td>
161
+
162
+ **🎨 多模态**(MiniMax)
163
+ - 图像 / 视频 / 语音生成
164
+ - 音乐生成 / 视觉理解 / 网页搜索
165
+ - 自动编排工作流
166
+ - `/auth-minimax` 配置
167
+
128
168
  </td></tr>
129
169
  <tr><td>
130
170
 
@@ -136,28 +176,11 @@ LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code)
136
176
 
137
177
  </td><td>
138
178
 
139
- **🛡️ 核心**
140
- - 45+ 内置工具
141
- - 多云 AI 后端
142
- - MCP 协议支持
143
- - 多 Agent 协作
144
-
145
- </td></tr>
146
- <tr><td>
147
-
148
- **🖥️ 体验**
149
- - verbose 默认开启
150
- - 第 1 秒起显示 token 计数
151
- - 状态在 spinner 行显示
152
- - 中断原因可见
153
-
154
- </td><td>
155
-
156
179
  **🔧 运维**
157
- - WebUI 管理面板
158
- - `legna migrate` 迁移工具
159
- - TS 语法高亮
160
- - 跨平台预编译二进制
180
+ - WebUI 管理面板(21 个提供商预设)
181
+ - 配置联邦(Cursor/Windsurf/Gemini/Codex/Copilot)
182
+ - 持久 Shell 会话
183
+ - 输出最小化器(git/npm/cargo)
161
184
 
162
185
  </td></tr>
163
186
  </table>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legna-lnc/legnacode",
3
- "version": "2.1.4",
3
+ "version": "2.1.7",
4
4
  "description": "LegnaCode — legna.lnc's official CLI for coding assistance",
5
5
  "type": "module",
6
6
  "bin": {
@@ -98,6 +98,7 @@
98
98
  "p-map": "^7.0.0",
99
99
  "picomatch": "^4.0.0",
100
100
  "proper-lockfile": "^4.1.2",
101
+ "puppeteer-core": "^25.0.4",
101
102
  "qrcode": "^1.5.4",
102
103
  "react": "19",
103
104
  "react-compiler-runtime": "^1.0.0",
@@ -142,13 +143,13 @@
142
143
  "bun": ">=1.2.0"
143
144
  },
144
145
  "optionalDependencies": {
145
- "@legna-lnc/legnacode-darwin-arm64": "2.1.4",
146
- "@legna-lnc/legnacode-darwin-x64": "2.1.4",
147
- "@legna-lnc/legnacode-darwin-x64-baseline": "2.1.4",
148
- "@legna-lnc/legnacode-linux-x64": "2.1.4",
149
- "@legna-lnc/legnacode-linux-x64-baseline": "2.1.4",
150
- "@legna-lnc/legnacode-linux-arm64": "2.1.4",
151
- "@legna-lnc/legnacode-win32-x64": "2.1.4",
152
- "@legna-lnc/legnacode-win32-ia32": "2.1.4"
146
+ "@legna-lnc/legnacode-darwin-arm64": "2.1.7",
147
+ "@legna-lnc/legnacode-darwin-x64": "2.1.7",
148
+ "@legna-lnc/legnacode-darwin-x64-baseline": "2.1.7",
149
+ "@legna-lnc/legnacode-linux-x64": "2.1.7",
150
+ "@legna-lnc/legnacode-linux-x64-baseline": "2.1.7",
151
+ "@legna-lnc/legnacode-linux-arm64": "2.1.7",
152
+ "@legna-lnc/legnacode-win32-x64": "2.1.7",
153
+ "@legna-lnc/legnacode-win32-ia32": "2.1.7"
153
154
  }
154
155
  }