@output.ai/cli 0.0.0 → 0.0.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.md +67 -2
- package/dist/api/generated/api.d.ts +272 -0
- package/dist/api/generated/api.js +131 -0
- package/dist/api/http_client.d.ts +6 -0
- package/dist/api/http_client.js +41 -0
- package/dist/api/orval_post_process.d.ts +10 -0
- package/dist/api/orval_post_process.js +33 -0
- package/dist/api/parser.d.ts +17 -0
- package/dist/api/parser.js +71 -0
- package/dist/commands/agents/init.d.ts +18 -0
- package/dist/commands/agents/init.js +175 -0
- package/dist/commands/agents/init.spec.d.ts +1 -0
- package/dist/commands/agents/init.spec.js +227 -0
- package/dist/commands/workflow/generate.js +1 -1
- package/dist/commands/workflow/list.d.ts +21 -0
- package/dist/commands/workflow/list.js +169 -0
- package/dist/commands/workflow/list.test.d.ts +1 -0
- package/dist/commands/workflow/list.test.js +83 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +19 -0
- package/dist/templates/agent_instructions/AGENTS.md.template +30 -0
- package/dist/templates/agent_instructions/agents/workflow_planner.md.template +104 -0
- package/dist/templates/agent_instructions/commands/plan_workflow.md.template +466 -0
- package/dist/templates/agent_instructions/meta/post_flight.md.template +94 -0
- package/dist/templates/agent_instructions/meta/pre_flight.md.template +60 -0
- package/dist/templates/workflow/README.md.template +6 -6
- package/dist/templates/workflow/workflow.ts.template +2 -2
- package/dist/utils/paths.d.ts +5 -0
- package/dist/utils/paths.js +8 -1
- package/package.json +19 -4
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Workflow Planning Command for Output SDK
|
|
3
|
+
version: 2.0
|
|
4
|
+
encoding: UTF-8
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plan Workflow Command
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Generate comprehensive workflow implementation plans following Output SDK patterns and best practices.
|
|
12
|
+
|
|
13
|
+
<pre_flight_check>
|
|
14
|
+
EXECUTE: @{{projectPath}}/.outputai/instructions/meta/pre_flight.md
|
|
15
|
+
</pre_flight_check>
|
|
16
|
+
|
|
17
|
+
<process_flow>
|
|
18
|
+
|
|
19
|
+
<step number="1" subagent="workflow_planner" name="requirements_analysis">
|
|
20
|
+
|
|
21
|
+
### Step 1: Requirements Analysis
|
|
22
|
+
|
|
23
|
+
Use the workflow_planner subagent to analyze the workflow requirements and infer smart defaults.
|
|
24
|
+
|
|
25
|
+
<smart_inference>
|
|
26
|
+
<approach>Infer requirements from description and apply defaults</approach>
|
|
27
|
+
<defaults>
|
|
28
|
+
- retry_policy: 3 attempts with exponential backoff
|
|
29
|
+
- timeout: 30s for activities, 5m for workflows
|
|
30
|
+
- openai_model: gpt-4o unless specified
|
|
31
|
+
- error_handling: ApplicationFailure patterns
|
|
32
|
+
- performance: clarity over speed optimization
|
|
33
|
+
</defaults>
|
|
34
|
+
</smart_inference>
|
|
35
|
+
|
|
36
|
+
<critical_questions>
|
|
37
|
+
ASK ONLY if cannot be inferred:
|
|
38
|
+
- Ambiguous input/output structures
|
|
39
|
+
- Non-standard API integrations
|
|
40
|
+
- Complex orchestration patterns
|
|
41
|
+
- Unusual error handling requirements
|
|
42
|
+
</critical_questions>
|
|
43
|
+
|
|
44
|
+
<requirements_template>
|
|
45
|
+
## Requirements Analysis
|
|
46
|
+
|
|
47
|
+
**Goal**: {{workflowGoal}}
|
|
48
|
+
**Input**: {{inputDescription}}
|
|
49
|
+
**Output**: {{outputDescription}}
|
|
50
|
+
**External Services**: {{servicesList}}
|
|
51
|
+
**Constraints**: {{constraintsList}}
|
|
52
|
+
</requirements_template>
|
|
53
|
+
|
|
54
|
+
</step>
|
|
55
|
+
|
|
56
|
+
<step number="2" name="pattern_analysis">
|
|
57
|
+
|
|
58
|
+
### Step 2: Pattern Analysis
|
|
59
|
+
|
|
60
|
+
<analysis_targets>
|
|
61
|
+
- Check the repository for similar implementations
|
|
62
|
+
- Identify reusable activities
|
|
63
|
+
- Find applicable prompt templates in workflow directories
|
|
64
|
+
- Locate relevant schemas and types
|
|
65
|
+
</analysis_targets>
|
|
66
|
+
|
|
67
|
+
<pattern_collection>
|
|
68
|
+
<existing_workflows>workflows with similar purpose or structure</existing_workflows>
|
|
69
|
+
<reusable_activities>activities that can be leveraged</reusable_activities>
|
|
70
|
+
<error_patterns>established error handling patterns</error_patterns>
|
|
71
|
+
<retry_policies>common retry configurations</retry_policies>
|
|
72
|
+
</pattern_collection>
|
|
73
|
+
|
|
74
|
+
</step>
|
|
75
|
+
|
|
76
|
+
<step number="3" subagent="workflow_planner" name="schema_definition">
|
|
77
|
+
|
|
78
|
+
### Step 3: Schema Definition
|
|
79
|
+
|
|
80
|
+
Use the workflow_planner subagent to define input/output schemas with Zod validation.
|
|
81
|
+
|
|
82
|
+
<schema_requirements>
|
|
83
|
+
- Use simple TypeScript interfaces for basic types
|
|
84
|
+
- Use Zod schemas when validation is needed
|
|
85
|
+
- Keep field types simple: string, number, boolean, object
|
|
86
|
+
- Mark optional fields with ? in interfaces or .optional() in Zod
|
|
87
|
+
- Export types for reuse across workflow files
|
|
88
|
+
</schema_requirements>
|
|
89
|
+
|
|
90
|
+
<input_schema_template>
|
|
91
|
+
```typescript
|
|
92
|
+
// For simple types (types.ts)
|
|
93
|
+
export interface {{WorkflowName}}Input {
|
|
94
|
+
{{requiredField}}: string;
|
|
95
|
+
{{optionalField}}?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Or for validation with Zod
|
|
99
|
+
import { z } from 'zod';
|
|
100
|
+
|
|
101
|
+
export const {{WorkflowName}}InputSchema = z.object({
|
|
102
|
+
{{requiredField}}: z.string(),
|
|
103
|
+
{{optionalField}}: z.string().optional()
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export type {{WorkflowName}}Input = z.infer<typeof {{WorkflowName}}InputSchema>;
|
|
107
|
+
```
|
|
108
|
+
</input_schema_template>
|
|
109
|
+
|
|
110
|
+
<output_schema_template>
|
|
111
|
+
```typescript
|
|
112
|
+
export interface {{WorkflowName}}Output {
|
|
113
|
+
result: string;
|
|
114
|
+
// Additional fields as needed
|
|
115
|
+
{{additionalFields}}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
</output_schema_template>
|
|
119
|
+
|
|
120
|
+
</step>
|
|
121
|
+
|
|
122
|
+
<step number="4" subagent="workflow_planner" name="activity_design">
|
|
123
|
+
|
|
124
|
+
### Step 4: Activity Design
|
|
125
|
+
|
|
126
|
+
Use the workflow_planner subagent to design workflow activities with clear boundaries.
|
|
127
|
+
|
|
128
|
+
<activity_template>
|
|
129
|
+
### Step: `{{stepName}}`
|
|
130
|
+
|
|
131
|
+
**Purpose**: {{stepPurpose}}
|
|
132
|
+
|
|
133
|
+
**Implementation (steps.ts)**:
|
|
134
|
+
```typescript
|
|
135
|
+
import { step } from '@output.ai/core';
|
|
136
|
+
import { generateText, generateObject } from '@output.ai/llm';
|
|
137
|
+
import { loadPrompt } from '@output.ai/prompt';
|
|
138
|
+
import type { Prompt } from '@output.ai/llm';
|
|
139
|
+
|
|
140
|
+
export const {{stepName}} = step({
|
|
141
|
+
name: '{{stepName}}',
|
|
142
|
+
description: '{{stepDescription}}',
|
|
143
|
+
inputSchema: {
|
|
144
|
+
type: 'object',
|
|
145
|
+
required: [{{requiredFields}}],
|
|
146
|
+
properties: {
|
|
147
|
+
{{fieldName}}: { type: '{{fieldType}}' }
|
|
148
|
+
// Add more fields as needed
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
outputSchema: {
|
|
152
|
+
type: '{{outputType}}'
|
|
153
|
+
},
|
|
154
|
+
fn: async (input) => {
|
|
155
|
+
// Implementation logic
|
|
156
|
+
{{implementationLogic}}
|
|
157
|
+
|
|
158
|
+
// For LLM operations:
|
|
159
|
+
// const prompt = loadPrompt('{{promptName}}', input);
|
|
160
|
+
// const response = await generateText(prompt as Prompt);
|
|
161
|
+
|
|
162
|
+
return {{returnValue}};
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Error Handling**:
|
|
168
|
+
- Use `FatalError` from '@output.ai/core' for non-retryable errors
|
|
169
|
+
- Standard errors will be retried based on workflow configuration
|
|
170
|
+
</activity_template>
|
|
171
|
+
|
|
172
|
+
<decision_tree>
|
|
173
|
+
IF step_uses_llm:
|
|
174
|
+
USE generateText or generateObject from @output.ai/llm
|
|
175
|
+
LOAD prompts with loadPrompt from @output.ai/prompt
|
|
176
|
+
DEFINE error handling with FatalError
|
|
177
|
+
ELSE IF step_uses_external_service:
|
|
178
|
+
IMPORT required service libraries
|
|
179
|
+
HANDLE errors appropriately
|
|
180
|
+
ELSE:
|
|
181
|
+
IMPLEMENT pure logic
|
|
182
|
+
VALIDATE inputs/outputs
|
|
183
|
+
</decision_tree>
|
|
184
|
+
|
|
185
|
+
</step>
|
|
186
|
+
|
|
187
|
+
<step number="5" subagent="workflow_planner" name="prompt_engineering">
|
|
188
|
+
|
|
189
|
+
### Step 5: Prompt Engineering (Conditional)
|
|
190
|
+
|
|
191
|
+
Use the workflow_planner subagent to design LLM prompts if the workflow uses AI services.
|
|
192
|
+
|
|
193
|
+
<decision_tree>
|
|
194
|
+
IF workflow_uses_llm:
|
|
195
|
+
EXECUTE prompt_design
|
|
196
|
+
ELSE:
|
|
197
|
+
SKIP to step 6
|
|
198
|
+
</decision_tree>
|
|
199
|
+
|
|
200
|
+
<prompt_template>
|
|
201
|
+
**Prompt File ({{promptName}}@v1.prompt)**:
|
|
202
|
+
```yaml
|
|
203
|
+
---
|
|
204
|
+
provider: {{provider}} # anthropic, openai, etc.
|
|
205
|
+
model: {{model}} # e.g., claude-sonnet-4-20250514, gpt-4o
|
|
206
|
+
temperature: {{temperature}} # e.g., 0.7
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
<assistant>
|
|
210
|
+
{{systemPrompt}}
|
|
211
|
+
</assistant>
|
|
212
|
+
|
|
213
|
+
<user>
|
|
214
|
+
{{userPrompt}}
|
|
215
|
+
|
|
216
|
+
Variables to include:
|
|
217
|
+
{{ "{{ " }}{{variableName}}{{ " }}" }}
|
|
218
|
+
</user>
|
|
219
|
+
```
|
|
220
|
+
</prompt_template>
|
|
221
|
+
|
|
222
|
+
<template_variables>
|
|
223
|
+
**Template Variables**:
|
|
224
|
+
- `{{ "{{ " }}{{variableName1}}{{ " }}" }}` - {{description1}}
|
|
225
|
+
- `{{ "{{ " }}{{variableName2}}{{ " }}" }}` - {{description2}}
|
|
226
|
+
|
|
227
|
+
**Loading in Step**:
|
|
228
|
+
```typescript
|
|
229
|
+
const prompt = loadPrompt('{{promptName}}@v1', {
|
|
230
|
+
{{variableName1}}: input.{{field1}},
|
|
231
|
+
{{variableName2}}: input.{{field2}}
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
</template_variables>
|
|
235
|
+
|
|
236
|
+
</step>
|
|
237
|
+
|
|
238
|
+
<step number="6" subagent="workflow_planner" name="orchestration_planning">
|
|
239
|
+
|
|
240
|
+
### Step 6: Workflow Orchestration
|
|
241
|
+
|
|
242
|
+
Use the workflow_planner subagent to define the workflow execution logic.
|
|
243
|
+
|
|
244
|
+
<orchestration_template>
|
|
245
|
+
## Workflow Logic
|
|
246
|
+
|
|
247
|
+
1. **Input Validation**: `validateWorkflowInput(rawInput, {{WorkflowName}}InputSchema)`
|
|
248
|
+
2. **{{Step2Name}}**: {{step2Description}}
|
|
249
|
+
3. **{{Step3Name}}**: Call `{{activityName}}({{parameters}})`
|
|
250
|
+
4. **{{Step4Name}}**: {{step4Description}}
|
|
251
|
+
5. **Result Assembly**: Structure final output with metadata
|
|
252
|
+
6. **Return**: Complete {{WorkflowName}}Output object
|
|
253
|
+
|
|
254
|
+
**Conditional Logic**:
|
|
255
|
+
{{conditionalRules}}
|
|
256
|
+
</orchestration_template>
|
|
257
|
+
|
|
258
|
+
<workflow_code_template>
|
|
259
|
+
**Workflow File (workflow.ts)**:
|
|
260
|
+
```typescript
|
|
261
|
+
import { workflow } from '@output.ai/core';
|
|
262
|
+
import { {{stepImports}} } from './steps.js';
|
|
263
|
+
import type { {{WorkflowName}}Input, {{WorkflowName}}Output } from './types.js';
|
|
264
|
+
|
|
265
|
+
export default workflow({
|
|
266
|
+
name: '{{workflowName}}',
|
|
267
|
+
description: '{{workflowDescription}}',
|
|
268
|
+
inputSchema: {
|
|
269
|
+
type: 'object',
|
|
270
|
+
required: [{{requiredFields}}],
|
|
271
|
+
properties: {
|
|
272
|
+
{{fieldName}}: { type: '{{fieldType}}' }
|
|
273
|
+
// Define all input fields
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
outputSchema: {
|
|
277
|
+
type: 'object',
|
|
278
|
+
required: [{{outputRequiredFields}}],
|
|
279
|
+
properties: {
|
|
280
|
+
result: { type: 'string' }
|
|
281
|
+
// Define output structure
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
fn: async (input: {{WorkflowName}}Input): Promise<{{WorkflowName}}Output> => {
|
|
285
|
+
// Workflow orchestration logic
|
|
286
|
+
{{orchestrationSteps}}
|
|
287
|
+
|
|
288
|
+
// Example step invocation:
|
|
289
|
+
// const result = await {{stepName}}({ {{stepParams}} });
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
result: {{resultValue}}
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
</workflow_code_template>
|
|
298
|
+
|
|
299
|
+
</step>
|
|
300
|
+
|
|
301
|
+
<step number="7" name="plan_document_creation">
|
|
302
|
+
|
|
303
|
+
### Step 7: Create Plan Document
|
|
304
|
+
|
|
305
|
+
<plan_structure>
|
|
306
|
+
# Workflow Plan: {{WorkflowName}}
|
|
307
|
+
|
|
308
|
+
## Overview
|
|
309
|
+
- **Purpose**: {{purpose}}
|
|
310
|
+
- **Use Case**: {{useCase}}
|
|
311
|
+
- **Key Features**: {{features}}
|
|
312
|
+
|
|
313
|
+
## Technical Specifications
|
|
314
|
+
{{schemaDefinitions}}
|
|
315
|
+
|
|
316
|
+
## Activity Specifications
|
|
317
|
+
{{activityDefinitions}}
|
|
318
|
+
|
|
319
|
+
## Prompt Specifications (if applicable)
|
|
320
|
+
{{promptDefinitions}}
|
|
321
|
+
|
|
322
|
+
## Workflow Orchestration
|
|
323
|
+
{{orchestrationLogic}}
|
|
324
|
+
|
|
325
|
+
## Implementation Checklist
|
|
326
|
+
- [ ] Create workflow directory structure
|
|
327
|
+
- [ ] Implement input/output schemas
|
|
328
|
+
- [ ] Create activity functions
|
|
329
|
+
- [ ] Design prompt templates (if needed)
|
|
330
|
+
- [ ] Implement workflow logic
|
|
331
|
+
- [ ] Add to entrypoint.ts
|
|
332
|
+
- [ ] Write unit tests
|
|
333
|
+
- [ ] Test with flow-cli
|
|
334
|
+
- [ ] Run integration tests
|
|
335
|
+
- [ ] Update documentation
|
|
336
|
+
</plan_structure>
|
|
337
|
+
|
|
338
|
+
<file_location>
|
|
339
|
+
workflow_plans/{{workflowName}}-plan.md
|
|
340
|
+
</file_location>
|
|
341
|
+
|
|
342
|
+
</step>
|
|
343
|
+
|
|
344
|
+
<step number="8" subagent="workflow_planner" name="testing_strategy">
|
|
345
|
+
|
|
346
|
+
### Step 8: Define Testing Strategy
|
|
347
|
+
|
|
348
|
+
Use the workflow_planner subagent to create comprehensive testing requirements.
|
|
349
|
+
|
|
350
|
+
<test_scenarios>
|
|
351
|
+
## Testing Plan
|
|
352
|
+
|
|
353
|
+
### Happy Path Tests
|
|
354
|
+
1. **Complete Input**: All fields provided, successful execution
|
|
355
|
+
2. **Minimal Input**: Required fields only
|
|
356
|
+
3. **Variations**: Different input combinations
|
|
357
|
+
|
|
358
|
+
### Edge Cases
|
|
359
|
+
1. **Boundary Values**: Min/max values, empty strings
|
|
360
|
+
2. **Special Characters**: Unicode, punctuation
|
|
361
|
+
3. **Optional Fields**: With/without optional data
|
|
362
|
+
|
|
363
|
+
### Error Scenarios
|
|
364
|
+
1. **Invalid Input**: Malformed data, wrong types
|
|
365
|
+
2. **Service Failures**: API errors, timeouts
|
|
366
|
+
3. **Schema Violations**: Invalid responses
|
|
367
|
+
|
|
368
|
+
### Performance Tests
|
|
369
|
+
1. **Response Time**: Must complete within {{timeout}}
|
|
370
|
+
2. **Concurrent Execution**: Multiple workflow instances
|
|
371
|
+
3. **Resource Usage**: Monitor memory and CPU
|
|
372
|
+
</test_scenarios>
|
|
373
|
+
|
|
374
|
+
<test_commands>
|
|
375
|
+
```bash
|
|
376
|
+
# Build the workflow
|
|
377
|
+
npm run build
|
|
378
|
+
|
|
379
|
+
# Start the worker (in one terminal)
|
|
380
|
+
npm run start # or flow-worker
|
|
381
|
+
|
|
382
|
+
# Execute workflow (in another terminal or via API)
|
|
383
|
+
# Via API endpoint if configured
|
|
384
|
+
curl -X POST http://localhost:3000/workflows/{{workflowName}} \
|
|
385
|
+
-H "Content-Type: application/json" \
|
|
386
|
+
-d '{{testPayload}}'
|
|
387
|
+
|
|
388
|
+
# Run validation
|
|
389
|
+
./run.sh validate
|
|
390
|
+
|
|
391
|
+
# Development mode with Docker
|
|
392
|
+
./run.sh dev
|
|
393
|
+
```
|
|
394
|
+
</test_commands>
|
|
395
|
+
|
|
396
|
+
</step>
|
|
397
|
+
|
|
398
|
+
<step number="9" name="review_checkpoint">
|
|
399
|
+
|
|
400
|
+
### Step 9: Review and Approval
|
|
401
|
+
|
|
402
|
+
Request user review of the workflow plan before proceeding to implementation.
|
|
403
|
+
|
|
404
|
+
<review_template>
|
|
405
|
+
I've completed the workflow plan for {{workflowName}}:
|
|
406
|
+
|
|
407
|
+
📋 **Plan Document**: `workflow_plans/{{workflowName}}-plan.md`
|
|
408
|
+
|
|
409
|
+
The plan includes:
|
|
410
|
+
- Complete input/output schemas with Zod validation
|
|
411
|
+
- {{activityCount}} activity specifications with error handling
|
|
412
|
+
- Workflow orchestration logic
|
|
413
|
+
- Comprehensive testing strategy
|
|
414
|
+
- Implementation checklist
|
|
415
|
+
|
|
416
|
+
Please review the plan and let me know if any modifications are needed.
|
|
417
|
+
</review_template>
|
|
418
|
+
|
|
419
|
+
</step>
|
|
420
|
+
|
|
421
|
+
</process_flow>
|
|
422
|
+
|
|
423
|
+
<post_flight_check>
|
|
424
|
+
EXECUTE: @{{projectPath}}/.outputai/instructions/meta/post_flight.md
|
|
425
|
+
</post_flight_check>
|
|
426
|
+
|
|
427
|
+
## Command Usage
|
|
428
|
+
|
|
429
|
+
### Basic Planning
|
|
430
|
+
```
|
|
431
|
+
/plan-workflow "Process customer support tickets using AI categorization"
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### With Complexity Hints
|
|
435
|
+
```
|
|
436
|
+
/plan-workflow "Multi-step data pipeline with validation" --complexity=complex --integrations=apis,llm
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Integration-Heavy Workflow
|
|
440
|
+
```
|
|
441
|
+
/plan-workflow "E-commerce order fulfillment" --integrations=payment,inventory,shipping
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
## Quality Standards
|
|
445
|
+
|
|
446
|
+
### Plan Completeness
|
|
447
|
+
- All schemas defined with exact types
|
|
448
|
+
- Every activity specified with I/O and processing logic
|
|
449
|
+
- External services identified with SDK references
|
|
450
|
+
- Error handling complete for all scenarios
|
|
451
|
+
- Testing scenarios documented with commands
|
|
452
|
+
|
|
453
|
+
### Output SDK Compliance
|
|
454
|
+
- ES module imports with .js extensions
|
|
455
|
+
- Use @output.ai/core for workflow and step functions
|
|
456
|
+
- Use @output.ai/llm for AI operations
|
|
457
|
+
- Use @output.ai/prompt for prompt loading
|
|
458
|
+
- Use FatalError from @output.ai/core for non-retryable errors
|
|
459
|
+
- Follow established workflow file structure (workflow.ts, steps.ts, types.ts, *.prompt)
|
|
460
|
+
|
|
461
|
+
### Implementation Readiness
|
|
462
|
+
- Developer can implement without clarification
|
|
463
|
+
- All code examples compile without modification
|
|
464
|
+
- Testing approach is comprehensive
|
|
465
|
+
- Performance requirements are measurable
|
|
466
|
+
- Documentation is clear and actionable
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Post-Flight Validation for Output SDK Workflow Operations
|
|
3
|
+
version: 1.0
|
|
4
|
+
encoding: UTF-8
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Post-Flight Rules for Output SDK Workflows
|
|
8
|
+
|
|
9
|
+
## Execution Verification
|
|
10
|
+
|
|
11
|
+
After completing all steps in the process_flow, systematically verify:
|
|
12
|
+
|
|
13
|
+
### Step Completion Audit
|
|
14
|
+
- [ ] Every numbered step has been read, executed, and delivered according to its instructions
|
|
15
|
+
- [ ] All steps that specified a subagent were delegated to the correct subagent
|
|
16
|
+
- [ ] If any subagent was not used as specified, document why and report to the user
|
|
17
|
+
- [ ] If any step was not executed according to instructions, explain which part was misread or skipped
|
|
18
|
+
|
|
19
|
+
### Output SDK Convention Compliance
|
|
20
|
+
|
|
21
|
+
Verify the following conventions were followed:
|
|
22
|
+
|
|
23
|
+
#### Import Conventions
|
|
24
|
+
- [ ] All TypeScript/JavaScript imports use `.js` extension for ES modules
|
|
25
|
+
- [ ] No direct axios usage - HttpClient wrapper used throughout
|
|
26
|
+
- [ ] Proper import paths for Output SDK packages (@flowsdk/core, @flowsdk/llm, etc.)
|
|
27
|
+
|
|
28
|
+
#### Workflow Structure
|
|
29
|
+
- [ ] Workflow exported in entrypoint.ts: `export * from './path/to/workflow.js';`
|
|
30
|
+
- [ ] All external operations wrapped in Temporal activities (steps)
|
|
31
|
+
- [ ] Proper error handling with ApplicationFailure patterns
|
|
32
|
+
- [ ] Retry policies configured appropriately
|
|
33
|
+
|
|
34
|
+
#### Documentation & Testing
|
|
35
|
+
- [ ] Comprehensive plan document created with all required sections
|
|
36
|
+
- [ ] Testing strategy defined with specific test scenarios
|
|
37
|
+
- [ ] Implementation checklist provided for developers
|
|
38
|
+
- [ ] All code examples are complete and would compile
|
|
39
|
+
|
|
40
|
+
## Quality Validation
|
|
41
|
+
|
|
42
|
+
### Plan Completeness Check
|
|
43
|
+
Ensure the workflow plan includes:
|
|
44
|
+
- [ ] **Overview**: Clear purpose and use case definition
|
|
45
|
+
- [ ] **Technical Specifications**: Complete input/output schemas with Zod validation
|
|
46
|
+
- [ ] **Activity Definitions**: Each activity fully specified with purpose, I/O, and error handling
|
|
47
|
+
- [ ] **Prompt Engineering**: LLM prompts designed (if applicable) with template variables
|
|
48
|
+
- [ ] **Orchestration Logic**: Step-by-step workflow execution flow
|
|
49
|
+
- [ ] **Retry Policies**: Configured for each activity with appropriate timeouts
|
|
50
|
+
- [ ] **Testing Requirements**: Comprehensive test scenarios and commands
|
|
51
|
+
|
|
52
|
+
### Implementation Readiness
|
|
53
|
+
Confirm the plan is ready for implementation:
|
|
54
|
+
- [ ] All schemas defined with exact field types and descriptions
|
|
55
|
+
- [ ] Every activity specified with input/output/processing logic
|
|
56
|
+
- [ ] External services identified with specific SDK client references
|
|
57
|
+
- [ ] Error handling complete for all failure scenarios
|
|
58
|
+
- [ ] Testing scenarios documented with expected outcomes
|
|
59
|
+
- [ ] Performance requirements clear with measurable criteria
|
|
60
|
+
|
|
61
|
+
## Deliverable Verification
|
|
62
|
+
|
|
63
|
+
### Required Outputs
|
|
64
|
+
Verify these deliverables were created or updated:
|
|
65
|
+
- [ ] Workflow plan document with full specifications
|
|
66
|
+
- [ ] Activity schemas with Zod validation
|
|
67
|
+
- [ ] Prompt templates (if LLM integration required)
|
|
68
|
+
- [ ] Testing strategy with specific commands
|
|
69
|
+
- [ ] Implementation checklist for developers
|
|
70
|
+
|
|
71
|
+
### Next Steps Documentation
|
|
72
|
+
Ensure the following guidance is provided:
|
|
73
|
+
- [ ] Clear handoff to implementation phase
|
|
74
|
+
- [ ] Specific Output SDK CLI commands to execute
|
|
75
|
+
- [ ] Dependencies to install (if any)
|
|
76
|
+
- [ ] Configuration requirements documented
|
|
77
|
+
- [ ] Success criteria clearly defined
|
|
78
|
+
|
|
79
|
+
## Error Reporting
|
|
80
|
+
|
|
81
|
+
If any issues were encountered:
|
|
82
|
+
1. Document the specific issue and step where it occurred
|
|
83
|
+
2. Explain any deviations from the planned process
|
|
84
|
+
3. Provide recommendations for resolution
|
|
85
|
+
4. Note any missing information that prevented completion
|
|
86
|
+
|
|
87
|
+
## Final Validation
|
|
88
|
+
|
|
89
|
+
Before marking the workflow planning complete:
|
|
90
|
+
- [ ] Developer can implement without additional clarification
|
|
91
|
+
- [ ] All Output SDK patterns and conventions are followed
|
|
92
|
+
- [ ] Testing approach is comprehensive and executable
|
|
93
|
+
- [ ] Documentation is clear and complete
|
|
94
|
+
- [ ] Plan aligns with project's existing workflow patterns
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Pre-Flight Checks for Output SDK Workflow Operations
|
|
3
|
+
version: 1.0
|
|
4
|
+
encoding: UTF-8
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Pre-Flight Rules for Output SDK Workflows
|
|
8
|
+
|
|
9
|
+
## Execution Requirements
|
|
10
|
+
|
|
11
|
+
- **CRITICAL**: For any step that specifies a subagent in the `subagent=""` XML attribute, you MUST use the specified subagent to perform the instructions for that step
|
|
12
|
+
- Process all XML blocks sequentially and completely
|
|
13
|
+
- Execute every numbered step in the process_flow EXACTLY as specified
|
|
14
|
+
|
|
15
|
+
## Output SDK Conventions Check
|
|
16
|
+
|
|
17
|
+
Before proceeding with any workflow operation, verify:
|
|
18
|
+
|
|
19
|
+
- **ES Modules**: All imports MUST use `.js` extension for ESM modules
|
|
20
|
+
- **HTTP Client**: NEVER use axios directly - always use @output.ai/http wrapper
|
|
21
|
+
- **LLM Client**: NEVER use a direct llm call - always use @output.ai/llm wrapper
|
|
22
|
+
- **Worker Restarts**: Remember to restart worker after creating workflows: `overmind restart worker`
|
|
23
|
+
- **Documentation**: Run `yarn g:workflow-doc` after modifications
|
|
24
|
+
|
|
25
|
+
## Requirements Gathering Strategy
|
|
26
|
+
|
|
27
|
+
### Smart Defaults Application
|
|
28
|
+
When information is not explicitly provided, apply these defaults:
|
|
29
|
+
- **Retry Policies**: 3 attempts with exponential backoff (1s initial, 10s max)
|
|
30
|
+
- **OpenAI Models**: Use `gpt-4o` unless specified otherwise
|
|
31
|
+
- **Error Handling**: ApplicationFailure patterns with appropriate error types
|
|
32
|
+
- **Performance**: Optimize for clarity and maintainability over raw speed
|
|
33
|
+
- **Timeouts**: 30 seconds for activities, 5 minutes for workflows
|
|
34
|
+
|
|
35
|
+
### Critical Information Requirements
|
|
36
|
+
Only stop to ask for clarification on:
|
|
37
|
+
- Ambiguous input/output structures that cannot be inferred from context
|
|
38
|
+
- Specific API keys or services not commonly used in the project
|
|
39
|
+
- Non-standard error handling or recovery requirements
|
|
40
|
+
- Complex orchestration patterns requiring specific sequencing
|
|
41
|
+
- External dependencies not already in the project
|
|
42
|
+
|
|
43
|
+
## Template Processing Rules
|
|
44
|
+
|
|
45
|
+
- Use exact templates as provided in each step
|
|
46
|
+
- Replace all template variables with actual values:
|
|
47
|
+
- `{{workflowName}}` - The workflow being planned
|
|
48
|
+
- `{{projectPath}}` - Root project directory path
|
|
49
|
+
- `{{requirements}}` - User-provided requirements
|
|
50
|
+
- `{{currentDate}}` - Current date in YYYY-MM-DD format
|
|
51
|
+
- `{{sdkVersion}}` - Current Output SDK version
|
|
52
|
+
|
|
53
|
+
## Quality Gates
|
|
54
|
+
|
|
55
|
+
Before proceeding past pre-flight:
|
|
56
|
+
1. Confirm all required context is available
|
|
57
|
+
2. Verify understanding of the workflow's purpose
|
|
58
|
+
3. Check for existing similar workflows to use as patterns
|
|
59
|
+
4. Ensure Output SDK conventions are understood
|
|
60
|
+
5. Validate that necessary subagents are available
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
This workflow was generated using the
|
|
7
|
+
This workflow was generated using the Output SDK CLI. It provides a starting point for building Temporal-based workflows with LLM integration.
|
|
8
8
|
|
|
9
9
|
## Files
|
|
10
10
|
|
|
@@ -63,7 +63,7 @@ Example:
|
|
|
63
63
|
|
|
64
64
|
### Workflow Structure
|
|
65
65
|
|
|
66
|
-
The workflow follows the new
|
|
66
|
+
The workflow follows the new Output SDK conventions:
|
|
67
67
|
|
|
68
68
|
```typescript
|
|
69
69
|
import { workflow } from '@output.ai/core';
|
|
@@ -159,8 +159,8 @@ export const llmStep = step( {
|
|
|
159
159
|
},
|
|
160
160
|
outputSchema: { type: 'string' },
|
|
161
161
|
fn: async ( input: { userInput: string } ) => {
|
|
162
|
-
const prompt = loadPrompt( 'prompt@v1', {
|
|
163
|
-
userInput: input.userInput
|
|
162
|
+
const prompt = loadPrompt( 'prompt@v1', {
|
|
163
|
+
userInput: input.userInput
|
|
164
164
|
} );
|
|
165
165
|
const response = await generateText( prompt as Prompt );
|
|
166
166
|
return response;
|
|
@@ -193,7 +193,7 @@ To test your workflow:
|
|
|
193
193
|
|
|
194
194
|
1. Build the parent project containing this workflow
|
|
195
195
|
2. Start the Flow worker
|
|
196
|
-
3. Execute the workflow using the
|
|
196
|
+
3. Execute the workflow using the Output SDK API
|
|
197
197
|
|
|
198
198
|
Example execution:
|
|
199
199
|
```bash
|
|
@@ -210,6 +210,6 @@ curl -X POST http://localhost:3001/workflow \
|
|
|
210
210
|
|
|
211
211
|
## Resources
|
|
212
212
|
|
|
213
|
-
- [
|
|
213
|
+
- [Output SDK Documentation](https://github.com/growthxai/flow-sdk)
|
|
214
214
|
- [Temporal Documentation](https://docs.temporal.io)
|
|
215
215
|
- [AI SDK Documentation](https://sdk.vercel.ai/docs)
|
|
@@ -5,7 +5,7 @@ import { exampleLLMStep, processDataStep } from './steps.js';
|
|
|
5
5
|
const inputSchema = {
|
|
6
6
|
type: 'object',
|
|
7
7
|
properties: {
|
|
8
|
-
prompt: {
|
|
8
|
+
prompt: {
|
|
9
9
|
type: 'string',
|
|
10
10
|
description: 'The prompt to send to the LLM'
|
|
11
11
|
},
|
|
@@ -60,7 +60,7 @@ export default workflow( {
|
|
|
60
60
|
} );
|
|
61
61
|
|
|
62
62
|
// Process data if provided, otherwise use defaults
|
|
63
|
-
const processedData = await processDataStep(
|
|
63
|
+
const processedData = await processDataStep(
|
|
64
64
|
input.data || { value: 42, type: 'default' }
|
|
65
65
|
);
|
|
66
66
|
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const TEMPLATE_DIRS: {
|
|
5
5
|
readonly workflow: string;
|
|
6
|
+
readonly agent_instructions: string;
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
8
9
|
* Default output directories
|
|
@@ -22,3 +23,7 @@ export declare function createTargetDir(outputDir: string, workflowName: string)
|
|
|
22
23
|
* Get the template directory for a specific template type
|
|
23
24
|
*/
|
|
24
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;
|