diff --git a/packages/extension/src/entrypoints/sidepanel/components/cards/index.tsx b/packages/extension/src/entrypoints/sidepanel/components/cards/index.tsx
index f2ee023..fad9242 100644
--- a/packages/extension/src/entrypoints/sidepanel/components/cards/index.tsx
+++ b/packages/extension/src/entrypoints/sidepanel/components/cards/index.tsx
@@ -1,3 +1,4 @@
+import { type AgentStep, type ErrorEvent, type ObservationEvent } from '@page-agent/core'
import {
CheckCircle,
ChevronDown,
@@ -143,87 +144,102 @@ function RawResponseSection({ rawResponse }: { rawResponse: unknown }) {
)
}
+function StepCard({ event }: { event: AgentStep }) {
+ return (
+
+
+ Step #{event.stepIndex! + 1}
+
+
+ {/* Reflection */}
+ {event.reflection &&
}
+
+ {/* Action */}
+ {event.action && (
+
+
+ Actions
+
+
+
+
+
+ {event.action.name}
+ {event.action.name !== 'done' && (
+
+ {JSON.stringify(event.action.input)}
+
+ )}
+
+
└ {event.action.output}
+
+
+
+ )}
+
+ {/* Raw Response */}
+ {!event.rawResponse ||
}
+
+ )
+}
+
+function ObservationCard({ event }: { event: ObservationEvent }) {
+ return (
+
+ {/*
+ Observation
+
*/}
+
+
+ {event.content}
+
+
+ )
+}
+
+function ErrorCard({ event }: { event: ErrorEvent }) {
+ return (
+
+
+
+ {event.message}
+
+ {!event.rawResponse ||
}
+
+ )
+}
+
// History event card component
export function EventCard({ event }: { event: HistoricalEvent }) {
// Done action - show as result card
if (event.type === 'step' && event.action?.name === 'done') {
const input = event.action.input as { text?: string; success?: boolean }
return (
-
+ <>
+
{!event.rawResponse || }
-
+ >
)
}
if (event.type === 'step') {
- return (
-
-
- Step #{event.stepIndex! + 1}
-
-
- {/* Reflection */}
- {event.reflection &&
}
-
- {/* Action */}
- {event.action && (
-
-
- Actions
-
-
-
-
-
- {event.action.name}
-
- {JSON.stringify(event.action.input)}
-
-
-
└ {event.action.output}
-
-
-
- )}
-
- {/* Raw Response */}
- {!event.rawResponse ||
}
-
- )
+ return
}
if (event.type === 'observation') {
- return (
-
- {/*
- Observation
-
*/}
-
-
- {event.content}
-
-
- )
+ return
}
if (event.type === 'error') {
- return (
-
-
-
- {event.message}
-
- {!event.rawResponse ||
}
-
- )
+ return
}
return null