@legna-lnc/legnacode 1.5.6 → 1.8.1

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,99 @@
4
4
 
5
5
  All notable changes to LegnaCode CLI will be documented in this file.
6
6
 
7
+ ## [1.8.0] - 2026-04-21
8
+
9
+ > Codex Full Fusion Release — 5-phase integration of OpenAI Codex CLI capabilities into LegnaCode.
10
+
11
+ ### Security (Phase 1 + Phase 2)
12
+
13
+ - **Process Hardening** — Disable core dumps, detect ptrace attachment, sanitize dangerous env vars (`LD_PRELOAD`, `DYLD_INSERT_LIBRARIES`, `NODE_OPTIONS` injection).
14
+ - **Static Exec Policy Engine** — TOML-based command execution rules (`prefix`/`glob`/`regex` matching). Built-in defaults block destructive commands (`rm -rf /`, `mkfs`), prompt for package installs, allow read-only operations. Evaluated before LLM classifier — `forbidden` → instant deny, `allow` → instant pass, `prompt` → existing approval flow.
15
+ - **Secret Detector** — Regex pattern library for AWS keys, GitHub tokens, JWTs, Slack tokens, private keys, generic API keys. Auto-redaction in memory pipeline (`[REDACTED:type]`).
16
+ - **Rollback** — Full implementation with timeline scanning, `--dry-run` preview, `--safe` backup branch creation.
17
+ - **Guardian Sub-Agent** — Dedicated tool call risk assessment with 6-category taxonomy (data_exfiltration, credential_probing, security_weakening, destructive_action, privilege_escalation, supply_chain). Rule-based pre-classification (30+ patterns), compact transcript builder (<2000 tokens), fail-closed design.
18
+ - **Shell Escalation Protocol** — Three-tier execution: `sandbox` (restricted), `escalate` (user confirm), `deny` (refuse). Platform-aware wrapping: macOS Seatbelt, Linux bubblewrap, fallback `unshare --net`.
19
+ - **Network Policy Agent** — Domain-level access control with `full`/`limited`/`blocked` modes, wildcard patterns, denylist priority, JSONL audit log.
20
+
21
+ ### Performance (Phase 4)
22
+
23
+ - **Rust Native NAPI Addon** — `cosine_similarity` (SIMD f32), `tfidf_vectorize` (Rayon parallel), `content_hash` (SHA-256 streaming), `estimate_tokens` (branchless CJK-aware). ~10-50x speedup with automatic TS fallback.
24
+ - **Kernel-Level Sandbox** — Seatbelt via `sandbox_init()` (macOS), seccomp-bpf via `prctl` (Linux). No external dependency (`sandbox-exec`/`bwrap`).
25
+ - **Two-Pass Wake-Up** — Greedy L1 fill + L0 backfill for maximum depth and coverage within token budget.
26
+ - **Keyword-Density L1** — Sentence ranking by `(keyword_ratio × √keyword_count)` replaces naive first-3-sentences.
27
+ - **Token ROI Ranking** — Memories ranked by recall-to-cost ratio; compact frequently-recalled memories outrank verbose one-shot memories.
28
+
29
+ ### Features (Phase 3 + Phase 5)
30
+
31
+ - **Collaboration Mode System** — Templated `.md` modes with YAML frontmatter. Built-in: `default`, `plan`, `execute`, `pair`. Three-tier loading (built-in → user → project). Runtime switching via programmatic API (note: `/mode` slash command disabled in compiled binary due to Bun JIT limitation).
32
+ - **JS REPL Bridge** — Public `legnacode` object in REPL scope: `tool()`, `readFile()`, `exec()`, `glob()`, `grep()`, `emitImage()`.
33
+ - **App-Server JSON-RPC** — Full JSON-RPC 2.0 with 7 method groups (`thread/*`, `turn/*`, `fs/*`, `config/*`, `mcpServer/*`, `model/*`, `skills/*`). Streaming notifications. stdio + WebSocket transports.
34
+ - **Agent Config Migration** — `/migrate` detects Codex, Cursor, Copilot, Windsurf, Aider, Continue. Imports config, MCP servers, rules.
35
+ - **Codex Plugin Compatibility** — Adapter for `codex-plugin.json` manifests. Marketplace registry fetcher with cache. Installation + auth policy engines. Integrated into plugin loader (CWD auto-scan) and marketplace browser.
36
+ - **Codex Skills Compatibility** — Auto-discovery of `~/.codex/skills/`. Frontmatter normalizer (`triggers` → `when_to_use`, `tools` → `allowed-tools`, `invoke` → `argument-hint`).
37
+ - **Codex Config Interoperability** — Bidirectional `~/.codex/config.toml` mapping. Auto-import as lowest-priority settings base.
38
+ - **TypeScript SDK** (`@legna/legnacode-sdk`) — `LegnaCode` client, `Thread` class, stdio/WebSocket transports, structured output. `Codex` alias.
39
+ - **Python SDK** (`legnacode-sdk`) — Async client, Thread, JSON-RPC transport, dataclass types. `Codex` alias.
40
+ - **TTS Voice Output** — Native backend (macOS `say`, Linux `espeak`). Streaming queue. Graceful degradation.
41
+ - **WebRTC Voice Transport** — Bidirectional audio via WebRTC. Signalling, ICE exchange, peer connection. Stub fallback.
42
+
43
+ ## [1.6.1] - 2026-04-24
44
+
45
+ ### Performance
46
+
47
+ - **Rust Native NAPI Addon** — Core hot-path operations rewritten in Rust via `napi-rs`. `cosine_similarity` (SIMD-accelerated f32 dot product), `tfidf_vectorize` (parallel TF-IDF with Rayon), `content_hash` (SHA-256 with streaming), and `estimate_tokens` (branchless CJK-aware counting). TypeScript bindings with automatic fallback to pure-TS implementations when the native module is unavailable. ~10-50x speedup on vector operations.
48
+
49
+ ### Security
50
+
51
+ - **Kernel-Level Sandbox Integration** — Rust-native sandbox profiles replace shell-exec wrappers. macOS: Seatbelt profile compiled in-process via `sandbox_init()` (no `sandbox-exec` child process). Linux: direct `prctl` seccomp-bpf syscall filter (no `bwrap`/`unshare` dependency). Platform capability detection with graceful degradation. `SandboxNative` class with `applySeatbelt()` / `applySeccomp()` / `detect()` API.
52
+
53
+ ### Improvements
54
+
55
+ - **Two-Pass Wake-Up Filling** — `LayeredStack.wakeUp()` now uses a two-pass strategy: Pass 1 greedily fills with L1 summaries (richer context), Pass 2 backfills remaining budget with L0 summaries from skipped drawers. Maximizes both depth and coverage within the same token budget.
56
+ - **Keyword-Density L1 Generation** — `generateL1()` replaced naive "first 3 sentences" with keyword-density scoring. Sentences ranked by `(keyword_ratio × √keyword_count)`, first sentence always anchored for context, top-density sentences greedily packed into 400 chars, re-sorted by original position for coherent reading.
57
+ - **Token ROI Ranking** — `topByImportance()` and `search()` now factor in token ROI: memories with high recall-to-cost ratio are boosted. A compact memory recalled frequently outranks a verbose memory recalled once. Content-hash index added for faster dedup lookups.
58
+
59
+ ## [1.6.0] - 2026-04-23
60
+
61
+ ### Features
62
+
63
+ - **Collaboration Mode System** — Templated collaboration modes with YAML frontmatter `.md` files. Three-tier loading: built-in (`src/services/collaborationModes/templates/`), user-level (`~/.legnacode/modes/`), project-level (`.legnacode/modes/`). Later tiers override earlier by mode ID. Modes control system prompt injection, tool restrictions (allow/deny lists), and behavior flags (`readOnly`, `autoExecute`, `stepByStep`, `requirePlan`). Ships with four built-in modes: `default`, `plan`, `execute`, `pair`. New `/mode` slash command for listing and switching modes at runtime.
64
+ - **JS REPL Bridge** — Public `legnacode` object injected into the JavaScript REPL global scope. Provides `tool()` for calling any LegnaCode tool by name, `readFile()`, `exec()`, `glob()`, `grep()` shortcuts, and `emitImage()` for rendering base64/Buffer/file-path images. Enables scripting LegnaCode capabilities from within REPL sessions.
65
+ - **App-Server JSON-RPC Layer** — Full JSON-RPC 2.0 infrastructure for IDE integration. Router with method registration and dispatch. Seven method groups: `thread/*` (session lifecycle, fork, rollback, compact), `turn/*` (message send, steer, interrupt), `fs/*` (read/write/metadata), `config/*` (read/write/batch), `mcpServer/*` (status, resource, tool call), `model/list`, `skills/list` + `collaborationMode/list`. Streaming notifier pushes `item/*`, `turn/*`, `agentMessage/delta` notifications. Two transports: stdio (JSONL) and WebSocket (with heartbeat keepalive). Standalone entrypoint via `legnacode app-server --transport stdio|websocket`.
66
+ - **External Agent Config Migration** — Detect and import configurations from other AI coding tools. Detectors for Codex, Cursor, GitHub Copilot, Windsurf, Aider, and Continue. Importers for Codex (TOML/JSON config → model + MCP servers), Cursor (settings.json → MCP servers + `.cursorrules` → `LEGNACODE.md`), and Copilot (`copilot-instructions.md` → `LEGNACODE.md`). Integrated into `/migrate --agents` flag and available standalone. Supports `--dry-run` preview and `--force` overwrite.
67
+
68
+ ## [1.5.9] - 2026-04-22
69
+
70
+ ### Security
71
+
72
+ - **Guardian Sub-Agent** — Dedicated approval agent for tool call risk assessment. Six-category risk taxonomy (data_exfiltration, credential_probing, security_weakening, destructive_action, privilege_escalation, supply_chain). Rule-based fast pre-classification with 30+ signal patterns. Compact transcript builder compresses conversation history to <2000 tokens for context. Fail-closed design: timeout/error/malformed response → deny. Structured JSON assessment output. Configurable via `guardian` settings field.
73
+ - **Shell Escalation Protocol** — Three-tier per-command execution decision: `sandbox` (restricted environment), `escalate` (user confirmation required), `deny` (refuse). Platform-aware sandbox wrapping: macOS Seatbelt (`sandbox-exec`), Linux bubblewrap (`bwrap`), Linux fallback (`unshare --net`). Integrates execPolicy + Guardian pre-classification for decision making. Detects commands needing external write access or network.
74
+ - **Network Policy Agent** — Domain-level network access control for all outbound requests. Three modes: `full` (unrestricted), `limited` (GET/HEAD/OPTIONS only), `blocked` (deny all). Wildcard domain patterns (`*.example.com`). Denylist takes precedence over allowlist. JSONL audit logging to `~/.legnacode/logs/network-audit.jsonl`. Configurable via `~/.legnacode/network-policy.toml`.
75
+
76
+ ## [1.5.8] - 2026-04-22
77
+
78
+ ### Security
79
+
80
+ - **Process Hardening** — Startup module inspired by Codex's `process-hardening`. Strips dangerous environment variables (`LD_PRELOAD`, `DYLD_INSERT_LIBRARIES`, `ELECTRON_RUN_AS_NODE`), sanitizes `NODE_OPTIONS` (removes `--require`/`--loader` injection flags), disables core dumps on Linux, and detects ptrace attachment.
81
+ - **Static Execution Policy Engine** — Rule-based command evaluation before shell execution. Supports prefix, glob, regex, and host_executable matchers. Ships with built-in defaults (forbids `rm -rf /`, pipe-to-shell, fork bombs; prompts for package installs and `sudo`; allows read-only git/file ops). User-configurable via `.legnacode/exec-policy.toml` (project) or `~/.legnacode/exec-policy.toml` (global). Codex-compatible function-call syntax supported.
82
+ - **Secret Detection & Redaction** — Pattern-based detector for 25+ secret types (AWS keys, GitHub PATs, Stripe keys, OpenAI/Anthropic API keys, JWTs, private keys, database URLs, etc.). Integrated into the auto-memory write pipeline — secrets are replaced with `[REDACTED:type]` before persisting to `.legna/memory/`.
83
+
84
+ ### Features
85
+
86
+ - **Rollback CLI** — Full implementation of the rollback command. Lists checkpoint history, resolves targets by index or message-ID prefix, supports `--dry-run` (preview changes), `--safe` (creates git backup branch before restoring), and `--list` (show all rollback points). Built on the existing fileHistory snapshot infrastructure.
87
+
88
+ ## [1.5.7] - 2026-04-21
89
+
90
+ ### Features
91
+
92
+ - **Git-style `/fork` command** — Unified conversation forking with sub-commands:
93
+ - `/fork` — Fork from current position (replaces `/branch`)
94
+ - `/fork @N` — Fork from the Nth user message, truncating subsequent history
95
+ - `/fork list` — Display branch tree with ASCII art, marking current branch
96
+ - `/fork switch <id|name>` — Switch between conversation branches
97
+ - `/fork <name>` — Fork with a custom name
98
+ - `/branch` is now an alias for `/fork`
99
+
7
100
  ## [1.5.6] - 2026-04-21
8
101
 
9
102
  ### Bug Fixes
package/README.md CHANGED
@@ -4,14 +4,15 @@
4
4
 
5
5
  **An AI-powered terminal programming assistant, supercharged.**
6
6
 
7
- [![version](https://img.shields.io/badge/version-1.5.6-blue)](./CHANGELOG.md)
7
+ [![version](https://img.shields.io/badge/version-1.8.0-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)
11
11
 
12
- 🌐 [中文文档](./README.zh-CN.md) · 📊 [vs Claude Code](./COMPARISON.md) · 📋 [Changelog](./CHANGELOG.md)
12
+ 🌐 [中文文档](./README.zh-CN.md) · 🛠️ [开发者文档](./developer.md) · 🛠️ [Developer Guide](./developer.en.md) · 📊 [vs Claude Code](./COMPARISON.md) · 📊 [vs Codex](./COMPARISON-CODEX.md) · 📋 [Changelog](./CHANGELOG.md)
13
+
14
+ <img width="855" height="319" alt="image" src="https://github.com/user-attachments/assets/02c7ba2f-4ef7-4799-8e3c-b469279c44e8" />
13
15
 
14
- <img width="1256" height="416" alt="LegnaCode banner" src="https://github.com/user-attachments/assets/5e4717e6-3404-4901-9f5c-1c6462fb1c1a" />
15
16
 
16
17
  </div>
17
18
 
@@ -33,6 +34,12 @@ LegnaCode is built on top of [Claude Code CLI](https://github.com/anthropics/cla
33
34
 
34
35
  | Version | Summary |
35
36
  |---------|---------|
37
+ | **1.8.0** | Codex full compat: plugin adapter + marketplace, skills discovery, config interop; TS/Python SDK; TTS + WebRTC voice |
38
+ | **1.6.1** | Rust NAPI addon (cosine/tfidf/hash/tokens); kernel sandbox (Seatbelt/seccomp); two-pass wake-up; keyword-density L1 |
39
+ | **1.6.0** | Collaboration modes (`/mode`); JS REPL bridge; JSON-RPC app-server; agent config migration (`/migrate`) |
40
+ | **1.5.9** | Guardian sub-agent; shell escalation protocol; network policy agent |
41
+ | **1.5.8** | Process hardening; exec policy engine; secret detector; rollback implementation |
42
+ | **1.5.7** | Git-style `/fork` command: fork from any message (`@N`), list branches, switch between forks |
36
43
  | **1.5.6** | WebUI SSE timeout fix (255s max); controller double-close crash fix |
37
44
  | **1.5.4** | Republish with all platform binaries in sync |
38
45
  | **1.5.3** | Hermes self-evolution loop; Qwen adapter; WebUI chat viewer & live chat; auto skill creation |
package/README.zh-CN.md CHANGED
@@ -4,14 +4,15 @@
4
4
 
5
5
  **AI 驱动的终端编程助手,全面增强。**
6
6
 
7
- [![version](https://img.shields.io/badge/version-1.5.6-blue)](./CHANGELOG.zh-CN.md)
7
+ [![version](https://img.shields.io/badge/version-1.5.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)
11
11
 
12
12
  🌐 [English](./README.md) · 📊 [对比 Claude Code](./COMPARISON.zh-CN.md) · 📋 [更新日志](./CHANGELOG.zh-CN.md)
13
13
 
14
- <img width="1256" height="416" alt="LegnaCode banner" src="https://github.com/user-attachments/assets/5e4717e6-3404-4901-9f5c-1c6462fb1c1a" />
14
+ <img width="855" height="319" alt="image" src="https://github.com/user-attachments/assets/6e94a216-e382-49df-aa2f-63fb96336614" />
15
+
15
16
 
16
17
  </div>
17
18
 
@@ -33,6 +34,7 @@ LegnaCode 基于 [Claude Code CLI](https://github.com/anthropics/claude-code)
33
34
 
34
35
  | 版本 | 摘要 |
35
36
  |------|------|
37
+ | **1.5.7** | Git 风格 `/fork` 命令:从任意消息分叉(`@N`)、列出分支树、切换分支 |
36
38
  | **1.5.6** | WebUI SSE 超时修复(255s 最大值);controller 重复关闭崩溃修复 |
37
39
  | **1.5.4** | 全平台二进制同步重发 |
38
40
  | **1.5.3** | Hermes 自我进化闭环;Qwen 适配器;WebUI 聊天查看器与实时聊天;自动 Skill 创建 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legna-lnc/legnacode",
3
- "version": "1.5.6",
3
+ "version": "1.8.1",
4
4
  "description": "LegnaCode — legna.lnc's official CLI for coding assistance",
5
5
  "type": "module",
6
6
  "bin": {
@@ -142,13 +142,13 @@
142
142
  "bun": ">=1.2.0"
143
143
  },
144
144
  "optionalDependencies": {
145
- "@legna-lnc/legnacode-darwin-arm64": "1.5.6",
146
- "@legna-lnc/legnacode-darwin-x64": "1.5.6",
147
- "@legna-lnc/legnacode-darwin-x64-baseline": "1.5.6",
148
- "@legna-lnc/legnacode-linux-x64": "1.5.6",
149
- "@legna-lnc/legnacode-linux-x64-baseline": "1.5.6",
150
- "@legna-lnc/legnacode-linux-arm64": "1.5.6",
151
- "@legna-lnc/legnacode-win32-x64": "1.5.6",
152
- "@legna-lnc/legnacode-win32-ia32": "1.5.6"
145
+ "@legna-lnc/legnacode-darwin-arm64": "1.8.1",
146
+ "@legna-lnc/legnacode-darwin-x64": "1.8.1",
147
+ "@legna-lnc/legnacode-darwin-x64-baseline": "1.8.1",
148
+ "@legna-lnc/legnacode-linux-x64": "1.8.1",
149
+ "@legna-lnc/legnacode-linux-x64-baseline": "1.8.1",
150
+ "@legna-lnc/legnacode-linux-arm64": "1.8.1",
151
+ "@legna-lnc/legnacode-win32-x64": "1.8.1",
152
+ "@legna-lnc/legnacode-win32-ia32": "1.8.1"
153
153
  }
154
154
  }