agency-orchestrator 0.5.1 → 0.5.2

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.en.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  **One sentence → full plan · 211 expert AI roles · Zero-code YAML · 10 LLM providers · 7 need no API key**
13
13
 
14
- > **Note:** `ao compose --run` auto-detects your language. For English input, it uses [agency-agents](https://github.com/msitarzewski/agency-agents) (170+ English roles). Use `ao init --lang en` to download the English role library. **6 English workflow templates** are ready in `workflows/en/` — more coming in v0.6.
14
+ > **Note:** `ao compose --run` auto-detects your language. Both 211 Chinese roles and 170+ English roles ([agency-agents](https://github.com/msitarzewski/agency-agents), MIT) are **bundled in the npm package no extra download needed**. **6 English workflow templates** are ready in `workflows/en/` — more coming in v0.6.
15
15
 
16
16
  > 📖 [Full Tutorial](https://dev.to/jnmetacode/agency-orchestrator-one-sentence-five-ai-agents-a-complete-plan-in-3-minutes-1ij6) — from install to real-world use in 10 minutes
17
17
 
@@ -217,8 +217,8 @@ All API providers support custom `base_url` and `api_key`, compatible with any O
217
217
 
218
218
  ```bash
219
219
  ao demo # Zero-config multi-agent demo
220
- ao init # Download 211 Chinese AI roles
221
- ao init --lang en # Download 170+ English AI roles
220
+ ao init # (Optional) Copy 211 Chinese roles locally for editing
221
+ ao init --lang en # (Optional) Copy 170+ English roles locally for editing
222
222
  ao init --workflow # Interactive workflow creator
223
223
  ao compose "description" # AI-powered workflow generation
224
224
  ao compose "description" --run # Generate AND execute in one command
package/README.md CHANGED
@@ -216,8 +216,8 @@ analyze ──→ tech_review ──→ summary
216
216
 
217
217
  ```bash
218
218
  ao demo # 零配置体验多智能体协作
219
- ao init # 下载 211 个中文 AI 角色
220
- ao init --lang en # 下载 170+ 个英文 AI 角色
219
+ ao init # (可选)复制 211 个中文角色到本地以便编辑
220
+ ao init --lang en # (可选)复制 170+ 个英文角色到本地以便编辑
221
221
  ao init --workflow # 交互式创建工作流
222
222
  ao compose "一句话描述" # AI 智能编排工作流
223
223
  ao compose "一句话描述" --run # 编排并立即执行
@@ -334,20 +334,52 @@ export async function composeWorkflow(options) {
334
334
  writeFileSync(savedPath, yaml + '\n', 'utf-8');
335
335
  const relativePath = relative(process.cwd(), savedPath);
336
336
  console.log(` Token 用量: 输入 ${result.usage.input_tokens}, 输出 ${result.usage.output_tokens}`);
337
- // 6. 校验生成的 YAML
337
+ // 6. 校验生成的 YAML(含角色路径真实性校验,防 LLM 幻觉)
338
338
  const warnings = [];
339
- try {
339
+ const validRolePaths = new Set(roles.map(r => r.path));
340
+ async function validateGenerated(path) {
340
341
  const { parseWorkflow, validateWorkflow } = await import('../core/parser.js');
341
- const workflow = parseWorkflow(savedPath);
342
- const errors = validateWorkflow(workflow);
343
- if (errors.length > 0) {
344
- for (const e of errors) {
345
- warnings.push(e);
342
+ const errors = [];
343
+ const invalidRoles = [];
344
+ try {
345
+ const workflow = parseWorkflow(path);
346
+ errors.push(...validateWorkflow(workflow));
347
+ for (const step of workflow.steps) {
348
+ if (step.role && !validRolePaths.has(step.role)) {
349
+ invalidRoles.push(step.role);
350
+ errors.push(`step "${step.id}" 的 role "${step.role}" 不存在于角色库中`);
351
+ }
346
352
  }
347
353
  }
354
+ catch (err) {
355
+ errors.push(`YAML 解析失败: ${err instanceof Error ? err.message : err}`);
356
+ }
357
+ return { errors, invalidRoles };
348
358
  }
349
- catch (err) {
350
- warnings.push(`YAML 解析失败: ${err instanceof Error ? err.message : err}`);
359
+ const first = await validateGenerated(savedPath);
360
+ // 发现幻觉角色 LLM 修一次
361
+ if (first.invalidRoles.length > 0) {
362
+ console.log(` 检测到 ${first.invalidRoles.length} 个不存在的角色,自动重新生成...`);
363
+ const retryPrompt = lang === 'en'
364
+ ? `The following role paths in your previous YAML do NOT exist in the catalog: ${first.invalidRoles.join(', ')}.\n\nRegenerate the FULL YAML. Use ONLY role paths from the catalog above. Do not invent new paths.`
365
+ : `你上次生成的 YAML 里有不存在的 role 路径:${first.invalidRoles.join('、')}。\n\n请重新生成完整 YAML,role 必须严格使用上方角色目录中列出的路径,不要编造。`;
366
+ try {
367
+ const retryResult = await connector.chat(systemPrompt, `${userPrompt}\n\n${retryPrompt}`, {
368
+ ...llmConfig,
369
+ max_tokens: llmConfig.max_tokens || 4096,
370
+ });
371
+ const retryYaml = extractYamlFromResponse(retryResult.content);
372
+ if (retryYaml && retryYaml.includes('steps:')) {
373
+ writeFileSync(savedPath, retryYaml + '\n', 'utf-8');
374
+ const second = await validateGenerated(savedPath);
375
+ warnings.push(...second.errors);
376
+ return { yaml: retryYaml, savedPath, relativePath, warnings };
377
+ }
378
+ }
379
+ catch (err) {
380
+ warnings.push(`自动修正失败(保留原始输出): ${err instanceof Error ? err.message : err}`);
381
+ }
351
382
  }
383
+ warnings.push(...first.errors);
352
384
  return { yaml, savedPath, relativePath, warnings };
353
385
  }
@@ -29,7 +29,7 @@ export class CLIBaseConnector {
29
29
  const args = useStdin
30
30
  ? (this.cfg.buildStdinArgs?.(config) ?? this.cfg.buildArgs('-', config))
31
31
  : this.cfg.buildArgs(fullPrompt, config);
32
- const timeout = config.timeout || 300_000; // 默认 5 分钟,effort=low 正常 1-3 分钟内响应
32
+ const timeout = config.timeout || 600_000; // 默认 10 分钟(gateway/MiniMax CLI provider 可能单步 5+ 分钟)
33
33
  return new Promise((resolve, reject) => {
34
34
  const child = spawn(this.cfg.command, args, {
35
35
  env: { ...process.env },
@@ -10,7 +10,7 @@ export async function executeDAG(dag, options) {
10
10
  const startTime = Date.now();
11
11
  const stepResults = [];
12
12
  const isCLI = llmConfig.provider.endsWith('-cli') || llmConfig.provider === 'claude-code';
13
- const timeout = llmConfig.timeout || (isCLI ? 300_000 : 120_000); // CLI 5分钟,API 2分钟
13
+ const timeout = llmConfig.timeout || (isCLI ? 600_000 : 120_000); // CLI 10分钟(gateway/MiniMax 等可能单步 5+ 分钟),API 2分钟
14
14
  const maxRetry = llmConfig.retry ?? 5;
15
15
  // CLI provider 强制串行:共享同一账户额度,并发会触发限速反而更慢
16
16
  const effectiveConcurrency = isCLI ? 1 : concurrency;
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Aider(开源 AI 编程终端工具)中直接运行多角色工作流,无需额外 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Antigravity 中直接运行多角色工作流,无需额外 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Claude Code 中直接运行多角色工作流,**无需 API key**。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 OpenAI Codex CLI 中直接运行多角色工作流,无需额外 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 GitHub Copilot(VS Code / JetBrains)中直接运行多角色工作流,无需额外 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Cursor 中使用多角色工作流,无需 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 DeerFlow(字节跳动开源 SuperAgent)中直接运行多角色工作流。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Gemini CLI 中直接运行多角色工作流,无需额外 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Kiro 中直接运行多角色工作流,无需 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 OpenClaw 中直接运行多角色工作流,无需 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 OpenCode(开源终端 AI 编程工具)中直接运行多角色工作流,无需额外 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Qwen Code(通义灵码 AI IDE 插件)中直接运行多角色工作流,无需额外 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Trae(字节跳动 AI IDE,国内最大的 AI 编程工具)中直接运行多角色工作流,无需 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  在 Windsurf(Codeium AI IDE)中直接运行多角色工作流,无需额外 API key。
4
4
 
5
+ > 🌐 **English users:** `npm install -g agency-orchestrator` — both 211 Chinese and 170+ English roles are bundled. Use `ao compose "your idea" --run` from CLI, or follow this guide for IDE-specific setup (translations coming in v0.6).
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-orchestrator",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Multi-agent YAML workflow engine — 211 AI roles, auto DAG parallelism, zero code. One sentence → multiple AI roles collaborate → complete plan in minutes. 10 LLM providers, 7 need no API key.",
5
5
  "keywords": [
6
6
  "multi-agent",
@@ -0,0 +1,103 @@
1
+ name: "小红书爆款笔记创作"
2
+ description: "一句话主题 → 策略分析 + 文案撰写 + SEO 标题 + 整合成稿"
3
+
4
+ agents_dir: "agency-agents-zh"
5
+
6
+ llm:
7
+ provider: "deepseek"
8
+ model: "deepseek-chat"
9
+ max_tokens: 4096
10
+ retry: 2
11
+
12
+ concurrency: 3
13
+
14
+ inputs:
15
+ - name: topic
16
+ description: "笔记主题(如:秋季穿搭技巧 / 职场新人避坑指南)"
17
+ required: true
18
+ - name: target_audience
19
+ description: "目标人群(如:25-35 岁女性白领,可选)"
20
+ required: false
21
+ default: "小红书主流用户(女性为主,关注生活方式)"
22
+
23
+ steps:
24
+ - id: strategy
25
+ role: "marketing/marketing-xiaohongshu-specialist"
26
+ name: "小红书策略师"
27
+ emoji: "📱"
28
+ task: |
29
+ 围绕主题「{{topic}}」做爆款策略分析,目标人群:{{target_audience}}。
30
+
31
+ 输出结构(300-400 字):
32
+ 1. **选题角度**:3 个具体的切入角度,每个说明爆款潜力
33
+ 2. **情绪钩子**:应该激发用户什么情绪(共鸣 / 焦虑 / 好奇 / 获得感)
34
+ 3. **内容骨架**:建议的内容结构(开头钩子→主体价值→结尾互动)
35
+ 4. **互动设计**:让用户评论/收藏的 1 个具体触发点
36
+ output: strategy
37
+
38
+ - id: copy
39
+ role: "marketing/marketing-content-creator"
40
+ name: "文案创作"
41
+ emoji: "✍️"
42
+ task: |
43
+ 根据策略写一篇小红书正文(500-700 字)。
44
+
45
+ 策略要点:
46
+ {{strategy}}
47
+
48
+ 正文要求:
49
+ - 开头 1 句话抓人(不要寒暄、不要自我介绍)
50
+ - 用"我"视角讲亲身经历或观察,真实感
51
+ - 分 3-5 个小节,每节有明确价值点
52
+ - 夹杂 emoji 让视觉轻盈(不要堆砌)
53
+ - 结尾 1 句引导评论/收藏
54
+ output: post_body
55
+ depends_on: [strategy]
56
+
57
+ - id: title
58
+ role: "marketing/marketing-baidu-seo-specialist"
59
+ name: "标题+标签专家"
60
+ emoji: "🎯"
61
+ task: |
62
+ 围绕主题「{{topic}}」和策略要点,产出:
63
+
64
+ 1. **5 个候选标题**(每个 ≤20 字):
65
+ - 至少 2 个带数字
66
+ - 至少 1 个带对比反差
67
+ - 至少 1 个带结果承诺
68
+ 2. **推荐标题**:从 5 个里选 1 个最可能爆的,说明理由
69
+ 3. **10 个话题标签**:按搜索量和相关性排序(#xxx 格式)
70
+
71
+ 参考策略:
72
+ {{strategy}}
73
+ output: title_and_tags
74
+ depends_on: [strategy]
75
+
76
+ - id: final
77
+ role: "marketing/marketing-content-creator"
78
+ name: "整合发稿"
79
+ emoji: "📝"
80
+ task: |
81
+ 把下面内容整合成一篇可以直接发布的小红书笔记。
82
+
83
+ 标题和标签:
84
+ {{title_and_tags}}
85
+
86
+ 正文:
87
+ {{post_body}}
88
+
89
+ 输出格式(严格按此结构):
90
+ ```
91
+ 【标题】:<选用推荐标题>
92
+
93
+ 【正文】:
94
+ <完整正文,可微调以适配标题>
95
+
96
+ 【话题标签】:
97
+ <10 个标签,每个前面加 #,用空格分隔>
98
+
99
+ 【发布建议】:
100
+ <2-3 行,包含建议发布时间、是否配图、评论区引导语>
101
+ ```
102
+ output: final_post
103
+ depends_on: [copy, title]