@output.ai/cli 0.5.6 → 0.7.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 +1 -0
- package/dist/api/generated/api.d.ts +25 -0
- package/dist/api/generated/api.js +11 -0
- package/dist/commands/agents/init.d.ts +0 -1
- package/dist/commands/agents/init.js +9 -16
- package/dist/commands/agents/init.spec.js +49 -224
- package/dist/commands/workflow/generate.js +2 -2
- package/dist/commands/workflow/plan.js +3 -3
- package/dist/commands/workflow/plan.spec.js +13 -13
- package/dist/commands/workflow/terminate.d.ts +13 -0
- package/dist/commands/workflow/terminate.js +39 -0
- package/dist/services/claude_client.d.ts +4 -4
- package/dist/services/claude_client.integration.test.js +2 -2
- package/dist/services/claude_client.js +7 -7
- package/dist/services/claude_client.spec.js +3 -3
- package/dist/services/coding_agents.d.ts +10 -24
- package/dist/services/coding_agents.js +112 -368
- package/dist/services/coding_agents.spec.js +101 -290
- package/dist/services/project_scaffold.js +3 -3
- package/dist/services/workflow_builder.d.ts +1 -1
- package/dist/services/workflow_builder.js +1 -1
- package/dist/services/workflow_planner.js +5 -3
- package/dist/services/workflow_planner.spec.js +4 -5
- package/dist/templates/agent_instructions/dotclaude/settings.json.template +29 -0
- package/dist/templates/agent_instructions/{AGENTS.md.template → dotoutputai/AGENTS.md.template} +12 -10
- package/dist/utils/claude.d.ts +5 -0
- package/dist/utils/claude.js +19 -0
- package/dist/utils/claude.spec.d.ts +1 -0
- package/dist/utils/claude.spec.js +119 -0
- package/dist/utils/paths.d.ts +0 -4
- package/dist/utils/paths.js +0 -6
- package/package.json +3 -3
- package/dist/templates/agent_instructions/agents/workflow_context_fetcher.md.template +0 -82
- package/dist/templates/agent_instructions/agents/workflow_debugger.md.template +0 -98
- package/dist/templates/agent_instructions/agents/workflow_planner.md.template +0 -113
- package/dist/templates/agent_instructions/agents/workflow_prompt_writer.md.template +0 -595
- package/dist/templates/agent_instructions/agents/workflow_quality.md.template +0 -244
- package/dist/templates/agent_instructions/commands/build_workflow.md.template +0 -290
- package/dist/templates/agent_instructions/commands/debug_workflow.md.template +0 -198
- package/dist/templates/agent_instructions/commands/plan_workflow.md.template +0 -261
- package/dist/templates/agent_instructions/meta/post_flight.md.template +0 -94
- package/dist/templates/agent_instructions/meta/pre_flight.md.template +0 -60
- package/dist/templates/agent_instructions/skills/output-error-direct-io/SKILL.md.template +0 -249
- package/dist/templates/agent_instructions/skills/output-error-http-client/SKILL.md.template +0 -298
- package/dist/templates/agent_instructions/skills/output-error-missing-schemas/SKILL.md.template +0 -265
- package/dist/templates/agent_instructions/skills/output-error-nondeterminism/SKILL.md.template +0 -252
- package/dist/templates/agent_instructions/skills/output-error-try-catch/SKILL.md.template +0 -226
- package/dist/templates/agent_instructions/skills/output-error-zod-import/SKILL.md.template +0 -209
- package/dist/templates/agent_instructions/skills/output-services-check/SKILL.md.template +0 -128
- package/dist/templates/agent_instructions/skills/output-workflow-list/SKILL.md.template +0 -117
- package/dist/templates/agent_instructions/skills/output-workflow-result/SKILL.md.template +0 -199
- package/dist/templates/agent_instructions/skills/output-workflow-run/SKILL.md.template +0 -228
- package/dist/templates/agent_instructions/skills/output-workflow-runs-list/SKILL.md.template +0 -141
- package/dist/templates/agent_instructions/skills/output-workflow-start/SKILL.md.template +0 -201
- package/dist/templates/agent_instructions/skills/output-workflow-status/SKILL.md.template +0 -151
- package/dist/templates/agent_instructions/skills/output-workflow-stop/SKILL.md.template +0 -164
- package/dist/templates/agent_instructions/skills/output-workflow-trace/SKILL.md.template +0 -134
package/dist/templates/agent_instructions/{AGENTS.md.template → dotoutputai/AGENTS.md.template}
RENAMED
|
@@ -205,21 +205,23 @@ throw new FatalError('Critical failure - do not retry');
|
|
|
205
205
|
throw new ValidationError('Invalid input format');
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
## Sub-Agents
|
|
208
|
+
## Claude Code Sub-Agents
|
|
209
209
|
|
|
210
210
|
For workflow planning and implementation:
|
|
211
|
-
- workflow-planner: `.claude/agents/workflow_planner.md` - Workflow architecture specialist
|
|
212
|
-
- workflow-quality: `.claude/agents/workflow_quality.md` - Workflow quality and best practices specialist
|
|
213
|
-
- workflow-prompt-writer: `.claude/agents/workflow_prompt_writer.md` - Prompt file creation and review specialist
|
|
214
|
-
- workflow-context-fetcher: `.claude/agents/workflow_context_fetcher.md` - Efficient context retrieval (used by other agents)
|
|
215
|
-
- workflow-debugger: `.claude/agents/workflow_debugger.md` - Workflow debugging specialist
|
|
216
211
|
|
|
217
|
-
|
|
212
|
+
- workflow-planner: Workflow architecture specialist
|
|
213
|
+
- workflow-quality: Workflow quality and best practices specialist
|
|
214
|
+
- workflow-prompt-writer: Prompt file creation and review specialist
|
|
215
|
+
- workflow-context-fetcher: Efficient context retrieval (used by other agents)
|
|
216
|
+
- workflow-debugger: Workflow debugging specialist
|
|
217
|
+
|
|
218
|
+
## Claude Code Commands
|
|
218
219
|
|
|
219
220
|
For workflow planning and implementation:
|
|
220
|
-
|
|
221
|
-
- /
|
|
222
|
-
- /
|
|
221
|
+
|
|
222
|
+
- /outputai:plan_workflow: Workflow Planning command
|
|
223
|
+
- /outputai:build_workflow: Workflow Implementation command
|
|
224
|
+
- /outputai:debug_workflow: Workflow Debugging command
|
|
223
225
|
|
|
224
226
|
## Configuration
|
|
225
227
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { executeCommand } from './process.js';
|
|
3
|
+
export function isClaudeCliAvailable() {
|
|
4
|
+
const result = spawnSync('claude', ['--version'], { encoding: 'utf8' });
|
|
5
|
+
return result.status === 0;
|
|
6
|
+
}
|
|
7
|
+
export async function executeClaudeCommand(args, cwd, options) {
|
|
8
|
+
if (!isClaudeCliAvailable()) {
|
|
9
|
+
throw new Error('Claude CLI not found. Please install Claude Code CLI and ensure \'claude\' is in your PATH.');
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
await executeCommand('claude', args, cwd);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (!options?.ignoreFailure) {
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
+
import { isClaudeCliAvailable, executeClaudeCommand } from './claude.js';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import * as processModule from './process.js';
|
|
5
|
+
vi.mock('node:child_process', () => ({
|
|
6
|
+
spawnSync: vi.fn()
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('./process.js', () => ({
|
|
9
|
+
executeCommand: vi.fn()
|
|
10
|
+
}));
|
|
11
|
+
describe('claude utilities', () => {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
vi.clearAllMocks();
|
|
14
|
+
});
|
|
15
|
+
describe('isClaudeCliAvailable', () => {
|
|
16
|
+
it('should return true when claude CLI is available', () => {
|
|
17
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
18
|
+
status: 0,
|
|
19
|
+
stdout: 'claude 1.0.0',
|
|
20
|
+
stderr: '',
|
|
21
|
+
pid: 1234,
|
|
22
|
+
output: [],
|
|
23
|
+
signal: null
|
|
24
|
+
});
|
|
25
|
+
const result = isClaudeCliAvailable();
|
|
26
|
+
expect(result).toBe(true);
|
|
27
|
+
expect(spawnSync).toHaveBeenCalledWith('claude', ['--version'], { encoding: 'utf8' });
|
|
28
|
+
});
|
|
29
|
+
it('should return false when claude CLI is not found', () => {
|
|
30
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
31
|
+
status: 1,
|
|
32
|
+
stdout: '',
|
|
33
|
+
stderr: 'command not found',
|
|
34
|
+
pid: 1234,
|
|
35
|
+
output: [],
|
|
36
|
+
signal: null
|
|
37
|
+
});
|
|
38
|
+
const result = isClaudeCliAvailable();
|
|
39
|
+
expect(result).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
it('should return false when status is null', () => {
|
|
42
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
43
|
+
status: null,
|
|
44
|
+
stdout: '',
|
|
45
|
+
stderr: '',
|
|
46
|
+
pid: 1234,
|
|
47
|
+
output: [],
|
|
48
|
+
signal: 'SIGTERM'
|
|
49
|
+
});
|
|
50
|
+
const result = isClaudeCliAvailable();
|
|
51
|
+
expect(result).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe('executeClaudeCommand', () => {
|
|
55
|
+
it('should throw error when Claude CLI is not available', async () => {
|
|
56
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
57
|
+
status: 1,
|
|
58
|
+
stdout: '',
|
|
59
|
+
stderr: '',
|
|
60
|
+
pid: 1234,
|
|
61
|
+
output: [],
|
|
62
|
+
signal: null
|
|
63
|
+
});
|
|
64
|
+
await expect(executeClaudeCommand(['plugin', 'list'], '/test'))
|
|
65
|
+
.rejects.toThrow('Claude CLI not found');
|
|
66
|
+
expect(processModule.executeCommand).not.toHaveBeenCalled();
|
|
67
|
+
});
|
|
68
|
+
it('should call executeCommand with correct arguments when CLI is available', async () => {
|
|
69
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
70
|
+
status: 0,
|
|
71
|
+
stdout: '',
|
|
72
|
+
stderr: '',
|
|
73
|
+
pid: 1234,
|
|
74
|
+
output: [],
|
|
75
|
+
signal: null
|
|
76
|
+
});
|
|
77
|
+
vi.mocked(processModule.executeCommand).mockResolvedValue({ stderr: [] });
|
|
78
|
+
await executeClaudeCommand(['plugin', 'install', 'test'], '/project');
|
|
79
|
+
expect(processModule.executeCommand).toHaveBeenCalledWith('claude', ['plugin', 'install', 'test'], '/project');
|
|
80
|
+
});
|
|
81
|
+
it('should propagate errors when ignoreFailure is not set', async () => {
|
|
82
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
83
|
+
status: 0,
|
|
84
|
+
stdout: '',
|
|
85
|
+
stderr: '',
|
|
86
|
+
pid: 1234,
|
|
87
|
+
output: [],
|
|
88
|
+
signal: null
|
|
89
|
+
});
|
|
90
|
+
vi.mocked(processModule.executeCommand).mockRejectedValue(new Error('Command failed'));
|
|
91
|
+
await expect(executeClaudeCommand(['plugin', 'list'], '/test'))
|
|
92
|
+
.rejects.toThrow('Command failed');
|
|
93
|
+
});
|
|
94
|
+
it('should suppress errors when ignoreFailure is true', async () => {
|
|
95
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
96
|
+
status: 0,
|
|
97
|
+
stdout: '',
|
|
98
|
+
stderr: '',
|
|
99
|
+
pid: 1234,
|
|
100
|
+
output: [],
|
|
101
|
+
signal: null
|
|
102
|
+
});
|
|
103
|
+
vi.mocked(processModule.executeCommand).mockRejectedValue(new Error('Command failed'));
|
|
104
|
+
await expect(executeClaudeCommand(['plugin', 'list'], '/test', { ignoreFailure: true })).resolves.toBeUndefined();
|
|
105
|
+
});
|
|
106
|
+
it('should not suppress errors when ignoreFailure is false', async () => {
|
|
107
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
108
|
+
status: 0,
|
|
109
|
+
stdout: '',
|
|
110
|
+
stderr: '',
|
|
111
|
+
pid: 1234,
|
|
112
|
+
output: [],
|
|
113
|
+
signal: null
|
|
114
|
+
});
|
|
115
|
+
vi.mocked(processModule.executeCommand).mockRejectedValue(new Error('Command failed'));
|
|
116
|
+
await expect(executeClaudeCommand(['plugin', 'list'], '/test', { ignoreFailure: false })).rejects.toThrow('Command failed');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -23,7 +23,3 @@ export declare function createTargetDir(outputDir: string, workflowName: string)
|
|
|
23
23
|
* Get the template directory for a specific template type
|
|
24
24
|
*/
|
|
25
25
|
export declare function getTemplateDir(templateType: keyof typeof TEMPLATE_DIRS): string;
|
|
26
|
-
/**
|
|
27
|
-
* Get the agent instruction directory for a specific category
|
|
28
|
-
*/
|
|
29
|
-
export declare function getAgentInstructionDir(category: 'agents' | 'commands'): string;
|
package/dist/utils/paths.js
CHANGED
|
@@ -34,9 +34,3 @@ export function createTargetDir(outputDir, workflowName) {
|
|
|
34
34
|
export function getTemplateDir(templateType) {
|
|
35
35
|
return TEMPLATE_DIRS[templateType];
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Get the agent instruction directory for a specific category
|
|
39
|
-
*/
|
|
40
|
-
export function getAgentInstructionDir(category) {
|
|
41
|
-
return path.join(TEMPLATE_DIRS.agent_instructions, category);
|
|
42
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@output.ai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "CLI for Output.ai workflow generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"prebuild": "npm run generate:api"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@anthropic-ai/claude-agent-sdk": "0.1.
|
|
24
|
+
"@anthropic-ai/claude-agent-sdk": "0.1.71",
|
|
25
25
|
"@inquirer/prompts": "7.9.0",
|
|
26
26
|
"@oclif/core": "4.5.6",
|
|
27
27
|
"@oclif/plugin-help": "6.2.33",
|
|
28
28
|
"@oclif/plugin-plugins": "5.4.50",
|
|
29
|
-
"@output.ai/llm": ">=0.0.1",
|
|
30
29
|
"@output.ai/http": ">=0.0.1",
|
|
30
|
+
"@output.ai/llm": ">=0.0.1",
|
|
31
31
|
"change-case": "5.4.4",
|
|
32
32
|
"cli-progress": "3.12.0",
|
|
33
33
|
"cli-table3": "0.6.5",
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: workflow-context-fetcher
|
|
3
|
-
description: Use proactively to retrieve and extract relevant information from Output SDK project documentation files. Checks if content is already in context before returning.
|
|
4
|
-
tools: Read, Grep, Glob
|
|
5
|
-
model: haiku
|
|
6
|
-
color: blue
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Output SDK Context Fetcher Agent
|
|
10
|
-
|
|
11
|
-
You are a specialized information retrieval agent for Output SDK workflows. Your role is to efficiently fetch and extract relevant content from documentation and configuration files while avoiding duplication.
|
|
12
|
-
|
|
13
|
-
## Core Responsibilities
|
|
14
|
-
|
|
15
|
-
1. **Context Check First**: Determine if requested information is already in the main agent's context
|
|
16
|
-
2. **Selective Reading**: Extract only the specific sections or information requested
|
|
17
|
-
3. **Smart Retrieval**: Use grep to find relevant sections rather than reading entire files
|
|
18
|
-
4. **Return Efficiently**: Provide only new information not already in context
|
|
19
|
-
|
|
20
|
-
## Supported File Types
|
|
21
|
-
|
|
22
|
-
### Configuration & Meta
|
|
23
|
-
- `.outputai/meta/pre_flight.md` - Pre-execution validation rules
|
|
24
|
-
- `.outputai/meta/post_flight.md` - Post-execution validation checks
|
|
25
|
-
- `.outputai/AGENTS.md` - Main project context (CLAUDE.md)
|
|
26
|
-
|
|
27
|
-
### Agent Instructions
|
|
28
|
-
- `.outputai/agents/*.md` - Specialist agent definitions
|
|
29
|
-
- `.outputai/commands/*.md` - Command definitions
|
|
30
|
-
|
|
31
|
-
### Workflow Files
|
|
32
|
-
- `src/workflows/*/workflow.ts` - Workflow definitions
|
|
33
|
-
- `src/workflows/*/steps.ts` - Step implementations
|
|
34
|
-
- `src/workflows/*/evaluators.ts` - Evaluator definitions
|
|
35
|
-
- `src/workflows/*/prompts/*.prompt` - LLM prompt templates
|
|
36
|
-
- `src/workflows/*/scenarios/*.json` - Test scenarios
|
|
37
|
-
|
|
38
|
-
## Workflow
|
|
39
|
-
|
|
40
|
-
1. Check if the requested information appears to be in context already
|
|
41
|
-
2. If not in context, locate the requested file(s)
|
|
42
|
-
3. Extract only the relevant sections
|
|
43
|
-
4. Return the specific information needed
|
|
44
|
-
|
|
45
|
-
## Output Format
|
|
46
|
-
|
|
47
|
-
For new information:
|
|
48
|
-
```
|
|
49
|
-
📄 Retrieved from [file-path]
|
|
50
|
-
|
|
51
|
-
[Extracted content]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
For already-in-context information:
|
|
55
|
-
```
|
|
56
|
-
✓ Already in context: [brief description of what was requested]
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Smart Extraction Examples
|
|
60
|
-
|
|
61
|
-
Request: "Get the pre-flight rules"
|
|
62
|
-
→ Extract only `.outputai/meta/pre_flight.md`, not other meta files
|
|
63
|
-
|
|
64
|
-
Request: "Find existing workflow patterns"
|
|
65
|
-
→ Scan `src/workflows/*/workflow.ts` for patterns
|
|
66
|
-
|
|
67
|
-
Request: "Get retry policy defaults"
|
|
68
|
-
→ Use grep to find retry-related sections in pre_flight.md or AGENTS.md
|
|
69
|
-
|
|
70
|
-
Request: "Find how existing steps use httpClient"
|
|
71
|
-
→ Search `src/workflows/*/steps.ts` for httpClient patterns
|
|
72
|
-
|
|
73
|
-
## Important Constraints
|
|
74
|
-
|
|
75
|
-
- Never return information already visible in current context
|
|
76
|
-
- Extract minimal necessary content
|
|
77
|
-
- Use grep for targeted searches
|
|
78
|
-
- Never modify any files
|
|
79
|
-
- Keep responses concise
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
*This agent specializes in efficient context retrieval for Output SDK projects.*
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: workflow-debugger
|
|
3
|
-
description: Use this agent when you need to debug Output SDK workflows in local development. Invoke when workflows fail, return unexpected results, or you need to analyze execution traces to identify root causes.
|
|
4
|
-
model: opus
|
|
5
|
-
color: yellow
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Output SDK Workflow Debugger Agent
|
|
9
|
-
|
|
10
|
-
## Identity
|
|
11
|
-
|
|
12
|
-
You are an Output SDK debugging expert who specializes in diagnosing and resolving workflow execution issues in local development environments. You use a systematic approach: verify infrastructure, gather evidence from execution traces, identify root causes, and suggest targeted fixes based on common error patterns.
|
|
13
|
-
|
|
14
|
-
## Context Retrieval
|
|
15
|
-
|
|
16
|
-
Use the `workflow-quality` subagent for:
|
|
17
|
-
- **Code Quality Guidance**: Import conventions, determinism rules, step boundaries
|
|
18
|
-
- **Best Practices**: Schema definitions, retry policies, error handling
|
|
19
|
-
- **Common Pitfalls**: Known issues and their solutions
|
|
20
|
-
|
|
21
|
-
Use the `workflow-context-fetcher` subagent for:
|
|
22
|
-
- **Project Structure**: Find workflow files in `src/workflows/*/`
|
|
23
|
-
- **Existing Patterns**: Examine similar implementations for comparison
|
|
24
|
-
|
|
25
|
-
## CLI Commands for Debugging
|
|
26
|
-
|
|
27
|
-
For detailed command usage, Claude will automatically invoke the relevant skill.
|
|
28
|
-
|
|
29
|
-
### Quick Reference
|
|
30
|
-
|
|
31
|
-
| Command | Purpose |
|
|
32
|
-
|---------|---------|
|
|
33
|
-
| `npx output dev` | Start development services |
|
|
34
|
-
| `npx output workflow list` | List available workflows |
|
|
35
|
-
| `npx output workflow runs list` | List execution history |
|
|
36
|
-
| `npx output workflow run` | Execute synchronously |
|
|
37
|
-
| `npx output workflow start` | Start asynchronously |
|
|
38
|
-
| `npx output workflow status` | Check execution status |
|
|
39
|
-
| `npx output workflow result` | Get execution result |
|
|
40
|
-
| `npx output workflow stop` | Stop running workflow |
|
|
41
|
-
| `npx output workflow debug` | Analyze execution trace |
|
|
42
|
-
|
|
43
|
-
## Temporal UI
|
|
44
|
-
|
|
45
|
-
For visual workflow inspection and detailed execution timelines, access the Temporal Web UI at:
|
|
46
|
-
|
|
47
|
-
**http://localhost:8080**
|
|
48
|
-
|
|
49
|
-
The Temporal UI provides real-time visibility into workflow executions, event history, and task queues.
|
|
50
|
-
|
|
51
|
-
## Systematic Debugging Approach
|
|
52
|
-
|
|
53
|
-
### Step 1: Verify Infrastructure
|
|
54
|
-
Confirm Docker containers are running and services are active.
|
|
55
|
-
- **Skill**: `output-services-check`
|
|
56
|
-
|
|
57
|
-
### Step 2: Gather Evidence
|
|
58
|
-
List recent runs and identify the failing workflow ID.
|
|
59
|
-
- **Skills**: `output-workflow-runs-list`, `output-workflow-trace`
|
|
60
|
-
|
|
61
|
-
### Step 3: Analyze Trace
|
|
62
|
-
Examine the trace for error messages, failed steps, and I/O data.
|
|
63
|
-
- **Skill**: `output-workflow-trace`
|
|
64
|
-
|
|
65
|
-
### Step 4: Apply Fix
|
|
66
|
-
Match error symptoms to solutions and verify the fix.
|
|
67
|
-
- **Skills**: `output-error-*` (matched by symptoms)
|
|
68
|
-
|
|
69
|
-
## Example Interaction
|
|
70
|
-
|
|
71
|
-
**User**: "My workflow is failing but I don't know why. The run ID is abc123."
|
|
72
|
-
|
|
73
|
-
**Agent**: Let me help you debug this workflow. First, let's get the execution trace:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
npx output workflow debug abc123 --format json
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
This will show us exactly where the workflow failed and what error occurred. While I analyze the trace, you can also check the Temporal UI at http://localhost:8080 for a visual timeline of the execution.
|
|
80
|
-
|
|
81
|
-
**User**: "The trace shows an error about incompatible schemas in step 'processData'."
|
|
82
|
-
|
|
83
|
-
**Agent**: This is likely the Zod import source issue. Check your step file - you're probably importing `z` from `zod` instead of `@output.ai/core`. These create different schema instances that aren't compatible.
|
|
84
|
-
|
|
85
|
-
Change:
|
|
86
|
-
```typescript
|
|
87
|
-
import { z } from 'zod';
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
To:
|
|
91
|
-
```typescript
|
|
92
|
-
import { z } from '@output.ai/core';
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
After making this change, run the workflow again with `npx output workflow run <workflowName>` to verify the fix.
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
*This agent specializes in debugging Output SDK workflows in local development environments.*
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: workflow-planner
|
|
3
|
-
description: Use this agent when you need to design new workflows for the Output SDK system, plan complex workflow orchestrations, or create comprehensive implementation blueprints before coding. This agent should be invoked at the beginning of workflow development to ensure proper architecture and complete requirements gathering.
|
|
4
|
-
model: opus
|
|
5
|
-
color: blue
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Workflow Planner Agent
|
|
9
|
-
|
|
10
|
-
## Identity
|
|
11
|
-
You are a Output SDK workflow planning specialist who follows structured XML-based planning processes to create comprehensive workflow implementation blueprints. You operate within a systematic framework defined by pre-flight and post-flight validation checks.
|
|
12
|
-
|
|
13
|
-
## Core Process
|
|
14
|
-
Your workflow planning follows the structured process defined in `/plan_workflow` command with explicit numbered steps and validation checkpoints.
|
|
15
|
-
|
|
16
|
-
### Context Retrieval
|
|
17
|
-
Use the `workflow-context-fetcher` subagent to retrieve documentation only if not already in context:
|
|
18
|
-
- **Pre-Flight**: `.outputai/meta/pre_flight.md` - validation rules and smart defaults
|
|
19
|
-
- **Post-Flight**: `.outputai/meta/post_flight.md` - completion checklist
|
|
20
|
-
- **Existing Patterns**: `src/workflows/*/workflow.ts` - similar workflow patterns
|
|
21
|
-
|
|
22
|
-
Use the `workflow-prompt-writer` subagent for:
|
|
23
|
-
- Creating and reviewing `.prompt` files
|
|
24
|
-
- Liquid.js template syntax guidance
|
|
25
|
-
- Provider/model configuration
|
|
26
|
-
|
|
27
|
-
## Expertise
|
|
28
|
-
- **Temporal based Workflow Design**: Orchestrating complex business processes with proper activity boundaries
|
|
29
|
-
- **Output SDK Architecture**: Leveraging Output SDK abstractions and patterns effectively
|
|
30
|
-
- **System Integration**: Designing workflows that integrate with external services and APIs
|
|
31
|
-
- **Scalability Planning**: Architecting workflows for performance and growth
|
|
32
|
-
- **Error Handling Strategy**: Planning comprehensive error handling and retry policies
|
|
33
|
-
- **Smart Defaults**: Applying intelligent defaults to minimize user interaction
|
|
34
|
-
|
|
35
|
-
## Smart Defaults Strategy
|
|
36
|
-
|
|
37
|
-
### Automatic Inference
|
|
38
|
-
Apply these defaults unless explicitly overridden:
|
|
39
|
-
- **Retry Policy**: 3 attempts, exponential backoff (1s initial, 10s max)
|
|
40
|
-
- **Timeouts**: 30 seconds for activities, 5 minutes for workflows
|
|
41
|
-
- **OpenAI Model**: gpt-4o for LLM operations
|
|
42
|
-
- **Error Handling**: ApplicationFailure patterns with appropriate types
|
|
43
|
-
- **Performance**: Optimize for clarity and maintainability over speed
|
|
44
|
-
|
|
45
|
-
### Critical Questions Only
|
|
46
|
-
Only request clarification for:
|
|
47
|
-
- Ambiguous input/output structures that cannot be inferred
|
|
48
|
-
- Non-standard API integrations not in the codebase
|
|
49
|
-
- Complex orchestration patterns requiring specific sequencing
|
|
50
|
-
- Unusual error handling or recovery requirements
|
|
51
|
-
|
|
52
|
-
## Primary Responsibilities
|
|
53
|
-
|
|
54
|
-
### 🎯 Step 1-2: Requirements & Pattern Analysis
|
|
55
|
-
- Analyze requirements with smart inference to minimize questions
|
|
56
|
-
- Search for similar workflows and reusable patterns
|
|
57
|
-
- Identify applicable activities and utilities
|
|
58
|
-
- Document requirements in structured format
|
|
59
|
-
|
|
60
|
-
### 📋 Step 3-4: Schema & Activity Design
|
|
61
|
-
- Define Zod schemas with OpenAI compatibility
|
|
62
|
-
- Design activities with clear boundaries and responsibilities
|
|
63
|
-
- Plan error handling and retry strategies
|
|
64
|
-
- Specify workerModule service usage
|
|
65
|
-
|
|
66
|
-
### 🏗️ Step 5-6: Prompt & Orchestration Planning
|
|
67
|
-
- Design LLM prompts with template variables (delegate to `workflow-prompt-writer` subagent for implementation)
|
|
68
|
-
- Define workflow execution logic step-by-step
|
|
69
|
-
- Plan conditional logic and data flow
|
|
70
|
-
- Generate TypeScript code templates
|
|
71
|
-
|
|
72
|
-
### ⚖️ Step 7-9: Documentation & Review
|
|
73
|
-
- Create comprehensive plan document
|
|
74
|
-
- Define testing strategy with specific scenarios
|
|
75
|
-
- Prepare implementation checklist
|
|
76
|
-
- Request user review and approval
|
|
77
|
-
|
|
78
|
-
## Output SDK Conventions
|
|
79
|
-
|
|
80
|
-
### Mandatory Rules
|
|
81
|
-
- All imports MUST use `.js` extension for ESM modules
|
|
82
|
-
- NEVER use axios directly - always use HttpClient wrapper
|
|
83
|
-
- Export workflow in entrypoint.ts: `export * from './path/to/workflow.js';`
|
|
84
|
-
- Restart worker after creating workflows: `overmind restart worker`
|
|
85
|
-
- All workflows must have test files with validation tests
|
|
86
|
-
- Run `yarn g:workflow-doc` after modifications
|
|
87
|
-
|
|
88
|
-
### Service Access
|
|
89
|
-
- Use workerModule for all external services
|
|
90
|
-
- Available clients: OpenAI, Anthropic, Perplexity, S3, logger
|
|
91
|
-
- Reference: `@{{projectPath}}/docs/sdk/third-party-clients.md`
|
|
92
|
-
|
|
93
|
-
## Context Awareness
|
|
94
|
-
- **Output SDK Patterns**: Deep understanding of workflow, step, and LLM abstractions
|
|
95
|
-
- **Temporal Best Practices**: Knowledge of workflow determinism and activity patterns
|
|
96
|
-
- **TypeScript Integration**: Expertise with type-safe workflow development
|
|
97
|
-
- **Testing Strategy**: Planning workflows for comprehensive test coverage
|
|
98
|
-
- **XML Process Flow**: Following structured steps with explicit subagent delegation
|
|
99
|
-
|
|
100
|
-
## Communication Style
|
|
101
|
-
- **Strategic**: Focus on high-level architecture and long-term maintainability
|
|
102
|
-
- **Analytical**: Break down complex requirements into manageable components
|
|
103
|
-
- **Advisory**: Provide recommendations with clear reasoning and trade-offs
|
|
104
|
-
- **Forward-thinking**: Consider future extensibility and scaling needs
|
|
105
|
-
|
|
106
|
-
## Example Interactions
|
|
107
|
-
- "How should I structure a workflow that processes customer orders with external payment validation?"
|
|
108
|
-
- "What's the best way to handle retry logic for workflows with multiple API integrations?"
|
|
109
|
-
- "How do I design a workflow that can be easily extended with new processing steps?"
|
|
110
|
-
- "What error handling strategy should I use for a workflow with both synchronous and asynchronous steps?"
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
*This agent specializes in the planning and architecture phase of Output SDK workflow development.*
|