@fractary/faber 1.0.2 → 1.2.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 (52) hide show
  1. package/README.md +12 -0
  2. package/dist/__tests__/config.test.d.ts +7 -0
  3. package/dist/__tests__/config.test.d.ts.map +1 -0
  4. package/dist/__tests__/config.test.js +297 -0
  5. package/dist/__tests__/config.test.js.map +1 -0
  6. package/dist/__tests__/integration/forge-integration.test.d.ts +7 -0
  7. package/dist/__tests__/integration/forge-integration.test.d.ts.map +1 -0
  8. package/dist/__tests__/integration/forge-integration.test.js +370 -0
  9. package/dist/__tests__/integration/forge-integration.test.js.map +1 -0
  10. package/dist/__tests__/integration/init-workflow.test.d.ts +7 -0
  11. package/dist/__tests__/integration/init-workflow.test.d.ts.map +1 -0
  12. package/dist/__tests__/integration/init-workflow.test.js +309 -0
  13. package/dist/__tests__/integration/init-workflow.test.js.map +1 -0
  14. package/dist/config/__tests__/initializer.test.d.ts +7 -0
  15. package/dist/config/__tests__/initializer.test.d.ts.map +1 -0
  16. package/dist/config/__tests__/initializer.test.js +317 -0
  17. package/dist/config/__tests__/initializer.test.js.map +1 -0
  18. package/dist/config/initializer.d.ts +68 -0
  19. package/dist/config/initializer.d.ts.map +1 -0
  20. package/dist/config/initializer.js +230 -0
  21. package/dist/config/initializer.js.map +1 -0
  22. package/dist/config.d.ts +94 -46
  23. package/dist/config.d.ts.map +1 -1
  24. package/dist/config.js +100 -18
  25. package/dist/config.js.map +1 -1
  26. package/dist/spec/__tests__/manager.test.d.ts +7 -0
  27. package/dist/spec/__tests__/manager.test.d.ts.map +1 -0
  28. package/dist/spec/__tests__/manager.test.js +206 -0
  29. package/dist/spec/__tests__/manager.test.js.map +1 -0
  30. package/dist/spec/manager.d.ts +9 -1
  31. package/dist/spec/manager.d.ts.map +1 -1
  32. package/dist/spec/manager.js +23 -1
  33. package/dist/spec/manager.js.map +1 -1
  34. package/dist/types.d.ts +24 -5
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/workflow/__tests__/agent-executor.test.d.ts +5 -0
  37. package/dist/workflow/__tests__/agent-executor.test.d.ts.map +1 -0
  38. package/dist/workflow/__tests__/agent-executor.test.js +282 -0
  39. package/dist/workflow/__tests__/agent-executor.test.js.map +1 -0
  40. package/dist/workflow/agent-executor.d.ts +59 -0
  41. package/dist/workflow/agent-executor.d.ts.map +1 -0
  42. package/dist/workflow/agent-executor.js +150 -0
  43. package/dist/workflow/agent-executor.js.map +1 -0
  44. package/dist/workflow/faber.d.ts +13 -0
  45. package/dist/workflow/faber.d.ts.map +1 -1
  46. package/dist/workflow/faber.js +85 -0
  47. package/dist/workflow/faber.js.map +1 -1
  48. package/dist/workflow/index.d.ts +2 -0
  49. package/dist/workflow/index.d.ts.map +1 -1
  50. package/dist/workflow/index.js +3 -1
  51. package/dist/workflow/index.js.map +1 -1
  52. package/package.json +5 -1
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ /**
3
+ * @fractary/faber - AgentExecutor Tests
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const agent_executor_1 = require("../agent-executor");
7
+ const errors_1 = require("../../errors");
8
+ // Mock @fractary/forge
9
+ jest.mock('@fractary/forge', () => ({
10
+ AgentAPI: jest.fn().mockImplementation(() => ({
11
+ resolveAgent: jest.fn(),
12
+ hasAgent: jest.fn(),
13
+ healthCheck: jest.fn(),
14
+ })),
15
+ }));
16
+ describe('AgentExecutor', () => {
17
+ let mockPhaseContext;
18
+ beforeEach(() => {
19
+ mockPhaseContext = {
20
+ workflowId: 'wf-123',
21
+ workId: '456',
22
+ phase: 'frame',
23
+ autonomy: 'assisted',
24
+ issue: null,
25
+ spec: null,
26
+ branch: null,
27
+ previousOutputs: {},
28
+ };
29
+ });
30
+ describe('constructor', () => {
31
+ it('should create instance in legacy mode when forge disabled', () => {
32
+ const executor = new agent_executor_1.AgentExecutor({
33
+ forge: { enabled: false, prefer_local: true },
34
+ });
35
+ expect(executor.isForgeEnabled()).toBe(false);
36
+ });
37
+ it('should create instance in Forge mode when forge enabled', () => {
38
+ const executor = new agent_executor_1.AgentExecutor({
39
+ forge: { enabled: true, prefer_local: true },
40
+ });
41
+ expect(executor.isForgeEnabled()).toBe(true);
42
+ });
43
+ it('should default to legacy mode when no config provided', () => {
44
+ const executor = new agent_executor_1.AgentExecutor();
45
+ expect(executor.isForgeEnabled()).toBe(false);
46
+ });
47
+ });
48
+ describe('getAgentNameForPhase', () => {
49
+ it('should map frame phase to frame-agent', () => {
50
+ const executor = new agent_executor_1.AgentExecutor();
51
+ expect(executor.getAgentNameForPhase('frame')).toBe('frame-agent');
52
+ });
53
+ it('should map architect phase to architect-agent', () => {
54
+ const executor = new agent_executor_1.AgentExecutor();
55
+ expect(executor.getAgentNameForPhase('architect')).toBe('architect-agent');
56
+ });
57
+ it('should map build phase to build-agent', () => {
58
+ const executor = new agent_executor_1.AgentExecutor();
59
+ expect(executor.getAgentNameForPhase('build')).toBe('build-agent');
60
+ });
61
+ it('should map evaluate phase to evaluate-agent', () => {
62
+ const executor = new agent_executor_1.AgentExecutor();
63
+ expect(executor.getAgentNameForPhase('evaluate')).toBe('evaluate-agent');
64
+ });
65
+ it('should map release phase to release-agent', () => {
66
+ const executor = new agent_executor_1.AgentExecutor();
67
+ expect(executor.getAgentNameForPhase('release')).toBe('release-agent');
68
+ });
69
+ it('should generate agent name for unknown phase', () => {
70
+ const executor = new agent_executor_1.AgentExecutor();
71
+ expect(executor.getAgentNameForPhase('custom')).toBe('custom-agent');
72
+ });
73
+ it('should return custom agent name directly when it contains -agent suffix', () => {
74
+ const executor = new agent_executor_1.AgentExecutor();
75
+ expect(executor.getAgentNameForPhase('my-custom-frame-agent')).toBe('my-custom-frame-agent');
76
+ });
77
+ it('should return custom agent name directly when it contains version specifier @', () => {
78
+ const executor = new agent_executor_1.AgentExecutor();
79
+ expect(executor.getAgentNameForPhase('custom-frame-agent@1.0.0')).toBe('custom-frame-agent@1.0.0');
80
+ });
81
+ it('should return custom agent name directly for versioned agents without -agent suffix', () => {
82
+ const executor = new agent_executor_1.AgentExecutor();
83
+ expect(executor.getAgentNameForPhase('my-custom@2.0.0')).toBe('my-custom@2.0.0');
84
+ });
85
+ });
86
+ describe('executePhaseAgent - Legacy Mode', () => {
87
+ it('should return legacy result when in legacy mode', async () => {
88
+ const executor = new agent_executor_1.AgentExecutor({
89
+ forge: { enabled: false, prefer_local: true },
90
+ });
91
+ const result = await executor.executePhaseAgent('frame', 'Analyze requirements', mockPhaseContext);
92
+ expect(result).toEqual({
93
+ output: 'Legacy phase execution: frame',
94
+ messages: [],
95
+ metadata: {
96
+ legacy: true,
97
+ phase: 'frame',
98
+ },
99
+ });
100
+ });
101
+ });
102
+ describe('executePhaseAgent - Forge Mode', () => {
103
+ it('should resolve agent and invoke it in Forge mode', async () => {
104
+ const mockInvoke = jest.fn().mockResolvedValue({
105
+ output: 'Agent result',
106
+ messages: [],
107
+ usage: { input_tokens: 100, output_tokens: 50 },
108
+ });
109
+ const mockAgent = {
110
+ name: 'frame-agent',
111
+ version: '2.0.0',
112
+ invoke: mockInvoke,
113
+ };
114
+ const { AgentAPI } = require('@fractary/forge');
115
+ const mockResolveAgent = jest.fn().mockResolvedValue(mockAgent);
116
+ AgentAPI.mockImplementation(() => ({
117
+ resolveAgent: mockResolveAgent,
118
+ }));
119
+ const executor = new agent_executor_1.AgentExecutor({
120
+ forge: { enabled: true, prefer_local: true },
121
+ });
122
+ const result = await executor.executePhaseAgent('frame', 'Analyze requirements', mockPhaseContext);
123
+ expect(mockResolveAgent).toHaveBeenCalledWith('frame-agent');
124
+ expect(mockInvoke).toHaveBeenCalledWith('Analyze requirements', {
125
+ workflowId: 'wf-123',
126
+ workId: '456',
127
+ phase: 'frame',
128
+ autonomy: 'assisted',
129
+ issue: null,
130
+ spec: null,
131
+ branch: null,
132
+ previousOutputs: {},
133
+ });
134
+ expect(result).toEqual({
135
+ output: 'Agent result',
136
+ messages: [],
137
+ usage: { input_tokens: 100, output_tokens: 50 },
138
+ });
139
+ });
140
+ it('should cache resolved agents', async () => {
141
+ const mockAgent = {
142
+ name: 'frame-agent',
143
+ version: '2.0.0',
144
+ invoke: jest.fn().mockResolvedValue({
145
+ output: 'Result',
146
+ messages: [],
147
+ }),
148
+ };
149
+ const { AgentAPI } = require('@fractary/forge');
150
+ const mockResolveAgent = jest.fn().mockResolvedValue(mockAgent);
151
+ AgentAPI.mockImplementation(() => ({
152
+ resolveAgent: mockResolveAgent,
153
+ }));
154
+ const executor = new agent_executor_1.AgentExecutor({
155
+ forge: { enabled: true, prefer_local: true },
156
+ });
157
+ // First call - should resolve
158
+ await executor.executePhaseAgent('frame', 'Task 1', mockPhaseContext);
159
+ expect(mockResolveAgent).toHaveBeenCalledTimes(1);
160
+ // Second call - should use cache
161
+ await executor.executePhaseAgent('frame', 'Task 2', mockPhaseContext);
162
+ expect(mockResolveAgent).toHaveBeenCalledTimes(1); // Still 1, not called again
163
+ });
164
+ it('should throw WorkflowError when agent not found', async () => {
165
+ const error = new Error('Agent not found');
166
+ error.name = 'AgentNotFoundError';
167
+ const { AgentAPI } = require('@fractary/forge');
168
+ AgentAPI.mockImplementation(() => ({
169
+ resolveAgent: jest.fn().mockRejectedValue(error),
170
+ }));
171
+ const executor = new agent_executor_1.AgentExecutor({
172
+ forge: { enabled: true, prefer_local: true },
173
+ });
174
+ await expect(executor.executePhaseAgent('frame', 'Task', mockPhaseContext)).rejects.toThrow(errors_1.WorkflowError);
175
+ });
176
+ it('should propagate other errors', async () => {
177
+ const error = new Error('Network error');
178
+ const { AgentAPI } = require('@fractary/forge');
179
+ AgentAPI.mockImplementation(() => ({
180
+ resolveAgent: jest.fn().mockRejectedValue(error),
181
+ }));
182
+ const executor = new agent_executor_1.AgentExecutor({
183
+ forge: { enabled: true, prefer_local: true },
184
+ });
185
+ await expect(executor.executePhaseAgent('frame', 'Task', mockPhaseContext)).rejects.toThrow('Network error');
186
+ });
187
+ });
188
+ describe('clearCache', () => {
189
+ it('should clear agent cache', async () => {
190
+ const mockAgent = {
191
+ name: 'frame-agent',
192
+ version: '2.0.0',
193
+ invoke: jest.fn().mockResolvedValue({ output: 'Result', messages: [] }),
194
+ };
195
+ const { AgentAPI } = require('@fractary/forge');
196
+ const mockResolveAgent = jest.fn().mockResolvedValue(mockAgent);
197
+ AgentAPI.mockImplementation(() => ({
198
+ resolveAgent: mockResolveAgent,
199
+ }));
200
+ const executor = new agent_executor_1.AgentExecutor({
201
+ forge: { enabled: true, prefer_local: true },
202
+ });
203
+ // First call - caches agent
204
+ await executor.executePhaseAgent('frame', 'Task', mockPhaseContext);
205
+ expect(mockResolveAgent).toHaveBeenCalledTimes(1);
206
+ // Clear cache
207
+ executor.clearCache();
208
+ // Second call - should resolve again
209
+ await executor.executePhaseAgent('frame', 'Task', mockPhaseContext);
210
+ expect(mockResolveAgent).toHaveBeenCalledTimes(2);
211
+ });
212
+ });
213
+ describe('healthCheck', () => {
214
+ it('should return healthy in legacy mode', async () => {
215
+ const executor = new agent_executor_1.AgentExecutor({
216
+ forge: { enabled: false, prefer_local: true },
217
+ });
218
+ const result = await executor.healthCheck();
219
+ expect(result).toEqual({
220
+ healthy: true,
221
+ phases: {},
222
+ });
223
+ });
224
+ it('should check health of all phase agents in Forge mode', async () => {
225
+ const { AgentAPI } = require('@fractary/forge');
226
+ const mockHealthCheck = jest.fn()
227
+ .mockResolvedValueOnce({ healthy: true, agent: 'frame-agent' })
228
+ .mockResolvedValueOnce({ healthy: true, agent: 'architect-agent' })
229
+ .mockResolvedValueOnce({ healthy: true, agent: 'build-agent' })
230
+ .mockResolvedValueOnce({ healthy: true, agent: 'evaluate-agent' })
231
+ .mockResolvedValueOnce({ healthy: true, agent: 'release-agent' });
232
+ AgentAPI.mockImplementation(() => ({
233
+ healthCheck: mockHealthCheck,
234
+ }));
235
+ const executor = new agent_executor_1.AgentExecutor({
236
+ forge: { enabled: true, prefer_local: true },
237
+ });
238
+ const result = await executor.healthCheck();
239
+ expect(result.healthy).toBe(true);
240
+ expect(result.phases.frame.healthy).toBe(true);
241
+ expect(result.phases.architect.healthy).toBe(true);
242
+ expect(result.phases.build.healthy).toBe(true);
243
+ expect(result.phases.evaluate.healthy).toBe(true);
244
+ expect(result.phases.release.healthy).toBe(true);
245
+ });
246
+ it('should return unhealthy if any agent fails health check', async () => {
247
+ const { AgentAPI } = require('@fractary/forge');
248
+ const mockHealthCheck = jest.fn()
249
+ .mockResolvedValueOnce({ healthy: true, agent: 'frame-agent' })
250
+ .mockResolvedValueOnce({ healthy: false, agent: 'architect-agent' })
251
+ .mockResolvedValueOnce({ healthy: true, agent: 'build-agent' })
252
+ .mockResolvedValueOnce({ healthy: true, agent: 'evaluate-agent' })
253
+ .mockResolvedValueOnce({ healthy: true, agent: 'release-agent' });
254
+ AgentAPI.mockImplementation(() => ({
255
+ healthCheck: mockHealthCheck,
256
+ }));
257
+ const executor = new agent_executor_1.AgentExecutor({
258
+ forge: { enabled: true, prefer_local: true },
259
+ });
260
+ const result = await executor.healthCheck();
261
+ expect(result.healthy).toBe(false);
262
+ expect(result.phases.architect.healthy).toBe(false);
263
+ });
264
+ it('should handle health check errors', async () => {
265
+ const { AgentAPI } = require('@fractary/forge');
266
+ const mockHealthCheck = jest.fn()
267
+ .mockResolvedValueOnce({ healthy: true })
268
+ .mockRejectedValueOnce(new Error('Connection failed'));
269
+ AgentAPI.mockImplementation(() => ({
270
+ healthCheck: mockHealthCheck,
271
+ }));
272
+ const executor = new agent_executor_1.AgentExecutor({
273
+ forge: { enabled: true, prefer_local: true },
274
+ });
275
+ const result = await executor.healthCheck();
276
+ expect(result.healthy).toBe(false);
277
+ expect(result.phases.architect.healthy).toBe(false);
278
+ expect(result.phases.architect.error).toBe('Connection failed');
279
+ });
280
+ });
281
+ });
282
+ //# sourceMappingURL=agent-executor.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-executor.test.js","sourceRoot":"","sources":["../../../src/workflow/__tests__/agent-executor.test.ts"],"names":[],"mapp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AAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;YACjD,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAChD,MAAM,eAAe,GAAG,IAAI,CAAC,EAAE,EAAE;iBAC9B,qBAAqB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iBACxC,qBAAqB,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;YAEzD,QAAQ,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;gBACjC,WAAW,EAAE,eAAe;aAC7B,CAAC,CAAC,CAAC;YAEJ,MAAM,QAAQ,GAAG,IAAI,8BAAa,CAAC;gBACjC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;aAC7C,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;YAE5C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACpD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @fractary/faber - Agent Executor
3
+ *
4
+ * Bridges FABER workflow with Forge's AgentAPI for agent resolution and execution.
5
+ */
6
+ import { AgentResult } from '@fractary/forge';
7
+ import { PhaseContext } from './types';
8
+ export interface ForgeConfig {
9
+ enabled: boolean;
10
+ prefer_local: boolean;
11
+ }
12
+ export interface AgentExecutorConfig {
13
+ forge?: ForgeConfig;
14
+ }
15
+ export declare class AgentExecutor {
16
+ private forge?;
17
+ private useLegacy;
18
+ private agentCache;
19
+ constructor(config?: AgentExecutorConfig);
20
+ /**
21
+ * Get agent name for a FABER phase or return custom agent name directly
22
+ *
23
+ * If phaseName is a known FABER phase (frame, architect, etc.), returns the mapped agent name.
24
+ * If phaseName looks like a custom agent name (contains '-agent' or '@'), returns it directly.
25
+ * Otherwise, generates a default agent name by appending '-agent'.
26
+ */
27
+ getAgentNameForPhase(phaseName: string): string;
28
+ /**
29
+ * Check if using Forge mode
30
+ */
31
+ isForgeEnabled(): boolean;
32
+ /**
33
+ * Execute a phase agent
34
+ */
35
+ executePhaseAgent(phaseName: string, task: string, context: PhaseContext): Promise<AgentResult>;
36
+ /**
37
+ * Execute using Forge agent
38
+ */
39
+ private executeForgeAgent;
40
+ /**
41
+ * Execute using legacy hardcoded logic (fallback)
42
+ */
43
+ private executeLegacyPhase;
44
+ /**
45
+ * Clear agent cache
46
+ */
47
+ clearCache(): void;
48
+ /**
49
+ * Health check for all phase agents
50
+ */
51
+ healthCheck(): Promise<{
52
+ healthy: boolean;
53
+ phases: Record<string, {
54
+ healthy: boolean;
55
+ error?: string;
56
+ }>;
57
+ }>;
58
+ }
59
+ //# sourceMappingURL=agent-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-executor.d.ts","sourceRoot":"","sources":["../../src/workflow/agent-executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsC,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAaD,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAC,CAAW;IACzB,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,UAAU,CAAoD;gBAE1D,MAAM,CAAC,EAAE,mBAAmB;IAQxC;;;;;;OAMG;IACH,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAgB/C;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACG,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,CAAC;IAQvB;;OAEG;YACW,iBAAiB;IAwC/B;;OAEG;YACW,kBAAkB;IAiBhC;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC;QAC3B,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,OAAO,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC9D,CAAC;CA0BH"}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ /**
3
+ * @fractary/faber - Agent Executor
4
+ *
5
+ * Bridges FABER workflow with Forge's AgentAPI for agent resolution and execution.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AgentExecutor = void 0;
9
+ const forge_1 = require("@fractary/forge");
10
+ const errors_1 = require("../errors");
11
+ /**
12
+ * Maps FABER phases to Forge agent names
13
+ */
14
+ const PHASE_AGENT_MAP = {
15
+ frame: 'frame-agent',
16
+ architect: 'architect-agent',
17
+ build: 'build-agent',
18
+ evaluate: 'evaluate-agent',
19
+ release: 'release-agent',
20
+ };
21
+ class AgentExecutor {
22
+ forge;
23
+ useLegacy;
24
+ agentCache = new Map();
25
+ constructor(config) {
26
+ this.useLegacy = !config?.forge?.enabled;
27
+ if (!this.useLegacy) {
28
+ this.forge = new forge_1.AgentAPI(config?.forge);
29
+ }
30
+ }
31
+ /**
32
+ * Get agent name for a FABER phase or return custom agent name directly
33
+ *
34
+ * If phaseName is a known FABER phase (frame, architect, etc.), returns the mapped agent name.
35
+ * If phaseName looks like a custom agent name (contains '-agent' or '@'), returns it directly.
36
+ * Otherwise, generates a default agent name by appending '-agent'.
37
+ */
38
+ getAgentNameForPhase(phaseName) {
39
+ // If it's a known phase, use the mapping
40
+ if (PHASE_AGENT_MAP[phaseName]) {
41
+ return PHASE_AGENT_MAP[phaseName];
42
+ }
43
+ // If it looks like a custom agent name (contains '-agent' or version specifier '@'),
44
+ // return it directly without modification
45
+ if (phaseName.includes('-agent') || phaseName.includes('@')) {
46
+ return phaseName;
47
+ }
48
+ // Default fallback: append '-agent' suffix
49
+ return `${phaseName}-agent`;
50
+ }
51
+ /**
52
+ * Check if using Forge mode
53
+ */
54
+ isForgeEnabled() {
55
+ return !this.useLegacy;
56
+ }
57
+ /**
58
+ * Execute a phase agent
59
+ */
60
+ async executePhaseAgent(phaseName, task, context) {
61
+ if (this.useLegacy) {
62
+ return this.executeLegacyPhase(phaseName, task, context);
63
+ }
64
+ return this.executeForgeAgent(phaseName, task, context);
65
+ }
66
+ /**
67
+ * Execute using Forge agent
68
+ */
69
+ async executeForgeAgent(phaseName, task, context) {
70
+ const agentName = this.getAgentNameForPhase(phaseName);
71
+ try {
72
+ // Check cache first
73
+ let agent = this.agentCache.get(agentName);
74
+ if (!agent) {
75
+ // Resolve agent from Forge
76
+ agent = await this.forge.resolveAgent(agentName);
77
+ this.agentCache.set(agentName, agent);
78
+ }
79
+ // Invoke agent with task and context
80
+ return await agent.invoke(task, {
81
+ workflowId: context.workflowId,
82
+ workId: context.workId,
83
+ phase: context.phase,
84
+ autonomy: context.autonomy,
85
+ issue: context.issue,
86
+ spec: context.spec,
87
+ branch: context.branch,
88
+ previousOutputs: context.previousOutputs,
89
+ });
90
+ }
91
+ catch (error) {
92
+ if (error instanceof Error && error.name === 'AgentNotFoundError') {
93
+ throw new errors_1.WorkflowError(`Agent '${agentName}' not found. ` +
94
+ `Run 'forge install ${agentName}' or check your .fractary/agents/ directory.`, { phase: phaseName, agent: agentName });
95
+ }
96
+ throw error;
97
+ }
98
+ }
99
+ /**
100
+ * Execute using legacy hardcoded logic (fallback)
101
+ */
102
+ async executeLegacyPhase(phaseName, _task, _context) {
103
+ // Return structured result matching Forge format
104
+ // This preserves backward compatibility during migration
105
+ return {
106
+ output: `Legacy phase execution: ${phaseName}`,
107
+ messages: [],
108
+ metadata: {
109
+ legacy: true,
110
+ phase: phaseName,
111
+ },
112
+ };
113
+ }
114
+ /**
115
+ * Clear agent cache
116
+ */
117
+ clearCache() {
118
+ this.agentCache.clear();
119
+ }
120
+ /**
121
+ * Health check for all phase agents
122
+ */
123
+ async healthCheck() {
124
+ if (this.useLegacy) {
125
+ return { healthy: true, phases: {} };
126
+ }
127
+ const phases = Object.keys(PHASE_AGENT_MAP);
128
+ const results = {};
129
+ let allHealthy = true;
130
+ for (const phase of phases) {
131
+ const agentName = PHASE_AGENT_MAP[phase];
132
+ try {
133
+ const check = await this.forge.healthCheck(agentName);
134
+ results[phase] = { healthy: check.healthy };
135
+ if (!check.healthy)
136
+ allHealthy = false;
137
+ }
138
+ catch (error) {
139
+ results[phase] = {
140
+ healthy: false,
141
+ error: error instanceof Error ? error.message : 'Unknown error'
142
+ };
143
+ allHealthy = false;
144
+ }
145
+ }
146
+ return { healthy: allHealthy, phases: results };
147
+ }
148
+ }
149
+ exports.AgentExecutor = AgentExecutor;
150
+ //# sourceMappingURL=agent-executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-executor.js","sourceRoot":"","sources":["../../src/workflow/agent-executor.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2CAAkF;AAElF,sCAA0C;AAW1C;;GAEG;AACH,MAAM,eAAe,GAA2B;IAC9C,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,iBAAiB;IAC5B,KAAK,EAAE,aAAa;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EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAClD,CAAC;CACF;AAhKD,sCAgKC"}
@@ -20,6 +20,7 @@ export declare class FaberWorkflow {
20
20
  private specManager;
21
21
  private logManager;
22
22
  private stateManager;
23
+ private agentExecutor;
23
24
  private config;
24
25
  private userInput;
25
26
  private listeners;
@@ -55,6 +56,18 @@ export declare class FaberWorkflow {
55
56
  * Run a specific phase
56
57
  */
57
58
  private runPhase;
59
+ /**
60
+ * Run phase using Forge agent
61
+ */
62
+ private runPhaseWithForge;
63
+ /**
64
+ * Build task description for phase agent
65
+ */
66
+ private buildPhaseTask;
67
+ /**
68
+ * Extract phase-specific outputs from agent result
69
+ */
70
+ private extractPhaseOutputs;
58
71
  /**
59
72
  * Frame Phase: Gather requirements from issue + conversation
60
73
  */
@@ -1 +1 @@
1
- {"version":3,"file":"faber.d.ts","sourceRoot":"","sources":["../../src/workflow/faber.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EAKd,iBAAiB,EAEjB,aAAa,EAEd,MAAM,SAAS,CAAC;AAsBjB;;;;;;;;;GASG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,YAAY,CAAe;IAEnC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,SAAS,CAA0B;gBAE/B,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;KAAE;IAa1D;;OAEG;IACH,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAIvD;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,aAAa,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