@fractary/faber 2.4.39 → 2.4.40
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/dist/cli/commands/logs.d.ts.map +1 -1
- package/dist/cli/commands/logs.js.map +1 -1
- package/dist/cli/commands/repo.d.ts.map +1 -1
- package/dist/cli/commands/repo.js.map +1 -1
- package/dist/cli/commands/spec.d.ts.map +1 -1
- package/dist/cli/commands/spec.js.map +1 -1
- package/dist/cli/commands/work.d.ts.map +1 -1
- package/dist/cli/commands/work.js.map +1 -1
- package/dist/cli/commands/workflow.d.ts.map +1 -1
- package/dist/cli/commands/workflow.js.map +1 -1
- package/dist/cli/index.js +5 -5
- package/dist/executors/cli-entry.d.ts +25 -0
- package/dist/executors/cli-entry.d.ts.map +1 -0
- package/dist/executors/cli-entry.js +86 -0
- package/dist/executors/cli-entry.js.map +1 -0
- package/dist/executors/index.d.ts +19 -0
- package/dist/executors/index.d.ts.map +1 -0
- package/dist/executors/index.js +22 -0
- package/dist/executors/index.js.map +1 -0
- package/dist/executors/providers/claude.d.ts +20 -0
- package/dist/executors/providers/claude.d.ts.map +1 -0
- package/dist/executors/providers/claude.js +123 -0
- package/dist/executors/providers/claude.js.map +1 -0
- package/dist/executors/providers/http.d.ts +21 -0
- package/dist/executors/providers/http.d.ts.map +1 -0
- package/dist/executors/providers/http.js +118 -0
- package/dist/executors/providers/http.js.map +1 -0
- package/dist/executors/providers/index.d.ts +10 -0
- package/dist/executors/providers/index.d.ts.map +1 -0
- package/dist/executors/providers/index.js +10 -0
- package/dist/executors/providers/index.js.map +1 -0
- package/dist/executors/providers/openai-compatible.d.ts +21 -0
- package/dist/executors/providers/openai-compatible.d.ts.map +1 -0
- package/dist/executors/providers/openai-compatible.js +136 -0
- package/dist/executors/providers/openai-compatible.js.map +1 -0
- package/dist/executors/providers/openai.d.ts +20 -0
- package/dist/executors/providers/openai.d.ts.map +1 -0
- package/dist/executors/providers/openai.js +121 -0
- package/dist/executors/providers/openai.js.map +1 -0
- package/dist/executors/registry.d.ts +72 -0
- package/dist/executors/registry.d.ts.map +1 -0
- package/dist/executors/registry.js +146 -0
- package/dist/executors/registry.js.map +1 -0
- package/dist/executors/types.d.ts +148 -0
- package/dist/executors/types.d.ts.map +1 -0
- package/dist/executors/types.js +9 -0
- package/dist/executors/types.js.map +1 -0
- package/dist/executors/workflow-executor.d.ts +92 -0
- package/dist/executors/workflow-executor.d.ts.map +1 -0
- package/dist/executors/workflow-executor.js +176 -0
- package/dist/executors/workflow-executor.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/workflow/__tests__/resolver.test.js +20 -20
- package/dist/workflow/resolver.d.ts +71 -2
- package/dist/workflow/resolver.d.ts.map +1 -1
- package/dist/workflow/resolver.js +140 -12
- package/dist/workflow/resolver.js.map +1 -1
- package/dist/workflows/registry.d.ts.map +1 -1
- package/dist/workflows/registry.js +48 -17
- package/dist/workflows/registry.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fractary/faber - Executor Registry
|
|
3
|
+
*
|
|
4
|
+
* Maps provider names to executor implementations and resolves which executor
|
|
5
|
+
* to use for a given step based on the config cascade:
|
|
6
|
+
* step.executor > phase_executors[phase] > workflow.executor > null (default)
|
|
7
|
+
*
|
|
8
|
+
* When resolution returns null, the caller should use the default behavior
|
|
9
|
+
* (Claude Code direct execution in skill mode, or Claude API in CLI mode).
|
|
10
|
+
*/
|
|
11
|
+
import { ClaudeExecutor } from './providers/claude.js';
|
|
12
|
+
import { OpenAIExecutor } from './providers/openai.js';
|
|
13
|
+
import { OpenAICompatibleExecutor } from './providers/openai-compatible.js';
|
|
14
|
+
import { HttpExecutor } from './providers/http.js';
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Registry
|
|
17
|
+
// ============================================================================
|
|
18
|
+
export class ExecutorRegistry {
|
|
19
|
+
executors = new Map();
|
|
20
|
+
instances = new Map();
|
|
21
|
+
/**
|
|
22
|
+
* Register an executor factory for a provider.
|
|
23
|
+
* Factories are called lazily on first use.
|
|
24
|
+
*/
|
|
25
|
+
register(provider, factory) {
|
|
26
|
+
this.executors.set(provider, factory);
|
|
27
|
+
// Clear cached instance if re-registering
|
|
28
|
+
this.instances.delete(provider);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get an executor for a provider. Creates the instance lazily.
|
|
32
|
+
* @throws Error if provider is not registered
|
|
33
|
+
*/
|
|
34
|
+
get(provider) {
|
|
35
|
+
let instance = this.instances.get(provider);
|
|
36
|
+
if (instance)
|
|
37
|
+
return instance;
|
|
38
|
+
const factory = this.executors.get(provider);
|
|
39
|
+
if (!factory) {
|
|
40
|
+
const available = Array.from(this.executors.keys()).join(', ');
|
|
41
|
+
throw new Error(`Executor provider '${provider}' not registered. Available: ${available || 'none'}`);
|
|
42
|
+
}
|
|
43
|
+
instance = factory();
|
|
44
|
+
this.instances.set(provider, instance);
|
|
45
|
+
return instance;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check if a provider is registered.
|
|
49
|
+
*/
|
|
50
|
+
has(provider) {
|
|
51
|
+
return this.executors.has(provider);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* List all registered provider names.
|
|
55
|
+
*/
|
|
56
|
+
listProviders() {
|
|
57
|
+
return Array.from(this.executors.keys());
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Resolve the executor for a step, applying the config cascade.
|
|
61
|
+
*
|
|
62
|
+
* Returns the executor and merged config, or null if no executor is configured
|
|
63
|
+
* (meaning the step should use the default execution path).
|
|
64
|
+
*
|
|
65
|
+
* Cascade order (most specific wins):
|
|
66
|
+
* 1. step.executor — explicit on the step
|
|
67
|
+
* 2. phaseExecutors[phase] — workflow-level per-phase override
|
|
68
|
+
* 3. workflowExecutor — workflow-level default
|
|
69
|
+
*
|
|
70
|
+
* @param step - The workflow step to resolve
|
|
71
|
+
* @param phase - Current phase name
|
|
72
|
+
* @param workflowExecutor - Workflow-level default executor config
|
|
73
|
+
* @param phaseExecutors - Per-phase executor overrides
|
|
74
|
+
* @returns Resolved executor and config, or null if no executor applies
|
|
75
|
+
*/
|
|
76
|
+
resolveForStep(step, phase, workflowExecutor, phaseExecutors) {
|
|
77
|
+
// Cascade: step > phase > workflow
|
|
78
|
+
const config = step.executor ??
|
|
79
|
+
phaseExecutors?.[phase] ??
|
|
80
|
+
workflowExecutor ??
|
|
81
|
+
null;
|
|
82
|
+
if (!config)
|
|
83
|
+
return null;
|
|
84
|
+
const executor = this.get(config.provider);
|
|
85
|
+
return { executor, config };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Validate all executor configs in a resolved workflow.
|
|
89
|
+
* Returns errors for any invalid configurations (missing API keys, etc.).
|
|
90
|
+
* Useful for fast-fail at plan time before execution starts.
|
|
91
|
+
*/
|
|
92
|
+
async validateWorkflow(steps, workflowExecutor, phaseExecutors) {
|
|
93
|
+
const errors = [];
|
|
94
|
+
// Collect all unique configs to validate
|
|
95
|
+
const configsToValidate = new Map();
|
|
96
|
+
if (workflowExecutor) {
|
|
97
|
+
configsToValidate.set(`workflow:${workflowExecutor.provider}`, workflowExecutor);
|
|
98
|
+
}
|
|
99
|
+
if (phaseExecutors) {
|
|
100
|
+
for (const [phase, config] of Object.entries(phaseExecutors)) {
|
|
101
|
+
if (config) {
|
|
102
|
+
configsToValidate.set(`phase:${phase}:${config.provider}`, config);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (let i = 0; i < steps.length; i++) {
|
|
107
|
+
const step = steps[i];
|
|
108
|
+
if (step.executor) {
|
|
109
|
+
configsToValidate.set(`step:${i}:${step.executor.provider}`, step.executor);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Validate each unique config
|
|
113
|
+
for (const [key, config] of configsToValidate) {
|
|
114
|
+
if (!this.has(config.provider)) {
|
|
115
|
+
const [scope, id] = key.split(':');
|
|
116
|
+
errors.push({
|
|
117
|
+
stepIndex: scope === 'step' ? parseInt(id) : -1,
|
|
118
|
+
error: `Provider '${config.provider}' is not registered`,
|
|
119
|
+
});
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const executor = this.get(config.provider);
|
|
123
|
+
const result = await executor.validate(config);
|
|
124
|
+
if (!result.valid) {
|
|
125
|
+
const [scope, id] = key.split(':');
|
|
126
|
+
errors.push({
|
|
127
|
+
stepIndex: scope === 'step' ? parseInt(id) : -1,
|
|
128
|
+
error: result.error || `Validation failed for provider '${config.provider}'`,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return errors;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create a registry with all built-in providers registered.
|
|
136
|
+
*/
|
|
137
|
+
static createDefault() {
|
|
138
|
+
const registry = new ExecutorRegistry();
|
|
139
|
+
registry.register('claude', () => new ClaudeExecutor());
|
|
140
|
+
registry.register('openai', () => new OpenAIExecutor());
|
|
141
|
+
registry.register('openai-compatible', () => new OpenAICompatibleExecutor());
|
|
142
|
+
registry.register('http', () => new HttpExecutor());
|
|
143
|
+
return registry;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/executors/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;A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AAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa;QAClB,MAAM,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAExC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;QACxD,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;QACxD,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI,wBAAwB,EAAE,CAAC,CAAC;QAC7E,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;QAEpD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fractary/faber - Step Executor Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the abstraction layer between workflow steps and the models/services
|
|
5
|
+
* that execute them. Enables multi-model workflows where individual steps can
|
|
6
|
+
* be routed to different providers (Claude, OpenAI, self-hosted LLMs, HTTP APIs).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Executor configuration for a workflow step.
|
|
10
|
+
*
|
|
11
|
+
* When specified on a step, overrides the default execution behavior
|
|
12
|
+
* (Claude Code direct execution) and routes to the specified provider.
|
|
13
|
+
*
|
|
14
|
+
* Config cascade: step.executor > phase_executors[phase] > workflow.executor > system default
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```yaml
|
|
18
|
+
* steps:
|
|
19
|
+
* - id: review-code
|
|
20
|
+
* prompt: "Review this code for security issues..."
|
|
21
|
+
* executor:
|
|
22
|
+
* provider: openai
|
|
23
|
+
* model: gpt-4o
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export interface StepExecutorConfig {
|
|
27
|
+
/**
|
|
28
|
+
* Provider identifier.
|
|
29
|
+
*
|
|
30
|
+
* Built-in providers:
|
|
31
|
+
* - 'claude': Anthropic Messages API (default env: ANTHROPIC_API_KEY)
|
|
32
|
+
* - 'openai': OpenAI Chat Completions API (default env: OPENAI_API_KEY)
|
|
33
|
+
* - 'openai-compatible': Any OpenAI-compatible endpoint (Ollama, vLLM, Together, Groq)
|
|
34
|
+
* - 'http': Generic HTTP POST (for non-LLM APIs like Banana, Replicate)
|
|
35
|
+
* - 'command': Shell command execution
|
|
36
|
+
*/
|
|
37
|
+
provider: string;
|
|
38
|
+
/** Model identifier within the provider (e.g., 'gpt-4o', 'claude-haiku-4-5', 'llama3') */
|
|
39
|
+
model?: string;
|
|
40
|
+
/** Base URL for openai-compatible or http providers */
|
|
41
|
+
base_url?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Environment variable name containing the API key.
|
|
44
|
+
* When omitted, uses provider default (e.g., OPENAI_API_KEY for 'openai').
|
|
45
|
+
*/
|
|
46
|
+
api_key_env?: string;
|
|
47
|
+
/** Maximum tokens for the response */
|
|
48
|
+
max_tokens?: number;
|
|
49
|
+
/** Temperature (0-2) */
|
|
50
|
+
temperature?: number;
|
|
51
|
+
/**
|
|
52
|
+
* System prompt override.
|
|
53
|
+
* Replaces the default system prompt for this step's execution.
|
|
54
|
+
* Useful for specializing model behavior (e.g., "You are an image generation assistant").
|
|
55
|
+
*/
|
|
56
|
+
system_prompt?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Context passed to executors for each step invocation.
|
|
60
|
+
* Provides the executor with information about the workflow, current step,
|
|
61
|
+
* and outputs from previous steps.
|
|
62
|
+
*/
|
|
63
|
+
export interface ExecutionContext {
|
|
64
|
+
/** Work item identifier (e.g., GitHub issue number) */
|
|
65
|
+
workId: string;
|
|
66
|
+
/** Current phase name (frame, architect, build, evaluate, release) */
|
|
67
|
+
phase: string;
|
|
68
|
+
/** Current step ID */
|
|
69
|
+
stepId: string;
|
|
70
|
+
/** Current step display name */
|
|
71
|
+
stepName: string;
|
|
72
|
+
/** Outputs from previously completed steps, keyed by step ID */
|
|
73
|
+
previousOutputs: Record<string, Record<string, unknown>>;
|
|
74
|
+
/** Issue context if available */
|
|
75
|
+
issue?: {
|
|
76
|
+
number: number;
|
|
77
|
+
title: string;
|
|
78
|
+
body: string;
|
|
79
|
+
};
|
|
80
|
+
/** Working directory for file operations */
|
|
81
|
+
workingDirectory: string;
|
|
82
|
+
/** Run ID for state tracking */
|
|
83
|
+
runId?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Result from an executor invocation.
|
|
87
|
+
* Maps to the existing result_handling system (success/warning/failure).
|
|
88
|
+
*/
|
|
89
|
+
export interface ExecutorResult {
|
|
90
|
+
/** The textual output from the executor */
|
|
91
|
+
output: string;
|
|
92
|
+
/** Execution status, aligns with step result_handling */
|
|
93
|
+
status: 'success' | 'warning' | 'failure';
|
|
94
|
+
/** Metadata about the execution */
|
|
95
|
+
metadata: {
|
|
96
|
+
/** Provider that executed this step */
|
|
97
|
+
provider: string;
|
|
98
|
+
/** Model used (if applicable) */
|
|
99
|
+
model?: string;
|
|
100
|
+
/** Execution duration in milliseconds */
|
|
101
|
+
duration_ms: number;
|
|
102
|
+
/** Token usage (if the provider reports it) */
|
|
103
|
+
tokens_used?: {
|
|
104
|
+
input: number;
|
|
105
|
+
output: number;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
/** Error message if status is 'failure' */
|
|
109
|
+
error?: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The Executor interface that all providers implement.
|
|
113
|
+
*
|
|
114
|
+
* Executors are stateless — each `execute()` call is independent.
|
|
115
|
+
* Configuration (API keys, endpoints) comes from the StepExecutorConfig
|
|
116
|
+
* and environment variables.
|
|
117
|
+
*/
|
|
118
|
+
export interface Executor {
|
|
119
|
+
/** Provider name (e.g., 'claude', 'openai', 'http') */
|
|
120
|
+
readonly provider: string;
|
|
121
|
+
/**
|
|
122
|
+
* Execute a step prompt and return the result.
|
|
123
|
+
*
|
|
124
|
+
* @param prompt - The step prompt text (may include context overlays)
|
|
125
|
+
* @param context - Workflow execution context
|
|
126
|
+
* @param config - Executor-specific configuration from the step/workflow
|
|
127
|
+
* @returns Structured result with output, status, and metadata
|
|
128
|
+
*/
|
|
129
|
+
execute(prompt: string, context: ExecutionContext, config: StepExecutorConfig): Promise<ExecutorResult>;
|
|
130
|
+
/**
|
|
131
|
+
* Validate that the executor can run with the given config.
|
|
132
|
+
* Checks for required environment variables, endpoint reachability, etc.
|
|
133
|
+
* Called during plan validation for fast-fail before execution starts.
|
|
134
|
+
*
|
|
135
|
+
* @param config - Executor configuration to validate
|
|
136
|
+
* @returns Validation result with error message if invalid
|
|
137
|
+
*/
|
|
138
|
+
validate(config: StepExecutorConfig): Promise<{
|
|
139
|
+
valid: boolean;
|
|
140
|
+
error?: string;
|
|
141
|
+
}>;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Factory function that creates an Executor instance.
|
|
145
|
+
* Used by the ExecutorRegistry for lazy instantiation.
|
|
146
|
+
*/
|
|
147
|
+
export type ExecutorFactory = () => Executor;
|
|
148
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/executors/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;OASG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,wBAAwB;IACxB,WAAW,CAAC,EAAE,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,MAAM,CAAC;IAE1B;;;;;;;OAOG;IACH,OAAO,CACL,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3B;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnF;AAMD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fractary/faber - Step Executor Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the abstraction layer between workflow steps and the models/services
|
|
5
|
+
* that execute them. Enables multi-model workflows where individual steps can
|
|
6
|
+
* be routed to different providers (Claude, OpenAI, self-hosted LLMs, HTTP APIs).
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/executors/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fractary/faber - Workflow Executor
|
|
3
|
+
*
|
|
4
|
+
* Deterministic workflow executor for CLI-native mode.
|
|
5
|
+
* Code controls the step iteration loop — no LLM needed for orchestration.
|
|
6
|
+
* Each step is dispatched to its configured executor (Claude API, OpenAI, HTTP, etc.).
|
|
7
|
+
*
|
|
8
|
+
* This is the multi-model successor to the legacy FaberWorkflow.run() and the
|
|
9
|
+
* deterministic executor bash prototype (execute-workflow.sh).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const registry = ExecutorRegistry.createDefault();
|
|
14
|
+
* const executor = new WorkflowExecutor(registry);
|
|
15
|
+
* const result = await executor.execute(plan, { workId: '123' });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
import type { ExecutorResult, StepExecutorConfig } from './types.js';
|
|
19
|
+
import { ExecutorRegistry } from './registry.js';
|
|
20
|
+
import type { ResolvedWorkflow, WorkflowStep, StepResultHandling } from '../workflow/resolver.js';
|
|
21
|
+
/** Options for workflow execution */
|
|
22
|
+
export interface WorkflowExecuteOptions {
|
|
23
|
+
/** Work item ID */
|
|
24
|
+
workId: string;
|
|
25
|
+
/** Issue context if available */
|
|
26
|
+
issue?: {
|
|
27
|
+
number: number;
|
|
28
|
+
title: string;
|
|
29
|
+
body: string;
|
|
30
|
+
};
|
|
31
|
+
/** Working directory */
|
|
32
|
+
workingDirectory?: string;
|
|
33
|
+
/** Only run these phases (others are skipped) */
|
|
34
|
+
phasesToRun?: string[];
|
|
35
|
+
/** Only run this specific step */
|
|
36
|
+
stepToRun?: string | null;
|
|
37
|
+
/** Callback for step progress */
|
|
38
|
+
onStepStart?: (phase: string, step: WorkflowStep, index: number, total: number) => void;
|
|
39
|
+
/** Callback for step completion */
|
|
40
|
+
onStepComplete?: (phase: string, step: WorkflowStep, result: ExecutorResult) => void;
|
|
41
|
+
/** Callback for phase start */
|
|
42
|
+
onPhaseStart?: (phase: string) => void;
|
|
43
|
+
/** Callback for phase complete */
|
|
44
|
+
onPhaseComplete?: (phase: string, status: 'completed' | 'failed' | 'skipped') => void;
|
|
45
|
+
}
|
|
46
|
+
/** Result from a complete workflow execution */
|
|
47
|
+
export interface WorkflowExecuteResult {
|
|
48
|
+
status: 'completed' | 'failed' | 'paused';
|
|
49
|
+
phases: PhaseExecuteResult[];
|
|
50
|
+
duration_ms: number;
|
|
51
|
+
steps_completed: number;
|
|
52
|
+
steps_total: number;
|
|
53
|
+
}
|
|
54
|
+
/** Result from a single phase */
|
|
55
|
+
export interface PhaseExecuteResult {
|
|
56
|
+
phase: string;
|
|
57
|
+
status: 'completed' | 'failed' | 'skipped';
|
|
58
|
+
steps: StepExecuteResult[];
|
|
59
|
+
duration_ms: number;
|
|
60
|
+
}
|
|
61
|
+
/** Result from a single step */
|
|
62
|
+
export interface StepExecuteResult {
|
|
63
|
+
stepId: string;
|
|
64
|
+
stepName: string;
|
|
65
|
+
result: ExecutorResult;
|
|
66
|
+
}
|
|
67
|
+
export declare class WorkflowExecutor {
|
|
68
|
+
private registry;
|
|
69
|
+
constructor(registry: ExecutorRegistry);
|
|
70
|
+
/**
|
|
71
|
+
* Execute a resolved workflow.
|
|
72
|
+
*
|
|
73
|
+
* Iterates through phases and steps deterministically.
|
|
74
|
+
* For each step, resolves the executor from the config cascade
|
|
75
|
+
* and dispatches execution.
|
|
76
|
+
*
|
|
77
|
+
* Steps without an executor config use the Claude API executor
|
|
78
|
+
* as the default (since we're in CLI mode, not Claude Code).
|
|
79
|
+
*/
|
|
80
|
+
execute(workflow: {
|
|
81
|
+
phases: ResolvedWorkflow['phases'];
|
|
82
|
+
executor?: StepExecutorConfig;
|
|
83
|
+
phase_executors?: Partial<Record<string, StepExecutorConfig>>;
|
|
84
|
+
result_handling?: StepResultHandling;
|
|
85
|
+
}, options: WorkflowExecuteOptions): Promise<WorkflowExecuteResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Resolve result handling for a step using the cascade:
|
|
88
|
+
* step > phase > workflow > defaults
|
|
89
|
+
*/
|
|
90
|
+
private resolveResultHandling;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=workflow-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-executor.d.ts","sourceRoot":"","sources":["../../src/executors/workflow-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAEV,cAAc,EACd,kBAAkB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAE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AkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC3C,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,gCAAgC;AAChC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;CACxB;AAMD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,gBAAgB;IAE9C;;;;;;;;;OASG;IACG,OAAO,CACX,QAAQ,EAAE;QACR,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACnC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;QAC9B,eAAe,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;QAC9D,eAAe,CAAC,EAAE,kBAAkB,CAAC;KACtC,EACD,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC;IAoJjC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;CAuB9B"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fractary/faber - Workflow Executor
|
|
3
|
+
*
|
|
4
|
+
* Deterministic workflow executor for CLI-native mode.
|
|
5
|
+
* Code controls the step iteration loop — no LLM needed for orchestration.
|
|
6
|
+
* Each step is dispatched to its configured executor (Claude API, OpenAI, HTTP, etc.).
|
|
7
|
+
*
|
|
8
|
+
* This is the multi-model successor to the legacy FaberWorkflow.run() and the
|
|
9
|
+
* deterministic executor bash prototype (execute-workflow.sh).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const registry = ExecutorRegistry.createDefault();
|
|
14
|
+
* const executor = new WorkflowExecutor(registry);
|
|
15
|
+
* const result = await executor.execute(plan, { workId: '123' });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Types
|
|
20
|
+
// ============================================================================
|
|
21
|
+
/** Phase names in execution order */
|
|
22
|
+
const PHASE_ORDER = ['frame', 'architect', 'build', 'evaluate', 'release'];
|
|
23
|
+
// ============================================================================
|
|
24
|
+
// Workflow Executor
|
|
25
|
+
// ============================================================================
|
|
26
|
+
export class WorkflowExecutor {
|
|
27
|
+
registry;
|
|
28
|
+
constructor(registry) {
|
|
29
|
+
this.registry = registry;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Execute a resolved workflow.
|
|
33
|
+
*
|
|
34
|
+
* Iterates through phases and steps deterministically.
|
|
35
|
+
* For each step, resolves the executor from the config cascade
|
|
36
|
+
* and dispatches execution.
|
|
37
|
+
*
|
|
38
|
+
* Steps without an executor config use the Claude API executor
|
|
39
|
+
* as the default (since we're in CLI mode, not Claude Code).
|
|
40
|
+
*/
|
|
41
|
+
async execute(workflow, options) {
|
|
42
|
+
const startTime = Date.now();
|
|
43
|
+
const phaseResults = [];
|
|
44
|
+
let totalStepsCompleted = 0;
|
|
45
|
+
let totalSteps = 0;
|
|
46
|
+
let workflowFailed = false;
|
|
47
|
+
// Count total steps
|
|
48
|
+
for (const phaseName of PHASE_ORDER) {
|
|
49
|
+
const phase = workflow.phases[phaseName];
|
|
50
|
+
if (phase.enabled) {
|
|
51
|
+
totalSteps += phase.steps.length;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Track outputs from previous steps for context
|
|
55
|
+
const previousOutputs = {};
|
|
56
|
+
for (const phaseName of PHASE_ORDER) {
|
|
57
|
+
const phase = workflow.phases[phaseName];
|
|
58
|
+
// Skip disabled phases
|
|
59
|
+
if (!phase.enabled) {
|
|
60
|
+
phaseResults.push({
|
|
61
|
+
phase: phaseName,
|
|
62
|
+
status: 'skipped',
|
|
63
|
+
steps: [],
|
|
64
|
+
duration_ms: 0,
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
// Skip if not in phasesToRun filter
|
|
69
|
+
if (options.phasesToRun && !options.phasesToRun.includes(phaseName)) {
|
|
70
|
+
phaseResults.push({
|
|
71
|
+
phase: phaseName,
|
|
72
|
+
status: 'skipped',
|
|
73
|
+
steps: [],
|
|
74
|
+
duration_ms: 0,
|
|
75
|
+
});
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
// Execute phase
|
|
79
|
+
options.onPhaseStart?.(phaseName);
|
|
80
|
+
const phaseStartTime = Date.now();
|
|
81
|
+
const stepResults = [];
|
|
82
|
+
let phaseFailed = false;
|
|
83
|
+
for (let i = 0; i < phase.steps.length; i++) {
|
|
84
|
+
const step = phase.steps[i];
|
|
85
|
+
// If stepToRun is specified, skip all other steps
|
|
86
|
+
if (options.stepToRun && step.id !== options.stepToRun) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
options.onStepStart?.(phaseName, step, i, phase.steps.length);
|
|
90
|
+
// Build execution context
|
|
91
|
+
const context = {
|
|
92
|
+
workId: options.workId,
|
|
93
|
+
phase: phaseName,
|
|
94
|
+
stepId: step.id,
|
|
95
|
+
stepName: step.name,
|
|
96
|
+
previousOutputs,
|
|
97
|
+
issue: options.issue,
|
|
98
|
+
workingDirectory: options.workingDirectory || process.cwd(),
|
|
99
|
+
};
|
|
100
|
+
// Resolve executor (cascade: step > phase > workflow > default 'claude')
|
|
101
|
+
const resolved = this.registry.resolveForStep(step, phaseName, workflow.executor, workflow.phase_executors);
|
|
102
|
+
let result;
|
|
103
|
+
if (resolved) {
|
|
104
|
+
// Execute with the resolved executor
|
|
105
|
+
result = await resolved.executor.execute(step.prompt, context, resolved.config);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// No executor configured — use claude as default in CLI mode
|
|
109
|
+
const claudeExecutor = this.registry.get('claude');
|
|
110
|
+
result = await claudeExecutor.execute(step.prompt, context, { provider: 'claude' });
|
|
111
|
+
}
|
|
112
|
+
stepResults.push({
|
|
113
|
+
stepId: step.id,
|
|
114
|
+
stepName: step.name,
|
|
115
|
+
result,
|
|
116
|
+
});
|
|
117
|
+
// Track outputs
|
|
118
|
+
previousOutputs[step.id] = {
|
|
119
|
+
output: result.output,
|
|
120
|
+
status: result.status,
|
|
121
|
+
};
|
|
122
|
+
totalStepsCompleted++;
|
|
123
|
+
options.onStepComplete?.(phaseName, step, result);
|
|
124
|
+
// Handle step result
|
|
125
|
+
if (result.status === 'failure') {
|
|
126
|
+
const handling = this.resolveResultHandling(step, phase, workflow);
|
|
127
|
+
if (handling.on_failure === 'stop') {
|
|
128
|
+
phaseFailed = true;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
// If on_failure is not 'stop', continue to next step
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const phaseStatus = phaseFailed ? 'failed' : 'completed';
|
|
135
|
+
phaseResults.push({
|
|
136
|
+
phase: phaseName,
|
|
137
|
+
status: phaseStatus,
|
|
138
|
+
steps: stepResults,
|
|
139
|
+
duration_ms: Date.now() - phaseStartTime,
|
|
140
|
+
});
|
|
141
|
+
options.onPhaseComplete?.(phaseName, phaseStatus);
|
|
142
|
+
if (phaseFailed) {
|
|
143
|
+
workflowFailed = true;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
status: workflowFailed ? 'failed' : 'completed',
|
|
149
|
+
phases: phaseResults,
|
|
150
|
+
duration_ms: Date.now() - startTime,
|
|
151
|
+
steps_completed: totalStepsCompleted,
|
|
152
|
+
steps_total: totalSteps,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Resolve result handling for a step using the cascade:
|
|
157
|
+
* step > phase > workflow > defaults
|
|
158
|
+
*/
|
|
159
|
+
resolveResultHandling(step, phase, workflow) {
|
|
160
|
+
return {
|
|
161
|
+
on_success: step.result_handling?.on_success ??
|
|
162
|
+
phase.result_handling?.on_success ??
|
|
163
|
+
workflow.result_handling?.on_success ??
|
|
164
|
+
'continue',
|
|
165
|
+
on_warning: step.result_handling?.on_warning ??
|
|
166
|
+
phase.result_handling?.on_warning ??
|
|
167
|
+
workflow.result_handling?.on_warning ??
|
|
168
|
+
'continue',
|
|
169
|
+
on_failure: step.result_handling?.on_failure ??
|
|
170
|
+
phase.result_handling?.on_failure ??
|
|
171
|
+
workflow.result_handling?.on_failure ??
|
|
172
|
+
'stop',
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=workflow-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-executor.js","sourceRoot":"","sources":["../../src/executors/workflow-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAeH,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E,qCAAqC;AACrC,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AA+CpF,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;IAAG,CAAC;IAElD;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO,CACX,QAKC,EACD,OAA+B;QAE/B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,YAAY,GAAyB,EAAE,CAAC;QAC9C,IAAI,mBAAmB,GAAG,CAAC,CAAC;QAC5B,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,cAAc,GAAG,KAAK,CAAC;QAE3B,oBAAoB;QACpB,KAAK,MAAM,SAAS,IAAI,WAAW,EAAE,CAAC;YACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,S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G,SAAS;YACnC,eAAe,EAAE,mBAAmB;YACpC,WAAW,EAAE,UAAU;SACxB,CAAC;IACJ,CAAC;IAED;;;OAGG;IACK,qBAAqB,CAC3B,IAAkB,EAClB,KAAoB,EACpB,QAAkD;QAElD,OAAO;YACL,UAAU,EACR,IAAI,CAAC,eAAe,EAAE,UAAU;gBAChC,KAAK,CAAC,eAAe,EAAE,UAAU;gBACjC,QAAQ,CAAC,eAAe,EAAE,UAAU;gBACpC,UAAU;YACZ,UAAU,EACR,IAAI,CAAC,eAAe,EAAE,UAAU;gBAChC,KAAK,CAAC,eAAe,EAAE,UAAU;gBACjC,QAAQ,CAAC,eAAe,EAAE,UAAU;gBACpC,UAAU;YACZ,UAAU,EACR,IAAI,CAAC,eAAe,EAAE,UAAU;gBAChC,KAAK,CAAC,eAAe,EAAE,UAAU;gBACjC,QAAQ,CAAC,eAAe,EAAE,UAAU;gBACpC,MAAM;SACT,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - workflow: FABER workflow orchestration
|
|
12
12
|
* - storage: Artifact storage (local and Codex integration)
|
|
13
13
|
* - agents: Agent type templates and selection
|
|
14
|
+
* - executors: Multi-model step execution framework
|
|
14
15
|
*/
|
|
15
16
|
export * from './types.js';
|
|
16
17
|
export * from './errors.js';
|
|
@@ -26,5 +27,6 @@ export * from './workflow/index.js';
|
|
|
26
27
|
export * from './storage/index.js';
|
|
27
28
|
export * from './agents/index.js';
|
|
28
29
|
export * from './changelog/index.js';
|
|
30
|
+
export * from './executors/index.js';
|
|
29
31
|
export * from './auth/index.js';
|
|
30
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAG9B,cAAc,yBAAyB,CAAC;AAGxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - workflow: FABER workflow orchestration
|
|
12
12
|
* - storage: Artifact storage (local and Codex integration)
|
|
13
13
|
* - agents: Agent type templates and selection
|
|
14
|
+
* - executors: Multi-model step execution framework
|
|
14
15
|
*/
|
|
15
16
|
// Core exports
|
|
16
17
|
export * from './types.js';
|
|
@@ -29,6 +30,8 @@ export * from './workflow/index.js';
|
|
|
29
30
|
export * from './storage/index.js';
|
|
30
31
|
export * from './agents/index.js';
|
|
31
32
|
export * from './changelog/index.js';
|
|
33
|
+
// Executors module
|
|
34
|
+
export * from './executors/index.js';
|
|
32
35
|
// Auth module
|
|
33
36
|
export * from './auth/index.js';
|
|
34
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAe;AACf,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAE9B,oBAAoB;AACpB,cAAc,yBAAyB,CAAC;AAExC,iBAAiB;AACjB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AAErC,mBAAmB;AACnB,cAAc,sBAAsB,CAAC;AAErC,cAAc;AACd,cAAc,iBAAiB,CAAC"}
|