agent-state-machine 2.3.0 → 2.5.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.
@@ -0,0 +1,130 @@
1
+ import { X, Square } from "lucide-react";
2
+ import { useState } from "react";
3
+
4
+ export default function SettingsModal({
5
+ isOpen,
6
+ onClose,
7
+ fullAuto,
8
+ onToggleFullAuto,
9
+ autoSelectDelay,
10
+ onDelayChange,
11
+ onStop,
12
+ disabled,
13
+ }) {
14
+ const [showStopConfirm, setShowStopConfirm] = useState(false);
15
+
16
+ if (!isOpen) return null;
17
+
18
+ const handleStop = () => {
19
+ if (showStopConfirm) {
20
+ onStop();
21
+ setShowStopConfirm(false);
22
+ onClose();
23
+ } else {
24
+ setShowStopConfirm(true);
25
+ }
26
+ };
27
+
28
+ const handleBackdropClick = (e) => {
29
+ if (e.target === e.currentTarget) {
30
+ setShowStopConfirm(false);
31
+ onClose();
32
+ }
33
+ };
34
+
35
+ return (
36
+ <div
37
+ className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm"
38
+ onClick={handleBackdropClick}
39
+ >
40
+ <div className="bg-white dark:bg-black border border-black/10 dark:border-white/10 rounded-3xl p-8 w-[90vw] max-w-md shadow-2xl">
41
+ {/* Header */}
42
+ <div className="flex justify-between items-center mb-6">
43
+ <h2 className="text-xl font-bold">Settings</h2>
44
+ <button
45
+ onClick={() => {
46
+ setShowStopConfirm(false);
47
+ onClose();
48
+ }}
49
+ className="p-2 hover:bg-black/5 dark:hover:bg-white/10 rounded-full transition-colors"
50
+ aria-label="Close settings"
51
+ >
52
+ <X className="w-5 h-5" />
53
+ </button>
54
+ </div>
55
+
56
+ {/* Full-auto toggle */}
57
+ <div className="flex items-center justify-between py-4 border-b border-black/10 dark:border-white/10">
58
+ <div>
59
+ <div className="font-semibold">Full-Auto Mode</div>
60
+ <div className="text-sm text-black/50 dark:text-white/50">
61
+ Auto-select recommended options
62
+ </div>
63
+ </div>
64
+ <button
65
+ onClick={onToggleFullAuto}
66
+ disabled={disabled}
67
+ className={`w-12 h-7 rounded-full transition-colors relative ${
68
+ fullAuto
69
+ ? "bg-black dark:bg-white"
70
+ : "bg-black/20 dark:bg-white/20"
71
+ } ${disabled ? "opacity-50 cursor-not-allowed" : ""}`}
72
+ aria-pressed={fullAuto}
73
+ aria-label="Toggle full-auto mode"
74
+ >
75
+ <div
76
+ className={`absolute top-1 w-5 h-5 rounded-full bg-white dark:bg-black transition-transform ${
77
+ fullAuto ? "left-6" : "left-1"
78
+ }`}
79
+ />
80
+ </button>
81
+ </div>
82
+
83
+ {/* Countdown delay */}
84
+ <div className="flex items-center justify-between py-4 border-b border-black/10 dark:border-white/10">
85
+ <div>
86
+ <div className="font-semibold">Countdown Delay</div>
87
+ <div className="text-sm text-black/50 dark:text-white/50">
88
+ Seconds before auto-select
89
+ </div>
90
+ </div>
91
+ <input
92
+ type="number"
93
+ value={autoSelectDelay}
94
+ onChange={(e) => {
95
+ const val = parseInt(e.target.value, 10);
96
+ if (!isNaN(val) && val >= 1 && val <= 120) {
97
+ onDelayChange(val);
98
+ }
99
+ }}
100
+ min={1}
101
+ max={120}
102
+ disabled={disabled}
103
+ className="w-20 p-2 text-center rounded-xl border border-black/20 dark:border-white/20 bg-transparent disabled:opacity-50"
104
+ />
105
+ </div>
106
+
107
+ {/* Stop button */}
108
+ <div className="mt-6">
109
+ <button
110
+ onClick={handleStop}
111
+ disabled={disabled}
112
+ className={`w-full py-4 rounded-2xl font-bold flex items-center justify-center gap-2 transition-colors ${
113
+ showStopConfirm
114
+ ? "bg-red-600 text-white hover:bg-red-700"
115
+ : "bg-red-500/10 text-red-500 hover:bg-red-500/20"
116
+ } ${disabled ? "opacity-50 cursor-not-allowed" : ""}`}
117
+ >
118
+ <Square className="w-5 h-5" />
119
+ {showStopConfirm ? "Click again to confirm" : "Stop Workflow"}
120
+ </button>
121
+ {showStopConfirm && (
122
+ <div className="text-center text-sm text-black/50 dark:text-white/50 mt-2">
123
+ This will terminate the CLI process
124
+ </div>
125
+ )}
126
+ </div>
127
+ </div>
128
+ </div>
129
+ );
130
+ }
@@ -199,6 +199,59 @@ body {
199
199
  color: rgba(0, 0, 0, 0.45);
200
200
  }
201
201
 
202
+ @keyframes check-pop {
203
+ 0% {
204
+ transform: scale(0.7);
205
+ opacity: 0;
206
+ }
207
+ 50% {
208
+ opacity: 1;
209
+ }
210
+ 100% {
211
+ transform: scale(1);
212
+ opacity: 1;
213
+ }
214
+ }
215
+
216
+ @keyframes check-draw {
217
+ 0% {
218
+ stroke-dashoffset: 30;
219
+ opacity: 0;
220
+ }
221
+ 40% {
222
+ opacity: 1;
223
+ }
224
+ 100% {
225
+ stroke-dashoffset: 0;
226
+ opacity: 1;
227
+ }
228
+ }
229
+
230
+ @keyframes ring-pop {
231
+ 0% {
232
+ transform: scale(0.7);
233
+ opacity: 0.5;
234
+ }
235
+ 100% {
236
+ transform: scale(1.2);
237
+ opacity: 0;
238
+ }
239
+ }
240
+
241
+ .checkmark-pop {
242
+ animation: check-pop 0.45s ease-out both;
243
+ }
244
+
245
+ .checkmark-draw {
246
+ stroke-dasharray: 30;
247
+ stroke-dashoffset: 30;
248
+ animation: check-draw 0.65s ease-out 0.15s forwards;
249
+ }
250
+
251
+ .success-ring {
252
+ animation: ring-pop 0.8s ease-out both;
253
+ }
254
+
202
255
  .dark .json-token-key {
203
256
  color: rgba(255, 255, 255, 0.8);
204
257
  }