@x-otto/coding 0.0.1-alpha.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 ADDED
@@ -0,0 +1,79 @@
1
+ # @x-otto/coding
2
+
3
+ ## 模块定位
4
+
5
+ 应用装配层,将各子系统组合成完整的 otto 编码助手。管理 App 容器和 AgentSession 对话周期。
6
+
7
+ ## 核心功能
8
+
9
+ | 模块 | 功能 |
10
+ | -------------------- | ------------------------------------------------ |
11
+ | App | 依赖注入容器,装配所有子系统 |
12
+ | AgentSession | 对话生命周期,消息持久化 + 事件流转发 + 工具网关 |
13
+ | CodingSessionManager | 多会话容器(InMemory / Disk / Remote) |
14
+ | Runner | 4 种运行模式(Print / JSON / RPC / Interactive) |
15
+
16
+ ## 安装
17
+
18
+ ```bash
19
+ pnpm add @x-otto/coding
20
+ ```
21
+
22
+ ## 快速开始
23
+
24
+ ```ts
25
+ import { App } from '@x-otto/coding'
26
+
27
+ const app = new App({
28
+ model: 'claude-sonnet-4-5-20250929',
29
+ workspaceDir: process.cwd(),
30
+ apiKey: process.env.ANTHROPIC_API_KEY,
31
+ })
32
+
33
+ const session = await app.createSession()
34
+ await session.prompt('Write a fibonacci function')
35
+ await app.dispose()
36
+ ```
37
+
38
+ ## API
39
+
40
+ | 导出 | 类型 | 说明 |
41
+ |---|---|---|
42
+ | `App` | `class` | 依赖注入容器,装配所有子系统 |
43
+ | `AgentSession` | `class` | 对话生命周期管理 |
44
+ | `CodingSessionManager` | `class` | 多会话容器 |
45
+ | `createPrintRunner` | `function` | Print 模式运行器 |
46
+ | `createInteractiveRunner` | `function` | Interactive 模式运行器 |
47
+ | `createJsonRunner` | `function` | JSON 模式运行器 |
48
+ | `createRpcRunner` | `function` | RPC 模式运行器 |
49
+
50
+ ## 目录概览
51
+
52
+ ```
53
+ src/
54
+ types.ts # 核心类型
55
+ app.ts # 应用容器
56
+ agent-session.ts # 对话生命周期
57
+ coding-session-manager.ts # 多会话管理
58
+ run/
59
+ print.ts # Print 模式
60
+ json.ts # JSON 模式
61
+ rpc.ts # RPC 模式
62
+ interactive.ts # 交互式 REPL
63
+ index.ts
64
+ tests/ # 29 个测试文件
65
+ example/
66
+ docs/
67
+ ```
68
+
69
+ ## 开发命令
70
+
71
+ ```bash
72
+ pnpm --filter @x-otto/coding build
73
+ pnpm --filter @x-otto/coding typecheck
74
+ pnpm --filter @x-otto/coding clean
75
+ ```
76
+
77
+ ## 关联包
78
+
79
+ 依赖几乎所有 `@x-otto/*` 子包,作为顶层组装。