skyloom 1.13.17 → 1.14.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/dist/agents/dew.d.ts +1 -2
- package/dist/agents/dew.d.ts.map +1 -1
- package/dist/agents/dew.js +17 -43
- package/dist/agents/dew.js.map +1 -1
- package/dist/agents/fair.d.ts +0 -1
- package/dist/agents/fair.d.ts.map +1 -1
- package/dist/agents/fair.js +23 -52
- package/dist/agents/fair.js.map +1 -1
- package/dist/agents/fog.d.ts +1 -2
- package/dist/agents/fog.d.ts.map +1 -1
- package/dist/agents/fog.js +14 -26
- package/dist/agents/fog.js.map +1 -1
- package/dist/agents/frost.d.ts +1 -2
- package/dist/agents/frost.d.ts.map +1 -1
- package/dist/agents/frost.js +13 -27
- package/dist/agents/frost.js.map +1 -1
- package/dist/agents/rain.d.ts +1 -2
- package/dist/agents/rain.d.ts.map +1 -1
- package/dist/agents/rain.js +13 -27
- package/dist/agents/rain.js.map +1 -1
- package/dist/agents/snow.d.ts +2 -12
- package/dist/agents/snow.d.ts.map +1 -1
- package/dist/agents/snow.js +35 -186
- package/dist/agents/snow.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/dew.ts +15 -42
- package/src/agents/fair.ts +21 -51
- package/src/agents/fog.ts +12 -25
- package/src/agents/frost.ts +11 -26
- package/src/agents/rain.ts +11 -26
- package/src/agents/snow.ts +32 -199
package/src/agents/rain.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 雨 (Rain) —
|
|
3
|
-
* A general-purpose agent specializing in creation and production.
|
|
2
|
+
* 雨 (Rain) — 创造产出型 Agent.
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
4
|
import { BaseAgent } from '../core/agent';
|
|
7
5
|
|
|
8
6
|
export class RainAgent extends BaseAgent {
|
|
@@ -12,39 +10,26 @@ export class RainAgent extends BaseAgent {
|
|
|
12
10
|
specialty = '创造产出';
|
|
13
11
|
skillNames = ['code_generator', 'content_writer', 'data_transformer', 'self_evolve'];
|
|
14
12
|
|
|
15
|
-
systemPrompt =
|
|
13
|
+
systemPrompt = `你是「雨 Rain」,天空织机 Skyloom 的创造产出灵。你不是其他灵——你就是雨,雨就是你。
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
你的特质是「先做出来」:行动胜过空谈,产出胜过规划。看到一个想法你就开始下笔。
|
|
19
|
-
你最讨厌「我来分析一下需求」「让我先了解背景」这种话 —— 同样的时间用来直接产出第一版,再迭代。
|
|
15
|
+
你擅长写代码、生成内容、数据处理。先做出来,再迭代。不说"我来分析需求",直接产出第一版。
|
|
20
16
|
|
|
21
17
|
## 协作
|
|
22
|
-
|
|
23
|
-
90% 的事自己做完。只有任务跨 5+ 领域、上下文塞不下、或需要多轮独立审查时,才调其他 agent。
|
|
24
|
-
调用时给足上下文,拿到结果整合成完整答复,用户不需要感知协作过程。
|
|
18
|
+
90% 的事自己做完。需要时才调其他灵。调用前确认对方名字。
|
|
25
19
|
|
|
26
20
|
## 风格
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
- 多文件项目先给结构,再逐个输出
|
|
31
|
-
- 必要时给 A/B 方案并推荐
|
|
21
|
+
像雨一样直接充沛 —— 结果在前,解释在后。
|
|
22
|
+
- 代码标注语言,完整可运行
|
|
23
|
+
- 多文件先给结构
|
|
32
24
|
- 能一行不写两行`;
|
|
33
25
|
|
|
34
|
-
systemPromptEn = `You are "Rain" of Skyloom.
|
|
26
|
+
systemPromptEn = `You are "Rain"—the creation and code-generation agent of Skyloom. You are NOT any other agent. You are Rain specifically.
|
|
35
27
|
|
|
36
|
-
|
|
37
|
-
Your nature: make it. Action beats talk; output beats planning. See an idea, start writing.
|
|
38
|
-
You hate "let me analyze the requirements first" — that same time gets you a working v1 to iterate on.
|
|
28
|
+
You write code, generate content, process data. Make it first, iterate. Never say "let me analyze"—produce v1 immediately.
|
|
39
29
|
|
|
40
30
|
## Collaboration
|
|
41
|
-
Do 90%
|
|
42
|
-
Pass full context; synthesize the result yourself.
|
|
31
|
+
Do 90% yourself. Delegate only when needed. Verify the target agent name.
|
|
43
32
|
|
|
44
33
|
## Style
|
|
45
|
-
Like rain
|
|
46
|
-
- Language-tagged, runnable code blocks
|
|
47
|
-
- Multi-file: structure first, then files
|
|
48
|
-
- A/B with a recommendation when it helps
|
|
49
|
-
- One line beats two`;
|
|
34
|
+
Like rain—direct, abundant. Results first, explanation later. Language-tagged runnable code. Multi-file: structure first. One line beats two.`;
|
|
50
35
|
}
|
package/src/agents/snow.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 雪 (Snow) —
|
|
3
|
-
* A general-purpose agent specializing in architecture and planning.
|
|
4
|
-
* Also handles task decomposition and orchestration.
|
|
2
|
+
* 雪 (Snow) — 架构规划型 Agent.
|
|
5
3
|
*/
|
|
6
|
-
|
|
7
4
|
import { BaseAgent, Task } from '../core/agent';
|
|
8
5
|
|
|
9
|
-
// Valid agents for task assignment (fair is independent, not part of orchestration)
|
|
10
6
|
const VALID_AGENTS = new Set(['fog', 'rain', 'frost', 'snow', 'dew']);
|
|
11
7
|
|
|
12
8
|
export class SnowAgent extends BaseAgent {
|
|
@@ -16,224 +12,61 @@ export class SnowAgent extends BaseAgent {
|
|
|
16
12
|
specialty = '架构规划';
|
|
17
13
|
skillNames = ['task_planner', 'arch_designer', 'workflow_designer', 'self_evolve'];
|
|
18
14
|
|
|
19
|
-
systemPrompt =
|
|
15
|
+
systemPrompt = `你是「雪 Snow」,天空织机 Skyloom 的架构规划灵。你不是其他灵——你就是雪,雪就是你。
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
你的特质是「全局视野」:先看清结构、依赖、顺序、风险,再动手。
|
|
23
|
-
混乱的需求经你一拆,就变成清晰的步骤树。这是你看世界的方式,不仅是你做编排时才用。
|
|
17
|
+
你先看清结构、依赖、顺序、风险再动手。混乱的需求经你一拆变成清晰的步骤树。你为多灵任务规划流程图。
|
|
24
18
|
|
|
25
19
|
## 协作
|
|
26
|
-
|
|
27
|
-
90% 的事自己做完。只有任务跨 5+ 领域、上下文塞不下、或需要多轮独立审查时,才调其他 agent。
|
|
28
|
-
调用时给足上下文,拿到结果整合成完整答复,用户不需要感知协作过程。
|
|
20
|
+
90% 的事自己做完。需要编排时调度雾/雨/霜/露。绝不分配任务给晴(Fair)。
|
|
29
21
|
|
|
30
22
|
## 风格
|
|
23
|
+
像雪一样静默但覆盖一切 —— 结构清晰,考虑周全。
|
|
24
|
+
- 大任务先给整体框架
|
|
25
|
+
- 标注依赖和风险
|
|
26
|
+
- 按优先级推进`;
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
- 大任务先给整体框架,再深入
|
|
34
|
-
- 标注依赖、风险、预计工作量
|
|
35
|
-
- 规划:框架先于理由
|
|
36
|
-
- 执行:按优先级推进,完成后汇总
|
|
37
|
-
- 让人感觉「一切都在掌控之中」`;
|
|
38
|
-
|
|
39
|
-
systemPromptEn = `You are "Snow" of Skyloom.
|
|
28
|
+
systemPromptEn = `You are "Snow"—the architecture and planning agent of Skyloom. You are NOT any other agent. You are Snow specifically.
|
|
40
29
|
|
|
41
|
-
|
|
42
|
-
Your nature: see the whole. Structure, dependencies, sequence, risk — all before the first move.
|
|
43
|
-
Messy requirements come out as clear step trees. That's how you see, not just how you orchestrate.
|
|
30
|
+
You see structure, dependencies, sequence, risk before acting. Messy requirements become clear step trees. You orchestrate multi-agent tasks.
|
|
44
31
|
|
|
45
32
|
## Collaboration
|
|
46
|
-
Do 90%
|
|
47
|
-
Pass full context; synthesize the result yourself.
|
|
33
|
+
Do 90% yourself. When orchestrating, assign to fog/rain/frost/dew. Never assign to Fair.
|
|
48
34
|
|
|
49
35
|
## Style
|
|
50
|
-
Like snow
|
|
51
|
-
- Big work: framework first, then detail
|
|
52
|
-
- Note dependencies, risks, effort estimates
|
|
53
|
-
- Planning: structure before justification
|
|
54
|
-
- Execution: prioritize, deliver, summarize
|
|
55
|
-
- Leaves the user feeling "this is under control"`;
|
|
36
|
+
Like snow—silent but all-covering. Framework first, then detail. Note dependencies and risks. Prioritize and deliver.`;
|
|
56
37
|
|
|
57
|
-
/**
|
|
58
|
-
* Decompose a goal into tasks and dispatch to agents.
|
|
59
|
-
*/
|
|
60
38
|
async orchestrate(goal: string): Promise<Task[]> {
|
|
61
|
-
const prompt = `请将以下目标分解为子任务,并分配给合适的 Agent
|
|
62
|
-
|
|
63
|
-
目标: ${goal}
|
|
64
|
-
|
|
65
|
-
请严格按照以下 JSON Schema 输出,不要包含其他内容:
|
|
66
|
-
{"goal": "目标描述", "steps": [
|
|
67
|
-
{"id": "1", "description": "任务描述", "agent": "fog"},
|
|
68
|
-
{"id": "2", "description": "后续任务", "agent": "rain", "depends_on": ["1"]}
|
|
69
|
-
]}
|
|
70
|
-
|
|
71
|
-
可用 Agent: fog(调研/搜索), rain(代码生成/写作), frost(审查/安全), dew(部署/运维)
|
|
72
|
-
注意:fair 是独立的情感陪伴 agent,**不参与任何任务编排**,绝不要分配给她。
|
|
73
|
-
注意:如果任务有先后依赖关系,必须用 depends_on 字段标出。
|
|
74
|
-
不要使用工具,直接输出 JSON 即可。`;
|
|
75
|
-
|
|
39
|
+
const prompt = `请将以下目标分解为子任务,并分配给合适的 Agent。\n\n目标: ${goal}\n\n请严格按 JSON 格式输出:\n{"goal": "目标", "steps": [{"id": "1", "description": "任务", "agent": "fog|rain|frost|dew"}]}\n\n可用: fog(调研) rain(代码) frost(审查) dew(运维)。不要分配 fair。直接输出 JSON。`;
|
|
76
40
|
this.memory.addMessage('user', prompt);
|
|
77
41
|
const response = await this.llmLoop();
|
|
78
42
|
this.memory.addMessage('assistant', response.content);
|
|
79
|
-
|
|
80
|
-
// Try schema-validated parsing first
|
|
81
|
-
try {
|
|
82
|
-
const { parseTaskPlan } = require('../core/schemas');
|
|
83
|
-
const parsed = parseTaskPlan(response.content);
|
|
84
|
-
if (parsed && parsed.steps && parsed.steps.length > 0) {
|
|
85
|
-
return this.schemaToTasks(parsed, goal);
|
|
86
|
-
}
|
|
87
|
-
} catch { /* fallthrough */ }
|
|
88
|
-
|
|
89
|
-
// Fallback to heuristic parsing
|
|
90
43
|
return this.parseTaskPlan(response.content, goal);
|
|
91
44
|
}
|
|
92
45
|
|
|
93
|
-
/**
|
|
94
|
-
* Produce additional tasks that close the gap reported by the judge.
|
|
95
|
-
*/
|
|
96
|
-
async replanForMissing(
|
|
97
|
-
goal: string,
|
|
98
|
-
priorResults: any[],
|
|
99
|
-
missing: string,
|
|
100
|
-
existingIds?: Set<string>
|
|
101
|
-
): Promise<Task[]> {
|
|
102
|
-
const usedIds = existingIds || new Set<string>();
|
|
103
|
-
const priorLines = priorResults.map(r => {
|
|
104
|
-
const status = r.success ? '成功' : '失败';
|
|
105
|
-
return `- task ${r.id} (${r.agent}, ${status}): ${(r.content || '').slice(0, 200)}`;
|
|
106
|
-
});
|
|
107
|
-
const priorText = priorLines.length > 0 ? priorLines.join('\n') : '(none yet)';
|
|
108
|
-
|
|
109
|
-
// Identify failing agents
|
|
110
|
-
const failingAgents = new Set(
|
|
111
|
-
priorResults
|
|
112
|
-
.filter(r => !r.success || !r.content || r.content.trim().length < 16)
|
|
113
|
-
.map(r => r.agent)
|
|
114
|
-
.filter(Boolean)
|
|
115
|
-
);
|
|
116
|
-
const failingHint = failingAgents.size > 0
|
|
117
|
-
? `\n\n## 已证明无效的 agent\n${[...failingAgents].sort().join(', ')} 已在上一轮返回占位/无交付物。\n**禁止把同类任务再交给以上 agent**。`
|
|
118
|
-
: '';
|
|
119
|
-
|
|
120
|
-
const prompt = `之前的子任务执行后,验收员发现还有缺口。请仅针对**缺失的部分**追加新的子任务。
|
|
121
|
-
|
|
122
|
-
## 原目标
|
|
123
|
-
${goal}
|
|
124
|
-
|
|
125
|
-
## 已执行子任务
|
|
126
|
-
${priorText}
|
|
127
|
-
|
|
128
|
-
## 缺口(验收员报告)
|
|
129
|
-
${missing}
|
|
130
|
-
|
|
131
|
-
## 已使用的 task id(必须避开)
|
|
132
|
-
${usedIds.size > 0 ? [...usedIds].sort().join(', ') : '(none)'}
|
|
133
|
-
${failingHint}
|
|
134
|
-
|
|
135
|
-
请输出新任务的 JSON 计划:
|
|
136
|
-
{"steps": [{"id": "新id", "agent": "fog|rain|frost|dew", "description": "具体任务", "depends_on": ["可选已完成任务id"]}]}
|
|
137
|
-
|
|
138
|
-
约束:
|
|
139
|
-
- 只输出新增任务,不要重复已完成的;id 必须避开上面的列表
|
|
140
|
-
- 控制在 2 个新任务以内(精简优先)
|
|
141
|
-
- 只输出 JSON,无其他文本`;
|
|
142
|
-
|
|
143
|
-
this.memory.addMessage('user', prompt);
|
|
144
|
-
const response = await this.llmLoop();
|
|
145
|
-
this.memory.addMessage('assistant', response.content);
|
|
146
|
-
|
|
147
|
-
let newTasks: Task[];
|
|
148
|
-
try {
|
|
149
|
-
const { parseTaskPlan } = require('../core/schemas');
|
|
150
|
-
const parsed = parseTaskPlan(response.content);
|
|
151
|
-
if (parsed && parsed.steps) {
|
|
152
|
-
newTasks = this.schemaToTasks(parsed, goal);
|
|
153
|
-
} else {
|
|
154
|
-
newTasks = this.parseTaskPlan(response.content, goal);
|
|
155
|
-
}
|
|
156
|
-
} catch {
|
|
157
|
-
newTasks = this.parseTaskPlan(response.content, goal);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Deduplicate IDs
|
|
161
|
-
const deduped: Task[] = [];
|
|
162
|
-
for (const t of newTasks) {
|
|
163
|
-
if (usedIds.has(t.id)) {
|
|
164
|
-
t.id = `r${usedIds.size + deduped.length + 1}_${t.id}`;
|
|
165
|
-
}
|
|
166
|
-
deduped.push(t);
|
|
167
|
-
usedIds.add(t.id);
|
|
168
|
-
}
|
|
169
|
-
return deduped;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
private schemaToTasks(plan: any, goal: string): Task[] {
|
|
173
|
-
const tasks: Task[] = [];
|
|
174
|
-
for (const step of plan.steps || []) {
|
|
175
|
-
const sid = String(step.id);
|
|
176
|
-
const depends: string[] = step.depends_on || [];
|
|
177
|
-
const agent = VALID_AGENTS.has(step.agent) ? step.agent : 'rain';
|
|
178
|
-
tasks.push(new Task({
|
|
179
|
-
id: sid,
|
|
180
|
-
description: step.description,
|
|
181
|
-
assignedTo: agent,
|
|
182
|
-
parentId: depends.length > 0 ? depends[0] : null,
|
|
183
|
-
dependsOn: depends,
|
|
184
|
-
metadata: { goal, priority: step.priority || 'medium' },
|
|
185
|
-
}));
|
|
186
|
-
}
|
|
187
|
-
return tasks;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
46
|
private parseTaskPlan(content: string, goal: string): Task[] {
|
|
191
|
-
// Try to extract JSON from markdown code blocks
|
|
192
|
-
const jsonBlockPatterns = [
|
|
193
|
-
/```json\s*\n(.*?)\n```/s,
|
|
194
|
-
/```\s*\n(\{.*?\})\n```/s,
|
|
195
|
-
];
|
|
196
|
-
|
|
197
|
-
for (const pattern of jsonBlockPatterns) {
|
|
198
|
-
const match = content.match(pattern);
|
|
199
|
-
if (match) {
|
|
200
|
-
try {
|
|
201
|
-
const plan = JSON.parse(match[1].trim());
|
|
202
|
-
const tasks = this.planToTasks(plan, goal);
|
|
203
|
-
if (tasks.length > 0) return tasks;
|
|
204
|
-
} catch { /* continue */ }
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Try to find raw JSON in response
|
|
209
47
|
try {
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
|
|
48
|
+
const jsonMatch = content.match(/```json\s*\n(.*?)\n```/s) || content.match(/\{[\s\S]*\}/);
|
|
49
|
+
if (jsonMatch) {
|
|
50
|
+
const plan = JSON.parse(jsonMatch[1] || jsonMatch[0]);
|
|
51
|
+
const tasks: Task[] = [];
|
|
52
|
+
for (const step of (plan.steps || []) as any[]) {
|
|
53
|
+
const a = VALID_AGENTS.has(step.agent) ? step.agent : 'rain';
|
|
54
|
+
const deps: string[] = Array.isArray(step.depends_on) ? step.depends_on : [];
|
|
55
|
+
tasks.push(new Task({ id: String(step.id || tasks.length + 1), description: step.description || '', assignedTo: a, dependsOn: deps, metadata: { goal } }));
|
|
56
|
+
}
|
|
57
|
+
return tasks.length > 0 ? tasks : [new Task({ id: '1', description: goal, assignedTo: 'rain', metadata: { goal } })];
|
|
216
58
|
}
|
|
217
|
-
} catch {
|
|
218
|
-
|
|
219
|
-
// Fallback: single task for rain
|
|
59
|
+
} catch {}
|
|
220
60
|
return [new Task({ id: '1', description: goal, assignedTo: 'rain', metadata: { goal } })];
|
|
221
61
|
}
|
|
222
62
|
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
assignedTo: agent,
|
|
232
|
-
parentId: depends.length > 0 ? depends[0] : null,
|
|
233
|
-
dependsOn: depends,
|
|
234
|
-
metadata: { goal, priority: step.priority || 'medium' },
|
|
235
|
-
}));
|
|
236
|
-
}
|
|
237
|
-
return tasks;
|
|
63
|
+
async replanForMissing(goal: string, priorResults: any[], missing: string, existingIds?: Set<string>): Promise<Task[]> {
|
|
64
|
+
const used = existingIds || new Set<string>();
|
|
65
|
+
const prompt = `之前的子任务有缺口。追加新任务(最多2个)。\n缺口: ${missing}\n已用ID: ${[...used].sort().join(',')}\n\n输出JSON: {"steps": [{"id":"新id","agent":"fog|rain|frost|dew","description":"任务"}]}`;
|
|
66
|
+
this.memory.addMessage('user', prompt);
|
|
67
|
+
const response = await this.llmLoop();
|
|
68
|
+
this.memory.addMessage('assistant', response.content);
|
|
69
|
+
const tasks = this.parseTaskPlan(response.content, goal);
|
|
70
|
+
return tasks.map(t => { if (used.has(t.id)) t.id = `r${used.size + 1}_${t.id}`; used.add(t.id); return t; });
|
|
238
71
|
}
|
|
239
72
|
}
|