@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.
Files changed (57) hide show
  1. package/README.md +1 -0
  2. package/dist/api/generated/api.d.ts +25 -0
  3. package/dist/api/generated/api.js +11 -0
  4. package/dist/commands/agents/init.d.ts +0 -1
  5. package/dist/commands/agents/init.js +9 -16
  6. package/dist/commands/agents/init.spec.js +49 -224
  7. package/dist/commands/workflow/generate.js +2 -2
  8. package/dist/commands/workflow/plan.js +3 -3
  9. package/dist/commands/workflow/plan.spec.js +13 -13
  10. package/dist/commands/workflow/terminate.d.ts +13 -0
  11. package/dist/commands/workflow/terminate.js +39 -0
  12. package/dist/services/claude_client.d.ts +4 -4
  13. package/dist/services/claude_client.integration.test.js +2 -2
  14. package/dist/services/claude_client.js +7 -7
  15. package/dist/services/claude_client.spec.js +3 -3
  16. package/dist/services/coding_agents.d.ts +10 -24
  17. package/dist/services/coding_agents.js +112 -368
  18. package/dist/services/coding_agents.spec.js +101 -290
  19. package/dist/services/project_scaffold.js +3 -3
  20. package/dist/services/workflow_builder.d.ts +1 -1
  21. package/dist/services/workflow_builder.js +1 -1
  22. package/dist/services/workflow_planner.js +5 -3
  23. package/dist/services/workflow_planner.spec.js +4 -5
  24. package/dist/templates/agent_instructions/dotclaude/settings.json.template +29 -0
  25. package/dist/templates/agent_instructions/{AGENTS.md.template → dotoutputai/AGENTS.md.template} +12 -10
  26. package/dist/utils/claude.d.ts +5 -0
  27. package/dist/utils/claude.js +19 -0
  28. package/dist/utils/claude.spec.d.ts +1 -0
  29. package/dist/utils/claude.spec.js +119 -0
  30. package/dist/utils/paths.d.ts +0 -4
  31. package/dist/utils/paths.js +0 -6
  32. package/package.json +3 -3
  33. package/dist/templates/agent_instructions/agents/workflow_context_fetcher.md.template +0 -82
  34. package/dist/templates/agent_instructions/agents/workflow_debugger.md.template +0 -98
  35. package/dist/templates/agent_instructions/agents/workflow_planner.md.template +0 -113
  36. package/dist/templates/agent_instructions/agents/workflow_prompt_writer.md.template +0 -595
  37. package/dist/templates/agent_instructions/agents/workflow_quality.md.template +0 -244
  38. package/dist/templates/agent_instructions/commands/build_workflow.md.template +0 -290
  39. package/dist/templates/agent_instructions/commands/debug_workflow.md.template +0 -198
  40. package/dist/templates/agent_instructions/commands/plan_workflow.md.template +0 -261
  41. package/dist/templates/agent_instructions/meta/post_flight.md.template +0 -94
  42. package/dist/templates/agent_instructions/meta/pre_flight.md.template +0 -60
  43. package/dist/templates/agent_instructions/skills/output-error-direct-io/SKILL.md.template +0 -249
  44. package/dist/templates/agent_instructions/skills/output-error-http-client/SKILL.md.template +0 -298
  45. package/dist/templates/agent_instructions/skills/output-error-missing-schemas/SKILL.md.template +0 -265
  46. package/dist/templates/agent_instructions/skills/output-error-nondeterminism/SKILL.md.template +0 -252
  47. package/dist/templates/agent_instructions/skills/output-error-try-catch/SKILL.md.template +0 -226
  48. package/dist/templates/agent_instructions/skills/output-error-zod-import/SKILL.md.template +0 -209
  49. package/dist/templates/agent_instructions/skills/output-services-check/SKILL.md.template +0 -128
  50. package/dist/templates/agent_instructions/skills/output-workflow-list/SKILL.md.template +0 -117
  51. package/dist/templates/agent_instructions/skills/output-workflow-result/SKILL.md.template +0 -199
  52. package/dist/templates/agent_instructions/skills/output-workflow-run/SKILL.md.template +0 -228
  53. package/dist/templates/agent_instructions/skills/output-workflow-runs-list/SKILL.md.template +0 -141
  54. package/dist/templates/agent_instructions/skills/output-workflow-start/SKILL.md.template +0 -201
  55. package/dist/templates/agent_instructions/skills/output-workflow-status/SKILL.md.template +0 -151
  56. package/dist/templates/agent_instructions/skills/output-workflow-stop/SKILL.md.template +0 -164
  57. package/dist/templates/agent_instructions/skills/output-workflow-trace/SKILL.md.template +0 -134
@@ -1,201 +0,0 @@
1
- ---
2
- name: output-workflow-start
3
- description: Start an Output SDK workflow asynchronously without waiting for completion. Use when starting long-running workflows, getting a workflow ID for later monitoring, running workflows in the background, or executing multiple workflows in parallel.
4
- allowed-tools: [Bash, Read, Write]
5
- ---
6
-
7
- # Start Workflow Asynchronously
8
-
9
- ## Overview
10
-
11
- This skill starts a workflow asynchronously, meaning the command returns immediately with a workflow ID while the workflow executes in the background. Use this for long-running workflows or when you need to run multiple workflows in parallel.
12
-
13
- ## When to Use This Skill
14
-
15
- - Starting workflows that take minutes or hours
16
- - Running multiple workflows in parallel
17
- - When you need to disconnect and check results later
18
- - Monitoring workflow progress separately
19
- - When you need the workflow ID immediately for tracking
20
-
21
- ## When to Use Sync Instead
22
-
23
- Consider using `npx output workflow run` (sync) when:
24
- - Workflow completes quickly (seconds)
25
- - You need the result immediately in your terminal
26
- - Simple testing during development
27
- - You want a single command with the result
28
-
29
- ## Instructions
30
-
31
- ### Basic Syntax
32
-
33
- ```bash
34
- npx output workflow start <workflowName> --input '<json-input>'
35
- npx output workflow start <workflowName> --input <path-to-json-file>
36
- ```
37
-
38
- The `--input` flag is required when the workflow expects input data.
39
-
40
- ### Input Methods
41
-
42
- #### 1. Inline JSON
43
-
44
- Pass JSON directly on the command line:
45
-
46
- ```bash
47
- npx output workflow start data-migration --input '{"batchSize": 1000}'
48
- ```
49
-
50
- #### 2. File Path (Recommended)
51
-
52
- Reference a JSON file containing the input:
53
-
54
- ```bash
55
- npx output workflow start data-migration --input src/data_migration/scenarios/large_batch.json
56
- ```
57
-
58
- This is the recommended approach because:
59
- - Input is version controlled and reproducible
60
- - Complex inputs are easier to read and edit
61
- - Scenarios can be shared and reused
62
-
63
- ### Getting the Workflow ID
64
-
65
- The command outputs the workflow ID which you'll need for:
66
- - Checking status: `npx output workflow status <id>`
67
- - Getting results: `npx output workflow result <id>`
68
- - Debugging: `npx output workflow debug <id>`
69
-
70
- ## Examples
71
-
72
- **Scenario**: Start a long-running workflow with scenario file
73
-
74
- ```bash
75
- npx output workflow start data-migration --input src/data_migration/scenarios/full_migration.json
76
-
77
- # Output:
78
- # Started workflow: data-migration
79
- # Workflow ID: abc123xyz
80
- # Use 'npx output workflow status abc123xyz' to check progress
81
- ```
82
-
83
- **Scenario**: Start multiple workflows in parallel using scenario files
84
-
85
- ```bash
86
- # Start several workflows with different scenario files
87
- npx output workflow start process-batch --input src/process_batch/scenarios/batch_1.json
88
- npx output workflow start process-batch --input src/process_batch/scenarios/batch_2.json
89
- npx output workflow start process-batch --input src/process_batch/scenarios/batch_3.json
90
-
91
- # Note: Save the workflow IDs to check them later
92
- ```
93
-
94
- **Scenario**: Create scenario then start workflow
95
-
96
- ```bash
97
- # Create a scenario file
98
- mkdir -p src/generate_report/scenarios
99
- cat > src/generate_report/scenarios/annual_2024.json << 'EOF'
100
- {
101
- "year": 2024,
102
- "includeCharts": true,
103
- "format": "pdf"
104
- }
105
- EOF
106
-
107
- # Start the workflow
108
- npx output workflow start generate-report --input src/generate_report/scenarios/annual_2024.json
109
- # Output: Workflow ID: report-2024-abc
110
-
111
- # Check status periodically
112
- npx output workflow status report-2024-abc
113
- # Output: Status: RUNNING
114
-
115
- # Later, check again
116
- npx output workflow status report-2024-abc
117
- # Output: Status: COMPLETED
118
-
119
- # Get the result
120
- npx output workflow result report-2024-abc
121
- ```
122
-
123
- **Scenario**: Quick inline test for development
124
-
125
- ```bash
126
- npx output workflow start quick-job --input '{"test": true}'
127
- ```
128
-
129
- **Scenario**: Script for parallel execution
130
-
131
- ```bash
132
- # Start workflows and capture IDs
133
- ID1=$(npx output workflow start job --input src/job/scenarios/type_a.json | grep "Workflow ID" | cut -d: -f2 | tr -d ' ')
134
- ID2=$(npx output workflow start job --input src/job/scenarios/type_b.json | grep "Workflow ID" | cut -d: -f2 | tr -d ' ')
135
-
136
- # Wait and check results
137
- npx output workflow result $ID1
138
- npx output workflow result $ID2
139
- ```
140
-
141
- ## Following Up After Starting
142
-
143
- ### Check Status
144
-
145
- ```bash
146
- npx output workflow status <workflowId>
147
- ```
148
-
149
- Status values:
150
- - **RUNNING**: Still executing
151
- - **COMPLETED**: Finished successfully
152
- - **FAILED**: Encountered an error
153
- - **TERMINATED**: Was manually stopped
154
-
155
- ### Get Result
156
-
157
- ```bash
158
- npx output workflow result <workflowId>
159
- ```
160
-
161
- Only works for COMPLETED workflows. For FAILED workflows, use debug.
162
-
163
- ### Debug If Failed
164
-
165
- ```bash
166
- npx output workflow debug <workflowId> --format json
167
- ```
168
-
169
- ### Stop If Needed
170
-
171
- ```bash
172
- npx output workflow stop <workflowId>
173
- ```
174
-
175
- ## Workflow ID Management
176
-
177
- When starting multiple workflows, keep track of IDs:
178
-
179
- ```bash
180
- # Log IDs to a file
181
- npx output workflow start batch-job --input src/batch_job/scenarios/id_1.json >> workflow-ids.txt
182
- npx output workflow start batch-job --input src/batch_job/scenarios/id_2.json >> workflow-ids.txt
183
-
184
- # Or use a naming convention in your workflow that makes IDs predictable
185
- ```
186
-
187
- ## Best Practices
188
-
189
- 1. **Use scenario files**: Store inputs in `src/<workflow>/scenarios/` for reproducibility
190
- 2. **Save the workflow ID**: Always note the ID for later reference
191
- 3. **Monitor long workflows**: Use `npx output workflow status` to check progress
192
- 4. **Handle failures**: Check status before getting results
193
- 5. **Clean up**: Stop any stuck workflows with `npx output workflow stop`
194
-
195
- ## Related Commands
196
-
197
- - `npx output workflow run <name> --input` - Execute synchronously
198
- - `npx output workflow status <id>` - Check execution status
199
- - `npx output workflow result <id>` - Get execution result
200
- - `npx output workflow stop <id>` - Stop a running workflow
201
- - `npx output workflow debug <id>` - Debug a workflow execution
@@ -1,151 +0,0 @@
1
- ---
2
- name: output-workflow-status
3
- description: Check the status of an Output SDK workflow execution. Use when monitoring a running workflow, checking if a workflow completed, or determining workflow state (RUNNING, COMPLETED, FAILED, TERMINATED).
4
- allowed-tools: [Bash]
5
- ---
6
-
7
- # Check Workflow Execution Status
8
-
9
- ## Overview
10
-
11
- This skill checks the current execution status of a workflow. Use it to monitor running workflows, verify completion, or determine if a workflow failed before attempting to get its result.
12
-
13
- ## When to Use This Skill
14
-
15
- - Monitoring a workflow started asynchronously
16
- - Checking if a workflow has completed
17
- - Determining why you can't get a workflow result
18
- - Verifying workflow state before taking action
19
- - Polling for completion in scripts
20
-
21
- ## When to Use Other Commands
22
-
23
- - **Getting results**: Use `npx output workflow result` after confirming COMPLETED status
24
- - **Debugging failures**: Use `npx output workflow debug` for FAILED workflows
25
- - **Execution history**: Use `npx output workflow runs list` for multiple runs
26
-
27
- ## Instructions
28
-
29
- ### Check Status
30
-
31
- ```bash
32
- npx output workflow status <workflowId>
33
- ```
34
-
35
- Replace `<workflowId>` with the ID from `npx output workflow start` or `npx output workflow runs list`.
36
-
37
- ## Understanding Status Values
38
-
39
- | Status | Meaning | Next Action |
40
- |--------|---------|-------------|
41
- | RUNNING | Workflow is currently executing | Wait and check again |
42
- | COMPLETED | Workflow finished successfully | Get result with `npx output workflow result` |
43
- | FAILED | Workflow encountered an error | Debug with `npx output workflow debug` |
44
- | TERMINATED | Workflow was manually stopped | Review if expected, restart if needed |
45
- | TIMED_OUT | Workflow exceeded time limit | Check for long operations, adjust timeout |
46
-
47
- ## Examples
48
-
49
- **Scenario**: Monitor a running workflow
50
-
51
- ```bash
52
- # Start a workflow
53
- npx output workflow start data-sync '{"source": "external"}'
54
- # Output: Workflow ID: sync-abc123
55
-
56
- # Check status
57
- npx output workflow status sync-abc123
58
- # Output: Status: RUNNING
59
-
60
- # Wait and check again
61
- sleep 30
62
- npx output workflow status sync-abc123
63
- # Output: Status: COMPLETED
64
- ```
65
-
66
- **Scenario**: Poll for completion in a script
67
-
68
- ```bash
69
- WORKFLOW_ID="abc123xyz"
70
-
71
- while true; do
72
- STATUS=$(npx output workflow status $WORKFLOW_ID)
73
- echo "Current status: $STATUS"
74
-
75
- if [[ "$STATUS" == *"COMPLETED"* ]]; then
76
- echo "Workflow completed!"
77
- npx output workflow result $WORKFLOW_ID
78
- break
79
- elif [[ "$STATUS" == *"FAILED"* ]]; then
80
- echo "Workflow failed!"
81
- npx output workflow debug $WORKFLOW_ID --format json
82
- break
83
- fi
84
-
85
- sleep 10
86
- done
87
- ```
88
-
89
- **Scenario**: Check before getting result
90
-
91
- ```bash
92
- # Verify status first
93
- npx output workflow status my-workflow-123
94
-
95
- # If COMPLETED, get result
96
- npx output workflow result my-workflow-123
97
-
98
- # If FAILED, debug instead
99
- npx output workflow debug my-workflow-123 --format json
100
- ```
101
-
102
- **Scenario**: Batch status check
103
-
104
- ```bash
105
- # Check multiple workflows
106
- for id in abc123 def456 ghi789; do
107
- echo "Workflow $id: $(npx output workflow status $id)"
108
- done
109
- ```
110
-
111
- ## Status Transitions
112
-
113
- Workflows typically follow these paths:
114
-
115
- ```
116
- RUNNING -> COMPLETED (success)
117
- RUNNING -> FAILED (error occurred)
118
- RUNNING -> TERMINATED (manually stopped)
119
- RUNNING -> TIMED_OUT (exceeded limit)
120
- ```
121
-
122
- ## Interpreting Status Output
123
-
124
- The status command returns information including:
125
- - **Status**: Current state (RUNNING, COMPLETED, FAILED, etc.)
126
- - **Duration**: How long the workflow has been running or ran
127
- - **Start Time**: When the workflow began
128
-
129
- ## Troubleshooting
130
-
131
- ### "Workflow not found"
132
- - The workflow ID may be incorrect
133
- - The workflow may have been deleted from history
134
- - Check `npx output workflow runs list` to find the correct ID
135
-
136
- ### Status stays RUNNING too long
137
- 1. Check if the workflow is stuck: `npx output workflow debug <id>`
138
- 2. Look for infinite loops or waiting operations
139
- 3. Consider stopping: `npx output workflow stop <id>`
140
-
141
- ### Unexpected TERMINATED status
142
- - Someone may have manually stopped the workflow
143
- - Check with `npx output workflow debug` for context
144
- - Restart if needed: `npx output workflow start`
145
-
146
- ## Related Commands
147
-
148
- - `npx output workflow result <id>` - Get execution result (after COMPLETED)
149
- - `npx output workflow debug <id>` - Debug execution (after FAILED)
150
- - `npx output workflow stop <id>` - Stop a running workflow
151
- - `npx output workflow runs list` - View execution history
@@ -1,164 +0,0 @@
1
- ---
2
- name: output-workflow-stop
3
- description: Stop a running Output SDK workflow execution. Use when cancelling a workflow, stopping a long-running process, terminating a stuck workflow, or when you need to abort a workflow in progress.
4
- allowed-tools: [Bash]
5
- ---
6
-
7
- # Stop Running Workflow
8
-
9
- ## Overview
10
-
11
- This skill stops a running workflow execution. The workflow will be marked as TERMINATED and will not complete its remaining steps. Use this carefully as it cannot be undone.
12
-
13
- ## When to Use This Skill
14
-
15
- - Cancelling a workflow that's no longer needed
16
- - Stopping a workflow that appears stuck
17
- - Terminating a long-running workflow to free resources
18
- - Aborting a workflow with incorrect input
19
- - Emergency stop during unexpected behavior
20
-
21
- ## When NOT to Use This
22
-
23
- - If the workflow is about to complete (let it finish)
24
- - If you're unsure whether stopping is safe
25
- - For debugging (use `npx output workflow debug` instead)
26
- - If the workflow has side effects that may leave data in an inconsistent state
27
-
28
- ## Instructions
29
-
30
- ### Stop a Workflow
31
-
32
- ```bash
33
- npx output workflow stop <workflowId>
34
- ```
35
-
36
- ### Safety Considerations
37
-
38
- Before stopping, consider:
39
-
40
- 1. **Side effects**: Has the workflow made changes that need to be rolled back?
41
- 2. **Partial completion**: Are there steps that completed with side effects?
42
- 3. **Dependencies**: Are other workflows or systems waiting on this result?
43
- 4. **Recovery**: Do you need to restart or clean up after stopping?
44
-
45
- ## Examples
46
-
47
- **Scenario**: Stop a stuck workflow
48
-
49
- ```bash
50
- # Check status - workflow has been running too long
51
- npx output workflow status abc123xyz
52
- # Status: RUNNING (for 2 hours)
53
-
54
- # Decide to stop it
55
- npx output workflow stop abc123xyz
56
- # Workflow abc123xyz has been stopped
57
-
58
- # Verify it's terminated
59
- npx output workflow status abc123xyz
60
- # Status: TERMINATED
61
- ```
62
-
63
- **Scenario**: Cancel a workflow started with wrong input
64
-
65
- ```bash
66
- # Realized input was wrong immediately after starting
67
- npx output workflow start expensive-job '{"wrong": "input"}'
68
- # Workflow ID: job-abc123
69
-
70
- # Stop before it processes too much
71
- npx output workflow stop job-abc123
72
-
73
- # Start again with correct input
74
- npx output workflow start expensive-job '{"correct": "input"}'
75
- ```
76
-
77
- **Scenario**: Stop multiple workflows
78
-
79
- ```bash
80
- # Get list of running workflows
81
- npx output workflow runs list --format json | jq '.[] | select(.status == "RUNNING") | .workflowId'
82
-
83
- # Stop each one (carefully review first!)
84
- for id in abc123 def456; do
85
- echo "Stopping $id"
86
- npx output workflow stop $id
87
- done
88
- ```
89
-
90
- ## After Stopping a Workflow
91
-
92
- ### Check the State
93
-
94
- ```bash
95
- npx output workflow status <workflowId>
96
- # Status: TERMINATED
97
- ```
98
-
99
- ### Review What Happened
100
-
101
- ```bash
102
- npx output workflow debug <workflowId> --format json
103
- ```
104
-
105
- This shows:
106
- - Which steps completed before termination
107
- - Any partial results or side effects
108
- - The point at which the workflow was stopped
109
-
110
- ### Clean Up If Needed
111
-
112
- If the workflow made partial changes:
113
- 1. Review the debug output to see what completed
114
- 2. Manually revert any side effects if necessary
115
- 3. Consider creating a cleanup workflow for this scenario
116
-
117
- ### Restart If Appropriate
118
-
119
- ```bash
120
- # Start a fresh execution
121
- npx output workflow start <workflowName> '<input>'
122
- ```
123
-
124
- ## What Happens When You Stop
125
-
126
- 1. The Temporal server receives the termination request
127
- 2. The currently executing step may complete or abort
128
- 3. No further steps are executed
129
- 4. The workflow status changes to TERMINATED
130
- 5. The result will not be available (workflow didn't complete)
131
-
132
- ## Troubleshooting
133
-
134
- ### "Workflow not found"
135
- - Check the workflow ID is correct
136
- - Use `npx output workflow runs list` to find valid IDs
137
-
138
- ### "Workflow already completed"
139
- - The workflow finished before the stop command
140
- - Check status and get result if needed
141
-
142
- ### "Workflow already terminated"
143
- - The workflow was already stopped
144
- - No action needed
145
-
146
- ### Stop command hangs
147
- - The Temporal server may be unresponsive
148
- - Check if services are running: `docker ps | grep output`
149
- - May need to restart services
150
-
151
- ## Best Practices
152
-
153
- 1. **Always check status first**: Confirm the workflow is actually RUNNING
154
- 2. **Review before stopping**: Use `npx output workflow debug` to understand state
155
- 3. **Document why**: Note why you stopped the workflow for future reference
156
- 4. **Plan for cleanup**: Know what side effects may need manual handling
157
- 5. **Consider alternatives**: Sometimes waiting is better than stopping
158
-
159
- ## Related Commands
160
-
161
- - `npx output workflow status <id>` - Check current status
162
- - `npx output workflow debug <id>` - Review execution details
163
- - `npx output workflow start <name>` - Start a new execution
164
- - `npx output workflow runs list` - View execution history
@@ -1,134 +0,0 @@
1
- ---
2
- name: output-workflow-trace
3
- description: Analyze Output SDK workflow execution traces. Use when debugging a specific workflow, examining step failures, analyzing input/output data, understanding execution flow, or when you have a workflow ID to investigate.
4
- allowed-tools: [Bash, Read]
5
- ---
6
-
7
- # Workflow Trace Analysis
8
-
9
- ## Overview
10
-
11
- This skill provides guidance on retrieving and analyzing workflow execution traces using the Output CLI. Traces show the complete execution history including step inputs, outputs, errors, and timing information.
12
-
13
- ## When to Use This Skill
14
-
15
- - You have a workflow ID and need to understand what happened
16
- - A workflow failed and you need to identify which step failed
17
- - You need to examine the input/output data at each step
18
- - You want to understand the execution flow and timing
19
- - You need to find error messages and stack traces
20
- - Debugging retry behavior or unexpected results
21
-
22
- ## Instructions
23
-
24
- ### Step 1: Retrieve the Execution Trace
25
-
26
- **Basic trace (text format, may be truncated):**
27
- ```bash
28
- npx output workflow debug <workflowId>
29
- ```
30
-
31
- **Full trace (JSON format, recommended for detailed analysis):**
32
- ```bash
33
- npx output workflow debug <workflowId> --format json
34
- ```
35
-
36
- **Tip**: Always use `--format json` when you need complete trace data. The text format truncates long values which can hide important debugging information.
37
-
38
- ### Step 2: Analyze the Trace
39
-
40
- Follow this checklist when examining a trace:
41
-
42
- 1. **Identify the failed step**: Look for steps with error status or failure indicators
43
- 2. **Examine error messages**: Find the exact error message and stack trace
44
- 3. **Check step inputs**: Verify the data passed to the failing step was correct
45
- 4. **Check step outputs**: Look at outputs from preceding steps
46
- 5. **Review retry attempts**: Note how many retries occurred and their outcomes
47
- 6. **Check timing**: Look for unusual delays that might indicate timeouts
48
-
49
- ### Step 3: Use the Temporal UI for Visual Analysis
50
-
51
- Open **http://localhost:8080** in your browser for a visual workflow inspection:
52
-
53
- 1. Search for your workflow by ID
54
- 2. View the event history timeline
55
- 3. Click on individual events to see details
56
- 4. Inspect step inputs and outputs
57
- 5. See retry attempts and timing information
58
- 6. Export trace data if needed
59
-
60
- ## What to Look For in Traces
61
-
62
- ### Error Patterns
63
-
64
- | Error Message | Likely Cause |
65
- |---------------|--------------|
66
- | "incompatible schema" | Zod import issue - using `zod` instead of `@output.ai/core` |
67
- | "non-deterministic" | Using Math.random(), Date.now(), etc. in workflow code |
68
- | "FatalError" with retry context | Try-catch wrapping step calls |
69
- | "undefined is not a function" | Missing schema definitions |
70
- | "workflow must be deterministic" | Direct I/O in workflow function |
71
- | "ECONNREFUSED" or timeout | Services not running or network issues |
72
-
73
- ### Step Status Values
74
-
75
- - **COMPLETED**: Step finished successfully
76
- - **FAILED**: Step threw an error (may retry)
77
- - **RETRYING**: Step is being retried after a failure
78
- - **TIMED_OUT**: Step exceeded its timeout
79
- - **CANCELLED**: Workflow was stopped before step completed
80
-
81
- ### Key Trace Fields
82
-
83
- When examining JSON traces, focus on these fields:
84
-
85
- - `steps[].name`: Step identifier
86
- - `steps[].status`: Execution result
87
- - `steps[].input`: Data passed to the step
88
- - `steps[].output`: Data returned from the step
89
- - `steps[].error`: Error details if failed
90
- - `steps[].attempts`: Number of execution attempts
91
- - `steps[].duration`: How long the step took
92
-
93
- ## Examples
94
-
95
- **Scenario**: Debug a failed workflow
96
-
97
- ```bash
98
- # Get the workflow ID from runs list
99
- npx output workflow runs list --limit 5 --format json
100
-
101
- # Get detailed trace
102
- npx output workflow debug abc123xyz --format json
103
-
104
- # Look for the failing step in the output
105
- # Example output structure:
106
- # {
107
- # "workflowId": "abc123xyz",
108
- # "status": "FAILED",
109
- # "steps": [
110
- # { "name": "fetchData", "status": "COMPLETED", ... },
111
- # { "name": "processData", "status": "FAILED", "error": "..." }
112
- # ]
113
- # }
114
- ```
115
-
116
- **Scenario**: Investigate retry behavior
117
-
118
- ```bash
119
- npx output workflow debug abc123xyz --format json | jq '.steps[] | select(.attempts > 1)'
120
- ```
121
-
122
- **Scenario**: Check inputs to a specific step
123
-
124
- ```bash
125
- npx output workflow debug abc123xyz --format json | jq '.steps[] | select(.name == "processData") | .input'
126
- ```
127
-
128
- ## Next Steps After Analysis
129
-
130
- 1. Match the error to common patterns (see error skills)
131
- 2. Consult the `workflow-quality` subagent for best practices
132
- 3. Make code fixes based on identified issues
133
- 4. Re-run the workflow: `npx output workflow run <workflowName> <input>`
134
- 5. Verify the fix with a new trace