File size: 25,319 Bytes
c2ea5ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
import React, { useState, useCallback } from "react";
import { Button } from "@/components/ui/button";
import { Progress } from "@/components/ui/progress";
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card";

import { Separator } from "@/components/ui/separator";
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select";
import { Textarea } from "@/components/ui/textarea";
import { Label } from "@/components/ui/label";
import {
  Upload,
  X,
  CheckCircle,
  AlertCircle,
  FileText,
  Trash2,
  ArrowUpDown,
  Copy,
} from "lucide-react";
import { useSystemNotifications } from "@/hooks/useSystemNotifications";
import { useAgentGraph } from "@/context/AgentGraphContext";
import { api } from "@/lib/api";

type ConcatenationMethod = "newlines" | "timestamps" | "custom" | "none";

interface FileUpload {
  file: File;
  id: string;
  preview?: string;
}

export function UploadView() {
  const [uploadProgress, setUploadProgress] = useState(0);
  const [isUploading, setIsUploading] = useState(false);
  const [selectedFiles, setSelectedFiles] = useState<FileUpload[]>([]);
  const [uploadComplete, setUploadComplete] = useState(false);
  const [concatenationMethod, setConcatenationMethod] =
    useState<ConcatenationMethod>("newlines");
  const [customSeparator, setCustomSeparator] = useState("\n---\n");
  const [finalFilename, setFinalFilename] = useState("");
  const [isDragging, setIsDragging] = useState(false);

  const { notifySuccess, notifyError } = useSystemNotifications();
  const { actions } = useAgentGraph();

  const handleFileSelect = useCallback(
    (e: React.ChangeEvent<HTMLInputElement>) => {
      const files = e.target.files;
      if (files) {
        addFiles(Array.from(files));
      }
    },
    []
  );

  const handleDragOver = useCallback((e: React.DragEvent) => {
    e.preventDefault();
    setIsDragging(true);
  }, []);

  const handleDragLeave = useCallback((e: React.DragEvent) => {
    e.preventDefault();
    setIsDragging(false);
  }, []);

  const handleDrop = useCallback((e: React.DragEvent) => {
    e.preventDefault();
    setIsDragging(false);
    
    const files = Array.from(e.dataTransfer.files);
    if (files.length > 0) {
      addFiles(files);
    }
  }, []);

  const addFiles = (files: File[]) => {
    const newFiles = files.map((file) => ({
      file,
      id: Math.random().toString(36).substr(2, 9),
      preview: file.size < 50000 ? "Loading..." : undefined, // Only preview small files
    }));

    setSelectedFiles((prev) => [...prev, ...newFiles]);
    setUploadComplete(false);

    // Generate filename suggestion
    if (files.length === 1 && selectedFiles.length === 0) {
      setFinalFilename(files[0]?.name || "trace");
    } else {
      setFinalFilename(`combined_trace_${Date.now()}.${getOutputExtension()}`);
    }
  };

  const removeFile = (id: string) => {
    setSelectedFiles((prev) => prev.filter((f) => f.id !== id));
  };

  const moveFile = (id: string, direction: "up" | "down") => {
    setSelectedFiles((prev) => {
      const index = prev.findIndex((f) => f.id === id);
      if (index === -1) return prev;

      const newFiles = [...prev];
      const targetIndex = direction === "up" ? index - 1 : index + 1;

      if (
        targetIndex >= 0 &&
        targetIndex < newFiles.length &&
        newFiles[index] &&
        newFiles[targetIndex]
      ) {
        [newFiles[index], newFiles[targetIndex]] = [
          newFiles[targetIndex],
          newFiles[index],
        ];
      }

      return newFiles;
    });
  };

  const getOutputExtension = () => {
    const hasJson = selectedFiles.some((f) => f.file.name.endsWith(".json"));
    return hasJson ? "json" : "txt";
  };

  const concatenateFiles = async (): Promise<string> => {
    if (selectedFiles.length === 1) {
      return (await selectedFiles[0]?.file.text()) || "";
    }

    const fileContents = await Promise.all(
      selectedFiles.map(async (fileUpload) => {
        const content = await fileUpload.file.text();
        return {
          filename: fileUpload.file.name,
          content: content.trim(),
        };
      })
    );

    switch (concatenationMethod) {
      case "none":
        return fileContents.map((f) => f.content).join("");

      case "newlines":
        return fileContents.map((f) => f.content).join("\n\n");

      case "timestamps":
        return fileContents
          .map(
            (f) =>
              `=== File: ${f.filename} (${new Date().toISOString()}) ===\n${
                f.content
              }`
          )
          .join("\n\n");

      case "custom":
        return fileContents.map((f) => f.content).join(customSeparator);

      default:
        return fileContents.map((f) => f.content).join("\n\n");
    }
  };

  const handleUpload = async () => {
    if (selectedFiles.length === 0) return;

    setIsUploading(true);
    setUploadProgress(0);

    try {
      let fileToUpload: File;

      if (selectedFiles.length === 1 && selectedFiles[0]) {
        fileToUpload = selectedFiles[0].file;
      } else {
        // Concatenate multiple files
        const combinedContent = await concatenateFiles();
        const blob = new Blob([combinedContent], { type: "text/plain" });
        fileToUpload = new File([blob], finalFilename, { type: blob.type });
      }

      const trace = await api.traces.upload(fileToUpload, (progress) => {
        setUploadProgress(progress);
      });

      notifySuccess(
        "Upload Successful",
        `${fileToUpload.name} has been uploaded successfully.`
      );

      // Refresh traces list
      const traces = await api.traces.list();
      actions.setTraces(traces);

      // Select the uploaded trace
      actions.setSelectedTrace(trace);

      // Mark upload as complete
      setUploadComplete(true);
      setUploadProgress(100);
    } catch (error) {
      notifyError(
        "Upload Failed",
        error instanceof Error ? error.message : "Failed to upload file"
      );
    } finally {
      setIsUploading(false);
    }
  };

  const handleReset = () => {
    setSelectedFiles([]);
    setUploadProgress(0);
    setUploadComplete(false);
    setFinalFilename("");
  };

  const handleViewTrace = () => {
    actions.setActiveView("traces");
  };

  const getFileIcon = (fileName: string) => {
    const extension = fileName.toLowerCase().split(".").pop();
    switch (extension) {
      case "json":
        return "📄";
      case "txt":
        return "📝";
      case "log":
        return "📋";
      default:
        return "📄";
    }
  };

  const formatFileSize = (bytes: number) => {
    if (bytes === 0) return "0 Bytes";
    const k = 1024;
    const sizes = ["Bytes", "KB", "MB", "GB"];
    const i = Math.floor(Math.log(bytes) / Math.log(k));
    return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
  };

  return (
    <div className="p-6 space-y-6 max-w-7xl mx-auto">
      {/* Upload Instructions */}
      <div 
        className={`border border-dashed rounded-lg p-8 text-center space-y-4 transition-colors ${
          isDragging
            ? "border-primary bg-primary/5 border-2"
            : "border-gray-300 hover:border-primary/50"
        }`}
        onDragOver={handleDragOver}
        onDragLeave={handleDragLeave}
        onDrop={handleDrop}
      >
        <div className="space-y-2">
          <Upload className="h-12 w-12 text-muted-foreground mx-auto" />
          <h3 className="text-lg font-semibold">
            Drop files here or click to upload
          </h3>
          <p className="text-muted-foreground max-w-md mx-auto">
            Select trace files (JSON, TXT, JSONL) to upload. You can select
            multiple files at once.
          </p>
        </div>
        <Button size="lg" variant="outline" asChild>
          <label className="cursor-pointer">
            <input
              type="file"
              className="hidden"
              accept=".json,.txt,.log"
              multiple
              onChange={handleFileSelect}
            />
            Browse Files
          </label>
        </Button>
      </div>

      <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
        {/* Left Column - Upload Functionality */}
        <div className="space-y-6">
          {/* Selected Files */}
          {selectedFiles.length > 0 && (
            <div className="space-y-4">
              <div className="flex items-center justify-between">
                <h4 className="font-medium">
                  Selected Files ({selectedFiles.length})
                </h4>
                <Button variant="ghost" size="sm" onClick={handleReset}>
                  <X className="h-4 w-4 mr-1" />
                  Clear All
                </Button>
              </div>

              <div className="space-y-2 max-h-60 overflow-y-auto">
                {selectedFiles.map((fileUpload, index) => (
                  <div
                    key={fileUpload.id}
                    className="flex items-center gap-3 p-3 border rounded-lg bg-muted/20"
                  >
                    <div className="text-2xl">
                      {getFileIcon(fileUpload.file.name)}
                    </div>
                    <div className="flex-1 min-w-0">
                      <p
                        className="font-medium text-sm truncate"
                        title={fileUpload.file.name}
                      >
                        {fileUpload.file.name}
                      </p>
                      <div className="flex items-center gap-2 text-xs text-muted-foreground">
                        <span>{formatFileSize(fileUpload.file.size)}</span>
                        <span></span>
                        <span>{fileUpload.file.type || "Unknown type"}</span>
                      </div>
                    </div>
                    <div className="flex items-center gap-1">
                      <Button
                        variant="ghost"
                        size="sm"
                        onClick={() => moveFile(fileUpload.id, "up")}
                        disabled={index === 0}
                      >
                        <ArrowUpDown className="h-3 w-3" />
                      </Button>
                      <Button
                        variant="ghost"
                        size="sm"
                        onClick={() => removeFile(fileUpload.id)}
                      >
                        <Trash2 className="h-3 w-3" />
                      </Button>
                    </div>
                  </div>
                ))}
              </div>
            </div>
          )}

          {/* Multiple Files Configuration */}
          {selectedFiles.length > 1 && (
            <Card>
              <CardHeader>
                <CardTitle className="flex items-center gap-2">
                  <Copy className="h-5 w-5" />
                  File Concatenation
                </CardTitle>
                <CardDescription>
                  Configure how multiple files should be combined
                </CardDescription>
              </CardHeader>
              <CardContent className="space-y-4">
                <div className="space-y-2">
                  <Label htmlFor="concatenation-method">
                    Concatenation Method
                  </Label>
                  <Select
                    value={concatenationMethod}
                    onValueChange={(value: ConcatenationMethod) =>
                      setConcatenationMethod(value)
                    }
                  >
                    <SelectTrigger>
                      <SelectValue />
                    </SelectTrigger>
                    <SelectContent>
                      <SelectItem value="newlines">
                        Separate with blank lines
                      </SelectItem>
                      <SelectItem value="timestamps">
                        Add timestamps and filenames
                      </SelectItem>
                      <SelectItem value="custom">Custom separator</SelectItem>
                      <SelectItem value="none">
                        No separation (direct concatenation)
                      </SelectItem>
                    </SelectContent>
                  </Select>
                </div>

                {concatenationMethod === "custom" && (
                  <div className="space-y-2">
                    <Label htmlFor="custom-separator">Custom Separator</Label>
                    <Textarea
                      id="custom-separator"
                      value={customSeparator}
                      onChange={(e) => setCustomSeparator(e.target.value)}
                      placeholder="Enter custom separator..."
                      rows={2}
                    />
                  </div>
                )}

                <div className="space-y-2">
                  <Label htmlFor="final-filename">Final Filename</Label>
                  <input
                    id="final-filename"
                    type="text"
                    value={finalFilename}
                    onChange={(e) => setFinalFilename(e.target.value)}
                    className="w-full px-3 py-2 border rounded-lg text-sm"
                    placeholder="Enter filename for combined file..."
                  />
                </div>
              </CardContent>
            </Card>
          )}

          {/* Upload Progress & Actions */}
          {selectedFiles.length > 0 && (
            <Card>
              <CardHeader>
                <CardTitle className="flex items-center gap-2">
                  <FileText className="h-5 w-5" />
                  {uploadComplete ? "Upload Complete" : "Ready to Upload"}
                </CardTitle>
                <CardDescription>
                  {selectedFiles.length === 1 && selectedFiles[0]
                    ? `Upload ${selectedFiles[0].file.name}`
                    : `Combine and upload ${selectedFiles.length} files`}
                </CardDescription>
              </CardHeader>
              <CardContent className="space-y-4">
                {/* Upload Progress */}
                {isUploading && (
                  <div className="space-y-3">
                    <div className="flex items-center justify-between text-sm">
                      <span className="text-muted-foreground">
                        Uploading...
                      </span>
                      <span className="font-medium">
                        {Math.round(uploadProgress)}%
                      </span>
                    </div>
                    <Progress value={uploadProgress} className="h-3" />
                  </div>
                )}

                {/* Success State */}
                {uploadComplete && (
                  <div className="p-4 bg-green-50 border border-green-200 rounded-lg">
                    <div className="flex items-center gap-2 text-green-800 mb-2">
                      <CheckCircle className="h-5 w-5" />
                      <span className="font-medium">Upload Successful!</span>
                    </div>
                    <p className="text-sm text-green-700 mb-4">
                      Your trace file has been uploaded and is ready for
                      analysis.
                    </p>
                    <div className="flex gap-2">
                      <Button onClick={handleViewTrace} size="sm">
                        View in Traces
                      </Button>
                      <Button onClick={handleReset} variant="outline" size="sm">
                        Upload Another
                      </Button>
                    </div>
                  </div>
                )}

                {/* Upload Actions */}
                {!uploadComplete && (
                  <div className="flex gap-3">
                    <Button
                      variant="outline"
                      onClick={handleReset}
                      disabled={isUploading}
                      className="flex-1"
                    >
                      Reset
                    </Button>
                    <Button
                      onClick={handleUpload}
                      disabled={isUploading}
                      className="flex-1"
                      size="lg"
                    >
                      {isUploading
                        ? "Uploading..."
                        : selectedFiles.length > 1
                        ? "Combine & Upload"
                        : "Upload File"}
                    </Button>
                  </div>
                )}
              </CardContent>
            </Card>
          )}

          {/* Minimum Viable Trace Example */}
          <Card>
            <CardHeader>
              <CardTitle className="text-lg">
                Minimum Viable Trace Example
              </CardTitle>
              <CardDescription>
                AgentGraph can process even basic conversation logs with just
                agent identification and input/output pairs
              </CardDescription>
            </CardHeader>
            <CardContent>
              <div className="bg-slate-50 border rounded-lg p-4">
                <pre className="text-xs text-slate-700 whitespace-pre-wrap">
                  {`{
  "agent_name": "assistant",
  "input": "user message", 
  "output": "agent response"
}`}
                </pre>
              </div>
              <p className="text-xs text-muted-foreground mt-3">
                <span className="font-medium">Note:</span> Analysis capabilities
                scale significantly with additional structured metadata.
              </p>
            </CardContent>
          </Card>

          {/* File Guidelines */}
          <Card>
            <CardHeader>
              <CardTitle className="flex items-center gap-2">
                <Upload className="h-5 w-5" />
                File Guidelines
              </CardTitle>
            </CardHeader>
            <CardContent>
              <div className="space-y-4 text-sm">
                <div>
                  <h4 className="font-medium mb-2">Supported File Types</h4>
                  <ul className="space-y-1 text-muted-foreground">
                    <li>• JSON files (.json) - Structured trace data</li>
                    <li>• Text files (.txt) - Plain text traces</li>
                    <li>• Log files (.log) - Application logs</li>
                  </ul>
                </div>
                <Separator />
                <div>
                  <h4 className="font-medium mb-2">File Requirements</h4>
                  <ul className="space-y-1 text-muted-foreground">
                    <li>• Maximum file size: 50MB per file</li>
                    <li>• UTF-8 encoding recommended</li>
                    <li>• Well-formed JSON for .json files</li>
                    <li>
                      • Multiple files will be concatenated based on your
                      settings
                    </li>
                  </ul>
                </div>
              </div>
            </CardContent>
          </Card>
        </div>

        {/* Right Column - AgentGraph Trace Requirements */}
        <div className="space-y-6">
          <Card>
            <CardHeader>
              <CardTitle className="flex items-center gap-2">
                <AlertCircle className="h-5 w-5" />
                AgentGraph Trace Requirements
              </CardTitle>
            </CardHeader>
            <CardContent>
              <div className="space-y-6 text-sm">
                {/* Essential Requirements */}
                <div>
                  <h4 className="font-semibold text-green-700 mb-3">
                    Essential (Absolute Minimum):
                  </h4>
                  <ul className="space-y-2 text-muted-foreground">
                    <li>
                      •{" "}
                      <span className="font-medium">Agent Identification</span>{" "}
                      - Clear agent names/types to distinguish different actors
                    </li>
                    <li>
                      •{" "}
                      <span className="font-medium">Input/Output Messages</span>{" "}
                      - Core conversation content (user inputs and agent
                      responses)
                    </li>
                  </ul>
                </div>

                <Separator />

                {/* Highly Recommended */}
                <div>
                  <h4 className="font-semibold text-blue-700 mb-3">
                    Highly Recommended:
                  </h4>
                  <ul className="space-y-2 text-muted-foreground">
                    <li>
<span className="font-medium">System Prompts</span> -
                      Agent instructions and personas (improves entity
                      classification)
                    </li>
                    <li>
                      •{" "}
                      <span className="font-medium">
                        Hierarchical Structure
                      </span>{" "}
                      - Parent-child relationships between spans/steps for
                      execution flow analysis
                    </li>
                    <li>
<span className="font-medium">Tool Usage Details</span>{" "}
                      - Function calls with parameters and return values
                      (critical for multi-step agents)
                    </li>
                    <li>
<span className="font-medium">Error Information</span> -
                      Exception details and failure modes for anomaly detection
                    </li>
                  </ul>
                </div>

                <Separator />

                {/* Optional */}
                <div>
                  <h4 className="font-semibold text-purple-700 mb-3">
                    Optional (Enhanced Analysis):
                  </h4>
                  <ul className="space-y-2 text-muted-foreground">
                    <li>
                      •{" "}
                      <span className="font-medium">
                        Intermediate Reasoning
                      </span>{" "}
                      - Chain-of-thought processes (enhances causal analysis)
                    </li>
                    <li>
                      •{" "}
                      <span className="font-medium">
                        Unique Trace Identifier
                      </span>{" "}
                      - Consistent ID to track complete agent workflows (e.g.,
                      trace_id, session_id)
                    </li>
                    <li>
<span className="font-medium">Timestamps</span> -
                      Start/end times for temporal analysis and performance
                      optimization
                    </li>
                    <li>
<span className="font-medium">Basic Status</span> -
                      Success/failure indication for each step
                    </li>
                    <li>
<span className="font-medium">Model Information</span> -
                      LLM model names, versions, parameters (enables
                      model-specific insights)
                    </li>
                    <li>
<span className="font-medium">Token Usage</span> -
                      Input/output token counts (for cost analysis)
                    </li>
                    <li>
<span className="font-medium">Execution Context</span> -
                      Environment details, API endpoints, service versions
                    </li>
                  </ul>
                </div>

                <Separator />

                {/* Multi-Agent Specific */}
                <div>
                  <h4 className="font-semibold text-orange-700 mb-3">
                    Multi-Agent Specific (Optional):
                  </h4>
                  <ul className="space-y-2 text-muted-foreground">
                    <li>
<span className="font-medium">Task Decomposition</span>{" "}
                      - How tasks are split among agents (Normally in the Agent
                      Setting yaml file in CrewAI)
                    </li>
                    <li>
<span className="font-medium">Dependency Tracking</span>{" "}
                      - Inter-agent dependencies (Access level of each agent)
                    </li>
                    <li>
                      •{" "}
                      <span className="font-medium">Orchestration Events</span>{" "}
                      - Workflow coordination and handoffs (Sometimes defined in
                      the parameters or code)
                    </li>
                  </ul>
                </div>
              </div>
            </CardContent>
          </Card>
        </div>
      </div>
    </div>
  );
}