@ai-zen/air 0.3.1 → 0.3.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.
- package/README.md +27 -29
- package/README.zh.md +27 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,14 +69,14 @@ $ gred "hello" file.txt
|
|
|
69
69
|
├── config.json # { "apiKey": "sk-xxx" }
|
|
70
70
|
├── context.json # [ { role, content }, ... ] Current conversation
|
|
71
71
|
├── snapshots/ # Auto snapshots before migration or /save
|
|
72
|
-
└──
|
|
72
|
+
└── memory/ # Long-term memory written by AI (*.md)
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### Core Philosophy
|
|
76
76
|
|
|
77
77
|
- **Model**: DeepSeek-V4-Flash (hardcoded, only one)
|
|
78
78
|
- **Tool**: Just one `shell` tool — the AI executes commands, reads and writes files through it
|
|
79
|
-
- **Memory**: The AI decides what to remember, writes to `
|
|
79
|
+
- **Memory**: The AI decides what to remember, writes to `memory/*.md` via shell, reads on next startup. No extra persistence mechanism
|
|
80
80
|
- **Context**: Auto-migrates when JSON serialization exceeds 500K chars, takes a snapshot before migration
|
|
81
81
|
- **Rules**: Consult the user before making changes. Dangerous operations require explicit written confirmation. The user takes responsibility for their own instructions
|
|
82
82
|
|
|
@@ -84,36 +84,34 @@ $ gred "hello" file.txt
|
|
|
84
84
|
|
|
85
85
|
```
|
|
86
86
|
src/
|
|
87
|
-
├── cli.ts
|
|
88
|
-
├── config.ts
|
|
89
|
-
├── delta-renderer.ts
|
|
90
|
-
├── hook.ts
|
|
91
|
-
├── migration.ts
|
|
92
|
-
├── tools.ts
|
|
93
|
-
├── agent-factory.ts
|
|
94
|
-
├── chat
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
│ ├──
|
|
99
|
-
│
|
|
100
|
-
│
|
|
101
|
-
│
|
|
102
|
-
│
|
|
103
|
-
│
|
|
104
|
-
│
|
|
105
|
-
│
|
|
106
|
-
│ ├── new.ts # /new — new session
|
|
107
|
-
│ └── save.ts # /save — save snapshot
|
|
87
|
+
├── cli.ts # CLI entry, commander
|
|
88
|
+
├── config.ts # Config, context, snapshot read/write
|
|
89
|
+
├── delta-renderer.ts # Stream renderer
|
|
90
|
+
├── hook.ts # Fallback terminal hook (install/uninstall)
|
|
91
|
+
├── migration.ts # Context counting & migration
|
|
92
|
+
├── tools.ts # Tool definitions — shell
|
|
93
|
+
├── agent-factory.ts # Agent factory — build model & agent
|
|
94
|
+
├── agent-runtime.ts # Core runtime — send, chat loop
|
|
95
|
+
├── agent-types.ts # Type definitions (ChatCtx, etc.)
|
|
96
|
+
├── agent-constants.ts # System prompt & constants
|
|
97
|
+
├── agent-commands/ # Interactive command handlers
|
|
98
|
+
│ ├── index.ts # dispatchCommand() — command router
|
|
99
|
+
│ ├── back.ts # /back — recall & resend
|
|
100
|
+
│ ├── editor.ts # /editor — multi-line input
|
|
101
|
+
│ ├── exit.ts # /exit — quit
|
|
102
|
+
│ ├── help.ts # /help
|
|
103
|
+
│ ├── load.ts # /load — load snapshot
|
|
104
|
+
│ ├── new.ts # /new — new session
|
|
105
|
+
│ └── save.ts # /save — save snapshot
|
|
108
106
|
└── __tests__/
|
|
109
|
-
├── chat.test.ts
|
|
110
|
-
├── config.test.ts
|
|
111
|
-
├── main.test.ts
|
|
112
|
-
├── e2e.test.ts
|
|
113
|
-
└── tools.test.ts
|
|
107
|
+
├── chat.test.ts # Chat session tests
|
|
108
|
+
├── config.test.ts # Config/context/snapshot tests
|
|
109
|
+
├── main.test.ts # contextSize/shouldMigrate tests
|
|
110
|
+
├── e2e.test.ts # End-to-end tests
|
|
111
|
+
└── tools.test.ts # Shell tool structure tests
|
|
114
112
|
```
|
|
115
113
|
|
|
116
|
-
~
|
|
114
|
+
~76 KB, 879 lines (excluding tests).
|
|
117
115
|
|
|
118
116
|
## Tests
|
|
119
117
|
|
package/README.zh.md
CHANGED
|
@@ -69,14 +69,14 @@ $ gred "hello" file.txt
|
|
|
69
69
|
├── config.json # { "apiKey": "sk-xxx" }
|
|
70
70
|
├── context.json # [ { role, content }, ... ] 当前对话
|
|
71
71
|
├── snapshots/ # /save 或迁移前自动快照
|
|
72
|
-
└──
|
|
72
|
+
└── memory/ # AI 自己写入的长期记忆 (*.md)
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### 核心理念
|
|
76
76
|
|
|
77
77
|
- **模型**: DeepSeek-V4-Flash(写死,只有一个)
|
|
78
78
|
- **工具**: 只有一个 `shell`,AI 用它执行命令、读写文件
|
|
79
|
-
- **记忆**: AI 自己决定记什么,用 shell 写入 `
|
|
79
|
+
- **记忆**: AI 自己决定记什么,用 shell 写入 `memory/*.md`,下次启动时读取。air 不做额外的持久化机制
|
|
80
80
|
- **上下文**: JSON 序列化后超过 50 万字符自动迁移,迁移前拍快照
|
|
81
81
|
- **行为准则**: 先商量再动手,危险操作必须获得用户书面确认。追责原则——每一步基于用户指令,用户承担责任
|
|
82
82
|
|
|
@@ -84,36 +84,34 @@ $ gred "hello" file.txt
|
|
|
84
84
|
|
|
85
85
|
```
|
|
86
86
|
src/
|
|
87
|
-
├── cli.ts
|
|
88
|
-
├── config.ts
|
|
89
|
-
├── delta-renderer.ts
|
|
90
|
-
├── hook.ts
|
|
91
|
-
├── migration.ts
|
|
92
|
-
├── tools.ts
|
|
93
|
-
├── agent-factory.ts
|
|
94
|
-
├── chat
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
│ ├──
|
|
99
|
-
│
|
|
100
|
-
│
|
|
101
|
-
│
|
|
102
|
-
│
|
|
103
|
-
│
|
|
104
|
-
│
|
|
105
|
-
│
|
|
106
|
-
│ ├── new.ts # /new — 新会话
|
|
107
|
-
│ └── save.ts # /save — 保存快照
|
|
87
|
+
├── cli.ts # CLI 入口,commander
|
|
88
|
+
├── config.ts # 配置、上下文、快照读写
|
|
89
|
+
├── delta-renderer.ts # 流式渲染器
|
|
90
|
+
├── hook.ts # 兜底终端钩子(install/uninstall)
|
|
91
|
+
├── migration.ts # 上下文计数与迁移
|
|
92
|
+
├── tools.ts # 工具定义——shell
|
|
93
|
+
├── agent-factory.ts # Agent 工厂——构建模型与 Agent
|
|
94
|
+
├── agent-runtime.ts # 核心运行时——send、chat loop
|
|
95
|
+
├── agent-types.ts # 类型定义(ChatCtx 等)
|
|
96
|
+
├── agent-constants.ts # 系统提示词与常量
|
|
97
|
+
├── agent-commands/ # 交互命令处理
|
|
98
|
+
│ ├── index.ts # dispatchCommand() — 命令分发入口
|
|
99
|
+
│ ├── back.ts # /back — 撤回消息
|
|
100
|
+
│ ├── editor.ts # /editor — 多行编辑器输入
|
|
101
|
+
│ ├── exit.ts # /exit — 退出
|
|
102
|
+
│ ├── help.ts # /help
|
|
103
|
+
│ ├── load.ts # /load — 加载快照
|
|
104
|
+
│ ├── new.ts # /new — 新会话
|
|
105
|
+
│ └── save.ts # /save — 保存快照
|
|
108
106
|
└── __tests__/
|
|
109
|
-
├── chat.test.ts
|
|
110
|
-
├── config.test.ts
|
|
111
|
-
├── main.test.ts
|
|
112
|
-
├── e2e.test.ts
|
|
113
|
-
└── tools.test.ts
|
|
107
|
+
├── chat.test.ts # 聊天测试
|
|
108
|
+
├── config.test.ts # 配置/上下文/快照测试
|
|
109
|
+
├── main.test.ts # contextSize/shouldMigrate 测试
|
|
110
|
+
├── e2e.test.ts # 端到端测试
|
|
111
|
+
└── tools.test.ts # shell 工具结构测试
|
|
114
112
|
```
|
|
115
113
|
|
|
116
|
-
共
|
|
114
|
+
共 116 KB,1381 行。
|
|
117
115
|
|
|
118
116
|
## 测试
|
|
119
117
|
|