@alpaca-editor/core 1.0.4185 → 1.0.4187

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/components/ui/popover.d.ts +3 -3
  2. package/dist/config/config.js +9 -1
  3. package/dist/config/config.js.map +1 -1
  4. package/dist/editor/ConfirmationDialog.js.map +1 -1
  5. package/dist/editor/ImageEditButton.js.map +1 -1
  6. package/dist/editor/ai/Agents.js +6 -2
  7. package/dist/editor/ai/Agents.js.map +1 -1
  8. package/dist/editor/client/EditorShell.js +17 -0
  9. package/dist/editor/client/EditorShell.js.map +1 -1
  10. package/dist/editor/client/ui/EditorChrome.js +1 -0
  11. package/dist/editor/client/ui/EditorChrome.js.map +1 -1
  12. package/dist/editor/field-types/DateTimeFieldEditor.js +1 -1
  13. package/dist/editor/field-types/DateTimeFieldEditor.js.map +1 -1
  14. package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -1
  15. package/dist/editor/reviews/CommentPopover.js +1 -1
  16. package/dist/editor/reviews/CommentPopover.js.map +1 -1
  17. package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
  18. package/dist/editor/services/aiService.d.ts +2 -0
  19. package/dist/editor/services/aiService.js.map +1 -1
  20. package/dist/editor/views/ParheliaView.d.ts +5 -0
  21. package/dist/editor/views/ParheliaView.js +136 -0
  22. package/dist/editor/views/ParheliaView.js.map +1 -0
  23. package/dist/page-wizard/WizardSteps.js +6 -2
  24. package/dist/page-wizard/WizardSteps.js.map +1 -1
  25. package/dist/revision.d.ts +2 -2
  26. package/dist/revision.js +2 -2
  27. package/dist/splash-screen/SplashScreen.js +36 -54
  28. package/dist/splash-screen/SplashScreen.js.map +1 -1
  29. package/dist/styles.css +7 -8
  30. package/package.json +12 -8
  31. package/src/config/config.tsx +11 -1
  32. package/src/editor/ConfirmationDialog.tsx +1 -1
  33. package/src/editor/ImageEditButton.tsx +4 -2
  34. package/src/editor/ai/Agents.tsx +7 -2
  35. package/src/editor/client/EditorShell.tsx +18 -0
  36. package/src/editor/client/ui/EditorChrome.tsx +1 -0
  37. package/src/editor/field-types/DateTimeFieldEditor.tsx +5 -4
  38. package/src/editor/reviews/CommentDisplayPopover.tsx +2 -2
  39. package/src/editor/reviews/CommentPopover.tsx +2 -2
  40. package/src/editor/reviews/SuggestionDisplayPopover.tsx +1 -1
  41. package/src/editor/services/aiService.ts +4 -0
  42. package/src/editor/views/ParheliaView.tsx +207 -0
  43. package/src/page-wizard/WizardSteps.tsx +6 -2
  44. package/src/revision.ts +2 -2
  45. package/src/splash-screen/SplashScreen.tsx +74 -113
@@ -289,7 +289,7 @@ export const Agents = React.memo(function Agents({
289
289
  }
290
290
  }
291
291
  if (message.type === "agent:run:start") {
292
- const { agentId, agentName } = message.payload;
292
+ const { agentId, agentName, autoSelect } = message.payload;
293
293
 
294
294
  if (!agentId || !agentName) {
295
295
  console.warn(
@@ -320,7 +320,7 @@ export const Agents = React.memo(function Agents({
320
320
  };
321
321
  return updatedAgents;
322
322
  } else {
323
- // Add new agent to the array (but don't activate it - user may be in a different browser instance)
323
+ // Add new agent to the array
324
324
  const newAgent: Agent = {
325
325
  id: agentId,
326
326
  name: agentName,
@@ -332,6 +332,11 @@ export const Agents = React.memo(function Agents({
332
332
  return [...prevAgents, newAgent];
333
333
  }
334
334
  });
335
+
336
+ // Auto-switch to the spawned agent if requested
337
+ if (autoSelect === true) {
338
+ setActiveAgentIdWithStorage(agentId);
339
+ }
335
340
  } else if (message.type === "agent:info:updated") {
336
341
  const { agentId, agentName, agentDescription } =
337
342
  message.payload || {};
@@ -1518,6 +1518,24 @@ export function EditorShell({
1518
1518
  switchView();
1519
1519
  };
1520
1520
 
1521
+ // Listen for switch-view commands from agents via websocket
1522
+ useEffect(() => {
1523
+ const handleSwitchView = (message: { type: string; payload: any }) => {
1524
+ if (message.type === "switch-view" && message.payload?.viewName) {
1525
+ try {
1526
+ switchView(message.payload.viewName);
1527
+ } catch (error) {
1528
+ console.error("Error switching view:", error);
1529
+ }
1530
+ }
1531
+ };
1532
+
1533
+ const unsubscribe = addSocketMessageListener(handleSwitchView);
1534
+ return () => {
1535
+ unsubscribe();
1536
+ };
1537
+ }, [addSocketMessageListener, switchView]);
1538
+
1521
1539
  const [dialog, setDialog] = useState<ReactNode>(null);
1522
1540
 
1523
1541
  const openDialog: OpenDialog = useCallback(
@@ -50,6 +50,7 @@ export function EditorChrome(props: {
50
50
  showAgentsPanel &&
51
51
  !editContext.currentWizardId &&
52
52
  ![
53
+ "parhelia",
53
54
  "splash-screen",
54
55
  "open-page",
55
56
  "new-page",
@@ -177,9 +177,10 @@ export function DateTimeFieldEditor({
177
177
  <PopoverTrigger asChild>
178
178
  <Button
179
179
  variant="outline"
180
+ size="sm"
180
181
  data-empty={!date}
181
182
  className={cn(
182
- "bg-gray-5 justify-start p-1 text-left text-xs font-normal",
183
+ "bg-gray-5 justify-start px-2 text-left text-xs font-normal",
183
184
  !date && "text-muted-foreground",
184
185
  )}
185
186
  disabled={readOnly}
@@ -205,7 +206,7 @@ export function DateTimeFieldEditor({
205
206
 
206
207
  <div
207
208
  className={cn(
208
- "bg-gray-5 flex items-center justify-start gap-1 px-2 text-left text-xs font-normal",
209
+ "bg-gray-5 flex h-8 items-center justify-start gap-1 rounded-sm px-2 text-left text-xs font-normal",
209
210
  !date && "text-muted-foreground",
210
211
  )}
211
212
  >
@@ -216,7 +217,7 @@ export function DateTimeFieldEditor({
216
217
  <PopoverTrigger asChild>
217
218
  <Button
218
219
  variant="ghost"
219
- className="bg-gray-5 h-8 w-12 p-1 text-xs"
220
+ className="bg-gray-5 h-8 w-12 p-0 text-xs"
220
221
  disabled={readOnly || !date}
221
222
  >
222
223
  {hours.toString().padStart(2, "0")}
@@ -249,7 +250,7 @@ export function DateTimeFieldEditor({
249
250
  <PopoverTrigger asChild>
250
251
  <Button
251
252
  variant="ghost"
252
- className="bg-gray-5 h-7.5 w-12 text-xs"
253
+ className="bg-gray-5 h-8 w-12 p-0 text-xs"
253
254
  disabled={readOnly || !date}
254
255
  >
255
256
  {minutes.toString().padStart(2, "0")}
@@ -109,9 +109,9 @@ export function CommentDisplayPopover({
109
109
  }}
110
110
  enableIframeClickDetection={true}
111
111
  >
112
- <PopoverTrigger asChild>{children}</PopoverTrigger>
112
+ <PopoverTrigger asChild>{children as any}</PopoverTrigger>
113
113
  <PopoverContent
114
- ref={contentRef}
114
+ ref={contentRef as any}
115
115
  tabIndex={-1}
116
116
  className="w-96 p-4"
117
117
  side="bottom"
@@ -163,11 +163,11 @@ export function CommentPopover({
163
163
  )}
164
164
  {!position && (
165
165
  <PopoverTrigger asChild>
166
- {children ?? <MessageCirclePlus size={16} strokeWidth={1} />}
166
+ {(children ?? <MessageCirclePlus size={16} strokeWidth={1} />) as any}
167
167
  </PopoverTrigger>
168
168
  )}
169
169
  <PopoverContent
170
- ref={contentRef}
170
+ ref={contentRef as any}
171
171
  tabIndex={-1}
172
172
  className="w-96 p-4"
173
173
  data-testid="add-comment-popover"
@@ -265,7 +265,7 @@ export function SuggestionDisplayPopover({
265
265
  }}
266
266
  enableIframeClickDetection={true}
267
267
  >
268
- <PopoverTrigger asChild>{children}</PopoverTrigger>
268
+ <PopoverTrigger asChild>{children as any}</PopoverTrigger>
269
269
  <PopoverContent className="w-96 p-4" side="bottom" align="start">
270
270
  <div className="space-y-3">
271
271
  {/* Header */}
@@ -24,6 +24,10 @@ export type AiProfile = {
24
24
  hiddenFromOverview?: boolean;
25
25
  // Optional cost limit configured on the profile (USD)
26
26
  costLimit?: number | null;
27
+ // Number of user browse history items to include (0 = disabled)
28
+ includeUserBrowseHistory?: number;
29
+ // Whether to include user favorites
30
+ includeUserFavorites?: boolean;
27
31
  };
28
32
 
29
33
  // In-flight de-duplication and short TTL cache for AI profiles to avoid
@@ -0,0 +1,207 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { AgentTerminal } from "../ai/AgentTerminal";
3
+ import { Agent, AgentMetadata } from "../services/agentService";
4
+ import { useEditContext } from "../client/editContext";
5
+ import { AiProfile, loadAiProfiles } from "../services/aiService";
6
+ import { AgentProfilesOverview } from "../ai/AgentProfilesOverview";
7
+
8
+ /**
9
+ * ParheliaView - A minimalistic, focused view for a single agent terminal
10
+ * This view provides a distraction-free interface with just the agent terminal centered on screen
11
+ */
12
+ export function ParheliaView() {
13
+ const editContext = useEditContext();
14
+ const [agent, setAgent] = useState<Agent | null>(null);
15
+ const [initialMetadata, setInitialMetadata] = useState<
16
+ AgentMetadata | undefined
17
+ >(undefined);
18
+ const [availableProfiles, setAvailableProfiles] = useState<AiProfile[]>([]);
19
+ const [loadingProfiles, setLoadingProfiles] = useState(false);
20
+
21
+ // Load available profiles
22
+ useEffect(() => {
23
+ let cancelled = false;
24
+ (async () => {
25
+ try {
26
+ setLoadingProfiles(true);
27
+ const profiles = await loadAiProfiles(
28
+ editContext?.currentItemDescriptor,
29
+ );
30
+ if (cancelled) return;
31
+ setAvailableProfiles(profiles || []);
32
+ } catch (e) {
33
+ console.error("Failed to load AI profiles", e);
34
+ } finally {
35
+ if (!cancelled) setLoadingProfiles(false);
36
+ }
37
+ })();
38
+ return () => {
39
+ cancelled = true;
40
+ };
41
+ }, [editContext?.currentItemDescriptor?.id]);
42
+
43
+ // Listen for external requests to add a new agent
44
+ useEffect(() => {
45
+ const handleAddNewAgent = (ev: Event) => {
46
+ let metadata: AgentMetadata | undefined = undefined;
47
+ try {
48
+ const ce = ev as unknown as CustomEvent;
49
+ metadata = (ce.detail && (ce.detail as any).metadata) as
50
+ | AgentMetadata
51
+ | undefined;
52
+ } catch {}
53
+
54
+ // Create a new agent
55
+ const newAgent: Agent = {
56
+ status: "new",
57
+ id: crypto.randomUUID(),
58
+ name: `New Agent`,
59
+ updatedDate: new Date().toISOString(),
60
+ userId: "",
61
+ };
62
+ setAgent(newAgent);
63
+ setInitialMetadata(metadata);
64
+
65
+ // Focus the prompt after the agent mounts
66
+ setTimeout(() => {
67
+ try {
68
+ window.dispatchEvent(new CustomEvent("editor:focusAgentPrompt"));
69
+ } catch {}
70
+ }, 60);
71
+ };
72
+
73
+ window.addEventListener(
74
+ "editor:addNewAgent",
75
+ handleAddNewAgent as EventListener,
76
+ );
77
+ return () =>
78
+ window.removeEventListener(
79
+ "editor:addNewAgent",
80
+ handleAddNewAgent as EventListener,
81
+ );
82
+ }, []);
83
+
84
+ // Listen for external requests to open an existing agent
85
+ useEffect(() => {
86
+ const handleOpenAgent = (ev: Event) => {
87
+ try {
88
+ const ce = ev as unknown as CustomEvent;
89
+ const agentId = (ce.detail && (ce.detail as any).agentId) as
90
+ | string
91
+ | undefined;
92
+
93
+ if (!agentId) return;
94
+
95
+ // Load the agent
96
+ const loadedAgent: Agent = {
97
+ id: agentId,
98
+ name: "Loading...",
99
+ status: "running",
100
+ userId: "",
101
+ updatedDate: new Date().toISOString(),
102
+ };
103
+ setAgent(loadedAgent);
104
+ } catch (error) {
105
+ console.error("Error opening agent:", error);
106
+ }
107
+ };
108
+
109
+ window.addEventListener(
110
+ "editor:openAgent",
111
+ handleOpenAgent as EventListener,
112
+ );
113
+ return () =>
114
+ window.removeEventListener(
115
+ "editor:openAgent",
116
+ handleOpenAgent as EventListener,
117
+ );
118
+ }, []);
119
+
120
+ const handleSelectProfile = (profileId: string) => {
121
+ try {
122
+ const selected = availableProfiles.find((p) => p.id === profileId);
123
+ const metadata = selected
124
+ ? {
125
+ profile: selected.name,
126
+ additionalData: {
127
+ profileId: selected.id,
128
+ profileName: selected.name,
129
+ },
130
+ }
131
+ : undefined;
132
+
133
+ // Create a new agent with the selected profile
134
+ const newAgent: Agent = {
135
+ status: "new",
136
+ id: crypto.randomUUID(),
137
+ name: `New Agent`,
138
+ updatedDate: new Date().toISOString(),
139
+ userId: "",
140
+ };
141
+ setAgent(newAgent);
142
+ setInitialMetadata(metadata);
143
+
144
+ // Focus the prompt after the agent mounts
145
+ setTimeout(() => {
146
+ try {
147
+ window.dispatchEvent(new CustomEvent("editor:focusAgentPrompt"));
148
+ } catch {}
149
+ }, 60);
150
+ } catch (error) {
151
+ console.error("Error creating agent with profile:", error);
152
+ }
153
+ };
154
+
155
+ // Empty state when no agent is active
156
+ if (!agent) {
157
+ return (
158
+ <div className="flex h-full items-center justify-center bg-gray-50 p-8">
159
+ <div className="w-full max-w-4xl">
160
+ {loadingProfiles ? (
161
+ <div className="text-center text-sm text-gray-500">
162
+ Loading profiles...
163
+ </div>
164
+ ) : availableProfiles.length > 0 ? (
165
+ <div className="flex flex-col gap-6">
166
+ <div className="text-center">
167
+ <h2 className="text-2xl font-light tracking-wide text-gray-900">
168
+ parhelia
169
+ </h2>
170
+ <p className="mt-2 text-sm text-gray-500">
171
+ Select an AI agent profile to begin
172
+ </p>
173
+ </div>
174
+ <AgentProfilesOverview
175
+ profiles={availableProfiles}
176
+ onSelectProfile={handleSelectProfile}
177
+ />
178
+ </div>
179
+ ) : (
180
+ <div className="text-center">
181
+ <h2 className="text-2xl font-light tracking-wide text-gray-900">
182
+ parhelia
183
+ </h2>
184
+ <p className="mt-2 text-sm text-gray-500">
185
+ No agent profiles available
186
+ </p>
187
+ </div>
188
+ )}
189
+ </div>
190
+ </div>
191
+ );
192
+ }
193
+
194
+ // Active agent terminal view
195
+ return (
196
+ <div className="flex h-full items-center justify-center bg-gray-50">
197
+ <div className="h-full w-full max-w-6xl">
198
+ <AgentTerminal
199
+ agentStub={agent}
200
+ initialMetadata={initialMetadata}
201
+ profiles={availableProfiles}
202
+ isActive={true}
203
+ />
204
+ </div>
205
+ </div>
206
+ );
207
+ }
@@ -429,12 +429,16 @@ export function WizardSteps({ wizard, parentItem }: WizardStepsProps) {
429
429
  };
430
430
 
431
431
  const handleFinish = () => {
432
+ editContext?.setCurrentWizardId(null);
432
433
  editContext?.switchView("page-editor", { skipConfirmation: true });
433
434
  };
434
435
 
435
436
  const handleClose = () => {
436
- editContext?.setCurrentWizardId(null);
437
- editContext?.switchView("content-editor");
437
+ // If wizard was opened from new-page, go to splash screen instead
438
+ const targetView = editContext?.previousViewName === "new-page"
439
+ ? "splash-screen"
440
+ : (editContext?.previousViewName || "content-editor");
441
+ editContext?.switchView(targetView);
438
442
  };
439
443
 
440
444
  const currentStep = wizard.steps[currentStepIndex];
package/src/revision.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = "1.0.4185";
2
- export const buildDate = "2025-10-23 17:45:06";
1
+ export const version = "1.0.4187";
2
+ export const buildDate = "2025-10-24 13:03:58";
@@ -102,14 +102,14 @@ export function SplashScreen() {
102
102
  <>
103
103
  <div className="relative flex h-full w-full bg-gray-100 md:items-center md:justify-center">
104
104
  <div className="mt-2 flex flex-col gap-6 p-4 md:mt-6 md:gap-12">
105
- <div className="z-10">
105
+ <div className="relative z-20">
106
106
  <h1 className="text-xl font-semibold">Your global website</h1>
107
107
  <div className="text-sm text-gray-500">
108
108
  Add a new page or manage existing ones
109
109
  </div>
110
110
  </div>
111
111
 
112
- <div className="z-10 flex flex-1 flex-col items-stretch gap-4 md:max-w-screen-xl md:flex-row">
112
+ <div className="relative z-20 flex flex-1 flex-col items-stretch gap-4 md:max-w-screen-xl md:flex-row">
113
113
  <div className="flex flex-1 flex-col gap-4">
114
114
  <div className="flex-1 flex-col gap-7 rounded-lg bg-white p-6">
115
115
  <div className="flex flex-col gap-4 md:flex-row">
@@ -157,70 +157,27 @@ export function SplashScreen() {
157
157
  <RecentPages />
158
158
  </div>
159
159
  </div>
160
- {/* Agent Profiles Overview Card (Demo view) */}
161
- <Card
162
- title="AI Agent Profiles"
163
- description="Choose a profile to start a new agent"
164
- icon={<Bot strokeWidth={1} />}
165
- className="w-full md:max-w-screen-xl"
166
- >
167
- {loadingProfiles ? (
168
- <div className="flex h-80 items-center justify-center text-xs text-gray-500">
169
- Loading profiles...
170
- </div>
171
- ) : profiles && profiles.length > 0 ? (
172
- <AgentProfilesOverview
173
- profiles={profiles}
174
- onSelectProfile={(profileId) => {
175
- // Switch to agents overview to show both overview and agents panel
176
- editContext?.switchView("agents-overview");
177
- editContext?.setShowAgentsPanel?.(true);
178
- // Longer delay to allow view switch and Agents panel to mount
179
- setTimeout(() => {
180
- try {
181
- const selectedProfile = profiles.find(
182
- (p) => p.id === profileId,
183
- );
184
- window.dispatchEvent(
185
- new CustomEvent("editor:addNewAgent", {
186
- detail: {
187
- metadata: {
188
- profile: selectedProfile?.name,
189
- additionalData: {
190
- profileId: selectedProfile?.id,
191
- profileName: selectedProfile?.name,
192
- },
193
- },
194
- },
195
- }),
196
- );
197
- } catch {}
198
- }, 500);
199
- }}
200
- />
201
- ) : (
202
- <div className="flex h-80 items-center justify-center text-xs text-gray-500">
203
- No agent profiles available
204
- </div>
205
- )}
206
- </Card>
207
160
  </div>
208
- <div className="bg-wizard absolute inset-0" />
161
+ <div className="bg-wizard absolute inset-0 z-10" />
209
162
  </div>
210
163
  </>
211
164
  );
212
165
  } else {
213
166
  return (
214
- <div className="flex h-full w-full flex-col gap-2 bg-gray-100 md:items-center md:justify-center">
215
- <div className="z-10 flex flex-1 flex-col items-stretch gap-4 p-4 md:min-h-[40vh] md:max-w-screen-xl md:flex-row">
216
- <Card
217
- title=<span className="tracking-wides text-2xl font-extralight">
218
- parhelia
219
- </span>
220
- description="The easiest way to create and manage your content"
221
- icon={<AnimatedSunIcon />}
222
- className="flex-1"
223
- >
167
+ <div className="relative flex h-full w-full bg-gray-100 md:items-center md:justify-center" data-testid = "asdf">
168
+ <div className="mt-2 flex flex-col gap-6 p-4 md:mt-6 md:gap-12">
169
+
170
+
171
+ <div className="relative z-20 flex flex-1 flex-col items-stretch gap-4 md:max-w-screen-xl md:flex-row">
172
+ <div className="flex flex-1 flex-col gap-4">
173
+ <Card
174
+ title=<span className="tracking-wides text-2xl font-extralight">
175
+ parhelia
176
+ </span>
177
+ description="The easiest way to create and manage your content"
178
+ icon={<AnimatedSunIcon />}
179
+ className="flex-1"
180
+ >
224
181
  <div className="flex flex-col gap-4 text-sm text-gray-500">
225
182
  Parhelia is an editor for your favorite content management system.
226
183
  It allows you to create and manage your content in a simple and
@@ -258,9 +215,8 @@ export function SplashScreen() {
258
215
  >
259
216
  Open Sitecore Launchpad
260
217
  </ActionButton>
261
-
262
218
  <ActionButton
263
- className="mt-6 md:mt-18"
219
+ // className="mt-6 md:mt-18"
264
220
  onClick={() => {
265
221
  editContext?.switchView("page-editor");
266
222
  }}
@@ -269,61 +225,66 @@ export function SplashScreen() {
269
225
  </ActionButton>
270
226
  </div>
271
227
  </div>
272
- </Card>
273
- <div className="flex-1">
274
- <RecentPages />
228
+ </Card>
229
+ </div>
230
+ <div className="flex-1">
231
+ <RecentPages />
232
+ </div>
275
233
  </div>
276
- </div>
277
- {/* Agent Profiles Overview Card */}
278
- <div className="z-10 mt-2 flex w-full max-w-screen-xl flex-1 px-4">
279
- <Card
280
- title="AI Agent Profiles"
281
- description="Choose a profile to start a new agent"
282
- icon={<Bot strokeWidth={1} />}
283
- className="w-full"
284
- >
285
- {loadingProfiles ? (
286
- <div className="flex h-80 items-center justify-center text-xs text-gray-500">
287
- Loading profiles...
288
- </div>
289
- ) : profiles && profiles.length > 0 ? (
290
- <AgentProfilesOverview
291
- profiles={profiles}
292
- onSelectProfile={(profileId) => {
293
- // Switch to agents overview to show both overview and agents panel
294
- editContext?.switchView("agents-overview");
295
- editContext?.setShowAgentsPanel?.(true);
296
- // Longer delay to allow view switch and Agents panel to mount
297
- setTimeout(() => {
298
- try {
299
- const selectedProfile = profiles.find(
300
- (p) => p.id === profileId,
301
- );
302
- window.dispatchEvent(
303
- new CustomEvent("editor:addNewAgent", {
304
- detail: {
305
- metadata: {
306
- profile: selectedProfile?.name,
307
- additionalData: {
308
- profileId: selectedProfile?.id,
309
- profileName: selectedProfile?.name,
234
+ {/* Agent Profiles Overview Card */}
235
+ <div className="relative z-20">
236
+ <Card
237
+ title="AI Agent Profiles"
238
+ description="Choose a profile to start a new agent"
239
+ icon={<Bot strokeWidth={1} />}
240
+ className="w-full md:max-w-screen-xl"
241
+ >
242
+ <div className="max-h-80 overflow-y-auto">
243
+ {loadingProfiles ? (
244
+ <div className="flex h-80 items-center justify-center text-xs text-gray-500">
245
+ Loading profiles...
246
+ </div>
247
+ ) : profiles && profiles.length > 0 ? (
248
+ <AgentProfilesOverview
249
+ profiles={profiles}
250
+ onSelectProfile={(profileId) => {
251
+ // Switch to agents overview to show both overview and agents panel
252
+ editContext?.switchView("agents-overview");
253
+ editContext?.setShowAgentsPanel?.(true);
254
+ // Longer delay to allow view switch and Agents panel to mount
255
+ setTimeout(() => {
256
+ try {
257
+ const selectedProfile = profiles.find(
258
+ (p) => p.id === profileId,
259
+ );
260
+ window.dispatchEvent(
261
+ new CustomEvent("editor:addNewAgent", {
262
+ detail: {
263
+ metadata: {
264
+ profile: selectedProfile?.name,
265
+ additionalData: {
266
+ profileId: selectedProfile?.id,
267
+ profileName: selectedProfile?.name,
268
+ },
269
+ },
310
270
  },
311
- },
312
- },
313
- }),
314
- );
315
- } catch {}
316
- }, 500);
317
- }}
318
- />
319
- ) : (
320
- <div className="flex h-80 items-center justify-center text-xs text-gray-500">
321
- No agent profiles available
271
+ }),
272
+ );
273
+ } catch {}
274
+ }, 500);
275
+ }}
276
+ className="overflow-x-auto"
277
+ />
278
+ ) : (
279
+ <div className="flex h-80 items-center justify-center text-xs text-gray-500">
280
+ No agent profiles available
281
+ </div>
282
+ )}
322
283
  </div>
323
- )}
324
- </Card>
284
+ </Card>
285
+ </div>
325
286
  </div>
326
- <div className="bg-wizard absolute inset-0" />
287
+ <div className="bg-wizard absolute inset-0 z-10" />
327
288
  </div>
328
289
  );
329
290
  }