@legna-lnc/legnacode 2.1.2 → 2.1.6

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,42 @@
4
4
 
5
5
  All notable changes to LegnaCode CLI will be documented in this file.
6
6
 
7
+ ## [2.1.5] - 2026-05-23
8
+
9
+ ### Features
10
+
11
+ - **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.
12
+ - **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.
13
+ - **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.
14
+ - **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.
15
+ - **Grep Cache** — LRU cache (50 entries, 5s TTL). Reuses results for same path + same pattern. Auto-invalidates after file edits.
16
+ - **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.
17
+ - **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.
18
+ - **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.
19
+ - **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.
20
+
21
+ ### Feature Flags
22
+
23
+ All new features are gated behind build-time feature flags (default on):
24
+
25
+ ```
26
+ HASHLINE_EDIT = true
27
+ MULTI_PROVIDER = true
28
+ PERSISTENT_SHELL = true
29
+ OUTPUT_MINIMIZER = true
30
+ REAL_BROWSER = true
31
+ PYTHON_KERNEL = true
32
+ CONFIG_DISCOVERY = true
33
+ ```
34
+
35
+ ## [2.1.3] - 2026-05-23
36
+
37
+ ### Fixes
38
+
39
+ - **`/loop` cron not firing** — Removed GrowthBook `tengu_kairos_cron` remote feature flag dependency from `isKairosCronEnabled()` and `isDurableCronEnabled()`. Cron scheduling now only depends on the build-time `AGENT_TRIGGERS` flag + local `CLAUDE_CODE_DISABLE_CRON` env var. LegnaCode controls its own features locally.
40
+ - **OpenAI stream bridge silent empty response** — When an OpenAI-compatible API (DeepSeek, etc.) stream ends without `finish_reason` and has produced no content, throw an error instead of silently treating it as a successful `end_turn`. If the stream has open tool_call blocks, infer `tool_use` stop_reason so the agentic loop continues.
41
+ - **Cron prompt path references** — Fixed `.claude/scheduled_tasks.json` → `.legna/scheduled_tasks.json` in CronDelete/CronList tool prompts.
42
+
7
43
  ## [2.1.2] - 2026-05-07
8
44
 
9
45
  ### 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.2-blue)](./CHANGELOG.md)
7
+ [![version](https://img.shields.io/badge/version-2.1.5-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,8 @@ 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.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) |
41
+ | **2.1.3** | Remove GrowthBook dependency from /loop cron gate; fix OpenAI stream bridge silently swallowing empty responses |
37
42
  | **2.1.2** | Fix ctrl+o crash when sandbox is disabled (SandboxViolationStore.subscribe guard) |
38
43
  | **2.1.1** | DeepSeek deep optimization: auto reasoning effort, precise pricing, model alias expansion, tool name encoding |
39
44
  | **2.1.0** | Platform-aware publish (Mac→darwin+linux, Win→win32); DeepSeek reasoning_content multi-turn 400 fix; ShellProgressMessage crash fix |
@@ -114,20 +119,54 @@ Built on [Claude Code CLI](https://github.com/anthropics/claude-code) by Anthrop
114
119
  <table>
115
120
  <tr><td>
116
121
 
117
- **🎨 Multimodal** (MiniMax)
118
- - Image / Video / Speech generation
119
- - Music generation / Vision / Web search
120
- - Auto-orchestrated pipelines
121
- - `/auth-minimax` configuration
122
+ **🔀 Multi-Provider Routing**
123
+ - 28 providers, 9 API protocols
124
+ - Anthropic / OpenAI / Gemini / Bedrock / Azure / Vertex / Ollama
125
+ - One-click profile switching (Admin WebUI)
126
+ - Auto protocol inference from URL
127
+
128
+ </td><td>
129
+
130
+ **✏️ Hashline Edit**
131
+ - Hash-anchored precision editing
132
+ - 10x success rate on weaker models
133
+ - 61% output token reduction
134
+ - 3-way merge auto-recovery
135
+
136
+ </td></tr>
137
+ <tr><td>
138
+
139
+ **🌐 Real Browser**
140
+ - Puppeteer + CDP headless control
141
+ - Accessibility tree extraction
142
+ - Stealth anti-detection scripts
143
+ - Electron app attachment
122
144
 
123
145
  </td><td>
124
146
 
147
+ **🐍 Persistent Python**
148
+ - Stateful kernel across turns
149
+ - Rich display (DataFrames, plots, images)
150
+ - venv/conda auto-detection
151
+ - NDJSON protocol over stdin/stdout
152
+
153
+ </td></tr>
154
+ <tr><td>
155
+
125
156
  **🧠 Memory**
126
157
  - 4-layer stack (~800 tokens/turn)
127
158
  - TF-IDF vector search (<5ms)
128
159
  - Temporal knowledge graph
129
160
  - PreCompact auto-save
130
161
 
162
+ </td><td>
163
+
164
+ **🎨 Multimodal** (MiniMax)
165
+ - Image / Video / Speech generation
166
+ - Music generation / Vision / Web search
167
+ - Auto-orchestrated pipelines
168
+ - `/auth-minimax` configuration
169
+
131
170
  </td></tr>
132
171
  <tr><td>
133
172
 
@@ -139,28 +178,11 @@ Built on [Claude Code CLI](https://github.com/anthropics/claude-code) by Anthrop
139
178
 
140
179
  </td><td>
141
180
 
142
- **🛡️ Core**
143
- - 45+ built-in tools
144
- - Multi-cloud backends
145
- - MCP protocol support
146
- - Multi-agent collaboration
147
-
148
- </td></tr>
149
- <tr><td>
150
-
151
- **🖥️ UX**
152
- - Verbose on by default
153
- - Token counter from second 1
154
- - Status in spinner line
155
- - Interrupt reason visible
156
-
157
- </td><td>
158
-
159
181
  **🔧 DevOps**
160
- - WebUI admin panel
161
- - `legna migrate` tool
162
- - Pure TS syntax highlighting
163
- - Cross-platform binaries
182
+ - WebUI admin panel (21 provider presets)
183
+ - Config federation (Cursor/Windsurf/Gemini/Codex/Copilot)
184
+ - Persistent shell sessions
185
+ - Output minimizer (git/npm/cargo)
164
186
 
165
187
  </td></tr>
166
188
  </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.2-blue)](./CHANGELOG.zh-CN.md)
7
+ [![version](https://img.shields.io/badge/version-2.1.5-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,8 @@ LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code)
34
37
 
35
38
  | 版本 | 摘要 |
36
39
  |------|------|
40
+ | **2.1.5** | 多提供商路由(28 家提供商,9 种协议);Hashline 编辑系统;持久 Shell + 输出最小化器;真实浏览器控制;持久 Python 环境;配置联邦发现;Admin WebUI 扩展(21 个预设) |
41
+ | **2.1.3** | 移除 /loop 定时任务对 GrowthBook 的依赖;修复 OpenAI 流式桥接空响应静默吞错误 |
37
42
  | **2.1.2** | 修复 sandbox 未启用时 ctrl+o 崩溃(SandboxViolationStore.subscribe 防御) |
38
43
  | **2.1.1** | DeepSeek 深度优化:自适应推理力度、精确定价、模型别名扩展、工具名编码 |
39
44
  | **2.1.0** | 平台感知发布(Mac→darwin+linux,Win→win32);DeepSeek reasoning_content 多轮 400 修复;ShellProgressMessage 崩溃修复 |
@@ -110,20 +115,54 @@ LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code)
110
115
  <table>
111
116
  <tr><td>
112
117
 
113
- **🎨 多模态**(MiniMax)
114
- - 图像 / 视频 / 语音生成
115
- - 音乐生成 / 视觉理解 / 网页搜索
116
- - 自动编排工作流
117
- - `/auth-minimax` 配置
118
+ **🔀 多提供商路由**
119
+ - 28 家提供商,9 API 协议
120
+ - Anthropic / OpenAI / Gemini / Bedrock / Azure / Vertex / Ollama
121
+ - 一键配置切换(Admin WebUI)
122
+ - URL 自动推断协议
123
+
124
+ </td><td>
125
+
126
+ **✏️ Hashline 编辑**
127
+ - 哈希锚点精确编辑
128
+ - 弱模型成功率提升 10 倍
129
+ - 输出 token 减少 61%
130
+ - 3-way merge 自动恢复
131
+
132
+ </td></tr>
133
+ <tr><td>
134
+
135
+ **🌐 真实浏览器**
136
+ - Puppeteer + CDP 无头控制
137
+ - 可访问性树提取
138
+ - 反检测 stealth 脚本
139
+ - Electron 应用附加
118
140
 
119
141
  </td><td>
120
142
 
143
+ **🐍 持久 Python**
144
+ - 跨回合有状态 kernel
145
+ - 富显示(DataFrame、图表、图片)
146
+ - venv/conda 自动检测
147
+ - NDJSON 协议通信
148
+
149
+ </td></tr>
150
+ <tr><td>
151
+
121
152
  **🧠 记忆**
122
153
  - 4 层栈(~800 token/轮)
123
154
  - TF-IDF 向量搜索(<5ms)
124
155
  - 时序知识图谱
125
156
  - 压缩前自动保存
126
157
 
158
+ </td><td>
159
+
160
+ **🎨 多模态**(MiniMax)
161
+ - 图像 / 视频 / 语音生成
162
+ - 音乐生成 / 视觉理解 / 网页搜索
163
+ - 自动编排工作流
164
+ - `/auth-minimax` 配置
165
+
127
166
  </td></tr>
128
167
  <tr><td>
129
168
 
@@ -135,28 +174,11 @@ LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code)
135
174
 
136
175
  </td><td>
137
176
 
138
- **🛡️ 核心**
139
- - 45+ 内置工具
140
- - 多云 AI 后端
141
- - MCP 协议支持
142
- - 多 Agent 协作
143
-
144
- </td></tr>
145
- <tr><td>
146
-
147
- **🖥️ 体验**
148
- - verbose 默认开启
149
- - 第 1 秒起显示 token 计数
150
- - 状态在 spinner 行显示
151
- - 中断原因可见
152
-
153
- </td><td>
154
-
155
177
  **🔧 运维**
156
- - WebUI 管理面板
157
- - `legna migrate` 迁移工具
158
- - TS 语法高亮
159
- - 跨平台预编译二进制
178
+ - WebUI 管理面板(21 个提供商预设)
179
+ - 配置联邦(Cursor/Windsurf/Gemini/Codex/Copilot)
180
+ - 持久 Shell 会话
181
+ - 输出最小化器(git/npm/cargo)
160
182
 
161
183
  </td></tr>
162
184
  </table>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legna-lnc/legnacode",
3
- "version": "2.1.2",
3
+ "version": "2.1.6",
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.2",
146
- "@legna-lnc/legnacode-darwin-x64": "2.1.2",
147
- "@legna-lnc/legnacode-darwin-x64-baseline": "2.1.2",
148
- "@legna-lnc/legnacode-linux-x64": "2.1.2",
149
- "@legna-lnc/legnacode-linux-x64-baseline": "2.1.2",
150
- "@legna-lnc/legnacode-linux-arm64": "2.1.2",
151
- "@legna-lnc/legnacode-win32-x64": "2.1.2",
152
- "@legna-lnc/legnacode-win32-ia32": "2.1.2"
146
+ "@legna-lnc/legnacode-darwin-arm64": "2.1.6",
147
+ "@legna-lnc/legnacode-darwin-x64": "2.1.6",
148
+ "@legna-lnc/legnacode-darwin-x64-baseline": "2.1.6",
149
+ "@legna-lnc/legnacode-linux-x64": "2.1.6",
150
+ "@legna-lnc/legnacode-linux-x64-baseline": "2.1.6",
151
+ "@legna-lnc/legnacode-linux-arm64": "2.1.6",
152
+ "@legna-lnc/legnacode-win32-x64": "2.1.6",
153
+ "@legna-lnc/legnacode-win32-ia32": "2.1.6"
153
154
  }
154
155
  }