@grackle-ai/web-components 0.107.2

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 (279) hide show
  1. package/.rush/temp/3ae72563f781afd72723475938136f113846603e.untar.log +10 -0
  2. package/.rush/temp/bc1d5bf9201ce71abeaeaddd096deb9b0805d703.untar.log +10 -0
  3. package/.rush/temp/operation/_phase_build/all.log +18 -0
  4. package/.rush/temp/operation/_phase_build/log-chunks.jsonl +18 -0
  5. package/.rush/temp/operation/_phase_build/state.json +3 -0
  6. package/.rush/temp/operation/_phase_test/all.log +121 -0
  7. package/.rush/temp/operation/_phase_test/log-chunks.jsonl +121 -0
  8. package/.rush/temp/operation/_phase_test/state.json +3 -0
  9. package/.rush/temp/shrinkwrap-deps.json +938 -0
  10. package/.storybook/main.ts +22 -0
  11. package/.storybook/preview.tsx +30 -0
  12. package/config/rig.json +4 -0
  13. package/config/rush-project.json +12 -0
  14. package/dist/index.css +1 -0
  15. package/dist/index.js +39221 -0
  16. package/eslint.config.cjs +5 -0
  17. package/package.json +83 -0
  18. package/rush-logs/web-components._phase_build.cache.log +4 -0
  19. package/rush-logs/web-components._phase_test.cache.log +4 -0
  20. package/src/components/chat/ChatInput.module.scss +81 -0
  21. package/src/components/chat/ChatInput.stories.tsx +91 -0
  22. package/src/components/chat/ChatInput.tsx +168 -0
  23. package/src/components/chat/index.ts +6 -0
  24. package/src/components/dag/DagView.module.scss +149 -0
  25. package/src/components/dag/DagView.stories.tsx +125 -0
  26. package/src/components/dag/DagView.tsx +109 -0
  27. package/src/components/dag/TaskNode.stories.tsx +133 -0
  28. package/src/components/dag/TaskNode.tsx +40 -0
  29. package/src/components/dag/useDagLayout.ts +139 -0
  30. package/src/components/display/Breadcrumbs.module.scss +71 -0
  31. package/src/components/display/Breadcrumbs.stories.tsx +80 -0
  32. package/src/components/display/Breadcrumbs.tsx +46 -0
  33. package/src/components/display/Button.module.scss +110 -0
  34. package/src/components/display/Button.stories.tsx +88 -0
  35. package/src/components/display/Button.tsx +40 -0
  36. package/src/components/display/ConfirmDialog.module.scss +67 -0
  37. package/src/components/display/ConfirmDialog.stories.tsx +81 -0
  38. package/src/components/display/ConfirmDialog.tsx +88 -0
  39. package/src/components/display/CopyButton.module.scss +41 -0
  40. package/src/components/display/CopyButton.stories.tsx +78 -0
  41. package/src/components/display/CopyButton.tsx +64 -0
  42. package/src/components/display/DemoBanner.module.scss +37 -0
  43. package/src/components/display/DemoBanner.stories.tsx +40 -0
  44. package/src/components/display/DemoBanner.tsx +23 -0
  45. package/src/components/display/EventHoverRow.module.scss +102 -0
  46. package/src/components/display/EventHoverRow.stories.tsx +99 -0
  47. package/src/components/display/EventHoverRow.tsx +154 -0
  48. package/src/components/display/EventRenderer.module.scss +272 -0
  49. package/src/components/display/EventRenderer.stories.tsx +186 -0
  50. package/src/components/display/EventRenderer.tsx +271 -0
  51. package/src/components/display/EventStream.module.scss +93 -0
  52. package/src/components/display/EventStream.stories.tsx +249 -0
  53. package/src/components/display/EventStream.tsx +369 -0
  54. package/src/components/display/FloatingActionBar.module.scss +107 -0
  55. package/src/components/display/FloatingActionBar.stories.tsx +122 -0
  56. package/src/components/display/FloatingActionBar.tsx +119 -0
  57. package/src/components/display/SessionAttemptSelector.module.scss +50 -0
  58. package/src/components/display/SessionAttemptSelector.stories.tsx +78 -0
  59. package/src/components/display/SessionAttemptSelector.tsx +49 -0
  60. package/src/components/display/SessionPicker.module.scss +200 -0
  61. package/src/components/display/SessionPicker.stories.tsx +169 -0
  62. package/src/components/display/SessionPicker.tsx +214 -0
  63. package/src/components/display/Skeleton.module.scss +58 -0
  64. package/src/components/display/Skeleton.stories.tsx +94 -0
  65. package/src/components/display/Skeleton.tsx +127 -0
  66. package/src/components/display/Spinner.module.scss +41 -0
  67. package/src/components/display/Spinner.stories.tsx +66 -0
  68. package/src/components/display/Spinner.tsx +32 -0
  69. package/src/components/display/SplashScreen.module.scss +20 -0
  70. package/src/components/display/SplashScreen.stories.tsx +26 -0
  71. package/src/components/display/SplashScreen.tsx +16 -0
  72. package/src/components/display/SplitButton.module.scss +166 -0
  73. package/src/components/display/SplitButton.stories.tsx +95 -0
  74. package/src/components/display/SplitButton.tsx +128 -0
  75. package/src/components/display/Tooltip.module.scss +84 -0
  76. package/src/components/display/Tooltip.stories.tsx +240 -0
  77. package/src/components/display/Tooltip.tsx +184 -0
  78. package/src/components/display/extractText.test.tsx +48 -0
  79. package/src/components/display/index.ts +20 -0
  80. package/src/components/editable/EditableCheckbox.stories.tsx +54 -0
  81. package/src/components/editable/EditableCheckbox.tsx +39 -0
  82. package/src/components/editable/EditableField.module.scss +135 -0
  83. package/src/components/editable/EditableSelect.tsx +164 -0
  84. package/src/components/editable/EditableTextArea.stories.tsx +50 -0
  85. package/src/components/editable/EditableTextArea.tsx +148 -0
  86. package/src/components/editable/EditableTextField.stories.tsx +62 -0
  87. package/src/components/editable/EditableTextField.tsx +153 -0
  88. package/src/components/editable/EnvironmentSelect.module.scss +17 -0
  89. package/src/components/editable/EnvironmentSelect.stories.tsx +61 -0
  90. package/src/components/editable/EnvironmentSelect.tsx +87 -0
  91. package/src/components/editable/index.ts +13 -0
  92. package/src/components/editable/useEditableField.test.tsx +233 -0
  93. package/src/components/editable/useEditableField.ts +173 -0
  94. package/src/components/index.ts +20 -0
  95. package/src/components/knowledge/KnowledgeDetailPanel.module.scss +162 -0
  96. package/src/components/knowledge/KnowledgeDetailPanel.stories.tsx +208 -0
  97. package/src/components/knowledge/KnowledgeDetailPanel.tsx +122 -0
  98. package/src/components/knowledge/KnowledgeGraph.module.scss +110 -0
  99. package/src/components/knowledge/KnowledgeGraph.stories.tsx +180 -0
  100. package/src/components/knowledge/KnowledgeGraph.tsx +455 -0
  101. package/src/components/knowledge/KnowledgeNav.module.scss +130 -0
  102. package/src/components/knowledge/KnowledgeNav.stories.tsx +108 -0
  103. package/src/components/knowledge/KnowledgeNav.tsx +138 -0
  104. package/src/components/knowledge/index.ts +3 -0
  105. package/src/components/layout/AppNav.module.scss +82 -0
  106. package/src/components/layout/AppNav.stories.tsx +115 -0
  107. package/src/components/layout/AppNav.tsx +133 -0
  108. package/src/components/layout/BottomStatusBar.module.scss +58 -0
  109. package/src/components/layout/BottomStatusBar.stories.tsx +35 -0
  110. package/src/components/layout/BottomStatusBar.tsx +206 -0
  111. package/src/components/layout/Sidebar.module.scss +60 -0
  112. package/src/components/layout/Sidebar.stories.tsx +46 -0
  113. package/src/components/layout/Sidebar.tsx +84 -0
  114. package/src/components/layout/StatusBar.module.scss +108 -0
  115. package/src/components/layout/StatusBar.stories.tsx +119 -0
  116. package/src/components/layout/StatusBar.tsx +70 -0
  117. package/src/components/layout/index.ts +9 -0
  118. package/src/components/lists/EnvironmentNav.module.scss +118 -0
  119. package/src/components/lists/EnvironmentNav.stories.tsx +121 -0
  120. package/src/components/lists/EnvironmentNav.tsx +133 -0
  121. package/src/components/lists/FindingsNav.module.scss +126 -0
  122. package/src/components/lists/FindingsNav.tsx +146 -0
  123. package/src/components/lists/TaskList.module.scss +206 -0
  124. package/src/components/lists/TaskList.stories.tsx +401 -0
  125. package/src/components/lists/TaskList.tsx +509 -0
  126. package/src/components/lists/index.ts +6 -0
  127. package/src/components/lists/listHelpers.tsx +130 -0
  128. package/src/components/notifications/Callout.module.scss +83 -0
  129. package/src/components/notifications/Callout.stories.tsx +81 -0
  130. package/src/components/notifications/Callout.tsx +64 -0
  131. package/src/components/notifications/Toast.module.scss +86 -0
  132. package/src/components/notifications/Toast.stories.tsx +71 -0
  133. package/src/components/notifications/Toast.tsx +51 -0
  134. package/src/components/notifications/ToastContainer.module.scss +23 -0
  135. package/src/components/notifications/ToastContainer.stories.tsx +66 -0
  136. package/src/components/notifications/ToastContainer.tsx +29 -0
  137. package/src/components/notifications/UpdateBanner.stories.tsx +77 -0
  138. package/src/components/notifications/UpdateBanner.test.tsx +64 -0
  139. package/src/components/notifications/UpdateBanner.tsx +44 -0
  140. package/src/components/notifications/index.ts +8 -0
  141. package/src/components/panels/AboutPanel.stories.tsx +70 -0
  142. package/src/components/panels/AboutPanel.tsx +66 -0
  143. package/src/components/panels/AppearancePanel.stories.tsx +45 -0
  144. package/src/components/panels/AppearancePanel.tsx +97 -0
  145. package/src/components/panels/CredentialProvidersPanel.stories.tsx +62 -0
  146. package/src/components/panels/CredentialProvidersPanel.tsx +111 -0
  147. package/src/components/panels/EnvironmentEditPanel.module.scss +170 -0
  148. package/src/components/panels/EnvironmentEditPanel.stories.tsx +206 -0
  149. package/src/components/panels/EnvironmentEditPanel.tsx +785 -0
  150. package/src/components/panels/FindingsPanel.module.scss +94 -0
  151. package/src/components/panels/FindingsPanel.stories.tsx +109 -0
  152. package/src/components/panels/FindingsPanel.tsx +76 -0
  153. package/src/components/panels/KeyboardShortcutsPanel.module.scss +65 -0
  154. package/src/components/panels/KeyboardShortcutsPanel.stories.tsx +40 -0
  155. package/src/components/panels/KeyboardShortcutsPanel.tsx +104 -0
  156. package/src/components/panels/PluginsPanel.tsx +77 -0
  157. package/src/components/panels/SettingsPanel.module.scss +336 -0
  158. package/src/components/panels/TaskActionButtons.module.scss +22 -0
  159. package/src/components/panels/TaskActionButtons.stories.tsx +125 -0
  160. package/src/components/panels/TaskActionButtons.tsx +87 -0
  161. package/src/components/panels/TaskEditPanel.module.scss +202 -0
  162. package/src/components/panels/TaskEditPanel.stories.tsx +75 -0
  163. package/src/components/panels/TaskEditPanel.tsx +328 -0
  164. package/src/components/panels/TaskOverviewPanel.module.scss +236 -0
  165. package/src/components/panels/TaskOverviewPanel.stories.tsx +219 -0
  166. package/src/components/panels/TaskOverviewPanel.tsx +270 -0
  167. package/src/components/panels/TokensPanel.stories.tsx +131 -0
  168. package/src/components/panels/TokensPanel.tsx +143 -0
  169. package/src/components/panels/WorkpadPanel.module.scss +39 -0
  170. package/src/components/panels/WorkpadPanel.stories.tsx +56 -0
  171. package/src/components/panels/WorkpadPanel.tsx +63 -0
  172. package/src/components/panels/index.ts +13 -0
  173. package/src/components/personas/McpToolSelector.module.scss +109 -0
  174. package/src/components/personas/McpToolSelector.stories.tsx +129 -0
  175. package/src/components/personas/McpToolSelector.tsx +180 -0
  176. package/src/components/personas/PersonaManager.module.scss +233 -0
  177. package/src/components/personas/PersonaManager.stories.tsx +139 -0
  178. package/src/components/personas/PersonaManager.tsx +122 -0
  179. package/src/components/schedules/ScheduleManager.module.scss +98 -0
  180. package/src/components/schedules/ScheduleManager.stories.tsx +78 -0
  181. package/src/components/schedules/ScheduleManager.tsx +160 -0
  182. package/src/components/settings/SettingsNav.module.scss +82 -0
  183. package/src/components/settings/SettingsNav.stories.tsx +83 -0
  184. package/src/components/settings/SettingsNav.tsx +104 -0
  185. package/src/components/streams/StreamDetailPanel.module.scss +206 -0
  186. package/src/components/streams/StreamDetailPanel.stories.tsx +132 -0
  187. package/src/components/streams/StreamDetailPanel.tsx +119 -0
  188. package/src/components/streams/StreamList.module.scss +92 -0
  189. package/src/components/streams/StreamList.stories.tsx +99 -0
  190. package/src/components/streams/StreamList.tsx +114 -0
  191. package/src/components/streams/index.ts +10 -0
  192. package/src/components/tools/AgentToolCard.module.scss +118 -0
  193. package/src/components/tools/AgentToolCard.stories.tsx +304 -0
  194. package/src/components/tools/AgentToolCard.tsx +247 -0
  195. package/src/components/tools/FileEditCard.stories.tsx +138 -0
  196. package/src/components/tools/FileEditCard.tsx +160 -0
  197. package/src/components/tools/FileReadCard.stories.tsx +120 -0
  198. package/src/components/tools/FileReadCard.tsx +106 -0
  199. package/src/components/tools/FindingCard.stories.tsx +124 -0
  200. package/src/components/tools/FindingCard.tsx +178 -0
  201. package/src/components/tools/GenericToolCard.stories.tsx +80 -0
  202. package/src/components/tools/GenericToolCard.tsx +111 -0
  203. package/src/components/tools/IpcCard.stories.tsx +129 -0
  204. package/src/components/tools/IpcCard.tsx +178 -0
  205. package/src/components/tools/KnowledgeCard.stories.tsx +112 -0
  206. package/src/components/tools/KnowledgeCard.tsx +165 -0
  207. package/src/components/tools/MetadataCard.stories.tsx +32 -0
  208. package/src/components/tools/MetadataCard.tsx +39 -0
  209. package/src/components/tools/SearchCard.stories.tsx +74 -0
  210. package/src/components/tools/SearchCard.tsx +86 -0
  211. package/src/components/tools/ShellCard.stories.tsx +112 -0
  212. package/src/components/tools/ShellCard.tsx +106 -0
  213. package/src/components/tools/TaskCard.stories.tsx +123 -0
  214. package/src/components/tools/TaskCard.tsx +203 -0
  215. package/src/components/tools/TodoCard.module.scss +131 -0
  216. package/src/components/tools/TodoCard.stories.tsx +202 -0
  217. package/src/components/tools/TodoCard.tsx +200 -0
  218. package/src/components/tools/ToolCard.stories.tsx +177 -0
  219. package/src/components/tools/ToolCard.tsx +60 -0
  220. package/src/components/tools/ToolCardProps.ts +20 -0
  221. package/src/components/tools/ToolSearchCard.stories.tsx +81 -0
  222. package/src/components/tools/ToolSearchCard.tsx +86 -0
  223. package/src/components/tools/WorkpadCard.stories.tsx +106 -0
  224. package/src/components/tools/WorkpadCard.tsx +125 -0
  225. package/src/components/tools/classifyTool.test.ts +44 -0
  226. package/src/components/tools/classifyTool.ts +134 -0
  227. package/src/components/tools/parseDiff.ts +95 -0
  228. package/src/components/tools/parseShellOutput.ts +28 -0
  229. package/src/components/tools/toolCardHelpers.test.ts +53 -0
  230. package/src/components/tools/toolCards.module.scss +234 -0
  231. package/src/components/workspace/WorkspaceBoard.module.scss +238 -0
  232. package/src/components/workspace/WorkspaceBoard.stories.tsx +240 -0
  233. package/src/components/workspace/WorkspaceBoard.tsx +232 -0
  234. package/src/components/workspace/WorkspaceFormFields.module.scss +79 -0
  235. package/src/components/workspace/WorkspaceFormFields.stories.tsx +133 -0
  236. package/src/components/workspace/WorkspaceFormFields.tsx +185 -0
  237. package/src/context/GrackleContext.ts +28 -0
  238. package/src/context/GrackleContextTypes.ts +64 -0
  239. package/src/context/SidebarContext.tsx +53 -0
  240. package/src/context/ThemeContext.tsx +21 -0
  241. package/src/context/ToastContext.tsx +56 -0
  242. package/src/hooks/types.ts +864 -0
  243. package/src/hooks/useEventSelection.test.ts +204 -0
  244. package/src/hooks/useEventSelection.ts +158 -0
  245. package/src/hooks/useSmartScroll.ts +151 -0
  246. package/src/hooks/useTheme.ts +228 -0
  247. package/src/index.ts +210 -0
  248. package/src/mocks/MockGrackleProvider.tsx +1397 -0
  249. package/src/mocks/mockData.ts +1966 -0
  250. package/src/mocks/mockKnowledgeData.ts +294 -0
  251. package/src/scss.d.ts +12 -0
  252. package/src/styles/global.scss +244 -0
  253. package/src/styles/mixins.scss +278 -0
  254. package/src/styles/prism-theme.scss +148 -0
  255. package/src/styles/theme.scss +1102 -0
  256. package/src/test-utils/storybook-decorators.tsx +50 -0
  257. package/src/test-utils/storybook-helpers.ts +262 -0
  258. package/src/themes.ts +142 -0
  259. package/src/utils/boardColumns.ts +141 -0
  260. package/src/utils/breadcrumbs.test.ts +285 -0
  261. package/src/utils/breadcrumbs.ts +222 -0
  262. package/src/utils/dashboard.test.ts +156 -0
  263. package/src/utils/dashboard.ts +195 -0
  264. package/src/utils/eventContent.test.ts +353 -0
  265. package/src/utils/eventContent.ts +209 -0
  266. package/src/utils/findingCategory.ts +33 -0
  267. package/src/utils/format.ts +27 -0
  268. package/src/utils/iconSize.ts +18 -0
  269. package/src/utils/navigation.ts +205 -0
  270. package/src/utils/route-config.test.ts +128 -0
  271. package/src/utils/scrollUtils.test.ts +65 -0
  272. package/src/utils/scrollUtils.ts +49 -0
  273. package/src/utils/sessionEvents.test.ts +302 -0
  274. package/src/utils/sessionEvents.ts +233 -0
  275. package/src/utils/taskStatus.tsx +137 -0
  276. package/src/utils/time.ts +92 -0
  277. package/tsconfig.json +8 -0
  278. package/vite.config.ts +20 -0
  279. package/vitest.config.ts +10 -0
@@ -0,0 +1,272 @@
1
+ @use '../../styles/mixins' as *;
2
+
3
+ // =============================================================================
4
+ // Event Renderer — individual session event styles
5
+ // =============================================================================
6
+
7
+ // System context (system prompt) — collapsible left-bordered section
8
+ .systemContextEvent {
9
+ border-left: 3px solid var(--accent-purple, #a78bfa);
10
+ margin: var(--space-xs) 0;
11
+ font-size: var(--font-size-sm);
12
+ }
13
+
14
+ .systemContextHeader {
15
+ display: flex;
16
+ align-items: center;
17
+ gap: var(--space-xs);
18
+ background: none;
19
+ border: none;
20
+ padding: 2px var(--space-sm);
21
+ color: var(--text-secondary);
22
+ font-size: var(--font-size-sm);
23
+ font-family: inherit;
24
+ width: 100%;
25
+ text-align: left;
26
+ cursor: pointer;
27
+ border-radius: var(--radius-sm);
28
+ transition: color var(--transition-fast),
29
+ background var(--transition-fast);
30
+
31
+ &:hover {
32
+ color: var(--text-primary);
33
+ background: var(--bg-overlay);
34
+ }
35
+ }
36
+
37
+ .systemContextBadge {
38
+ flex-shrink: 0;
39
+ font-size: 10px;
40
+ font-weight: var(--font-weight-bold);
41
+ color: var(--accent-purple, #a78bfa);
42
+ text-transform: uppercase;
43
+ letter-spacing: 0.05em;
44
+ }
45
+
46
+ .systemContextToggle {
47
+ margin-left: auto;
48
+ color: var(--text-tertiary);
49
+ font-size: 10px;
50
+ }
51
+
52
+ .systemContextPre {
53
+ padding: var(--space-xs) var(--space-sm);
54
+ margin: 0;
55
+ font-size: 11px;
56
+ font-family: var(--font-mono);
57
+ color: var(--text-secondary);
58
+ white-space: pre-wrap;
59
+ word-break: break-word;
60
+ overflow: hidden;
61
+ }
62
+
63
+ .systemContextEllipsis {
64
+ color: var(--text-tertiary);
65
+ }
66
+
67
+ .systemEvent {
68
+ color: var(--text-secondary);
69
+ font-style: italic;
70
+ font-size: var(--font-size-sm);
71
+ padding: 2px 0;
72
+ }
73
+
74
+ .systemTimestamp {
75
+ color: var(--text-tertiary);
76
+ }
77
+
78
+ .textEvent {
79
+ position: relative;
80
+ padding: var(--space-xs) 0;
81
+ padding-left: var(--space-xs);
82
+ line-height: var(--line-height);
83
+
84
+ // --- Markdown element styles ---
85
+
86
+ h1, h2, h3, h4, h5, h6 {
87
+ margin: var(--space-sm) 0 var(--space-xs);
88
+ font-weight: var(--font-weight-bold);
89
+ }
90
+
91
+ h1 { font-size: 1.4em; }
92
+ h2 { font-size: 1.2em; }
93
+ h3 { font-size: 1.1em; }
94
+
95
+ p {
96
+ margin: var(--space-xs) 0;
97
+ }
98
+
99
+ pre {
100
+ @include surface-inset;
101
+ padding: var(--space-sm);
102
+ margin: var(--space-xs) 0;
103
+ overflow: auto;
104
+ font-size: 11px;
105
+ white-space: pre-wrap;
106
+ }
107
+
108
+ code {
109
+ font-family: var(--font-mono);
110
+ font-size: 0.9em;
111
+ background: var(--bg-overlay);
112
+ padding: 1px 4px;
113
+ border-radius: var(--radius-sm);
114
+ }
115
+
116
+ pre code {
117
+ background: none;
118
+ padding: 0;
119
+ }
120
+
121
+ table {
122
+ border-collapse: collapse;
123
+ margin: var(--space-xs) 0;
124
+ font-size: var(--font-size-sm);
125
+ width: 100%;
126
+ }
127
+
128
+ th, td {
129
+ border: 1px solid var(--border-subtle);
130
+ padding: var(--space-xs) var(--space-sm);
131
+ text-align: left;
132
+ }
133
+
134
+ th {
135
+ background: var(--bg-overlay);
136
+ font-weight: var(--font-weight-bold);
137
+ }
138
+
139
+ ul, ol {
140
+ padding-left: var(--space-lg);
141
+ margin: var(--space-xs) 0;
142
+ }
143
+
144
+ li {
145
+ margin: 2px 0;
146
+ }
147
+
148
+ strong {
149
+ font-weight: var(--font-weight-bold);
150
+ }
151
+
152
+ a {
153
+ color: var(--accent-blue);
154
+ text-decoration: underline;
155
+ }
156
+
157
+ hr {
158
+ border: none;
159
+ border-top: 1px solid var(--border-subtle);
160
+ margin: var(--space-sm) 0;
161
+ }
162
+
163
+ blockquote {
164
+ border-left: 3px solid var(--border-subtle);
165
+ padding-left: var(--space-sm);
166
+ margin: var(--space-xs) 0;
167
+ color: var(--text-secondary);
168
+ }
169
+ }
170
+
171
+ // --- Copy button positioning ---
172
+
173
+ .codeBlockWrapper {
174
+ position: relative;
175
+
176
+ &:hover .codeBlockCopyButton {
177
+ opacity: 0.4;
178
+ }
179
+ }
180
+
181
+ .codeBlockCopyButton {
182
+ // Override absolute position from CopyButton default — sits inside the wrapper.
183
+ // Mobile: base CopyButton handles always-visible (opacity: 1).
184
+ }
185
+
186
+ // Tool card styles have moved to ../tools/toolCards.module.scss.
187
+ // Individual cards: FileReadCard, FileEditCard, ShellCard, SearchCard, etc.
188
+
189
+ .errorEvent {
190
+ color: var(--accent-red);
191
+ font-weight: var(--font-weight-bold);
192
+ padding: var(--space-xs) 0;
193
+ border-left: 3px solid var(--accent-red);
194
+ padding-left: var(--space-sm);
195
+ }
196
+
197
+ .statusEvent {
198
+ color: var(--accent-yellow);
199
+ font-size: 11px;
200
+ padding: var(--space-xs) 0;
201
+ border-top: 1px solid var(--border-subtle);
202
+ border-bottom: 1px solid var(--border-subtle);
203
+ margin: var(--space-xs) 0;
204
+ }
205
+
206
+ .userInputEvent {
207
+ display: flex;
208
+ justify-content: flex-end;
209
+ padding: var(--space-xs) 0;
210
+ }
211
+
212
+ .userInputContent {
213
+ background: var(--accent-blue-dim);
214
+ color: var(--accent-blue-fg);
215
+ border: 1px solid var(--accent-blue);
216
+ border-radius: var(--radius-md);
217
+ padding: var(--space-xs) var(--space-sm);
218
+ max-width: 75%;
219
+ word-break: break-word;
220
+ font-size: var(--font-size-sm);
221
+ line-height: var(--line-height);
222
+
223
+ @include mobile {
224
+ max-width: 90%;
225
+ }
226
+ }
227
+
228
+ .signalEvent {
229
+ display: flex;
230
+ align-items: flex-start;
231
+ gap: var(--space-sm);
232
+ border-left: 3px solid var(--accent-yellow);
233
+ padding: var(--space-xs) var(--space-sm);
234
+ margin: var(--space-xs) 0;
235
+ font-size: var(--font-size-sm);
236
+ color: var(--text-secondary);
237
+ }
238
+
239
+ .signalBadge {
240
+ flex-shrink: 0;
241
+ font-size: 10px;
242
+ font-weight: var(--font-weight-bold);
243
+ color: var(--accent-yellow);
244
+ text-transform: uppercase;
245
+ letter-spacing: 0.05em;
246
+ }
247
+
248
+ .signalContent {
249
+ white-space: pre-wrap;
250
+ word-break: break-word;
251
+ }
252
+
253
+ .usageEvent {
254
+ display: flex;
255
+ justify-content: center;
256
+ padding: var(--space-xs) 0;
257
+ margin: var(--space-xs) 0;
258
+ }
259
+
260
+ .usageBadge {
261
+ font-size: var(--font-size-xs);
262
+ color: var(--text-tertiary);
263
+ background: var(--bg-tertiary);
264
+ border-radius: var(--radius-sm);
265
+ padding: 2px var(--space-sm);
266
+ letter-spacing: 0.02em;
267
+ }
268
+
269
+ .defaultEvent {
270
+ padding: 2px 0;
271
+ color: var(--text-secondary);
272
+ }
@@ -0,0 +1,186 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { expect } from "@storybook/test";
3
+ import { EventRenderer } from "./EventRenderer.js";
4
+ import { makeEvent } from "../../test-utils/storybook-helpers.js";
5
+
6
+ const meta: Meta<typeof EventRenderer> = {
7
+ component: EventRenderer,
8
+ title: "Grackle/Display/EventRenderer",
9
+ tags: ["autodocs"],
10
+ };
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+
14
+ // --- Tool card stories (now routed through ToolCard) ---
15
+
16
+ /** Unpaired tool_result renders as a generic tool card. */
17
+ export const ToolResultSuccess: Story = {
18
+ args: {
19
+ event: makeEvent({
20
+ eventType: "tool_result",
21
+ content: "File written successfully",
22
+ raw: JSON.stringify({ is_error: false }),
23
+ }),
24
+ },
25
+ play: async ({ canvas }) => {
26
+ await expect(canvas.getByTestId("tool-card-generic")).toBeInTheDocument();
27
+ },
28
+ };
29
+
30
+ /** Paired tool_use+tool_result renders as a specialized card (FileReadCard). */
31
+ export const PairedToolUseResult: Story = {
32
+ args: {
33
+ event: makeEvent({
34
+ eventType: "tool_result",
35
+ content: "import express from 'express';",
36
+ }),
37
+ toolUseCtx: { tool: "Read", args: { file_path: "/src/index.ts" } },
38
+ },
39
+ play: async ({ canvas }) => {
40
+ await expect(canvas.getByTestId("tool-card-file-read")).toBeInTheDocument();
41
+ await expect(canvas.getByText("index.ts")).toBeInTheDocument();
42
+ },
43
+ };
44
+
45
+ /** Paired Edit tool renders as FileEditCard with diff. */
46
+ export const PairedEditResult: Story = {
47
+ args: {
48
+ event: makeEvent({
49
+ eventType: "tool_result",
50
+ content: "File updated",
51
+ }),
52
+ toolUseCtx: {
53
+ tool: "Edit",
54
+ args: { file_path: "/src/config.ts", old_string: "port = 3000", new_string: "port = 8080" },
55
+ },
56
+ },
57
+ play: async ({ canvas }) => {
58
+ await expect(canvas.getByTestId("tool-card-file-edit")).toBeInTheDocument();
59
+ await expect(canvas.getByText("config.ts")).toBeInTheDocument();
60
+ },
61
+ };
62
+
63
+ /** Paired Bash tool renders as ShellCard. */
64
+ export const PairedShellResult: Story = {
65
+ args: {
66
+ event: makeEvent({
67
+ eventType: "tool_result",
68
+ content: "[exit 0] Tests passed",
69
+ }),
70
+ toolUseCtx: { tool: "Bash", args: { command: "npm test" } },
71
+ },
72
+ play: async ({ canvas }) => {
73
+ await expect(canvas.getByTestId("tool-card-shell")).toBeInTheDocument();
74
+ await expect(canvas.getByTestId("tool-card-command")).toHaveTextContent("npm test");
75
+ },
76
+ };
77
+
78
+ /** Unpaired tool_use renders as an in-progress card. */
79
+ export const UnpairedToolUse: Story = {
80
+ args: {
81
+ event: makeEvent({
82
+ eventType: "tool_use",
83
+ content: JSON.stringify({ tool: "Read", args: { file_path: "/src/app.ts" } }),
84
+ }),
85
+ },
86
+ play: async ({ canvas }) => {
87
+ // Should render as FileReadCard (in-progress, no result)
88
+ const card = canvas.getByTestId("tool-card-file-read");
89
+ await expect(card.className).toContain("inProgress");
90
+ },
91
+ };
92
+
93
+ /** Error tool_result renders with red accent. */
94
+ export const ToolResultError: Story = {
95
+ args: {
96
+ event: makeEvent({
97
+ eventType: "tool_result",
98
+ content: "Error: ENOENT: no such file",
99
+ raw: JSON.stringify({ is_error: true }),
100
+ }),
101
+ toolUseCtx: { tool: "Read", args: { file_path: "/missing.ts" } },
102
+ },
103
+ play: async ({ canvas }) => {
104
+ const card = canvas.getByTestId("tool-card-file-read");
105
+ await expect(card.className).toContain("cardRed");
106
+ },
107
+ };
108
+
109
+ // --- Markdown rendering stories ---
110
+
111
+ /** Text event renders headings as h1/h2/h3 elements. */
112
+ export const MarkdownHeadings: Story = {
113
+ args: {
114
+ event: makeEvent({
115
+ eventType: "text",
116
+ content: "# Heading One\n\n## Heading Two\n\n### Heading Three",
117
+ }),
118
+ },
119
+ play: async ({ canvas }) => {
120
+ await expect(canvas.getByRole("heading", { level: 1 })).toHaveTextContent("Heading One");
121
+ await expect(canvas.getByRole("heading", { level: 2 })).toHaveTextContent("Heading Two");
122
+ await expect(canvas.getByRole("heading", { level: 3 })).toHaveTextContent("Heading Three");
123
+ },
124
+ };
125
+
126
+ /** Text event renders bold, italic, and links. */
127
+ export const MarkdownInlineFormatting: Story = {
128
+ args: {
129
+ event: makeEvent({
130
+ eventType: "text",
131
+ content: "This has **bold text** and *italic text* and [a link](https://example.com)",
132
+ }),
133
+ },
134
+ play: async ({ canvas }) => {
135
+ await expect(canvas.getByText("bold text").tagName).toBe("STRONG");
136
+ await expect(canvas.getByText("italic text").tagName).toBe("EM");
137
+ const link = canvas.getByRole("link", { name: "a link" });
138
+ await expect(link).toHaveAttribute("href", "https://example.com");
139
+ },
140
+ };
141
+
142
+ /** Text event renders fenced code blocks as pre > code elements. */
143
+ export const MarkdownCodeBlock: Story = {
144
+ args: {
145
+ event: makeEvent({
146
+ eventType: "text",
147
+ content: "```js\nconst x = 42;\nconsole.log(x);\n```",
148
+ }),
149
+ },
150
+ play: async ({ canvasElement }) => {
151
+ // rehype-prism-plus splits code into <span> tokens for highlighting,
152
+ // so getByText can't find the full string. Query the DOM directly.
153
+ const pre = canvasElement.querySelector("pre");
154
+ await expect(pre).toBeTruthy();
155
+ await expect(pre!.textContent).toContain("const x = 42");
156
+ },
157
+ };
158
+
159
+ /** Text event wraps plain text content in paragraph elements. */
160
+ export const MarkdownParagraphWrapping: Story = {
161
+ args: {
162
+ event: makeEvent({
163
+ eventType: "text",
164
+ content: "This is a plain text paragraph.",
165
+ }),
166
+ },
167
+ play: async ({ canvas }) => {
168
+ const paragraph = canvas.getByText("This is a plain text paragraph.");
169
+ await expect(paragraph.tagName).toBe("P");
170
+ },
171
+ };
172
+
173
+ /** System context event renders as collapsible prompt. */
174
+ export const SystemContext: Story = {
175
+ args: {
176
+ event: makeEvent({
177
+ eventType: "system",
178
+ content: "You are a helpful assistant.\nYou write clean code.\nYou follow best practices.\nLine 4.\nLine 5.\nLine 6.",
179
+ raw: JSON.stringify({ systemContext: true }),
180
+ }),
181
+ },
182
+ play: async ({ canvas }) => {
183
+ await expect(canvas.getByTestId("system-context-event")).toBeInTheDocument();
184
+ await expect(canvas.getByText("SYSTEM PROMPT")).toBeInTheDocument();
185
+ },
186
+ };