@polderlabs/bizar 7.0.2 → 8.0.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.
- package/.claude/settings.local.json +8 -0
- package/bizar-dash/DESIGN.md +729 -969
- package/bizar-dash/GLYPH.md +418 -0
- package/bizar-dash/PLAN.md +1135 -0
- package/bizar-dash/dist/assets/ActivityFeed-BRBtQOHB.js +6 -0
- package/bizar-dash/dist/assets/ActivityFeed-BRBtQOHB.js.map +1 -0
- package/bizar-dash/dist/assets/ActivityView-CwqhxBfh.js +1 -0
- package/bizar-dash/dist/assets/ActivityView-CwqhxBfh.js.map +1 -0
- package/bizar-dash/dist/assets/AgentActivity-6MxU-a9F.js +1 -0
- package/bizar-dash/dist/assets/AgentActivity-6MxU-a9F.js.map +1 -0
- package/bizar-dash/dist/assets/AgentsView-BYrOFdwl.js +8 -0
- package/bizar-dash/dist/assets/AgentsView-BYrOFdwl.js.map +1 -0
- package/bizar-dash/dist/assets/Badge-Cd61wsBa.js +1 -0
- package/bizar-dash/dist/assets/Badge-Cd61wsBa.js.map +1 -0
- package/bizar-dash/dist/assets/Card-C_bvqXdQ.js +1 -0
- package/bizar-dash/dist/assets/Card-C_bvqXdQ.js.map +1 -0
- package/bizar-dash/dist/assets/EmptyState-BWQuKnk9.js +1 -0
- package/bizar-dash/dist/assets/EmptyState-BWQuKnk9.js.map +1 -0
- package/bizar-dash/dist/assets/GoalsView-Dok0yt9S.js +11 -0
- package/bizar-dash/dist/assets/GoalsView-Dok0yt9S.js.map +1 -0
- package/bizar-dash/dist/assets/Grid-C62gCPqt.js +1 -0
- package/bizar-dash/dist/assets/Grid-C62gCPqt.js.map +1 -0
- package/bizar-dash/dist/assets/KanbanCard-CtTKP6ZX.js +21 -0
- package/bizar-dash/dist/assets/KanbanCard-CtTKP6ZX.js.map +1 -0
- package/bizar-dash/dist/assets/LibrariesView-BcyBQXiY.js +67 -0
- package/bizar-dash/dist/assets/LibrariesView-BcyBQXiY.js.map +1 -0
- package/bizar-dash/dist/assets/MemoryView-49wR4u-y.js +13 -0
- package/bizar-dash/dist/assets/MemoryView-49wR4u-y.js.map +1 -0
- package/bizar-dash/dist/assets/OverviewView-BtQ_UWYj.js +1 -0
- package/bizar-dash/dist/assets/OverviewView-BtQ_UWYj.js.map +1 -0
- package/bizar-dash/dist/assets/ProgressBar-CpvDeq9F.js +1 -0
- package/bizar-dash/dist/assets/ProgressBar-CpvDeq9F.js.map +1 -0
- package/bizar-dash/dist/assets/SettingsRow-DmIe5OUu.js +30 -0
- package/bizar-dash/dist/assets/SettingsRow-DmIe5OUu.js.map +1 -0
- package/bizar-dash/dist/assets/SettingsView-D1KmGWbi.js +48 -0
- package/bizar-dash/dist/assets/SettingsView-D1KmGWbi.js.map +1 -0
- package/bizar-dash/dist/assets/StatTile-BkIP32gG.js +11 -0
- package/bizar-dash/dist/assets/StatTile-BkIP32gG.js.map +1 -0
- package/bizar-dash/dist/assets/TasksView-Cba3GJ42.js +1 -0
- package/bizar-dash/dist/assets/TasksView-Cba3GJ42.js.map +1 -0
- package/bizar-dash/dist/assets/ViewHeader-D6c2cw1b.js +6 -0
- package/bizar-dash/dist/assets/ViewHeader-D6c2cw1b.js.map +1 -0
- package/bizar-dash/dist/assets/brain-DeoXNDE2.js +6 -0
- package/bizar-dash/dist/assets/brain-DeoXNDE2.js.map +1 -0
- package/bizar-dash/dist/assets/calendar-DRlQkGJc.js +6 -0
- package/bizar-dash/dist/assets/calendar-DRlQkGJc.js.map +1 -0
- package/bizar-dash/dist/assets/circle-check-DmYQ3vGp.js +6 -0
- package/bizar-dash/dist/assets/circle-check-DmYQ3vGp.js.map +1 -0
- package/bizar-dash/dist/assets/cmdk-BwN8hcKQ.js +80 -0
- package/bizar-dash/dist/assets/cmdk-BwN8hcKQ.js.map +1 -0
- package/bizar-dash/dist/assets/dnd-kit-DR2Qzzxk.js +5 -0
- package/bizar-dash/dist/assets/dnd-kit-DR2Qzzxk.js.map +1 -0
- package/bizar-dash/dist/assets/git-merge-OoqBKQer.js +6 -0
- package/bizar-dash/dist/assets/git-merge-OoqBKQer.js.map +1 -0
- package/bizar-dash/dist/assets/git-pull-request-CXBQTR2f.js +6 -0
- package/bizar-dash/dist/assets/git-pull-request-CXBQTR2f.js.map +1 -0
- package/bizar-dash/dist/assets/main-COdgjqbZ.css +1 -0
- package/bizar-dash/dist/assets/main-Cw6gybzS.js +109 -0
- package/bizar-dash/dist/assets/main-Cw6gybzS.js.map +1 -0
- package/bizar-dash/dist/assets/message-square-DUTeIQAR.js +6 -0
- package/bizar-dash/dist/assets/message-square-DUTeIQAR.js.map +1 -0
- package/bizar-dash/dist/assets/minus-CrStJTZ7.js +6 -0
- package/bizar-dash/dist/assets/minus-CrStJTZ7.js.map +1 -0
- package/bizar-dash/dist/assets/wrench-BJ1WIC4u.js +6 -0
- package/bizar-dash/dist/assets/wrench-BJ1WIC4u.js.map +1 -0
- package/bizar-dash/dist/{mobile.html → v8.html} +6 -9
- package/bizar-dash/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/bizar-dash/src/server/server.mjs +1 -57
- package/bizar-dash/src/web/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/bizar-dash/src/web/v8/App.tsx +188 -0
- package/bizar-dash/src/web/v8/__tests__/App.test.tsx +102 -0
- package/bizar-dash/src/web/v8/__tests__/AppShell.test.tsx +79 -0
- package/bizar-dash/src/web/v8/__tests__/PageSkeleton.test.tsx +12 -0
- package/bizar-dash/src/web/v8/__tests__/SettingsView.test.tsx +84 -0
- package/bizar-dash/src/web/v8/__tests__/Sidebar.test.tsx +95 -0
- package/bizar-dash/src/web/v8/__tests__/activity.test.tsx +63 -0
- package/bizar-dash/src/web/v8/__tests__/agents.test.tsx +90 -0
- package/bizar-dash/src/web/v8/__tests__/controls.test.tsx +135 -0
- package/bizar-dash/src/web/v8/__tests__/cx.test.ts +25 -0
- package/bizar-dash/src/web/v8/__tests__/data.test.tsx +293 -0
- package/bizar-dash/src/web/v8/__tests__/feedback.test.tsx +213 -0
- package/bizar-dash/src/web/v8/__tests__/goals.test.tsx +105 -0
- package/bizar-dash/src/web/v8/__tests__/kanban.test.tsx +176 -0
- package/bizar-dash/src/web/v8/__tests__/libraries.test.tsx +70 -0
- package/bizar-dash/src/web/v8/__tests__/memory.test.tsx +60 -0
- package/bizar-dash/src/web/v8/__tests__/navigation.test.tsx +137 -0
- package/bizar-dash/src/web/v8/__tests__/settings.test.tsx +104 -0
- package/bizar-dash/src/web/v8/__tests__/theme.test.tsx +98 -0
- package/bizar-dash/src/web/v8/__tests__/views.test.tsx +112 -0
- package/bizar-dash/src/web/v8/main.tsx +28 -0
- package/bizar-dash/src/web/v8/shell/AppShell.tsx +90 -0
- package/bizar-dash/src/web/v8/shell/PageSkeleton.tsx +29 -0
- package/bizar-dash/src/web/v8/shell/Sidebar.tsx +361 -0
- package/bizar-dash/src/web/v8/shell/StatusBar.tsx +63 -0
- package/bizar-dash/src/web/v8/shell/Topbar.tsx +113 -0
- package/bizar-dash/src/web/v8/shell/index.ts +15 -0
- package/bizar-dash/src/web/v8/ui/activity/ActivityFeed.tsx +137 -0
- package/bizar-dash/src/web/v8/ui/agents/AgentActivity.tsx +101 -0
- package/bizar-dash/src/web/v8/ui/agents/AgentCard.tsx +158 -0
- package/bizar-dash/src/web/v8/ui/controls/Button.tsx +141 -0
- package/bizar-dash/src/web/v8/ui/controls/ButtonGroup.tsx +32 -0
- package/bizar-dash/src/web/v8/ui/controls/Checkbox.tsx +49 -0
- package/bizar-dash/src/web/v8/ui/controls/Field.tsx +78 -0
- package/bizar-dash/src/web/v8/ui/controls/Form.tsx +23 -0
- package/bizar-dash/src/web/v8/ui/controls/IconButton.tsx +112 -0
- package/bizar-dash/src/web/v8/ui/controls/Input.tsx +94 -0
- package/bizar-dash/src/web/v8/ui/controls/RadioGroup.tsx +74 -0
- package/bizar-dash/src/web/v8/ui/controls/Select.tsx +171 -0
- package/bizar-dash/src/web/v8/ui/controls/Slider.tsx +68 -0
- package/bizar-dash/src/web/v8/ui/controls/Switch.tsx +56 -0
- package/bizar-dash/src/web/v8/ui/controls/Textarea.tsx +64 -0
- package/bizar-dash/src/web/v8/ui/controls/Toggle.tsx +36 -0
- package/bizar-dash/src/web/v8/ui/controls/ToggleGroup.tsx +85 -0
- package/bizar-dash/src/web/v8/ui/data/Accordion.tsx +134 -0
- package/bizar-dash/src/web/v8/ui/data/Avatar.tsx +175 -0
- package/bizar-dash/src/web/v8/ui/data/Badge.tsx +93 -0
- package/bizar-dash/src/web/v8/ui/data/BarList.tsx +101 -0
- package/bizar-dash/src/web/v8/ui/data/Card.tsx +140 -0
- package/bizar-dash/src/web/v8/ui/data/Chip.tsx +96 -0
- package/bizar-dash/src/web/v8/ui/data/Kbd.tsx +42 -0
- package/bizar-dash/src/web/v8/ui/data/ProgressBar.tsx +93 -0
- package/bizar-dash/src/web/v8/ui/data/Sparkline.tsx +98 -0
- package/bizar-dash/src/web/v8/ui/data/StatTile.tsx +150 -0
- package/bizar-dash/src/web/v8/ui/data/Table.tsx +170 -0
- package/bizar-dash/src/web/v8/ui/data/Timeline.tsx +130 -0
- package/bizar-dash/src/web/v8/ui/data/ViewHeader.tsx +122 -0
- package/bizar-dash/src/web/v8/ui/feedback/Alert.tsx +95 -0
- package/bizar-dash/src/web/v8/ui/feedback/Banner.tsx +39 -0
- package/bizar-dash/src/web/v8/ui/feedback/ContextMenu.tsx +143 -0
- package/bizar-dash/src/web/v8/ui/feedback/Dialog.tsx +149 -0
- package/bizar-dash/src/web/v8/ui/feedback/Drawer.tsx +8 -0
- package/bizar-dash/src/web/v8/ui/feedback/DropdownMenu.tsx +231 -0
- package/bizar-dash/src/web/v8/ui/feedback/EmptyState.tsx +48 -0
- package/bizar-dash/src/web/v8/ui/feedback/Popover.tsx +56 -0
- package/bizar-dash/src/web/v8/ui/feedback/Sheet.tsx +103 -0
- package/bizar-dash/src/web/v8/ui/feedback/Skeleton.tsx +67 -0
- package/bizar-dash/src/web/v8/ui/feedback/Spinner.tsx +30 -0
- package/bizar-dash/src/web/v8/ui/feedback/Toast.tsx +66 -0
- package/bizar-dash/src/web/v8/ui/feedback/Tooltip.tsx +89 -0
- package/bizar-dash/src/web/v8/ui/goals/GoalCard.tsx +176 -0
- package/bizar-dash/src/web/v8/ui/goals/KeyResult.tsx +115 -0
- package/bizar-dash/src/web/v8/ui/index.ts +322 -0
- package/bizar-dash/src/web/v8/ui/kanban/KanbanBoard.tsx +80 -0
- package/bizar-dash/src/web/v8/ui/kanban/KanbanCard.tsx +247 -0
- package/bizar-dash/src/web/v8/ui/kanban/KanbanColumn.tsx +181 -0
- package/bizar-dash/src/web/v8/ui/kanban/KanbanContextMenu.tsx +122 -0
- package/bizar-dash/src/web/v8/ui/kanban/KanbanQuickAdd.tsx +141 -0
- package/bizar-dash/src/web/v8/ui/libraries/LibraryGrid.tsx +30 -0
- package/bizar-dash/src/web/v8/ui/libraries/LibraryItem.tsx +161 -0
- package/bizar-dash/src/web/v8/ui/memory/MemoryVault.tsx +144 -0
- package/bizar-dash/src/web/v8/ui/navigation/CommandPalette.tsx +224 -0
- package/bizar-dash/src/web/v8/ui/navigation/NavLink.tsx +81 -0
- package/bizar-dash/src/web/v8/ui/navigation/Pagination.tsx +164 -0
- package/bizar-dash/src/web/v8/ui/navigation/Tabs.tsx +128 -0
- package/bizar-dash/src/web/v8/ui/navigation/useCommandPaletteHotkey.test.ts +79 -0
- package/bizar-dash/src/web/v8/ui/primitives/Box.tsx +144 -0
- package/bizar-dash/src/web/v8/ui/primitives/Center.tsx +40 -0
- package/bizar-dash/src/web/v8/ui/primitives/Cluster.tsx +67 -0
- package/bizar-dash/src/web/v8/ui/primitives/Grid.tsx +104 -0
- package/bizar-dash/src/web/v8/ui/primitives/Inline.tsx +77 -0
- package/bizar-dash/src/web/v8/ui/primitives/Portal.tsx +33 -0
- package/bizar-dash/src/web/v8/ui/primitives/ScrollArea.tsx +62 -0
- package/bizar-dash/src/web/v8/ui/primitives/Separator.tsx +42 -0
- package/bizar-dash/src/web/v8/ui/primitives/Stack.tsx +73 -0
- package/bizar-dash/src/web/v8/ui/primitives/VisuallyHidden.tsx +49 -0
- package/bizar-dash/src/web/v8/ui/settings/SettingsNav.tsx +91 -0
- package/bizar-dash/src/web/v8/ui/settings/SettingsRow.tsx +88 -0
- package/bizar-dash/src/web/v8/ui/settings/SettingsSection.tsx +109 -0
- package/bizar-dash/src/web/v8/ui/styles/globals.css +220 -0
- package/bizar-dash/src/web/v8/ui/styles/reset.css +57 -0
- package/bizar-dash/src/web/v8/ui/styles/tokens.css +217 -0
- package/bizar-dash/src/web/v8/ui/theme/DensityProvider.test.tsx +74 -0
- package/bizar-dash/src/web/v8/ui/theme/DensityProvider.tsx +66 -0
- package/bizar-dash/src/web/v8/ui/theme/ThemeProvider.test.tsx +86 -0
- package/bizar-dash/src/web/v8/ui/theme/ThemeProvider.tsx +94 -0
- package/bizar-dash/src/web/v8/ui/theme/ThemeToggle.tsx +88 -0
- package/bizar-dash/src/web/v8/ui/theme/useDensity.ts +15 -0
- package/bizar-dash/src/web/v8/ui/theme/useTheme.ts +16 -0
- package/bizar-dash/src/web/v8/ui/utils/cx.ts +19 -0
- package/bizar-dash/src/web/v8/views/Activity/ActivityView.tsx +33 -0
- package/bizar-dash/src/web/v8/views/Agents/AgentsView.tsx +108 -0
- package/bizar-dash/src/web/v8/views/CommandPalette/AppCommandPalette.test.tsx +142 -0
- package/bizar-dash/src/web/v8/views/CommandPalette/AppCommandPalette.tsx +144 -0
- package/bizar-dash/src/web/v8/views/Goals/GoalsView.tsx +84 -0
- package/bizar-dash/src/web/v8/views/Libraries/LibrariesView.tsx +41 -0
- package/bizar-dash/src/web/v8/views/Memory/MemoryView.tsx +61 -0
- package/bizar-dash/src/web/v8/views/Overview/OverviewView.tsx +92 -0
- package/bizar-dash/src/web/v8/views/Router.tsx +96 -0
- package/bizar-dash/src/web/v8/views/Settings/SettingsView.tsx +305 -0
- package/bizar-dash/src/web/v8/views/Tasks/CommandPalettePlaceholder.tsx +106 -0
- package/bizar-dash/src/web/v8/views/Tasks/TasksKanbanPlaceholder.tsx +62 -0
- package/bizar-dash/src/web/v8/views/Tasks/TasksView.tsx +74 -0
- package/bizar-dash/src/web/v8/vite-env.d.ts +15 -0
- package/bizar-dash/src/web/{mobile.html → v8.html} +4 -7
- package/bizar-dash/tests/settings-layout.test.tsx +2 -2
- package/bizar-dash/tests/settings-nav.test.tsx +6 -6
- package/bizar-dash/tests/setup.ts +26 -0
- package/bizar-dash/vite.config.ts +26 -2
- package/bizar-dash/vitest.config.ts +5 -3
- package/cli/provision-claude.mjs +108 -5
- package/package.json +36 -3
- package/bizar-dash/dist/assets/EnvVarsSection-BfhAz3ax.js +0 -114
- package/bizar-dash/dist/assets/EnvVarsSection-BfhAz3ax.js.map +0 -1
- package/bizar-dash/dist/assets/MobileChat-DLWdv6tQ.js +0 -1
- package/bizar-dash/dist/assets/MobileChat-DLWdv6tQ.js.map +0 -1
- package/bizar-dash/dist/assets/MobileSettings-Bxv62uPY.js +0 -1
- package/bizar-dash/dist/assets/MobileSettings-Bxv62uPY.js.map +0 -1
- package/bizar-dash/dist/assets/Toast-ATSAmbdi.js +0 -26
- package/bizar-dash/dist/assets/Toast-ATSAmbdi.js.map +0 -1
- package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js +0 -1
- package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js.map +0 -1
- package/bizar-dash/dist/assets/main-306CZfn6.js +0 -430
- package/bizar-dash/dist/assets/main-306CZfn6.js.map +0 -1
- package/bizar-dash/dist/assets/main-G3bNDpY3.css +0 -1
- package/bizar-dash/dist/assets/mobile-C_naUN91.js +0 -1
- package/bizar-dash/dist/assets/mobile-C_naUN91.js.map +0 -1
- package/bizar-dash/dist/assets/mobile-layout-BWLtwtfQ.css +0 -1
- package/bizar-dash/dist/assets/mobile-layout-GZ3bE8L6.js +0 -211
- package/bizar-dash/dist/assets/mobile-layout-GZ3bE8L6.js.map +0 -1
- package/bizar-dash/dist/assets/useSlashCommands-BOwD7lNb.js +0 -65
- package/bizar-dash/dist/assets/useSlashCommands-BOwD7lNb.js.map +0 -1
- package/bizar-dash/dist/index.html +0 -43
- package/bizar-dash/src/web/App.tsx +0 -915
- package/bizar-dash/src/web/MobileApp.tsx +0 -414
- package/bizar-dash/src/web/components/ArtifactCreateDialog.tsx +0 -95
- package/bizar-dash/src/web/components/ArtifactListDialog.tsx +0 -55
- package/bizar-dash/src/web/components/ArtifactViewer.tsx +0 -144
- package/bizar-dash/src/web/components/AuditDialog.tsx +0 -79
- package/bizar-dash/src/web/components/AutosaveField.tsx +0 -50
- package/bizar-dash/src/web/components/BackupRestore.tsx +0 -330
- package/bizar-dash/src/web/components/BgStatusBadge.tsx +0 -32
- package/bizar-dash/src/web/components/Button.tsx +0 -56
- package/bizar-dash/src/web/components/CanvasContextMenu.tsx +0 -68
- package/bizar-dash/src/web/components/Card.tsx +0 -40
- package/bizar-dash/src/web/components/CollapsibleSection.tsx +0 -72
- package/bizar-dash/src/web/components/CommandDialog.tsx +0 -66
- package/bizar-dash/src/web/components/DoctorPanel.tsx +0 -160
- package/bizar-dash/src/web/components/EmptyState.tsx +0 -30
- package/bizar-dash/src/web/components/EnvVarManager.tsx +0 -430
- package/bizar-dash/src/web/components/EvalDiff.tsx +0 -157
- package/bizar-dash/src/web/components/EvalExportButton.tsx +0 -27
- package/bizar-dash/src/web/components/EvalRunCard.tsx +0 -78
- package/bizar-dash/src/web/components/FileBrowser.tsx +0 -633
- package/bizar-dash/src/web/components/HeadroomSettings.tsx +0 -418
- package/bizar-dash/src/web/components/HeadroomStatus.tsx +0 -158
- package/bizar-dash/src/web/components/HelpDialog.tsx +0 -55
- package/bizar-dash/src/web/components/InviteDialog.tsx +0 -205
- package/bizar-dash/src/web/components/KillConfirmDialog.tsx +0 -88
- package/bizar-dash/src/web/components/MobileBottomNav.tsx +0 -38
- package/bizar-dash/src/web/components/MobileDrawer.tsx +0 -68
- package/bizar-dash/src/web/components/MobileHeader.tsx +0 -50
- package/bizar-dash/src/web/components/MobileLayout.tsx +0 -63
- package/bizar-dash/src/web/components/Modal.tsx +0 -215
- package/bizar-dash/src/web/components/Notifications.tsx +0 -242
- package/bizar-dash/src/web/components/ScheduleTemplateCard.tsx +0 -72
- package/bizar-dash/src/web/components/ScreenshotCapture.tsx +0 -138
- package/bizar-dash/src/web/components/ScreenshotOCR.tsx +0 -42
- package/bizar-dash/src/web/components/SearchModal.tsx +0 -227
- package/bizar-dash/src/web/components/SettingsNav.tsx +0 -112
- package/bizar-dash/src/web/components/SettingsSearch.tsx +0 -328
- package/bizar-dash/src/web/components/Sidebar.tsx +0 -89
- package/bizar-dash/src/web/components/Spinner.tsx +0 -19
- package/bizar-dash/src/web/components/StatusBadge.tsx +0 -56
- package/bizar-dash/src/web/components/Tag.tsx +0 -41
- package/bizar-dash/src/web/components/TailscaleSettings.tsx +0 -161
- package/bizar-dash/src/web/components/TaskCard.tsx +0 -69
- package/bizar-dash/src/web/components/TaskCreateSheet.tsx +0 -76
- package/bizar-dash/src/web/components/Toast.tsx +0 -150
- package/bizar-dash/src/web/components/Toggle.tsx +0 -31
- package/bizar-dash/src/web/components/Topbar.tsx +0 -410
- package/bizar-dash/src/web/components/UsageChart.tsx +0 -250
- package/bizar-dash/src/web/components/UsageTable.tsx +0 -90
- package/bizar-dash/src/web/components/VirtualList.tsx +0 -53
- package/bizar-dash/src/web/components/VisualPlanDialog.tsx +0 -58
- package/bizar-dash/src/web/components/VoiceNotesPanel.tsx +0 -211
- package/bizar-dash/src/web/components/VoiceRecorder.tsx +0 -105
- package/bizar-dash/src/web/components/WorkspaceSelector.tsx +0 -158
- package/bizar-dash/src/web/components/agents/CommunicationLog.tsx +0 -126
- package/bizar-dash/src/web/components/agents/DependencyGraph.tsx +0 -163
- package/bizar-dash/src/web/components/agents/QualityGates.tsx +0 -123
- package/bizar-dash/src/web/components/agents/RealTimeEventLog.tsx +0 -127
- package/bizar-dash/src/web/components/agents/RoutingDecisions.test.tsx +0 -148
- package/bizar-dash/src/web/components/agents/RoutingDecisions.tsx +0 -160
- package/bizar-dash/src/web/components/background/AttachButton.tsx +0 -96
- package/bizar-dash/src/web/components/background/TmuxAttachCard.tsx +0 -122
- package/bizar-dash/src/web/components/chat/AgentChip.tsx +0 -68
- package/bizar-dash/src/web/components/chat/AgentNode.tsx +0 -127
- package/bizar-dash/src/web/components/chat/AgentTree.tsx +0 -80
- package/bizar-dash/src/web/components/chat/ChatBubble.tsx +0 -60
- package/bizar-dash/src/web/components/chat/ChatComposer.tsx +0 -72
- package/bizar-dash/src/web/components/chat/ChatInfoPanel.tsx +0 -370
- package/bizar-dash/src/web/components/chat/ChatRail.tsx +0 -387
- package/bizar-dash/src/web/components/chat/ChatThread.tsx +0 -127
- package/bizar-dash/src/web/components/chat/ChatTopBar.tsx +0 -50
- package/bizar-dash/src/web/components/chat/Composer.tsx +0 -166
- package/bizar-dash/src/web/components/chat/ConfirmModal.tsx +0 -54
- package/bizar-dash/src/web/components/chat/EmptyState.tsx +0 -21
- package/bizar-dash/src/web/components/chat/FirstRunGreeting.tsx +0 -18
- package/bizar-dash/src/web/components/chat/FloatingComposer.tsx +0 -38
- package/bizar-dash/src/web/components/chat/InfoPanel.tsx +0 -184
- package/bizar-dash/src/web/components/chat/JumpToLatest.tsx +0 -58
- package/bizar-dash/src/web/components/chat/LoadingSkeleton.tsx +0 -19
- package/bizar-dash/src/web/components/chat/MessageBlock.tsx +0 -260
- package/bizar-dash/src/web/components/chat/MessageBubble.tsx +0 -60
- package/bizar-dash/src/web/components/chat/SessionList.tsx +0 -163
- package/bizar-dash/src/web/components/chat/SessionRowMenu.tsx +0 -206
- package/bizar-dash/src/web/components/chat/StreamingIndicator.tsx +0 -37
- package/bizar-dash/src/web/components/chat/SuggestionCards.tsx +0 -55
- package/bizar-dash/src/web/components/chat/WelcomeScreen.tsx +0 -36
- package/bizar-dash/src/web/components/chat/_legacy.ts +0 -30
- package/bizar-dash/src/web/components/chat/index.ts +0 -31
- package/bizar-dash/src/web/components/chat/useAutoGrowTextarea.ts +0 -18
- package/bizar-dash/src/web/components/chat/useChat.ts +0 -1190
- package/bizar-dash/src/web/components/chat/useSlashCommands.ts +0 -47
- package/bizar-dash/src/web/components/goals/GoalInput.tsx +0 -86
- package/bizar-dash/src/web/components/goals/PlanVisualization.tsx +0 -111
- package/bizar-dash/src/web/components/tasks/BacklogPanel.css +0 -109
- package/bizar-dash/src/web/components/tasks/BacklogPanel.tsx +0 -209
- package/bizar-dash/src/web/hooks/useAutosave.ts +0 -107
- package/bizar-dash/src/web/hooks/useI18n.ts +0 -13
- package/bizar-dash/src/web/index.html +0 -37
- package/bizar-dash/src/web/lib/api.ts +0 -237
- package/bizar-dash/src/web/lib/goapPlanner.ts +0 -614
- package/bizar-dash/src/web/lib/i18n.ts +0 -25
- package/bizar-dash/src/web/lib/logger.ts +0 -30
- package/bizar-dash/src/web/lib/markdown.tsx +0 -59
- package/bizar-dash/src/web/lib/search.ts +0 -115
- package/bizar-dash/src/web/lib/types.ts +0 -894
- package/bizar-dash/src/web/lib/utils.ts +0 -114
- package/bizar-dash/src/web/lib/ws.ts +0 -177
- package/bizar-dash/src/web/locales/en.json +0 -52
- package/bizar-dash/src/web/main.tsx +0 -43
- package/bizar-dash/src/web/mobile/MobileApp.tsx +0 -309
- package/bizar-dash/src/web/mobile/MobileBottomNav.tsx +0 -38
- package/bizar-dash/src/web/mobile/MobileChat.tsx +0 -138
- package/bizar-dash/src/web/mobile/MobileDoctor.tsx +0 -80
- package/bizar-dash/src/web/mobile/MobileEval.tsx +0 -167
- package/bizar-dash/src/web/mobile/MobileMemory.tsx +0 -108
- package/bizar-dash/src/web/mobile/MobileOverview.tsx +0 -213
- package/bizar-dash/src/web/mobile/MobileSettings.tsx +0 -251
- package/bizar-dash/src/web/mobile/MobileTasks.tsx +0 -94
- package/bizar-dash/src/web/mobile/MobileTopbar.tsx +0 -115
- package/bizar-dash/src/web/mobile/components/MobileBottomSheet.tsx +0 -182
- package/bizar-dash/src/web/mobile/components/MobileListItem.tsx +0 -64
- package/bizar-dash/src/web/mobile/components/MobileModal.tsx +0 -123
- package/bizar-dash/src/web/mobile/views/MobileActivity.tsx +0 -273
- package/bizar-dash/src/web/mobile/views/MobileAgents.tsx +0 -374
- package/bizar-dash/src/web/mobile/views/MobileArtifactCanvas.tsx +0 -439
- package/bizar-dash/src/web/mobile/views/MobileArtifacts.tsx +0 -143
- package/bizar-dash/src/web/mobile/views/MobileChat.tsx +0 -257
- package/bizar-dash/src/web/mobile/views/MobileConfig.tsx +0 -175
- package/bizar-dash/src/web/mobile/views/MobileHistory.tsx +0 -191
- package/bizar-dash/src/web/mobile/views/MobileMods.tsx +0 -149
- package/bizar-dash/src/web/mobile/views/MobileMore.tsx +0 -121
- package/bizar-dash/src/web/mobile/views/MobileNotifications.tsx +0 -137
- package/bizar-dash/src/web/mobile/views/MobilePlans.tsx +0 -26
- package/bizar-dash/src/web/mobile/views/MobileSchedules.tsx +0 -685
- package/bizar-dash/src/web/mobile/views/MobileSearchModal.tsx +0 -172
- package/bizar-dash/src/web/mobile/views/MobileSettings.tsx +0 -363
- package/bizar-dash/src/web/mobile/views/MobileSkills.tsx +0 -153
- package/bizar-dash/src/web/mobile/views/MobileTasks.tsx +0 -564
- package/bizar-dash/src/web/mobile/views/QrCodePanel.tsx +0 -69
- package/bizar-dash/src/web/mobile.tsx +0 -14
- package/bizar-dash/src/web/styles/agents-redesign.css +0 -311
- package/bizar-dash/src/web/styles/chat.css +0 -1740
- package/bizar-dash/src/web/styles/glyphs.css +0 -960
- package/bizar-dash/src/web/styles/main.css +0 -10391
- package/bizar-dash/src/web/styles/memory.css +0 -1182
- package/bizar-dash/src/web/styles/minimax-usage.css +0 -842
- package/bizar-dash/src/web/styles/mobile-chat.css +0 -5
- package/bizar-dash/src/web/styles/mobile-layout.css +0 -233
- package/bizar-dash/src/web/styles/mobile.css +0 -2181
- package/bizar-dash/src/web/styles/settings.css +0 -795
- package/bizar-dash/src/web/styles/skills.css +0 -302
- package/bizar-dash/src/web/styles/tasks-redesign.css +0 -253
- package/bizar-dash/src/web/styles/tasks.css +0 -605
- package/bizar-dash/src/web/ui/controls/Button.tsx +0 -77
- package/bizar-dash/src/web/ui/controls/Checkbox.tsx +0 -95
- package/bizar-dash/src/web/ui/controls/IconButton.tsx +0 -66
- package/bizar-dash/src/web/ui/controls/Kbd.tsx +0 -24
- package/bizar-dash/src/web/ui/controls/NumberInput.tsx +0 -77
- package/bizar-dash/src/web/ui/controls/RadioGroup.tsx +0 -109
- package/bizar-dash/src/web/ui/controls/SearchInput.tsx +0 -91
- package/bizar-dash/src/web/ui/controls/Select.tsx +0 -92
- package/bizar-dash/src/web/ui/controls/Slider.tsx +0 -70
- package/bizar-dash/src/web/ui/controls/TextInput.tsx +0 -67
- package/bizar-dash/src/web/ui/controls/Textarea.tsx +0 -56
- package/bizar-dash/src/web/ui/controls/Toggle.tsx +0 -79
- package/bizar-dash/src/web/ui/controls/controls.css +0 -476
- package/bizar-dash/src/web/ui/controls/index.ts +0 -35
- package/bizar-dash/src/web/ui/data/BarChart.tsx +0 -60
- package/bizar-dash/src/web/ui/data/DataTable.tsx +0 -216
- package/bizar-dash/src/web/ui/data/EmptyState.tsx +0 -60
- package/bizar-dash/src/web/ui/data/ErrorState.tsx +0 -56
- package/bizar-dash/src/web/ui/data/KeyValueList.tsx +0 -106
- package/bizar-dash/src/web/ui/data/LoadingState.tsx +0 -65
- package/bizar-dash/src/web/ui/data/Sparkline.tsx +0 -87
- package/bizar-dash/src/web/ui/data/StatTile.tsx +0 -87
- package/bizar-dash/src/web/ui/data/data.css +0 -535
- package/bizar-dash/src/web/ui/data/index.ts +0 -31
- package/bizar-dash/src/web/ui/feedback/Badge.tsx +0 -49
- package/bizar-dash/src/web/ui/feedback/Dialog.tsx +0 -209
- package/bizar-dash/src/web/ui/feedback/ProgressBar.tsx +0 -69
- package/bizar-dash/src/web/ui/feedback/StatusDot.tsx +0 -50
- package/bizar-dash/src/web/ui/feedback/Toast.tsx +0 -200
- package/bizar-dash/src/web/ui/feedback/Tooltip.tsx +0 -126
- package/bizar-dash/src/web/ui/feedback/feedback.css +0 -314
- package/bizar-dash/src/web/ui/feedback/index.ts +0 -43
- package/bizar-dash/src/web/ui/index.ts +0 -56
- package/bizar-dash/src/web/ui/layout/AppShell.tsx +0 -51
- package/bizar-dash/src/web/ui/layout/Breadcrumbs.tsx +0 -97
- package/bizar-dash/src/web/ui/layout/Panel.tsx +0 -73
- package/bizar-dash/src/web/ui/layout/PanelHeader.tsx +0 -39
- package/bizar-dash/src/web/ui/layout/Sidebar.tsx +0 -131
- package/bizar-dash/src/web/ui/layout/Tabs.tsx +0 -133
- package/bizar-dash/src/web/ui/layout/Topbar.tsx +0 -42
- package/bizar-dash/src/web/ui/layout/ViewHeader.tsx +0 -48
- package/bizar-dash/src/web/ui/layout/index.ts +0 -34
- package/bizar-dash/src/web/ui/layout/layout.css +0 -464
- package/bizar-dash/src/web/ui/navigation/CommandPalette.tsx +0 -199
- package/bizar-dash/src/web/ui/navigation/NavGroup.tsx +0 -95
- package/bizar-dash/src/web/ui/navigation/NavLink.tsx +0 -93
- package/bizar-dash/src/web/ui/navigation/index.ts +0 -17
- package/bizar-dash/src/web/ui/navigation/navigation.css +0 -343
- package/bizar-dash/src/web/ui/primitives/Box.tsx +0 -91
- package/bizar-dash/src/web/ui/primitives/Grid.tsx +0 -49
- package/bizar-dash/src/web/ui/primitives/Inline.tsx +0 -55
- package/bizar-dash/src/web/ui/primitives/Separator.tsx +0 -46
- package/bizar-dash/src/web/ui/primitives/Stack.tsx +0 -54
- package/bizar-dash/src/web/ui/primitives/VisuallyHidden.tsx +0 -26
- package/bizar-dash/src/web/ui/primitives/index.ts +0 -23
- package/bizar-dash/src/web/ui/primitives/primitives.css +0 -183
- package/bizar-dash/src/web/ui/styles/globals.css +0 -86
- package/bizar-dash/src/web/ui/styles/reset.css +0 -125
- package/bizar-dash/src/web/ui/styles/tokens.css +0 -208
- package/bizar-dash/src/web/ui/theme/ThemeProvider.tsx +0 -142
- package/bizar-dash/src/web/ui/theme/tokens.ts +0 -131
- package/bizar-dash/src/web/ui/theme/useTheme.ts +0 -22
- package/bizar-dash/src/web/ui/utils/cx.ts +0 -42
- package/bizar-dash/src/web/views/Activity.tsx +0 -1221
- package/bizar-dash/src/web/views/Agents.tsx +0 -964
- package/bizar-dash/src/web/views/Artifacts.tsx +0 -1494
- package/bizar-dash/src/web/views/BackgroundAgents.tsx +0 -822
- package/bizar-dash/src/web/views/Chat.tsx +0 -532
- package/bizar-dash/src/web/views/Config.tsx +0 -3
- package/bizar-dash/src/web/views/Doctor.tsx +0 -317
- package/bizar-dash/src/web/views/Eval.tsx +0 -372
- package/bizar-dash/src/web/views/EvalReport.tsx +0 -353
- package/bizar-dash/src/web/views/GoalPlanner.tsx +0 -158
- package/bizar-dash/src/web/views/Harness.tsx +0 -306
- package/bizar-dash/src/web/views/History.tsx +0 -353
- package/bizar-dash/src/web/views/Memory.tsx +0 -161
- package/bizar-dash/src/web/views/MiniMaxUsage.tsx +0 -942
- package/bizar-dash/src/web/views/ModView.tsx +0 -207
- package/bizar-dash/src/web/views/Mods.tsx +0 -706
- package/bizar-dash/src/web/views/Overview.tsx +0 -1364
- package/bizar-dash/src/web/views/Providers.tsx +0 -302
- package/bizar-dash/src/web/views/Schedules.tsx +0 -902
- package/bizar-dash/src/web/views/Settings.tsx +0 -308
- package/bizar-dash/src/web/views/Skills.tsx +0 -383
- package/bizar-dash/src/web/views/SpawnAgentModal.tsx +0 -221
- package/bizar-dash/src/web/views/Tasks.tsx +0 -789
- package/bizar-dash/src/web/views/Workspace.tsx +0 -294
- package/bizar-dash/src/web/views/glyphs/GlyphRenderer.tsx +0 -844
- package/bizar-dash/src/web/views/glyphs/components.tsx +0 -1098
- package/bizar-dash/src/web/views/memory/ConfigPanel.tsx +0 -426
- package/bizar-dash/src/web/views/memory/FromScreenshotPanel.tsx +0 -23
- package/bizar-dash/src/web/views/memory/GitSyncPanel.tsx +0 -220
- package/bizar-dash/src/web/views/memory/LightragPanel.tsx +0 -310
- package/bizar-dash/src/web/views/memory/MemoryGraphLegend.tsx +0 -29
- package/bizar-dash/src/web/views/memory/MemoryGraphPanel.tsx +0 -192
- package/bizar-dash/src/web/views/memory/MemoryGraphView.tsx +0 -336
- package/bizar-dash/src/web/views/memory/MemoryOverview.tsx +0 -367
- package/bizar-dash/src/web/views/memory/MemoryStatusCard.tsx +0 -160
- package/bizar-dash/src/web/views/memory/ObsidianPanel.tsx +0 -650
- package/bizar-dash/src/web/views/memory/SemanticSearchPanel.tsx +0 -197
- package/bizar-dash/src/web/views/memory/VaultFromClipboardPanel.tsx +0 -101
- package/bizar-dash/src/web/views/settings/ActivitySection.tsx +0 -205
- package/bizar-dash/src/web/views/settings/AgentSection.tsx +0 -305
- package/bizar-dash/src/web/views/settings/AuthSection.tsx +0 -159
- package/bizar-dash/src/web/views/settings/EnvVarsSection.tsx +0 -15
- package/bizar-dash/src/web/views/settings/GeneralSection.tsx +0 -128
- package/bizar-dash/src/web/views/settings/HeadroomSection.tsx +0 -39
- package/bizar-dash/src/web/views/settings/MemorySection.tsx +0 -154
- package/bizar-dash/src/web/views/settings/NetworkSection.tsx +0 -87
- package/bizar-dash/src/web/views/settings/NotificationsSection.tsx +0 -34
- package/bizar-dash/src/web/views/settings/SystemLlmSection.tsx +0 -81
- package/bizar-dash/src/web/views/settings/ThemeSection.tsx +0 -168
- package/bizar-dash/src/web/views/settings/UpdatesSection.tsx +0 -256
- package/bizar-dash/src/web/views/settings/WorkspacesSection.tsx +0 -189
|
@@ -1,902 +0,0 @@
|
|
|
1
|
-
// src/views/Schedules.tsx — list, create, edit, run, delete schedules for the active project.
|
|
2
|
-
//
|
|
3
|
-
// v3.9.0 — overhauled with structured DOW/time/TZ pickers, a reusable
|
|
4
|
-
// ScheduleEditorModal that handles both create and edit, a human-readable
|
|
5
|
-
// schedule label on every card, and a timezone-aware next-run display.
|
|
6
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
Clock,
|
|
9
|
-
Plus,
|
|
10
|
-
PlayCircle,
|
|
11
|
-
Pencil,
|
|
12
|
-
Trash2,
|
|
13
|
-
RefreshCw,
|
|
14
|
-
History,
|
|
15
|
-
ChevronDown,
|
|
16
|
-
LayoutTemplate,
|
|
17
|
-
} from 'lucide-react';
|
|
18
|
-
import { Card, CardTitle, CardMeta } from '../components/Card';
|
|
19
|
-
import { Button } from '../components/Button';
|
|
20
|
-
import { EmptyState } from '../components/EmptyState';
|
|
21
|
-
import { Spinner } from '../components/Spinner';
|
|
22
|
-
import { useToast } from '../components/Toast';
|
|
23
|
-
import { useModal } from '../components/Modal';
|
|
24
|
-
import { api } from '../lib/api';
|
|
25
|
-
import { formatRelative } from '../lib/utils';
|
|
26
|
-
import type { Schedule, Settings, Snapshot } from '../lib/types';
|
|
27
|
-
import { ScheduleTemplateCard } from '../components/ScheduleTemplateCard';
|
|
28
|
-
import type { ScheduleTemplate } from '../components/ScheduleTemplateCard';
|
|
29
|
-
|
|
30
|
-
type Props = {
|
|
31
|
-
snapshot: Snapshot;
|
|
32
|
-
settings: Settings;
|
|
33
|
-
activeTab: string;
|
|
34
|
-
setActiveTab: (id: string) => void;
|
|
35
|
-
refreshSnapshot: () => Promise<void>;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const TYPES = ['interval', 'cron', 'once'] as const;
|
|
39
|
-
const ACTIONS = ['command', 'agent', 'webhook'] as const;
|
|
40
|
-
|
|
41
|
-
// v3.9.0 — Curated IANA timezone list. "Other…" lets the operator type
|
|
42
|
-
// any zone croner accepts (the backend passes the string through).
|
|
43
|
-
const TIMEZONES: Array<{ value: string; label: string }> = [
|
|
44
|
-
{ value: 'UTC', label: 'UTC' },
|
|
45
|
-
{ value: 'America/New_York', label: 'America/New_York (ET)' },
|
|
46
|
-
{ value: 'America/Los_Angeles', label: 'America/Los_Angeles (PT)' },
|
|
47
|
-
{ value: 'America/Chicago', label: 'America/Chicago (CT)' },
|
|
48
|
-
{ value: 'Europe/London', label: 'Europe/London (UK)' },
|
|
49
|
-
{ value: 'Europe/Berlin', label: 'Europe/Berlin (CET)' },
|
|
50
|
-
{ value: 'Asia/Tokyo', label: 'Asia/Tokyo (JST)' },
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const MINUTE_OPTIONS = Array.from({ length: 12 }, (_, i) => i * 5); // 0,5,10,…55
|
|
54
|
-
const HOUR_OPTIONS = Array.from({ length: 24 }, (_, h) => ({
|
|
55
|
-
value: h,
|
|
56
|
-
label: h === 0 ? '12 AM' : h < 12 ? `${h} AM` : h === 12 ? '12 PM' : `${h - 12} PM`,
|
|
57
|
-
}));
|
|
58
|
-
const DOW_OPTIONS: Array<{ value: string; label: string }> = [
|
|
59
|
-
{ value: '*', label: 'Every day' },
|
|
60
|
-
{ value: '0', label: 'Sunday' },
|
|
61
|
-
{ value: '1', label: 'Monday' },
|
|
62
|
-
{ value: '2', label: 'Tuesday' },
|
|
63
|
-
{ value: '3', label: 'Wednesday' },
|
|
64
|
-
{ value: '4', label: 'Thursday' },
|
|
65
|
-
{ value: '5', label: 'Friday' },
|
|
66
|
-
{ value: '6', label: 'Saturday' },
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
const INTERVAL_UNITS: Array<{ value: string; label: string }> = [
|
|
70
|
-
{ value: 's', label: 'seconds' },
|
|
71
|
-
{ value: 'm', label: 'minutes' },
|
|
72
|
-
{ value: 'h', label: 'hours' },
|
|
73
|
-
{ value: 'd', label: 'days' },
|
|
74
|
-
];
|
|
75
|
-
|
|
76
|
-
/** Best-effort cron parser — used to pre-populate the structured form
|
|
77
|
-
* when editing a schedule the user originally saved with raw cron text. */
|
|
78
|
-
function parseCronFields(expr: string): { minute: number; hour: number; dow: string } | null {
|
|
79
|
-
if (typeof expr !== 'string') return null;
|
|
80
|
-
const parts = expr.trim().split(/\s+/);
|
|
81
|
-
if (parts.length !== 5) return null;
|
|
82
|
-
const [m, h, , , dow] = parts;
|
|
83
|
-
// We only pre-populate when every field is a literal — wildcards and
|
|
84
|
-
// ranges (other than `*`) leave the form blank rather than guess.
|
|
85
|
-
const minNum = parseInt(m, 10);
|
|
86
|
-
const hourNum = parseInt(h, 10);
|
|
87
|
-
if (!Number.isFinite(minNum) || !Number.isFinite(hourNum)) return null;
|
|
88
|
-
if (m !== String(minNum) || h !== String(hourNum)) return null;
|
|
89
|
-
const dowClean = dow === '*' ? '*' : parseInt(dow, 10);
|
|
90
|
-
if (dowClean === null || (dow !== '*' && !Number.isFinite(dowClean))) return null;
|
|
91
|
-
return { minute: minNum, hour: hourNum, dow: dow === '*' ? '*' : String(dowClean) };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function parseIntervalParts(s: string): { n: number; unit: string } | null {
|
|
95
|
-
if (typeof s !== 'string') return null;
|
|
96
|
-
const m = /^(\d+)\s*([smhd])$/i.exec(s.trim());
|
|
97
|
-
if (!m) return null;
|
|
98
|
-
return { n: parseInt(m[1], 10), unit: m[2].toLowerCase() };
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
type EditorState = {
|
|
102
|
-
name: string;
|
|
103
|
-
type: 'cron' | 'interval' | 'once';
|
|
104
|
-
cronMinute: number;
|
|
105
|
-
cronHour: number;
|
|
106
|
-
cronDow: string;
|
|
107
|
-
showAdvanced: boolean;
|
|
108
|
-
rawCron: string;
|
|
109
|
-
intervalN: number;
|
|
110
|
-
intervalUnit: string;
|
|
111
|
-
onceAt: string; // datetime-local string
|
|
112
|
-
timezone: string;
|
|
113
|
-
customTimezone: string;
|
|
114
|
-
actionType: 'command' | 'agent' | 'webhook';
|
|
115
|
-
actionTarget: string;
|
|
116
|
-
actionPrompt: string;
|
|
117
|
-
skipIfBudgetLow: boolean;
|
|
118
|
-
maxConcurrent: number;
|
|
119
|
-
enabled: boolean;
|
|
120
|
-
humanLabel: string;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
function buildInitialState(initial?: Schedule): EditorState {
|
|
124
|
-
if (!initial) {
|
|
125
|
-
return {
|
|
126
|
-
name: '',
|
|
127
|
-
type: 'cron',
|
|
128
|
-
cronMinute: 0,
|
|
129
|
-
cronHour: 13,
|
|
130
|
-
cronDow: '0',
|
|
131
|
-
showAdvanced: false,
|
|
132
|
-
rawCron: '0 13 * * 0',
|
|
133
|
-
intervalN: 30,
|
|
134
|
-
intervalUnit: 'm',
|
|
135
|
-
onceAt: '',
|
|
136
|
-
timezone: 'UTC',
|
|
137
|
-
customTimezone: '',
|
|
138
|
-
actionType: 'agent',
|
|
139
|
-
actionTarget: '',
|
|
140
|
-
actionPrompt: '',
|
|
141
|
-
skipIfBudgetLow: false,
|
|
142
|
-
maxConcurrent: 6,
|
|
143
|
-
enabled: true,
|
|
144
|
-
humanLabel: '',
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
const parsed = initial.type === 'cron' ? parseCronFields(initial.schedule) : null;
|
|
148
|
-
const parsedInterval = initial.type === 'interval' ? parseIntervalParts(initial.schedule) : null;
|
|
149
|
-
const tz = initial.timezone || 'UTC';
|
|
150
|
-
const tzKnown = TIMEZONES.some((t) => t.value === tz);
|
|
151
|
-
return {
|
|
152
|
-
name: initial.name || '',
|
|
153
|
-
type: initial.type,
|
|
154
|
-
cronMinute: parsed?.minute ?? 0,
|
|
155
|
-
cronHour: parsed?.hour ?? 9,
|
|
156
|
-
cronDow: parsed?.dow ?? '*',
|
|
157
|
-
showAdvanced: !parsed,
|
|
158
|
-
rawCron: initial.schedule,
|
|
159
|
-
intervalN: parsedInterval?.n ?? 30,
|
|
160
|
-
intervalUnit: parsedInterval?.unit ?? 'm',
|
|
161
|
-
onceAt: initial.type === 'once' ? toDatetimeLocal(initial.schedule) : '',
|
|
162
|
-
timezone: tzKnown ? tz : 'Other…',
|
|
163
|
-
customTimezone: tzKnown ? '' : tz,
|
|
164
|
-
actionType: initial.action.type,
|
|
165
|
-
actionTarget: initial.action.target || '',
|
|
166
|
-
actionPrompt: initial.action.prompt || '',
|
|
167
|
-
skipIfBudgetLow: !!initial.budgetCheck?.skipIfBudgetLow,
|
|
168
|
-
maxConcurrent: Number.isFinite(initial.budgetCheck?.maxConcurrent)
|
|
169
|
-
? initial.budgetCheck!.maxConcurrent!
|
|
170
|
-
: 6,
|
|
171
|
-
enabled: initial.enabled !== false,
|
|
172
|
-
humanLabel: '',
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function toDatetimeLocal(iso: string): string {
|
|
177
|
-
if (!iso) return '';
|
|
178
|
-
try {
|
|
179
|
-
const d = new Date(iso);
|
|
180
|
-
if (Number.isNaN(d.getTime())) return '';
|
|
181
|
-
// datetime-local needs YYYY-MM-DDTHH:mm in *local* time.
|
|
182
|
-
const pad = (n: number) => String(n).padStart(2, '0');
|
|
183
|
-
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
184
|
-
} catch {
|
|
185
|
-
return '';
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** Compose the cron / interval / once schedule string + a human label. */
|
|
190
|
-
function composeSchedule(s: EditorState): { schedule: string; humanLabel: string } {
|
|
191
|
-
if (s.type === 'cron') {
|
|
192
|
-
if (s.showAdvanced) {
|
|
193
|
-
return { schedule: s.rawCron.trim(), humanLabel: s.humanLabel || s.rawCron.trim() };
|
|
194
|
-
}
|
|
195
|
-
const cron = `${s.cronMinute} ${s.cronHour} * * ${s.cronDow}`;
|
|
196
|
-
const dowName = DOW_OPTIONS.find((d) => d.value === s.cronDow)?.label || '';
|
|
197
|
-
const hourLabel = HOUR_OPTIONS.find((h) => h.value === s.cronHour)?.label || `${s.cronHour}`;
|
|
198
|
-
const minute = String(s.cronMinute).padStart(2, '0');
|
|
199
|
-
const human =
|
|
200
|
-
dowName === 'Every day'
|
|
201
|
-
? `Every day at ${hourLabel.replace(' ', '')} (min ${minute})`
|
|
202
|
-
: `Every ${dowName} at ${hourLabel.replace(' ', '')} (min ${minute})`;
|
|
203
|
-
return { schedule: cron, humanLabel: s.humanLabel || human };
|
|
204
|
-
}
|
|
205
|
-
if (s.type === 'interval') {
|
|
206
|
-
const unit = INTERVAL_UNITS.find((u) => u.value === s.intervalUnit)?.label || s.intervalUnit;
|
|
207
|
-
const schedule = `${s.intervalN}${s.intervalUnit}`;
|
|
208
|
-
return {
|
|
209
|
-
schedule,
|
|
210
|
-
humanLabel: s.humanLabel || `Every ${s.intervalN} ${unit}`,
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
// once
|
|
214
|
-
if (!s.onceAt) return { schedule: '', humanLabel: s.humanLabel || '' };
|
|
215
|
-
const iso = new Date(s.onceAt).toISOString();
|
|
216
|
-
return {
|
|
217
|
-
schedule: iso,
|
|
218
|
-
humanLabel: s.humanLabel || new Date(s.onceAt).toLocaleString(),
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export function Schedules({ snapshot, refreshSnapshot }: Props) {
|
|
223
|
-
const toast = useToast();
|
|
224
|
-
const modal = useModal();
|
|
225
|
-
const [schedules, setSchedules] = useState<Schedule[]>(snapshot.schedules || []);
|
|
226
|
-
const [loading, setLoading] = useState(!snapshot.schedules);
|
|
227
|
-
const [activeSection, setActiveSection] = useState<'schedules' | 'templates'>('schedules');
|
|
228
|
-
const [templates, setTemplates] = useState<ScheduleTemplate[]>([]);
|
|
229
|
-
const [templatesLoading, setTemplatesLoading] = useState(false);
|
|
230
|
-
|
|
231
|
-
const reload = async () => {
|
|
232
|
-
try {
|
|
233
|
-
const r = await api.get<{ schedules: Schedule[]; projectId: string | null }>(
|
|
234
|
-
'/projects/active/schedules',
|
|
235
|
-
);
|
|
236
|
-
setSchedules(r.schedules || []);
|
|
237
|
-
} catch (err) {
|
|
238
|
-
toast.error(`Schedules load failed: ${(err as Error).message}`);
|
|
239
|
-
} finally {
|
|
240
|
-
setLoading(false);
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
const loadTemplates = async () => {
|
|
245
|
-
setTemplatesLoading(true);
|
|
246
|
-
try {
|
|
247
|
-
const r = await api.get<{ templates: ScheduleTemplate[] }>('/schedules/templates');
|
|
248
|
-
setTemplates(r.templates || []);
|
|
249
|
-
} catch (err) {
|
|
250
|
-
toast.error(`Templates load failed: ${(err as Error).message}`);
|
|
251
|
-
} finally {
|
|
252
|
-
setTemplatesLoading(false);
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
useEffect(() => {
|
|
257
|
-
if (snapshot.schedules?.length || snapshot.schedules) {
|
|
258
|
-
setSchedules(snapshot.schedules || []);
|
|
259
|
-
setLoading(false);
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
reload();
|
|
263
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
264
|
-
}, [snapshot.schedules]);
|
|
265
|
-
|
|
266
|
-
useEffect(() => {
|
|
267
|
-
if (activeSection === 'templates' && templates.length === 0) {
|
|
268
|
-
loadTemplates();
|
|
269
|
-
}
|
|
270
|
-
}, [activeSection]);
|
|
271
|
-
|
|
272
|
-
const openEditor = (initial?: Schedule) => {
|
|
273
|
-
modal.open({
|
|
274
|
-
title: initial ? `Edit schedule: ${initial.name}` : 'New schedule',
|
|
275
|
-
width: 640,
|
|
276
|
-
children: (
|
|
277
|
-
<ScheduleEditorModal
|
|
278
|
-
initial={initial}
|
|
279
|
-
onClose={modal.close}
|
|
280
|
-
onSubmitted={async (saved) => {
|
|
281
|
-
setSchedules((cur) => {
|
|
282
|
-
const idx = cur.findIndex((s) => s.id === saved.id);
|
|
283
|
-
if (idx === -1) return [...cur, saved];
|
|
284
|
-
const copy = cur.slice();
|
|
285
|
-
copy[idx] = saved;
|
|
286
|
-
return copy;
|
|
287
|
-
});
|
|
288
|
-
toast.success(initial ? 'Schedule updated.' : 'Schedule created.');
|
|
289
|
-
modal.close();
|
|
290
|
-
await refreshSnapshot();
|
|
291
|
-
}}
|
|
292
|
-
onError={(msg) => toast.error(msg)}
|
|
293
|
-
/>
|
|
294
|
-
),
|
|
295
|
-
});
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
const onRun = async (s: Schedule) => {
|
|
299
|
-
try {
|
|
300
|
-
const r = await api.post<{ ok: boolean; schedule: Schedule; runResult: { error?: string; stdout?: string } }>(
|
|
301
|
-
`/schedules/${encodeURIComponent(s.id)}/run`,
|
|
302
|
-
);
|
|
303
|
-
toast.success(r.ok ? 'Schedule ran.' : `Run failed: ${r.runResult?.error || 'unknown'}`);
|
|
304
|
-
await reload();
|
|
305
|
-
} catch (err) {
|
|
306
|
-
toast.error(`Run failed: ${(err as Error).message}`);
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
const onDelete = async (s: Schedule) => {
|
|
311
|
-
if (!confirm(`Delete schedule "${s.name}"?`)) return;
|
|
312
|
-
try {
|
|
313
|
-
await api.del(`/schedules/${encodeURIComponent(s.id)}`);
|
|
314
|
-
setSchedules((cur) => cur.filter((x) => x.id !== s.id));
|
|
315
|
-
toast.success('Schedule deleted.');
|
|
316
|
-
} catch (err) {
|
|
317
|
-
toast.error(`Delete failed: ${(err as Error).message}`);
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
const onUseTemplate = async (template: ScheduleTemplate) => {
|
|
322
|
-
try {
|
|
323
|
-
const saved = await api.post<Schedule>('/schedules/from-template', {
|
|
324
|
-
templateId: template.id,
|
|
325
|
-
});
|
|
326
|
-
setSchedules((cur) => [...cur, saved]);
|
|
327
|
-
setActiveSection('schedules');
|
|
328
|
-
toast.success(`Schedule "${saved.name}" created from template.`);
|
|
329
|
-
await refreshSnapshot();
|
|
330
|
-
} catch (err) {
|
|
331
|
-
toast.error(`Failed to create schedule: ${(err as Error).message}`);
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
if (loading) {
|
|
336
|
-
return (
|
|
337
|
-
<div className="view-loading"><Spinner size="lg" /></div>
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return (
|
|
342
|
-
<div className="view view-schedules">
|
|
343
|
-
<header className="view-header">
|
|
344
|
-
<div className="view-header-text">
|
|
345
|
-
<div className="view-title-row">
|
|
346
|
-
<h2 className="view-title">
|
|
347
|
-
<Clock size={18} /> Schedules
|
|
348
|
-
</h2>
|
|
349
|
-
<div className="view-section-tabs">
|
|
350
|
-
<button
|
|
351
|
-
type="button"
|
|
352
|
-
className={`tab-btn ${activeSection === 'schedules' ? 'tab-btn-active' : ''}`}
|
|
353
|
-
onClick={() => setActiveSection('schedules')}
|
|
354
|
-
>
|
|
355
|
-
Schedules ({schedules.length})
|
|
356
|
-
</button>
|
|
357
|
-
<button
|
|
358
|
-
type="button"
|
|
359
|
-
className={`tab-btn ${activeSection === 'templates' ? 'tab-btn-active' : ''}`}
|
|
360
|
-
onClick={() => setActiveSection('templates')}
|
|
361
|
-
>
|
|
362
|
-
<LayoutTemplate size={14} /> Templates
|
|
363
|
-
</button>
|
|
364
|
-
</div>
|
|
365
|
-
</div>
|
|
366
|
-
<p className="view-subtitle">
|
|
367
|
-
{activeSection === 'schedules'
|
|
368
|
-
? <>Recurring tasks for <strong>{snapshot.activeProject?.name || '(none)'}</strong>. Service daemon runs them at the right time.</>
|
|
369
|
-
: 'Example schedules you can use as a starting point.'}
|
|
370
|
-
</p>
|
|
371
|
-
</div>
|
|
372
|
-
<div className="view-actions">
|
|
373
|
-
{activeSection === 'schedules' && (
|
|
374
|
-
<>
|
|
375
|
-
<Button variant="secondary" size="sm" onClick={reload} aria-label="Refresh schedules">
|
|
376
|
-
<RefreshCw size={14} /> Refresh
|
|
377
|
-
</Button>
|
|
378
|
-
<Button variant="primary" size="sm" onClick={() => openEditor()}>
|
|
379
|
-
<Plus size={14} /> New schedule
|
|
380
|
-
</Button>
|
|
381
|
-
</>
|
|
382
|
-
)}
|
|
383
|
-
{activeSection === 'templates' && (
|
|
384
|
-
<Button variant="secondary" size="sm" onClick={loadTemplates} disabled={templatesLoading}>
|
|
385
|
-
<RefreshCw size={14} /> Refresh
|
|
386
|
-
</Button>
|
|
387
|
-
)}
|
|
388
|
-
</div>
|
|
389
|
-
</header>
|
|
390
|
-
|
|
391
|
-
{activeSection === 'templates' ? (
|
|
392
|
-
templatesLoading ? (
|
|
393
|
-
<div className="view-loading"><Spinner size="lg" /></div>
|
|
394
|
-
) : templates.length === 0 ? (
|
|
395
|
-
<EmptyState
|
|
396
|
-
icon={<LayoutTemplate size={32} />}
|
|
397
|
-
title="No templates"
|
|
398
|
-
message="No schedule templates found. Templates are loaded from templates/schedules/."
|
|
399
|
-
/>
|
|
400
|
-
) : (
|
|
401
|
-
<div className="schedule-template-grid">
|
|
402
|
-
{templates.map((t) => (
|
|
403
|
-
<ScheduleTemplateCard key={t.id} template={t} onUse={onUseTemplate} />
|
|
404
|
-
))}
|
|
405
|
-
</div>
|
|
406
|
-
)
|
|
407
|
-
) : schedules.length === 0 ? (
|
|
408
|
-
<EmptyState
|
|
409
|
-
icon={<Clock size={32} />}
|
|
410
|
-
title="No schedules"
|
|
411
|
-
message={
|
|
412
|
-
snapshot.activeProject
|
|
413
|
-
? 'Add a schedule to run commands, webhooks, or agent tasks on a cron / interval / one-shot basis.'
|
|
414
|
-
: 'Activate a project first to scope schedules.'
|
|
415
|
-
}
|
|
416
|
-
/>
|
|
417
|
-
) : (
|
|
418
|
-
<div className="schedule-grid">
|
|
419
|
-
{schedules.map((s) => (
|
|
420
|
-
<Card key={s.id} className="schedule-card">
|
|
421
|
-
<div className="schedule-card-head">
|
|
422
|
-
<div>
|
|
423
|
-
<CardTitle>{s.name}</CardTitle>
|
|
424
|
-
<CardMeta>
|
|
425
|
-
<code>{s.type}</code> ·{' '}
|
|
426
|
-
<span title={s.schedule}>{humanizeSchedule(s) || s.schedule}</span>
|
|
427
|
-
{s.timezone && s.timezone !== 'UTC' ? <> · <code>{s.timezone}</code></> : null}
|
|
428
|
-
{' · '}
|
|
429
|
-
<span className={s.enabled ? 'status-on' : 'status-neutral'}>
|
|
430
|
-
{s.enabled ? 'enabled' : 'disabled'}
|
|
431
|
-
</span>
|
|
432
|
-
</CardMeta>
|
|
433
|
-
</div>
|
|
434
|
-
<div className="schedule-card-actions">
|
|
435
|
-
<Button variant="secondary" size="sm" onClick={() => openEditor(s)}>
|
|
436
|
-
<Pencil size={12} /> Edit
|
|
437
|
-
</Button>
|
|
438
|
-
<Button variant="secondary" size="sm" onClick={() => onRun(s)}>
|
|
439
|
-
<PlayCircle size={12} /> Run now
|
|
440
|
-
</Button>
|
|
441
|
-
<button
|
|
442
|
-
type="button"
|
|
443
|
-
className="icon-btn icon-btn-danger"
|
|
444
|
-
aria-label="Delete"
|
|
445
|
-
title="Delete"
|
|
446
|
-
onClick={() => onDelete(s)}
|
|
447
|
-
>
|
|
448
|
-
<Trash2 size={12} />
|
|
449
|
-
</button>
|
|
450
|
-
</div>
|
|
451
|
-
</div>
|
|
452
|
-
<div className="schedule-card-action">
|
|
453
|
-
<span className="muted">action:</span>{' '}
|
|
454
|
-
<code>
|
|
455
|
-
{s.action.type} {s.action.target}
|
|
456
|
-
</code>
|
|
457
|
-
{s.action.type === 'agent' && s.action.prompt && (
|
|
458
|
-
<div className="schedule-card-prompt">
|
|
459
|
-
<span className="muted">prompt:</span> {s.action.prompt}
|
|
460
|
-
</div>
|
|
461
|
-
)}
|
|
462
|
-
</div>
|
|
463
|
-
{s.budgetCheck?.skipIfBudgetLow && (
|
|
464
|
-
<div className="schedule-card-budget">
|
|
465
|
-
<span className="muted">budget gate:</span>{' '}
|
|
466
|
-
skip if concurrent ≥ {s.budgetCheck.maxConcurrent ?? 6}
|
|
467
|
-
</div>
|
|
468
|
-
)}
|
|
469
|
-
<div className="schedule-card-times">
|
|
470
|
-
<div>
|
|
471
|
-
<span className="muted">last</span>{' '}
|
|
472
|
-
{s.lastRun ? formatRelative(s.lastRun) : '—'}
|
|
473
|
-
{s.lastResult && (
|
|
474
|
-
<span className={`tag ${resultTagClass(s.lastResult)}`}>{s.lastResult}</span>
|
|
475
|
-
)}
|
|
476
|
-
{s.lastError && (
|
|
477
|
-
<span className="muted schedule-card-error" title={s.lastError}>
|
|
478
|
-
{' '}— {truncate(s.lastError, 80)}
|
|
479
|
-
</span>
|
|
480
|
-
)}
|
|
481
|
-
</div>
|
|
482
|
-
<div>
|
|
483
|
-
<span className="muted">next</span>{' '}
|
|
484
|
-
{s.nextRun ? (
|
|
485
|
-
<span title={new Date(s.nextRun).toISOString()}>
|
|
486
|
-
{formatNextRun(s.nextRun, s.timezone)}
|
|
487
|
-
</span>
|
|
488
|
-
) : (
|
|
489
|
-
'—'
|
|
490
|
-
)}
|
|
491
|
-
{s.nextRun && (
|
|
492
|
-
<span className="muted"> · {formatRelative(s.nextRun)}</span>
|
|
493
|
-
)}
|
|
494
|
-
</div>
|
|
495
|
-
</div>
|
|
496
|
-
{s.history && s.history.length > 0 && (
|
|
497
|
-
<details className="schedule-card-history">
|
|
498
|
-
<summary>
|
|
499
|
-
<History size={12} /> {s.history.length} run{s.history.length === 1 ? '' : 's'}
|
|
500
|
-
</summary>
|
|
501
|
-
<ul>
|
|
502
|
-
{s.history.slice(-10).reverse().map((h, i) => (
|
|
503
|
-
<li key={i}>
|
|
504
|
-
<span className="tabular-nums muted">{formatRelative(h.ts)}</span>{' '}
|
|
505
|
-
<span className={`tag ${resultTagClass(h.result)}`}>{h.result}</span>
|
|
506
|
-
{h.error && <span className="muted"> — {truncate(h.error, 80)}</span>}
|
|
507
|
-
</li>
|
|
508
|
-
))}
|
|
509
|
-
</ul>
|
|
510
|
-
</details>
|
|
511
|
-
)}
|
|
512
|
-
</Card>
|
|
513
|
-
))}
|
|
514
|
-
</div>
|
|
515
|
-
)}
|
|
516
|
-
</div>
|
|
517
|
-
);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/* ------------------------------------------------------------------ */
|
|
521
|
-
/* Editor modal */
|
|
522
|
-
/* ------------------------------------------------------------------ */
|
|
523
|
-
|
|
524
|
-
function ScheduleEditorModal({
|
|
525
|
-
initial,
|
|
526
|
-
onClose,
|
|
527
|
-
onSubmitted,
|
|
528
|
-
onError,
|
|
529
|
-
}: {
|
|
530
|
-
initial?: Schedule;
|
|
531
|
-
onClose: () => void;
|
|
532
|
-
onSubmitted: (saved: Schedule) => void | Promise<void>;
|
|
533
|
-
onError: (msg: string) => void;
|
|
534
|
-
}) {
|
|
535
|
-
const [state, setState] = useState<EditorState>(() => buildInitialState(initial));
|
|
536
|
-
const [submitting, setSubmitting] = useState(false);
|
|
537
|
-
const tzSelectValue = useMemo(() => {
|
|
538
|
-
if (TIMEZONES.some((t) => t.value === state.timezone)) return state.timezone;
|
|
539
|
-
return 'Other…';
|
|
540
|
-
}, [state.timezone]);
|
|
541
|
-
|
|
542
|
-
const update = <K extends keyof EditorState>(key: K, value: EditorState[K]) => {
|
|
543
|
-
setState((cur) => ({ ...cur, [key]: value }));
|
|
544
|
-
};
|
|
545
|
-
|
|
546
|
-
const handleSubmit = async (e: React.FormEvent) => {
|
|
547
|
-
e.preventDefault();
|
|
548
|
-
const trimmedName = state.name.trim();
|
|
549
|
-
if (!trimmedName) {
|
|
550
|
-
onError('Name is required.');
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
const composed = composeSchedule(state);
|
|
554
|
-
if (!composed.schedule) {
|
|
555
|
-
onError('Schedule value is required.');
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
if (!state.actionTarget.trim()) {
|
|
559
|
-
onError('Action target is required.');
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
const tz = state.timezone === 'Other…' ? state.customTimezone.trim() : state.timezone;
|
|
563
|
-
const actionPayload: Record<string, unknown> = {
|
|
564
|
-
type: state.actionType,
|
|
565
|
-
target: state.actionTarget.trim(),
|
|
566
|
-
};
|
|
567
|
-
if (state.actionType === 'agent' && state.actionPrompt.trim()) {
|
|
568
|
-
actionPayload.prompt = state.actionPrompt.trim();
|
|
569
|
-
}
|
|
570
|
-
const payload: Record<string, unknown> = {
|
|
571
|
-
name: trimmedName,
|
|
572
|
-
type: state.type,
|
|
573
|
-
schedule: composed.schedule,
|
|
574
|
-
timezone: tz || 'UTC',
|
|
575
|
-
action: actionPayload,
|
|
576
|
-
budgetCheck: {
|
|
577
|
-
maxConcurrent: state.maxConcurrent,
|
|
578
|
-
skipIfBudgetLow: state.skipIfBudgetLow,
|
|
579
|
-
},
|
|
580
|
-
enabled: state.enabled,
|
|
581
|
-
};
|
|
582
|
-
setSubmitting(true);
|
|
583
|
-
try {
|
|
584
|
-
const saved = initial
|
|
585
|
-
? await api.put<Schedule>(`/schedules/${encodeURIComponent(initial.id)}`, payload)
|
|
586
|
-
: await api.post<Schedule>('/schedules', payload);
|
|
587
|
-
await onSubmitted(saved);
|
|
588
|
-
} catch (err) {
|
|
589
|
-
onError(`${initial ? 'Update' : 'Create'} failed: ${(err as Error).message}`);
|
|
590
|
-
} finally {
|
|
591
|
-
setSubmitting(false);
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
return (
|
|
596
|
-
<form className="schedule-form" onSubmit={handleSubmit}>
|
|
597
|
-
<label className="field-label" htmlFor="schedule-name">Name</label>
|
|
598
|
-
<input
|
|
599
|
-
id="schedule-name"
|
|
600
|
-
className="input"
|
|
601
|
-
type="text"
|
|
602
|
-
placeholder="Weekly code review"
|
|
603
|
-
value={state.name}
|
|
604
|
-
onChange={(e) => update('name', e.target.value)}
|
|
605
|
-
autoFocus
|
|
606
|
-
/>
|
|
607
|
-
|
|
608
|
-
<div className="task-form-row">
|
|
609
|
-
<div className="task-form-field">
|
|
610
|
-
<label className="field-label" htmlFor="schedule-type">Type</label>
|
|
611
|
-
<select
|
|
612
|
-
id="schedule-type"
|
|
613
|
-
className="select"
|
|
614
|
-
value={state.type}
|
|
615
|
-
onChange={(e) => update('type', e.target.value as EditorState['type'])}
|
|
616
|
-
>
|
|
617
|
-
{TYPES.map((t) => (
|
|
618
|
-
<option key={t} value={t}>{t}</option>
|
|
619
|
-
))}
|
|
620
|
-
</select>
|
|
621
|
-
</div>
|
|
622
|
-
</div>
|
|
623
|
-
|
|
624
|
-
{state.type === 'cron' && (
|
|
625
|
-
<div className="schedule-cron-group">
|
|
626
|
-
{!state.showAdvanced && (
|
|
627
|
-
<>
|
|
628
|
-
<div className="task-form-row">
|
|
629
|
-
<div className="task-form-field">
|
|
630
|
-
<label className="field-label" htmlFor="schedule-dow">Day of week</label>
|
|
631
|
-
<select
|
|
632
|
-
id="schedule-dow"
|
|
633
|
-
className="select"
|
|
634
|
-
value={state.cronDow}
|
|
635
|
-
onChange={(e) => update('cronDow', e.target.value)}
|
|
636
|
-
>
|
|
637
|
-
{DOW_OPTIONS.map((d) => (
|
|
638
|
-
<option key={d.value} value={d.value}>{d.label}</option>
|
|
639
|
-
))}
|
|
640
|
-
</select>
|
|
641
|
-
</div>
|
|
642
|
-
<div className="task-form-field">
|
|
643
|
-
<label className="field-label" htmlFor="schedule-hour">Hour</label>
|
|
644
|
-
<select
|
|
645
|
-
id="schedule-hour"
|
|
646
|
-
className="select"
|
|
647
|
-
value={String(state.cronHour)}
|
|
648
|
-
onChange={(e) => update('cronHour', parseInt(e.target.value, 10))}
|
|
649
|
-
>
|
|
650
|
-
{HOUR_OPTIONS.map((h) => (
|
|
651
|
-
<option key={h.value} value={String(h.value)}>{h.label}</option>
|
|
652
|
-
))}
|
|
653
|
-
</select>
|
|
654
|
-
</div>
|
|
655
|
-
<div className="task-form-field">
|
|
656
|
-
<label className="field-label" htmlFor="schedule-minute">Minute</label>
|
|
657
|
-
<select
|
|
658
|
-
id="schedule-minute"
|
|
659
|
-
className="select"
|
|
660
|
-
value={String(state.cronMinute)}
|
|
661
|
-
onChange={(e) => update('cronMinute', parseInt(e.target.value, 10))}
|
|
662
|
-
>
|
|
663
|
-
{MINUTE_OPTIONS.map((m) => (
|
|
664
|
-
<option key={m} value={String(m)}>{String(m).padStart(2, '0')}</option>
|
|
665
|
-
))}
|
|
666
|
-
</select>
|
|
667
|
-
</div>
|
|
668
|
-
</div>
|
|
669
|
-
</>
|
|
670
|
-
)}
|
|
671
|
-
{state.showAdvanced && (
|
|
672
|
-
<div className="task-form-field">
|
|
673
|
-
<label className="field-label" htmlFor="schedule-cron-expr">Cron expression</label>
|
|
674
|
-
<input
|
|
675
|
-
id="schedule-cron-expr"
|
|
676
|
-
className="input"
|
|
677
|
-
type="text"
|
|
678
|
-
value={state.rawCron}
|
|
679
|
-
onChange={(e) => update('rawCron', e.target.value)}
|
|
680
|
-
placeholder="0 13 * * 0"
|
|
681
|
-
/>
|
|
682
|
-
</div>
|
|
683
|
-
)}
|
|
684
|
-
<button
|
|
685
|
-
type="button"
|
|
686
|
-
className="link-btn"
|
|
687
|
-
onClick={() => update('showAdvanced', !state.showAdvanced)}
|
|
688
|
-
aria-expanded={state.showAdvanced}
|
|
689
|
-
>
|
|
690
|
-
<ChevronDown
|
|
691
|
-
size={12}
|
|
692
|
-
style={{
|
|
693
|
-
transform: state.showAdvanced ? 'rotate(180deg)' : 'none',
|
|
694
|
-
transition: 'transform 0.15s',
|
|
695
|
-
}}
|
|
696
|
-
/>
|
|
697
|
-
{state.showAdvanced ? 'Hide advanced' : 'Advanced (raw cron)'}
|
|
698
|
-
</button>
|
|
699
|
-
</div>
|
|
700
|
-
)}
|
|
701
|
-
|
|
702
|
-
{state.type === 'interval' && (
|
|
703
|
-
<div className="task-form-row">
|
|
704
|
-
<div className="task-form-field" style={{ flex: 1 }}>
|
|
705
|
-
<label className="field-label" htmlFor="schedule-interval-n">Every</label>
|
|
706
|
-
<input
|
|
707
|
-
id="schedule-interval-n"
|
|
708
|
-
className="input"
|
|
709
|
-
type="number"
|
|
710
|
-
min={1}
|
|
711
|
-
value={state.intervalN}
|
|
712
|
-
onChange={(e) => update('intervalN', parseInt(e.target.value, 10) || 1)}
|
|
713
|
-
/>
|
|
714
|
-
</div>
|
|
715
|
-
<div className="task-form-field" style={{ flex: 1 }}>
|
|
716
|
-
<label className="field-label" htmlFor="schedule-interval-unit">Unit</label>
|
|
717
|
-
<select
|
|
718
|
-
id="schedule-interval-unit"
|
|
719
|
-
className="select"
|
|
720
|
-
value={state.intervalUnit}
|
|
721
|
-
onChange={(e) => update('intervalUnit', e.target.value)}
|
|
722
|
-
>
|
|
723
|
-
{INTERVAL_UNITS.map((u) => (
|
|
724
|
-
<option key={u.value} value={u.value}>{u.label}</option>
|
|
725
|
-
))}
|
|
726
|
-
</select>
|
|
727
|
-
</div>
|
|
728
|
-
</div>
|
|
729
|
-
)}
|
|
730
|
-
|
|
731
|
-
{state.type === 'once' && (
|
|
732
|
-
<div className="task-form-field">
|
|
733
|
-
<label className="field-label" htmlFor="schedule-once-at">Run at</label>
|
|
734
|
-
<input
|
|
735
|
-
id="schedule-once-at"
|
|
736
|
-
className="input"
|
|
737
|
-
type="datetime-local"
|
|
738
|
-
value={state.onceAt}
|
|
739
|
-
onChange={(e) => update('onceAt', e.target.value)}
|
|
740
|
-
/>
|
|
741
|
-
</div>
|
|
742
|
-
)}
|
|
743
|
-
|
|
744
|
-
<div className="task-form-row">
|
|
745
|
-
<div className="task-form-field" style={{ flex: 1 }}>
|
|
746
|
-
<label className="field-label" htmlFor="schedule-timezone">Timezone</label>
|
|
747
|
-
<select
|
|
748
|
-
id="schedule-timezone"
|
|
749
|
-
className="select"
|
|
750
|
-
value={tzSelectValue}
|
|
751
|
-
onChange={(e) => update('timezone', e.target.value)}
|
|
752
|
-
>
|
|
753
|
-
{TIMEZONES.map((t) => (
|
|
754
|
-
<option key={t.value} value={t.value}>{t.label}</option>
|
|
755
|
-
))}
|
|
756
|
-
<option value="Other…">Other…</option>
|
|
757
|
-
</select>
|
|
758
|
-
</div>
|
|
759
|
-
{state.timezone === 'Other…' && (
|
|
760
|
-
<div className="task-form-field" style={{ flex: 1 }}>
|
|
761
|
-
<label className="field-label" htmlFor="schedule-custom-tz">IANA name</label>
|
|
762
|
-
<input
|
|
763
|
-
id="schedule-custom-tz"
|
|
764
|
-
className="input"
|
|
765
|
-
type="text"
|
|
766
|
-
placeholder="Europe/Paris"
|
|
767
|
-
value={state.customTimezone}
|
|
768
|
-
onChange={(e) => update('customTimezone', e.target.value)}
|
|
769
|
-
/>
|
|
770
|
-
</div>
|
|
771
|
-
)}
|
|
772
|
-
</div>
|
|
773
|
-
|
|
774
|
-
<div className="task-form-row">
|
|
775
|
-
<div className="task-form-field">
|
|
776
|
-
<label className="field-label" htmlFor="schedule-action-type">Action</label>
|
|
777
|
-
<select
|
|
778
|
-
id="schedule-action-type"
|
|
779
|
-
className="select"
|
|
780
|
-
value={state.actionType}
|
|
781
|
-
onChange={(e) => update('actionType', e.target.value as EditorState['actionType'])}
|
|
782
|
-
>
|
|
783
|
-
{ACTIONS.map((t) => (
|
|
784
|
-
<option key={t} value={t}>{t}</option>
|
|
785
|
-
))}
|
|
786
|
-
</select>
|
|
787
|
-
</div>
|
|
788
|
-
<div className="task-form-field" style={{ flex: 2 }}>
|
|
789
|
-
<label className="field-label" htmlFor="schedule-action-target">Target</label>
|
|
790
|
-
<input
|
|
791
|
-
id="schedule-action-target"
|
|
792
|
-
className="input"
|
|
793
|
-
type="text"
|
|
794
|
-
placeholder={state.actionType === 'webhook' ? 'https://...' : state.actionType === 'agent' ? 'agent name or task ref' : 'echo hi'}
|
|
795
|
-
value={state.actionTarget}
|
|
796
|
-
onChange={(e) => update('actionTarget', e.target.value)}
|
|
797
|
-
/>
|
|
798
|
-
</div>
|
|
799
|
-
</div>
|
|
800
|
-
|
|
801
|
-
{state.actionType === 'agent' && (
|
|
802
|
-
<div className="task-form-field">
|
|
803
|
-
<label className="field-label" htmlFor="schedule-action-prompt">Prompt (what to send the agent)</label>
|
|
804
|
-
<textarea
|
|
805
|
-
id="schedule-action-prompt"
|
|
806
|
-
className="input"
|
|
807
|
-
rows={3}
|
|
808
|
-
placeholder="Review open PRs for stale code review comments and nudge reviewers."
|
|
809
|
-
value={state.actionPrompt}
|
|
810
|
-
onChange={(e) => update('actionPrompt', e.target.value)}
|
|
811
|
-
/>
|
|
812
|
-
</div>
|
|
813
|
-
)}
|
|
814
|
-
|
|
815
|
-
<fieldset className="schedule-budget-card">
|
|
816
|
-
<legend>Budget pre-flight</legend>
|
|
817
|
-
<label className="checkbox-row">
|
|
818
|
-
<input
|
|
819
|
-
id="schedule-skip-budget"
|
|
820
|
-
type="checkbox"
|
|
821
|
-
checked={state.skipIfBudgetLow}
|
|
822
|
-
onChange={(e) => update('skipIfBudgetLow', e.target.checked)}
|
|
823
|
-
/>
|
|
824
|
-
<span>Skip this run when too many background tasks are already running.</span>
|
|
825
|
-
</label>
|
|
826
|
-
<div className="task-form-field">
|
|
827
|
-
<label className="field-label" htmlFor="schedule-max-concurrent">Max concurrent bg tasks</label>
|
|
828
|
-
<input
|
|
829
|
-
id="schedule-max-concurrent"
|
|
830
|
-
className="input"
|
|
831
|
-
type="number"
|
|
832
|
-
min={1}
|
|
833
|
-
max={64}
|
|
834
|
-
value={state.maxConcurrent}
|
|
835
|
-
onChange={(e) => update('maxConcurrent', parseInt(e.target.value, 10) || 6)}
|
|
836
|
-
disabled={!state.skipIfBudgetLow}
|
|
837
|
-
/>
|
|
838
|
-
</div>
|
|
839
|
-
</fieldset>
|
|
840
|
-
|
|
841
|
-
<label className="checkbox-row">
|
|
842
|
-
<input
|
|
843
|
-
id="schedule-enabled"
|
|
844
|
-
type="checkbox"
|
|
845
|
-
checked={state.enabled}
|
|
846
|
-
onChange={(e) => update('enabled', e.target.checked)}
|
|
847
|
-
/>
|
|
848
|
-
<span>Enabled</span>
|
|
849
|
-
</label>
|
|
850
|
-
|
|
851
|
-
<div className="modal-footer-actions">
|
|
852
|
-
<Button variant="ghost" type="button" onClick={onClose} disabled={submitting}>
|
|
853
|
-
Cancel
|
|
854
|
-
</Button>
|
|
855
|
-
<Button variant="primary" type="submit" disabled={submitting}>
|
|
856
|
-
{initial ? 'Save' : 'Create'}
|
|
857
|
-
</Button>
|
|
858
|
-
</div>
|
|
859
|
-
</form>
|
|
860
|
-
);
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
/* ------------------------------------------------------------------ */
|
|
864
|
-
/* Helpers */
|
|
865
|
-
/* ------------------------------------------------------------------ */
|
|
866
|
-
|
|
867
|
-
function humanizeSchedule(s: Schedule): string {
|
|
868
|
-
if (s.type !== 'cron') return s.schedule;
|
|
869
|
-
const parsed = parseCronFields(s.schedule);
|
|
870
|
-
if (!parsed) return s.schedule;
|
|
871
|
-
const dowName = DOW_OPTIONS.find((d) => d.value === parsed.dow)?.label || '';
|
|
872
|
-
const hourLabel = HOUR_OPTIONS.find((h) => h.value === parsed.hour)?.label || `${parsed.hour}`;
|
|
873
|
-
const minute = String(parsed.minute).padStart(2, '0');
|
|
874
|
-
if (dowName === 'Every day') return `Every day at ${hourLabel} :${minute}`;
|
|
875
|
-
return `Every ${dowName} at ${hourLabel} :${minute}`;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
function formatNextRun(iso: string, tz?: string | null): string {
|
|
879
|
-
try {
|
|
880
|
-
return new Date(iso).toLocaleString(undefined, {
|
|
881
|
-
timeZone: tz || undefined,
|
|
882
|
-
weekday: 'long',
|
|
883
|
-
hour: 'numeric',
|
|
884
|
-
minute: '2-digit',
|
|
885
|
-
month: 'short',
|
|
886
|
-
day: 'numeric',
|
|
887
|
-
});
|
|
888
|
-
} catch {
|
|
889
|
-
return new Date(iso).toLocaleString();
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
function resultTagClass(result: string): string {
|
|
894
|
-
if (result === 'success') return 'tag-success';
|
|
895
|
-
if (result === 'skipped') return 'tag-warning';
|
|
896
|
-
return 'tag-error';
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
function truncate(s: string, max: number): string {
|
|
900
|
-
if (s.length <= max) return s;
|
|
901
|
-
return s.slice(0, max - 1) + '…';
|
|
902
|
-
}
|