skyloom 1.14.8 → 1.15.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.
Files changed (156) hide show
  1. package/.github/workflows/ci.yml +2 -2
  2. package/.github/workflows/publish.yml +51 -4
  3. package/CONVERSION_PLAN.md +191 -191
  4. package/config/default.yaml +46 -43
  5. package/config/models.yaml +928 -155
  6. package/config/providers.yaml +109 -6
  7. package/dist/agents/snow.d.ts +2 -0
  8. package/dist/agents/snow.d.ts.map +1 -1
  9. package/dist/agents/snow.js +36 -5
  10. package/dist/agents/snow.js.map +1 -1
  11. package/dist/cli/loom_chat.d.ts.map +1 -1
  12. package/dist/cli/loom_chat.js +207 -1
  13. package/dist/cli/loom_chat.js.map +1 -1
  14. package/dist/cli/main.js +192 -42
  15. package/dist/cli/main.js.map +1 -1
  16. package/dist/cli/tui.d.ts.map +1 -1
  17. package/dist/cli/tui.js +6 -31
  18. package/dist/cli/tui.js.map +1 -1
  19. package/dist/core/agent.d.ts +6 -4
  20. package/dist/core/agent.d.ts.map +1 -1
  21. package/dist/core/agent.js +61 -20
  22. package/dist/core/agent.js.map +1 -1
  23. package/dist/core/catalog.d.ts.map +1 -1
  24. package/dist/core/catalog.js +30 -9
  25. package/dist/core/catalog.js.map +1 -1
  26. package/dist/core/commands.d.ts +110 -0
  27. package/dist/core/commands.d.ts.map +1 -0
  28. package/dist/core/commands.js +633 -0
  29. package/dist/core/commands.js.map +1 -0
  30. package/dist/core/concurrency.d.ts +38 -0
  31. package/dist/core/concurrency.d.ts.map +1 -0
  32. package/dist/core/concurrency.js +65 -0
  33. package/dist/core/concurrency.js.map +1 -0
  34. package/dist/core/factory.js +16 -16
  35. package/dist/core/file_checkpoint.d.ts +9 -0
  36. package/dist/core/file_checkpoint.d.ts.map +1 -1
  37. package/dist/core/file_checkpoint.js +33 -1
  38. package/dist/core/file_checkpoint.js.map +1 -1
  39. package/dist/core/llm.d.ts.map +1 -1
  40. package/dist/core/llm.js +66 -13
  41. package/dist/core/llm.js.map +1 -1
  42. package/dist/core/memory.js +51 -51
  43. package/dist/core/schemas.d.ts +16 -0
  44. package/dist/core/schemas.d.ts.map +1 -1
  45. package/dist/core/schemas.js +32 -0
  46. package/dist/core/schemas.js.map +1 -1
  47. package/dist/core/security.d.ts.map +1 -1
  48. package/dist/core/security.js +27 -0
  49. package/dist/core/security.js.map +1 -1
  50. package/dist/core/skymd.js +14 -14
  51. package/dist/core/trace.d.ts +105 -0
  52. package/dist/core/trace.d.ts.map +1 -0
  53. package/dist/core/trace.js +213 -0
  54. package/dist/core/trace.js.map +1 -0
  55. package/dist/tools/builtin.d.ts +2 -6
  56. package/dist/tools/builtin.d.ts.map +1 -1
  57. package/dist/tools/builtin.js +18 -111
  58. package/dist/tools/builtin.js.map +1 -1
  59. package/dist/tools/extra.d.ts +13 -0
  60. package/dist/tools/extra.d.ts.map +1 -0
  61. package/dist/tools/extra.js +827 -0
  62. package/dist/tools/extra.js.map +1 -0
  63. package/dist/tools/guards.d.ts +12 -0
  64. package/dist/tools/guards.d.ts.map +1 -0
  65. package/dist/tools/guards.js +143 -0
  66. package/dist/tools/guards.js.map +1 -0
  67. package/dist/tools/model_tool.d.ts.map +1 -1
  68. package/dist/tools/model_tool.js +24 -4
  69. package/dist/tools/model_tool.js.map +1 -1
  70. package/dist/web/markdown.d.ts +32 -0
  71. package/dist/web/markdown.d.ts.map +1 -0
  72. package/dist/web/markdown.js +202 -0
  73. package/dist/web/markdown.js.map +1 -0
  74. package/dist/web/server.d.ts +4 -0
  75. package/dist/web/server.d.ts.map +1 -1
  76. package/dist/web/server.js +14 -582
  77. package/dist/web/server.js.map +1 -1
  78. package/dist/web/ui.d.ts +31 -0
  79. package/dist/web/ui.d.ts.map +1 -0
  80. package/dist/web/ui.js +1009 -0
  81. package/dist/web/ui.js.map +1 -0
  82. package/docs/AESTHETIC_DESIGN.md +152 -152
  83. package/docs/OPTIMIZATION_PLAN.md +178 -178
  84. package/package.json +1 -1
  85. package/src/agents/snow.ts +38 -5
  86. package/src/cli/commands_md.ts +112 -112
  87. package/src/cli/input_macros.ts +83 -83
  88. package/src/cli/loom.ts +1041 -1041
  89. package/src/cli/loom_chat.ts +772 -603
  90. package/src/cli/main.ts +853 -723
  91. package/src/cli/tui.ts +264 -289
  92. package/src/core/agent/guard.ts +133 -133
  93. package/src/core/agent/task.ts +100 -100
  94. package/src/core/agent.ts +1630 -1590
  95. package/src/core/agent_helpers.ts +500 -500
  96. package/src/core/bus.ts +221 -221
  97. package/src/core/cache.ts +153 -153
  98. package/src/core/catalog.ts +199 -178
  99. package/src/core/circuit_breaker.ts +119 -119
  100. package/src/core/commands.ts +704 -0
  101. package/src/core/concurrency.ts +73 -0
  102. package/src/core/config.ts +365 -365
  103. package/src/core/constants.ts +95 -95
  104. package/src/core/factory.ts +656 -656
  105. package/src/core/file_checkpoint.ts +163 -136
  106. package/src/core/hooks.ts +126 -126
  107. package/src/core/llm.ts +972 -915
  108. package/src/core/logger.ts +143 -143
  109. package/src/core/mcp.ts +1001 -1001
  110. package/src/core/memory.ts +1201 -1201
  111. package/src/core/middleware.ts +350 -350
  112. package/src/core/model_config.ts +159 -159
  113. package/src/core/pipelines.ts +424 -424
  114. package/src/core/schemas.ts +319 -282
  115. package/src/core/security.ts +27 -0
  116. package/src/core/semantic.ts +211 -211
  117. package/src/core/skill.ts +384 -384
  118. package/src/core/skymd.ts +143 -143
  119. package/src/core/theme.ts +65 -65
  120. package/src/core/tool.ts +457 -457
  121. package/src/core/trace.ts +236 -0
  122. package/src/core/verify.ts +71 -71
  123. package/src/plugins/loader.ts +91 -91
  124. package/src/skills/loader.ts +75 -75
  125. package/src/tools/builtin.ts +571 -642
  126. package/src/tools/computer.ts +279 -279
  127. package/src/tools/extra.ts +662 -0
  128. package/src/tools/guards.ts +82 -0
  129. package/src/tools/model_tool.ts +93 -74
  130. package/src/tools/todo.ts +76 -76
  131. package/src/web/markdown.ts +193 -0
  132. package/src/web/server.ts +117 -693
  133. package/src/web/ui.ts +949 -0
  134. package/tests/agent.test.ts +211 -159
  135. package/tests/agent_helpers.test.ts +48 -48
  136. package/tests/catalog.test.ts +86 -86
  137. package/tests/checkpoint_commands.test.ts +124 -124
  138. package/tests/claude_compat.test.ts +110 -110
  139. package/tests/commands.test.ts +103 -0
  140. package/tests/concurrency.test.ts +102 -0
  141. package/tests/config.test.ts +41 -41
  142. package/tests/extra_tools.test.ts +212 -0
  143. package/tests/fence_plugin.test.ts +52 -52
  144. package/tests/guard.test.ts +75 -75
  145. package/tests/loom.test.ts +337 -337
  146. package/tests/memory.test.ts +170 -170
  147. package/tests/model_config.test.ts +109 -109
  148. package/tests/skymd.test.ts +146 -146
  149. package/tests/ssrf.test.ts +38 -38
  150. package/tests/structured_retry.test.ts +87 -0
  151. package/tests/task.test.ts +60 -60
  152. package/tests/todo_toolstats.test.ts +94 -94
  153. package/tests/trace.test.ts +128 -0
  154. package/tests/tui.test.ts +67 -67
  155. package/tests/web.test.ts +169 -0
  156. package/tsconfig.json +38 -38
@@ -15,10 +15,10 @@ jobs:
15
15
  node-version: [18, 20, 22]
16
16
 
17
17
  steps:
18
- - uses: actions/checkout@v4
18
+ - uses: actions/checkout@v5
19
19
 
20
20
  - name: Use Node.js ${{ matrix.node-version }}
21
- uses: actions/setup-node@v4
21
+ uses: actions/setup-node@v5
22
22
  with:
23
23
  node-version: ${{ matrix.node-version }}
24
24
  cache: 'npm'
@@ -4,24 +4,71 @@ on:
4
4
  push:
5
5
  tags:
6
6
  - 'v*'
7
+ # Continuous delivery from master: every push runs the workflow, the
8
+ # version check below makes it a no-op unless package.json declares a
9
+ # version that is not yet on npm. Needed because some environments
10
+ # (remote agent sessions) can push branches but not tags, and the
11
+ # API token cannot dispatch workflows either.
12
+ branches:
13
+ - master
14
+ # Manual trigger: publishes whatever version master's package.json declares,
15
+ # then creates the matching v* tag. Needed because some environments (e.g.
16
+ # remote agent sessions) can push branches but not tags.
17
+ workflow_dispatch: {}
7
18
 
8
19
  permissions:
9
20
  id-token: write
10
- contents: read
21
+ contents: write
11
22
 
12
23
  jobs:
13
24
  publish:
14
25
  runs-on: ubuntu-latest
15
26
  permissions:
16
27
  id-token: write
28
+ contents: write
17
29
  steps:
18
- - uses: actions/checkout@v4
30
+ - uses: actions/checkout@v5
19
31
 
20
- - uses: actions/setup-node@v4
32
+ - uses: actions/setup-node@v5
21
33
  with:
22
34
  node-version: '20'
23
35
  registry-url: 'https://registry.npmjs.org'
24
36
 
37
+ # OIDC trusted publishing requires npm >= 11.5.1; Node 20 bundles npm 10,
38
+ # whose unauthenticated PUT is rejected by the registry with 404 — the
39
+ # reason every previous publish run (v1.14.8, v1.14.9) failed.
40
+ - run: npm install -g npm@^11.5.1
41
+ - run: npm --version
42
+
25
43
  - run: npm ci
26
44
  - run: npm run build
27
- - run: npm publish --access public
45
+
46
+ # Refuse to republish an existing version (idempotent dispatches).
47
+ - name: Skip if version already published
48
+ id: check
49
+ run: |
50
+ V=$(node -p "require('./package.json').version")
51
+ echo "version=$V" >> "$GITHUB_OUTPUT"
52
+ if npm view "skyloom@$V" version >/dev/null 2>&1; then
53
+ echo "already=true" >> "$GITHUB_OUTPUT"
54
+ echo "skyloom@$V already on npm — skipping publish"
55
+ else
56
+ echo "already=false" >> "$GITHUB_OUTPUT"
57
+ fi
58
+
59
+ - name: Publish
60
+ if: steps.check.outputs.already == 'false'
61
+ run: npm publish --access public
62
+
63
+ # When publishing from a branch (master push or manual dispatch), create
64
+ # the release tag the environment couldn't push. Tag pushes skip this.
65
+ - name: Tag release
66
+ if: github.ref_type == 'branch'
67
+ run: |
68
+ V="v${{ steps.check.outputs.version }}"
69
+ if git ls-remote --exit-code origin "refs/tags/$V" >/dev/null 2>&1; then
70
+ echo "$V already exists"
71
+ else
72
+ git tag "$V"
73
+ git push origin "$V"
74
+ fi
@@ -1,191 +1,191 @@
1
- # Skyloom Python → TypeScript 完整转换计划
2
-
3
- ## 已完成的核心模块(✅)
4
-
5
- ### 基础配置层
6
- - ✅ `constants.ts` - 所有常量定义(VALID_AGENTS, TASK_DONE_SENTINEL, etc)
7
- - ✅ `schemas.ts` - LLM 响应验证和数据结构(TaskPlanSchema, FactSchema)
8
- - ✅ `logger.ts` - 结构化日志系统(JSON lines format)
9
- - ✅ `config.ts` - 配置管理(YAML加载、合并、提供者目录)
10
-
11
- ### 工具和中间件层
12
- - ✅ `tool.ts` - 工具注册和执行框架(缓存、重试、参数验证)
13
- - ✅ `circuit_breaker.ts` - 熔断器模式(故障容错)
14
-
15
- ## 待转换的模块
16
-
17
- ### Phase 1: 核心基础设施(Core Infrastructure)
18
- - [ ] `memory.ts` - 三层内存系统(短期、工作、长期)+ SQLite 持久化
19
- - [ ] `cache.ts` - LLM 响应缓存
20
- - [ ] `middleware.ts` - 中间件链(前处理、后处理)
21
- - [ ] `bus.ts` - 事件总线系统
22
- - [ ] `pipelines.ts` - DAG 管道编排
23
-
24
- ### Phase 2: LLM 和 API 集成
25
- - [ ] `llm.ts` - LiteLLM 抽象(流式、重试、成本追踪)
26
- - [ ] `mcp.ts` - 模型上下文协议集成
27
- - [ ] `semantic.ts` - 语义搜索和嵌入
28
-
29
- ### Phase 3: Agent 核心
30
- - [ ] `agent.ts` - BaseAgent 类(message management, tool execution)
31
- - [ ] `factory.ts` - Agent 工厂模式
32
- - [ ] `router.ts` - 智能路由系统(direct/single/orchestrate 分类)
33
-
34
- ### Phase 4: 六个 Agent 实现
35
- - [ ] `agents/fog.ts` - 研究 Agent
36
- - [ ] `agents/rain.ts` - 代码生成 Agent
37
- - [ ] `agents/frost.ts` - 代码审查 Agent
38
- - [ ] `agents/snow.ts` - 编排 Agent
39
- - [ ] `agents/dew.ts` - DevOps Agent
40
- - [ ] `agents/fair.ts` - 情感陪伴 Agent
41
-
42
- ### Phase 5: 技能系统
43
- - [ ] `skill.ts` - 技能基类和注册表
44
- - [ ] `skills/loader.ts` - 技能动态加载
45
- - [ ] 40+ 内置技能转换
46
-
47
- ### Phase 6: 工具系统
48
- - [ ] `tools/builtin.ts` - 内置工具(文件、shell、HTTP、git)
49
- - [ ] `tools/delegate.ts` - MCP 工具委派
50
-
51
- ### Phase 7: CLI 和 Web
52
- - [ ] `cli/main.ts` - 命令行入口(Commander.js)
53
- - [ ] `cli/mode.ts` - 交互模式管理
54
- - [ ] CLI 子命令(chat, task, web, setup)
55
- - [ ] `web/server.ts` - Express/Fastify 服务器
56
- - [ ] `web/tts.ts` - 文字转语音集成
57
-
58
- ### Phase 8: 测试
59
- - [ ] 所有 52 个测试文件转换为 Vitest
60
-
61
- ## 转换规范
62
-
63
- ### 文件映射
64
-
65
- | Python | TypeScript | 备注 |
66
- |--------|-----------|-----|
67
- | `asyncio` | `Promise / async-await` | 原生支持 |
68
- | `dataclasses` | `interfaces + types` | TypeScript types |
69
- | `pathlib.Path` | `path` module | Node.js 标准 |
70
- | `aiosqlite` | `sqlite / sqlite3` | Node.js SQLite |
71
- | `typer` | `commander` | CLI 框架 |
72
- | `rich` | `chalk` + `enquirer` | TUI 输出 |
73
- | `pyyaml` | `yaml` npm package | YAML 处理 |
74
- | `litellm` | `openai` + providers | LLM SDK |
75
- | `httpx` | `axios` / `got` | HTTP 客户端 |
76
- | `pytest` | `vitest` | 测试框架 |
77
-
78
- ### 关键转换模式
79
-
80
- #### 1. Python Dataclass → TypeScript Interface + Class
81
- ```python
82
- @dataclass
83
- class Message:
84
- role: str
85
- content: str
86
- ```
87
-
88
- ```typescript
89
- interface Message {
90
- role: string;
91
- content: string;
92
- }
93
- ```
94
-
95
- #### 2. Python Dict/List 操作 → TypeScript Map/Set/Array
96
- ```python
97
- data: dict[str, list[str]] = {}
98
- ```
99
-
100
- ```typescript
101
- data: Map<string, string[]> = new Map();
102
- ```
103
-
104
- #### 3. Python 异步 → TypeScript Async/Await
105
- ```python
106
- async def fetch():
107
- result = await client.get()
108
- ```
109
-
110
- ```typescript
111
- async function fetch() {
112
- const result = await client.get();
113
- }
114
- ```
115
-
116
- #### 4. Python 类型提示 → TypeScript 类型注解
117
- ```python
118
- def execute(tool: str, params: dict) -> str:
119
- ```
120
-
121
- ```typescript
122
- function execute(tool: string, params: Record<string, unknown>): string
123
- ```
124
-
125
- ## 命名规范(保持一致)
126
-
127
- - Agent 名称:`fog`, `rain`, `frost`, `snow`, `dew`, `fair`(全部小写)
128
- - 文件名:camelCase(`agentFactory.ts` 而非 `agent_factory.ts`)
129
- - 变量名:camelCase(`maxRetries` 而非 `max_retries`)
130
- - 常量:UPPER_SNAKE_CASE(`DEFAULT_TOOL_TIMEOUT`)
131
- - 接口:PascalCase(`ToolRegistry`, `Message`, `AgentConfig`)
132
-
133
- ## 依赖管理
134
-
135
- ### 核心依赖映射
136
- | 功能 | Python | TypeScript |
137
- |------|--------|-----------|
138
- | CLI | typer | commander |
139
- | TUI | rich | chalk + enquirer + ora |
140
- | LLM | litellm | openai + axios |
141
- | Database | aiosqlite | sqlite / better-sqlite3 |
142
- | YAML | pyyaml | yaml |
143
- | HTTP | httpx | axios / got |
144
- | 测试 | pytest | vitest |
145
- | 类型检查 | mypy | typescript |
146
-
147
- ### 质量保证工具
148
- - **Linter**: eslint + @typescript-eslint
149
- - **格式化**: prettier
150
- - **类型**: TypeScript strict mode
151
- - **测试**: vitest + coverage
152
-
153
- ## 大小估计
154
-
155
- | 层级 | 文件数 | LOC | 转换难度 |
156
- |-----|--------|-----|---------|
157
- | Core | 8 | 2500 | ⭐⭐ |
158
- | Memory | 1 | 800 | ⭐⭐⭐ |
159
- | Agents | 7 | 2000 | ⭐⭐ |
160
- | Skills | 40+ | 8000 | ⭐ |
161
- | Tools | 2 | 2000 | ⭐⭐ |
162
- | CLI/Web | 10 | 3000 | ⭐⭐⭐ |
163
- | Tests | 52 | 10000 | ⭐⭐ |
164
- | **总计** | **120+** | **28000** | - |
165
-
166
- ## 质量检查清单
167
-
168
- - [ ] 所有 TypeScript 文件通过 tsc --noEmit
169
- - [ ] 所有文件通过 eslint
170
- - [ ] 100% 类型覆盖率(no `any` 除非必要)
171
- - [ ] 所有测试通过(npm test)
172
- - [ ] CLI 命令可执行(npm start)
173
- - [ ] Web 服务启动正常
174
- - [ ] 配置加载和合并正确
175
- - [ ] 内存系统持久化正确
176
- - [ ] Agent 通信链正常
177
- - [ ] 工具执行链正常
178
-
179
- ## 转换步骤
180
-
181
- 1. ✅ 基础配置(constants, schemas, logger, config)
182
- 2. ✅ 工具框架(tool, circuit_breaker)
183
- 3. ⏳ 转换其他核心模块(使用 agent 并行)
184
- 4. ⏳ 转换 Agent 系统
185
- 5. ⏳ 转换 CLI/Web 接口
186
- 6. ⏳ 转换所有测试
187
- 7. ⏳ 集成测试和优化
188
-
189
- ---
190
-
191
- **目标**: 完整的功能对等、无任何功能丢失、所有业务逻辑保持一致的 TypeScript 版本。
1
+ # Skyloom Python → TypeScript 完整转换计划
2
+
3
+ ## 已完成的核心模块(✅)
4
+
5
+ ### 基础配置层
6
+ - ✅ `constants.ts` - 所有常量定义(VALID_AGENTS, TASK_DONE_SENTINEL, etc)
7
+ - ✅ `schemas.ts` - LLM 响应验证和数据结构(TaskPlanSchema, FactSchema)
8
+ - ✅ `logger.ts` - 结构化日志系统(JSON lines format)
9
+ - ✅ `config.ts` - 配置管理(YAML加载、合并、提供者目录)
10
+
11
+ ### 工具和中间件层
12
+ - ✅ `tool.ts` - 工具注册和执行框架(缓存、重试、参数验证)
13
+ - ✅ `circuit_breaker.ts` - 熔断器模式(故障容错)
14
+
15
+ ## 待转换的模块
16
+
17
+ ### Phase 1: 核心基础设施(Core Infrastructure)
18
+ - [ ] `memory.ts` - 三层内存系统(短期、工作、长期)+ SQLite 持久化
19
+ - [ ] `cache.ts` - LLM 响应缓存
20
+ - [ ] `middleware.ts` - 中间件链(前处理、后处理)
21
+ - [ ] `bus.ts` - 事件总线系统
22
+ - [ ] `pipelines.ts` - DAG 管道编排
23
+
24
+ ### Phase 2: LLM 和 API 集成
25
+ - [ ] `llm.ts` - LiteLLM 抽象(流式、重试、成本追踪)
26
+ - [ ] `mcp.ts` - 模型上下文协议集成
27
+ - [ ] `semantic.ts` - 语义搜索和嵌入
28
+
29
+ ### Phase 3: Agent 核心
30
+ - [ ] `agent.ts` - BaseAgent 类(message management, tool execution)
31
+ - [ ] `factory.ts` - Agent 工厂模式
32
+ - [ ] `router.ts` - 智能路由系统(direct/single/orchestrate 分类)
33
+
34
+ ### Phase 4: 六个 Agent 实现
35
+ - [ ] `agents/fog.ts` - 研究 Agent
36
+ - [ ] `agents/rain.ts` - 代码生成 Agent
37
+ - [ ] `agents/frost.ts` - 代码审查 Agent
38
+ - [ ] `agents/snow.ts` - 编排 Agent
39
+ - [ ] `agents/dew.ts` - DevOps Agent
40
+ - [ ] `agents/fair.ts` - 情感陪伴 Agent
41
+
42
+ ### Phase 5: 技能系统
43
+ - [ ] `skill.ts` - 技能基类和注册表
44
+ - [ ] `skills/loader.ts` - 技能动态加载
45
+ - [ ] 40+ 内置技能转换
46
+
47
+ ### Phase 6: 工具系统
48
+ - [ ] `tools/builtin.ts` - 内置工具(文件、shell、HTTP、git)
49
+ - [ ] `tools/delegate.ts` - MCP 工具委派
50
+
51
+ ### Phase 7: CLI 和 Web
52
+ - [ ] `cli/main.ts` - 命令行入口(Commander.js)
53
+ - [ ] `cli/mode.ts` - 交互模式管理
54
+ - [ ] CLI 子命令(chat, task, web, setup)
55
+ - [ ] `web/server.ts` - Express/Fastify 服务器
56
+ - [ ] `web/tts.ts` - 文字转语音集成
57
+
58
+ ### Phase 8: 测试
59
+ - [ ] 所有 52 个测试文件转换为 Vitest
60
+
61
+ ## 转换规范
62
+
63
+ ### 文件映射
64
+
65
+ | Python | TypeScript | 备注 |
66
+ |--------|-----------|-----|
67
+ | `asyncio` | `Promise / async-await` | 原生支持 |
68
+ | `dataclasses` | `interfaces + types` | TypeScript types |
69
+ | `pathlib.Path` | `path` module | Node.js 标准 |
70
+ | `aiosqlite` | `sqlite / sqlite3` | Node.js SQLite |
71
+ | `typer` | `commander` | CLI 框架 |
72
+ | `rich` | `chalk` + `enquirer` | TUI 输出 |
73
+ | `pyyaml` | `yaml` npm package | YAML 处理 |
74
+ | `litellm` | `openai` + providers | LLM SDK |
75
+ | `httpx` | `axios` / `got` | HTTP 客户端 |
76
+ | `pytest` | `vitest` | 测试框架 |
77
+
78
+ ### 关键转换模式
79
+
80
+ #### 1. Python Dataclass → TypeScript Interface + Class
81
+ ```python
82
+ @dataclass
83
+ class Message:
84
+ role: str
85
+ content: str
86
+ ```
87
+
88
+ ```typescript
89
+ interface Message {
90
+ role: string;
91
+ content: string;
92
+ }
93
+ ```
94
+
95
+ #### 2. Python Dict/List 操作 → TypeScript Map/Set/Array
96
+ ```python
97
+ data: dict[str, list[str]] = {}
98
+ ```
99
+
100
+ ```typescript
101
+ data: Map<string, string[]> = new Map();
102
+ ```
103
+
104
+ #### 3. Python 异步 → TypeScript Async/Await
105
+ ```python
106
+ async def fetch():
107
+ result = await client.get()
108
+ ```
109
+
110
+ ```typescript
111
+ async function fetch() {
112
+ const result = await client.get();
113
+ }
114
+ ```
115
+
116
+ #### 4. Python 类型提示 → TypeScript 类型注解
117
+ ```python
118
+ def execute(tool: str, params: dict) -> str:
119
+ ```
120
+
121
+ ```typescript
122
+ function execute(tool: string, params: Record<string, unknown>): string
123
+ ```
124
+
125
+ ## 命名规范(保持一致)
126
+
127
+ - Agent 名称:`fog`, `rain`, `frost`, `snow`, `dew`, `fair`(全部小写)
128
+ - 文件名:camelCase(`agentFactory.ts` 而非 `agent_factory.ts`)
129
+ - 变量名:camelCase(`maxRetries` 而非 `max_retries`)
130
+ - 常量:UPPER_SNAKE_CASE(`DEFAULT_TOOL_TIMEOUT`)
131
+ - 接口:PascalCase(`ToolRegistry`, `Message`, `AgentConfig`)
132
+
133
+ ## 依赖管理
134
+
135
+ ### 核心依赖映射
136
+ | 功能 | Python | TypeScript |
137
+ |------|--------|-----------|
138
+ | CLI | typer | commander |
139
+ | TUI | rich | chalk + enquirer + ora |
140
+ | LLM | litellm | openai + axios |
141
+ | Database | aiosqlite | sqlite / better-sqlite3 |
142
+ | YAML | pyyaml | yaml |
143
+ | HTTP | httpx | axios / got |
144
+ | 测试 | pytest | vitest |
145
+ | 类型检查 | mypy | typescript |
146
+
147
+ ### 质量保证工具
148
+ - **Linter**: eslint + @typescript-eslint
149
+ - **格式化**: prettier
150
+ - **类型**: TypeScript strict mode
151
+ - **测试**: vitest + coverage
152
+
153
+ ## 大小估计
154
+
155
+ | 层级 | 文件数 | LOC | 转换难度 |
156
+ |-----|--------|-----|---------|
157
+ | Core | 8 | 2500 | ⭐⭐ |
158
+ | Memory | 1 | 800 | ⭐⭐⭐ |
159
+ | Agents | 7 | 2000 | ⭐⭐ |
160
+ | Skills | 40+ | 8000 | ⭐ |
161
+ | Tools | 2 | 2000 | ⭐⭐ |
162
+ | CLI/Web | 10 | 3000 | ⭐⭐⭐ |
163
+ | Tests | 52 | 10000 | ⭐⭐ |
164
+ | **总计** | **120+** | **28000** | - |
165
+
166
+ ## 质量检查清单
167
+
168
+ - [ ] 所有 TypeScript 文件通过 tsc --noEmit
169
+ - [ ] 所有文件通过 eslint
170
+ - [ ] 100% 类型覆盖率(no `any` 除非必要)
171
+ - [ ] 所有测试通过(npm test)
172
+ - [ ] CLI 命令可执行(npm start)
173
+ - [ ] Web 服务启动正常
174
+ - [ ] 配置加载和合并正确
175
+ - [ ] 内存系统持久化正确
176
+ - [ ] Agent 通信链正常
177
+ - [ ] 工具执行链正常
178
+
179
+ ## 转换步骤
180
+
181
+ 1. ✅ 基础配置(constants, schemas, logger, config)
182
+ 2. ✅ 工具框架(tool, circuit_breaker)
183
+ 3. ⏳ 转换其他核心模块(使用 agent 并行)
184
+ 4. ⏳ 转换 Agent 系统
185
+ 5. ⏳ 转换 CLI/Web 接口
186
+ 6. ⏳ 转换所有测试
187
+ 7. ⏳ 集成测试和优化
188
+
189
+ ---
190
+
191
+ **目标**: 完整的功能对等、无任何功能丢失、所有业务逻辑保持一致的 TypeScript 版本。
@@ -1,43 +1,46 @@
1
- # Skyloom default configuration
2
- llm:
3
- default_model: gpt-4o
4
- language: zh
5
- max_retries: 2
6
- temperature: 0.7
7
- max_tokens: 4096
8
-
9
- # Per-agent models inherit `llm.default_model` (or the user's wizard-chosen
10
- # top-level default_model) unless an agent sets its own `model:` here.
11
- agents:
12
- fog:
13
- temperature: 0.7
14
- rain:
15
- temperature: 0.7
16
- frost:
17
- temperature: 0.3
18
- snow:
19
- temperature: 0.5
20
- dew:
21
- temperature: 0.3
22
- fair:
23
- temperature: 0.9
24
-
25
- memory:
26
- db_path: ~/.skyloom/memory.db
27
- short_term_limit: 100
28
- max_persisted_messages: 2000
29
-
30
- workspace:
31
- path: auto
32
-
33
- cli:
34
- default_agent: fog
35
- approval_mode: interactive
36
-
37
- plugins:
38
- enabled: true
39
- directories:
40
- - ~/.skyloom/plugins
41
-
42
- mcp:
43
- servers: []
1
+ # Skyloom default configuration
2
+ llm:
3
+ default_model: gpt-4o
4
+ language: zh
5
+ max_retries: 2
6
+ temperature: 0.7
7
+ max_tokens: 4096
8
+ # Max tool calls a single LLM round runs in parallel. Bounds socket/FD/CPU
9
+ # use when the model requests many side-effecting tools at once. 1 = serial.
10
+ tool_concurrency: 4
11
+
12
+ # Per-agent models inherit `llm.default_model` (or the user's wizard-chosen
13
+ # top-level default_model) unless an agent sets its own `model:` here.
14
+ agents:
15
+ fog:
16
+ temperature: 0.7
17
+ rain:
18
+ temperature: 0.7
19
+ frost:
20
+ temperature: 0.3
21
+ snow:
22
+ temperature: 0.5
23
+ dew:
24
+ temperature: 0.3
25
+ fair:
26
+ temperature: 0.9
27
+
28
+ memory:
29
+ db_path: ~/.skyloom/memory.db
30
+ short_term_limit: 100
31
+ max_persisted_messages: 2000
32
+
33
+ workspace:
34
+ path: auto
35
+
36
+ cli:
37
+ default_agent: fog
38
+ approval_mode: interactive
39
+
40
+ plugins:
41
+ enabled: true
42
+ directories:
43
+ - ~/.skyloom/plugins
44
+
45
+ mcp:
46
+ servers: []