@marktoflow/gui 2.0.0-alpha.1 → 2.0.0-alpha.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/.turbo/turbo-build.log +7 -7
- package/README.md +38 -2
- package/dist/client/assets/index-C90Y_aBX.js +678 -0
- package/dist/client/assets/index-C90Y_aBX.js.map +1 -0
- package/dist/client/assets/index-CRWeQ3NN.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/server/index.js +1 -1
- package/dist/server/server/routes/tools.js +406 -0
- package/dist/server/server/routes/tools.js.map +1 -1
- package/dist/server/server/services/agents/codex-provider.js +270 -0
- package/dist/server/server/services/agents/codex-provider.js.map +1 -0
- package/dist/server/server/services/agents/prompts.js +27 -0
- package/dist/server/server/services/agents/prompts.js.map +1 -1
- package/dist/server/server/services/agents/registry.js +20 -0
- package/dist/server/server/services/agents/registry.js.map +1 -1
- package/package.json +4 -4
- package/src/client/components/Canvas/Canvas.tsx +24 -6
- package/src/client/components/Canvas/ForEachNode.tsx +128 -0
- package/src/client/components/Canvas/IfElseNode.tsx +126 -0
- package/src/client/components/Canvas/ParallelNode.tsx +140 -0
- package/src/client/components/Canvas/SwitchNode.tsx +164 -0
- package/src/client/components/Canvas/TransformNode.tsx +185 -0
- package/src/client/components/Canvas/TryCatchNode.tsx +164 -0
- package/src/client/components/Canvas/WhileNode.tsx +129 -0
- package/src/client/components/Canvas/index.ts +24 -0
- package/src/client/utils/serviceIcons.tsx +33 -0
- package/src/server/index.ts +1 -1
- package/src/server/routes/tools.ts +406 -0
- package/src/server/services/agents/codex-provider.ts +398 -0
- package/src/server/services/agents/prompts.ts +27 -0
- package/src/server/services/agents/registry.ts +21 -0
- package/tailwind.config.ts +1 -1
- package/tests/integration/api.test.ts +203 -1
- package/tests/integration/testApp.ts +1 -1
- package/tests/setup.ts +35 -0
- package/tests/unit/ForEachNode.test.tsx +218 -0
- package/tests/unit/IfElseNode.test.tsx +188 -0
- package/tests/unit/ParallelNode.test.tsx +264 -0
- package/tests/unit/SwitchNode.test.tsx +252 -0
- package/tests/unit/TransformNode.test.tsx +386 -0
- package/tests/unit/TryCatchNode.test.tsx +243 -0
- package/tests/unit/WhileNode.test.tsx +226 -0
- package/tests/unit/codexProvider.test.ts +399 -0
- package/tests/unit/serviceIcons.test.ts +197 -0
- package/.turbo/turbo-test.log +0 -22
- package/dist/client/assets/index-DwTI8opO.js +0 -608
- package/dist/client/assets/index-DwTI8opO.js.map +0 -1
- package/dist/client/assets/index-RoEdL6gO.css +0 -1
- package/dist/server/index.d.ts +0 -3
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -56
- package/dist/server/index.js.map +0 -1
- package/dist/server/routes/ai.js +0 -50
- package/dist/server/routes/ai.js.map +0 -1
- package/dist/server/routes/execute.js +0 -62
- package/dist/server/routes/execute.js.map +0 -1
- package/dist/server/routes/workflows.js +0 -99
- package/dist/server/routes/workflows.js.map +0 -1
- package/dist/server/services/AIService.d.ts +0 -30
- package/dist/server/services/AIService.d.ts.map +0 -1
- package/dist/server/services/AIService.js +0 -216
- package/dist/server/services/AIService.js.map +0 -1
- package/dist/server/services/FileWatcher.d.ts +0 -10
- package/dist/server/services/FileWatcher.d.ts.map +0 -1
- package/dist/server/services/FileWatcher.js +0 -62
- package/dist/server/services/FileWatcher.js.map +0 -1
- package/dist/server/services/WorkflowService.d.ts +0 -54
- package/dist/server/services/WorkflowService.d.ts.map +0 -1
- package/dist/server/services/WorkflowService.js +0 -323
- package/dist/server/services/WorkflowService.js.map +0 -1
- package/dist/server/websocket/index.d.ts +0 -10
- package/dist/server/websocket/index.d.ts.map +0 -1
- package/dist/server/websocket/index.js +0 -85
- package/dist/server/websocket/index.js.map +0 -1
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Codex AI agent provider
|
|
3
|
+
* Uses the @openai/codex-sdk for AI capabilities
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { parse as yamlParse } from 'yaml';
|
|
7
|
+
import type {
|
|
8
|
+
AgentProvider,
|
|
9
|
+
AgentCapabilities,
|
|
10
|
+
AgentConfig,
|
|
11
|
+
PromptResult,
|
|
12
|
+
Workflow,
|
|
13
|
+
} from './types.js';
|
|
14
|
+
import { buildPrompt, generateSuggestions } from './prompts.js';
|
|
15
|
+
|
|
16
|
+
// Dynamic import types for Codex SDK
|
|
17
|
+
interface CodexSDK {
|
|
18
|
+
Codex: new (options?: CodexOptions) => CodexInstance;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface CodexOptions {
|
|
22
|
+
codexPathOverride?: string;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
apiKey?: string;
|
|
25
|
+
env?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ThreadOptions {
|
|
29
|
+
model?: string;
|
|
30
|
+
sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access';
|
|
31
|
+
workingDirectory?: string;
|
|
32
|
+
skipGitRepoCheck?: boolean;
|
|
33
|
+
modelReasoningEffort?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
34
|
+
networkAccessEnabled?: boolean;
|
|
35
|
+
webSearchMode?: 'disabled' | 'cached' | 'live';
|
|
36
|
+
approvalPolicy?: 'never' | 'on-request' | 'on-failure' | 'untrusted';
|
|
37
|
+
additionalDirectories?: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface ThreadItem {
|
|
41
|
+
id: string;
|
|
42
|
+
type: string;
|
|
43
|
+
text?: string;
|
|
44
|
+
command?: string;
|
|
45
|
+
aggregated_output?: string;
|
|
46
|
+
status?: string;
|
|
47
|
+
changes?: unknown[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface Usage {
|
|
51
|
+
input_tokens: number;
|
|
52
|
+
cached_input_tokens: number;
|
|
53
|
+
output_tokens: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface TurnResult {
|
|
57
|
+
items: ThreadItem[];
|
|
58
|
+
finalResponse: string;
|
|
59
|
+
usage: Usage | null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface ThreadEvent {
|
|
63
|
+
type: string;
|
|
64
|
+
thread_id?: string;
|
|
65
|
+
item?: ThreadItem;
|
|
66
|
+
usage?: Usage;
|
|
67
|
+
message?: string;
|
|
68
|
+
error?: { message: string };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface StreamedTurnResult {
|
|
72
|
+
events: AsyncGenerator<ThreadEvent>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface Thread {
|
|
76
|
+
id: string | null;
|
|
77
|
+
run(input: string, options?: unknown): Promise<TurnResult>;
|
|
78
|
+
runStreamed(input: string, options?: unknown): Promise<StreamedTurnResult>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface CodexInstance {
|
|
82
|
+
startThread(options?: ThreadOptions): Thread;
|
|
83
|
+
resumeThread(id: string, options?: ThreadOptions): Thread;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export class CodexProvider implements AgentProvider {
|
|
87
|
+
readonly id = 'codex';
|
|
88
|
+
readonly name = 'OpenAI Codex';
|
|
89
|
+
readonly capabilities: AgentCapabilities = {
|
|
90
|
+
streaming: true,
|
|
91
|
+
toolUse: true,
|
|
92
|
+
codeExecution: true,
|
|
93
|
+
systemPrompts: true,
|
|
94
|
+
models: [
|
|
95
|
+
'codex-1',
|
|
96
|
+
'o3',
|
|
97
|
+
'o3-mini',
|
|
98
|
+
'o4-mini',
|
|
99
|
+
'gpt-4.1',
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
private codex: CodexInstance | null = null;
|
|
104
|
+
private model: string = 'codex-1';
|
|
105
|
+
private ready: boolean = false;
|
|
106
|
+
private error: string | undefined;
|
|
107
|
+
private workingDirectory: string = process.cwd();
|
|
108
|
+
private lastThreadId: string | null = null;
|
|
109
|
+
|
|
110
|
+
async initialize(config: AgentConfig): Promise<void> {
|
|
111
|
+
try {
|
|
112
|
+
// Try to import the Codex SDK (dynamic import with webpackIgnore to avoid bundling issues)
|
|
113
|
+
const sdkModule = (await import(
|
|
114
|
+
/* webpackIgnore: true */ '@openai/codex-sdk'
|
|
115
|
+
).catch(() => null)) as CodexSDK | null;
|
|
116
|
+
|
|
117
|
+
if (!sdkModule || !sdkModule.Codex) {
|
|
118
|
+
this.ready = false;
|
|
119
|
+
this.error = 'OpenAI Codex SDK not installed. Run: npm install @openai/codex-sdk';
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const { Codex } = sdkModule;
|
|
124
|
+
|
|
125
|
+
const codexOptions: CodexOptions = {};
|
|
126
|
+
|
|
127
|
+
// API key from config or environment
|
|
128
|
+
if (config.apiKey) {
|
|
129
|
+
codexOptions.apiKey = config.apiKey;
|
|
130
|
+
} else if (process.env.OPENAI_API_KEY) {
|
|
131
|
+
codexOptions.apiKey = process.env.OPENAI_API_KEY;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Base URL
|
|
135
|
+
if (config.baseUrl) {
|
|
136
|
+
codexOptions.baseUrl = config.baseUrl;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Codex path override
|
|
140
|
+
if (config.options?.codexPath) {
|
|
141
|
+
codexOptions.codexPathOverride = config.options.codexPath as string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Environment variables
|
|
145
|
+
if (config.options?.env) {
|
|
146
|
+
codexOptions.env = config.options.env as Record<string, string>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
this.codex = new Codex(codexOptions);
|
|
150
|
+
|
|
151
|
+
if (config.model) {
|
|
152
|
+
this.model = config.model;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Working directory
|
|
156
|
+
if (config.options?.workingDirectory) {
|
|
157
|
+
this.workingDirectory = config.options.workingDirectory as string;
|
|
158
|
+
} else if (config.options?.cwd) {
|
|
159
|
+
this.workingDirectory = config.options.cwd as string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Test connectivity by starting a simple thread
|
|
163
|
+
try {
|
|
164
|
+
const thread = this.codex.startThread({
|
|
165
|
+
skipGitRepoCheck: true,
|
|
166
|
+
sandboxMode: 'read-only',
|
|
167
|
+
workingDirectory: this.workingDirectory,
|
|
168
|
+
});
|
|
169
|
+
// Just verify it can be created
|
|
170
|
+
if (thread) {
|
|
171
|
+
this.ready = true;
|
|
172
|
+
this.error = undefined;
|
|
173
|
+
}
|
|
174
|
+
} catch (testError) {
|
|
175
|
+
this.ready = false;
|
|
176
|
+
this.error = `Cannot initialize Codex: ${testError instanceof Error ? testError.message : 'Unknown error'}`;
|
|
177
|
+
}
|
|
178
|
+
} catch (err) {
|
|
179
|
+
this.ready = false;
|
|
180
|
+
this.error = err instanceof Error ? err.message : 'Unknown error initializing Codex';
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
isReady(): boolean {
|
|
185
|
+
return this.ready;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
getStatus(): { ready: boolean; model?: string; error?: string } {
|
|
189
|
+
return {
|
|
190
|
+
ready: this.ready,
|
|
191
|
+
model: this.model,
|
|
192
|
+
error: this.error,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async processPrompt(
|
|
197
|
+
prompt: string,
|
|
198
|
+
workflow: Workflow,
|
|
199
|
+
context?: { selectedStepId?: string; recentHistory?: string[] }
|
|
200
|
+
): Promise<PromptResult> {
|
|
201
|
+
if (!this.codex || !this.ready) {
|
|
202
|
+
return {
|
|
203
|
+
explanation: 'OpenAI Codex provider not available.',
|
|
204
|
+
error: this.error || 'Provider not initialized',
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
try {
|
|
209
|
+
// Build context-aware prompts
|
|
210
|
+
const { systemPrompt, userPrompt } = buildPrompt(prompt, workflow, context);
|
|
211
|
+
|
|
212
|
+
// Combine system and user prompts for Codex
|
|
213
|
+
const fullPrompt = `${systemPrompt}\n\n---\n\n${userPrompt}`;
|
|
214
|
+
|
|
215
|
+
const thread = this.codex.startThread({
|
|
216
|
+
model: this.model,
|
|
217
|
+
skipGitRepoCheck: true,
|
|
218
|
+
sandboxMode: 'read-only', // Safe for workflow modifications
|
|
219
|
+
workingDirectory: this.workingDirectory,
|
|
220
|
+
modelReasoningEffort: 'medium',
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const result = await thread.run(fullPrompt);
|
|
224
|
+
this.lastThreadId = thread.id;
|
|
225
|
+
|
|
226
|
+
// Extract the response text
|
|
227
|
+
const responseText = result.finalResponse ||
|
|
228
|
+
result.items.find((item) => item.type === 'agent_message')?.text || '';
|
|
229
|
+
|
|
230
|
+
return this.parseAIResponse(responseText, workflow);
|
|
231
|
+
} catch (err) {
|
|
232
|
+
return {
|
|
233
|
+
explanation: '',
|
|
234
|
+
error: err instanceof Error ? err.message : 'Unknown error',
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async getSuggestions(workflow: Workflow, selectedStepId?: string): Promise<string[]> {
|
|
240
|
+
return generateSuggestions(workflow, selectedStepId);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async streamPrompt(
|
|
244
|
+
prompt: string,
|
|
245
|
+
workflow: Workflow,
|
|
246
|
+
onChunk: (chunk: string) => void,
|
|
247
|
+
context?: { selectedStepId?: string; recentHistory?: string[] }
|
|
248
|
+
): Promise<PromptResult> {
|
|
249
|
+
if (!this.codex || !this.ready) {
|
|
250
|
+
return this.processPrompt(prompt, workflow, context);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const { systemPrompt, userPrompt } = buildPrompt(prompt, workflow, context);
|
|
254
|
+
const fullPrompt = `${systemPrompt}\n\n---\n\n${userPrompt}`;
|
|
255
|
+
let fullResponse = '';
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
const thread = this.codex.startThread({
|
|
259
|
+
model: this.model,
|
|
260
|
+
skipGitRepoCheck: true,
|
|
261
|
+
sandboxMode: 'read-only',
|
|
262
|
+
workingDirectory: this.workingDirectory,
|
|
263
|
+
modelReasoningEffort: 'medium',
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
const streamResult = await thread.runStreamed(fullPrompt);
|
|
267
|
+
|
|
268
|
+
for await (const event of streamResult.events) {
|
|
269
|
+
if (event.type === 'thread.started') {
|
|
270
|
+
this.lastThreadId = event.thread_id || null;
|
|
271
|
+
} else if (event.type === 'item.completed' && event.item?.type === 'agent_message') {
|
|
272
|
+
const text = event.item.text || '';
|
|
273
|
+
fullResponse = text;
|
|
274
|
+
onChunk(text);
|
|
275
|
+
} else if (event.type === 'error') {
|
|
276
|
+
throw new Error(event.message || 'Stream error');
|
|
277
|
+
} else if (event.type === 'turn.failed') {
|
|
278
|
+
throw new Error(event.error?.message || 'Turn failed');
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return this.parseAIResponse(fullResponse, workflow);
|
|
283
|
+
} catch (err) {
|
|
284
|
+
return {
|
|
285
|
+
explanation: '',
|
|
286
|
+
error: err instanceof Error ? err.message : 'Unknown error',
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
async cancel(): Promise<void> {
|
|
292
|
+
// Codex SDK doesn't have explicit cancellation, but we can reset state
|
|
293
|
+
this.lastThreadId = null;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Get the last thread ID for resumption
|
|
298
|
+
*/
|
|
299
|
+
getLastThreadId(): string | null {
|
|
300
|
+
return this.lastThreadId;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Resume a previous thread
|
|
305
|
+
*/
|
|
306
|
+
async resumePrompt(
|
|
307
|
+
threadId: string,
|
|
308
|
+
prompt: string,
|
|
309
|
+
workflow: Workflow,
|
|
310
|
+
context?: { selectedStepId?: string; recentHistory?: string[] }
|
|
311
|
+
): Promise<PromptResult> {
|
|
312
|
+
if (!this.codex || !this.ready) {
|
|
313
|
+
return {
|
|
314
|
+
explanation: 'OpenAI Codex provider not available.',
|
|
315
|
+
error: this.error || 'Provider not initialized',
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
try {
|
|
320
|
+
const { systemPrompt, userPrompt } = buildPrompt(prompt, workflow, context);
|
|
321
|
+
const fullPrompt = `${systemPrompt}\n\n---\n\n${userPrompt}`;
|
|
322
|
+
|
|
323
|
+
const thread = this.codex.resumeThread(threadId, {
|
|
324
|
+
model: this.model,
|
|
325
|
+
skipGitRepoCheck: true,
|
|
326
|
+
sandboxMode: 'read-only',
|
|
327
|
+
workingDirectory: this.workingDirectory,
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
const result = await thread.run(fullPrompt);
|
|
331
|
+
this.lastThreadId = thread.id;
|
|
332
|
+
|
|
333
|
+
const responseText = result.finalResponse ||
|
|
334
|
+
result.items.find((item) => item.type === 'agent_message')?.text || '';
|
|
335
|
+
|
|
336
|
+
return this.parseAIResponse(responseText, workflow);
|
|
337
|
+
} catch (err) {
|
|
338
|
+
return {
|
|
339
|
+
explanation: '',
|
|
340
|
+
error: err instanceof Error ? err.message : 'Unknown error',
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
private parseAIResponse(responseText: string, originalWorkflow: Workflow): PromptResult {
|
|
346
|
+
const yamlMatch = responseText.match(/```yaml\n([\s\S]*?)\n```/);
|
|
347
|
+
let modifiedWorkflow: Workflow | undefined;
|
|
348
|
+
let explanation = responseText;
|
|
349
|
+
|
|
350
|
+
if (yamlMatch) {
|
|
351
|
+
try {
|
|
352
|
+
const parsedYaml = yamlParse(yamlMatch[1]);
|
|
353
|
+
if (parsedYaml && (parsedYaml.steps || parsedYaml.metadata)) {
|
|
354
|
+
modifiedWorkflow = parsedYaml as Workflow;
|
|
355
|
+
const explanationMatch = responseText.match(/^([\s\S]*?)```yaml/);
|
|
356
|
+
if (explanationMatch) {
|
|
357
|
+
explanation = explanationMatch[1].trim();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
} catch {
|
|
361
|
+
// Failed to parse YAML
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
let diff: string | undefined;
|
|
366
|
+
if (modifiedWorkflow) {
|
|
367
|
+
diff = this.generateDiff(originalWorkflow, modifiedWorkflow);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return { explanation, workflow: modifiedWorkflow, diff };
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
private generateDiff(original: Workflow, modified: Workflow): string {
|
|
374
|
+
const originalStepIds = new Set(original.steps?.map((s) => s.id) || []);
|
|
375
|
+
const modifiedStepIds = new Set(modified.steps?.map((s) => s.id) || []);
|
|
376
|
+
|
|
377
|
+
const added = modified.steps?.filter((s) => !originalStepIds.has(s.id)) || [];
|
|
378
|
+
const removed = original.steps?.filter((s) => !modifiedStepIds.has(s.id)) || [];
|
|
379
|
+
|
|
380
|
+
let diff = '';
|
|
381
|
+
if (added.length > 0) {
|
|
382
|
+
diff += `+ Added ${added.length} step(s): ${added.map((s) => s.name || s.id).join(', ')}\n`;
|
|
383
|
+
}
|
|
384
|
+
if (removed.length > 0) {
|
|
385
|
+
diff += `- Removed ${removed.length} step(s): ${removed.map((s) => s.name || s.id).join(', ')}\n`;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return diff || 'No structural changes detected';
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export function createCodexProvider(config?: AgentConfig): CodexProvider {
|
|
393
|
+
const provider = new CodexProvider();
|
|
394
|
+
if (config) {
|
|
395
|
+
provider.initialize(config);
|
|
396
|
+
}
|
|
397
|
+
return provider;
|
|
398
|
+
}
|
|
@@ -142,6 +142,33 @@ export const AVAILABLE_SERVICES = {
|
|
|
142
142
|
description: 'Local Ollama LLM for AI tasks',
|
|
143
143
|
commonActions: ['generate', 'chat', 'embeddings'],
|
|
144
144
|
},
|
|
145
|
+
codex: {
|
|
146
|
+
sdk: '@openai/codex-sdk',
|
|
147
|
+
description: 'OpenAI Codex for AI-powered coding workflows',
|
|
148
|
+
commonActions: [
|
|
149
|
+
'chat',
|
|
150
|
+
'codeModify',
|
|
151
|
+
'codeAnalyze',
|
|
152
|
+
'codeReview',
|
|
153
|
+
'webSearch',
|
|
154
|
+
'execute',
|
|
155
|
+
'structured',
|
|
156
|
+
'resume',
|
|
157
|
+
'withImages',
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
copilot: {
|
|
161
|
+
sdk: '@github/copilot-sdk',
|
|
162
|
+
description: 'GitHub Copilot for AI code assistance',
|
|
163
|
+
commonActions: [
|
|
164
|
+
'chat',
|
|
165
|
+
'codeReview',
|
|
166
|
+
'codeModify',
|
|
167
|
+
'withTools',
|
|
168
|
+
'withAgents',
|
|
169
|
+
'withMcp',
|
|
170
|
+
],
|
|
171
|
+
},
|
|
145
172
|
} as const;
|
|
146
173
|
|
|
147
174
|
// Base system prompt with comprehensive context
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
import { createClaudeProvider } from './claude-provider.js';
|
|
15
15
|
import { createClaudeCodeProvider } from './claude-code-provider.js';
|
|
16
16
|
import { createCopilotProvider } from './copilot-provider.js';
|
|
17
|
+
import { createCodexProvider } from './codex-provider.js';
|
|
17
18
|
import { createDemoProvider } from './demo-provider.js';
|
|
18
19
|
import { createOllamaProvider } from './ollama-provider.js';
|
|
19
20
|
|
|
@@ -38,6 +39,11 @@ export class AgentRegistry {
|
|
|
38
39
|
name: 'GitHub Copilot (SDK)',
|
|
39
40
|
factory: createCopilotProvider,
|
|
40
41
|
});
|
|
42
|
+
this.registerProvider({
|
|
43
|
+
id: 'codex',
|
|
44
|
+
name: 'OpenAI Codex (SDK)',
|
|
45
|
+
factory: createCodexProvider,
|
|
46
|
+
});
|
|
41
47
|
// API key-based providers
|
|
42
48
|
this.registerProvider({
|
|
43
49
|
id: 'claude',
|
|
@@ -153,6 +159,21 @@ export class AgentRegistry {
|
|
|
153
159
|
}
|
|
154
160
|
}
|
|
155
161
|
|
|
162
|
+
// Try OpenAI Codex SDK (uses OPENAI_API_KEY)
|
|
163
|
+
const codexProvider = this.providers.get('codex');
|
|
164
|
+
if (codexProvider) {
|
|
165
|
+
await codexProvider.initialize({
|
|
166
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
167
|
+
options: {
|
|
168
|
+
cwd: process.cwd(),
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
if (codexProvider.isReady()) {
|
|
172
|
+
this.activeProviderId = 'codex';
|
|
173
|
+
return 'codex';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
156
177
|
// Try Claude with API key (requires ANTHROPIC_API_KEY)
|
|
157
178
|
const claudeProvider = this.providers.get('claude');
|
|
158
179
|
if (claudeProvider) {
|
package/tailwind.config.ts
CHANGED
|
@@ -12,7 +12,7 @@ describe('API Integration Tests', () => {
|
|
|
12
12
|
expect(response.status).toBe(200);
|
|
13
13
|
expect(response.body).toEqual({
|
|
14
14
|
status: 'ok',
|
|
15
|
-
version: '2.0.0-alpha.
|
|
15
|
+
version: '2.0.0-alpha.2',
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
});
|
|
@@ -57,6 +57,90 @@ describe('API Integration Tests', () => {
|
|
|
57
57
|
expect(githubTool.name).toBe('GitHub');
|
|
58
58
|
expect(githubTool.sdk).toBe('@octokit/rest');
|
|
59
59
|
});
|
|
60
|
+
|
|
61
|
+
it('should include all new payment integrations', async () => {
|
|
62
|
+
const response = await request(app).get('/api/tools');
|
|
63
|
+
const stripeTool = response.body.tools.find((t: { id: string }) => t.id === 'stripe');
|
|
64
|
+
|
|
65
|
+
expect(stripeTool).toBeDefined();
|
|
66
|
+
expect(stripeTool.name).toBe('Stripe');
|
|
67
|
+
expect(stripeTool.category).toBe('Payments');
|
|
68
|
+
expect(stripeTool.sdk).toBe('stripe');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should include all new communication integrations', async () => {
|
|
72
|
+
const response = await request(app).get('/api/tools');
|
|
73
|
+
|
|
74
|
+
const twilioTool = response.body.tools.find((t: { id: string }) => t.id === 'twilio');
|
|
75
|
+
expect(twilioTool).toBeDefined();
|
|
76
|
+
expect(twilioTool.name).toBe('Twilio');
|
|
77
|
+
expect(twilioTool.category).toBe('Communication');
|
|
78
|
+
|
|
79
|
+
const sendgridTool = response.body.tools.find((t: { id: string }) => t.id === 'sendgrid');
|
|
80
|
+
expect(sendgridTool).toBeDefined();
|
|
81
|
+
expect(sendgridTool.name).toBe('SendGrid');
|
|
82
|
+
|
|
83
|
+
const teamsTool = response.body.tools.find((t: { id: string }) => t.id === 'teams');
|
|
84
|
+
expect(teamsTool).toBeDefined();
|
|
85
|
+
expect(teamsTool.name).toBe('Microsoft Teams');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should include all new e-commerce integrations', async () => {
|
|
89
|
+
const response = await request(app).get('/api/tools');
|
|
90
|
+
const shopifyTool = response.body.tools.find((t: { id: string }) => t.id === 'shopify');
|
|
91
|
+
|
|
92
|
+
expect(shopifyTool).toBeDefined();
|
|
93
|
+
expect(shopifyTool.name).toBe('Shopify');
|
|
94
|
+
expect(shopifyTool.category).toBe('E-commerce');
|
|
95
|
+
expect(shopifyTool.sdk).toBe('@shopify/shopify-api');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should include all new support integrations', async () => {
|
|
99
|
+
const response = await request(app).get('/api/tools');
|
|
100
|
+
const zendeskTool = response.body.tools.find((t: { id: string }) => t.id === 'zendesk');
|
|
101
|
+
|
|
102
|
+
expect(zendeskTool).toBeDefined();
|
|
103
|
+
expect(zendeskTool.name).toBe('Zendesk');
|
|
104
|
+
expect(zendeskTool.category).toBe('Support');
|
|
105
|
+
expect(zendeskTool.sdk).toBe('node-zendesk');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should include all new marketing integrations', async () => {
|
|
109
|
+
const response = await request(app).get('/api/tools');
|
|
110
|
+
const mailchimpTool = response.body.tools.find((t: { id: string }) => t.id === 'mailchimp');
|
|
111
|
+
|
|
112
|
+
expect(mailchimpTool).toBeDefined();
|
|
113
|
+
expect(mailchimpTool.name).toBe('Mailchimp');
|
|
114
|
+
expect(mailchimpTool.category).toBe('Marketing');
|
|
115
|
+
expect(mailchimpTool.sdk).toBe('@mailchimp/mailchimp_marketing');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('should include all new project management integrations', async () => {
|
|
119
|
+
const response = await request(app).get('/api/tools');
|
|
120
|
+
|
|
121
|
+
const asanaTool = response.body.tools.find((t: { id: string }) => t.id === 'asana');
|
|
122
|
+
expect(asanaTool).toBeDefined();
|
|
123
|
+
expect(asanaTool.name).toBe('Asana');
|
|
124
|
+
expect(asanaTool.category).toBe('Project Management');
|
|
125
|
+
|
|
126
|
+
const trelloTool = response.body.tools.find((t: { id: string }) => t.id === 'trello');
|
|
127
|
+
expect(trelloTool).toBeDefined();
|
|
128
|
+
expect(trelloTool.name).toBe('Trello');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should include all new storage integrations', async () => {
|
|
132
|
+
const response = await request(app).get('/api/tools');
|
|
133
|
+
|
|
134
|
+
const dropboxTool = response.body.tools.find((t: { id: string }) => t.id === 'dropbox');
|
|
135
|
+
expect(dropboxTool).toBeDefined();
|
|
136
|
+
expect(dropboxTool.name).toBe('Dropbox');
|
|
137
|
+
expect(dropboxTool.category).toBe('Storage');
|
|
138
|
+
|
|
139
|
+
const s3Tool = response.body.tools.find((t: { id: string }) => t.id === 'aws-s3');
|
|
140
|
+
expect(s3Tool).toBeDefined();
|
|
141
|
+
expect(s3Tool.name).toBe('AWS S3');
|
|
142
|
+
expect(s3Tool.category).toBe('Storage');
|
|
143
|
+
});
|
|
60
144
|
});
|
|
61
145
|
|
|
62
146
|
describe('GET /api/tools/:toolId', () => {
|
|
@@ -91,6 +175,124 @@ describe('API Integration Tests', () => {
|
|
|
91
175
|
});
|
|
92
176
|
});
|
|
93
177
|
|
|
178
|
+
describe('GET /api/tools/:toolId - New Integrations', () => {
|
|
179
|
+
it('should return stripe tool with payment actions', async () => {
|
|
180
|
+
const response = await request(app).get('/api/tools/stripe');
|
|
181
|
+
|
|
182
|
+
expect(response.status).toBe(200);
|
|
183
|
+
expect(response.body.tool.id).toBe('stripe');
|
|
184
|
+
expect(response.body.tool.actions).toBeDefined();
|
|
185
|
+
|
|
186
|
+
const createCustomer = response.body.tool.actions.find(
|
|
187
|
+
(a: { id: string }) => a.id === 'customers.create'
|
|
188
|
+
);
|
|
189
|
+
expect(createCustomer).toBeDefined();
|
|
190
|
+
expect(createCustomer.name).toBe('Create Customer');
|
|
191
|
+
|
|
192
|
+
const createPaymentIntent = response.body.tool.actions.find(
|
|
193
|
+
(a: { id: string }) => a.id === 'paymentIntents.create'
|
|
194
|
+
);
|
|
195
|
+
expect(createPaymentIntent).toBeDefined();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('should return twilio tool with messaging actions', async () => {
|
|
199
|
+
const response = await request(app).get('/api/tools/twilio');
|
|
200
|
+
|
|
201
|
+
expect(response.status).toBe(200);
|
|
202
|
+
expect(response.body.tool.id).toBe('twilio');
|
|
203
|
+
|
|
204
|
+
const sendSMS = response.body.tool.actions.find((a: { id: string }) => a.id === 'sendSMS');
|
|
205
|
+
expect(sendSMS).toBeDefined();
|
|
206
|
+
expect(sendSMS.name).toBe('Send SMS');
|
|
207
|
+
|
|
208
|
+
const sendWhatsApp = response.body.tool.actions.find(
|
|
209
|
+
(a: { id: string }) => a.id === 'sendWhatsApp'
|
|
210
|
+
);
|
|
211
|
+
expect(sendWhatsApp).toBeDefined();
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it('should return shopify tool with e-commerce actions', async () => {
|
|
215
|
+
const response = await request(app).get('/api/tools/shopify');
|
|
216
|
+
|
|
217
|
+
expect(response.status).toBe(200);
|
|
218
|
+
expect(response.body.tool.id).toBe('shopify');
|
|
219
|
+
|
|
220
|
+
const createProduct = response.body.tool.actions.find(
|
|
221
|
+
(a: { id: string }) => a.id === 'createProduct'
|
|
222
|
+
);
|
|
223
|
+
expect(createProduct).toBeDefined();
|
|
224
|
+
|
|
225
|
+
const createOrder = response.body.tool.actions.find(
|
|
226
|
+
(a: { id: string }) => a.id === 'createOrder'
|
|
227
|
+
);
|
|
228
|
+
expect(createOrder).toBeDefined();
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it('should return zendesk tool with support actions', async () => {
|
|
232
|
+
const response = await request(app).get('/api/tools/zendesk');
|
|
233
|
+
|
|
234
|
+
expect(response.status).toBe(200);
|
|
235
|
+
expect(response.body.tool.id).toBe('zendesk');
|
|
236
|
+
|
|
237
|
+
const createTicket = response.body.tool.actions.find(
|
|
238
|
+
(a: { id: string }) => a.id === 'createTicket'
|
|
239
|
+
);
|
|
240
|
+
expect(createTicket).toBeDefined();
|
|
241
|
+
expect(createTicket.name).toBe('Create Ticket');
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it('should return asana tool with project management actions', async () => {
|
|
245
|
+
const response = await request(app).get('/api/tools/asana');
|
|
246
|
+
|
|
247
|
+
expect(response.status).toBe(200);
|
|
248
|
+
expect(response.body.tool.id).toBe('asana');
|
|
249
|
+
|
|
250
|
+
const createTask = response.body.tool.actions.find(
|
|
251
|
+
(a: { id: string }) => a.id === 'createTask'
|
|
252
|
+
);
|
|
253
|
+
expect(createTask).toBeDefined();
|
|
254
|
+
|
|
255
|
+
const createProject = response.body.tool.actions.find(
|
|
256
|
+
(a: { id: string }) => a.id === 'createProject'
|
|
257
|
+
);
|
|
258
|
+
expect(createProject).toBeDefined();
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it('should return dropbox tool with storage actions', async () => {
|
|
262
|
+
const response = await request(app).get('/api/tools/dropbox');
|
|
263
|
+
|
|
264
|
+
expect(response.status).toBe(200);
|
|
265
|
+
expect(response.body.tool.id).toBe('dropbox');
|
|
266
|
+
|
|
267
|
+
const uploadFile = response.body.tool.actions.find(
|
|
268
|
+
(a: { id: string }) => a.id === 'uploadFile'
|
|
269
|
+
);
|
|
270
|
+
expect(uploadFile).toBeDefined();
|
|
271
|
+
|
|
272
|
+
const createSharedLink = response.body.tool.actions.find(
|
|
273
|
+
(a: { id: string }) => a.id === 'createSharedLink'
|
|
274
|
+
);
|
|
275
|
+
expect(createSharedLink).toBeDefined();
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should return aws-s3 tool with object storage actions', async () => {
|
|
279
|
+
const response = await request(app).get('/api/tools/aws-s3');
|
|
280
|
+
|
|
281
|
+
expect(response.status).toBe(200);
|
|
282
|
+
expect(response.body.tool.id).toBe('aws-s3');
|
|
283
|
+
|
|
284
|
+
const uploadObject = response.body.tool.actions.find(
|
|
285
|
+
(a: { id: string }) => a.id === 'uploadObject'
|
|
286
|
+
);
|
|
287
|
+
expect(uploadObject).toBeDefined();
|
|
288
|
+
|
|
289
|
+
const listObjects = response.body.tool.actions.find(
|
|
290
|
+
(a: { id: string }) => a.id === 'listObjects'
|
|
291
|
+
);
|
|
292
|
+
expect(listObjects).toBeDefined();
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
|
|
94
296
|
describe('GET /api/tools/:toolId/actions/:actionId', () => {
|
|
95
297
|
it('should return action details', async () => {
|
|
96
298
|
const response = await request(app).get('/api/tools/github/actions/pulls.get');
|