@marktoflow/gui 2.0.0-alpha.5 → 2.0.1

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 (164) hide show
  1. package/README.md +48 -180
  2. package/client.log +0 -0
  3. package/dist/client/assets/index-DQeR1ew6.css +1 -0
  4. package/dist/client/assets/index-LbIVPHbD.js +833 -0
  5. package/dist/client/assets/index-LbIVPHbD.js.map +1 -0
  6. package/dist/client/index.html +2 -2
  7. package/dist/client/marktoflow-logo.png +0 -0
  8. package/dist/server/index.js +31 -5
  9. package/dist/server/index.js.map +1 -1
  10. package/dist/server/routes/admin.js +95 -0
  11. package/dist/server/routes/admin.js.map +1 -0
  12. package/dist/server/routes/ai.js +2 -2
  13. package/dist/server/routes/ai.js.map +1 -1
  14. package/dist/server/routes/collaboration.js +104 -0
  15. package/dist/server/routes/collaboration.js.map +1 -0
  16. package/dist/server/routes/execute.js +181 -14
  17. package/dist/server/routes/execute.js.map +1 -1
  18. package/dist/server/routes/form.js +160 -0
  19. package/dist/server/routes/form.js.map +1 -0
  20. package/dist/server/routes/settings.js +90 -0
  21. package/dist/server/routes/settings.js.map +1 -0
  22. package/dist/server/routes/templates.js +106 -0
  23. package/dist/server/routes/templates.js.map +1 -0
  24. package/dist/server/routes/versions.js +101 -0
  25. package/dist/server/routes/versions.js.map +1 -0
  26. package/dist/server/services/AIService.js +85 -2
  27. package/dist/server/services/AIService.js.map +1 -1
  28. package/dist/server/services/ExecutionManager.js +571 -0
  29. package/dist/server/services/ExecutionManager.js.map +1 -0
  30. package/dist/server/services/VersionService.js +65 -0
  31. package/dist/server/services/VersionService.js.map +1 -0
  32. package/dist/server/services/WorkflowService.js +8 -2
  33. package/dist/server/services/WorkflowService.js.map +1 -1
  34. package/dist/server/services/agents/copilot-provider.js +32 -0
  35. package/dist/server/services/agents/copilot-provider.js.map +1 -1
  36. package/dist/server/websocket/index.js +42 -0
  37. package/dist/server/websocket/index.js.map +1 -1
  38. package/dist/shared/constants.js +9 -0
  39. package/dist/shared/constants.js.map +1 -1
  40. package/dist/shared/settings.js +51 -0
  41. package/dist/shared/settings.js.map +1 -0
  42. package/package.json +14 -10
  43. package/public/marktoflow-logo.png +0 -0
  44. package/server.log +0 -0
  45. package/tests/integration/fixtures/test-workflow.md +6 -0
  46. package/.turbo/turbo-build.log +0 -42
  47. package/dist/client/assets/index-CM44OayM.js +0 -704
  48. package/dist/client/assets/index-CM44OayM.js.map +0 -1
  49. package/dist/client/assets/index-Dru63gi6.css +0 -1
  50. package/marktoflow-gui-2.0.0-alpha.5.tgz +0 -0
  51. package/playwright.config.ts +0 -27
  52. package/postcss.config.js +0 -6
  53. package/src/client/App.tsx +0 -520
  54. package/src/client/components/Canvas/Canvas.tsx +0 -425
  55. package/src/client/components/Canvas/ExecutionOverlay.tsx +0 -935
  56. package/src/client/components/Canvas/ForEachNode.tsx +0 -152
  57. package/src/client/components/Canvas/IfElseNode.tsx +0 -141
  58. package/src/client/components/Canvas/NodeContextMenu.tsx +0 -192
  59. package/src/client/components/Canvas/OutputNode.tsx +0 -111
  60. package/src/client/components/Canvas/ParallelNode.tsx +0 -157
  61. package/src/client/components/Canvas/StepNode.tsx +0 -106
  62. package/src/client/components/Canvas/SubWorkflowNode.tsx +0 -141
  63. package/src/client/components/Canvas/SwitchNode.tsx +0 -185
  64. package/src/client/components/Canvas/Toolbar.tsx +0 -227
  65. package/src/client/components/Canvas/TransformNode.tsx +0 -194
  66. package/src/client/components/Canvas/TriggerNode.tsx +0 -128
  67. package/src/client/components/Canvas/TryCatchNode.tsx +0 -164
  68. package/src/client/components/Canvas/WhileNode.tsx +0 -161
  69. package/src/client/components/Canvas/index.ts +0 -24
  70. package/src/client/components/Debug/VariableInspector.tsx +0 -148
  71. package/src/client/components/Editor/InputsEditor.tsx +0 -458
  72. package/src/client/components/Editor/NewStepWizard.tsx +0 -344
  73. package/src/client/components/Editor/StepEditor.tsx +0 -532
  74. package/src/client/components/Editor/YamlEditor.tsx +0 -160
  75. package/src/client/components/Panels/PropertiesPanel.tsx +0 -589
  76. package/src/client/components/Prompt/ChangePreview.tsx +0 -281
  77. package/src/client/components/Prompt/PromptHistoryPanel.tsx +0 -209
  78. package/src/client/components/Prompt/PromptInput.tsx +0 -110
  79. package/src/client/components/Settings/ProviderSwitcher.tsx +0 -228
  80. package/src/client/components/Sidebar/ImportDialog.tsx +0 -257
  81. package/src/client/components/Sidebar/Sidebar.tsx +0 -362
  82. package/src/client/components/common/Breadcrumb.tsx +0 -40
  83. package/src/client/components/common/Button.tsx +0 -68
  84. package/src/client/components/common/ContextMenu.tsx +0 -202
  85. package/src/client/components/common/KeyboardShortcuts.tsx +0 -149
  86. package/src/client/components/common/Modal.tsx +0 -93
  87. package/src/client/components/common/Tabs.tsx +0 -57
  88. package/src/client/components/common/ThemeToggle.tsx +0 -63
  89. package/src/client/components/index.ts +0 -32
  90. package/src/client/hooks/index.ts +0 -4
  91. package/src/client/hooks/useAIPrompt.ts +0 -108
  92. package/src/client/hooks/useCanvas.ts +0 -247
  93. package/src/client/hooks/useWebSocket.ts +0 -164
  94. package/src/client/hooks/useWorkflow.ts +0 -138
  95. package/src/client/main.tsx +0 -10
  96. package/src/client/stores/agentStore.ts +0 -109
  97. package/src/client/stores/canvasStore.ts +0 -348
  98. package/src/client/stores/editorStore.ts +0 -133
  99. package/src/client/stores/executionStore.ts +0 -502
  100. package/src/client/stores/index.ts +0 -4
  101. package/src/client/stores/layoutStore.ts +0 -103
  102. package/src/client/stores/navigationStore.ts +0 -49
  103. package/src/client/stores/promptStore.ts +0 -113
  104. package/src/client/stores/themeStore.ts +0 -75
  105. package/src/client/stores/workflowStore.ts +0 -185
  106. package/src/client/styles/globals.css +0 -452
  107. package/src/client/utils/cn.ts +0 -9
  108. package/src/client/utils/index.ts +0 -4
  109. package/src/client/utils/platform.ts +0 -46
  110. package/src/client/utils/serviceIcons.tsx +0 -97
  111. package/src/client/utils/stepValidation.ts +0 -155
  112. package/src/client/utils/workflowToGraph.ts +0 -523
  113. package/src/server/index.ts +0 -137
  114. package/src/server/routes/ai.ts +0 -91
  115. package/src/server/routes/execute.ts +0 -71
  116. package/src/server/routes/executions.ts +0 -136
  117. package/src/server/routes/tools.ts +0 -970
  118. package/src/server/routes/workflows.ts +0 -147
  119. package/src/server/services/AIService.ts +0 -105
  120. package/src/server/services/FileWatcher.ts +0 -69
  121. package/src/server/services/WorkflowService.ts +0 -601
  122. package/src/server/services/agents/claude-code-provider.ts +0 -320
  123. package/src/server/services/agents/claude-provider.ts +0 -248
  124. package/src/server/services/agents/codex-provider.ts +0 -398
  125. package/src/server/services/agents/copilot-provider.ts +0 -311
  126. package/src/server/services/agents/demo-provider.ts +0 -184
  127. package/src/server/services/agents/index.ts +0 -31
  128. package/src/server/services/agents/ollama-provider.ts +0 -267
  129. package/src/server/services/agents/prompts.ts +0 -509
  130. package/src/server/services/agents/registry.ts +0 -310
  131. package/src/server/services/agents/types.ts +0 -146
  132. package/src/server/websocket/index.ts +0 -117
  133. package/src/shared/constants.ts +0 -180
  134. package/src/shared/types.ts +0 -179
  135. package/tailwind.config.ts +0 -73
  136. package/tests/e2e/app.spec.ts +0 -90
  137. package/tests/e2e/canvas.spec.ts +0 -128
  138. package/tests/e2e/workflow.spec.ts +0 -185
  139. package/tests/integration/api.test.ts +0 -452
  140. package/tests/integration/testApp.ts +0 -31
  141. package/tests/setup.ts +0 -72
  142. package/tests/unit/ForEachNode.test.tsx +0 -308
  143. package/tests/unit/IfElseNode.test.tsx +0 -235
  144. package/tests/unit/ParallelNode.test.tsx +0 -344
  145. package/tests/unit/SwitchNode.test.tsx +0 -327
  146. package/tests/unit/TransformNode.test.tsx +0 -386
  147. package/tests/unit/TryCatchNode.test.tsx +0 -243
  148. package/tests/unit/WhileNode.test.tsx +0 -230
  149. package/tests/unit/agentStore.test.ts +0 -218
  150. package/tests/unit/canvasStore.test.ts +0 -502
  151. package/tests/unit/codexProvider.test.ts +0 -399
  152. package/tests/unit/components.test.tsx +0 -151
  153. package/tests/unit/executionStore.test.ts +0 -567
  154. package/tests/unit/layoutStore.test.ts +0 -194
  155. package/tests/unit/navigationStore.test.ts +0 -152
  156. package/tests/unit/platform.test.ts +0 -118
  157. package/tests/unit/serviceIcons.test.ts +0 -197
  158. package/tests/unit/stepValidation.test.ts +0 -226
  159. package/tests/unit/themeStore.test.ts +0 -141
  160. package/tests/unit/workflowToGraph.test.ts +0 -311
  161. package/tsconfig.json +0 -29
  162. package/tsconfig.server.json +0 -28
  163. package/vite.config.ts +0 -31
  164. package/vitest.config.ts +0 -26
@@ -1,281 +0,0 @@
1
- import { useState } from 'react';
2
- import { Modal, ModalFooter } from '../common/Modal';
3
- import { Button } from '../common/Button';
4
- import { Tabs, TabsList, TabsTrigger, TabsContent } from '../common/Tabs';
5
- import Editor from '@monaco-editor/react';
6
- import { stringify } from 'yaml';
7
- import { Check, X, Eye, Code, GitCompare } from 'lucide-react';
8
- import type { Workflow } from '@shared/types';
9
-
10
- interface ChangePreviewProps {
11
- open: boolean;
12
- onOpenChange: (open: boolean) => void;
13
- originalWorkflow: Workflow | null;
14
- modifiedWorkflow: Workflow | null;
15
- explanation: string;
16
- onAccept: () => void;
17
- onReject: () => void;
18
- }
19
-
20
- export function ChangePreview({
21
- open,
22
- onOpenChange,
23
- originalWorkflow,
24
- modifiedWorkflow,
25
- explanation,
26
- onAccept,
27
- onReject,
28
- }: ChangePreviewProps) {
29
- const [activeTab, setActiveTab] = useState('explanation');
30
-
31
- const originalYaml = originalWorkflow
32
- ? stringify(originalWorkflow, { indent: 2 })
33
- : '';
34
- const modifiedYaml = modifiedWorkflow
35
- ? stringify(modifiedWorkflow, { indent: 2 })
36
- : '';
37
-
38
- const handleAccept = () => {
39
- onAccept();
40
- onOpenChange(false);
41
- };
42
-
43
- const handleReject = () => {
44
- onReject();
45
- onOpenChange(false);
46
- };
47
-
48
- return (
49
- <Modal
50
- open={open}
51
- onOpenChange={onOpenChange}
52
- title="Review Changes"
53
- description="The AI has suggested the following changes to your workflow"
54
- size="xl"
55
- >
56
- <Tabs value={activeTab} onValueChange={setActiveTab}>
57
- <TabsList>
58
- <TabsTrigger value="explanation">
59
- <Eye className="w-4 h-4 mr-1.5" />
60
- Explanation
61
- </TabsTrigger>
62
- <TabsTrigger value="diff">
63
- <GitCompare className="w-4 h-4 mr-1.5" />
64
- Side by Side
65
- </TabsTrigger>
66
- <TabsTrigger value="modified">
67
- <Code className="w-4 h-4 mr-1.5" />
68
- Modified YAML
69
- </TabsTrigger>
70
- </TabsList>
71
-
72
- <div className="p-4">
73
- <TabsContent value="explanation">
74
- <div className="prose prose-invert max-w-none">
75
- <div className="p-4 bg-node-bg rounded-lg border border-node-border">
76
- <p className="text-gray-300 whitespace-pre-wrap">{explanation}</p>
77
- </div>
78
-
79
- {modifiedWorkflow && (
80
- <div className="mt-4">
81
- <h4 className="text-sm font-medium text-gray-400 mb-2">
82
- Changes Summary
83
- </h4>
84
- <ul className="space-y-2">
85
- {getChangesSummary(originalWorkflow, modifiedWorkflow).map(
86
- (change, index) => (
87
- <li
88
- key={index}
89
- className={`flex items-start gap-2 text-sm ${
90
- change.type === 'added'
91
- ? 'text-success'
92
- : change.type === 'removed'
93
- ? 'text-error'
94
- : 'text-warning'
95
- }`}
96
- >
97
- <span className="flex-shrink-0">
98
- {change.type === 'added'
99
- ? '+'
100
- : change.type === 'removed'
101
- ? '-'
102
- : '~'}
103
- </span>
104
- <span>{change.description}</span>
105
- </li>
106
- )
107
- )}
108
- </ul>
109
- </div>
110
- )}
111
- </div>
112
- </TabsContent>
113
-
114
- <TabsContent value="diff">
115
- <div className="grid grid-cols-2 gap-4">
116
- <div>
117
- <h4 className="text-sm font-medium text-gray-400 mb-2">
118
- Original
119
- </h4>
120
- <div className="border border-node-border rounded-lg overflow-hidden">
121
- <Editor
122
- height="400px"
123
- language="yaml"
124
- value={originalYaml}
125
- theme="vs-dark"
126
- options={{
127
- readOnly: true,
128
- minimap: { enabled: false },
129
- fontSize: 12,
130
- lineNumbers: 'on',
131
- scrollBeyondLastLine: false,
132
- }}
133
- />
134
- </div>
135
- </div>
136
- <div>
137
- <h4 className="text-sm font-medium text-gray-400 mb-2">
138
- Modified
139
- </h4>
140
- <div className="border border-node-border rounded-lg overflow-hidden">
141
- <Editor
142
- height="400px"
143
- language="yaml"
144
- value={modifiedYaml}
145
- theme="vs-dark"
146
- options={{
147
- readOnly: true,
148
- minimap: { enabled: false },
149
- fontSize: 12,
150
- lineNumbers: 'on',
151
- scrollBeyondLastLine: false,
152
- }}
153
- />
154
- </div>
155
- </div>
156
- </div>
157
- </TabsContent>
158
-
159
- <TabsContent value="modified">
160
- <div className="border border-node-border rounded-lg overflow-hidden">
161
- <Editor
162
- height="500px"
163
- language="yaml"
164
- value={modifiedYaml}
165
- theme="vs-dark"
166
- options={{
167
- readOnly: true,
168
- minimap: { enabled: false },
169
- fontSize: 13,
170
- fontFamily: 'JetBrains Mono, Consolas, monospace',
171
- lineNumbers: 'on',
172
- scrollBeyondLastLine: false,
173
- }}
174
- />
175
- </div>
176
- </TabsContent>
177
- </div>
178
- </Tabs>
179
-
180
- <ModalFooter>
181
- <Button
182
- variant="secondary"
183
- onClick={handleReject}
184
- icon={<X className="w-4 h-4" />}
185
- >
186
- Reject
187
- </Button>
188
- <Button onClick={handleAccept} icon={<Check className="w-4 h-4" />}>
189
- Accept Changes
190
- </Button>
191
- </ModalFooter>
192
- </Modal>
193
- );
194
- }
195
-
196
- interface Change {
197
- type: 'added' | 'removed' | 'modified';
198
- description: string;
199
- }
200
-
201
- function getChangesSummary(
202
- original: Workflow | null,
203
- modified: Workflow | null
204
- ): Change[] {
205
- const changes: Change[] = [];
206
-
207
- if (!original || !modified) return changes;
208
-
209
- // Check steps
210
- const originalStepIds = new Set(original.steps.map((s) => s.id));
211
- const modifiedStepIds = new Set(modified.steps.map((s) => s.id));
212
-
213
- // Added steps
214
- for (const step of modified.steps) {
215
- if (!originalStepIds.has(step.id)) {
216
- changes.push({
217
- type: 'added',
218
- description: `Added step "${step.name || step.id}"`,
219
- });
220
- }
221
- }
222
-
223
- // Removed steps
224
- for (const step of original.steps) {
225
- if (!modifiedStepIds.has(step.id)) {
226
- changes.push({
227
- type: 'removed',
228
- description: `Removed step "${step.name || step.id}"`,
229
- });
230
- }
231
- }
232
-
233
- // Modified steps
234
- for (const modStep of modified.steps) {
235
- if (originalStepIds.has(modStep.id)) {
236
- const origStep = original.steps.find((s) => s.id === modStep.id);
237
- if (origStep) {
238
- // Check for modifications
239
- if (JSON.stringify(origStep) !== JSON.stringify(modStep)) {
240
- const modifications: string[] = [];
241
-
242
- if (origStep.action !== modStep.action) {
243
- modifications.push('action');
244
- }
245
- if (JSON.stringify(origStep.inputs) !== JSON.stringify(modStep.inputs)) {
246
- modifications.push('inputs');
247
- }
248
- if (
249
- JSON.stringify(origStep.errorHandling) !==
250
- JSON.stringify(modStep.errorHandling)
251
- ) {
252
- modifications.push('error handling');
253
- }
254
- if (
255
- JSON.stringify(origStep.conditions) !==
256
- JSON.stringify(modStep.conditions)
257
- ) {
258
- modifications.push('conditions');
259
- }
260
-
261
- if (modifications.length > 0) {
262
- changes.push({
263
- type: 'modified',
264
- description: `Modified "${modStep.name || modStep.id}": ${modifications.join(', ')}`,
265
- });
266
- }
267
- }
268
- }
269
- }
270
- }
271
-
272
- // Check metadata changes
273
- if (original.metadata.name !== modified.metadata.name) {
274
- changes.push({
275
- type: 'modified',
276
- description: `Renamed workflow to "${modified.metadata.name}"`,
277
- });
278
- }
279
-
280
- return changes;
281
- }
@@ -1,209 +0,0 @@
1
- import { useState } from 'react';
2
- import {
3
- History,
4
- ChevronDown,
5
- ChevronUp,
6
- CheckCircle,
7
- XCircle,
8
- RefreshCw,
9
- Trash2,
10
- Clock,
11
- Copy,
12
- Check,
13
- X,
14
- } from 'lucide-react';
15
- import { usePromptStore, type PromptHistoryItem } from '../../stores/promptStore';
16
- import { Button } from '../common/Button';
17
-
18
- interface PromptHistoryPanelProps {
19
- onSelectPrompt?: (prompt: string) => void;
20
- }
21
-
22
- export function PromptHistoryPanel({ onSelectPrompt }: PromptHistoryPanelProps) {
23
- const [isExpanded, setIsExpanded] = useState(false);
24
- const [selectedItem, setSelectedItem] = useState<PromptHistoryItem | null>(null);
25
- const [copiedId, setCopiedId] = useState<string | null>(null);
26
-
27
- const { history, clearHistory, sendPrompt, isProcessing } = usePromptStore();
28
-
29
- const handleRerun = async (prompt: string) => {
30
- if (isProcessing) return;
31
- await sendPrompt(prompt);
32
- };
33
-
34
- const handleCopy = async (text: string, id: string) => {
35
- try {
36
- await navigator.clipboard.writeText(text);
37
- setCopiedId(id);
38
- setTimeout(() => setCopiedId(null), 2000);
39
- } catch (error) {
40
- console.error('Failed to copy:', error);
41
- }
42
- };
43
-
44
- const formatTime = (date: Date) => {
45
- const now = new Date();
46
- const diff = now.getTime() - new Date(date).getTime();
47
-
48
- if (diff < 60000) return 'Just now';
49
- if (diff < 3600000) return `${Math.floor(diff / 60000)}m ago`;
50
- if (diff < 86400000) return `${Math.floor(diff / 3600000)}h ago`;
51
- return new Date(date).toLocaleDateString();
52
- };
53
-
54
- if (history.length === 0) {
55
- return null;
56
- }
57
-
58
- return (
59
- <div className="border-t border-node-border">
60
- {/* Header - always visible */}
61
- <button
62
- onClick={() => setIsExpanded(!isExpanded)}
63
- className="w-full flex items-center justify-between px-4 py-2 bg-panel-bg hover:bg-white/5 transition-colors"
64
- >
65
- <div className="flex items-center gap-2">
66
- <History className="w-4 h-4 text-gray-400" />
67
- <span className="text-sm text-gray-300">Prompt History</span>
68
- <span className="text-xs text-gray-500">({history.length})</span>
69
- </div>
70
- {isExpanded ? (
71
- <ChevronDown className="w-4 h-4 text-gray-400" />
72
- ) : (
73
- <ChevronUp className="w-4 h-4 text-gray-400" />
74
- )}
75
- </button>
76
-
77
- {/* Expanded content */}
78
- {isExpanded && (
79
- <div className="bg-panel-bg">
80
- {/* Action bar */}
81
- <div className="flex items-center justify-between px-4 py-2 border-b border-node-border">
82
- <span className="text-xs text-gray-500">
83
- {history.filter((h) => h.success).length} successful,{' '}
84
- {history.filter((h) => !h.success).length} failed
85
- </span>
86
- <Button
87
- variant="ghost"
88
- size="sm"
89
- onClick={clearHistory}
90
- icon={<Trash2 className="w-3 h-3" />}
91
- >
92
- Clear
93
- </Button>
94
- </div>
95
-
96
- {/* History list */}
97
- <div className="max-h-64 overflow-y-auto">
98
- {history.map((item, index) => {
99
- const itemId = `${index}-${item.timestamp}`;
100
- const isSelected = selectedItem === item;
101
-
102
- return (
103
- <div
104
- key={itemId}
105
- className="border-b border-node-border last:border-b-0"
106
- >
107
- {/* Item header */}
108
- <div
109
- className={`flex items-start gap-3 px-4 py-3 cursor-pointer transition-colors ${
110
- isSelected ? 'bg-primary/10' : 'hover:bg-white/5'
111
- }`}
112
- onClick={() => setSelectedItem(isSelected ? null : item)}
113
- >
114
- {/* Status icon */}
115
- {item.success ? (
116
- <CheckCircle className="w-4 h-4 text-success flex-shrink-0 mt-0.5" />
117
- ) : (
118
- <XCircle className="w-4 h-4 text-error flex-shrink-0 mt-0.5" />
119
- )}
120
-
121
- {/* Content */}
122
- <div className="flex-1 min-w-0">
123
- <div className="text-sm text-gray-300 line-clamp-2">
124
- {item.prompt}
125
- </div>
126
- <div className="flex items-center gap-2 mt-1">
127
- <Clock className="w-3 h-3 text-gray-500" />
128
- <span className="text-xs text-gray-500">
129
- {formatTime(item.timestamp)}
130
- </span>
131
- </div>
132
- </div>
133
-
134
- {/* Actions */}
135
- <div className="flex items-center gap-1 flex-shrink-0">
136
- <button
137
- onClick={(e) => {
138
- e.stopPropagation();
139
- handleCopy(item.prompt, itemId);
140
- }}
141
- className="p-1.5 hover:bg-white/10 rounded transition-colors"
142
- title="Copy prompt"
143
- >
144
- {copiedId === itemId ? (
145
- <Check className="w-3.5 h-3.5 text-success" />
146
- ) : (
147
- <Copy className="w-3.5 h-3.5 text-gray-400" />
148
- )}
149
- </button>
150
- <button
151
- onClick={(e) => {
152
- e.stopPropagation();
153
- handleRerun(item.prompt);
154
- }}
155
- disabled={isProcessing}
156
- className="p-1.5 hover:bg-white/10 rounded transition-colors disabled:opacity-50"
157
- title="Re-run prompt"
158
- >
159
- <RefreshCw className={`w-3.5 h-3.5 text-gray-400 ${isProcessing ? 'animate-spin' : ''}`} />
160
- </button>
161
- {onSelectPrompt && (
162
- <button
163
- onClick={(e) => {
164
- e.stopPropagation();
165
- onSelectPrompt(item.prompt);
166
- }}
167
- className="p-1.5 hover:bg-white/10 rounded transition-colors"
168
- title="Edit prompt"
169
- >
170
- <span className="text-xs text-gray-400">Edit</span>
171
- </button>
172
- )}
173
- </div>
174
- </div>
175
-
176
- {/* Expanded details */}
177
- {isSelected && (
178
- <div className="px-4 pb-3 pl-11">
179
- <div className="bg-node-bg rounded-lg p-3">
180
- <div className="flex items-center justify-between mb-2">
181
- <span className="text-xs font-medium text-gray-500 uppercase">
182
- Response
183
- </span>
184
- <button
185
- onClick={() => handleCopy(item.response, `${itemId}-response`)}
186
- className="p-1 hover:bg-white/10 rounded transition-colors"
187
- >
188
- {copiedId === `${itemId}-response` ? (
189
- <Check className="w-3 h-3 text-success" />
190
- ) : (
191
- <Copy className="w-3 h-3 text-gray-400" />
192
- )}
193
- </button>
194
- </div>
195
- <div className={`text-xs font-mono ${item.success ? 'text-gray-300' : 'text-error'}`}>
196
- {item.response || 'No response'}
197
- </div>
198
- </div>
199
- </div>
200
- )}
201
- </div>
202
- );
203
- })}
204
- </div>
205
- </div>
206
- )}
207
- </div>
208
- );
209
- }
@@ -1,110 +0,0 @@
1
- import { useState, useRef, useEffect } from 'react';
2
- import { Send, Loader2, Sparkles } from 'lucide-react';
3
- import { usePromptStore } from '../../stores/promptStore';
4
- import { PromptHistoryPanel } from './PromptHistoryPanel';
5
- import { getModKey } from '../../utils/platform';
6
-
7
- export function PromptInput() {
8
- const [prompt, setPrompt] = useState('');
9
- const textareaRef = useRef<HTMLTextAreaElement>(null);
10
-
11
- const { isProcessing, history, sendPrompt } = usePromptStore();
12
- const modKey = getModKey();
13
-
14
- // Auto-resize textarea
15
- useEffect(() => {
16
- if (textareaRef.current) {
17
- textareaRef.current.style.height = 'auto';
18
- textareaRef.current.style.height = `${Math.min(textareaRef.current.scrollHeight, 200)}px`;
19
- }
20
- }, [prompt]);
21
-
22
- const handleSubmit = async () => {
23
- if (!prompt.trim() || isProcessing) return;
24
-
25
- await sendPrompt(prompt);
26
- setPrompt('');
27
- };
28
-
29
- const handleKeyDown = (e: React.KeyboardEvent) => {
30
- if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
31
- e.preventDefault();
32
- handleSubmit();
33
- }
34
- if (e.key === 'ArrowUp' && !prompt && history.length > 0) {
35
- setPrompt(history[0].prompt);
36
- }
37
- };
38
-
39
- const suggestions = [
40
- 'Add a Slack notification step',
41
- 'Add error handling with 3 retries',
42
- 'Convert to a sub-workflow',
43
- 'Add a condition to skip if draft',
44
- ];
45
-
46
- return (
47
- <div className="bg-panel-bg">
48
- {/* History Panel */}
49
- <PromptHistoryPanel onSelectPrompt={setPrompt} />
50
-
51
- {/* Suggestions */}
52
- {!prompt && !isProcessing && (
53
- <div className="px-4 py-2 border-t border-node-border/50">
54
- <div className="flex items-center gap-2 overflow-x-auto pb-1">
55
- <Sparkles className="w-4 h-4 text-primary flex-shrink-0" />
56
- {suggestions.map((suggestion) => (
57
- <button
58
- key={suggestion}
59
- onClick={() => setPrompt(suggestion)}
60
- className="px-3 py-1 bg-node-bg border border-node-border rounded-full text-xs text-gray-300 hover:border-primary hover:text-primary transition-colors whitespace-nowrap"
61
- >
62
- {suggestion}
63
- </button>
64
- ))}
65
- </div>
66
- </div>
67
- )}
68
-
69
- {/* Input area */}
70
- <div className="p-4 flex items-end gap-3 border-t border-node-border">
71
- <div className="flex-1 relative">
72
- <textarea
73
- ref={textareaRef}
74
- value={prompt}
75
- onChange={(e) => setPrompt(e.target.value)}
76
- onKeyDown={handleKeyDown}
77
- placeholder="Describe the changes you want to make to the workflow..."
78
- disabled={isProcessing}
79
- rows={1}
80
- className="w-full px-4 py-3 bg-node-bg border border-node-border rounded-lg text-sm text-white placeholder-gray-500 focus:outline-none focus:border-primary resize-none disabled:opacity-50"
81
- />
82
- {isProcessing && (
83
- <div className="absolute right-3 top-1/2 -translate-y-1/2">
84
- <Loader2 className="w-5 h-5 text-primary animate-spin" />
85
- </div>
86
- )}
87
- </div>
88
-
89
- <button
90
- onClick={handleSubmit}
91
- disabled={!prompt.trim() || isProcessing}
92
- className="w-10 h-10 rounded-lg bg-primary hover:bg-primary-dark disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center transition-colors"
93
- >
94
- <Send className="w-5 h-5 text-white" />
95
- </button>
96
- </div>
97
-
98
- {/* Keyboard hint */}
99
- <div className="px-4 pb-2 text-xs text-gray-500">
100
- Press <kbd className="px-1.5 py-0.5 bg-node-bg rounded text-gray-400">{modKey}</kbd> +{' '}
101
- <kbd className="px-1.5 py-0.5 bg-node-bg rounded text-gray-400">Enter</kbd> to send
102
- {history.length > 0 && (
103
- <span className="ml-4">
104
- <kbd className="px-1.5 py-0.5 bg-node-bg rounded text-gray-400">↑</kbd> for last prompt
105
- </span>
106
- )}
107
- </div>
108
- </div>
109
- );
110
- }