@runfusion/fusion 0.38.0 → 0.38.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.
- package/dist/client/.vite/manifest.json +52 -52
- package/dist/client/assets/{AgentDetailView-CquLtIia.js → AgentDetailView-DuRYmHK3.js} +1 -1
- package/dist/client/assets/{AgentPermissionPolicyEditor-Dk-oEs1X.js → AgentPermissionPolicyEditor-ClY32kYN.js} +1 -1
- package/dist/client/assets/{AgentsView-BZVOpQ05.js → AgentsView-UbCAHs_i.js} +3 -3
- package/dist/client/assets/{ChatView-CErtz86Y.js → ChatView-DDDjYRKc.js} +1 -1
- package/dist/client/assets/{DevServerView-BRA00XoT.js → DevServerView-DY5GlJcD.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-D496NTjZ.js → DirectoryPicker-B4VRL2BH.js} +1 -1
- package/dist/client/assets/{DocumentsView-DIRlgdeB.js → DocumentsView-tqpIZ9t9.js} +1 -1
- package/dist/client/assets/{EvalsView-By5mtr80.js → EvalsView-C_Br3ry8.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-Br57oNdX.js → ExperimentalAgentOnboardingModal-lXM--LV-.js} +1 -1
- package/dist/client/assets/{GoalsView-COI14CWJ.js → GoalsView-CI3Bzs1b.js} +1 -1
- package/dist/client/assets/{InsightsView-Hm7vX2lr.js → InsightsView-BYfsVobi.js} +1 -1
- package/dist/client/assets/{MemoryView-BLozyYur.js → MemoryView-DT4vIhaW.js} +1 -1
- package/dist/client/assets/{NodesView-bXC6WoE2.js → NodesView-Dx6HFqjI.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-DEiqcMkx.js → PiExtensionsManager-BcGBnNiC.js} +1 -1
- package/dist/client/assets/{PluginManager-l4224zxk.js → PluginManager-T_XZ7iNI.js} +1 -1
- package/dist/client/assets/{ResearchView-CpsR1Q56.js → ResearchView-Bv4igpnv.js} +1 -1
- package/dist/client/assets/{SecretsView-Bwme1zZI.js → SecretsView-C4VX2ZTa.js} +1 -1
- package/dist/client/assets/{SettingsModal-DdrXxMPW.js → SettingsModal-CLEkhLK_.js} +3 -3
- package/dist/client/assets/{SettingsModal-32vUNWRe.js → SettingsModal-Cy42vswI.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-BFD9E0H_.js → SetupWizardModal-LqloAL4J.js} +1 -1
- package/dist/client/assets/{SkillsView-CZMLY7F_.js → SkillsView-I1SDKaRz.js} +1 -1
- package/dist/client/assets/{StashRecoveryView-jgZeWbZo.js → StashRecoveryView-DMUUR3cy.js} +1 -1
- package/dist/client/assets/{TodoView-DXdnOymj.js → TodoView-PKvJKjtV.js} +1 -1
- package/dist/client/assets/{dashboard-view-H8SnaCPP.js → dashboard-view-D4XVI1XP.js} +1 -1
- package/dist/client/assets/{folder-open-Dh5_gv6L.js → folder-open-Doam5g-y.js} +1 -1
- package/dist/client/assets/{index-w1dPHtmq.js → index-BS-jSWPW.js} +5 -5
- package/dist/client/assets/index-ktpD_W3I.css +1 -0
- package/dist/client/assets/{upload-ntU2YHPl.js → upload-BUfrZl69.js} +1 -1
- package/dist/client/assets/{users-BWK61s9U.js → users-XNGnYBJb.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/version.json +1 -1
- package/dist/droid-cli/package.json +1 -1
- package/dist/pi-claude-cli/package.json +1 -1
- package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
- package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
- package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-reports/package.json +1 -1
- package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
- package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-B9hAW3eU.css +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"../../../plugins/fusion-plugin-dependency-graph/src/dashboard-view.tsx": {
|
|
3
|
-
"file": "assets/dashboard-view-
|
|
3
|
+
"file": "assets/dashboard-view-D4XVI1XP.js",
|
|
4
4
|
"name": "dashboard-view",
|
|
5
5
|
"src": "../../../plugins/fusion-plugin-dependency-graph/src/dashboard-view.tsx",
|
|
6
6
|
"isDynamicEntry": true,
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"file": "assets/AgentPermissionPolicyEditor-CGxjOr6G.css",
|
|
33
33
|
"src": "_AgentPermissionPolicyEditor-CGxjOr6G.css"
|
|
34
34
|
},
|
|
35
|
-
"_AgentPermissionPolicyEditor-
|
|
36
|
-
"file": "assets/AgentPermissionPolicyEditor-
|
|
35
|
+
"_AgentPermissionPolicyEditor-ClY32kYN.js": {
|
|
36
|
+
"file": "assets/AgentPermissionPolicyEditor-ClY32kYN.js",
|
|
37
37
|
"name": "AgentPermissionPolicyEditor",
|
|
38
38
|
"imports": [
|
|
39
39
|
"index.html",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"assets/AgentPermissionPolicyEditor-CGxjOr6G.css"
|
|
44
44
|
]
|
|
45
45
|
},
|
|
46
|
-
"_DirectoryPicker-
|
|
47
|
-
"file": "assets/DirectoryPicker-
|
|
46
|
+
"_DirectoryPicker-B4VRL2BH.js": {
|
|
47
|
+
"file": "assets/DirectoryPicker-B4VRL2BH.js",
|
|
48
48
|
"name": "DirectoryPicker",
|
|
49
49
|
"imports": [
|
|
50
50
|
"_vendor-react-K0fH_qHe.js",
|
|
51
51
|
"index.html",
|
|
52
|
-
"_folder-open-
|
|
52
|
+
"_folder-open-Doam5g-y.js"
|
|
53
53
|
],
|
|
54
54
|
"css": [
|
|
55
55
|
"assets/DirectoryPicker-DzKVmxOf.css"
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"file": "assets/ExperimentalAgentOnboardingModal-BNpveCEk.css",
|
|
64
64
|
"src": "_ExperimentalAgentOnboardingModal-BNpveCEk.css"
|
|
65
65
|
},
|
|
66
|
-
"_ExperimentalAgentOnboardingModal-
|
|
67
|
-
"file": "assets/ExperimentalAgentOnboardingModal-
|
|
66
|
+
"_ExperimentalAgentOnboardingModal-lXM--LV-.js": {
|
|
67
|
+
"file": "assets/ExperimentalAgentOnboardingModal-lXM--LV-.js",
|
|
68
68
|
"name": "ExperimentalAgentOnboardingModal",
|
|
69
69
|
"imports": [
|
|
70
70
|
"_vendor-react-K0fH_qHe.js",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"assets/ExperimentalAgentOnboardingModal-BNpveCEk.css"
|
|
75
75
|
]
|
|
76
76
|
},
|
|
77
|
-
"_SettingsModal-
|
|
78
|
-
"file": "assets/SettingsModal-
|
|
77
|
+
"_SettingsModal-Cy42vswI.js": {
|
|
78
|
+
"file": "assets/SettingsModal-Cy42vswI.js",
|
|
79
79
|
"name": "SettingsModal",
|
|
80
80
|
"imports": [
|
|
81
81
|
"_vendor-react-K0fH_qHe.js",
|
|
@@ -120,8 +120,8 @@
|
|
|
120
120
|
"_vendor-react-K0fH_qHe.js"
|
|
121
121
|
]
|
|
122
122
|
},
|
|
123
|
-
"_folder-open-
|
|
124
|
-
"file": "assets/folder-open-
|
|
123
|
+
"_folder-open-Doam5g-y.js": {
|
|
124
|
+
"file": "assets/folder-open-Doam5g-y.js",
|
|
125
125
|
"name": "folder-open",
|
|
126
126
|
"imports": [
|
|
127
127
|
"index.html"
|
|
@@ -131,15 +131,15 @@
|
|
|
131
131
|
"file": "assets/projectDetection-G3XuxD2X.js",
|
|
132
132
|
"name": "projectDetection"
|
|
133
133
|
},
|
|
134
|
-
"_upload-
|
|
135
|
-
"file": "assets/upload-
|
|
134
|
+
"_upload-BUfrZl69.js": {
|
|
135
|
+
"file": "assets/upload-BUfrZl69.js",
|
|
136
136
|
"name": "upload",
|
|
137
137
|
"imports": [
|
|
138
138
|
"index.html"
|
|
139
139
|
]
|
|
140
140
|
},
|
|
141
|
-
"_users-
|
|
142
|
-
"file": "assets/users-
|
|
141
|
+
"_users-XNGnYBJb.js": {
|
|
142
|
+
"file": "assets/users-XNGnYBJb.js",
|
|
143
143
|
"name": "users",
|
|
144
144
|
"imports": [
|
|
145
145
|
"index.html"
|
|
@@ -169,15 +169,15 @@
|
|
|
169
169
|
"src": "_vendor-xterm-LZoznX6r.css"
|
|
170
170
|
},
|
|
171
171
|
"components/AgentDetailView.tsx": {
|
|
172
|
-
"file": "assets/AgentDetailView-
|
|
172
|
+
"file": "assets/AgentDetailView-DuRYmHK3.js",
|
|
173
173
|
"name": "AgentDetailView",
|
|
174
174
|
"src": "components/AgentDetailView.tsx",
|
|
175
175
|
"isDynamicEntry": true,
|
|
176
176
|
"imports": [
|
|
177
177
|
"_vendor-react-K0fH_qHe.js",
|
|
178
178
|
"index.html",
|
|
179
|
-
"_AgentPermissionPolicyEditor-
|
|
180
|
-
"_ExperimentalAgentOnboardingModal-
|
|
179
|
+
"_AgentPermissionPolicyEditor-ClY32kYN.js",
|
|
180
|
+
"_ExperimentalAgentOnboardingModal-lXM--LV-.js",
|
|
181
181
|
"_vendor-xterm-DzcZoU0P.js",
|
|
182
182
|
"_vendor-codemirror-jBKmHyH0.js"
|
|
183
183
|
],
|
|
@@ -186,16 +186,16 @@
|
|
|
186
186
|
]
|
|
187
187
|
},
|
|
188
188
|
"components/AgentsView.tsx": {
|
|
189
|
-
"file": "assets/AgentsView-
|
|
189
|
+
"file": "assets/AgentsView-UbCAHs_i.js",
|
|
190
190
|
"name": "AgentsView",
|
|
191
191
|
"src": "components/AgentsView.tsx",
|
|
192
192
|
"isDynamicEntry": true,
|
|
193
193
|
"imports": [
|
|
194
194
|
"index.html",
|
|
195
195
|
"_vendor-react-K0fH_qHe.js",
|
|
196
|
-
"_ExperimentalAgentOnboardingModal-
|
|
197
|
-
"_upload-
|
|
198
|
-
"_folder-open-
|
|
196
|
+
"_ExperimentalAgentOnboardingModal-lXM--LV-.js",
|
|
197
|
+
"_upload-BUfrZl69.js",
|
|
198
|
+
"_folder-open-Doam5g-y.js",
|
|
199
199
|
"_vendor-xterm-DzcZoU0P.js",
|
|
200
200
|
"_vendor-codemirror-jBKmHyH0.js"
|
|
201
201
|
],
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
]
|
|
208
208
|
},
|
|
209
209
|
"components/ChatView.tsx": {
|
|
210
|
-
"file": "assets/ChatView-
|
|
210
|
+
"file": "assets/ChatView-DDDjYRKc.js",
|
|
211
211
|
"name": "ChatView",
|
|
212
212
|
"src": "components/ChatView.tsx",
|
|
213
213
|
"isDynamicEntry": true,
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
]
|
|
223
223
|
},
|
|
224
224
|
"components/DevServerView.tsx": {
|
|
225
|
-
"file": "assets/DevServerView-
|
|
225
|
+
"file": "assets/DevServerView-DY5GlJcD.js",
|
|
226
226
|
"name": "DevServerView",
|
|
227
227
|
"src": "components/DevServerView.tsx",
|
|
228
228
|
"isDynamicEntry": true,
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
]
|
|
238
238
|
},
|
|
239
239
|
"components/DocumentsView.tsx": {
|
|
240
|
-
"file": "assets/DocumentsView-
|
|
240
|
+
"file": "assets/DocumentsView-tqpIZ9t9.js",
|
|
241
241
|
"name": "DocumentsView",
|
|
242
242
|
"src": "components/DocumentsView.tsx",
|
|
243
243
|
"isDynamicEntry": true,
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
]
|
|
253
253
|
},
|
|
254
254
|
"components/EvalsView.tsx": {
|
|
255
|
-
"file": "assets/EvalsView-
|
|
255
|
+
"file": "assets/EvalsView-C_Br3ry8.js",
|
|
256
256
|
"name": "EvalsView",
|
|
257
257
|
"src": "components/EvalsView.tsx",
|
|
258
258
|
"isDynamicEntry": true,
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
]
|
|
268
268
|
},
|
|
269
269
|
"components/GoalsView.tsx": {
|
|
270
|
-
"file": "assets/GoalsView-
|
|
270
|
+
"file": "assets/GoalsView-CI3Bzs1b.js",
|
|
271
271
|
"name": "GoalsView",
|
|
272
272
|
"src": "components/GoalsView.tsx",
|
|
273
273
|
"isDynamicEntry": true,
|
|
@@ -282,14 +282,14 @@
|
|
|
282
282
|
]
|
|
283
283
|
},
|
|
284
284
|
"components/InsightsView.tsx": {
|
|
285
|
-
"file": "assets/InsightsView-
|
|
285
|
+
"file": "assets/InsightsView-BYfsVobi.js",
|
|
286
286
|
"name": "InsightsView",
|
|
287
287
|
"src": "components/InsightsView.tsx",
|
|
288
288
|
"isDynamicEntry": true,
|
|
289
289
|
"imports": [
|
|
290
290
|
"_vendor-react-K0fH_qHe.js",
|
|
291
291
|
"index.html",
|
|
292
|
-
"_users-
|
|
292
|
+
"_users-XNGnYBJb.js",
|
|
293
293
|
"_vendor-xterm-DzcZoU0P.js",
|
|
294
294
|
"_vendor-codemirror-jBKmHyH0.js"
|
|
295
295
|
],
|
|
@@ -298,13 +298,13 @@
|
|
|
298
298
|
]
|
|
299
299
|
},
|
|
300
300
|
"components/MemoryView.tsx": {
|
|
301
|
-
"file": "assets/MemoryView-
|
|
301
|
+
"file": "assets/MemoryView-DT4vIhaW.js",
|
|
302
302
|
"name": "MemoryView",
|
|
303
303
|
"src": "components/MemoryView.tsx",
|
|
304
304
|
"isDynamicEntry": true,
|
|
305
305
|
"imports": [
|
|
306
306
|
"_vendor-react-K0fH_qHe.js",
|
|
307
|
-
"_SettingsModal-
|
|
307
|
+
"_SettingsModal-Cy42vswI.js",
|
|
308
308
|
"index.html",
|
|
309
309
|
"_vendor-xterm-DzcZoU0P.js",
|
|
310
310
|
"_vendor-codemirror-jBKmHyH0.js"
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
]
|
|
315
315
|
},
|
|
316
316
|
"components/NodesView.tsx": {
|
|
317
|
-
"file": "assets/NodesView-
|
|
317
|
+
"file": "assets/NodesView-Dx6HFqjI.js",
|
|
318
318
|
"name": "NodesView",
|
|
319
319
|
"src": "components/NodesView.tsx",
|
|
320
320
|
"isDynamicEntry": true,
|
|
@@ -322,7 +322,7 @@
|
|
|
322
322
|
"_vendor-react-K0fH_qHe.js",
|
|
323
323
|
"index.html",
|
|
324
324
|
"_projectDetection-G3XuxD2X.js",
|
|
325
|
-
"_upload-
|
|
325
|
+
"_upload-BUfrZl69.js",
|
|
326
326
|
"_vendor-xterm-DzcZoU0P.js",
|
|
327
327
|
"_vendor-codemirror-jBKmHyH0.js"
|
|
328
328
|
],
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
]
|
|
332
332
|
},
|
|
333
333
|
"components/PiExtensionsManager.tsx": {
|
|
334
|
-
"file": "assets/PiExtensionsManager-
|
|
334
|
+
"file": "assets/PiExtensionsManager-BcGBnNiC.js",
|
|
335
335
|
"name": "PiExtensionsManager",
|
|
336
336
|
"src": "components/PiExtensionsManager.tsx",
|
|
337
337
|
"isDynamicEntry": true,
|
|
@@ -346,17 +346,17 @@
|
|
|
346
346
|
]
|
|
347
347
|
},
|
|
348
348
|
"components/PluginManager.tsx": {
|
|
349
|
-
"file": "assets/PluginManager-
|
|
349
|
+
"file": "assets/PluginManager-T_XZ7iNI.js",
|
|
350
350
|
"name": "PluginManager",
|
|
351
351
|
"src": "components/PluginManager.tsx",
|
|
352
352
|
"isDynamicEntry": true,
|
|
353
353
|
"imports": [
|
|
354
354
|
"_vendor-react-K0fH_qHe.js",
|
|
355
355
|
"index.html",
|
|
356
|
-
"_DirectoryPicker-
|
|
356
|
+
"_DirectoryPicker-B4VRL2BH.js",
|
|
357
357
|
"_vendor-xterm-DzcZoU0P.js",
|
|
358
358
|
"_vendor-codemirror-jBKmHyH0.js",
|
|
359
|
-
"_folder-open-
|
|
359
|
+
"_folder-open-Doam5g-y.js"
|
|
360
360
|
],
|
|
361
361
|
"css": [
|
|
362
362
|
"assets/PluginManager-BJQXdUmV.css"
|
|
@@ -375,7 +375,7 @@
|
|
|
375
375
|
]
|
|
376
376
|
},
|
|
377
377
|
"components/ResearchView.tsx": {
|
|
378
|
-
"file": "assets/ResearchView-
|
|
378
|
+
"file": "assets/ResearchView-Bv4igpnv.js",
|
|
379
379
|
"name": "ResearchView",
|
|
380
380
|
"src": "components/ResearchView.tsx",
|
|
381
381
|
"isDynamicEntry": true,
|
|
@@ -390,7 +390,7 @@
|
|
|
390
390
|
]
|
|
391
391
|
},
|
|
392
392
|
"components/SecretsView.tsx": {
|
|
393
|
-
"file": "assets/SecretsView-
|
|
393
|
+
"file": "assets/SecretsView-C4VX2ZTa.js",
|
|
394
394
|
"name": "SecretsView",
|
|
395
395
|
"src": "components/SecretsView.tsx",
|
|
396
396
|
"isDynamicEntry": true,
|
|
@@ -405,16 +405,16 @@
|
|
|
405
405
|
]
|
|
406
406
|
},
|
|
407
407
|
"components/SettingsModal.tsx": {
|
|
408
|
-
"file": "assets/SettingsModal-
|
|
408
|
+
"file": "assets/SettingsModal-CLEkhLK_.js",
|
|
409
409
|
"name": "SettingsModal",
|
|
410
410
|
"src": "components/SettingsModal.tsx",
|
|
411
411
|
"isDynamicEntry": true,
|
|
412
412
|
"imports": [
|
|
413
413
|
"index.html",
|
|
414
414
|
"_vendor-react-K0fH_qHe.js",
|
|
415
|
-
"_SettingsModal-
|
|
416
|
-
"_users-
|
|
417
|
-
"_AgentPermissionPolicyEditor-
|
|
415
|
+
"_SettingsModal-Cy42vswI.js",
|
|
416
|
+
"_users-XNGnYBJb.js",
|
|
417
|
+
"_AgentPermissionPolicyEditor-ClY32kYN.js",
|
|
418
418
|
"components/SecretsView.tsx",
|
|
419
419
|
"_vendor-xterm-DzcZoU0P.js",
|
|
420
420
|
"_vendor-codemirror-jBKmHyH0.js"
|
|
@@ -428,25 +428,25 @@
|
|
|
428
428
|
]
|
|
429
429
|
},
|
|
430
430
|
"components/SetupWizardModal.tsx": {
|
|
431
|
-
"file": "assets/SetupWizardModal-
|
|
431
|
+
"file": "assets/SetupWizardModal-LqloAL4J.js",
|
|
432
432
|
"name": "SetupWizardModal",
|
|
433
433
|
"src": "components/SetupWizardModal.tsx",
|
|
434
434
|
"isDynamicEntry": true,
|
|
435
435
|
"imports": [
|
|
436
436
|
"_vendor-react-K0fH_qHe.js",
|
|
437
437
|
"index.html",
|
|
438
|
-
"_DirectoryPicker-
|
|
438
|
+
"_DirectoryPicker-B4VRL2BH.js",
|
|
439
439
|
"_projectDetection-G3XuxD2X.js",
|
|
440
440
|
"_vendor-xterm-DzcZoU0P.js",
|
|
441
441
|
"_vendor-codemirror-jBKmHyH0.js",
|
|
442
|
-
"_folder-open-
|
|
442
|
+
"_folder-open-Doam5g-y.js"
|
|
443
443
|
],
|
|
444
444
|
"css": [
|
|
445
445
|
"assets/SetupWizardModal-CGYGKurR.css"
|
|
446
446
|
]
|
|
447
447
|
},
|
|
448
448
|
"components/SkillsView.tsx": {
|
|
449
|
-
"file": "assets/SkillsView-
|
|
449
|
+
"file": "assets/SkillsView-I1SDKaRz.js",
|
|
450
450
|
"name": "SkillsView",
|
|
451
451
|
"src": "components/SkillsView.tsx",
|
|
452
452
|
"isDynamicEntry": true,
|
|
@@ -461,7 +461,7 @@
|
|
|
461
461
|
]
|
|
462
462
|
},
|
|
463
463
|
"components/StashRecoveryView.tsx": {
|
|
464
|
-
"file": "assets/StashRecoveryView-
|
|
464
|
+
"file": "assets/StashRecoveryView-DMUUR3cy.js",
|
|
465
465
|
"name": "StashRecoveryView",
|
|
466
466
|
"src": "components/StashRecoveryView.tsx",
|
|
467
467
|
"isDynamicEntry": true,
|
|
@@ -476,7 +476,7 @@
|
|
|
476
476
|
]
|
|
477
477
|
},
|
|
478
478
|
"components/TodoView.tsx": {
|
|
479
|
-
"file": "assets/TodoView-
|
|
479
|
+
"file": "assets/TodoView-PKvJKjtV.js",
|
|
480
480
|
"name": "TodoView",
|
|
481
481
|
"src": "components/TodoView.tsx",
|
|
482
482
|
"isDynamicEntry": true,
|
|
@@ -491,7 +491,7 @@
|
|
|
491
491
|
]
|
|
492
492
|
},
|
|
493
493
|
"index.html": {
|
|
494
|
-
"file": "assets/index-
|
|
494
|
+
"file": "assets/index-BS-jSWPW.js",
|
|
495
495
|
"name": "index",
|
|
496
496
|
"src": "index.html",
|
|
497
497
|
"isEntry": true,
|
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
"components/StashRecoveryView.tsx"
|
|
545
545
|
],
|
|
546
546
|
"css": [
|
|
547
|
-
"assets/index-
|
|
547
|
+
"assets/index-ktpD_W3I.css"
|
|
548
548
|
]
|
|
549
549
|
}
|
|
550
550
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as t,j as e}from"./vendor-react-K0fH_qHe.js";import{c as Os,e0 as zt,e1 as Ht,e2 as Bt,e3 as It,L as q,R as ws,az as et,Z as Ot,aA as As,_ as ys,a as ht,b as ft,e4 as _t,e5 as Ut,e6 as Vt,v as gt,d0 as Jt,e7 as Wt,z as I,e8 as qt,e9 as xt,ea as bt,eb as Gt,j as Ss,D as Fs,s as js,bE as pt,k as vt,Q as Es,A as ks,O as st,a$ as Je,ec as Kt,X as jt,F as ns,ed as Yt,cx as Nt,ee as yt,ef as Zt,cU as Qt,ax as Xt,bD as ea,aB as St,B as _s,a1 as sa,$ as tt,a5 as ta,a6 as aa,eg as Bs,l as kt,eh as na,bR as ia,r as la,ay as Ct,a4 as wt,ei as ra,C as me,ej as Rt,ek as at,bH as nt,el as oa,em as ca,en as da,eo as ua,ep as is,af as ls,ah as rs,ai as os,ad as Mt,eq as ma,er as ha,h as fa,d3 as ga,i as xa,a2 as it,es as ba,et as pa,m as va,eu as Is,ev as ja,ew as Na,V as ya,ex as Sa,ey as ka,ez as At,eA as Ca,eB as wa,eC as Ra,eD as Ma,eE as Aa}from"./index-
|
|
1
|
+
import{r as t,j as e}from"./vendor-react-K0fH_qHe.js";import{c as Os,e0 as zt,e1 as Ht,e2 as Bt,e3 as It,L as q,R as ws,az as et,Z as Ot,aA as As,_ as ys,a as ht,b as ft,e4 as _t,e5 as Ut,e6 as Vt,v as gt,d0 as Jt,e7 as Wt,z as I,e8 as qt,e9 as xt,ea as bt,eb as Gt,j as Ss,D as Fs,s as js,bE as pt,k as vt,Q as Es,A as ks,O as st,a$ as Je,ec as Kt,X as jt,F as ns,ed as Yt,cx as Nt,ee as yt,ef as Zt,cU as Qt,ax as Xt,bD as ea,aB as St,B as _s,a1 as sa,$ as tt,a5 as ta,a6 as aa,eg as Bs,l as kt,eh as na,bR as ia,r as la,ay as Ct,a4 as wt,ei as ra,C as me,ej as Rt,ek as at,bH as nt,el as oa,em as ca,en as da,eo as ua,ep as is,af as ls,ah as rs,ai as os,ad as Mt,eq as ma,er as ha,h as fa,d3 as ga,i as xa,a2 as it,es as ba,et as pa,m as va,eu as Is,ev as ja,ew as Na,V as ya,ex as Sa,ey as ka,ez as At,eA as Ca,eB as wa,eC as Ra,eD as Ma,eE as Aa}from"./index-BS-jSWPW.js";import{S as Ft,A as Fa}from"./AgentPermissionPolicyEditor-ClY32kYN.js";import{f as Ps,S as Ea,E as Pa}from"./ExperimentalAgentOnboardingModal-lXM--LV-.js";import"./vendor-xterm-DzcZoU0P.js";import"./vendor-codemirror-jBKmHyH0.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as f,dZ as h,eK as j,eL as k}from"./index-
|
|
1
|
+
import{c as f,dZ as h,eK as j,eL as k}from"./index-BS-jSWPW.js";import{j as e}from"./vendor-react-K0fH_qHe.js";/**
|
|
2
2
|
* @license lucide-react v1.7.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentDetailView-
|
|
2
|
-
import{c as pt,A as Je,C as gt,Z as Is,s as Ps,r as Et,F as Mt,f as zs,a as Fs,b as us,B as _t,u as ms,d as Nt,e as Os,g as Ds,h as Hs,i as Bs,j as Lt,k as ht,P as Ws,l as Gs,m as Vs,n as Ks,o as qt,G as Us,S as Ys,L as yt,T as kt,R as Ze,X as Zt,p as Xs,q as qs,t as ct,v as Zs,w as Jt,x as Js,y as Qs,z as pe,D as at,E as ea,M as ta,H as sa,I as Qt,N as es,J as ts,K as aa,O as Ct,Q as dt,U as na,V as la,W as ia,Y as ra,_ as oa,$ as ss,a0 as ca,a1 as da,a2 as ut,a3 as ua,a4 as as,a5 as ma,a6 as ga}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentDetailView-DuRYmHK3.js","assets/vendor-react-K0fH_qHe.js","assets/index-BS-jSWPW.js","assets/vendor-xterm-DzcZoU0P.js","assets/vendor-xterm-LZoznX6r.css","assets/vendor-codemirror-jBKmHyH0.js","assets/index-ktpD_W3I.css","assets/AgentPermissionPolicyEditor-ClY32kYN.js","assets/AgentPermissionPolicyEditor-CGxjOr6G.css","assets/ExperimentalAgentOnboardingModal-lXM--LV-.js","assets/ExperimentalAgentOnboardingModal-BNpveCEk.css","assets/AgentDetailView-CY-O6VkV.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as pt,A as Je,C as gt,Z as Is,s as Ps,r as Et,F as Mt,f as zs,a as Fs,b as us,B as _t,u as ms,d as Nt,e as Os,g as Ds,h as Hs,i as Bs,j as Lt,k as ht,P as Ws,l as Gs,m as Vs,n as Ks,o as qt,G as Us,S as Ys,L as yt,T as kt,R as Ze,X as Zt,p as Xs,q as qs,t as ct,v as Zs,w as Jt,x as Js,y as Qs,z as pe,D as at,E as ea,M as ta,H as sa,I as Qt,N as es,J as ts,K as aa,O as Ct,Q as dt,U as na,V as la,W as ia,Y as ra,_ as oa,$ as ss,a0 as ca,a1 as da,a2 as ut,a3 as ua,a4 as as,a5 as ma,a6 as ga}from"./index-BS-jSWPW.js";import{r as s,j as e,a as ha}from"./vendor-react-K0fH_qHe.js";import{A as pa,S as xa,E as ba,f as va}from"./ExperimentalAgentOnboardingModal-lXM--LV-.js";import{U as It}from"./upload-BUfrZl69.js";import{F as fa}from"./folder-open-Doam5g-y.js";import"./vendor-xterm-DzcZoU0P.js";import"./vendor-codemirror-jBKmHyH0.js";/**
|
|
3
3
|
* @license lucide-react v1.7.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -26,4 +26,4 @@ reportsTo: null
|
|
|
26
26
|
skills:
|
|
27
27
|
- review
|
|
28
28
|
---
|
|
29
|
-
Agent instructions go here...`,value:j,onChange:i=>{f("paste"),y([]),k(i.target.value),O(null)},rows:8,"aria-label":"Manifest content"})]}),e.jsxs("p",{className:"agent-import-file-hint",children:["Current input: ",d]}),le&&e.jsxs("p",{className:"agent-dialog-error",children:[e.jsx(kt,{size:14}),le]})]}),b==="preview"&&e.jsxs("div",{className:"agent-import-preview",children:[e.jsxs("div",{className:"agent-import-company",children:[e.jsx("span",{className:"agent-import-company-label",children:"Company"}),e.jsx("span",{className:"agent-import-company-name",children:C})]}),e.jsxs("div",{className:"agent-import-count",children:[e.jsx(Mt,{size:14}),e.jsxs("span",{children:[L.length," agent",L.length!==1?"s":""," found"]})]}),L.length>0&&e.jsxs("div",{className:"agent-import-selection-controls",children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>F(L.map(i=>i.name)),children:"Select all agents"}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>F([]),children:"Clear agents"})]}),L.length>0?e.jsx("div",{className:"agent-import-agent-list",children:L.map((i,p)=>e.jsxs("div",{className:"agent-import-agent-item",children:[e.jsx("label",{className:"checkbox-label",children:e.jsx("input",{type:"checkbox","aria-label":`Select agent ${i.name}`,checked:v.includes(i.name),onChange:()=>Me(i.name)})}),e.jsx("span",{className:"agent-import-agent-icon",children:i.icon||"🤖"}),e.jsxs("div",{className:"agent-import-agent-details",children:[e.jsx("span",{className:"agent-import-agent-name",children:i.name}),e.jsxs("span",{className:"agent-import-agent-meta",children:[i.title&&e.jsxs("span",{className:"agent-import-agent-title",children:[i.title," · "]}),e.jsx("span",{className:"agent-import-agent-role",children:i.role}),i.reportsTo&&e.jsxs("span",{className:"agent-import-agent-reports",children:[" · reports to ",i.reportsTo]}),i.skills&&i.skills.length>0&&e.jsxs("span",{className:"agent-import-agent-model",children:[" · skills: ",i.skills.join(", ")]})]}),i.instructionsText&&e.jsxs("span",{className:"agent-import-agent-instructions",children:[i.instructionsText.slice(0,100),i.instructionsText.length>100?"...":""]})]})]},p))}):e.jsx("p",{className:"agent-import-empty",children:"No agents found in the manifest."}),$.length>0&&e.jsxs("div",{className:"agent-import-skills-section",children:[e.jsxs("div",{className:"agent-import-count",children:[e.jsx(Mt,{size:14}),e.jsxs("span",{children:[$.length," skill",$.length!==1?"s":""," found"]})]}),e.jsxs("div",{className:"agent-import-selection-controls",children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>q($.map(i=>i.name)),children:"Select all skills"}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>q([]),children:"Clear skills"})]}),e.jsx("div",{className:"agent-import-skill-list",children:$.map((i,p)=>e.jsxs("div",{className:"agent-import-skill-item",children:[e.jsx("label",{className:"checkbox-label",children:e.jsx("input",{type:"checkbox","aria-label":`Select skill ${i.name}`,checked:P.includes(i.name),onChange:()=>Ae(i.name)})}),e.jsx("span",{className:"agent-import-skill-icon",children:"⚡"}),e.jsxs("div",{className:"agent-import-skill-details",children:[e.jsx("span",{className:"agent-import-skill-name",children:i.name}),i.description&&e.jsx("span",{className:"agent-import-skill-description",children:i.description})]})]},`${i.name}-${p}`))})]}),me&&e.jsxs("p",{className:"agent-dialog-error",children:[e.jsx(kt,{size:14}),me]})]}),b==="result"&&N&&e.jsxs("div",{className:"agent-import-result",children:[e.jsx("div",{className:"agent-import-result-icon",children:e.jsx(gt,{size:32})}),e.jsx("h3",{className:"agent-import-result-title",children:"Import Complete"}),e.jsxs("p",{className:"agent-import-result-company",children:["From ",e.jsx("strong",{children:N.companyName??"Unknown"})]}),e.jsxs("div",{className:"agent-import-result-stats",children:[N.created.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--success",children:e.jsxs("span",{children:[N.created.length," created"]})}),N.skipped.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--skipped",children:e.jsxs("span",{children:[N.skipped.length," skipped (already exist)"]})}),N.errors.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--error",children:e.jsxs("span",{children:[N.errors.length," error",N.errors.length!==1?"s":""]})})]}),N.created.length>0&&e.jsx("div",{className:"agent-import-result-agents",children:N.created.map((i,p)=>e.jsxs("div",{className:"agent-import-result-agent",children:[e.jsx(gt,{size:12}),e.jsx("span",{children:i.name})]},p))}),N.errors.length>0&&e.jsx("div",{className:"agent-import-result-errors",children:N.errors.map((i,p)=>e.jsxs("div",{className:"agent-import-result-error",children:[e.jsx(Zt,{size:12}),e.jsxs("span",{children:[i.name,": ",i.error]})]},p))}),N.skills&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"agent-import-result-divider"}),e.jsx("h4",{className:"agent-import-result-section-title",children:"Skills"}),e.jsxs("div",{className:"agent-import-result-stats",children:[N.skills.imported.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--success",children:e.jsxs("span",{children:[N.skills.imported.length," skill",N.skills.imported.length!==1?"s":""," imported"]})}),N.skills.skipped.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--skipped",children:e.jsxs("span",{children:[N.skills.skipped.length," skill",N.skills.skipped.length!==1?"s":""," skipped (already exist)"]})}),N.skills.errors.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--error",children:e.jsxs("span",{children:[N.skills.errors.length," skill",N.skills.errors.length!==1?"s":""," error",N.skills.errors.length!==1?"s":""]})}),N.skills.imported.length===0&&N.skills.skipped.length===0&&N.skills.errors.length===0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--skipped",children:e.jsx("span",{children:"No skills in package"})})]}),N.skills.imported.length>0&&e.jsx("div",{className:"agent-import-result-agents",children:N.skills.imported.map((i,p)=>e.jsxs("div",{className:"agent-import-result-agent",children:[e.jsx(gt,{size:12}),e.jsx("span",{children:i.name})]},p))}),N.skills.errors.length>0&&e.jsx("div",{className:"agent-import-result-errors",children:N.skills.errors.map((i,p)=>e.jsxs("div",{className:"agent-import-result-error",children:[e.jsx(Zt,{size:12}),e.jsxs("span",{children:[i.name,": ",i.error]})]},p))})]})]})]}),e.jsxs("div",{className:"agent-dialog-footer",children:[b==="preview"&&e.jsx("button",{className:"btn",onClick:()=>o("input"),disabled:V,children:"Back"}),e.jsx("button",{className:"btn",onClick:Ne,disabled:V,children:b==="result"?"Close":"Cancel"}),b==="input"&&e.jsx("button",{className:"btn btn-task-create",onClick:()=>void Te(),disabled:xe||(d==="directory"?R.length===0:d==="browse"?!K:!j.trim()),children:xe?e.jsxs(e.Fragment,{children:[e.jsx(yt,{size:14,className:"spin"}),"Parsing..."]}):"Preview"}),b==="preview"&&e.jsx("button",{className:"btn btn-task-create",onClick:()=>void ze(),disabled:V||T===0&&M===0,children:V?e.jsxs(e.Fragment,{children:[e.jsx(yt,{size:14,className:"spin"}),ce]}):`Import ${Ee}`})]})]})}):null}const Rt="fn-agent-org-chart-layout";function cs(a){return a==="auto"||a==="horizontal"||a==="vertical"}const Da=768,Ha={nodeWidth:220,siblingGap:24,rootGap:24,chartPadding:24},Ba={nodeWidth:160,siblingGap:8,rootGap:8,chartPadding:8};function gs(a){return a.children.length===0?1:a.children.reduce((r,x)=>r+gs(x),0)}function Wa(a){return a<=Da?Ba:Ha}function Ga(a,r){const x=gs(a);return x*r.nodeWidth+Math.max(0,x-1)*r.siblingGap}function Va(a,r=Number.POSITIVE_INFINITY){const x=Wa(r);if(a.length===0)return x.nodeWidth;const h=a.map(o=>Ga(o,x)).reduce((o,d)=>o+d,0),b=Math.max(0,a.length-1)*x.rootGap;return h+b+x.chartPadding*2}function Ka(a){const r=a.preference??"auto";if(r!=="auto")return r;const x=Number.isFinite(a.availableWidth)&&a.availableWidth>0?a.availableWidth:0;return x===0||a.tree.length<=1?"horizontal":Va(a.tree,x)>x?"vertical":"horizontal"}const ds=s.lazy(()=>ca(()=>import("./AgentDetailView-CquLtIia.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(a=>({default:a.AgentDetailView}))),$t=[{value:"triage",label:"Triage",icon:"⊕"},{value:"executor",label:"Executor",icon:"▶"},{value:"reviewer",label:"Reviewer",icon:"⊙"},{value:"merger",label:"Merger",icon:"⊞"},{value:"scheduler",label:"Scheduler",icon:"◷"},{value:"engineer",label:"Engineer",icon:"⎔"},{value:"custom",label:"Custom",icon:"✦"}],Tt=[.1,.25,.5,1,2,3,5,10],Ua=.25,Ya=3,mt=16,qe=32;function Pt(a){switch(a){case"running":return"agent-badge--running";case"active":return"agent-badge--active";case"paused":return"agent-badge--paused";case"error":return"agent-badge--error";case"idle":default:return"agent-badge--idle"}}function zt(a,r){switch(r){case"running":return`${a}--running`;case"active":return`${a}--active`;case"paused":return`${a}--paused`;case"error":return`${a}--error`;case"idle":default:return`${a}--idle`}}function hs(a){return a.children.length===0?1:a.children.reduce((r,x)=>r+hs(x),0)}function Ft(a,r){return a.state==="error"?{title:void 0,label:"Error"}:{title:r.reason??r.label,label:r.stateDerived?null:r.label}}function ps({node:a,onSelect:r,getHealthStatus:x,selectedAgentId:g,registerNodeElement:h,linksRef:b}){const{agent:o,children:d}=a,f=x(o),j=Ft(o,f),k=Pt(o.state),R=zt("org-chart-node-card",o.state),y=hs(a),C={"--org-chart-subtree-leaves":String(y)};return e.jsxs("div",{className:`org-chart-node${d.length>0?" org-chart-node--has-children":""}`,style:C,children:[e.jsxs("div",{ref:E=>h(o.id,E),"data-agent-id":o.id,className:`org-chart-node-card ${R}${g===o.id?" agent-card--selected":""}`,onClick:()=>r(o.id),role:"button",tabIndex:0,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.key===" "&&E.preventDefault(),r(o.id))},children:[e.jsxs("div",{className:"org-chart-node__header",children:[e.jsx("span",{className:"org-chart-node__icon",children:e.jsx(ht,{agent:o,size:20})}),e.jsx("span",{className:"org-chart-node__name",children:o.name})]}),e.jsxs("div",{className:"org-chart-node__meta",children:[e.jsx("span",{className:`org-chart-node__badge ${k}`,children:o.state}),e.jsxs("span",{className:"org-chart-node__health",style:{color:f.color},title:j.title,children:[f.icon,j.label&&e.jsx("span",{className:"text-secondary",children:j.label})]})]})]}),d.length>0&&e.jsx("div",{className:"org-chart-children",role:"group","aria-label":`${o.name} employees`,children:d.map(E=>(b.current.push({parentId:o.id,childId:E.agent.id}),e.jsx(ps,{node:E,onSelect:r,getHealthStatus:x,selectedAgentId:g,registerNodeElement:h,linksRef:b},E.agent.id)))})]})}function Xa({links:a,nodeElements:r,canvasRef:x,viewportRef:g,layoutMode:h,transform:b}){const[o,d]=s.useState([]);return s.useLayoutEffect(()=>{const f=x.current,j=g.current;if(!f||!j||a.length===0){d([]);return}const k=()=>{const y=f.getBoundingClientRect(),C=a.flatMap(({parentId:E,childId:L})=>{const W=r.get(E),$=r.get(L);if(!W||!$)return[];const _=W.getBoundingClientRect(),v=$.getBoundingClientRect(),F=(_.left-y.left)/b.scale,P=(_.top-y.top)/b.scale,q=(v.left-y.left)/b.scale,xe=(v.top-y.top)/b.scale;if(h==="vertical"){const N=F,ue=P+_.height/b.scale/2,me=q,S=xe+v.height/b.scale/2,Z=N-(N-me)/2;return[`M ${N} ${ue} L ${Z} ${ue} L ${Z} ${S} L ${me} ${S}`]}const ne=F+_.width/b.scale/2,V=P+_.height/b.scale,ae=q+v.width/b.scale/2,le=xe,O=V+(le-V)/2;return[`M ${ne} ${V} L ${ne} ${O} L ${ae} ${O} L ${ae} ${le}`]});d(C)};k();const R=new ResizeObserver(k);return R.observe(f),R.observe(j),r.forEach(y=>R.observe(y)),()=>R.disconnect()},[x,h,a,r,b.scale,g]),e.jsx("svg",{className:"agent-org-chart-connectors","aria-hidden":"true",children:o.map((f,j)=>e.jsx("path",{d:f},`${j}-${f}`))})}function an({addToast:a,projectId:r,onOpenTaskLogs:x,agentOnboardingEnabled:g=!1}){const[h,b]=s.useState(!1),d=Xs()==="mobile",[f,j]=s.useState("all"),{agents:k,stats:R,isLoading:y,loadAgents:C,refreshAgents:E}=qs(r,{filterState:f,showSystemAgents:h}),[L,W]=s.useState(!1),[$,_]=s.useState(null),[v,F]=s.useState(!1),[P,q]=s.useState(null),[xe,ne]=s.useState(null),V=d&&!!P,[ae,le]=s.useState("dashboard"),[O,N]=s.useState(null),[ue,me]=s.useState(!1),[S,Z]=s.useState(()=>{if(typeof window>"u")return"list";const t=ct("fn-agent-view",r);return t==="list"||t==="board"||t==="org"?t:"list"}),[ie,$e]=s.useState(()=>{if(typeof window>"u")return"auto";const t=ct(Rt,r);return cs(t)?t:"auto"}),[ee,te]=s.useState([]),[be,K]=s.useState(!1),[ge,je]=s.useState(0),[re,G]=s.useState(!1),[oe,he]=s.useState(!1),[Le,Ie]=s.useState(!1),[Ne,Ve]=s.useState(!1),[Se,Pe]=s.useState(0),[Te,ze]=s.useState(0),[T,M]=s.useState({scale:1,x:0,y:0}),[ve,fe]=s.useState(!1),Ee=s.useRef(null),ce=s.useRef(null),Me=s.useRef(null),Ae=s.useRef(new Map),i=s.useRef([]),p=s.useRef(new Map),I=s.useRef(null),J=s.useRef(null),D=s.useRef(!1),{confirm:U}=Zs(),Fe=s.useRef(null),Oe=s.useId();s.useEffect(()=>{const t=ct("fn-agent-view",r);if(t==="list"||t==="board"||t==="org"){Z(t);return}Z("list")},[r]),s.useEffect(()=>{Jt("fn-agent-view",S,r)},[S,r]),s.useEffect(()=>{const t=ct(Rt,r);$e(cs(t)?t:"auto")},[r]),s.useEffect(()=>{Jt(Rt,ie,r)},[ie,r]);const[xt,ye]=s.useState(null),Ke=s.useRef(null),[bt,Re]=s.useState(null),[De,ke]=s.useState(null),[Qe,Ce]=s.useState({}),[n,z]=s.useState(1),[_e,He]=s.useState(!1),[we,Ot]=s.useState(new Set),[vt,Ue]=s.useState(new Map),nt=s.useRef(!0);s.useEffect(()=>(nt.current=!0,()=>{nt.current=!1}),[]),s.useEffect(()=>{Js(r).then(t=>{nt.current&&z(t.heartbeatMultiplier??1)}).catch(()=>{})},[r]);const Dt=s.useCallback(async t=>{const l=Number.isFinite(t)&&t>0?t:1;z(l),He(!0);try{await Qs({heartbeatMultiplier:l},r),a(`Heartbeat speed set to ×${l.toFixed(1)}`,"success")}catch(c){a(`Failed to save heartbeat multiplier: ${pe(c)}`,"error")}finally{nt.current&&He(!1)}},[r,a]),lt=s.useMemo(()=>vt.size===0?k:k.map(t=>{const l=vt.get(t.id);return l?{...t,state:l}:t}),[k,vt]),et=s.useMemo(()=>lt.filter(t=>h||!at(t)),[lt,h]),xs=s.useMemo(()=>lt.filter(t=>t.state!=="active"&&t.state!=="running"?!1:h||!at(t)),[lt,h]),Be=s.useMemo(()=>{if(h)return ee;const t=l=>at(l.agent)?null:{...l,children:l.children.map(t).filter(c=>c!==null)};return ee.map(t).filter(l=>l!==null)},[ee,h]);s.useEffect(()=>{if(S!=="org")return;const t=ce.current;if(!t)return;const l=()=>{je(t.clientWidth)};l();const c=typeof ResizeObserver<"u"?new ResizeObserver(l):null;return c?.observe(t),window.addEventListener("resize",l),()=>{c?.disconnect(),window.removeEventListener("resize",l)}},[S,Be.length]),s.useEffect(()=>{if(S!=="org")return;let t=!1;return K(!0),ea(r,{includeEphemeral:h}).then(l=>{t||te(l)}).catch(l=>{t||(a(`Failed to load org chart: ${pe(l)}`,"error"),te([]))}).finally(()=>{t||K(!1)}),()=>{t=!0}},[S,r,h,a]),s.useEffect(()=>{const t=setInterval(()=>{C()},3e4);return()=>{clearInterval(t)}},[C]),s.useEffect(()=>{if(!re)return;let t=!1;Ve(!0),Lt(void 0,r).then(u=>{if(t)return;const w=u.filter(A=>!at(A));Pe(w.filter(A=>A.state==="active"||A.state==="running").length),ze(w.filter(A=>A.state==="paused").length)}).catch(u=>{t||(Pe(0),ze(0),a(`Failed to load bulk agent actions: ${pe(u)}`,"error"))}).finally(()=>{t||Ve(!1)});const l=u=>{const w=u.target;w&&(Ee.current?.contains(w)||Fe.current?.contains(w)||G(!1))},c=u=>{u.key==="Escape"&&(G(!1),Fe.current?.focus())};return document.addEventListener("mousedown",l),document.addEventListener("touchstart",l),document.addEventListener("keydown",c),()=>{t=!0,document.removeEventListener("mousedown",l),document.removeEventListener("touchstart",l),document.removeEventListener("keydown",c)}},[a,re,r]);const Ht=async t=>{if(!Le){Ie(!0);try{const c=(await Lt(void 0,r)).filter(B=>!at(B)),u=c.filter(B=>t==="paused"?B.state==="active"||B.state==="running":B.state==="paused"),w=c.length-u.length;if(u.length===0){a(`No agents eligible to ${t==="paused"?"pause":"resume"}`,"error");return}if(!await U({title:t==="paused"?"Pause All Agents":"Resume All Agents",message:`${t==="paused"?"Pause":"Resume"} ${u.length} agent${u.length===1?"":"s"} in this project?`,danger:t==="paused"}))return;const se=await Promise.allSettled(u.map(B=>ss(B.id,t,r))),Q=se.map((B,ot)=>({result:B,agent:u[ot]})).filter(B=>B.result.status==="rejected"),m=se.length-Q.length,H=Q.length,X=`${t==="paused"?"Paused":"Resumed"} ${m} agent${m===1?"":"s"}; skipped ${w}`;if(H>0){const B=Q.slice(0,3).map(({agent:ot,result:Ls})=>`${ot.name||ot.id}: ${pe(Ls.reason)}`).join("; ");a(`${X}; failed ${H}${B?` (${B})`:""}`,"error")}else a(X,"success");await C()}catch(l){a(`Failed to ${t==="paused"?"pause":"resume"} agents: ${pe(l)}`,"error")}finally{Ie(!1)}}},tt=async(t,l)=>{if(!we.has(t)){Ot(c=>new Set(c).add(t)),Ue(c=>{const u=new Map(c);return u.set(t,l),u});try{await ss(t,l,r),a(`Agent state updated to ${l}`,"success"),await C(),Ue(c=>{const u=new Map(c);return u.delete(t),u})}catch(c){Ue(u=>{const w=new Map(u);return w.delete(t),w}),a(`Failed to update state: ${pe(c)}`,"error")}finally{Ot(c=>{const u=new Set(c);return u.delete(t),u})}}},bs=async(t,l)=>{if(await U({title:"Delete Agent",message:`Delete agent "${l}"? This cannot be undone.`,danger:!0}))try{await ga(t,r),a(`Agent "${l}" deleted`,"success"),await C()}catch(u){a(`Failed to delete agent: ${pe(u)}`,"error")}},vs=async(t,l)=>{const c=k.find(u=>u.id===t);if(c){if(c.role===l){ye(null);return}try{await ut(t,{role:l},r),a(`Agent role updated to ${$t.find(u=>u.value===l)?.label??l}`,"success"),ye(null),C()}catch(u){a(`Failed to update role: ${pe(u)}`,"error")}}},fs=(t,l)=>{t.key==="Escape"&&ye(null)},js=async(t,l)=>{De===t.id&&(ke(null),Ce(c=>{const u={...c};return delete u[t.id],u})),Re(t.id);try{await ut(t.id,{runtimeConfig:{...t.runtimeConfig??{},heartbeatIntervalMs:l}},r),a(`Heartbeat interval updated to ${as(l)} for ${t.name}`,"success"),C()}catch(c){a(`Failed to update heartbeat interval: ${pe(c)}`,"error")}finally{Re(null)}},Bt=async t=>{const l=Qe[t.id]??"";if(l.trim()===""){a("Please enter a heartbeat interval in minutes","error");return}const c=Number(l);if(isNaN(c)){a("Heartbeat interval must be a valid number","error");return}if(c<=0){a("Heartbeat interval must be greater than 0","error");return}if(c>=1&&c<5){Re(t.id);try{await ut(t.id,{runtimeConfig:{...t.runtimeConfig??{},heartbeatIntervalMs:ua}},r),a(`Heartbeat interval set to 5 minutes (minimum). ${c} minute${c!==1?"s":""} was below the 5-minute minimum.`,"success"),ke(null),Ce(w=>{const A={...w};return delete A[t.id],A}),C()}catch(w){a(`Failed to update heartbeat interval: ${pe(w)}`,"error")}finally{Re(null)}return}const u=Math.round(c*6e4);Re(t.id);try{await ut(t.id,{runtimeConfig:{...t.runtimeConfig??{},heartbeatIntervalMs:u}},r),a(`Heartbeat interval updated to ${as(u)} for ${t.name}`,"success"),ke(null),Ce(w=>{const A={...w};return delete A[t.id],A}),C()}catch(w){a(`Failed to update heartbeat interval: ${pe(w)}`,"error")}finally{Re(null)}},Ns=t=>{const l=Et(t.runtimeConfig?.heartbeatIntervalMs),c=Math.round(l/6e4);ke(t.id),Ce(u=>({...u,[t.id]:String(c)}))},de=s.useCallback((t,l)=>{q(t),le(l?.initialTab??"dashboard"),N(l?.initialRunId??null),me(l?.preferActiveRun??!1)},[]),We=s.useCallback(()=>{q(null),le("dashboard"),N(null),me(!1)},[]),Wt=s.useCallback(t=>{de(t)},[de]),ys=s.useCallback(t=>{ne(t),de(t)},[de]),ks=s.useCallback(async({agentId:t,deleted:l})=>{await E(),l&&P===t&&We()},[E,P,We]),Cs=s.useCallback(t=>{de(t),d&&he(!1)},[d,de]),ws=async(t,l)=>{Ue(c=>{const u=new Map(c);return u.set(t,"running"),u});try{await ma(t,r,{source:"on_demand",triggerDetail:"Triggered from dashboard"}),a(`Heartbeat run started for ${l}`,"success"),await C(),Ue(c=>{const u=new Map(c);return u.delete(t),u})}catch(c){Ue(u=>{const w=new Map(u);return w.delete(t),w}),a(`Failed to start heartbeat run: ${pe(c)}`,"error")}},Ge=s.useCallback(t=>Math.min(Ya,Math.max(Ua,t)),[]),Y=s.useCallback(t=>{const l=ce.current,c=Me.current?.querySelector(".agent-org-chart");if(!l||!c)return{...t,scale:Ge(t.scale)};const u=Ge(t.scale),w=c.scrollWidth*u,A=c.scrollHeight*u,se=l.clientWidth,Q=l.clientHeight,m=Math.min(qe,se-w-qe),H=qe,X=Math.min(qe,Q-A-qe),B=qe;return{scale:u,x:Math.max(m,Math.min(H,t.x)),y:Math.max(X,Math.min(B,t.y))}},[Ge]),it=s.useCallback((t,l,c)=>{const u=ce.current;u&&M(w=>{const A=Ge(t),se=u.getBoundingClientRect(),Q=l-se.left,m=c-se.top,H=(Q-w.x)/w.scale,X=(m-w.y)/w.scale;return Y({scale:A,x:Q-H*A,y:m-X*A})})},[Ge,Y]),Ye=s.useCallback(()=>{const t=ce.current,l=Me.current?.querySelector(".agent-org-chart");if(!t||!l)return;const c=t.clientWidth,u=t.clientHeight,w=l.scrollWidth,A=l.scrollHeight;if(w<=0||A<=0)return;const se=Ge(Math.min(c/w,u/A,1)),Q=(c-w*se)/2,m=(u-A*se)/2;M(Y({scale:se,x:Q,y:m}))},[Ge,Y]),ft=s.useCallback(t=>{Z(t),t!=="org"&&M({scale:1,x:0,y:0}),d&&P&&We()},[We,d,P]),Gt=t=>$t.find(l=>l.value===t)?.label??t,rt=s.useMemo(()=>Ka({tree:Be,availableWidth:ge,preference:ie}),[Be,ie,ge]),Vt=s.useCallback(t=>{$e(t),M({scale:1,x:0,y:0})},[]);s.useEffect(()=>{M({scale:1,x:0,y:0}),D.current=!1},[r,rt]),s.useLayoutEffect(()=>{S!=="org"||be||Be.length===0||D.current||(Ye(),D.current=!0)},[S,Be.length,Ye,be]);const Ss=s.useCallback((t,l)=>{l?Ae.current.set(t,l):Ae.current.delete(t)},[]),Kt=s.useCallback(()=>e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"btn-icon touch-target",onClick:()=>M(t=>Y({...t,scale:t.scale*.9})),"aria-label":"Zoom out org chart",title:"Zoom out",children:e.jsx(Aa,{size:16})}),e.jsxs("span",{className:"agent-org-chart-controls__zoom-label","aria-live":"polite",children:[Math.round(T.scale*100),"%"]}),e.jsx("button",{type:"button",className:"btn-icon touch-target",onClick:()=>M(t=>Y({...t,scale:t.scale*1.1})),"aria-label":"Zoom in org chart",title:"Zoom in",children:e.jsx(wa,{size:16})}),e.jsxs("button",{type:"button",className:"btn touch-target btn-sm agent-org-chart-controls__fit-btn",onClick:Ye,"aria-label":"Fit org chart",title:"Fit org chart",children:[e.jsx(ta,{size:16}),"Fit"]}),e.jsxs("button",{type:"button",className:"btn touch-target btn-sm",onClick:()=>M(t=>Y({...t,x:0,y:0})),"aria-label":"Center org chart",title:"Center org chart",children:[e.jsx(sa,{size:16}),"Center"]})]}),[Y,Ye,T.scale]),As=s.useCallback(t=>{if(!(t.ctrlKey||t.metaKey))return;t.preventDefault();const l=t.deltaY>0?.9:1.1;it(T.scale*l,t.clientX,t.clientY)},[T.scale,it]),Rs=s.useCallback(t=>{if(t.target.closest(".org-chart-node-card"))return;if(t.currentTarget.setPointerCapture?.(t.pointerId),p.current.set(t.pointerId,{x:t.clientX,y:t.clientY}),p.current.size===1){I.current={x:t.clientX-T.x,y:t.clientY-T.y,pointerId:t.pointerId},fe(!0);return}if(p.current.size===2){const c=Array.from(p.current.values()),u=c[0].x-c[1].x,w=c[0].y-c[1].y;J.current={distance:Math.hypot(u,w),scale:T.scale,centerX:(c[0].x+c[1].x)/2,centerY:(c[0].y+c[1].y)/2},I.current=null}},[T.scale,T.x,T.y]),$s=s.useCallback(t=>{if(p.current.has(t.pointerId)){if(p.current.set(t.pointerId,{x:t.clientX,y:t.clientY}),p.current.size>=2){const l=Array.from(p.current.values()),c=J.current;if(!c)return;const u=l[0].x-l[1].x,w=l[0].y-l[1].y,A=Math.hypot(u,w),se=c.scale*(A/c.distance);it(se,c.centerX,c.centerY);return}!I.current||I.current.pointerId!==t.pointerId||M(l=>Y({...l,x:t.clientX-I.current.x,y:t.clientY-I.current.y}))}},[Y,it]),Ut=s.useCallback(t=>{p.current.delete(t.pointerId),p.current.size<2&&(J.current=null),p.current.size===0&&(I.current=null,fe(!1))},[]),Ts=s.useCallback(t=>{if(t.key==="ArrowLeft")M(l=>Y({...l,x:l.x+mt}));else if(t.key==="ArrowRight")M(l=>Y({...l,x:l.x-mt}));else if(t.key==="ArrowUp")M(l=>Y({...l,y:l.y+mt}));else if(t.key==="ArrowDown")M(l=>Y({...l,y:l.y-mt}));else if(t.key==="+"||t.key==="=")M(l=>Y({...l,scale:l.scale*1.1}));else if(t.key==="-")M(l=>Y({...l,scale:l.scale*.9}));else if(t.key==="0")Ye();else if(t.key==="Home")M({scale:1,x:0,y:0});else return;t.preventDefault()},[Y,Ye]),Yt=s.useCallback(()=>{const t=[{value:"horizontal",label:"Horizontal",icon:e.jsx(es,{size:16}),ariaLabel:"Horizontal layout"},{value:"vertical",label:"Vertical",icon:e.jsx(Qt,{size:16}),ariaLabel:"Vertical layout"},{value:"auto",label:"Auto",icon:e.jsx(Ze,{size:16}),ariaLabel:"Automatic layout"}];return e.jsx("div",{className:"agent-org-chart-layout-toggle","data-testid":"agent-org-chart-layout-toggle",children:t.map(l=>{const c=ie===l.value;return e.jsxs("button",{type:"button",className:`btn-icon touch-target agent-org-chart-layout-toggle__button${c?" btn-icon--active":""}`,onClick:()=>Vt(l.value),"aria-pressed":c,"aria-label":l.ariaLabel,title:l.ariaLabel,"data-layout-value":l.value,children:[l.icon,e.jsx("span",{className:"agent-org-chart-layout-toggle__text",children:l.label})]},l.value)})})},[Vt,ie]),Es=t=>Array.isArray(t.metadata?.skills)?t.metadata.skills:[],jt=t=>da(t),Ms=Ne||Le||Se===0,_s=Ne||Le||Te===0,Xt=y&&k.length===0,st=s.useCallback(()=>{W(!0)},[]);return e.jsxs("div",{className:"agents-view",children:[e.jsxs("div",{className:"agents-view-header",children:[e.jsxs("div",{className:"agents-view-title",children:[e.jsx(_t,{size:24}),e.jsx("h2",{children:"Agents"})]}),e.jsxs("div",{className:"agents-view-controls",children:[e.jsxs("div",{className:"view-toggle",children:[e.jsx("button",{className:`view-toggle-btn${S==="list"?" active":""}`,onClick:()=>ft("list"),title:"List view","aria-label":"List view","aria-pressed":S==="list",children:e.jsx(Qt,{size:16})}),e.jsx("button",{className:`view-toggle-btn${S==="board"?" active":""}`,onClick:()=>ft("board"),title:"Board view","aria-label":"Board view","aria-pressed":S==="board",children:e.jsx(Je,{size:16})}),e.jsx("button",{className:`view-toggle-btn${S==="org"?" active":""}`,onClick:()=>ft("org"),title:"Org Chart view","aria-label":"Org Chart view","aria-pressed":S==="org",children:e.jsx(es,{size:16})})]}),e.jsxs("div",{className:"agents-view-primary-actions",children:[e.jsx("button",{ref:Fe,className:`btn-icon agent-controls-trigger${re?" agent-controls-trigger--active":""}`,onClick:()=>G(t=>!t),title:"Controls","aria-label":"Controls","aria-haspopup":"dialog","aria-expanded":re,"aria-controls":Oe,children:e.jsx(ka,{size:16})}),e.jsx("button",{className:"btn-icon",onClick:()=>void C(),title:"Refresh","aria-label":"Refresh",children:e.jsx(Ze,{size:16,className:y?"spin":void 0})}),!d&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm agent-import-trigger",onClick:()=>{F(!0),G(!1)},"aria-label":"Import",title:"Import",children:[e.jsx(It,{size:16}),"Import"]}),e.jsxs("button",{className:"btn btn-task-create btn-sm",onClick:()=>{st(),G(!1)},"aria-label":"New Agent",title:"New Agent",children:[e.jsx(ts,{size:16}),"New Agent"]})]}),re&&e.jsxs("div",{ref:Ee,id:Oe,className:"agent-controls-panel agent-controls-panel--scrollable",role:"dialog","aria-label":"Agent controls","aria-modal":"false",children:[e.jsx("div",{className:"agent-controls",children:e.jsxs("div",{className:"agent-controls-filters",children:[e.jsxs("div",{className:"agent-state-filter",children:[e.jsx(aa,{size:14}),e.jsxs("select",{className:"agent-state-filter-select",value:f,onChange:t=>j(t.target.value),"aria-label":"Filter agents by state",children:[e.jsx("option",{value:"all",children:"All States"}),e.jsx("option",{value:"idle",children:"Idle"}),e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"running",children:"Running"}),e.jsx("option",{value:"paused",children:"Paused"}),e.jsx("option",{value:"error",children:"Error"})]})]}),e.jsxs("label",{className:"checkbox-label agent-system-filter",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:t=>b(t.target.checked),"aria-label":"Show system agents"}),"Show system agents"]})]})}),d&&e.jsxs("div",{className:"agent-controls-mobile-actions",children:[e.jsxs("button",{className:"btn btn-sm agent-import-trigger",onClick:()=>{F(!0),G(!1)},"aria-label":"Import",title:"Import",children:[e.jsx(It,{size:16}),"Import"]}),e.jsxs("button",{className:"btn btn-task-create btn-sm",onClick:()=>{st(),G(!1)},"aria-label":"New Agent",title:"New Agent",children:[e.jsx(ts,{size:16}),"New Agent"]})]}),e.jsxs("div",{className:"agent-controls-bulk-actions",role:"menu","aria-label":"Bulk agent actions",children:[e.jsxs("button",{type:"button",className:"agent-detail-bulk-menu-item",role:"menuitem",disabled:Ms,onClick:()=>{G(!1),Ht("paused")},children:[e.jsxs("span",{className:"agent-controls-bulk-actions__label",children:[e.jsx(Ct,{}),e.jsx("span",{children:"Pause All Agents"})]}),e.jsx("span",{className:"agent-detail-bulk-menu-item-hint",children:Ne?"Loading eligibility…":Se===0?"No active or running project agents to pause":`Pause ${Se} active/running agent${Se===1?"":"s"}`})]}),e.jsxs("button",{type:"button",className:"agent-detail-bulk-menu-item",role:"menuitem",disabled:_s,onClick:()=>{G(!1),Ht("active")},children:[e.jsxs("span",{className:"agent-controls-bulk-actions__label",children:[e.jsx(dt,{}),e.jsx("span",{children:"Resume All Agents"})]}),e.jsx("span",{className:"agent-detail-bulk-menu-item-hint",children:Ne?"Loading eligibility…":Te===0?"No paused project agents to resume":`Resume ${Te} paused agent${Te===1?"":"s"}`})]})]}),e.jsx("div",{className:"agent-global-controls agent-controls-actions",children:e.jsxs("div",{className:"heartbeat-multiplier-group",children:[e.jsxs("div",{className:"heartbeat-multiplier-controls",children:[e.jsx("label",{htmlFor:"globalHeartbeatMultiplier",className:"heartbeat-multiplier-label",children:"Heartbeat Speed"}),e.jsx("input",{id:"globalHeartbeatMultiplier",className:"heartbeat-multiplier-slider touch-target",type:"range",min:.1,max:10,step:.1,value:n,onChange:t=>{const l=Number(t.target.value);Dt(Number.isFinite(l)&&l>0?l:1)},disabled:_e}),e.jsxs("span",{className:"heartbeat-multiplier-value",children:["×",n.toFixed(1)]}),e.jsx("select",{className:"heartbeat-multiplier-preset",value:String(Tt.reduce((t,l)=>Math.abs(l-n)<Math.abs(t-n)?l:t,Tt[0])),onChange:t=>{const l=Number(t.target.value);Dt(Number.isFinite(l)&&l>0?l:1)},disabled:_e,"aria-label":"Heartbeat speed preset",children:Tt.map(t=>e.jsxs("option",{value:String(t),children:["×",t]},t))})]}),e.jsx("small",{className:"text-secondary",children:"Scales all agent heartbeat intervals. ×0.5 = twice as fast, ×2.0 = twice as slow. Default: ×1.0"})]})}),e.jsx(Ra,{agents:et})]})]})]})]}),e.jsx(za,{isOpen:L,onClose:()=>{W(!1),_(null)},onCreated:()=>{W(!1),_(null),C()},projectId:r,prefillDraft:$,agentOnboardingEnabled:g,existingAgents:k,onPrefillDraft:_}),e.jsx(Oa,{isOpen:v,onClose:()=>F(!1),onImported:()=>void C(),projectId:r}),e.jsx(Ia,{stats:R,activeAgents:xs,projectId:r,isOpen:oe,onToggle:()=>he(t=>!t),onSelectAgent:Cs,onOpenTaskLogs:x}),S==="org"?e.jsx("div",{className:"agents-org-full-view",children:e.jsx("div",{className:"agents-view-content agents-view-content--org-full",children:P?e.jsxs("div",{className:"agents-org-detail-view","data-testid":"agents-org-detail-view",children:[e.jsx("button",{type:"button",className:"btn btn-sm agents-org-detail-back",onClick:We,"aria-label":"Back to org chart",children:"Back to org chart"}),e.jsx(s.Suspense,{fallback:null,children:e.jsx(ds,{inline:!0,showInlineBackButton:!1,agentId:P,projectId:r,onClose:We,addToast:a,onChildClick:Wt,initialTab:ae,initialRunId:O,preferActiveRun:ue},P)})]}):Xt?e.jsxs("div",{className:"agents-view-loading",role:"status","aria-live":"polite",children:[e.jsx(Ze,{size:18,className:"spin"}),e.jsx("span",{children:"Loading agents..."})]}):e.jsxs("div",{className:"agent-org-chart-shell","data-testid":"agent-org-chart-shell",children:[d?e.jsxs("div",{className:"agent-org-chart-controls","data-testid":"agent-org-chart-controls",children:[Yt(),Kt()]}):e.jsxs("div",{className:"agent-org-chart-toolbar",children:[Yt(),e.jsx("div",{className:"agent-org-chart-controls","data-testid":"agent-org-chart-controls",children:Kt()})]}),e.jsx("div",{ref:ce,className:"agent-org-chart-viewport","data-testid":"agent-org-chart-viewport",tabIndex:0,role:"region","aria-label":"Org chart canvas",onWheel:As,onPointerDown:Rs,onPointerMove:$s,onPointerUp:Ut,onPointerCancel:Ut,onKeyDown:Ts,"data-panning":ve?"true":"false",children:e.jsxs("div",{ref:Me,className:`agent-org-chart-canvas agent-org-chart-canvas--zoom-${Math.round((T.scale??1)*100)}`,"data-panning":ve?"true":"false",style:{transform:`translate(${T.x}px, ${T.y}px) scale(${T.scale})`},children:[e.jsx("div",{className:`agent-org-chart${rt==="vertical"?" agent-org-chart--vertical":""}`,"data-testid":"agent-org-chart","data-layout-mode":rt,children:be?e.jsxs("div",{className:"agent-org-chart__loading",role:"status","aria-live":"polite",children:[e.jsx(Ze,{size:18,className:"spin"}),e.jsx("span",{children:"Loading org chart..."})]}):Be.length===0?e.jsx(St,{onCtaClick:st}):(i.current=[],Be.map(t=>e.jsx(ps,{node:t,onSelect:ys,getHealthStatus:jt,selectedAgentId:xe,registerNodeElement:Ss,linksRef:i},t.agent.id)))}),e.jsx(Xa,{links:i.current,nodeElements:Ae.current,canvasRef:Me,viewportRef:ce,layoutMode:rt,transform:T})]})})]})})}):e.jsxs("div",{className:"agents-split-layout",children:[e.jsx("div",{className:`agents-split-sidebar${V?" agents-split-sidebar--hidden-mobile":""}`,children:e.jsx("div",{className:"agents-view-content",children:Xt?e.jsxs("div",{className:"agents-view-loading",role:"status","aria-live":"polite",children:[e.jsx(Ze,{size:18,className:"spin"}),e.jsx("span",{children:"Loading agents..."})]}):S==="board"?e.jsx("div",{className:"agent-board",children:et.length===0?e.jsx(St,{onCtaClick:st}):et.map(t=>{const l=jt(t),c=Ft(t,l),u=Pt(t.state),w=zt("agent-board-card",t.state);return e.jsx("div",{className:`agent-board-card ${w}${P===t.id?" agent-card--selected":""}`,children:e.jsxs("div",{className:"agent-board-clickable",onClick:()=>de(t.id),role:"button",tabIndex:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.key===" "&&A.preventDefault(),de(t.id))},children:[e.jsxs("div",{className:"agent-board-header",children:[e.jsx("span",{className:"agent-board-icon",children:e.jsx(ht,{agent:t,size:20})}),e.jsx("span",{className:"agent-board-badge badge text-secondary",children:Gt(t.role)}),e.jsx("span",{className:`agent-board-badge badge ${u}`,children:t.state}),(t.pendingApprovalCount??0)>0?e.jsxs("span",{className:"agent-board-badge badge agent-approval-badge",title:"Pending approvals",children:[e.jsx("span",{className:"status-dot status-dot--pending"}),t.pendingApprovalCount]}):null]}),e.jsx("div",{className:"agent-board-name",children:t.name}),e.jsx("div",{className:"agent-board-id",children:t.id}),e.jsxs("div",{className:"agent-board-health",style:{color:l.color},title:c.title,children:[l.icon,c.label?` ${c.label}`:""]})]})},t.id)})}):e.jsx("div",{className:"agent-list",children:et.length===0?e.jsx(St,{onCtaClick:st}):et.map(t=>{const l=jt(t),c=Ft(t,l),u=Pt(t.state),w=zt("agent-card",t.state),A=Et(t.runtimeConfig?.heartbeatIntervalMs),se=na(A),Q=bt===t.id;return e.jsxs("div",{className:`agent-card agent-card--clickable ${w}${P===t.id?" agent-card--selected":""}`,onClick:m=>{const H=m.target;if(H===m.currentTarget){de(t.id);return}const X=H.closest('button, select, input, [role="button"]');X&&X!==m.currentTarget||de(t.id)},role:"button",tabIndex:0,onKeyDown:m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.key===" "&&m.preventDefault(),de(t.id))},"aria-label":`Open details for ${t.name}`,children:[e.jsxs("div",{className:"agent-card-header",children:[e.jsxs("div",{className:"agent-info",children:[xt===t.id?e.jsx("select",{ref:Ke,className:"select agent-role-select",value:t.role,onChange:m=>void vs(t.id,m.target.value),onKeyDown:m=>fs(m,t.id),onBlur:()=>ye(null),autoFocus:!0,children:$t.map(m=>e.jsxs("option",{value:m.value,children:[m.icon," ",m.label]},m.value))}):e.jsx("span",{className:"agent-icon agent-icon--clickable",onClick:m=>{m.stopPropagation(),ye(t.id)},title:"Click to change role",role:"button",tabIndex:0,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.stopPropagation(),ye(t.id))},children:e.jsx(ht,{agent:t,size:20})}),e.jsxs("div",{className:"agent-meta",children:[e.jsx("span",{className:"agent-name",children:t.name}),e.jsx("span",{className:"agent-id text-secondary",children:t.id})]}),e.jsx(us,{size:20,className:"agent-card-chevron"})]}),e.jsxs("div",{className:"agent-badges",children:[e.jsx("span",{className:`badge ${u}`,children:t.state}),e.jsxs("span",{className:"badge",style:{color:l.color},title:c.title,children:[l.icon,c.label?` ${c.label}`:""]}),e.jsx("span",{className:"badge text-secondary",children:Gt(t.role)}),(t.pendingApprovalCount??0)>0?e.jsxs("span",{className:"badge agent-approval-badge",title:"Pending approvals",children:[e.jsx("span",{className:"status-dot status-dot--pending"}),t.pendingApprovalCount]}):null,(()=>{const m=Es(t);if(m.length===0)return null;const H=m.slice(0,2),X=m.length-2;return e.jsxs(e.Fragment,{children:[H.map(B=>e.jsx("span",{className:"badge badge-skill",title:B,children:va(B)},B)),X>0&&e.jsxs("span",{className:"badge badge-skill",children:["+",X]})]})})()]})]}),e.jsxs("div",{className:"agent-card-body",children:[t.state==="error"&&t.lastError?e.jsx(la,{errorText:t.lastError,issueContext:{surface:"AgentsView list",agentId:t.id,agentName:t.name,agentState:t.state,taskId:t.taskId}}):null,t.taskId&&e.jsxs("div",{className:"agent-task",children:[e.jsx("span",{className:"text-secondary",children:"Working on:"}),e.jsx("span",{className:"badge",children:t.taskId})]}),e.jsxs("div",{className:"agent-heartbeat-control",children:[e.jsx("span",{className:"text-secondary",children:"Heartbeat:"}),De===t.id?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"input agent-heartbeat-custom-input",value:Qe[t.id]??"",onChange:m=>Ce(H=>({...H,[t.id]:m.target.value})),onKeyDown:m=>{m.key==="Enter"?Bt(t):m.key==="Escape"&&(ke(null),Ce(H=>{const X={...H};return delete X[t.id],X}))},disabled:Q,"aria-label":`Custom heartbeat interval in minutes for ${t.name}`}),e.jsx("span",{className:"text-secondary",children:"min"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>void Bt(t),disabled:Q,title:"Save custom interval",children:"Save"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>{ke(null),Ce(m=>{const H={...m};return delete H[t.id],H})},disabled:Q,title:"Cancel custom interval",children:"Cancel"})]}):e.jsx(e.Fragment,{children:e.jsxs("select",{className:"select agent-heartbeat-select",value:A,onChange:m=>{const H=m.target.value;H==="__custom__"?Ns(t):js(t,Number(H))},disabled:Q,"aria-label":`Set heartbeat interval for ${t.name}`,children:[se.map(m=>e.jsx("option",{value:m.value,children:m.label},m.value)),ia.some(m=>m.value===A)&&e.jsx("option",{value:"__custom__",children:"Custom..."})]})}),Q&&e.jsx("span",{className:"agent-heartbeat-saving text-secondary",children:"Saving…"}),t.lastHeartbeatAt&&(()=>{const m=new Date(t.lastHeartbeatAt),H=new Date(m.getTime()+A),X=t.state==="active"||t.state==="running";return e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"agent-heartbeat-last text-secondary",title:m.toLocaleString(),children:["Last: ",m.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})]}),X&&e.jsxs("span",{className:"agent-heartbeat-next text-secondary",title:H.toLocaleString(),children:["Next: ",H.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})]})]})})()]})]}),e.jsxs("div",{className:"agent-card-actions",children:[e.jsxs("div",{className:"agent-card-actions-group agent-card-actions-group--primary",children:[t.state==="idle"&&e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"active"),disabled:we.has(t.id),title:"Activate",children:[e.jsx(dt,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Start"})]}),t.state==="active"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void ws(t.id,t.name),disabled:we.has(t.id),title:"Run Now","aria-label":`Run now for ${t.name}`,children:[e.jsx(Je,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Run Now"})]}),e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"paused"),disabled:we.has(t.id),title:"Pause",children:[e.jsx(Ct,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Pause"})]})]}),t.state==="paused"&&e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"active"),disabled:we.has(t.id),title:"Resume",children:[e.jsx(dt,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Resume"})]}),t.state==="running"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>de(t.id,{initialTab:"runs",initialRunId:null,preferActiveRun:!0}),title:"View live run details","aria-label":`View live run details for ${t.name}`,children:[e.jsx(Je,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Running"})]}),e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"paused"),disabled:we.has(t.id),title:"Pause",children:[e.jsx(Ct,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Pause"})]})]}),t.state==="error"&&e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"active"),disabled:we.has(t.id),title:"Retry",children:[e.jsx(dt,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Retry"})]})]}),e.jsxs("div",{className:"agent-card-actions-group agent-card-actions-group--secondary",children:[e.jsxs("button",{className:"btn btn-sm agent-card-details-btn",onClick:()=>de(t.id),title:`View details for ${t.name}`,"aria-label":`View details for ${t.name}`,children:[e.jsx(ra,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Details"})]}),(t.state==="idle"||t.state==="paused")&&e.jsxs("button",{className:"btn btn-sm btn-danger",onClick:()=>void bs(t.id,t.name),title:"Delete",children:[e.jsx(oa,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Delete"})]})]})]})]},t.id)})})})}),e.jsx("div",{className:`agents-split-detail${d&&!P?" agents-split-detail--hidden-mobile":""}`,children:P?e.jsx(s.Suspense,{fallback:null,children:e.jsx(ds,{inline:!0,showInlineBackButton:d,agentId:P,projectId:r,onClose:We,addToast:a,onChildClick:Wt,initialTab:ae,initialRunId:O,preferActiveRun:ue,onMutationSuccess:ks},P)}):e.jsxs("div",{className:"agents-detail-empty-state",children:[e.jsx(_t,{size:48}),e.jsx("h3",{children:"Select an agent"}),e.jsx("p",{children:"Choose an agent from the sidebar to view details"})]})})]})]})}export{an as AgentsView};
|
|
29
|
+
Agent instructions go here...`,value:j,onChange:i=>{f("paste"),y([]),k(i.target.value),O(null)},rows:8,"aria-label":"Manifest content"})]}),e.jsxs("p",{className:"agent-import-file-hint",children:["Current input: ",d]}),le&&e.jsxs("p",{className:"agent-dialog-error",children:[e.jsx(kt,{size:14}),le]})]}),b==="preview"&&e.jsxs("div",{className:"agent-import-preview",children:[e.jsxs("div",{className:"agent-import-company",children:[e.jsx("span",{className:"agent-import-company-label",children:"Company"}),e.jsx("span",{className:"agent-import-company-name",children:C})]}),e.jsxs("div",{className:"agent-import-count",children:[e.jsx(Mt,{size:14}),e.jsxs("span",{children:[L.length," agent",L.length!==1?"s":""," found"]})]}),L.length>0&&e.jsxs("div",{className:"agent-import-selection-controls",children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>F(L.map(i=>i.name)),children:"Select all agents"}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>F([]),children:"Clear agents"})]}),L.length>0?e.jsx("div",{className:"agent-import-agent-list",children:L.map((i,p)=>e.jsxs("div",{className:"agent-import-agent-item",children:[e.jsx("label",{className:"checkbox-label",children:e.jsx("input",{type:"checkbox","aria-label":`Select agent ${i.name}`,checked:v.includes(i.name),onChange:()=>Me(i.name)})}),e.jsx("span",{className:"agent-import-agent-icon",children:i.icon||"🤖"}),e.jsxs("div",{className:"agent-import-agent-details",children:[e.jsx("span",{className:"agent-import-agent-name",children:i.name}),e.jsxs("span",{className:"agent-import-agent-meta",children:[i.title&&e.jsxs("span",{className:"agent-import-agent-title",children:[i.title," · "]}),e.jsx("span",{className:"agent-import-agent-role",children:i.role}),i.reportsTo&&e.jsxs("span",{className:"agent-import-agent-reports",children:[" · reports to ",i.reportsTo]}),i.skills&&i.skills.length>0&&e.jsxs("span",{className:"agent-import-agent-model",children:[" · skills: ",i.skills.join(", ")]})]}),i.instructionsText&&e.jsxs("span",{className:"agent-import-agent-instructions",children:[i.instructionsText.slice(0,100),i.instructionsText.length>100?"...":""]})]})]},p))}):e.jsx("p",{className:"agent-import-empty",children:"No agents found in the manifest."}),$.length>0&&e.jsxs("div",{className:"agent-import-skills-section",children:[e.jsxs("div",{className:"agent-import-count",children:[e.jsx(Mt,{size:14}),e.jsxs("span",{children:[$.length," skill",$.length!==1?"s":""," found"]})]}),e.jsxs("div",{className:"agent-import-selection-controls",children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>q($.map(i=>i.name)),children:"Select all skills"}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>q([]),children:"Clear skills"})]}),e.jsx("div",{className:"agent-import-skill-list",children:$.map((i,p)=>e.jsxs("div",{className:"agent-import-skill-item",children:[e.jsx("label",{className:"checkbox-label",children:e.jsx("input",{type:"checkbox","aria-label":`Select skill ${i.name}`,checked:P.includes(i.name),onChange:()=>Ae(i.name)})}),e.jsx("span",{className:"agent-import-skill-icon",children:"⚡"}),e.jsxs("div",{className:"agent-import-skill-details",children:[e.jsx("span",{className:"agent-import-skill-name",children:i.name}),i.description&&e.jsx("span",{className:"agent-import-skill-description",children:i.description})]})]},`${i.name}-${p}`))})]}),me&&e.jsxs("p",{className:"agent-dialog-error",children:[e.jsx(kt,{size:14}),me]})]}),b==="result"&&N&&e.jsxs("div",{className:"agent-import-result",children:[e.jsx("div",{className:"agent-import-result-icon",children:e.jsx(gt,{size:32})}),e.jsx("h3",{className:"agent-import-result-title",children:"Import Complete"}),e.jsxs("p",{className:"agent-import-result-company",children:["From ",e.jsx("strong",{children:N.companyName??"Unknown"})]}),e.jsxs("div",{className:"agent-import-result-stats",children:[N.created.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--success",children:e.jsxs("span",{children:[N.created.length," created"]})}),N.skipped.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--skipped",children:e.jsxs("span",{children:[N.skipped.length," skipped (already exist)"]})}),N.errors.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--error",children:e.jsxs("span",{children:[N.errors.length," error",N.errors.length!==1?"s":""]})})]}),N.created.length>0&&e.jsx("div",{className:"agent-import-result-agents",children:N.created.map((i,p)=>e.jsxs("div",{className:"agent-import-result-agent",children:[e.jsx(gt,{size:12}),e.jsx("span",{children:i.name})]},p))}),N.errors.length>0&&e.jsx("div",{className:"agent-import-result-errors",children:N.errors.map((i,p)=>e.jsxs("div",{className:"agent-import-result-error",children:[e.jsx(Zt,{size:12}),e.jsxs("span",{children:[i.name,": ",i.error]})]},p))}),N.skills&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"agent-import-result-divider"}),e.jsx("h4",{className:"agent-import-result-section-title",children:"Skills"}),e.jsxs("div",{className:"agent-import-result-stats",children:[N.skills.imported.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--success",children:e.jsxs("span",{children:[N.skills.imported.length," skill",N.skills.imported.length!==1?"s":""," imported"]})}),N.skills.skipped.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--skipped",children:e.jsxs("span",{children:[N.skills.skipped.length," skill",N.skills.skipped.length!==1?"s":""," skipped (already exist)"]})}),N.skills.errors.length>0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--error",children:e.jsxs("span",{children:[N.skills.errors.length," skill",N.skills.errors.length!==1?"s":""," error",N.skills.errors.length!==1?"s":""]})}),N.skills.imported.length===0&&N.skills.skipped.length===0&&N.skills.errors.length===0&&e.jsx("div",{className:"agent-import-result-stat agent-import-result-stat--skipped",children:e.jsx("span",{children:"No skills in package"})})]}),N.skills.imported.length>0&&e.jsx("div",{className:"agent-import-result-agents",children:N.skills.imported.map((i,p)=>e.jsxs("div",{className:"agent-import-result-agent",children:[e.jsx(gt,{size:12}),e.jsx("span",{children:i.name})]},p))}),N.skills.errors.length>0&&e.jsx("div",{className:"agent-import-result-errors",children:N.skills.errors.map((i,p)=>e.jsxs("div",{className:"agent-import-result-error",children:[e.jsx(Zt,{size:12}),e.jsxs("span",{children:[i.name,": ",i.error]})]},p))})]})]})]}),e.jsxs("div",{className:"agent-dialog-footer",children:[b==="preview"&&e.jsx("button",{className:"btn",onClick:()=>o("input"),disabled:V,children:"Back"}),e.jsx("button",{className:"btn",onClick:Ne,disabled:V,children:b==="result"?"Close":"Cancel"}),b==="input"&&e.jsx("button",{className:"btn btn-task-create",onClick:()=>void Te(),disabled:xe||(d==="directory"?R.length===0:d==="browse"?!K:!j.trim()),children:xe?e.jsxs(e.Fragment,{children:[e.jsx(yt,{size:14,className:"spin"}),"Parsing..."]}):"Preview"}),b==="preview"&&e.jsx("button",{className:"btn btn-task-create",onClick:()=>void ze(),disabled:V||T===0&&M===0,children:V?e.jsxs(e.Fragment,{children:[e.jsx(yt,{size:14,className:"spin"}),ce]}):`Import ${Ee}`})]})]})}):null}const Rt="fn-agent-org-chart-layout";function cs(a){return a==="auto"||a==="horizontal"||a==="vertical"}const Da=768,Ha={nodeWidth:220,siblingGap:24,rootGap:24,chartPadding:24},Ba={nodeWidth:160,siblingGap:8,rootGap:8,chartPadding:8};function gs(a){return a.children.length===0?1:a.children.reduce((r,x)=>r+gs(x),0)}function Wa(a){return a<=Da?Ba:Ha}function Ga(a,r){const x=gs(a);return x*r.nodeWidth+Math.max(0,x-1)*r.siblingGap}function Va(a,r=Number.POSITIVE_INFINITY){const x=Wa(r);if(a.length===0)return x.nodeWidth;const h=a.map(o=>Ga(o,x)).reduce((o,d)=>o+d,0),b=Math.max(0,a.length-1)*x.rootGap;return h+b+x.chartPadding*2}function Ka(a){const r=a.preference??"auto";if(r!=="auto")return r;const x=Number.isFinite(a.availableWidth)&&a.availableWidth>0?a.availableWidth:0;return x===0||a.tree.length<=1?"horizontal":Va(a.tree,x)>x?"vertical":"horizontal"}const ds=s.lazy(()=>ca(()=>import("./AgentDetailView-DuRYmHK3.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(a=>({default:a.AgentDetailView}))),$t=[{value:"triage",label:"Triage",icon:"⊕"},{value:"executor",label:"Executor",icon:"▶"},{value:"reviewer",label:"Reviewer",icon:"⊙"},{value:"merger",label:"Merger",icon:"⊞"},{value:"scheduler",label:"Scheduler",icon:"◷"},{value:"engineer",label:"Engineer",icon:"⎔"},{value:"custom",label:"Custom",icon:"✦"}],Tt=[.1,.25,.5,1,2,3,5,10],Ua=.25,Ya=3,mt=16,qe=32;function Pt(a){switch(a){case"running":return"agent-badge--running";case"active":return"agent-badge--active";case"paused":return"agent-badge--paused";case"error":return"agent-badge--error";case"idle":default:return"agent-badge--idle"}}function zt(a,r){switch(r){case"running":return`${a}--running`;case"active":return`${a}--active`;case"paused":return`${a}--paused`;case"error":return`${a}--error`;case"idle":default:return`${a}--idle`}}function hs(a){return a.children.length===0?1:a.children.reduce((r,x)=>r+hs(x),0)}function Ft(a,r){return a.state==="error"?{title:void 0,label:"Error"}:{title:r.reason??r.label,label:r.stateDerived?null:r.label}}function ps({node:a,onSelect:r,getHealthStatus:x,selectedAgentId:g,registerNodeElement:h,linksRef:b}){const{agent:o,children:d}=a,f=x(o),j=Ft(o,f),k=Pt(o.state),R=zt("org-chart-node-card",o.state),y=hs(a),C={"--org-chart-subtree-leaves":String(y)};return e.jsxs("div",{className:`org-chart-node${d.length>0?" org-chart-node--has-children":""}`,style:C,children:[e.jsxs("div",{ref:E=>h(o.id,E),"data-agent-id":o.id,className:`org-chart-node-card ${R}${g===o.id?" agent-card--selected":""}`,onClick:()=>r(o.id),role:"button",tabIndex:0,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.key===" "&&E.preventDefault(),r(o.id))},children:[e.jsxs("div",{className:"org-chart-node__header",children:[e.jsx("span",{className:"org-chart-node__icon",children:e.jsx(ht,{agent:o,size:20})}),e.jsx("span",{className:"org-chart-node__name",children:o.name})]}),e.jsxs("div",{className:"org-chart-node__meta",children:[e.jsx("span",{className:`org-chart-node__badge ${k}`,children:o.state}),e.jsxs("span",{className:"org-chart-node__health",style:{color:f.color},title:j.title,children:[f.icon,j.label&&e.jsx("span",{className:"text-secondary",children:j.label})]})]})]}),d.length>0&&e.jsx("div",{className:"org-chart-children",role:"group","aria-label":`${o.name} employees`,children:d.map(E=>(b.current.push({parentId:o.id,childId:E.agent.id}),e.jsx(ps,{node:E,onSelect:r,getHealthStatus:x,selectedAgentId:g,registerNodeElement:h,linksRef:b},E.agent.id)))})]})}function Xa({links:a,nodeElements:r,canvasRef:x,viewportRef:g,layoutMode:h,transform:b}){const[o,d]=s.useState([]);return s.useLayoutEffect(()=>{const f=x.current,j=g.current;if(!f||!j||a.length===0){d([]);return}const k=()=>{const y=f.getBoundingClientRect(),C=a.flatMap(({parentId:E,childId:L})=>{const W=r.get(E),$=r.get(L);if(!W||!$)return[];const _=W.getBoundingClientRect(),v=$.getBoundingClientRect(),F=(_.left-y.left)/b.scale,P=(_.top-y.top)/b.scale,q=(v.left-y.left)/b.scale,xe=(v.top-y.top)/b.scale;if(h==="vertical"){const N=F,ue=P+_.height/b.scale/2,me=q,S=xe+v.height/b.scale/2,Z=N-(N-me)/2;return[`M ${N} ${ue} L ${Z} ${ue} L ${Z} ${S} L ${me} ${S}`]}const ne=F+_.width/b.scale/2,V=P+_.height/b.scale,ae=q+v.width/b.scale/2,le=xe,O=V+(le-V)/2;return[`M ${ne} ${V} L ${ne} ${O} L ${ae} ${O} L ${ae} ${le}`]});d(C)};k();const R=new ResizeObserver(k);return R.observe(f),R.observe(j),r.forEach(y=>R.observe(y)),()=>R.disconnect()},[x,h,a,r,b.scale,g]),e.jsx("svg",{className:"agent-org-chart-connectors","aria-hidden":"true",children:o.map((f,j)=>e.jsx("path",{d:f},`${j}-${f}`))})}function an({addToast:a,projectId:r,onOpenTaskLogs:x,agentOnboardingEnabled:g=!1}){const[h,b]=s.useState(!1),d=Xs()==="mobile",[f,j]=s.useState("all"),{agents:k,stats:R,isLoading:y,loadAgents:C,refreshAgents:E}=qs(r,{filterState:f,showSystemAgents:h}),[L,W]=s.useState(!1),[$,_]=s.useState(null),[v,F]=s.useState(!1),[P,q]=s.useState(null),[xe,ne]=s.useState(null),V=d&&!!P,[ae,le]=s.useState("dashboard"),[O,N]=s.useState(null),[ue,me]=s.useState(!1),[S,Z]=s.useState(()=>{if(typeof window>"u")return"list";const t=ct("fn-agent-view",r);return t==="list"||t==="board"||t==="org"?t:"list"}),[ie,$e]=s.useState(()=>{if(typeof window>"u")return"auto";const t=ct(Rt,r);return cs(t)?t:"auto"}),[ee,te]=s.useState([]),[be,K]=s.useState(!1),[ge,je]=s.useState(0),[re,G]=s.useState(!1),[oe,he]=s.useState(!1),[Le,Ie]=s.useState(!1),[Ne,Ve]=s.useState(!1),[Se,Pe]=s.useState(0),[Te,ze]=s.useState(0),[T,M]=s.useState({scale:1,x:0,y:0}),[ve,fe]=s.useState(!1),Ee=s.useRef(null),ce=s.useRef(null),Me=s.useRef(null),Ae=s.useRef(new Map),i=s.useRef([]),p=s.useRef(new Map),I=s.useRef(null),J=s.useRef(null),D=s.useRef(!1),{confirm:U}=Zs(),Fe=s.useRef(null),Oe=s.useId();s.useEffect(()=>{const t=ct("fn-agent-view",r);if(t==="list"||t==="board"||t==="org"){Z(t);return}Z("list")},[r]),s.useEffect(()=>{Jt("fn-agent-view",S,r)},[S,r]),s.useEffect(()=>{const t=ct(Rt,r);$e(cs(t)?t:"auto")},[r]),s.useEffect(()=>{Jt(Rt,ie,r)},[ie,r]);const[xt,ye]=s.useState(null),Ke=s.useRef(null),[bt,Re]=s.useState(null),[De,ke]=s.useState(null),[Qe,Ce]=s.useState({}),[n,z]=s.useState(1),[_e,He]=s.useState(!1),[we,Ot]=s.useState(new Set),[vt,Ue]=s.useState(new Map),nt=s.useRef(!0);s.useEffect(()=>(nt.current=!0,()=>{nt.current=!1}),[]),s.useEffect(()=>{Js(r).then(t=>{nt.current&&z(t.heartbeatMultiplier??1)}).catch(()=>{})},[r]);const Dt=s.useCallback(async t=>{const l=Number.isFinite(t)&&t>0?t:1;z(l),He(!0);try{await Qs({heartbeatMultiplier:l},r),a(`Heartbeat speed set to ×${l.toFixed(1)}`,"success")}catch(c){a(`Failed to save heartbeat multiplier: ${pe(c)}`,"error")}finally{nt.current&&He(!1)}},[r,a]),lt=s.useMemo(()=>vt.size===0?k:k.map(t=>{const l=vt.get(t.id);return l?{...t,state:l}:t}),[k,vt]),et=s.useMemo(()=>lt.filter(t=>h||!at(t)),[lt,h]),xs=s.useMemo(()=>lt.filter(t=>t.state!=="active"&&t.state!=="running"?!1:h||!at(t)),[lt,h]),Be=s.useMemo(()=>{if(h)return ee;const t=l=>at(l.agent)?null:{...l,children:l.children.map(t).filter(c=>c!==null)};return ee.map(t).filter(l=>l!==null)},[ee,h]);s.useEffect(()=>{if(S!=="org")return;const t=ce.current;if(!t)return;const l=()=>{je(t.clientWidth)};l();const c=typeof ResizeObserver<"u"?new ResizeObserver(l):null;return c?.observe(t),window.addEventListener("resize",l),()=>{c?.disconnect(),window.removeEventListener("resize",l)}},[S,Be.length]),s.useEffect(()=>{if(S!=="org")return;let t=!1;return K(!0),ea(r,{includeEphemeral:h}).then(l=>{t||te(l)}).catch(l=>{t||(a(`Failed to load org chart: ${pe(l)}`,"error"),te([]))}).finally(()=>{t||K(!1)}),()=>{t=!0}},[S,r,h,a]),s.useEffect(()=>{const t=setInterval(()=>{C()},3e4);return()=>{clearInterval(t)}},[C]),s.useEffect(()=>{if(!re)return;let t=!1;Ve(!0),Lt(void 0,r).then(u=>{if(t)return;const w=u.filter(A=>!at(A));Pe(w.filter(A=>A.state==="active"||A.state==="running").length),ze(w.filter(A=>A.state==="paused").length)}).catch(u=>{t||(Pe(0),ze(0),a(`Failed to load bulk agent actions: ${pe(u)}`,"error"))}).finally(()=>{t||Ve(!1)});const l=u=>{const w=u.target;w&&(Ee.current?.contains(w)||Fe.current?.contains(w)||G(!1))},c=u=>{u.key==="Escape"&&(G(!1),Fe.current?.focus())};return document.addEventListener("mousedown",l),document.addEventListener("touchstart",l),document.addEventListener("keydown",c),()=>{t=!0,document.removeEventListener("mousedown",l),document.removeEventListener("touchstart",l),document.removeEventListener("keydown",c)}},[a,re,r]);const Ht=async t=>{if(!Le){Ie(!0);try{const c=(await Lt(void 0,r)).filter(B=>!at(B)),u=c.filter(B=>t==="paused"?B.state==="active"||B.state==="running":B.state==="paused"),w=c.length-u.length;if(u.length===0){a(`No agents eligible to ${t==="paused"?"pause":"resume"}`,"error");return}if(!await U({title:t==="paused"?"Pause All Agents":"Resume All Agents",message:`${t==="paused"?"Pause":"Resume"} ${u.length} agent${u.length===1?"":"s"} in this project?`,danger:t==="paused"}))return;const se=await Promise.allSettled(u.map(B=>ss(B.id,t,r))),Q=se.map((B,ot)=>({result:B,agent:u[ot]})).filter(B=>B.result.status==="rejected"),m=se.length-Q.length,H=Q.length,X=`${t==="paused"?"Paused":"Resumed"} ${m} agent${m===1?"":"s"}; skipped ${w}`;if(H>0){const B=Q.slice(0,3).map(({agent:ot,result:Ls})=>`${ot.name||ot.id}: ${pe(Ls.reason)}`).join("; ");a(`${X}; failed ${H}${B?` (${B})`:""}`,"error")}else a(X,"success");await C()}catch(l){a(`Failed to ${t==="paused"?"pause":"resume"} agents: ${pe(l)}`,"error")}finally{Ie(!1)}}},tt=async(t,l)=>{if(!we.has(t)){Ot(c=>new Set(c).add(t)),Ue(c=>{const u=new Map(c);return u.set(t,l),u});try{await ss(t,l,r),a(`Agent state updated to ${l}`,"success"),await C(),Ue(c=>{const u=new Map(c);return u.delete(t),u})}catch(c){Ue(u=>{const w=new Map(u);return w.delete(t),w}),a(`Failed to update state: ${pe(c)}`,"error")}finally{Ot(c=>{const u=new Set(c);return u.delete(t),u})}}},bs=async(t,l)=>{if(await U({title:"Delete Agent",message:`Delete agent "${l}"? This cannot be undone.`,danger:!0}))try{await ga(t,r),a(`Agent "${l}" deleted`,"success"),await C()}catch(u){a(`Failed to delete agent: ${pe(u)}`,"error")}},vs=async(t,l)=>{const c=k.find(u=>u.id===t);if(c){if(c.role===l){ye(null);return}try{await ut(t,{role:l},r),a(`Agent role updated to ${$t.find(u=>u.value===l)?.label??l}`,"success"),ye(null),C()}catch(u){a(`Failed to update role: ${pe(u)}`,"error")}}},fs=(t,l)=>{t.key==="Escape"&&ye(null)},js=async(t,l)=>{De===t.id&&(ke(null),Ce(c=>{const u={...c};return delete u[t.id],u})),Re(t.id);try{await ut(t.id,{runtimeConfig:{...t.runtimeConfig??{},heartbeatIntervalMs:l}},r),a(`Heartbeat interval updated to ${as(l)} for ${t.name}`,"success"),C()}catch(c){a(`Failed to update heartbeat interval: ${pe(c)}`,"error")}finally{Re(null)}},Bt=async t=>{const l=Qe[t.id]??"";if(l.trim()===""){a("Please enter a heartbeat interval in minutes","error");return}const c=Number(l);if(isNaN(c)){a("Heartbeat interval must be a valid number","error");return}if(c<=0){a("Heartbeat interval must be greater than 0","error");return}if(c>=1&&c<5){Re(t.id);try{await ut(t.id,{runtimeConfig:{...t.runtimeConfig??{},heartbeatIntervalMs:ua}},r),a(`Heartbeat interval set to 5 minutes (minimum). ${c} minute${c!==1?"s":""} was below the 5-minute minimum.`,"success"),ke(null),Ce(w=>{const A={...w};return delete A[t.id],A}),C()}catch(w){a(`Failed to update heartbeat interval: ${pe(w)}`,"error")}finally{Re(null)}return}const u=Math.round(c*6e4);Re(t.id);try{await ut(t.id,{runtimeConfig:{...t.runtimeConfig??{},heartbeatIntervalMs:u}},r),a(`Heartbeat interval updated to ${as(u)} for ${t.name}`,"success"),ke(null),Ce(w=>{const A={...w};return delete A[t.id],A}),C()}catch(w){a(`Failed to update heartbeat interval: ${pe(w)}`,"error")}finally{Re(null)}},Ns=t=>{const l=Et(t.runtimeConfig?.heartbeatIntervalMs),c=Math.round(l/6e4);ke(t.id),Ce(u=>({...u,[t.id]:String(c)}))},de=s.useCallback((t,l)=>{q(t),le(l?.initialTab??"dashboard"),N(l?.initialRunId??null),me(l?.preferActiveRun??!1)},[]),We=s.useCallback(()=>{q(null),le("dashboard"),N(null),me(!1)},[]),Wt=s.useCallback(t=>{de(t)},[de]),ys=s.useCallback(t=>{ne(t),de(t)},[de]),ks=s.useCallback(async({agentId:t,deleted:l})=>{await E(),l&&P===t&&We()},[E,P,We]),Cs=s.useCallback(t=>{de(t),d&&he(!1)},[d,de]),ws=async(t,l)=>{Ue(c=>{const u=new Map(c);return u.set(t,"running"),u});try{await ma(t,r,{source:"on_demand",triggerDetail:"Triggered from dashboard"}),a(`Heartbeat run started for ${l}`,"success"),await C(),Ue(c=>{const u=new Map(c);return u.delete(t),u})}catch(c){Ue(u=>{const w=new Map(u);return w.delete(t),w}),a(`Failed to start heartbeat run: ${pe(c)}`,"error")}},Ge=s.useCallback(t=>Math.min(Ya,Math.max(Ua,t)),[]),Y=s.useCallback(t=>{const l=ce.current,c=Me.current?.querySelector(".agent-org-chart");if(!l||!c)return{...t,scale:Ge(t.scale)};const u=Ge(t.scale),w=c.scrollWidth*u,A=c.scrollHeight*u,se=l.clientWidth,Q=l.clientHeight,m=Math.min(qe,se-w-qe),H=qe,X=Math.min(qe,Q-A-qe),B=qe;return{scale:u,x:Math.max(m,Math.min(H,t.x)),y:Math.max(X,Math.min(B,t.y))}},[Ge]),it=s.useCallback((t,l,c)=>{const u=ce.current;u&&M(w=>{const A=Ge(t),se=u.getBoundingClientRect(),Q=l-se.left,m=c-se.top,H=(Q-w.x)/w.scale,X=(m-w.y)/w.scale;return Y({scale:A,x:Q-H*A,y:m-X*A})})},[Ge,Y]),Ye=s.useCallback(()=>{const t=ce.current,l=Me.current?.querySelector(".agent-org-chart");if(!t||!l)return;const c=t.clientWidth,u=t.clientHeight,w=l.scrollWidth,A=l.scrollHeight;if(w<=0||A<=0)return;const se=Ge(Math.min(c/w,u/A,1)),Q=(c-w*se)/2,m=(u-A*se)/2;M(Y({scale:se,x:Q,y:m}))},[Ge,Y]),ft=s.useCallback(t=>{Z(t),t!=="org"&&M({scale:1,x:0,y:0}),d&&P&&We()},[We,d,P]),Gt=t=>$t.find(l=>l.value===t)?.label??t,rt=s.useMemo(()=>Ka({tree:Be,availableWidth:ge,preference:ie}),[Be,ie,ge]),Vt=s.useCallback(t=>{$e(t),M({scale:1,x:0,y:0})},[]);s.useEffect(()=>{M({scale:1,x:0,y:0}),D.current=!1},[r,rt]),s.useLayoutEffect(()=>{S!=="org"||be||Be.length===0||D.current||(Ye(),D.current=!0)},[S,Be.length,Ye,be]);const Ss=s.useCallback((t,l)=>{l?Ae.current.set(t,l):Ae.current.delete(t)},[]),Kt=s.useCallback(()=>e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"btn-icon touch-target",onClick:()=>M(t=>Y({...t,scale:t.scale*.9})),"aria-label":"Zoom out org chart",title:"Zoom out",children:e.jsx(Aa,{size:16})}),e.jsxs("span",{className:"agent-org-chart-controls__zoom-label","aria-live":"polite",children:[Math.round(T.scale*100),"%"]}),e.jsx("button",{type:"button",className:"btn-icon touch-target",onClick:()=>M(t=>Y({...t,scale:t.scale*1.1})),"aria-label":"Zoom in org chart",title:"Zoom in",children:e.jsx(wa,{size:16})}),e.jsxs("button",{type:"button",className:"btn touch-target btn-sm agent-org-chart-controls__fit-btn",onClick:Ye,"aria-label":"Fit org chart",title:"Fit org chart",children:[e.jsx(ta,{size:16}),"Fit"]}),e.jsxs("button",{type:"button",className:"btn touch-target btn-sm",onClick:()=>M(t=>Y({...t,x:0,y:0})),"aria-label":"Center org chart",title:"Center org chart",children:[e.jsx(sa,{size:16}),"Center"]})]}),[Y,Ye,T.scale]),As=s.useCallback(t=>{if(!(t.ctrlKey||t.metaKey))return;t.preventDefault();const l=t.deltaY>0?.9:1.1;it(T.scale*l,t.clientX,t.clientY)},[T.scale,it]),Rs=s.useCallback(t=>{if(t.target.closest(".org-chart-node-card"))return;if(t.currentTarget.setPointerCapture?.(t.pointerId),p.current.set(t.pointerId,{x:t.clientX,y:t.clientY}),p.current.size===1){I.current={x:t.clientX-T.x,y:t.clientY-T.y,pointerId:t.pointerId},fe(!0);return}if(p.current.size===2){const c=Array.from(p.current.values()),u=c[0].x-c[1].x,w=c[0].y-c[1].y;J.current={distance:Math.hypot(u,w),scale:T.scale,centerX:(c[0].x+c[1].x)/2,centerY:(c[0].y+c[1].y)/2},I.current=null}},[T.scale,T.x,T.y]),$s=s.useCallback(t=>{if(p.current.has(t.pointerId)){if(p.current.set(t.pointerId,{x:t.clientX,y:t.clientY}),p.current.size>=2){const l=Array.from(p.current.values()),c=J.current;if(!c)return;const u=l[0].x-l[1].x,w=l[0].y-l[1].y,A=Math.hypot(u,w),se=c.scale*(A/c.distance);it(se,c.centerX,c.centerY);return}!I.current||I.current.pointerId!==t.pointerId||M(l=>Y({...l,x:t.clientX-I.current.x,y:t.clientY-I.current.y}))}},[Y,it]),Ut=s.useCallback(t=>{p.current.delete(t.pointerId),p.current.size<2&&(J.current=null),p.current.size===0&&(I.current=null,fe(!1))},[]),Ts=s.useCallback(t=>{if(t.key==="ArrowLeft")M(l=>Y({...l,x:l.x+mt}));else if(t.key==="ArrowRight")M(l=>Y({...l,x:l.x-mt}));else if(t.key==="ArrowUp")M(l=>Y({...l,y:l.y+mt}));else if(t.key==="ArrowDown")M(l=>Y({...l,y:l.y-mt}));else if(t.key==="+"||t.key==="=")M(l=>Y({...l,scale:l.scale*1.1}));else if(t.key==="-")M(l=>Y({...l,scale:l.scale*.9}));else if(t.key==="0")Ye();else if(t.key==="Home")M({scale:1,x:0,y:0});else return;t.preventDefault()},[Y,Ye]),Yt=s.useCallback(()=>{const t=[{value:"horizontal",label:"Horizontal",icon:e.jsx(es,{size:16}),ariaLabel:"Horizontal layout"},{value:"vertical",label:"Vertical",icon:e.jsx(Qt,{size:16}),ariaLabel:"Vertical layout"},{value:"auto",label:"Auto",icon:e.jsx(Ze,{size:16}),ariaLabel:"Automatic layout"}];return e.jsx("div",{className:"agent-org-chart-layout-toggle","data-testid":"agent-org-chart-layout-toggle",children:t.map(l=>{const c=ie===l.value;return e.jsxs("button",{type:"button",className:`btn-icon touch-target agent-org-chart-layout-toggle__button${c?" btn-icon--active":""}`,onClick:()=>Vt(l.value),"aria-pressed":c,"aria-label":l.ariaLabel,title:l.ariaLabel,"data-layout-value":l.value,children:[l.icon,e.jsx("span",{className:"agent-org-chart-layout-toggle__text",children:l.label})]},l.value)})})},[Vt,ie]),Es=t=>Array.isArray(t.metadata?.skills)?t.metadata.skills:[],jt=t=>da(t),Ms=Ne||Le||Se===0,_s=Ne||Le||Te===0,Xt=y&&k.length===0,st=s.useCallback(()=>{W(!0)},[]);return e.jsxs("div",{className:"agents-view",children:[e.jsxs("div",{className:"agents-view-header",children:[e.jsxs("div",{className:"agents-view-title",children:[e.jsx(_t,{size:24}),e.jsx("h2",{children:"Agents"})]}),e.jsxs("div",{className:"agents-view-controls",children:[e.jsxs("div",{className:"view-toggle",children:[e.jsx("button",{className:`view-toggle-btn${S==="list"?" active":""}`,onClick:()=>ft("list"),title:"List view","aria-label":"List view","aria-pressed":S==="list",children:e.jsx(Qt,{size:16})}),e.jsx("button",{className:`view-toggle-btn${S==="board"?" active":""}`,onClick:()=>ft("board"),title:"Board view","aria-label":"Board view","aria-pressed":S==="board",children:e.jsx(Je,{size:16})}),e.jsx("button",{className:`view-toggle-btn${S==="org"?" active":""}`,onClick:()=>ft("org"),title:"Org Chart view","aria-label":"Org Chart view","aria-pressed":S==="org",children:e.jsx(es,{size:16})})]}),e.jsxs("div",{className:"agents-view-primary-actions",children:[e.jsx("button",{ref:Fe,className:`btn-icon agent-controls-trigger${re?" agent-controls-trigger--active":""}`,onClick:()=>G(t=>!t),title:"Controls","aria-label":"Controls","aria-haspopup":"dialog","aria-expanded":re,"aria-controls":Oe,children:e.jsx(ka,{size:16})}),e.jsx("button",{className:"btn-icon",onClick:()=>void C(),title:"Refresh","aria-label":"Refresh",children:e.jsx(Ze,{size:16,className:y?"spin":void 0})}),!d&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm agent-import-trigger",onClick:()=>{F(!0),G(!1)},"aria-label":"Import",title:"Import",children:[e.jsx(It,{size:16}),"Import"]}),e.jsxs("button",{className:"btn btn-task-create btn-sm",onClick:()=>{st(),G(!1)},"aria-label":"New Agent",title:"New Agent",children:[e.jsx(ts,{size:16}),"New Agent"]})]}),re&&e.jsxs("div",{ref:Ee,id:Oe,className:"agent-controls-panel agent-controls-panel--scrollable",role:"dialog","aria-label":"Agent controls","aria-modal":"false",children:[e.jsx("div",{className:"agent-controls",children:e.jsxs("div",{className:"agent-controls-filters",children:[e.jsxs("div",{className:"agent-state-filter",children:[e.jsx(aa,{size:14}),e.jsxs("select",{className:"agent-state-filter-select",value:f,onChange:t=>j(t.target.value),"aria-label":"Filter agents by state",children:[e.jsx("option",{value:"all",children:"All States"}),e.jsx("option",{value:"idle",children:"Idle"}),e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"running",children:"Running"}),e.jsx("option",{value:"paused",children:"Paused"}),e.jsx("option",{value:"error",children:"Error"})]})]}),e.jsxs("label",{className:"checkbox-label agent-system-filter",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:t=>b(t.target.checked),"aria-label":"Show system agents"}),"Show system agents"]})]})}),d&&e.jsxs("div",{className:"agent-controls-mobile-actions",children:[e.jsxs("button",{className:"btn btn-sm agent-import-trigger",onClick:()=>{F(!0),G(!1)},"aria-label":"Import",title:"Import",children:[e.jsx(It,{size:16}),"Import"]}),e.jsxs("button",{className:"btn btn-task-create btn-sm",onClick:()=>{st(),G(!1)},"aria-label":"New Agent",title:"New Agent",children:[e.jsx(ts,{size:16}),"New Agent"]})]}),e.jsxs("div",{className:"agent-controls-bulk-actions",role:"menu","aria-label":"Bulk agent actions",children:[e.jsxs("button",{type:"button",className:"agent-detail-bulk-menu-item",role:"menuitem",disabled:Ms,onClick:()=>{G(!1),Ht("paused")},children:[e.jsxs("span",{className:"agent-controls-bulk-actions__label",children:[e.jsx(Ct,{}),e.jsx("span",{children:"Pause All Agents"})]}),e.jsx("span",{className:"agent-detail-bulk-menu-item-hint",children:Ne?"Loading eligibility…":Se===0?"No active or running project agents to pause":`Pause ${Se} active/running agent${Se===1?"":"s"}`})]}),e.jsxs("button",{type:"button",className:"agent-detail-bulk-menu-item",role:"menuitem",disabled:_s,onClick:()=>{G(!1),Ht("active")},children:[e.jsxs("span",{className:"agent-controls-bulk-actions__label",children:[e.jsx(dt,{}),e.jsx("span",{children:"Resume All Agents"})]}),e.jsx("span",{className:"agent-detail-bulk-menu-item-hint",children:Ne?"Loading eligibility…":Te===0?"No paused project agents to resume":`Resume ${Te} paused agent${Te===1?"":"s"}`})]})]}),e.jsx("div",{className:"agent-global-controls agent-controls-actions",children:e.jsxs("div",{className:"heartbeat-multiplier-group",children:[e.jsxs("div",{className:"heartbeat-multiplier-controls",children:[e.jsx("label",{htmlFor:"globalHeartbeatMultiplier",className:"heartbeat-multiplier-label",children:"Heartbeat Speed"}),e.jsx("input",{id:"globalHeartbeatMultiplier",className:"heartbeat-multiplier-slider touch-target",type:"range",min:.1,max:10,step:.1,value:n,onChange:t=>{const l=Number(t.target.value);Dt(Number.isFinite(l)&&l>0?l:1)},disabled:_e}),e.jsxs("span",{className:"heartbeat-multiplier-value",children:["×",n.toFixed(1)]}),e.jsx("select",{className:"heartbeat-multiplier-preset",value:String(Tt.reduce((t,l)=>Math.abs(l-n)<Math.abs(t-n)?l:t,Tt[0])),onChange:t=>{const l=Number(t.target.value);Dt(Number.isFinite(l)&&l>0?l:1)},disabled:_e,"aria-label":"Heartbeat speed preset",children:Tt.map(t=>e.jsxs("option",{value:String(t),children:["×",t]},t))})]}),e.jsx("small",{className:"text-secondary",children:"Scales all agent heartbeat intervals. ×0.5 = twice as fast, ×2.0 = twice as slow. Default: ×1.0"})]})}),e.jsx(Ra,{agents:et})]})]})]})]}),e.jsx(za,{isOpen:L,onClose:()=>{W(!1),_(null)},onCreated:()=>{W(!1),_(null),C()},projectId:r,prefillDraft:$,agentOnboardingEnabled:g,existingAgents:k,onPrefillDraft:_}),e.jsx(Oa,{isOpen:v,onClose:()=>F(!1),onImported:()=>void C(),projectId:r}),e.jsx(Ia,{stats:R,activeAgents:xs,projectId:r,isOpen:oe,onToggle:()=>he(t=>!t),onSelectAgent:Cs,onOpenTaskLogs:x}),S==="org"?e.jsx("div",{className:"agents-org-full-view",children:e.jsx("div",{className:"agents-view-content agents-view-content--org-full",children:P?e.jsxs("div",{className:"agents-org-detail-view","data-testid":"agents-org-detail-view",children:[e.jsx("button",{type:"button",className:"btn btn-sm agents-org-detail-back",onClick:We,"aria-label":"Back to org chart",children:"Back to org chart"}),e.jsx(s.Suspense,{fallback:null,children:e.jsx(ds,{inline:!0,showInlineBackButton:!1,agentId:P,projectId:r,onClose:We,addToast:a,onChildClick:Wt,initialTab:ae,initialRunId:O,preferActiveRun:ue},P)})]}):Xt?e.jsxs("div",{className:"agents-view-loading",role:"status","aria-live":"polite",children:[e.jsx(Ze,{size:18,className:"spin"}),e.jsx("span",{children:"Loading agents..."})]}):e.jsxs("div",{className:"agent-org-chart-shell","data-testid":"agent-org-chart-shell",children:[d?e.jsxs("div",{className:"agent-org-chart-controls","data-testid":"agent-org-chart-controls",children:[Yt(),Kt()]}):e.jsxs("div",{className:"agent-org-chart-toolbar",children:[Yt(),e.jsx("div",{className:"agent-org-chart-controls","data-testid":"agent-org-chart-controls",children:Kt()})]}),e.jsx("div",{ref:ce,className:"agent-org-chart-viewport","data-testid":"agent-org-chart-viewport",tabIndex:0,role:"region","aria-label":"Org chart canvas",onWheel:As,onPointerDown:Rs,onPointerMove:$s,onPointerUp:Ut,onPointerCancel:Ut,onKeyDown:Ts,"data-panning":ve?"true":"false",children:e.jsxs("div",{ref:Me,className:`agent-org-chart-canvas agent-org-chart-canvas--zoom-${Math.round((T.scale??1)*100)}`,"data-panning":ve?"true":"false",style:{transform:`translate(${T.x}px, ${T.y}px) scale(${T.scale})`},children:[e.jsx("div",{className:`agent-org-chart${rt==="vertical"?" agent-org-chart--vertical":""}`,"data-testid":"agent-org-chart","data-layout-mode":rt,children:be?e.jsxs("div",{className:"agent-org-chart__loading",role:"status","aria-live":"polite",children:[e.jsx(Ze,{size:18,className:"spin"}),e.jsx("span",{children:"Loading org chart..."})]}):Be.length===0?e.jsx(St,{onCtaClick:st}):(i.current=[],Be.map(t=>e.jsx(ps,{node:t,onSelect:ys,getHealthStatus:jt,selectedAgentId:xe,registerNodeElement:Ss,linksRef:i},t.agent.id)))}),e.jsx(Xa,{links:i.current,nodeElements:Ae.current,canvasRef:Me,viewportRef:ce,layoutMode:rt,transform:T})]})})]})})}):e.jsxs("div",{className:"agents-split-layout",children:[e.jsx("div",{className:`agents-split-sidebar${V?" agents-split-sidebar--hidden-mobile":""}`,children:e.jsx("div",{className:"agents-view-content",children:Xt?e.jsxs("div",{className:"agents-view-loading",role:"status","aria-live":"polite",children:[e.jsx(Ze,{size:18,className:"spin"}),e.jsx("span",{children:"Loading agents..."})]}):S==="board"?e.jsx("div",{className:"agent-board",children:et.length===0?e.jsx(St,{onCtaClick:st}):et.map(t=>{const l=jt(t),c=Ft(t,l),u=Pt(t.state),w=zt("agent-board-card",t.state);return e.jsx("div",{className:`agent-board-card ${w}${P===t.id?" agent-card--selected":""}`,children:e.jsxs("div",{className:"agent-board-clickable",onClick:()=>de(t.id),role:"button",tabIndex:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.key===" "&&A.preventDefault(),de(t.id))},children:[e.jsxs("div",{className:"agent-board-header",children:[e.jsx("span",{className:"agent-board-icon",children:e.jsx(ht,{agent:t,size:20})}),e.jsx("span",{className:"agent-board-badge badge text-secondary",children:Gt(t.role)}),e.jsx("span",{className:`agent-board-badge badge ${u}`,children:t.state}),(t.pendingApprovalCount??0)>0?e.jsxs("span",{className:"agent-board-badge badge agent-approval-badge",title:"Pending approvals",children:[e.jsx("span",{className:"status-dot status-dot--pending"}),t.pendingApprovalCount]}):null]}),e.jsx("div",{className:"agent-board-name",children:t.name}),e.jsx("div",{className:"agent-board-id",children:t.id}),e.jsxs("div",{className:"agent-board-health",style:{color:l.color},title:c.title,children:[l.icon,c.label?` ${c.label}`:""]})]})},t.id)})}):e.jsx("div",{className:"agent-list",children:et.length===0?e.jsx(St,{onCtaClick:st}):et.map(t=>{const l=jt(t),c=Ft(t,l),u=Pt(t.state),w=zt("agent-card",t.state),A=Et(t.runtimeConfig?.heartbeatIntervalMs),se=na(A),Q=bt===t.id;return e.jsxs("div",{className:`agent-card agent-card--clickable ${w}${P===t.id?" agent-card--selected":""}`,onClick:m=>{const H=m.target;if(H===m.currentTarget){de(t.id);return}const X=H.closest('button, select, input, [role="button"]');X&&X!==m.currentTarget||de(t.id)},role:"button",tabIndex:0,onKeyDown:m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.key===" "&&m.preventDefault(),de(t.id))},"aria-label":`Open details for ${t.name}`,children:[e.jsxs("div",{className:"agent-card-header",children:[e.jsxs("div",{className:"agent-info",children:[xt===t.id?e.jsx("select",{ref:Ke,className:"select agent-role-select",value:t.role,onChange:m=>void vs(t.id,m.target.value),onKeyDown:m=>fs(m,t.id),onBlur:()=>ye(null),autoFocus:!0,children:$t.map(m=>e.jsxs("option",{value:m.value,children:[m.icon," ",m.label]},m.value))}):e.jsx("span",{className:"agent-icon agent-icon--clickable",onClick:m=>{m.stopPropagation(),ye(t.id)},title:"Click to change role",role:"button",tabIndex:0,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.stopPropagation(),ye(t.id))},children:e.jsx(ht,{agent:t,size:20})}),e.jsxs("div",{className:"agent-meta",children:[e.jsx("span",{className:"agent-name",children:t.name}),e.jsx("span",{className:"agent-id text-secondary",children:t.id})]}),e.jsx(us,{size:20,className:"agent-card-chevron"})]}),e.jsxs("div",{className:"agent-badges",children:[e.jsx("span",{className:`badge ${u}`,children:t.state}),e.jsxs("span",{className:"badge",style:{color:l.color},title:c.title,children:[l.icon,c.label?` ${c.label}`:""]}),e.jsx("span",{className:"badge text-secondary",children:Gt(t.role)}),(t.pendingApprovalCount??0)>0?e.jsxs("span",{className:"badge agent-approval-badge",title:"Pending approvals",children:[e.jsx("span",{className:"status-dot status-dot--pending"}),t.pendingApprovalCount]}):null,(()=>{const m=Es(t);if(m.length===0)return null;const H=m.slice(0,2),X=m.length-2;return e.jsxs(e.Fragment,{children:[H.map(B=>e.jsx("span",{className:"badge badge-skill",title:B,children:va(B)},B)),X>0&&e.jsxs("span",{className:"badge badge-skill",children:["+",X]})]})})()]})]}),e.jsxs("div",{className:"agent-card-body",children:[t.state==="error"&&t.lastError?e.jsx(la,{errorText:t.lastError,issueContext:{surface:"AgentsView list",agentId:t.id,agentName:t.name,agentState:t.state,taskId:t.taskId}}):null,t.taskId&&e.jsxs("div",{className:"agent-task",children:[e.jsx("span",{className:"text-secondary",children:"Working on:"}),e.jsx("span",{className:"badge",children:t.taskId})]}),e.jsxs("div",{className:"agent-heartbeat-control",children:[e.jsx("span",{className:"text-secondary",children:"Heartbeat:"}),De===t.id?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"input agent-heartbeat-custom-input",value:Qe[t.id]??"",onChange:m=>Ce(H=>({...H,[t.id]:m.target.value})),onKeyDown:m=>{m.key==="Enter"?Bt(t):m.key==="Escape"&&(ke(null),Ce(H=>{const X={...H};return delete X[t.id],X}))},disabled:Q,"aria-label":`Custom heartbeat interval in minutes for ${t.name}`}),e.jsx("span",{className:"text-secondary",children:"min"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>void Bt(t),disabled:Q,title:"Save custom interval",children:"Save"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>{ke(null),Ce(m=>{const H={...m};return delete H[t.id],H})},disabled:Q,title:"Cancel custom interval",children:"Cancel"})]}):e.jsx(e.Fragment,{children:e.jsxs("select",{className:"select agent-heartbeat-select",value:A,onChange:m=>{const H=m.target.value;H==="__custom__"?Ns(t):js(t,Number(H))},disabled:Q,"aria-label":`Set heartbeat interval for ${t.name}`,children:[se.map(m=>e.jsx("option",{value:m.value,children:m.label},m.value)),ia.some(m=>m.value===A)&&e.jsx("option",{value:"__custom__",children:"Custom..."})]})}),Q&&e.jsx("span",{className:"agent-heartbeat-saving text-secondary",children:"Saving…"}),t.lastHeartbeatAt&&(()=>{const m=new Date(t.lastHeartbeatAt),H=new Date(m.getTime()+A),X=t.state==="active"||t.state==="running";return e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"agent-heartbeat-last text-secondary",title:m.toLocaleString(),children:["Last: ",m.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})]}),X&&e.jsxs("span",{className:"agent-heartbeat-next text-secondary",title:H.toLocaleString(),children:["Next: ",H.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})]})]})})()]})]}),e.jsxs("div",{className:"agent-card-actions",children:[e.jsxs("div",{className:"agent-card-actions-group agent-card-actions-group--primary",children:[t.state==="idle"&&e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"active"),disabled:we.has(t.id),title:"Activate",children:[e.jsx(dt,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Start"})]}),t.state==="active"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void ws(t.id,t.name),disabled:we.has(t.id),title:"Run Now","aria-label":`Run now for ${t.name}`,children:[e.jsx(Je,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Run Now"})]}),e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"paused"),disabled:we.has(t.id),title:"Pause",children:[e.jsx(Ct,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Pause"})]})]}),t.state==="paused"&&e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"active"),disabled:we.has(t.id),title:"Resume",children:[e.jsx(dt,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Resume"})]}),t.state==="running"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>de(t.id,{initialTab:"runs",initialRunId:null,preferActiveRun:!0}),title:"View live run details","aria-label":`View live run details for ${t.name}`,children:[e.jsx(Je,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Running"})]}),e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"paused"),disabled:we.has(t.id),title:"Pause",children:[e.jsx(Ct,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Pause"})]})]}),t.state==="error"&&e.jsxs("button",{className:"btn btn-sm",onClick:()=>void tt(t.id,"active"),disabled:we.has(t.id),title:"Retry",children:[e.jsx(dt,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Retry"})]})]}),e.jsxs("div",{className:"agent-card-actions-group agent-card-actions-group--secondary",children:[e.jsxs("button",{className:"btn btn-sm agent-card-details-btn",onClick:()=>de(t.id),title:`View details for ${t.name}`,"aria-label":`View details for ${t.name}`,children:[e.jsx(ra,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Details"})]}),(t.state==="idle"||t.state==="paused")&&e.jsxs("button",{className:"btn btn-sm btn-danger",onClick:()=>void bs(t.id,t.name),title:"Delete",children:[e.jsx(oa,{size:14})," ",e.jsx("span",{className:"agent-card-action-label",children:"Delete"})]})]})]})]},t.id)})})})}),e.jsx("div",{className:`agents-split-detail${d&&!P?" agents-split-detail--hidden-mobile":""}`,children:P?e.jsx(s.Suspense,{fallback:null,children:e.jsx(ds,{inline:!0,showInlineBackButton:d,agentId:P,projectId:r,onClose:We,addToast:a,onChildClick:Wt,initialTab:ae,initialRunId:O,preferActiveRun:ue,onMutationSuccess:ks},P)}):e.jsxs("div",{className:"agents-detail-empty-state",children:[e.jsx(_t,{size:48}),e.jsx("h3",{children:"Select an agent"}),e.jsx("p",{children:"Choose an agent from the sidebar to view details"})]})})]})]})}export{an as AgentsView};
|