zapmyco 0.1.0 → 0.3.0

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 CHANGED
@@ -1,47 +1,62 @@
1
- # ai-typescript-starter
1
+ # zapmyco
2
2
 
3
- [![CI](https://github.com/shenjingnan/ai-typescript-starter/actions/workflows/ci.yml/badge.svg)](https://github.com/shenjingnan/ai-typescript-starter/actions/workflows/ci.yml)
4
- [![npm version](https://img.shields.io/npm/v/ai-typescript-starter.svg)](https://www.npmjs.com/package/ai-typescript-starter)
3
+ [![CI](https://github.com/shenjingnan/zapmyco/actions/workflows/ci.yml/badge.svg)](https://github.com/shenjingnan/zapmyco/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/zapmyco.svg)](https://www.npmjs.com/package/zapmyco)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
 
7
- AI 原生的 TypeScript 启动模板,专为 AI 辅助开发时代打造。
7
+ AI 原生并行任务编排系统 -- AI 总管 (Personal AI Chief of Staff)。
8
8
 
9
9
  ## 特性
10
10
 
11
- - **现代技术栈**: TypeScript + Node.js 24+ + pnpm
12
- - **构建工具**: tsdown - 基于 rolldown 的 TypeScript 打包器
13
- - **测试框架**: Vitest - Vite 原生测试框架
14
- - **代码质量**: Biome (Lint + Format) + cspell (拼写检查)
15
- - **Git 工作流**: Husky + lint-staged + release-it
16
- - **AI 集成**: 内置 CLAUDE.md .claude/ 目录配置
17
- - **CI/CD**: GitHub Actions 自动化测试和发布
11
+ - **Agent 协议**: 统一的 `IAgent` / `IStreamingAgent` 接口,支持请求-响应 + 流式事件双通道模式
12
+ - **任务编排**: 目标分解、子任务依赖图、并行执行与结果聚合
13
+ - **Agent 运行时**: 基于 pi-agent-core 的适配层,支持 LLM 驱动的 Agent 创建与工具桥接
14
+ - **LLM 集成**: Provider 抽象、结构化输出、Token 用量追踪
15
+ - **交互式 REPL**: 基于 pi-tui 的终端界面,支持命令注册、历史记录、自定义编辑器
16
+ - **CLI 工具链**: `run` 直接执行目标、`agents` 查看注册 Agent、`config` 管理配置
17
+ - **配置系统**: cosmiconfig 驱动,支持多级配置覆盖
18
+ - **基础设施**: 事件总线、统一错误体系、结构化日志
18
19
 
19
20
  ## 快速开始
20
21
 
21
- ### 使用模板
22
-
23
- 点击仓库页面的 "Use this template" 按钮创建新项目。
24
-
25
22
  ### 安装
26
23
 
27
24
  ```bash
28
25
  # 克隆项目
29
- git clone https://github.com/your-username/your-project.git
30
- cd your-project
26
+ git clone https://github.com/shenjingnan/zapmyco.git
27
+ cd zapmyco
31
28
 
32
29
  # 安装依赖
33
30
  pnpm install
34
31
  ```
35
32
 
33
+ ### 使用
34
+
35
+ ```bash
36
+ # 构建项目
37
+ pnpm run build
38
+
39
+ # 进入交互式 REPL 模式
40
+ pnpm run start
41
+ # 或直接运行 CLI
42
+ zapmyco
43
+
44
+ # 直接执行单次目标(非交互模式)
45
+ zapmyco run "重构用户认证模块"
46
+
47
+ # 列出可用 Agent
48
+ zapmyco agents
49
+
50
+ # 显示版本号
51
+ zapmyco version
52
+ ```
53
+
36
54
  ### 开发
37
55
 
38
56
  ```bash
39
- # 开发模式
57
+ # 开发模式 (watch)
40
58
  pnpm run dev
41
59
 
42
- # 构建
43
- pnpm run build
44
-
45
60
  # 测试
46
61
  pnpm run test
47
62
 
@@ -58,16 +73,27 @@ pnpm run check
58
73
  ## 项目结构
59
74
 
60
75
  ```
61
- ai-typescript-starter/
62
- ├── .claude/ # Claude Code 配置
76
+ zapmyco/
77
+ ├── .agents/ # AI Agent 配置 (.claude 符号链接指向此目录)
63
78
  │ ├── commands/ # Slash 命令
64
79
  │ └── skills/ # 技能定义
65
80
  ├── .github/ # GitHub 配置
66
- ├── workflows/ # CI/CD 工作流
67
- │ └── ISSUE_TEMPLATE/ # Issue 模板
81
+ └── workflows/ # CI/CD 工作流
68
82
  ├── docs/ # 文档
69
83
  ├── examples/ # 示例代码
70
- ├── src/ # 源代码
84
+ ├── src/
85
+ │ ├── cli/ # CLI 入口 & REPL 交互界面
86
+ │ │ └── repl/ # REPL 核心:命令注册、会话、渲染、历史、编辑器
87
+ │ ├── config/ # 配置加载与默认值
88
+ │ ├── core/ # 核心领域模型
89
+ │ │ ├── agent-runtime/# Agent 运行时 (pi-agent-core 适配层)
90
+ │ │ ├── aggregator/ # 结果聚合
91
+ │ │ ├── intent/ # 目标与意图
92
+ │ │ ├── result/ # 任务结果
93
+ │ │ └── task/ # 子任务与依赖图
94
+ │ ├── infra/ # 基础设施:常量、错误、事件总线、日志
95
+ │ ├── llm/ # LLM Provider 抽象 & Token 追踪
96
+ │ ├── protocol/ # Agent 协议接口定义
71
97
  │ └── __tests__/ # 测试文件
72
98
  ├── AGENTS.md # AI Agent 配置
73
99
  └── dist/ # 构建产物
@@ -79,6 +105,7 @@ ai-typescript-starter/
79
105
  |------|------|
80
106
  | `pnpm run build` | 构建项目 |
81
107
  | `pnpm run dev` | 开发模式 (watch) |
108
+ | `pnpm run start` | 启动 CLI (REPL 模式) |
82
109
  | `pnpm run test` | 运行测试 |
83
110
  | `pnpm run test:watch` | 测试监听模式 |
84
111
  | `pnpm run test:coverage` | 测试覆盖率报告 |
@@ -87,7 +114,7 @@ ai-typescript-starter/
87
114
  | `pnpm run format` | 格式化代码 |
88
115
  | `pnpm run typecheck` | TypeScript 类型检查 |
89
116
  | `pnpm run check` | 完整检查 (typecheck + lint) |
90
- | `pnpm run check:fix` | 检查并修复 |
117
+ | `pnpm run check:fix` | 检查并自动修复 |
91
118
  | `pnpm run spellcheck` | 拼写检查 |
92
119
  | `pnpm run release` | 创建发布 |
93
120
  | `pnpm run release:beta` | 发布 beta 预发布版本 |
@@ -96,18 +123,85 @@ ai-typescript-starter/
96
123
  | `pnpm run release:minor` | 直接发布 minor 版本 |
97
124
  | `pnpm run release:major` | 直接发布 major 版本 |
98
125
 
126
+ ## 公共 API
127
+
128
+ ### 核心导出
129
+
130
+ ```typescript
131
+ import {
132
+ VERSION,
133
+ APP_NAME,
134
+ // 配置
135
+ loadConfig,
136
+ DEFAULT_CONFIG,
137
+ type ZapmycoConfig,
138
+ // Agent 运行时
139
+ createLlmBasedAgent,
140
+ createToolsFromCapabilities,
141
+ createToolFromCapability,
142
+ adaptAgentEvent,
143
+ createEventBridgeListener,
144
+ dispatchToEventBus,
145
+ LlmBasedAgent,
146
+ // LLM
147
+ CostTracker,
148
+ costTracker,
149
+ // 基础设施
150
+ eventBus,
151
+ Logger,
152
+ logger,
153
+ ZapmycoError,
154
+ } from 'zapmyco';
155
+ ```
156
+
157
+ ### Protocol 层类型
158
+
159
+ ```typescript
160
+ import type {
161
+ IAgent,
162
+ IStreamingAgent,
163
+ AgentExecuteRequest,
164
+ AgentExecuteOptions,
165
+ AgentStatus,
166
+ Capability,
167
+ CapabilityCategory,
168
+ Goal,
169
+ SubTask,
170
+ TaskGraph,
171
+ TaskResult,
172
+ FinalResult,
173
+ TokenUsage,
174
+ } from 'zapmyco';
175
+
176
+ // 或单独导入协议层
177
+ import type { IAgent, IStreamingAgent } from 'zapmyco/protocol';
178
+ ```
179
+
180
+ ### 核心领域类型
181
+
182
+ | 模块 | 关键类型 | 说明 |
183
+ |------|---------|------|
184
+ | `protocol/agent` | `IAgent`, `IStreamingAgent` | Agent 统一接口 |
185
+ | `core/intent` | `Goal`, `GoalType`, `GoalConstraints` | 目标与意图定义 |
186
+ | `core/task` | `SubTask`, `TaskGraph`, `TaskStatus` | 子任务与依赖图 |
187
+ | `core/result` | `TaskResult`, `FinalResult`, `TokenUsage` | 执行结果与用量 |
188
+ | `core/aggregator` | `ProgressEvent`, `ProgressPayload` | 进度事件 |
189
+ | `core/agent-runtime` | `AgentRuntimeConfig`, `ToolRegistration` | 运行时配置 |
190
+ | `llm/types` | `ChatMessage`, `LlmResponse`, `StructuredOutputSchema` | LLM 交互类型 |
191
+ | `config/types` | `ZapmycoConfig` | 应用配置 |
192
+
99
193
  ## AI 辅助开发
100
194
 
101
195
  本项目专为 AI 辅助开发设计,内置了完善的 AI 工程约束:
102
196
 
103
- ### CLAUDE.md
197
+ ### AGENTS.md / CLAUDE.md
104
198
 
105
199
  为 Claude Code 提供项目上下文和开发规范。
106
200
 
107
- ### .claude/ 目录
201
+ ### .agents/ 目录
108
202
 
109
- - `commands/` - 自定义 Slash 命令 (`/build`, `/test`, `/lint`, `/typecheck`, `/spellcheck`, `/release`, `/commit-push-pr`)
110
- - `skills/` - 项目技能定义 (`resolve-git-conflicts`, `fix-audit`, `project-context`, `update-readme`)
203
+ - `commands/` - 自定义 Slash 命令 (`/build`, `/test`, `/lint`, `/typecheck`, `/release`, `/commit-push-pr`)
204
+ - `skills/` - 项目技能定义 (`update-readme`, `resolve-git-conflicts`, `project-context` )
111
205
 
112
206
  ## 代码风格
113
207
 
@@ -146,4 +240,4 @@ pnpm run release
146
240
 
147
241
  ## 许可证
148
242
 
149
- [MIT](LICENSE) © 2026 shenjingnan
243
+ [MIT](LICENSE) © 2026 shenjingnan