@mcp-shark/mcp-shark 1.4.0

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 (212) hide show
  1. package/LICENSE +85 -0
  2. package/README.md +724 -0
  3. package/bin/mcp-shark.js +93 -0
  4. package/mcp-server/.editorconfig +15 -0
  5. package/mcp-server/.prettierignore +11 -0
  6. package/mcp-server/.prettierrc +12 -0
  7. package/mcp-server/README.md +280 -0
  8. package/mcp-server/commitlint.config.cjs +42 -0
  9. package/mcp-server/eslint.config.js +131 -0
  10. package/mcp-server/lib/auditor/audit.js +228 -0
  11. package/mcp-server/lib/common/error.js +15 -0
  12. package/mcp-server/lib/server/external/all.js +32 -0
  13. package/mcp-server/lib/server/external/config.js +59 -0
  14. package/mcp-server/lib/server/external/kv.js +102 -0
  15. package/mcp-server/lib/server/external/single/client.js +35 -0
  16. package/mcp-server/lib/server/external/single/request.js +49 -0
  17. package/mcp-server/lib/server/external/single/run.js +75 -0
  18. package/mcp-server/lib/server/external/single/transport.js +57 -0
  19. package/mcp-server/lib/server/internal/handlers/common.js +20 -0
  20. package/mcp-server/lib/server/internal/handlers/error.js +7 -0
  21. package/mcp-server/lib/server/internal/handlers/prompts-get.js +22 -0
  22. package/mcp-server/lib/server/internal/handlers/prompts-list.js +12 -0
  23. package/mcp-server/lib/server/internal/handlers/resources-list.js +12 -0
  24. package/mcp-server/lib/server/internal/handlers/resources-read.js +19 -0
  25. package/mcp-server/lib/server/internal/handlers/tools-call.js +37 -0
  26. package/mcp-server/lib/server/internal/handlers/tools-list.js +14 -0
  27. package/mcp-server/lib/server/internal/run.js +49 -0
  28. package/mcp-server/lib/server/internal/server.js +63 -0
  29. package/mcp-server/lib/server/internal/session.js +39 -0
  30. package/mcp-server/mcp-shark.js +72 -0
  31. package/mcp-server/package-lock.json +4784 -0
  32. package/mcp-server/package.json +30 -0
  33. package/package.json +103 -0
  34. package/ui/README.md +212 -0
  35. package/ui/index.html +16 -0
  36. package/ui/package-lock.json +3574 -0
  37. package/ui/package.json +12 -0
  38. package/ui/paths.js +282 -0
  39. package/ui/public/og-image.png +0 -0
  40. package/ui/server/routes/backups.js +251 -0
  41. package/ui/server/routes/composite.js +244 -0
  42. package/ui/server/routes/config.js +175 -0
  43. package/ui/server/routes/conversations.js +25 -0
  44. package/ui/server/routes/help.js +43 -0
  45. package/ui/server/routes/logs.js +32 -0
  46. package/ui/server/routes/playground.js +152 -0
  47. package/ui/server/routes/requests.js +235 -0
  48. package/ui/server/routes/sessions.js +27 -0
  49. package/ui/server/routes/smartscan/discover.js +117 -0
  50. package/ui/server/routes/smartscan/scans/clearCache.js +22 -0
  51. package/ui/server/routes/smartscan/scans/createBatchScans.js +123 -0
  52. package/ui/server/routes/smartscan/scans/createScan.js +42 -0
  53. package/ui/server/routes/smartscan/scans/getCachedResults.js +51 -0
  54. package/ui/server/routes/smartscan/scans/getScan.js +41 -0
  55. package/ui/server/routes/smartscan/scans/listScans.js +24 -0
  56. package/ui/server/routes/smartscan/scans.js +13 -0
  57. package/ui/server/routes/smartscan/token.js +56 -0
  58. package/ui/server/routes/smartscan/transport.js +53 -0
  59. package/ui/server/routes/smartscan.js +24 -0
  60. package/ui/server/routes/statistics.js +83 -0
  61. package/ui/server/utils/config-update.js +212 -0
  62. package/ui/server/utils/config.js +98 -0
  63. package/ui/server/utils/paths.js +23 -0
  64. package/ui/server/utils/port.js +28 -0
  65. package/ui/server/utils/process.js +80 -0
  66. package/ui/server/utils/scan-cache/all-results.js +180 -0
  67. package/ui/server/utils/scan-cache/directory.js +35 -0
  68. package/ui/server/utils/scan-cache/file-operations.js +104 -0
  69. package/ui/server/utils/scan-cache/hash.js +47 -0
  70. package/ui/server/utils/scan-cache/server-operations.js +80 -0
  71. package/ui/server/utils/scan-cache.js +12 -0
  72. package/ui/server/utils/serialization.js +13 -0
  73. package/ui/server/utils/smartscan-token.js +42 -0
  74. package/ui/server.js +199 -0
  75. package/ui/src/App.jsx +153 -0
  76. package/ui/src/CompositeLogs.jsx +164 -0
  77. package/ui/src/CompositeSetup.jsx +285 -0
  78. package/ui/src/HelpGuide/HelpGuideContent.jsx +118 -0
  79. package/ui/src/HelpGuide/HelpGuideFooter.jsx +58 -0
  80. package/ui/src/HelpGuide/HelpGuideHeader.jsx +56 -0
  81. package/ui/src/HelpGuide.jsx +65 -0
  82. package/ui/src/IntroTour.jsx +140 -0
  83. package/ui/src/LogDetail.jsx +122 -0
  84. package/ui/src/LogTable.jsx +242 -0
  85. package/ui/src/PacketDetail.jsx +190 -0
  86. package/ui/src/PacketFilters.jsx +222 -0
  87. package/ui/src/PacketList.jsx +183 -0
  88. package/ui/src/SmartScan.jsx +178 -0
  89. package/ui/src/TabNavigation.jsx +143 -0
  90. package/ui/src/components/App/HelpButton.jsx +64 -0
  91. package/ui/src/components/App/TrafficTab.jsx +69 -0
  92. package/ui/src/components/App/useAppState.js +163 -0
  93. package/ui/src/components/BackupList.jsx +192 -0
  94. package/ui/src/components/CollapsibleSection.jsx +82 -0
  95. package/ui/src/components/ConfigFileSection.jsx +84 -0
  96. package/ui/src/components/ConfigViewerModal.jsx +141 -0
  97. package/ui/src/components/ConfirmationModal.jsx +129 -0
  98. package/ui/src/components/DetailsTab/BodySection.jsx +27 -0
  99. package/ui/src/components/DetailsTab/CollapsibleRequestResponse.jsx +70 -0
  100. package/ui/src/components/DetailsTab/HeadersSection.jsx +25 -0
  101. package/ui/src/components/DetailsTab/InfoSection.jsx +28 -0
  102. package/ui/src/components/DetailsTab/NetworkInfoSection.jsx +63 -0
  103. package/ui/src/components/DetailsTab/ProtocolInfoSection.jsx +75 -0
  104. package/ui/src/components/DetailsTab/RequestDetailsSection.jsx +46 -0
  105. package/ui/src/components/DetailsTab/ResponseDetailsSection.jsx +66 -0
  106. package/ui/src/components/DetailsTab.jsx +31 -0
  107. package/ui/src/components/DetectedPathsList.jsx +171 -0
  108. package/ui/src/components/FileInput.jsx +144 -0
  109. package/ui/src/components/GroupHeader.jsx +76 -0
  110. package/ui/src/components/GroupedByMcpView.jsx +103 -0
  111. package/ui/src/components/GroupedByServerView.jsx +134 -0
  112. package/ui/src/components/GroupedBySessionView.jsx +127 -0
  113. package/ui/src/components/GroupedViews.jsx +2 -0
  114. package/ui/src/components/HexTab.jsx +188 -0
  115. package/ui/src/components/LogsDisplay.jsx +93 -0
  116. package/ui/src/components/LogsToolbar.jsx +193 -0
  117. package/ui/src/components/McpPlayground/LoadingModal.jsx +113 -0
  118. package/ui/src/components/McpPlayground/PromptsSection/PromptCallPanel.jsx +125 -0
  119. package/ui/src/components/McpPlayground/PromptsSection/PromptItem.jsx +48 -0
  120. package/ui/src/components/McpPlayground/PromptsSection/PromptsList.jsx +45 -0
  121. package/ui/src/components/McpPlayground/PromptsSection.jsx +106 -0
  122. package/ui/src/components/McpPlayground/ResourcesSection/ResourceCallPanel.jsx +89 -0
  123. package/ui/src/components/McpPlayground/ResourcesSection/ResourceItem.jsx +59 -0
  124. package/ui/src/components/McpPlayground/ResourcesSection/ResourcesList.jsx +45 -0
  125. package/ui/src/components/McpPlayground/ResourcesSection.jsx +91 -0
  126. package/ui/src/components/McpPlayground/ToolsSection/ToolCallPanel.jsx +125 -0
  127. package/ui/src/components/McpPlayground/ToolsSection/ToolItem.jsx +48 -0
  128. package/ui/src/components/McpPlayground/ToolsSection/ToolsList.jsx +45 -0
  129. package/ui/src/components/McpPlayground/ToolsSection.jsx +107 -0
  130. package/ui/src/components/McpPlayground/common/EmptyState.jsx +17 -0
  131. package/ui/src/components/McpPlayground/common/ErrorState.jsx +17 -0
  132. package/ui/src/components/McpPlayground/common/LoadingState.jsx +17 -0
  133. package/ui/src/components/McpPlayground/useMcpPlayground.js +280 -0
  134. package/ui/src/components/McpPlayground.jsx +171 -0
  135. package/ui/src/components/MessageDisplay.jsx +28 -0
  136. package/ui/src/components/PacketDetailHeader.jsx +88 -0
  137. package/ui/src/components/PacketFilters/ExportControls.jsx +126 -0
  138. package/ui/src/components/PacketFilters/FilterInput.jsx +59 -0
  139. package/ui/src/components/RawTab.jsx +142 -0
  140. package/ui/src/components/RequestRow/OrphanedResponseRow.jsx +155 -0
  141. package/ui/src/components/RequestRow/RequestRowMain.jsx +240 -0
  142. package/ui/src/components/RequestRow/ResponseRow.jsx +158 -0
  143. package/ui/src/components/RequestRow.jsx +70 -0
  144. package/ui/src/components/ServerControl.jsx +133 -0
  145. package/ui/src/components/ServiceSelector.jsx +209 -0
  146. package/ui/src/components/SetupHeader.jsx +30 -0
  147. package/ui/src/components/SharkLogo.jsx +21 -0
  148. package/ui/src/components/SmartScan/AnalysisResult.jsx +64 -0
  149. package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultItem.jsx +215 -0
  150. package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultsHeader.jsx +94 -0
  151. package/ui/src/components/SmartScan/BatchResultsDisplay.jsx +26 -0
  152. package/ui/src/components/SmartScan/DebugInfoSection.jsx +53 -0
  153. package/ui/src/components/SmartScan/EmptyState.jsx +57 -0
  154. package/ui/src/components/SmartScan/ErrorDisplay.jsx +48 -0
  155. package/ui/src/components/SmartScan/ExpandableSection.jsx +93 -0
  156. package/ui/src/components/SmartScan/FindingsTable.jsx +257 -0
  157. package/ui/src/components/SmartScan/ListViewContent.jsx +75 -0
  158. package/ui/src/components/SmartScan/NotablePatternsSection.jsx +75 -0
  159. package/ui/src/components/SmartScan/OverallSummarySection.jsx +72 -0
  160. package/ui/src/components/SmartScan/RawDataSection.jsx +52 -0
  161. package/ui/src/components/SmartScan/RecommendationsSection.jsx +78 -0
  162. package/ui/src/components/SmartScan/ScanDetailHeader.jsx +92 -0
  163. package/ui/src/components/SmartScan/ScanDetailView.jsx +141 -0
  164. package/ui/src/components/SmartScan/ScanListView/ScanListHeader.jsx +49 -0
  165. package/ui/src/components/SmartScan/ScanListView/ScanListItem.jsx +201 -0
  166. package/ui/src/components/SmartScan/ScanListView.jsx +73 -0
  167. package/ui/src/components/SmartScan/ScanOverviewSection.jsx +123 -0
  168. package/ui/src/components/SmartScan/ScanResultsDisplay.jsx +35 -0
  169. package/ui/src/components/SmartScan/ScanViewContent.jsx +68 -0
  170. package/ui/src/components/SmartScan/ScanningProgress.jsx +47 -0
  171. package/ui/src/components/SmartScan/ServerInfoSection.jsx +43 -0
  172. package/ui/src/components/SmartScan/ServerSelectionRow.jsx +207 -0
  173. package/ui/src/components/SmartScan/SingleResultDisplay.jsx +269 -0
  174. package/ui/src/components/SmartScan/SmartScanControls.jsx +290 -0
  175. package/ui/src/components/SmartScan/SmartScanHeader.jsx +77 -0
  176. package/ui/src/components/SmartScan/ViewModeTabs.jsx +57 -0
  177. package/ui/src/components/SmartScan/hooks/useCacheManagement.js +34 -0
  178. package/ui/src/components/SmartScan/hooks/useMcpDiscovery.js +121 -0
  179. package/ui/src/components/SmartScan/hooks/useScanList.js +193 -0
  180. package/ui/src/components/SmartScan/hooks/useScanOperations.js +87 -0
  181. package/ui/src/components/SmartScan/hooks/useServerStatus.js +26 -0
  182. package/ui/src/components/SmartScan/hooks/useTokenManagement.js +53 -0
  183. package/ui/src/components/SmartScan/scanDataUtils.js +98 -0
  184. package/ui/src/components/SmartScan/useSmartScan.js +72 -0
  185. package/ui/src/components/SmartScan/utils.js +19 -0
  186. package/ui/src/components/SmartScanIcons.jsx +58 -0
  187. package/ui/src/components/TabNavigation/DesktopTabs.jsx +111 -0
  188. package/ui/src/components/TabNavigation/MobileDropdown.jsx +140 -0
  189. package/ui/src/components/TabNavigation.jsx +97 -0
  190. package/ui/src/components/TabNavigationIcons.jsx +40 -0
  191. package/ui/src/components/TableHeader.jsx +164 -0
  192. package/ui/src/components/TourOverlay.jsx +117 -0
  193. package/ui/src/components/TourTooltip/TourTooltipButtons.jsx +117 -0
  194. package/ui/src/components/TourTooltip/TourTooltipHeader.jsx +70 -0
  195. package/ui/src/components/TourTooltip/TourTooltipIcons.jsx +45 -0
  196. package/ui/src/components/TourTooltip/useTooltipPosition.js +108 -0
  197. package/ui/src/components/TourTooltip.jsx +83 -0
  198. package/ui/src/components/ViewModeTabs.jsx +91 -0
  199. package/ui/src/components/WhatThisDoesSection.jsx +61 -0
  200. package/ui/src/config/tourSteps.jsx +141 -0
  201. package/ui/src/hooks/useAnimation.js +92 -0
  202. package/ui/src/hooks/useConfigManagement.js +124 -0
  203. package/ui/src/hooks/useServiceExtraction.js +51 -0
  204. package/ui/src/index.css +42 -0
  205. package/ui/src/main.jsx +10 -0
  206. package/ui/src/theme.js +65 -0
  207. package/ui/src/utils/animations.js +170 -0
  208. package/ui/src/utils/groupingUtils.js +93 -0
  209. package/ui/src/utils/hexUtils.js +24 -0
  210. package/ui/src/utils/mcpGroupingUtils.js +262 -0
  211. package/ui/src/utils/requestUtils.js +297 -0
  212. package/ui/vite.config.js +18 -0
@@ -0,0 +1,59 @@
1
+ import { colors, fonts } from '../../theme';
2
+ import anime from 'animejs';
3
+
4
+ export default function FilterInput({
5
+ type = 'text',
6
+ placeholder,
7
+ value,
8
+ onChange,
9
+ style = {},
10
+ ...props
11
+ }) {
12
+ const defaultStyle = {
13
+ padding: '8px 12px',
14
+ background: colors.bgCard,
15
+ border: `1px solid ${colors.borderLight}`,
16
+ color: colors.textPrimary,
17
+ fontSize: '13px',
18
+ fontFamily:
19
+ type === 'number' || placeholder?.includes('JSON-RPC') || placeholder?.includes('HTTP')
20
+ ? fonts.mono
21
+ : fonts.body,
22
+ borderRadius: '8px',
23
+ transition: 'all 0.2s',
24
+ ...style,
25
+ };
26
+
27
+ const handleFocus = (e) => {
28
+ anime({
29
+ targets: e.currentTarget,
30
+ borderColor: colors.accentBlue,
31
+ boxShadow: [`0 0 0 0px ${colors.accentBlue}20`, `0 0 0 3px ${colors.accentBlue}20`],
32
+ duration: 200,
33
+ easing: 'easeOutQuad',
34
+ });
35
+ };
36
+
37
+ const handleBlur = (e) => {
38
+ anime({
39
+ targets: e.currentTarget,
40
+ borderColor: colors.borderLight,
41
+ boxShadow: 'none',
42
+ duration: 200,
43
+ easing: 'easeOutQuad',
44
+ });
45
+ };
46
+
47
+ return (
48
+ <input
49
+ type={type}
50
+ placeholder={placeholder}
51
+ value={value || ''}
52
+ onChange={onChange}
53
+ style={defaultStyle}
54
+ onFocus={handleFocus}
55
+ onBlur={handleBlur}
56
+ {...props}
57
+ />
58
+ );
59
+ }
@@ -0,0 +1,142 @@
1
+ import { useState } from 'react';
2
+ import { colors, fonts } from '../theme';
3
+
4
+ const ChevronDown = ({ size = 14, color = 'currentColor', rotated = false }) => (
5
+ <svg
6
+ width={size}
7
+ height={size}
8
+ viewBox="0 0 24 24"
9
+ fill="none"
10
+ stroke={color}
11
+ strokeWidth="2.5"
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ style={{
15
+ display: 'inline-block',
16
+ verticalAlign: 'middle',
17
+ transform: rotated ? 'rotate(-90deg)' : 'rotate(0deg)',
18
+ transition: 'transform 0.2s ease',
19
+ }}
20
+ >
21
+ <polyline points="6 9 12 15 18 9" />
22
+ </svg>
23
+ );
24
+
25
+ function CollapsibleRequestResponse({ title, titleColor, children, defaultExpanded = true }) {
26
+ const [isExpanded, setIsExpanded] = useState(defaultExpanded);
27
+
28
+ return (
29
+ <div
30
+ style={{
31
+ background: colors.bgCard,
32
+ borderRadius: '8px',
33
+ border: `1px solid ${colors.borderLight}`,
34
+ overflow: 'hidden',
35
+ marginBottom: '20px',
36
+ }}
37
+ >
38
+ <div
39
+ onClick={() => setIsExpanded(!isExpanded)}
40
+ style={{
41
+ padding: '16px 20px',
42
+ background: isExpanded ? colors.bgCard : colors.bgSecondary,
43
+ borderBottom: isExpanded ? `1px solid ${colors.borderLight}` : 'none',
44
+ cursor: 'pointer',
45
+ userSelect: 'none',
46
+ display: 'flex',
47
+ alignItems: 'center',
48
+ justifyContent: 'space-between',
49
+ transition: 'background-color 0.15s ease',
50
+ }}
51
+ onMouseEnter={(e) => {
52
+ e.currentTarget.style.background = colors.bgHover;
53
+ }}
54
+ onMouseLeave={(e) => {
55
+ e.currentTarget.style.background = isExpanded ? colors.bgCard : colors.bgSecondary;
56
+ }}
57
+ >
58
+ <div
59
+ style={{
60
+ fontSize: '13px',
61
+ fontWeight: '600',
62
+ color: titleColor,
63
+ textTransform: 'uppercase',
64
+ letterSpacing: '0.05em',
65
+ fontFamily: fonts.body,
66
+ display: 'flex',
67
+ alignItems: 'center',
68
+ gap: '8px',
69
+ }}
70
+ >
71
+ <ChevronDown size={14} color={titleColor} rotated={!isExpanded} />
72
+ {title}
73
+ </div>
74
+ </div>
75
+ {isExpanded && <div style={{ padding: '20px' }}>{children}</div>}
76
+ </div>
77
+ );
78
+ }
79
+
80
+ function RawTab({ requestFullText, responseFullText, hasRequest, hasResponse }) {
81
+ return (
82
+ <div style={{ padding: '20px', overflow: 'auto', flex: 1, background: colors.bgPrimary }}>
83
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '0' }}>
84
+ {hasRequest && (
85
+ <CollapsibleRequestResponse
86
+ title="Raw Request Data"
87
+ titleColor={colors.accentBlue}
88
+ defaultExpanded={true}
89
+ >
90
+ <pre
91
+ style={{
92
+ background: colors.bgSecondary,
93
+ padding: '16px',
94
+ borderRadius: '8px',
95
+ overflow: 'auto',
96
+ fontSize: '12px',
97
+ fontFamily: fonts.mono,
98
+ color: colors.textPrimary,
99
+ border: `1px solid ${colors.borderLight}`,
100
+ whiteSpace: 'pre-wrap',
101
+ wordBreak: 'break-all',
102
+ lineHeight: '1.5',
103
+ maxHeight: 'calc(100vh - 300px)',
104
+ }}
105
+ >
106
+ {requestFullText || '(empty)'}
107
+ </pre>
108
+ </CollapsibleRequestResponse>
109
+ )}
110
+
111
+ {hasResponse && (
112
+ <CollapsibleRequestResponse
113
+ title="Raw Response Data"
114
+ titleColor={colors.accentGreen}
115
+ defaultExpanded={true}
116
+ >
117
+ <pre
118
+ style={{
119
+ background: colors.bgSecondary,
120
+ padding: '16px',
121
+ borderRadius: '8px',
122
+ overflow: 'auto',
123
+ fontSize: '12px',
124
+ fontFamily: fonts.mono,
125
+ color: colors.textPrimary,
126
+ border: `1px solid ${colors.borderLight}`,
127
+ whiteSpace: 'pre-wrap',
128
+ wordBreak: 'break-all',
129
+ lineHeight: '1.5',
130
+ maxHeight: 'calc(100vh - 300px)',
131
+ }}
132
+ >
133
+ {responseFullText || '(empty)'}
134
+ </pre>
135
+ </CollapsibleRequestResponse>
136
+ )}
137
+ </div>
138
+ </div>
139
+ );
140
+ }
141
+
142
+ export default RawTab;
@@ -0,0 +1,155 @@
1
+ import { colors, fonts, withOpacity } from '../../theme';
2
+ import {
3
+ formatRelativeTime,
4
+ formatDateTime,
5
+ getSourceDest,
6
+ getEndpoint,
7
+ } from '../../utils/requestUtils.js';
8
+
9
+ export default function OrphanedResponseRow({ response, selected, firstRequestTime, onSelect }) {
10
+ const isSelected = selected?.frame_number === response.frame_number;
11
+ const { source, dest } = getSourceDest(response);
12
+ const relativeTime = formatRelativeTime(response.timestamp_iso, firstRequestTime);
13
+
14
+ return (
15
+ <tr
16
+ onClick={() => onSelect(response)}
17
+ style={{
18
+ cursor: 'pointer',
19
+ background: isSelected ? colors.bgSelected : colors.bgUnpaired,
20
+ borderBottom: `1px solid ${colors.borderLight}`,
21
+ fontFamily: fonts.body,
22
+ transition: 'background-color 0.15s ease',
23
+ opacity: 0.85,
24
+ }}
25
+ onMouseEnter={(e) => {
26
+ if (!isSelected) {
27
+ e.currentTarget.style.background = withOpacity(colors.accentOrange, 0.1);
28
+ }
29
+ }}
30
+ onMouseLeave={(e) => {
31
+ if (!isSelected) {
32
+ e.currentTarget.style.background = colors.bgUnpaired;
33
+ }
34
+ }}
35
+ >
36
+ <td
37
+ style={{
38
+ padding: '16px',
39
+ borderRight: `1px solid ${colors.borderLight}`,
40
+ color: colors.textPrimary,
41
+ textAlign: 'right',
42
+ fontFamily: fonts.mono,
43
+ fontSize: '12px',
44
+ }}
45
+ >
46
+ <span style={{ color: colors.accentOrange, fontWeight: '500' }}>
47
+ #{response.frame_number} (orphaned)
48
+ </span>
49
+ </td>
50
+ <td
51
+ style={{
52
+ padding: '16px',
53
+ borderRight: `1px solid ${colors.borderLight}`,
54
+ color: colors.textPrimary,
55
+ fontFamily: fonts.mono,
56
+ fontSize: '12px',
57
+ }}
58
+ >
59
+ {relativeTime}
60
+ </td>
61
+ <td
62
+ style={{
63
+ padding: '16px',
64
+ borderRight: `1px solid ${colors.borderLight}`,
65
+ color: colors.textPrimary,
66
+ fontFamily: fonts.body,
67
+ fontSize: '12px',
68
+ }}
69
+ >
70
+ {formatDateTime(response.timestamp_iso)}
71
+ </td>
72
+ <td
73
+ style={{
74
+ padding: '16px',
75
+ borderRight: `1px solid ${colors.borderLight}`,
76
+ color: colors.accentOrange,
77
+ fontFamily: fonts.mono,
78
+ fontSize: '12px',
79
+ fontWeight: '500',
80
+ }}
81
+ >
82
+ {source}
83
+ </td>
84
+ <td
85
+ style={{
86
+ padding: '16px',
87
+ borderRight: `1px solid ${colors.borderLight}`,
88
+ color: colors.accentOrange,
89
+ fontFamily: fonts.mono,
90
+ fontSize: '12px',
91
+ fontWeight: '500',
92
+ }}
93
+ >
94
+ {dest}
95
+ </td>
96
+ <td
97
+ style={{
98
+ padding: '16px',
99
+ borderRight: `1px solid ${colors.borderLight}`,
100
+ color: colors.textPrimary,
101
+ fontFamily: fonts.mono,
102
+ fontSize: '12px',
103
+ fontWeight: '500',
104
+ }}
105
+ >
106
+ {response.protocol || 'HTTP'}
107
+ </td>
108
+ <td
109
+ style={{
110
+ padding: '16px',
111
+ borderRight: `1px solid ${colors.borderLight}`,
112
+ color: colors.textSecondary,
113
+ fontFamily: fonts.mono,
114
+ fontSize: '12px',
115
+ fontWeight: '500',
116
+ }}
117
+ >
118
+ -
119
+ </td>
120
+ <td
121
+ style={{
122
+ padding: '16px',
123
+ borderRight: `1px solid ${colors.borderLight}`,
124
+ fontFamily: fonts.mono,
125
+ fontSize: '12px',
126
+ fontWeight: '500',
127
+ }}
128
+ >
129
+ <div
130
+ style={{
131
+ color:
132
+ response.status_code >= 400
133
+ ? colors.error
134
+ : response.status_code >= 300
135
+ ? colors.warning
136
+ : colors.success,
137
+ fontWeight: '600',
138
+ }}
139
+ >
140
+ {response.status_code || '-'}
141
+ </div>
142
+ </td>
143
+ <td
144
+ style={{
145
+ padding: '16px',
146
+ color: colors.textPrimary,
147
+ fontFamily: fonts.mono,
148
+ fontSize: '12px',
149
+ }}
150
+ >
151
+ {getEndpoint(response)}
152
+ </td>
153
+ </tr>
154
+ );
155
+ }
@@ -0,0 +1,240 @@
1
+ import { colors, fonts, withOpacity } from '../../theme';
2
+ import {
3
+ formatRelativeTime,
4
+ formatDateTime,
5
+ getSourceDest,
6
+ getEndpoint,
7
+ } from '../../utils/requestUtils.js';
8
+ import { IconChevronDown } from '@tabler/icons-react';
9
+
10
+ const ChevronDown = ({ size = 12, rotated = false }) => (
11
+ <IconChevronDown
12
+ size={size}
13
+ stroke={1.5}
14
+ style={{
15
+ display: 'inline-block',
16
+ verticalAlign: 'middle',
17
+ transform: rotated ? 'rotate(-90deg)' : 'rotate(0deg)',
18
+ transition: 'transform 0.2s ease',
19
+ }}
20
+ />
21
+ );
22
+
23
+ export default function RequestRowMain({
24
+ request,
25
+ response,
26
+ selected,
27
+ firstRequestTime,
28
+ onSelect,
29
+ isExpanded,
30
+ onToggleExpand,
31
+ isUnpaired,
32
+ }) {
33
+ const isSelected = selected?.frame_number === request.frame_number;
34
+ const { source, dest } = getSourceDest(request);
35
+ const relativeTime = formatRelativeTime(request.timestamp_iso, firstRequestTime);
36
+ const hasResponse = !!response;
37
+
38
+ return (
39
+ <>
40
+ <tr
41
+ onClick={() => onSelect(request)}
42
+ style={{
43
+ cursor: 'pointer',
44
+ background: isSelected
45
+ ? colors.bgSelected
46
+ : isUnpaired
47
+ ? colors.bgUnpaired
48
+ : colors.bgSecondary,
49
+ borderBottom: `1px solid ${colors.borderLight}`,
50
+ fontFamily: fonts.body,
51
+ transition: 'background-color 0.15s ease',
52
+ opacity: isUnpaired ? 0.85 : 1,
53
+ }}
54
+ onMouseEnter={(e) => {
55
+ if (!isSelected) {
56
+ e.currentTarget.style.background = isUnpaired
57
+ ? withOpacity(colors.accentOrange, 0.1)
58
+ : colors.bgCard;
59
+ }
60
+ }}
61
+ onMouseLeave={(e) => {
62
+ if (!isSelected) {
63
+ e.currentTarget.style.background = isUnpaired ? colors.bgUnpaired : colors.bgSecondary;
64
+ }
65
+ }}
66
+ >
67
+ <td
68
+ style={{
69
+ padding: '16px',
70
+ borderRight: `1px solid ${colors.borderLight}`,
71
+ color: colors.textPrimary,
72
+ textAlign: 'right',
73
+ fontFamily: fonts.mono,
74
+ fontSize: '12px',
75
+ }}
76
+ >
77
+ <div
78
+ style={{
79
+ display: 'flex',
80
+ alignItems: 'center',
81
+ gap: '8px',
82
+ justifyContent: 'flex-end',
83
+ }}
84
+ >
85
+ {hasResponse && (
86
+ <button
87
+ onClick={(e) => {
88
+ e.stopPropagation();
89
+ onToggleExpand();
90
+ }}
91
+ style={{
92
+ background: 'none',
93
+ border: 'none',
94
+ cursor: 'pointer',
95
+ padding: '2px',
96
+ display: 'flex',
97
+ alignItems: 'center',
98
+ color: colors.textSecondary,
99
+ }}
100
+ onMouseEnter={(e) => {
101
+ e.currentTarget.style.color = colors.textPrimary;
102
+ }}
103
+ onMouseLeave={(e) => {
104
+ e.currentTarget.style.color = colors.textSecondary;
105
+ }}
106
+ >
107
+ <ChevronDown size={14} rotated={!isExpanded} />
108
+ </button>
109
+ )}
110
+ <span
111
+ style={{
112
+ color: isUnpaired ? colors.accentOrange : colors.accentBlue,
113
+ fontWeight: '500',
114
+ }}
115
+ >
116
+ #{request.frame_number}
117
+ {isUnpaired && (
118
+ <span
119
+ style={{
120
+ fontSize: '10px',
121
+ color: colors.textSecondary,
122
+ marginLeft: '4px',
123
+ fontStyle: 'italic',
124
+ }}
125
+ >
126
+ (no response)
127
+ </span>
128
+ )}
129
+ </span>
130
+ </div>
131
+ </td>
132
+ <td
133
+ style={{
134
+ padding: '16px',
135
+ borderRight: `1px solid ${colors.borderLight}`,
136
+ color: colors.textPrimary,
137
+ fontFamily: fonts.mono,
138
+ fontSize: '12px',
139
+ }}
140
+ >
141
+ {relativeTime}
142
+ </td>
143
+ <td
144
+ style={{
145
+ padding: '16px',
146
+ borderRight: `1px solid ${colors.borderLight}`,
147
+ color: colors.textPrimary,
148
+ fontFamily: fonts.body,
149
+ fontSize: '12px',
150
+ }}
151
+ >
152
+ {formatDateTime(request.timestamp_iso)}
153
+ </td>
154
+ <td
155
+ style={{
156
+ padding: '16px',
157
+ borderRight: `1px solid ${colors.borderLight}`,
158
+ color: colors.accentBlue,
159
+ fontFamily: fonts.mono,
160
+ fontSize: '12px',
161
+ fontWeight: '500',
162
+ }}
163
+ >
164
+ {source}
165
+ </td>
166
+ <td
167
+ style={{
168
+ padding: '16px',
169
+ borderRight: `1px solid ${colors.borderLight}`,
170
+ color: colors.accentBlue,
171
+ fontFamily: fonts.mono,
172
+ fontSize: '12px',
173
+ fontWeight: '500',
174
+ }}
175
+ >
176
+ {dest}
177
+ </td>
178
+ <td
179
+ style={{
180
+ padding: '16px',
181
+ borderRight: `1px solid ${colors.borderLight}`,
182
+ color: colors.textPrimary,
183
+ fontFamily: fonts.mono,
184
+ fontSize: '12px',
185
+ fontWeight: '500',
186
+ }}
187
+ >
188
+ {request.protocol || 'HTTP'}
189
+ </td>
190
+ <td
191
+ style={{
192
+ padding: '16px',
193
+ borderRight: `1px solid ${colors.borderLight}`,
194
+ color: colors.textPrimary,
195
+ fontFamily: fonts.mono,
196
+ fontSize: '12px',
197
+ fontWeight: '500',
198
+ }}
199
+ >
200
+ <div style={{ color: colors.accentBlue }}>{request.method || 'REQ'}</div>
201
+ </td>
202
+ <td
203
+ style={{
204
+ padding: '16px',
205
+ borderRight: `1px solid ${colors.borderLight}`,
206
+ fontFamily: fonts.mono,
207
+ fontSize: '12px',
208
+ fontWeight: '500',
209
+ }}
210
+ >
211
+ {hasResponse && (
212
+ <div
213
+ style={{
214
+ color:
215
+ response.status_code >= 400
216
+ ? colors.error
217
+ : response.status_code >= 300
218
+ ? colors.warning
219
+ : colors.success,
220
+ fontWeight: '600',
221
+ }}
222
+ >
223
+ {response.status_code || '-'}
224
+ </div>
225
+ )}
226
+ </td>
227
+ <td
228
+ style={{
229
+ padding: '16px',
230
+ color: colors.textPrimary,
231
+ fontFamily: fonts.mono,
232
+ fontSize: '12px',
233
+ }}
234
+ >
235
+ {getEndpoint(request)}
236
+ </td>
237
+ </tr>
238
+ </>
239
+ );
240
+ }