@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.
- package/.rush/temp/3ae72563f781afd72723475938136f113846603e.untar.log +10 -0
- package/.rush/temp/bc1d5bf9201ce71abeaeaddd096deb9b0805d703.untar.log +10 -0
- package/.rush/temp/operation/_phase_build/all.log +18 -0
- package/.rush/temp/operation/_phase_build/log-chunks.jsonl +18 -0
- package/.rush/temp/operation/_phase_build/state.json +3 -0
- package/.rush/temp/operation/_phase_test/all.log +121 -0
- package/.rush/temp/operation/_phase_test/log-chunks.jsonl +121 -0
- package/.rush/temp/operation/_phase_test/state.json +3 -0
- package/.rush/temp/shrinkwrap-deps.json +938 -0
- package/.storybook/main.ts +22 -0
- package/.storybook/preview.tsx +30 -0
- package/config/rig.json +4 -0
- package/config/rush-project.json +12 -0
- package/dist/index.css +1 -0
- package/dist/index.js +39221 -0
- package/eslint.config.cjs +5 -0
- package/package.json +83 -0
- package/rush-logs/web-components._phase_build.cache.log +4 -0
- package/rush-logs/web-components._phase_test.cache.log +4 -0
- package/src/components/chat/ChatInput.module.scss +81 -0
- package/src/components/chat/ChatInput.stories.tsx +91 -0
- package/src/components/chat/ChatInput.tsx +168 -0
- package/src/components/chat/index.ts +6 -0
- package/src/components/dag/DagView.module.scss +149 -0
- package/src/components/dag/DagView.stories.tsx +125 -0
- package/src/components/dag/DagView.tsx +109 -0
- package/src/components/dag/TaskNode.stories.tsx +133 -0
- package/src/components/dag/TaskNode.tsx +40 -0
- package/src/components/dag/useDagLayout.ts +139 -0
- package/src/components/display/Breadcrumbs.module.scss +71 -0
- package/src/components/display/Breadcrumbs.stories.tsx +80 -0
- package/src/components/display/Breadcrumbs.tsx +46 -0
- package/src/components/display/Button.module.scss +110 -0
- package/src/components/display/Button.stories.tsx +88 -0
- package/src/components/display/Button.tsx +40 -0
- package/src/components/display/ConfirmDialog.module.scss +67 -0
- package/src/components/display/ConfirmDialog.stories.tsx +81 -0
- package/src/components/display/ConfirmDialog.tsx +88 -0
- package/src/components/display/CopyButton.module.scss +41 -0
- package/src/components/display/CopyButton.stories.tsx +78 -0
- package/src/components/display/CopyButton.tsx +64 -0
- package/src/components/display/DemoBanner.module.scss +37 -0
- package/src/components/display/DemoBanner.stories.tsx +40 -0
- package/src/components/display/DemoBanner.tsx +23 -0
- package/src/components/display/EventHoverRow.module.scss +102 -0
- package/src/components/display/EventHoverRow.stories.tsx +99 -0
- package/src/components/display/EventHoverRow.tsx +154 -0
- package/src/components/display/EventRenderer.module.scss +272 -0
- package/src/components/display/EventRenderer.stories.tsx +186 -0
- package/src/components/display/EventRenderer.tsx +271 -0
- package/src/components/display/EventStream.module.scss +93 -0
- package/src/components/display/EventStream.stories.tsx +249 -0
- package/src/components/display/EventStream.tsx +369 -0
- package/src/components/display/FloatingActionBar.module.scss +107 -0
- package/src/components/display/FloatingActionBar.stories.tsx +122 -0
- package/src/components/display/FloatingActionBar.tsx +119 -0
- package/src/components/display/SessionAttemptSelector.module.scss +50 -0
- package/src/components/display/SessionAttemptSelector.stories.tsx +78 -0
- package/src/components/display/SessionAttemptSelector.tsx +49 -0
- package/src/components/display/SessionPicker.module.scss +200 -0
- package/src/components/display/SessionPicker.stories.tsx +169 -0
- package/src/components/display/SessionPicker.tsx +214 -0
- package/src/components/display/Skeleton.module.scss +58 -0
- package/src/components/display/Skeleton.stories.tsx +94 -0
- package/src/components/display/Skeleton.tsx +127 -0
- package/src/components/display/Spinner.module.scss +41 -0
- package/src/components/display/Spinner.stories.tsx +66 -0
- package/src/components/display/Spinner.tsx +32 -0
- package/src/components/display/SplashScreen.module.scss +20 -0
- package/src/components/display/SplashScreen.stories.tsx +26 -0
- package/src/components/display/SplashScreen.tsx +16 -0
- package/src/components/display/SplitButton.module.scss +166 -0
- package/src/components/display/SplitButton.stories.tsx +95 -0
- package/src/components/display/SplitButton.tsx +128 -0
- package/src/components/display/Tooltip.module.scss +84 -0
- package/src/components/display/Tooltip.stories.tsx +240 -0
- package/src/components/display/Tooltip.tsx +184 -0
- package/src/components/display/extractText.test.tsx +48 -0
- package/src/components/display/index.ts +20 -0
- package/src/components/editable/EditableCheckbox.stories.tsx +54 -0
- package/src/components/editable/EditableCheckbox.tsx +39 -0
- package/src/components/editable/EditableField.module.scss +135 -0
- package/src/components/editable/EditableSelect.tsx +164 -0
- package/src/components/editable/EditableTextArea.stories.tsx +50 -0
- package/src/components/editable/EditableTextArea.tsx +148 -0
- package/src/components/editable/EditableTextField.stories.tsx +62 -0
- package/src/components/editable/EditableTextField.tsx +153 -0
- package/src/components/editable/EnvironmentSelect.module.scss +17 -0
- package/src/components/editable/EnvironmentSelect.stories.tsx +61 -0
- package/src/components/editable/EnvironmentSelect.tsx +87 -0
- package/src/components/editable/index.ts +13 -0
- package/src/components/editable/useEditableField.test.tsx +233 -0
- package/src/components/editable/useEditableField.ts +173 -0
- package/src/components/index.ts +20 -0
- package/src/components/knowledge/KnowledgeDetailPanel.module.scss +162 -0
- package/src/components/knowledge/KnowledgeDetailPanel.stories.tsx +208 -0
- package/src/components/knowledge/KnowledgeDetailPanel.tsx +122 -0
- package/src/components/knowledge/KnowledgeGraph.module.scss +110 -0
- package/src/components/knowledge/KnowledgeGraph.stories.tsx +180 -0
- package/src/components/knowledge/KnowledgeGraph.tsx +455 -0
- package/src/components/knowledge/KnowledgeNav.module.scss +130 -0
- package/src/components/knowledge/KnowledgeNav.stories.tsx +108 -0
- package/src/components/knowledge/KnowledgeNav.tsx +138 -0
- package/src/components/knowledge/index.ts +3 -0
- package/src/components/layout/AppNav.module.scss +82 -0
- package/src/components/layout/AppNav.stories.tsx +115 -0
- package/src/components/layout/AppNav.tsx +133 -0
- package/src/components/layout/BottomStatusBar.module.scss +58 -0
- package/src/components/layout/BottomStatusBar.stories.tsx +35 -0
- package/src/components/layout/BottomStatusBar.tsx +206 -0
- package/src/components/layout/Sidebar.module.scss +60 -0
- package/src/components/layout/Sidebar.stories.tsx +46 -0
- package/src/components/layout/Sidebar.tsx +84 -0
- package/src/components/layout/StatusBar.module.scss +108 -0
- package/src/components/layout/StatusBar.stories.tsx +119 -0
- package/src/components/layout/StatusBar.tsx +70 -0
- package/src/components/layout/index.ts +9 -0
- package/src/components/lists/EnvironmentNav.module.scss +118 -0
- package/src/components/lists/EnvironmentNav.stories.tsx +121 -0
- package/src/components/lists/EnvironmentNav.tsx +133 -0
- package/src/components/lists/FindingsNav.module.scss +126 -0
- package/src/components/lists/FindingsNav.tsx +146 -0
- package/src/components/lists/TaskList.module.scss +206 -0
- package/src/components/lists/TaskList.stories.tsx +401 -0
- package/src/components/lists/TaskList.tsx +509 -0
- package/src/components/lists/index.ts +6 -0
- package/src/components/lists/listHelpers.tsx +130 -0
- package/src/components/notifications/Callout.module.scss +83 -0
- package/src/components/notifications/Callout.stories.tsx +81 -0
- package/src/components/notifications/Callout.tsx +64 -0
- package/src/components/notifications/Toast.module.scss +86 -0
- package/src/components/notifications/Toast.stories.tsx +71 -0
- package/src/components/notifications/Toast.tsx +51 -0
- package/src/components/notifications/ToastContainer.module.scss +23 -0
- package/src/components/notifications/ToastContainer.stories.tsx +66 -0
- package/src/components/notifications/ToastContainer.tsx +29 -0
- package/src/components/notifications/UpdateBanner.stories.tsx +77 -0
- package/src/components/notifications/UpdateBanner.test.tsx +64 -0
- package/src/components/notifications/UpdateBanner.tsx +44 -0
- package/src/components/notifications/index.ts +8 -0
- package/src/components/panels/AboutPanel.stories.tsx +70 -0
- package/src/components/panels/AboutPanel.tsx +66 -0
- package/src/components/panels/AppearancePanel.stories.tsx +45 -0
- package/src/components/panels/AppearancePanel.tsx +97 -0
- package/src/components/panels/CredentialProvidersPanel.stories.tsx +62 -0
- package/src/components/panels/CredentialProvidersPanel.tsx +111 -0
- package/src/components/panels/EnvironmentEditPanel.module.scss +170 -0
- package/src/components/panels/EnvironmentEditPanel.stories.tsx +206 -0
- package/src/components/panels/EnvironmentEditPanel.tsx +785 -0
- package/src/components/panels/FindingsPanel.module.scss +94 -0
- package/src/components/panels/FindingsPanel.stories.tsx +109 -0
- package/src/components/panels/FindingsPanel.tsx +76 -0
- package/src/components/panels/KeyboardShortcutsPanel.module.scss +65 -0
- package/src/components/panels/KeyboardShortcutsPanel.stories.tsx +40 -0
- package/src/components/panels/KeyboardShortcutsPanel.tsx +104 -0
- package/src/components/panels/PluginsPanel.tsx +77 -0
- package/src/components/panels/SettingsPanel.module.scss +336 -0
- package/src/components/panels/TaskActionButtons.module.scss +22 -0
- package/src/components/panels/TaskActionButtons.stories.tsx +125 -0
- package/src/components/panels/TaskActionButtons.tsx +87 -0
- package/src/components/panels/TaskEditPanel.module.scss +202 -0
- package/src/components/panels/TaskEditPanel.stories.tsx +75 -0
- package/src/components/panels/TaskEditPanel.tsx +328 -0
- package/src/components/panels/TaskOverviewPanel.module.scss +236 -0
- package/src/components/panels/TaskOverviewPanel.stories.tsx +219 -0
- package/src/components/panels/TaskOverviewPanel.tsx +270 -0
- package/src/components/panels/TokensPanel.stories.tsx +131 -0
- package/src/components/panels/TokensPanel.tsx +143 -0
- package/src/components/panels/WorkpadPanel.module.scss +39 -0
- package/src/components/panels/WorkpadPanel.stories.tsx +56 -0
- package/src/components/panels/WorkpadPanel.tsx +63 -0
- package/src/components/panels/index.ts +13 -0
- package/src/components/personas/McpToolSelector.module.scss +109 -0
- package/src/components/personas/McpToolSelector.stories.tsx +129 -0
- package/src/components/personas/McpToolSelector.tsx +180 -0
- package/src/components/personas/PersonaManager.module.scss +233 -0
- package/src/components/personas/PersonaManager.stories.tsx +139 -0
- package/src/components/personas/PersonaManager.tsx +122 -0
- package/src/components/schedules/ScheduleManager.module.scss +98 -0
- package/src/components/schedules/ScheduleManager.stories.tsx +78 -0
- package/src/components/schedules/ScheduleManager.tsx +160 -0
- package/src/components/settings/SettingsNav.module.scss +82 -0
- package/src/components/settings/SettingsNav.stories.tsx +83 -0
- package/src/components/settings/SettingsNav.tsx +104 -0
- package/src/components/streams/StreamDetailPanel.module.scss +206 -0
- package/src/components/streams/StreamDetailPanel.stories.tsx +132 -0
- package/src/components/streams/StreamDetailPanel.tsx +119 -0
- package/src/components/streams/StreamList.module.scss +92 -0
- package/src/components/streams/StreamList.stories.tsx +99 -0
- package/src/components/streams/StreamList.tsx +114 -0
- package/src/components/streams/index.ts +10 -0
- package/src/components/tools/AgentToolCard.module.scss +118 -0
- package/src/components/tools/AgentToolCard.stories.tsx +304 -0
- package/src/components/tools/AgentToolCard.tsx +247 -0
- package/src/components/tools/FileEditCard.stories.tsx +138 -0
- package/src/components/tools/FileEditCard.tsx +160 -0
- package/src/components/tools/FileReadCard.stories.tsx +120 -0
- package/src/components/tools/FileReadCard.tsx +106 -0
- package/src/components/tools/FindingCard.stories.tsx +124 -0
- package/src/components/tools/FindingCard.tsx +178 -0
- package/src/components/tools/GenericToolCard.stories.tsx +80 -0
- package/src/components/tools/GenericToolCard.tsx +111 -0
- package/src/components/tools/IpcCard.stories.tsx +129 -0
- package/src/components/tools/IpcCard.tsx +178 -0
- package/src/components/tools/KnowledgeCard.stories.tsx +112 -0
- package/src/components/tools/KnowledgeCard.tsx +165 -0
- package/src/components/tools/MetadataCard.stories.tsx +32 -0
- package/src/components/tools/MetadataCard.tsx +39 -0
- package/src/components/tools/SearchCard.stories.tsx +74 -0
- package/src/components/tools/SearchCard.tsx +86 -0
- package/src/components/tools/ShellCard.stories.tsx +112 -0
- package/src/components/tools/ShellCard.tsx +106 -0
- package/src/components/tools/TaskCard.stories.tsx +123 -0
- package/src/components/tools/TaskCard.tsx +203 -0
- package/src/components/tools/TodoCard.module.scss +131 -0
- package/src/components/tools/TodoCard.stories.tsx +202 -0
- package/src/components/tools/TodoCard.tsx +200 -0
- package/src/components/tools/ToolCard.stories.tsx +177 -0
- package/src/components/tools/ToolCard.tsx +60 -0
- package/src/components/tools/ToolCardProps.ts +20 -0
- package/src/components/tools/ToolSearchCard.stories.tsx +81 -0
- package/src/components/tools/ToolSearchCard.tsx +86 -0
- package/src/components/tools/WorkpadCard.stories.tsx +106 -0
- package/src/components/tools/WorkpadCard.tsx +125 -0
- package/src/components/tools/classifyTool.test.ts +44 -0
- package/src/components/tools/classifyTool.ts +134 -0
- package/src/components/tools/parseDiff.ts +95 -0
- package/src/components/tools/parseShellOutput.ts +28 -0
- package/src/components/tools/toolCardHelpers.test.ts +53 -0
- package/src/components/tools/toolCards.module.scss +234 -0
- package/src/components/workspace/WorkspaceBoard.module.scss +238 -0
- package/src/components/workspace/WorkspaceBoard.stories.tsx +240 -0
- package/src/components/workspace/WorkspaceBoard.tsx +232 -0
- package/src/components/workspace/WorkspaceFormFields.module.scss +79 -0
- package/src/components/workspace/WorkspaceFormFields.stories.tsx +133 -0
- package/src/components/workspace/WorkspaceFormFields.tsx +185 -0
- package/src/context/GrackleContext.ts +28 -0
- package/src/context/GrackleContextTypes.ts +64 -0
- package/src/context/SidebarContext.tsx +53 -0
- package/src/context/ThemeContext.tsx +21 -0
- package/src/context/ToastContext.tsx +56 -0
- package/src/hooks/types.ts +864 -0
- package/src/hooks/useEventSelection.test.ts +204 -0
- package/src/hooks/useEventSelection.ts +158 -0
- package/src/hooks/useSmartScroll.ts +151 -0
- package/src/hooks/useTheme.ts +228 -0
- package/src/index.ts +210 -0
- package/src/mocks/MockGrackleProvider.tsx +1397 -0
- package/src/mocks/mockData.ts +1966 -0
- package/src/mocks/mockKnowledgeData.ts +294 -0
- package/src/scss.d.ts +12 -0
- package/src/styles/global.scss +244 -0
- package/src/styles/mixins.scss +278 -0
- package/src/styles/prism-theme.scss +148 -0
- package/src/styles/theme.scss +1102 -0
- package/src/test-utils/storybook-decorators.tsx +50 -0
- package/src/test-utils/storybook-helpers.ts +262 -0
- package/src/themes.ts +142 -0
- package/src/utils/boardColumns.ts +141 -0
- package/src/utils/breadcrumbs.test.ts +285 -0
- package/src/utils/breadcrumbs.ts +222 -0
- package/src/utils/dashboard.test.ts +156 -0
- package/src/utils/dashboard.ts +195 -0
- package/src/utils/eventContent.test.ts +353 -0
- package/src/utils/eventContent.ts +209 -0
- package/src/utils/findingCategory.ts +33 -0
- package/src/utils/format.ts +27 -0
- package/src/utils/iconSize.ts +18 -0
- package/src/utils/navigation.ts +205 -0
- package/src/utils/route-config.test.ts +128 -0
- package/src/utils/scrollUtils.test.ts +65 -0
- package/src/utils/scrollUtils.ts +49 -0
- package/src/utils/sessionEvents.test.ts +302 -0
- package/src/utils/sessionEvents.ts +233 -0
- package/src/utils/taskStatus.tsx +137 -0
- package/src/utils/time.ts +92 -0
- package/tsconfig.json +8 -0
- package/vite.config.ts +20 -0
- package/vitest.config.ts +10 -0
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grackle-ai/web-components",
|
|
3
|
+
"version": "0.107.2",
|
|
4
|
+
"description": "Presentational React component library for the Grackle web UI",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/nick-pape/grackle.git",
|
|
9
|
+
"directory": "packages/web-components"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"grackle",
|
|
13
|
+
"components",
|
|
14
|
+
"react",
|
|
15
|
+
"storybook"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/nick-pape/grackle#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/nick-pape/grackle/issues"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=22.0.0 <24.0.0"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "src/index.ts",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@bufbuild/protobuf": "^2.5.0",
|
|
28
|
+
"@dagrejs/dagre": "^2.0.4",
|
|
29
|
+
"@xyflow/react": "^12.10.0",
|
|
30
|
+
"motion": "^11.18.0",
|
|
31
|
+
"d3-drag": "^3.0.0",
|
|
32
|
+
"d3-force": "^3.0.0",
|
|
33
|
+
"d3-selection": "^3.0.0",
|
|
34
|
+
"d3-transition": "^3.0.0",
|
|
35
|
+
"d3-zoom": "^3.0.0",
|
|
36
|
+
"react": "^19.0.0",
|
|
37
|
+
"react-dom": "^19.0.0",
|
|
38
|
+
"react-markdown": "^9.0.3",
|
|
39
|
+
"rehype-prism-plus": "^2.0.0",
|
|
40
|
+
"remark-gfm": "^4.0.0",
|
|
41
|
+
"lucide-react": "~0.474.0",
|
|
42
|
+
"react-router": "^7.0.0",
|
|
43
|
+
"@grackle-ai/common": "0.107.2"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@rushstack/heft": "1.2.7",
|
|
47
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
48
|
+
"@types/d3-drag": "^3.0.0",
|
|
49
|
+
"@types/d3-force": "^3.0.0",
|
|
50
|
+
"@types/d3-selection": "^3.0.0",
|
|
51
|
+
"@types/d3-transition": "^3.0.0",
|
|
52
|
+
"@types/d3-zoom": "^3.0.0",
|
|
53
|
+
"@types/react": "^19.0.0",
|
|
54
|
+
"@types/react-dom": "^19.0.0",
|
|
55
|
+
"sass": "^1.86.0",
|
|
56
|
+
"vite": "^6.0.0",
|
|
57
|
+
"vitest": "^3.1.1",
|
|
58
|
+
"@testing-library/react": "^16.3.2",
|
|
59
|
+
"jsdom": "^29.0.0",
|
|
60
|
+
"@testing-library/dom": "^10.4.1",
|
|
61
|
+
"storybook": "8.6.18",
|
|
62
|
+
"@storybook/addon-controls": "8.6.18",
|
|
63
|
+
"@storybook/addon-docs": "8.6.18",
|
|
64
|
+
"@storybook/react": "8.6.18",
|
|
65
|
+
"@storybook/react-vite": "8.6.18",
|
|
66
|
+
"@storybook/test": "8.6.18",
|
|
67
|
+
"@storybook/test-runner": "^0.21.0",
|
|
68
|
+
"concurrently": "^9.1.0",
|
|
69
|
+
"http-server": "^14.1.1",
|
|
70
|
+
"wait-on": "^8.0.0",
|
|
71
|
+
"@grackle-ai/heft-rig": "0.0.1"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "heft build --clean",
|
|
75
|
+
"clean": "heft clean",
|
|
76
|
+
"test": "vitest run",
|
|
77
|
+
"storybook": "storybook dev -p 6006",
|
|
78
|
+
"build-storybook": "storybook build",
|
|
79
|
+
"test-storybook": "test-storybook",
|
|
80
|
+
"_phase:build": "heft run --only build -- --clean",
|
|
81
|
+
"_phase:test": "heft run --only test"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
@use '../../styles/mixins' as *;
|
|
2
|
+
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// ChatInput — reusable chat form for sending messages to agent sessions
|
|
5
|
+
// =============================================================================
|
|
6
|
+
|
|
7
|
+
.bar {
|
|
8
|
+
@include surface-panel;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: var(--space-sm);
|
|
12
|
+
padding: var(--space-sm) var(--space-md);
|
|
13
|
+
border-top: 1px solid var(--border-subtle);
|
|
14
|
+
|
|
15
|
+
@include mobile {
|
|
16
|
+
flex-wrap: wrap;
|
|
17
|
+
padding: var(--space-xs) var(--space-sm);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Form controls
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
.input {
|
|
26
|
+
@include input-field;
|
|
27
|
+
flex: 1;
|
|
28
|
+
|
|
29
|
+
@include mobile {
|
|
30
|
+
min-width: 0;
|
|
31
|
+
flex: 1 1 100%;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.select {
|
|
36
|
+
@include select-field;
|
|
37
|
+
|
|
38
|
+
@include mobile {
|
|
39
|
+
flex: 1 1 auto;
|
|
40
|
+
min-width: 80px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Buttons
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
.btnPrimary {
|
|
49
|
+
@include btn-primary;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.btnDanger {
|
|
53
|
+
@include btn-danger;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.btnGhost {
|
|
57
|
+
@include btn-ghost;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Status indicators
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
.badge {
|
|
65
|
+
background: var(--accent-green-dim);
|
|
66
|
+
color: var(--accent-green);
|
|
67
|
+
border-radius: var(--radius-full);
|
|
68
|
+
padding: 3px var(--space-md);
|
|
69
|
+
font-size: var(--font-size-xs);
|
|
70
|
+
font-weight: var(--font-weight-medium);
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.disconnectHint {
|
|
75
|
+
color: var(--accent-yellow);
|
|
76
|
+
font-size: 11px;
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: var(--space-xs);
|
|
81
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { expect, fn } from "@storybook/test";
|
|
3
|
+
import { ChatInput } from "./ChatInput.js";
|
|
4
|
+
import type { Environment } from "../../hooks/types.js";
|
|
5
|
+
import { makeEnvironment, makePersona } from "../../test-utils/storybook-helpers.js";
|
|
6
|
+
|
|
7
|
+
const connectedEnv: Environment = makeEnvironment({ id: "local", displayName: "Local", status: "connected" });
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof ChatInput> = {
|
|
10
|
+
component: ChatInput,
|
|
11
|
+
title: "Grackle/Chat/ChatInput",
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
args: {
|
|
14
|
+
personas: [makePersona({ id: "p1", name: "Software Engineer" })],
|
|
15
|
+
environments: [connectedEnv],
|
|
16
|
+
onSendInput: fn(),
|
|
17
|
+
onSpawn: fn(),
|
|
18
|
+
onStartTask: fn(),
|
|
19
|
+
onProvisionEnvironment: fn(),
|
|
20
|
+
onShowToast: fn(),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
/** Send mode shows text input and Send button. */
|
|
27
|
+
export const SendMode: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
mode: "send",
|
|
30
|
+
sessionId: "sess-1",
|
|
31
|
+
environmentId: "local",
|
|
32
|
+
},
|
|
33
|
+
play: async ({ canvas }) => {
|
|
34
|
+
await expect(canvas.getByPlaceholderText("Type a message...")).toBeInTheDocument();
|
|
35
|
+
await expect(canvas.getByRole("button", { name: "Send" })).toBeDisabled();
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Spawn mode shows persona selector when showPersonaSelect is true. */
|
|
40
|
+
export const SpawnModeWithPersonaSelect: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
mode: "spawn",
|
|
43
|
+
environmentId: "local",
|
|
44
|
+
showPersonaSelect: true,
|
|
45
|
+
},
|
|
46
|
+
play: async ({ canvas }) => {
|
|
47
|
+
await expect(canvas.getByPlaceholderText("Enter prompt...")).toBeInTheDocument();
|
|
48
|
+
await expect(canvas.getByRole("button", { name: "Go" })).toBeDisabled();
|
|
49
|
+
// Persona selector should be present
|
|
50
|
+
const select = canvas.getByDisplayValue("(Default)");
|
|
51
|
+
await expect(select).toBeInTheDocument();
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Go button is disabled when no environmentId is provided. */
|
|
56
|
+
export const SpawnModeNoEnv: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
mode: "spawn",
|
|
59
|
+
environmentId: "",
|
|
60
|
+
showPersonaSelect: true,
|
|
61
|
+
},
|
|
62
|
+
play: async ({ canvas }) => {
|
|
63
|
+
await expect(canvas.getByRole("button", { name: "Go" })).toBeDisabled();
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** Start mode shows text input and Send button. */
|
|
68
|
+
export const StartMode: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
mode: "start",
|
|
71
|
+
taskId: "task-1",
|
|
72
|
+
environmentId: "local",
|
|
73
|
+
},
|
|
74
|
+
play: async ({ canvas }) => {
|
|
75
|
+
await expect(canvas.getByPlaceholderText("Type a message...")).toBeInTheDocument();
|
|
76
|
+
await expect(canvas.getByRole("button", { name: "Send" })).toBeDisabled();
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** Send mode renders input and Send button (Stop is in page header, not ChatInput). */
|
|
81
|
+
export const SendModeActive: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
mode: "send",
|
|
84
|
+
sessionId: "sess-1",
|
|
85
|
+
environmentId: "local",
|
|
86
|
+
},
|
|
87
|
+
play: async ({ canvas }) => {
|
|
88
|
+
await expect(canvas.getByPlaceholderText("Type a message...")).toBeInTheDocument();
|
|
89
|
+
await expect(canvas.getByRole("button", { name: "Send" })).toBeDisabled();
|
|
90
|
+
},
|
|
91
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { useState, type FormEvent, type JSX } from "react";
|
|
2
|
+
import type { ToastVariant } from "../../context/ToastContext.js";
|
|
3
|
+
import type { Environment, PersonaData } from "../../hooks/types.js";
|
|
4
|
+
import styles from "./ChatInput.module.scss";
|
|
5
|
+
|
|
6
|
+
// --- Helpers ---
|
|
7
|
+
|
|
8
|
+
/** Returns true when the environment with the given ID is disconnected or in error. */
|
|
9
|
+
function isEnvDisconnected(environmentId: string | undefined, environments: Environment[]): boolean {
|
|
10
|
+
if (!environmentId) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const env = environments.find((e) => e.id === environmentId);
|
|
14
|
+
return env !== undefined && (env.status === "disconnected" || env.status === "error");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// --- Subcomponents ---
|
|
18
|
+
|
|
19
|
+
interface DisconnectedBannerProps {
|
|
20
|
+
environmentId: string;
|
|
21
|
+
onReconnect: (envId: string) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Hint + Reconnect button shown when the task/session environment is unreachable. */
|
|
25
|
+
function DisconnectedBanner({ environmentId, onReconnect }: DisconnectedBannerProps): JSX.Element {
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<span className={styles.disconnectHint} data-testid="env-disconnect-hint">
|
|
29
|
+
Environment unavailable
|
|
30
|
+
</span>
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
onClick={() => onReconnect(environmentId)}
|
|
34
|
+
className={styles.btnGhost}
|
|
35
|
+
data-testid="reconnect-btn"
|
|
36
|
+
title="Reconnect the environment to resume messaging"
|
|
37
|
+
>
|
|
38
|
+
Reconnect
|
|
39
|
+
</button>
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// --- Main component ---
|
|
45
|
+
|
|
46
|
+
/** Chat input mode determines the action performed on submit. */
|
|
47
|
+
export interface ChatInputProps {
|
|
48
|
+
/** "send" = sendInput to existing session, "spawn" = create new session, "start" = start a task */
|
|
49
|
+
mode: "send" | "spawn" | "start";
|
|
50
|
+
/** Session ID to send input to (mode="send") */
|
|
51
|
+
sessionId?: string;
|
|
52
|
+
/** Environment ID (mode="spawn" and "start") */
|
|
53
|
+
environmentId?: string;
|
|
54
|
+
/** Task ID to start (mode="start") */
|
|
55
|
+
taskId?: string;
|
|
56
|
+
/** Show persona selector dropdown (mode="spawn") */
|
|
57
|
+
showPersonaSelect?: boolean;
|
|
58
|
+
/** All personas (for persona selector in spawn mode). */
|
|
59
|
+
personas: PersonaData[];
|
|
60
|
+
/** All environments (for disconnect detection). */
|
|
61
|
+
environments: Environment[];
|
|
62
|
+
/** Send text input to an existing session. */
|
|
63
|
+
onSendInput: (sessionId: string, text: string) => void;
|
|
64
|
+
/** Spawn a new session. */
|
|
65
|
+
onSpawn: (environmentId: string, prompt: string, personaId?: string) => void;
|
|
66
|
+
/** Start a task. */
|
|
67
|
+
onStartTask: (taskId: string, personaId?: string, environmentId?: string, notes?: string) => void;
|
|
68
|
+
/** Reconnect a disconnected environment. */
|
|
69
|
+
onProvisionEnvironment: (environmentId: string) => void;
|
|
70
|
+
/** Display a toast notification. */
|
|
71
|
+
onShowToast?: (message: string, variant?: ToastVariant) => void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Reusable form component for sending messages to agent sessions. */
|
|
75
|
+
export function ChatInput({
|
|
76
|
+
mode,
|
|
77
|
+
sessionId,
|
|
78
|
+
environmentId,
|
|
79
|
+
taskId,
|
|
80
|
+
showPersonaSelect,
|
|
81
|
+
personas,
|
|
82
|
+
environments,
|
|
83
|
+
onSendInput,
|
|
84
|
+
onSpawn,
|
|
85
|
+
onStartTask,
|
|
86
|
+
onProvisionEnvironment,
|
|
87
|
+
onShowToast,
|
|
88
|
+
}: ChatInputProps): JSX.Element {
|
|
89
|
+
|
|
90
|
+
const [text, setText] = useState("");
|
|
91
|
+
const [spawnPersonaId, setSpawnPersonaId] = useState("");
|
|
92
|
+
|
|
93
|
+
const envDisconnected = isEnvDisconnected(environmentId, environments);
|
|
94
|
+
|
|
95
|
+
const handleSubmit = (e: FormEvent): void => {
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
if (!text.trim()) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (mode === "send") {
|
|
102
|
+
if (!sessionId || envDisconnected) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
onSendInput(sessionId, text);
|
|
106
|
+
setText("");
|
|
107
|
+
} else if (mode === "spawn") {
|
|
108
|
+
if (!environmentId) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
onSpawn(environmentId, text, spawnPersonaId);
|
|
112
|
+
onShowToast?.("Session started", "success");
|
|
113
|
+
setText("");
|
|
114
|
+
setSpawnPersonaId("");
|
|
115
|
+
} else {
|
|
116
|
+
// mode === "start"
|
|
117
|
+
if (!taskId) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
onStartTask(taskId, undefined, environmentId, text);
|
|
121
|
+
setText("");
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// --- spawn mode ---
|
|
126
|
+
if (mode === "spawn") {
|
|
127
|
+
return (
|
|
128
|
+
<form onSubmit={handleSubmit} className={styles.bar}>
|
|
129
|
+
<span className={styles.badge}>
|
|
130
|
+
new chat
|
|
131
|
+
</span>
|
|
132
|
+
<input type="text" value={text} onChange={(e) => setText(e.target.value)} placeholder="Enter prompt..." autoFocus className={styles.input} aria-label="Enter prompt" />
|
|
133
|
+
{showPersonaSelect && (
|
|
134
|
+
<select value={spawnPersonaId} onChange={(e) => setSpawnPersonaId(e.target.value)} className={styles.select} aria-label="Select persona">
|
|
135
|
+
<option value="">(Default)</option>
|
|
136
|
+
{personas.map((p) => (
|
|
137
|
+
<option key={p.id} value={p.id}>{p.name}</option>
|
|
138
|
+
))}
|
|
139
|
+
</select>
|
|
140
|
+
)}
|
|
141
|
+
<button type="submit" disabled={!text.trim() || !environmentId} className={styles.btnPrimary}>Go</button>
|
|
142
|
+
</form>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// --- start mode ---
|
|
147
|
+
if (mode === "start") {
|
|
148
|
+
return (
|
|
149
|
+
<form onSubmit={handleSubmit} className={styles.bar}>
|
|
150
|
+
<input type="text" value={text} onChange={(e) => setText(e.target.value)} placeholder="Type a message..." autoFocus className={styles.input} aria-label="Type a message" />
|
|
151
|
+
<button type="submit" disabled={!text.trim()} className={styles.btnPrimary}>Send</button>
|
|
152
|
+
</form>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// --- send mode ---
|
|
157
|
+
return (
|
|
158
|
+
<form onSubmit={handleSubmit} className={styles.bar}>
|
|
159
|
+
{envDisconnected && environmentId && (
|
|
160
|
+
<DisconnectedBanner environmentId={environmentId} onReconnect={onProvisionEnvironment} />
|
|
161
|
+
)}
|
|
162
|
+
<input type="text" value={text} onChange={(e) => setText(e.target.value)} placeholder="Type a message..." autoFocus={!envDisconnected} disabled={envDisconnected} className={styles.input} aria-label="Type a message" />
|
|
163
|
+
<span title={envDisconnected ? "Environment is unavailable — reconnect first" : undefined}>
|
|
164
|
+
<button type="submit" disabled={!text.trim() || envDisconnected} className={styles.btnPrimary}>Send</button>
|
|
165
|
+
</span>
|
|
166
|
+
</form>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
@use '../../styles/mixins' as *;
|
|
2
|
+
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// DAG View — React Flow dark theme overrides and task node styles
|
|
5
|
+
// =============================================================================
|
|
6
|
+
|
|
7
|
+
.dagContainer {
|
|
8
|
+
flex: 1;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
|
|
12
|
+
// React Flow theme overrides
|
|
13
|
+
--xy-background-color: transparent;
|
|
14
|
+
--xy-node-border-radius: var(--radius-lg);
|
|
15
|
+
--xy-edge-stroke: var(--text-tertiary);
|
|
16
|
+
--xy-minimap-background: var(--bg-inset);
|
|
17
|
+
--xy-minimap-mask-background: var(--bg-overlay);
|
|
18
|
+
--xy-controls-button-background-color: var(--bg-elevated);
|
|
19
|
+
--xy-controls-button-background-color-hover: var(--bg-overlay);
|
|
20
|
+
--xy-controls-button-color: var(--text-secondary);
|
|
21
|
+
--xy-controls-button-color-hover: var(--text-primary);
|
|
22
|
+
--xy-controls-button-border-color: var(--border-subtle);
|
|
23
|
+
--xy-attribution-background-color: transparent;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.emptyDag {
|
|
27
|
+
flex: 1;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
color: var(--text-tertiary);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// =============================================================================
|
|
35
|
+
// Task Node
|
|
36
|
+
// =============================================================================
|
|
37
|
+
|
|
38
|
+
.taskNode {
|
|
39
|
+
@include surface-card;
|
|
40
|
+
width: 220px;
|
|
41
|
+
min-height: 60px;
|
|
42
|
+
display: flex;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
@include card-hover;
|
|
46
|
+
|
|
47
|
+
@include mobile {
|
|
48
|
+
width: 160px;
|
|
49
|
+
min-height: 48px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.taskNodeBorder {
|
|
54
|
+
width: 4px;
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
border-radius: var(--radius-md) 0 0 var(--radius-md);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.taskNodeContent {
|
|
60
|
+
flex: 1;
|
|
61
|
+
padding: var(--space-sm) var(--space-md);
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
gap: var(--space-xs);
|
|
66
|
+
min-width: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.taskNodeHeader {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: var(--space-sm);
|
|
73
|
+
min-width: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.taskNodeIcon {
|
|
77
|
+
font-size: var(--font-size-sm);
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.taskNodeTitle {
|
|
82
|
+
font-size: var(--font-size-sm);
|
|
83
|
+
color: var(--text-primary);
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
text-overflow: ellipsis;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.taskNodeBadges {
|
|
90
|
+
display: flex;
|
|
91
|
+
gap: var(--space-xs);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.childBadge {
|
|
95
|
+
@include surface-inset;
|
|
96
|
+
font-size: var(--font-size-xs);
|
|
97
|
+
color: var(--text-secondary);
|
|
98
|
+
padding: 1px var(--space-xs);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.depBadge {
|
|
102
|
+
@include surface-inset;
|
|
103
|
+
font-size: var(--font-size-xs);
|
|
104
|
+
color: var(--accent-yellow);
|
|
105
|
+
padding: 1px var(--space-xs);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// =============================================================================
|
|
109
|
+
// Handles
|
|
110
|
+
// =============================================================================
|
|
111
|
+
|
|
112
|
+
.handle {
|
|
113
|
+
width: 6px !important;
|
|
114
|
+
height: 6px !important;
|
|
115
|
+
background: var(--text-tertiary) !important;
|
|
116
|
+
border: 1px solid var(--border-subtle) !important;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// =============================================================================
|
|
120
|
+
// MiniMap node colors (set via nodeColor callback, not CSS)
|
|
121
|
+
// =============================================================================
|
|
122
|
+
|
|
123
|
+
// ---------------------------------------------------------------------------
|
|
124
|
+
// Empty state CTA
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
|
|
127
|
+
.emptyCta {
|
|
128
|
+
flex: 1;
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
gap: var(--space-md);
|
|
134
|
+
padding: var(--space-xl);
|
|
135
|
+
text-align: center;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ctaDescription {
|
|
139
|
+
font-size: var(--font-size-sm);
|
|
140
|
+
color: var(--text-tertiary);
|
|
141
|
+
max-width: 280px;
|
|
142
|
+
line-height: var(--line-height);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ctaButton {
|
|
146
|
+
@include btn-primary;
|
|
147
|
+
padding: var(--space-sm) var(--space-xl);
|
|
148
|
+
font-size: var(--font-size-md);
|
|
149
|
+
}
|