agency-orchestrator 0.3.0 → 0.3.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.
package/README.md CHANGED
@@ -160,7 +160,7 @@ analyze ──→ tech_review ──→ summary
160
160
  condition: "{{job_type}} contains technical"
161
161
 
162
162
  - id: biz_path
163
- role: "marketing/marketing-strategist"
163
+ role: "marketing/marketing-social-media-strategist"
164
164
  task: "Business evaluation: {{requirements}}"
165
165
  depends_on: [classify]
166
166
  condition: "{{job_type}} contains business"
@@ -176,12 +176,12 @@ Supported operators: `contains`, `equals`, `not_contains`, `not_equals`.
176
176
 
177
177
  ```yaml
178
178
  - id: write_draft
179
- role: "content/content-creator"
179
+ role: "marketing/marketing-content-creator"
180
180
  task: "Write article: {{topic}}"
181
181
  output: draft
182
182
 
183
183
  - id: brand_review
184
- role: "marketing/brand-guardian"
184
+ role: "design/design-brand-guardian"
185
185
  task: "Review brand compliance: {{draft}}"
186
186
  output: review_result
187
187
  depends_on: [write_draft]
@@ -34,7 +34,7 @@ function buildLayers(steps) {
34
34
  remaining.delete(s.id);
35
35
  for (const [id, depList] of deps) {
36
36
  if (depList.includes(s.id)) {
37
- inDegree.set(id, (inDegree.get(id) || 1) - 1);
37
+ inDegree.set(id, (inDegree.get(id) ?? 0) - 1);
38
38
  }
39
39
  }
40
40
  }
@@ -77,10 +77,12 @@ export function explainWorkflow(workflow) {
77
77
  for (const step of layer.steps) {
78
78
  const role = formatRole(step.role);
79
79
  // 取 task 的第一行作为摘要
80
- const taskSummary = (step.task || '').split('\n')[0].trim().slice(0, 60);
80
+ const firstLine = (step.task || '').split('\n')[0].trim();
81
+ const taskSummary = firstLine.slice(0, 60);
82
+ const truncated = firstLine.length > 60 || (step.task || '').includes('\n');
81
83
  lines.push(` • ${step.id} (${role})`);
82
84
  if (taskSummary) {
83
- lines.push(` ${taskSummary}${(step.task || '').length > 60 ? '...' : ''}`);
85
+ lines.push(` ${taskSummary}${truncated ? '...' : ''}`);
84
86
  }
85
87
  // 标注条件
86
88
  if (step.condition) {
@@ -96,7 +98,7 @@ export function explainWorkflow(workflow) {
96
98
  }
97
99
  // 汇总
98
100
  const totalSteps = workflow.steps.length;
99
- const maxParallel = Math.max(...layers.map(l => l.steps.length));
101
+ const maxParallel = layers.length > 0 ? Math.max(...layers.map(l => l.steps.length)) : 0;
100
102
  const hasLoop = workflow.steps.some(s => s.loop);
101
103
  const hasCondition = workflow.steps.some(s => s.condition);
102
104
  lines.push(`总计 ${totalSteps} 个步骤,${layers.length} 层执行,最大并行度 ${maxParallel}。`);
@@ -4,10 +4,14 @@
4
4
  import { createInterface } from 'readline';
5
5
  import { writeFileSync, mkdirSync, existsSync } from 'fs';
6
6
  import { resolve } from 'path';
7
+ /** Escape double quotes for YAML string values */
8
+ function yamlEscape(s) {
9
+ return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
10
+ }
7
11
  export function generateWorkflowYaml(opts) {
8
12
  const lines = [
9
- `name: "${opts.name}"`,
10
- `description: "${opts.description}"`,
13
+ `name: "${yamlEscape(opts.name)}"`,
14
+ `description: "${yamlEscape(opts.description)}"`,
11
15
  '',
12
16
  'agents_dir: "agency-agents-zh"',
13
17
  '',
@@ -21,22 +25,27 @@ export function generateWorkflowYaml(opts) {
21
25
  if (opts.hasInputs && opts.inputs.length > 0) {
22
26
  lines.push('', 'inputs:');
23
27
  for (const input of opts.inputs) {
24
- lines.push(` - name: ${input.name}`);
25
- lines.push(` description: "${input.description}"`);
28
+ lines.push(` - name: "${yamlEscape(input.name)}"`);
29
+ lines.push(` description: "${yamlEscape(input.description)}"`);
26
30
  lines.push(` required: ${input.required}`);
27
31
  }
28
32
  }
29
33
  lines.push('', 'steps:');
30
34
  for (let i = 0; i < opts.roles.length; i++) {
31
35
  const step = opts.roles[i];
32
- lines.push(` - id: ${step.id}`);
33
- lines.push(` role: "${step.role}"`);
34
- lines.push(` task: |`);
35
- // Indent task lines for YAML block scalar
36
- for (const taskLine of step.task.split('\n')) {
37
- lines.push(` ${taskLine}`);
36
+ lines.push(` - id: "${yamlEscape(step.id)}"`);
37
+ lines.push(` role: "${yamlEscape(step.role)}"`);
38
+ // 单行 task 用引号,多行用 block scalar
39
+ if (step.task.includes('\n')) {
40
+ lines.push(` task: |`);
41
+ for (const taskLine of step.task.split('\n')) {
42
+ lines.push(` ${taskLine}`);
43
+ }
44
+ }
45
+ else {
46
+ lines.push(` task: "${yamlEscape(step.task)}"`);
38
47
  }
39
- lines.push(` output: ${step.output}`);
48
+ lines.push(` output: "${yamlEscape(step.output)}"`);
40
49
  if (i > 0) {
41
50
  lines.push(` depends_on: [${opts.roles[i - 1].id}]`);
42
51
  }
package/dist/cli/watch.js CHANGED
@@ -6,7 +6,7 @@ const ICONS = {
6
6
  running: '🔄',
7
7
  done: '✅',
8
8
  error: '❌',
9
- skipped: '⏭️',
9
+ skipped: '',
10
10
  };
11
11
  /**
12
12
  * 创建 watch 渲染器,返回 ProgressCallback
@@ -50,7 +50,9 @@ export function createWatchRenderer(workflowName, stepIds, roles) {
50
50
  lines.push(line);
51
51
  }
52
52
  lines.push(`│${''.padEnd(boxWidth - 2)}│`);
53
- lines.push(`│ Progress: ${bar} ${completed}/${total} ${elapsed}s${''.padEnd(Math.max(0, boxWidth - 38 - elapsed.length))}│`);
53
+ const progressContent = `Progress: ${bar} ${completed}/${total} ${elapsed}s`;
54
+ const progressPad = Math.max(0, boxWidth - 4 - progressContent.length);
55
+ lines.push(`│ ${progressContent}${''.padEnd(progressPad)} │`);
54
56
  lines.push(`└${'─'.repeat(boxWidth - 2)}┘`);
55
57
  // 写到 stderr 避免与正常输出混合
56
58
  for (const line of lines) {
package/dist/cli.js CHANGED
@@ -47,7 +47,7 @@ async function main() {
47
47
  break;
48
48
  default: {
49
49
  // 容错:用户可能漏了空格,如 "planworkflows/x.yaml"
50
- const knownCmds = ['run', 'validate', 'plan', 'explain', 'roles'];
50
+ const knownCmds = ['run', 'validate', 'plan', 'explain', 'roles', 'init'];
51
51
  const match = knownCmds.find(c => command.startsWith(c) && command.length > c.length);
52
52
  if (match) {
53
53
  console.error(`看起来少了个空格?试试:\n ao ${match} ${command.slice(match.length)}\n`);
@@ -5,18 +5,25 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- # 1. 安装角色定义
8
+ # 1. 下载 186 个 AI 角色
9
9
  cd your-project
10
10
  git clone --depth 1 https://github.com/jnMetaCode/agency-agents-zh.git
11
11
 
12
- # 2. 将 AGENTS.md 复制到项目根目录
13
- cp integrations/antigravity/AGENTS.md AGENTS.md
12
+ # 2. 下载工作流模板和技能文件
13
+ git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp
14
+ cp -r .ao-tmp/workflows ./workflows
15
+ cp .ao-tmp/integrations/antigravity/AGENTS.md ./AGENTS.md
16
+ rm -rf .ao-tmp
17
+
18
+ # 3. 开始使用
19
+ # 在 Antigravity 中直接说:运行 workflows/story-creation.yaml
14
20
  ```
15
21
 
16
- 如果项目根目录已有 `AGENTS.md`,将内容追加:
22
+ 如果项目根目录已有 `AGENTS.md`,可将内容追加而非覆盖:
17
23
 
18
24
  ```bash
19
- cat integrations/antigravity/AGENTS.md >> AGENTS.md
25
+ # 替换上面第 2 步中的 cp 命令为:
26
+ cat .ao-tmp/integrations/antigravity/AGENTS.md >> ./AGENTS.md
20
27
  ```
21
28
 
22
29
  ## 使用方式
@@ -5,19 +5,26 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- # 1. 安装角色定义
8
+ # 1. 下载 186 个 AI 角色
9
9
  cd your-project
10
10
  git clone --depth 1 https://github.com/jnMetaCode/agency-agents-zh.git
11
11
 
12
- # 2. 复制 workflow-runner 指令到 .codex 目录
12
+ # 2. 下载工作流模板和技能文件
13
+ git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp
14
+ cp -r .ao-tmp/workflows ./workflows
13
15
  mkdir -p .codex
14
- cp integrations/codex/instructions.md .codex/instructions.md
16
+ cp .ao-tmp/integrations/codex/instructions.md .codex/instructions.md
17
+ rm -rf .ao-tmp
18
+
19
+ # 3. 开始使用
20
+ # 在 Codex CLI 中直接说:运行 workflows/story-creation.yaml
15
21
  ```
16
22
 
17
- 如果 `.codex/instructions.md` 已存在,将内容追加:
23
+ 如果 `.codex/instructions.md` 已存在,可将内容追加而非覆盖:
18
24
 
19
25
  ```bash
20
- cat integrations/codex/instructions.md >> .codex/instructions.md
26
+ # 替换上面第 2 步中的 cp 命令为:
27
+ cat .ao-tmp/integrations/codex/instructions.md >> .codex/instructions.md
21
28
  ```
22
29
 
23
30
  ## 使用方式
@@ -5,16 +5,19 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- # 1. 安装角色定义到项目
8
+ # 1. 下载 186 个 AI 角色
9
9
  cd your-project
10
10
  git clone --depth 1 https://github.com/jnMetaCode/agency-agents-zh.git
11
11
 
12
- # 2. 复制工作流模板
13
- git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp && cp -r .ao-tmp/workflows ./workflows && rm -rf .ao-tmp
14
-
15
- # 3. 添加工作流执行规则
12
+ # 2. 下载工作流模板和技能文件
13
+ git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp
14
+ cp -r .ao-tmp/workflows ./workflows
16
15
  mkdir -p .cursor/rules
17
- cp agency-orchestrator/integrations/cursor/workflow-runner.mdc .cursor/rules/
16
+ cp .ao-tmp/integrations/cursor/workflow-runner.mdc .cursor/rules/
17
+ rm -rf .ao-tmp
18
+
19
+ # 3. 开始使用
20
+ # 在 Cursor 中直接说:运行 workflows/story-creation.yaml
18
21
  ```
19
22
 
20
23
  ## 使用方式
@@ -87,11 +90,11 @@ ao run workflows/story-creation.yaml -i 'premise=时间旅行'
87
90
 
88
91
  ## 可用工作流
89
92
 
90
- | 工作流 | 说明 | 角色 |
93
+ | 工作流 | 文件 | 说明 |
91
94
  |--------|------|------|
92
- | `story-creation.yaml` | 短篇小说创作 | 叙事学家 → 心理学家 + 叙事设计师 → 内容创作者 |
93
- | `product-review.yaml` | 产品需求评审 | 产品经理 → 架构师 + UX 研究员 → 产品经理 |
94
- | `content-pipeline.yaml` | 内容创作流水线 | 策略师 → 创作者 + SEO → 编辑 |
95
+ | 短篇小说创作 | `story-creation.yaml` | 叙事学家 → 心理学家 + 叙事设计师 → 内容创作者 |
96
+ | 产品需求评审 | `product-review.yaml` | 产品经理 → 架构师 + UX 研究员 → 产品经理 |
97
+ | 内容流水线 | `content-pipeline.yaml` | 策略师 → 创作者 + SEO → 编辑 |
95
98
 
96
99
  ## 自定义
97
100
 
@@ -5,13 +5,19 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- # 1. 安装角色定义
8
+ # 1. 下载 186 个 AI 角色
9
9
  cd your-project
10
10
  git clone --depth 1 https://github.com/jnMetaCode/agency-agents-zh.git
11
11
 
12
- # 2. 将 SKILL.md 复制到 DeerFlow 的自定义技能目录
12
+ # 2. 下载工作流模板和技能文件
13
+ git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp
14
+ cp -r .ao-tmp/workflows ./workflows
13
15
  mkdir -p skills/custom/ao-workflow-runner
14
- cp integrations/deerflow/SKILL.md skills/custom/ao-workflow-runner/SKILL.md
16
+ cp .ao-tmp/integrations/deerflow/SKILL.md skills/custom/ao-workflow-runner/SKILL.md
17
+ rm -rf .ao-tmp
18
+
19
+ # 3. 开始使用
20
+ # 在 DeerFlow 中直接说:运行 workflows/story-creation.yaml
15
21
  ```
16
22
 
17
23
  ## 使用方式
@@ -5,18 +5,25 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- # 1. 安装角色定义
8
+ # 1. 下载 186 个 AI 角色
9
9
  cd your-project
10
10
  git clone --depth 1 https://github.com/jnMetaCode/agency-agents-zh.git
11
11
 
12
- # 2. 将 workflow-runner 指令追加到项目根目录的 GEMINI.md
13
- cat integrations/gemini-cli/GEMINI.md >> GEMINI.md
12
+ # 2. 下载工作流模板和技能文件
13
+ git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp
14
+ cp -r .ao-tmp/workflows ./workflows
15
+ cp .ao-tmp/integrations/gemini-cli/GEMINI.md ./GEMINI.md
16
+ rm -rf .ao-tmp
17
+
18
+ # 3. 开始使用
19
+ # 在 Gemini CLI 中直接说:运行 workflows/story-creation.yaml
14
20
  ```
15
21
 
16
- 如果项目根目录还没有 `GEMINI.md`,直接复制即可:
22
+ 如果项目根目录已有 `GEMINI.md`,可将内容追加而非覆盖:
17
23
 
18
24
  ```bash
19
- cp integrations/gemini-cli/GEMINI.md GEMINI.md
25
+ # 替换上面第 2 步中的 cp 命令为:
26
+ cat .ao-tmp/integrations/gemini-cli/GEMINI.md >> ./GEMINI.md
20
27
  ```
21
28
 
22
29
  ## 使用方式
@@ -5,16 +5,19 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- # 1. 安装角色定义到项目
8
+ # 1. 下载 186 个 AI 角色
9
9
  cd your-project
10
10
  git clone --depth 1 https://github.com/jnMetaCode/agency-agents-zh.git
11
11
 
12
- # 2. 复制工作流模板
13
- git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp && cp -r .ao-tmp/workflows ./workflows && rm -rf .ao-tmp
14
-
15
- # 3. 添加工作流执行规则
12
+ # 2. 下载工作流模板和技能文件
13
+ git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp
14
+ cp -r .ao-tmp/workflows ./workflows
16
15
  mkdir -p .kiro/steering
17
- cp agency-orchestrator/integrations/kiro/ao-workflow-runner.md .kiro/steering/
16
+ cp .ao-tmp/integrations/kiro/ao-workflow-runner.md .kiro/steering/
17
+ rm -rf .ao-tmp
18
+
19
+ # 3. 开始使用
20
+ # 在 Kiro 中直接说:运行 workflows/story-creation.yaml
18
21
  ```
19
22
 
20
23
  ## 使用方式
@@ -5,16 +5,19 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- # 1. 安装角色定义到项目
8
+ # 1. 下载 186 个 AI 角色
9
9
  cd your-project
10
10
  git clone --depth 1 https://github.com/jnMetaCode/agency-agents-zh.git
11
11
 
12
- # 2. 复制工作流模板
13
- git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp && cp -r .ao-tmp/workflows ./workflows && rm -rf .ao-tmp
14
-
15
- # 3. 添加工作流执行规则
12
+ # 2. 下载工作流模板和技能文件
13
+ git clone --depth 1 https://github.com/jnMetaCode/agency-orchestrator.git .ao-tmp
14
+ cp -r .ao-tmp/workflows ./workflows
16
15
  mkdir -p .trae/rules
17
- cp agency-orchestrator/integrations/trae/ao-workflow-runner.md .trae/rules/
16
+ cp .ao-tmp/integrations/trae/ao-workflow-runner.md .trae/rules/
17
+ rm -rf .ao-tmp
18
+
19
+ # 3. 开始使用
20
+ # 在 Trae 中直接说:运行 workflows/story-creation.yaml
18
21
  ```
19
22
 
20
23
  ## 使用方式
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-orchestrator",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Multi-agent workflow orchestrator — 186 ready-to-use AI roles, YAML-defined pipelines, auto DAG parallelism, zero code required",
5
5
  "keywords": [
6
6
  "multi-agent",