@output.ai/cli 0.4.1 → 0.5.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 (39) hide show
  1. package/README.md +6 -8
  2. package/dist/api/generated/api.d.ts +66 -0
  3. package/dist/api/generated/api.js +26 -0
  4. package/dist/assets/docker/docker-compose-dev.yml +9 -2
  5. package/dist/commands/workflow/runs/list.d.ts +14 -0
  6. package/dist/commands/workflow/runs/list.js +104 -0
  7. package/dist/services/coding_agents.js +180 -8
  8. package/dist/services/coding_agents.spec.js +54 -11
  9. package/dist/services/workflow_runs.d.ts +14 -0
  10. package/dist/services/workflow_runs.js +24 -0
  11. package/dist/templates/agent_instructions/AGENTS.md.template +13 -7
  12. package/dist/templates/agent_instructions/agents/{context_fetcher.md.template → workflow_context_fetcher.md.template} +1 -1
  13. package/dist/templates/agent_instructions/agents/workflow_debugger.md.template +98 -0
  14. package/dist/templates/agent_instructions/agents/workflow_planner.md.template +3 -3
  15. package/dist/templates/agent_instructions/agents/{prompt_writer.md.template → workflow_prompt_writer.md.template} +1 -1
  16. package/dist/templates/agent_instructions/agents/workflow_quality.md.template +2 -2
  17. package/dist/templates/agent_instructions/commands/build_workflow.md.template +2 -2
  18. package/dist/templates/agent_instructions/commands/debug_workflow.md.template +198 -0
  19. package/dist/templates/agent_instructions/commands/plan_workflow.md.template +2 -2
  20. package/dist/templates/agent_instructions/skills/output-error-direct-io/SKILL.md.template +249 -0
  21. package/dist/templates/agent_instructions/skills/output-error-http-client/SKILL.md.template +298 -0
  22. package/dist/templates/agent_instructions/skills/output-error-missing-schemas/SKILL.md.template +265 -0
  23. package/dist/templates/agent_instructions/skills/output-error-nondeterminism/SKILL.md.template +252 -0
  24. package/dist/templates/agent_instructions/skills/output-error-try-catch/SKILL.md.template +226 -0
  25. package/dist/templates/agent_instructions/skills/output-error-zod-import/SKILL.md.template +209 -0
  26. package/dist/templates/agent_instructions/skills/output-services-check/SKILL.md.template +128 -0
  27. package/dist/templates/agent_instructions/skills/output-workflow-list/SKILL.md.template +117 -0
  28. package/dist/templates/agent_instructions/skills/output-workflow-result/SKILL.md.template +199 -0
  29. package/dist/templates/agent_instructions/skills/output-workflow-run/SKILL.md.template +228 -0
  30. package/dist/templates/agent_instructions/skills/output-workflow-runs-list/SKILL.md.template +141 -0
  31. package/dist/templates/agent_instructions/skills/output-workflow-start/SKILL.md.template +201 -0
  32. package/dist/templates/agent_instructions/skills/output-workflow-status/SKILL.md.template +151 -0
  33. package/dist/templates/agent_instructions/skills/output-workflow-stop/SKILL.md.template +164 -0
  34. package/dist/templates/agent_instructions/skills/output-workflow-trace/SKILL.md.template +134 -0
  35. package/dist/templates/project/README.md.template +1 -1
  36. package/dist/templates/project/package.json.template +3 -2
  37. package/dist/utils/date_formatter.d.ts +15 -0
  38. package/dist/utils/date_formatter.js +31 -1
  39. package/package.json +1 -1
@@ -0,0 +1,134 @@
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
+ output workflow debug <workflowId>
29
+ ```
30
+
31
+ **Full trace (JSON format, recommended for detailed analysis):**
32
+ ```bash
33
+ 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
+ output workflow runs list --limit 5 --format json
100
+
101
+ # Get detailed trace
102
+ 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
+ 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
+ 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: `output workflow run <workflowName> <input>`
134
+ 5. Verify the fix with a new trace
@@ -30,7 +30,7 @@ Edit `.env` to add:
30
30
  ### 3. Start Output Services
31
31
 
32
32
  ```bash
33
- npx output dev
33
+ npm run dev
34
34
  ```
35
35
 
36
36
  This starts:
@@ -5,8 +5,9 @@
5
5
  "type": "module",
6
6
  "main": "dist/worker.js",
7
7
  "scripts": {
8
- "build": "rm -rf dist/* && tsc -p ./ && copyfiles -u 1 './src/**/*.prompt' dist",
9
- "start-worker": "npm install && npm run build && output-worker",
8
+ "output:worker:install": "npm install",
9
+ "output:worker:build": "rm -rf dist/* && tsc -p ./ && copyfiles -u 1 './src/**/*.prompt' dist",
10
+ "output:worker:start": "output-worker",
10
11
  "dev": "output dev"
11
12
  },
12
13
  "dependencies": {
@@ -6,3 +6,18 @@
6
6
  * @returns Formatted duration string (e.g., "150ms", "2.50s", "3 minutes 45 seconds")
7
7
  */
8
8
  export declare function formatDuration(ms: number): string;
9
+ /**
10
+ * Format an ISO date string to a human-readable format
11
+ *
12
+ * @param isoString - ISO 8601 date string
13
+ * @returns Formatted date string (e.g., "Dec 3, 2025 10:30 AM")
14
+ */
15
+ export declare function formatDate(isoString: string | null | undefined): string;
16
+ /**
17
+ * Format a duration between two ISO timestamps
18
+ *
19
+ * @param startedAt - ISO 8601 start timestamp
20
+ * @param completedAt - ISO 8601 end timestamp (or null if still running)
21
+ * @returns Human-readable duration string (e.g., "5 seconds", "running")
22
+ */
23
+ export declare function formatDurationFromTimestamps(startedAt: string, completedAt: string | null | undefined): string;
@@ -1,4 +1,7 @@
1
- import { formatDuration as formatDurationFns, intervalToDuration } from 'date-fns';
1
+ /**
2
+ * Date and duration formatting utilities
3
+ */
4
+ import { format, formatDistanceStrict, formatDuration as formatDurationFns, intervalToDuration, parseISO } from 'date-fns';
2
5
  /**
3
6
  * Format a duration in milliseconds to a human-readable string.
4
7
  * Uses date-fns for durations >= 1 minute, custom formatting for shorter durations.
@@ -17,3 +20,30 @@ export function formatDuration(ms) {
17
20
  }
18
21
  return formatDurationFns(duration, { format: ['minutes', 'seconds'] });
19
22
  }
23
+ /**
24
+ * Format an ISO date string to a human-readable format
25
+ *
26
+ * @param isoString - ISO 8601 date string
27
+ * @returns Formatted date string (e.g., "Dec 3, 2025 10:30 AM")
28
+ */
29
+ export function formatDate(isoString) {
30
+ if (!isoString) {
31
+ return '-';
32
+ }
33
+ return format(parseISO(isoString), 'MMM d, yyyy h:mm a');
34
+ }
35
+ /**
36
+ * Format a duration between two ISO timestamps
37
+ *
38
+ * @param startedAt - ISO 8601 start timestamp
39
+ * @param completedAt - ISO 8601 end timestamp (or null if still running)
40
+ * @returns Human-readable duration string (e.g., "5 seconds", "running")
41
+ */
42
+ export function formatDurationFromTimestamps(startedAt, completedAt) {
43
+ if (!completedAt) {
44
+ return 'running';
45
+ }
46
+ const start = parseISO(startedAt);
47
+ const end = parseISO(completedAt);
48
+ return formatDistanceStrict(start, end, { addSuffix: false });
49
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@output.ai/cli",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "CLI for Output.ai workflow generation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",