feat(run-details-panel): enhance run details display and error handling

- Improved the layout and readability of the run details panel by restructuring sections and adding collapsible error views.
- Introduced a new `RunErrorSection` component to present run-level errors more clearly, allowing users to toggle raw error details.
- Updated the handling of run outputs, step results, and artifacts for better user experience.
- Refactored duration calculation in `RunRow` to utilize a dedicated `formatDuration` function for consistency.
- Added a new `RunStepResult` interface to improve type safety and clarity in handling step results.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-05-29 13:43:58 -07:00
parent cb2e33e083
commit fade9d1b9d
5 changed files with 268 additions and 44 deletions

View file

@ -190,6 +190,31 @@ export const run = runSummary.extend({
});
export type Run = z.infer<typeof run>;
/**
* Typed view over a single entry in {@link Run.step_results}. The Zod schema
* keeps step results as opaque records (the backend emits action-specific
* payloads), so this interface exists purely for safe field access in the UI
* and does not perform runtime validation.
*
* Mirrors `_result()` in
* `surfsense_backend/app/automations/runtime/step.py`. For the `agent_task`
* action, `result` carries the markdown `final_message` produced by the agent.
*/
export interface RunStepResult {
step_id: string;
action: string;
status: "succeeded" | "failed" | "skipped" | string;
started_at?: string;
finished_at?: string;
attempts?: number;
result?: {
final_message?: string;
agent_session_id?: string;
resumes?: unknown;
} & Record<string, unknown>;
error?: { message?: string; type?: string };
}
export const runListResponse = z.object({
items: z.array(runSummary),
total: z.number(),