@legna-lnc/legnacode 1.4.1 → 1.4.3

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +62 -0
  3. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -2,6 +2,51 @@
2
2
 
3
3
  All notable changes to LegnaCode CLI will be documented in this file.
4
4
 
5
+ ## [1.4.3] - 2026-04-11
6
+
7
+ ### Features
8
+
9
+ - **mempalace 记忆架构融合** — 移植 mempalace 的核心记忆系统,纯 TypeScript 实现,零外部依赖:
10
+ - **DrawerStore** — SQLite 持久化向量记忆存储 + WAL 审计日志,确定性 drawer ID(sha256 幂等 upsert)
11
+ - **TF-IDF 向量化器** — 纯 TS 实现(Porter 词干 + 余弦相似度),<10K drawer 搜索 <5ms
12
+ - **4 层记忆栈** — L0 identity (~100 token) + L1 top drawers (~500-800 token) 每轮加载,L2/L3 按需召回。每轮 token 从 ~8K 降到 ~800(节省 ~88%)
13
+ - **时序知识图谱** — SQLite 实体-关系存储,支持带有效期的三元组和时间点查询
14
+ - **Room 自动分类** — 6 类(facts/decisions/events/discoveries/preferences/advice)关键词评分
15
+ - **交换对提取器** — Q+A 配对分块 + 5 类标记评分(decisions/preferences/milestones/problems/emotional)
16
+ - **自动迁移** — 首次启动自动将现有 .legna/memory/*.md 文件迁移到 DrawerStore
17
+ - **PreCompact 记忆保存** — 压缩前自动提取高价值交换对到 DrawerStore,防止记忆丢失
18
+
19
+ ### Architecture
20
+
21
+ - 新增 `src/memdir/vectorStore/` — 完整的向量记忆系统(8 个文件)
22
+ - `types.ts` — Drawer、SearchResult、MetadataFilter 类型
23
+ - `tfidfVectorizer.ts` — TF-IDF + Porter 词干 + 余弦相似度
24
+ - `drawerStore.ts` — SQLite 持久化 + WAL + 向量搜索
25
+ - `roomDetector.ts` — 内容自动分类
26
+ - `layeredStack.ts` — 4 层记忆栈
27
+ - `knowledgeGraph.ts` — 时序知识图谱
28
+ - `exchangeExtractor.ts` — 交换对提取 + 标记评分
29
+ - `migration.ts` — .md → DrawerStore 自动迁移
30
+ - 升级 `src/memdir/providers/FileMemoryProvider.ts` — DrawerStore + LayeredStack 后端
31
+ - 接线 `src/services/compact/autoCompact.ts` — 压缩前调用 onPreCompress
32
+
33
+ ## [1.4.2] - 2026-04-11
34
+
35
+ ### Features
36
+
37
+ - **verbose 默认开启** — 用户默认看到完整的工具执行过程和进度信息
38
+ - **Token/Timer 即时显示** — 去掉 30 秒延迟,token 计数和耗时从第 1 秒就显示
39
+ - **Autocompact 状态可见** — 压缩对话时显示 "Compacting conversation context..." 系统消息
40
+ - **中断原因可见** — abort 时显示中断原因(streaming 和 tool_execution 两个阶段)
41
+ - **Output truncated 重试提示** — max output tokens recovery 时显示重试进度
42
+ - **工具执行日志** — StreamingToolExecutor 输出当前工具名和队列深度
43
+ - **Microcompact/Snip 日志** — 压缩操作添加 debug 日志
44
+ - **ForkedAgent 启动日志** — 子 agent 启动时输出标签和 ID
45
+
46
+ ### Bug Fixes
47
+
48
+ - **Apple Terminal 通知逻辑修复** — bell 未禁用时才发 bell(之前逻辑反了)
49
+
5
50
  ## [1.4.0] - 2026-04-11
6
51
 
7
52
  ### Features
package/README.md CHANGED
@@ -12,6 +12,8 @@ LegnaCode 是一个基于 Anthropic Claude 的智能终端编程助手,让你
12
12
 
13
13
  | 版本 | 日期 | 摘要 |
14
14
  |------|------|------|
15
+ | [1.4.3](./CHANGELOG.md#143---2026-04-11) | 2026-04-11 | mempalace 记忆架构融合(DrawerStore + TF-IDF 向量搜索 + 4 层记忆栈 + 时序知识图谱),token 节省 ~88% |
16
+ | [1.4.2](./CHANGELOG.md#142---2026-04-11) | 2026-04-11 | 进度反馈增强(消除 8 个静默代码路径),verbose 默认开启,Token/Timer 即时显示,中断原因可见 |
15
17
  | [1.4.0](./CHANGELOG.md#140---2026-04-11) | 2026-04-11 | MiniMax 深度原生兼容(6 个多模态工具),RPC 子进程工具执行,Memory Provider 插件系统,智能模型路由,自主技能检测,上下文压缩增强,跨会话记忆搜索 |
16
18
  | [1.3.7](./CHANGELOG.md#137---2026-04-09) | 2026-04-09 | Resume 会话检测修复,Interrupted 诊断日志,后台任务状态可见性增强 |
17
19
  | [1.3.6](./CHANGELOG.md#136---2026-04-09) | 2026-04-09 | 修复 Windows 路径分隔符导致 Edit 工具 "File has been unexpectedly modified" 误报 |
@@ -236,6 +238,66 @@ legna migrate --dry-run
236
238
  | `CLAUDE_CODE_USE_BEDROCK` | 使用 AWS Bedrock 后端 |
237
239
  | `CLAUDE_CODE_USE_VERTEX` | 使用 GCP Vertex 后端 |
238
240
  | `CLAUDE_CODE_SYNTAX_HIGHLIGHT` | 设为 `0` 禁用语法高亮 |
241
+ | `MINIMAX_API_KEY` | MiniMax API 密钥(启用多模态工具) |
242
+ | `MINIMAX_REGION` | MiniMax 区域:`global`(默认)或 `cn` |
243
+ | `MINIMAX_BASE_URL` | 自定义 MiniMax API 地址(覆盖区域默认值) |
244
+
245
+ ---
246
+
247
+ ## MiniMax 多模态集成
248
+
249
+ 当使用 MiniMax 模型(`ANTHROPIC_BASE_URL` 指向 `api.minimax.io` 或 `api.minimaxi.com`)且配置了 `MINIMAX_API_KEY` 时,LegnaCode 自动注册 6 个多模态原生工具,AI 可以直接调用。
250
+
251
+ ### 配置
252
+
253
+ ```bash
254
+ # 方式一:环境变量
255
+ export MINIMAX_API_KEY="your-api-key"
256
+ export MINIMAX_REGION="global" # 或 "cn"
257
+
258
+ # 方式二:交互式配置(持久化到 ~/.legna/minimax-credentials.json)
259
+ legna
260
+ > /auth-minimax your-api-key
261
+ ```
262
+
263
+ API key 获取:[MiniMax 国际站](https://platform.minimax.io) 或 [MiniMax 国内站](https://platform.minimaxi.com)
264
+
265
+ ### 多模态工具
266
+
267
+ | 工具 | 功能 | 示例 |
268
+ |------|------|------|
269
+ | `MiniMaxImageGenerate` | 文字生成图像 | "生成一张赛博朋克风格的城市夜景" |
270
+ | `MiniMaxVideoGenerate` | 文字/图像生成视频 | "把这张图片做成一段 5 秒的动画" |
271
+ | `MiniMaxSpeechSynthesize` | 文字转语音 | "把这段文字转成语音朗读" |
272
+ | `MiniMaxMusicGenerate` | 文字生成音乐 | "生成一段轻快的钢琴背景音乐" |
273
+ | `MiniMaxVisionDescribe` | 图像理解分析 | "描述这张图片的内容" |
274
+ | `MiniMaxWebSearch` | 网页搜索 | "搜索最新的 TypeScript 5.x 特性" |
275
+
276
+ 工具仅在使用 MiniMax 模型时自动启用,不影响其他模型的工具列表。
277
+
278
+ ### 多模态工作流
279
+
280
+ AI 可以自动编排多个工具完成复杂任务:
281
+
282
+ ```
283
+ 用户:帮我做一个项目宣传视频
284
+
285
+ AI 自动编排:
286
+ 1. 分析项目 README,提取核心卖点
287
+ 2. MiniMaxImageGenerate → 生成关键帧图片
288
+ 3. MiniMaxVideoGenerate → 基于关键帧生成视频
289
+ 4. MiniMaxSpeechSynthesize → 生成旁白配音
290
+ 5. 返回所有生成资源的 URL
291
+ ```
292
+
293
+ ### Schema 导出
294
+
295
+ MiniMax 工具的 schema 可以导出为 Anthropic 兼容格式,用于外部集成:
296
+
297
+ ```typescript
298
+ import { exportMiniMaxToolSchemasJSON } from './src/tools/MiniMaxTools/schemaExport.js'
299
+ console.log(exportMiniMaxToolSchemasJSON())
300
+ ```
239
301
 
240
302
  ---
241
303
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legna-lnc/legnacode",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "LegnaCode — legna.lnc's official CLI for coding assistance",
5
5
  "type": "module",
6
6
  "bin": {
@@ -142,11 +142,11 @@
142
142
  "bun": ">=1.2.0"
143
143
  },
144
144
  "optionalDependencies": {
145
- "@legna-lnc/legnacode-darwin-arm64": "1.4.1",
146
- "@legna-lnc/legnacode-darwin-x64": "1.4.1",
147
- "@legna-lnc/legnacode-linux-x64": "1.4.1",
148
- "@legna-lnc/legnacode-linux-arm64": "1.4.1",
149
- "@legna-lnc/legnacode-win32-x64": "1.4.1",
150
- "@legna-lnc/legnacode-win32-ia32": "1.4.1"
145
+ "@legna-lnc/legnacode-darwin-arm64": "1.4.3",
146
+ "@legna-lnc/legnacode-darwin-x64": "1.4.3",
147
+ "@legna-lnc/legnacode-linux-x64": "1.4.3",
148
+ "@legna-lnc/legnacode-linux-arm64": "1.4.3",
149
+ "@legna-lnc/legnacode-win32-x64": "1.4.3",
150
+ "@legna-lnc/legnacode-win32-ia32": "1.4.3"
151
151
  }
152
152
  }