khal-os 1.260324.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/.env.example +23 -0
- package/.genie/mailbox/cli-sent.jsonl +3 -0
- package/.genie/mailbox/ds1-wave2-engineer-1.json +15 -0
- package/.genie/mailbox/ds1-wave2-engineer-2.json +15 -0
- package/.genie/mailbox/ds1-wave2-engineer-3.json +15 -0
- package/.genie/state/os-observability.json +39 -0
- package/.genie/state/tmux-control-mode-terminal.json +28 -0
- package/.genie/wishes/genieos-one-theme/WISH.md +417 -0
- package/.genie/wishes/workos-prod-rbac/WISH.md +345 -0
- package/.github/workflows/ci.yml +39 -0
- package/.github/workflows/release.yml +78 -0
- package/.github/workflows/version.yml +122 -0
- package/.husky/pre-commit +1 -0
- package/.pnpm-approve-builds.json +1 -0
- package/CLAUDE.md +117 -0
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/biome.json +124 -0
- package/bun.lock +1249 -0
- package/docs/workos-setup.md +116 -0
- package/ecosystem.config.cjs +26 -0
- package/instrumentation.ts +8 -0
- package/knip.json +35 -0
- package/nats.conf +7 -0
- package/next.config.ts +25 -0
- package/package.json +78 -0
- package/packages/dev3000-app/components.ts +12 -0
- package/packages/dev3000-app/manifest.ts +19 -0
- package/packages/dev3000-app/package.json +23 -0
- package/packages/dev3000-app/views/dev3000/Dev3000App.tsx +758 -0
- package/packages/dev3000-app/views/dev3000/ErrorsPanel.tsx +160 -0
- package/packages/dev3000-app/views/dev3000/dev3000-context.tsx +21 -0
- package/packages/dev3000-app/views/dev3000/index.ts +4 -0
- package/packages/dev3000-app/views/dev3000/schema.ts +55 -0
- package/packages/dev3000-app/views/dev3000/service/index.ts +358 -0
- package/packages/dev3000-app/views/dev3000/service/runtime +1 -0
- package/packages/dev3000-app/views/dev3000/subjects.ts +9 -0
- package/packages/dev3000-app/views/dev3000/types.ts +77 -0
- package/packages/files-app/components.ts +12 -0
- package/packages/files-app/manifest.ts +19 -0
- package/packages/files-app/package.json +23 -0
- package/packages/files-app/views/files/ContextMenu.tsx +151 -0
- package/packages/files-app/views/files/DeleteConfirmDialog.tsx +39 -0
- package/packages/files-app/views/files/FileItem.tsx +128 -0
- package/packages/files-app/views/files/FilesApp.tsx +509 -0
- package/packages/files-app/views/files/FilesListView.tsx +201 -0
- package/packages/files-app/views/files/FilesToolbar.tsx +117 -0
- package/packages/files-app/views/files/GridView.tsx +90 -0
- package/packages/files-app/views/files/InlineInput.tsx +131 -0
- package/packages/files-app/views/files/UploadOverlay.tsx +61 -0
- package/packages/files-app/views/files/schema.ts +49 -0
- package/packages/files-app/views/files/service/index.ts +184 -0
- package/packages/files-app/views/files/service/runtime +1 -0
- package/packages/files-app/views/files/use-files.ts +201 -0
- package/packages/files-app/views/files/use-upload.ts +105 -0
- package/packages/genie-app/components.ts +12 -0
- package/packages/genie-app/lib/subjects.ts +87 -0
- package/packages/genie-app/manifest.ts +19 -0
- package/packages/genie-app/package.json +29 -0
- package/packages/genie-app/views/genie/service/agent-lifecycle.ts +136 -0
- package/packages/genie-app/views/genie/service/cli.ts +114 -0
- package/packages/genie-app/views/genie/service/comms.ts +141 -0
- package/packages/genie-app/views/genie/service/directory.ts +167 -0
- package/packages/genie-app/views/genie/service/index.ts +219 -0
- package/packages/genie-app/views/genie/service/system.ts +123 -0
- package/packages/genie-app/views/genie/service/teams.ts +191 -0
- package/packages/genie-app/views/genie/service/terminal-proxy.ts +184 -0
- package/packages/genie-app/views/genie/service/tmux-control.ts +318 -0
- package/packages/genie-app/views/genie/service/wishes.ts +270 -0
- package/packages/genie-app/views/genie/ui/GenieApp.tsx +5 -0
- package/packages/genie-app/views/genie/ui/PaneCard.tsx +307 -0
- package/packages/genie-app/views/genie/ui/Sidebar.tsx +212 -0
- package/packages/genie-app/views/genie/ui/TabBar.tsx +70 -0
- package/packages/genie-app/views/genie/ui/WorkspaceCanvas.tsx +343 -0
- package/packages/genie-app/views/genie/ui/XTermPane.tsx +306 -0
- package/packages/genie-app/views/genie/ui/hooks/useNatsAction.ts +54 -0
- package/packages/genie-app/views/genie/ui/hooks/useNatsRequest.ts +68 -0
- package/packages/genie-app/views/genie/ui/panels/AgentsPanel.tsx +399 -0
- package/packages/genie-app/views/genie/ui/panels/ChatPanel.tsx +351 -0
- package/packages/genie-app/views/genie/ui/panels/SystemPanel.tsx +195 -0
- package/packages/genie-app/views/genie/ui/panels/TeamsPanel.tsx +560 -0
- package/packages/genie-app/views/genie/ui/panels/WishesPanel.tsx +424 -0
- package/packages/nats-viewer-app/components.ts +12 -0
- package/packages/nats-viewer-app/manifest.ts +18 -0
- package/packages/nats-viewer-app/package.json +14 -0
- package/packages/nats-viewer-app/views/nats-viewer/ActiveSubs.tsx +34 -0
- package/packages/nats-viewer-app/views/nats-viewer/MessageLog.tsx +247 -0
- package/packages/nats-viewer-app/views/nats-viewer/NatsViewer.tsx +209 -0
- package/packages/nats-viewer-app/views/nats-viewer/PublishPanel.tsx +111 -0
- package/packages/nats-viewer-app/views/nats-viewer/RequestPanel.tsx +165 -0
- package/packages/nats-viewer-app/views/nats-viewer/Sidebar.tsx +59 -0
- package/packages/nats-viewer-app/views/nats-viewer/SubjectCatalog.tsx +63 -0
- package/packages/nats-viewer-app/views/nats-viewer/SubscribeInput.tsx +59 -0
- package/packages/nats-viewer-app/views/nats-viewer/index.ts +5 -0
- package/packages/nats-viewer-app/views/nats-viewer/nats-viewer-context.tsx +31 -0
- package/packages/nats-viewer-app/views/nats-viewer/types.ts +7 -0
- package/packages/nats-viewer-app/views/nats-viewer/use-message-buffer.ts +55 -0
- package/packages/os-cli/package.json +18 -0
- package/packages/os-cli/src/commands/events.ts +176 -0
- package/packages/os-cli/src/commands/logs.ts +96 -0
- package/packages/os-cli/src/commands/status.ts +53 -0
- package/packages/os-cli/src/commands/traces.ts +115 -0
- package/packages/os-cli/src/index.ts +15 -0
- package/packages/os-cli/src/lib/formatter.ts +123 -0
- package/packages/os-cli/src/lib/nats.ts +16 -0
- package/packages/os-cli/src/lib/trace-tree.ts +144 -0
- package/packages/os-cli/tsconfig.json +12 -0
- package/packages/os-sdk/package.json +27 -0
- package/packages/os-sdk/src/api/handler.ts +67 -0
- package/packages/os-sdk/src/config.ts +68 -0
- package/packages/os-sdk/src/db/factory.test.ts +42 -0
- package/packages/os-sdk/src/db/factory.ts +72 -0
- package/packages/os-sdk/src/db/migrate.ts +140 -0
- package/packages/os-sdk/src/db/provision.ts +44 -0
- package/packages/os-sdk/src/index.ts +36 -0
- package/packages/os-sdk/src/service/console-intercept.ts +60 -0
- package/packages/os-sdk/src/service/logger.ts +88 -0
- package/packages/os-sdk/src/service/o11y-streams.ts +88 -0
- package/packages/os-sdk/src/service/runtime.ts +259 -0
- package/packages/os-sdk/src/service/trace.ts +71 -0
- package/packages/os-sdk/tsconfig.json +16 -0
- package/packages/os-ui/package.json +13 -0
- package/packages/os-ui/src/index.ts +29 -0
- package/packages/os-ui/src/server.ts +4 -0
- package/packages/os-ui/tsconfig.json +19 -0
- package/packages/settings-app/components.ts +12 -0
- package/packages/settings-app/manifest.ts +18 -0
- package/packages/settings-app/package.json +14 -0
- package/packages/settings-app/views/settings/Settings.tsx +492 -0
- package/packages/terminal-app/components.ts +12 -0
- package/packages/terminal-app/manifest.ts +20 -0
- package/packages/terminal-app/package.json +23 -0
- package/packages/terminal-app/views/terminal/schema.ts +82 -0
- package/packages/terminal-app/views/terminal/service/index.ts +133 -0
- package/packages/terminal-app/views/terminal/service/runtime +1 -0
- package/packages/terminal-app/views/terminal/service/session.ts +290 -0
- package/packages/terminal-app/views/terminal/service/shell-hooks/bashrc-hook.sh +21 -0
- package/packages/terminal-app/views/terminal/types.ts +26 -0
- package/packages/terminal-app/views/terminal/ui/MultiTerminalApp.tsx +615 -0
- package/packages/terminal-app/views/terminal/ui/SplitDragHandle.tsx +91 -0
- package/packages/terminal-app/views/terminal/ui/SplitPaneRenderer.tsx +112 -0
- package/packages/terminal-app/views/terminal/ui/TerminalPane.tsx +478 -0
- package/packages/terminal-app/views/terminal/ui/TerminalTabBar.tsx +131 -0
- package/pnpm-workspace.yaml +9 -0
- package/postcss.config.mjs +7 -0
- package/public/file.svg +1 -0
- package/public/globe.svg +1 -0
- package/public/icons/code-server.svg +6 -0
- package/public/icons/default.svg +5 -0
- package/public/icons/dusk/1password.svg +1 -0
- package/public/icons/dusk/activity_monitor.svg +1 -0
- package/public/icons/dusk/app_store.svg +1 -0
- package/public/icons/dusk/atom.svg +1 -0
- package/public/icons/dusk/brave.svg +1 -0
- package/public/icons/dusk/calculator.svg +1 -0
- package/public/icons/dusk/calendar.svg +1 -0
- package/public/icons/dusk/chrome.svg +1 -0
- package/public/icons/dusk/chrome2.svg +1 -0
- package/public/icons/dusk/dashboard.svg +13 -0
- package/public/icons/dusk/discord.svg +1 -0
- package/public/icons/dusk/dropbox.svg +1 -0
- package/public/icons/dusk/electron.svg +1 -0
- package/public/icons/dusk/figma.svg +1 -0
- package/public/icons/dusk/finder.svg +1 -0
- package/public/icons/dusk/finder2.svg +1 -0
- package/public/icons/dusk/finder3.svg +1 -0
- package/public/icons/dusk/firefox.svg +1 -0
- package/public/icons/dusk/framer.svg +1 -0
- package/public/icons/dusk/gimp.svg +1 -0
- package/public/icons/dusk/github_desktop.svg +1 -0
- package/public/icons/dusk/hyper.svg +1 -0
- package/public/icons/dusk/hyper3.svg +1 -0
- package/public/icons/dusk/intellij.svg +1 -0
- package/public/icons/dusk/iterm2.svg +1 -0
- package/public/icons/dusk/itunes.svg +1 -0
- package/public/icons/dusk/mail.svg +1 -0
- package/public/icons/dusk/messenger.svg +1 -0
- package/public/icons/dusk/mongodb.svg +1 -0
- package/public/icons/dusk/notes.svg +1 -0
- package/public/icons/dusk/notion.svg +1 -0
- package/public/icons/dusk/obs.svg +1 -0
- package/public/icons/dusk/pages.svg +1 -0
- package/public/icons/dusk/photos.svg +1 -0
- package/public/icons/dusk/postman.svg +1 -0
- package/public/icons/dusk/preview.svg +1 -0
- package/public/icons/dusk/reminders.svg +1 -0
- package/public/icons/dusk/safari.svg +1 -0
- package/public/icons/dusk/sequel_pro.svg +1 -0
- package/public/icons/dusk/sketch.svg +1 -0
- package/public/icons/dusk/skype.svg +1 -0
- package/public/icons/dusk/slack.svg +1 -0
- package/public/icons/dusk/slack2.svg +1 -0
- package/public/icons/dusk/spotify.svg +1 -0
- package/public/icons/dusk/steam.svg +1 -0
- package/public/icons/dusk/system_preferences.svg +1 -0
- package/public/icons/dusk/tableplus.svg +1 -0
- package/public/icons/dusk/teams.svg +1 -0
- package/public/icons/dusk/telegram.svg +1 -0
- package/public/icons/dusk/terminal.svg +1 -0
- package/public/icons/dusk/todoist.svg +1 -0
- package/public/icons/dusk/trash.svg +1 -0
- package/public/icons/dusk/trello.svg +1 -0
- package/public/icons/dusk/vivaldi.svg +1 -0
- package/public/icons/dusk/vlc.svg +1 -0
- package/public/icons/dusk/vscode.svg +1 -0
- package/public/icons/dusk/whatsapp.svg +1 -0
- package/public/icons/dusk/xeyes.svg +1 -0
- package/public/icons/dusk/zoom.svg +1 -0
- package/public/icons/files.svg +5 -0
- package/public/icons/pwa/icon-192.png +0 -0
- package/public/icons/pwa/icon-512.png +0 -0
- package/public/icons/settings.svg +14 -0
- package/public/icons/terminal.svg +5 -0
- package/public/icons/text-editor.svg +7 -0
- package/public/manifest.json +38 -0
- package/public/next.svg +1 -0
- package/public/sw.js +41 -0
- package/public/vercel.svg +1 -0
- package/public/wallpapers/default.svg +10 -0
- package/public/window.svg +1 -0
- package/scripts/generate-pwa-icons.mjs +33 -0
- package/scripts/install-nats.sh +37 -0
- package/sentry.client.config.ts +21 -0
- package/sentry.edge.config.ts +12 -0
- package/sentry.server.config.ts +12 -0
- package/src/app/api/files/download/route.ts +81 -0
- package/src/app/api/files/download-zip/route.ts +102 -0
- package/src/app/api/files/upload/route.ts +58 -0
- package/src/app/api/webhooks/workos/route.ts +98 -0
- package/src/app/auth/callback/route.ts +16 -0
- package/src/app/auth/logout/route.ts +15 -0
- package/src/app/desktop/desktop-shell.tsx +110 -0
- package/src/app/desktop/layout.tsx +8 -0
- package/src/app/desktop/page.tsx +24 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +7 -0
- package/src/app/layout.tsx +64 -0
- package/src/app/offline/page.tsx +83 -0
- package/src/app/page.tsx +5 -0
- package/src/app/standalone/[appId]/page.tsx +28 -0
- package/src/app/standalone/layout.tsx +10 -0
- package/src/components/app-icon.tsx +55 -0
- package/src/components/apps/_echo/schema.ts +14 -0
- package/src/components/apps/_echo/service/index.ts +42 -0
- package/src/components/apps/app-manifest.ts +97 -0
- package/src/components/apps/app-registry.ts +55 -0
- package/src/components/apps/dev3000/Dev3000App.tsx +224 -0
- package/src/components/apps/dev3000/ErrorsPanel.tsx +160 -0
- package/src/components/apps/dev3000/Sidebar.tsx +41 -0
- package/src/components/apps/dev3000/TimelineLog.tsx +173 -0
- package/src/components/apps/dev3000/dev3000-context.tsx +29 -0
- package/src/components/apps/dev3000/index.ts +4 -0
- package/src/components/apps/dev3000/schema.ts +48 -0
- package/src/components/apps/dev3000/service/index.ts +520 -0
- package/src/components/apps/dev3000/service/runtime +1 -0
- package/src/components/apps/dev3000/types.ts +15 -0
- package/src/components/apps/dev3000/use-message-buffer.ts +46 -0
- package/src/components/apps/files/ContextMenu.tsx +151 -0
- package/src/components/apps/files/DeleteConfirmDialog.tsx +78 -0
- package/src/components/apps/files/FileItem.tsx +128 -0
- package/src/components/apps/files/FilesApp.tsx +509 -0
- package/src/components/apps/files/FilesListView.tsx +201 -0
- package/src/components/apps/files/FilesToolbar.tsx +117 -0
- package/src/components/apps/files/GridView.tsx +90 -0
- package/src/components/apps/files/InlineInput.tsx +131 -0
- package/src/components/apps/files/UploadOverlay.tsx +61 -0
- package/src/components/apps/files/schema.ts +49 -0
- package/src/components/apps/files/service/index.ts +227 -0
- package/src/components/apps/files/service/runtime +1 -0
- package/src/components/apps/files/use-files.ts +201 -0
- package/src/components/apps/files/use-upload.ts +105 -0
- package/src/components/apps/nats-viewer/ActiveSubs.tsx +34 -0
- package/src/components/apps/nats-viewer/MessageLog.tsx +247 -0
- package/src/components/apps/nats-viewer/NatsViewer.tsx +209 -0
- package/src/components/apps/nats-viewer/PublishPanel.tsx +113 -0
- package/src/components/apps/nats-viewer/RequestPanel.tsx +167 -0
- package/src/components/apps/nats-viewer/Sidebar.tsx +62 -0
- package/src/components/apps/nats-viewer/SubjectCatalog.tsx +64 -0
- package/src/components/apps/nats-viewer/SubscribeInput.tsx +59 -0
- package/src/components/apps/nats-viewer/index.ts +5 -0
- package/src/components/apps/nats-viewer/nats-viewer-context.tsx +31 -0
- package/src/components/apps/nats-viewer/types.ts +7 -0
- package/src/components/apps/nats-viewer/use-message-buffer.ts +55 -0
- package/src/components/apps/settings/Settings.tsx +492 -0
- package/src/components/apps/terminal/schema.ts +82 -0
- package/src/components/apps/terminal/service/index.ts +189 -0
- package/src/components/apps/terminal/service/runtime +1 -0
- package/src/components/apps/terminal/service/session.ts +296 -0
- package/src/components/apps/terminal/service/shell-hooks/bashrc-hook.sh +21 -0
- package/src/components/apps/terminal/types.ts +26 -0
- package/src/components/apps/terminal/ui/MultiTerminalApp.tsx +617 -0
- package/src/components/apps/terminal/ui/SplitDragHandle.tsx +91 -0
- package/src/components/apps/terminal/ui/SplitPaneRenderer.tsx +112 -0
- package/src/components/apps/terminal/ui/TerminalPane.tsx +476 -0
- package/src/components/apps/terminal/ui/TerminalTabBar.tsx +131 -0
- package/src/components/desktop/AnimatedBackground.tsx +69 -0
- package/src/components/desktop/Desktop.tsx +79 -0
- package/src/components/desktop/DesktopBackground.tsx +16 -0
- package/src/components/desktop/DesktopIcon.tsx +49 -0
- package/src/components/desktop/ShortcutViewer.tsx +136 -0
- package/src/components/desktop/WindowRenderer.tsx +34 -0
- package/src/components/desktop/WindowSwitcher.tsx +42 -0
- package/src/components/notifications/NotificationCenter.tsx +153 -0
- package/src/components/notifications/NotificationToasts.tsx +66 -0
- package/src/components/notifications/OrphanSessionToast.tsx +293 -0
- package/src/components/os-primitives/collapsible-sidebar.tsx +226 -0
- package/src/components/os-primitives/dialog.tsx +76 -0
- package/src/components/os-primitives/empty-state.tsx +43 -0
- package/src/components/os-primitives/index.ts +21 -0
- package/src/components/os-primitives/list-view.tsx +155 -0
- package/src/components/os-primitives/property-panel.tsx +108 -0
- package/src/components/os-primitives/section-header.tsx +19 -0
- package/src/components/os-primitives/sidebar-nav.tsx +110 -0
- package/src/components/os-primitives/split-pane.tsx +146 -0
- package/src/components/os-primitives/status-badge.tsx +10 -0
- package/src/components/os-primitives/status-bar.tsx +100 -0
- package/src/components/os-primitives/toolbar.tsx +152 -0
- package/src/components/taskbar/AppLauncher.tsx +114 -0
- package/src/components/taskbar/RunningApps.tsx +71 -0
- package/src/components/taskbar/SystemTray.tsx +134 -0
- package/src/components/taskbar/Taskbar.tsx +45 -0
- package/src/components/taskbar/UserMenu.tsx +138 -0
- package/src/components/taskbar/WorkspaceSwitcher.tsx +9 -0
- package/src/components/ui/ContextMenu.tsx +130 -0
- package/src/components/ui/badge.tsx +39 -0
- package/src/components/ui/button.tsx +102 -0
- package/src/components/ui/command.tsx +165 -0
- package/src/components/ui/dropdown-menu.tsx +233 -0
- package/src/components/ui/input.tsx +48 -0
- package/src/components/ui/note.tsx +55 -0
- package/src/components/ui/separator.tsx +25 -0
- package/src/components/ui/spinner.tsx +42 -0
- package/src/components/ui/switch.tsx +36 -0
- package/src/components/ui/theme-provider.tsx +24 -0
- package/src/components/ui/theme-switcher.tsx +51 -0
- package/src/components/ui/tooltip.tsx +62 -0
- package/src/components/window/MobileWindowStack.tsx +218 -0
- package/src/components/window/SnapPreview.tsx +37 -0
- package/src/components/window/StandaloneFrame.tsx +170 -0
- package/src/components/window/Window.tsx +423 -0
- package/src/components/window/WindowContent.tsx +14 -0
- package/src/components/window/WindowControlsOverlay.tsx +89 -0
- package/src/components/window/WindowFrame.tsx +124 -0
- package/src/lib/auth/index.ts +27 -0
- package/src/lib/auth/roles.ts +50 -0
- package/src/lib/auth/types.ts +32 -0
- package/src/lib/auth/use-auth.ts +53 -0
- package/src/lib/auth/webhook-handler.ts +87 -0
- package/src/lib/auth/workos.ts +67 -0
- package/src/lib/constants.ts +1 -0
- package/src/lib/desktop/dedup.ts +57 -0
- package/src/lib/desktop/schema.ts +55 -0
- package/src/lib/files/filename-validation.ts +41 -0
- package/src/lib/files/safe-path.ts +49 -0
- package/src/lib/hooks/use-desktop-nats.ts +438 -0
- package/src/lib/hooks/use-is-mobile.ts +23 -0
- package/src/lib/hooks/use-launch-app.ts +79 -0
- package/src/lib/hooks/use-nats-notifications.ts +84 -0
- package/src/lib/hooks/use-nats.ts +60 -0
- package/src/lib/hooks/use-visual-viewport.ts +72 -0
- package/src/lib/icons/resolve-window-icon.ts +10 -0
- package/src/lib/keyboard/defaults.ts +146 -0
- package/src/lib/keyboard/types.ts +52 -0
- package/src/lib/keyboard/use-global-keybinds.ts +231 -0
- package/src/lib/nats-client.ts +255 -0
- package/src/lib/nats.ts +35 -0
- package/src/lib/notifications/schema.ts +12 -0
- package/src/lib/service-loader.ts +171 -0
- package/src/lib/subjects.ts +64 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/ws-bridge.ts +288 -0
- package/src/lib/ws-protocol.ts +53 -0
- package/src/lib/ws-server.ts +167 -0
- package/src/middleware.ts +57 -0
- package/src/stores/desktop-store.ts +112 -0
- package/src/stores/keybind-store.ts +66 -0
- package/src/stores/notification-store.ts +271 -0
- package/src/stores/theme-store.ts +25 -0
- package/src/stores/window-store.ts +294 -0
- package/src/theme/animations.css +68 -0
- package/src/theme/base.css +123 -0
- package/src/theme/controls.css +35 -0
- package/src/theme/design-tokens.css +276 -0
- package/src/theme/index.css +23 -0
- package/src/theme/menus.css +45 -0
- package/src/theme/status.css +41 -0
- package/src/theme/surfaces.css +94 -0
- package/src/theme/tailwind-map.css +138 -0
- package/src/theme/taskbar.css +25 -0
- package/src/theme/terminal.css +55 -0
- package/src/theme/typography.css +26 -0
- package/src/theme/utilities.css +156 -0
- package/src/theme/window.css +103 -0
- package/src/types/desktop-entry.ts +12 -0
- package/src/types/use-descendants.d.ts +13 -0
- package/src/types/window.ts +28 -0
- package/src/types.d.ts +9 -0
- package/tauri/Cargo.lock +5464 -0
- package/tauri/Cargo.toml +19 -0
- package/tauri/build.rs +3 -0
- package/tauri/capabilities/default.json +36 -0
- package/tauri/icons/128x128.png +0 -0
- package/tauri/icons/128x128@2x.png +0 -0
- package/tauri/icons/32x32.png +0 -0
- package/tauri/icons/icon.png +0 -0
- package/tauri/src/main.rs +396 -0
- package/tauri/tauri.conf.json +23 -0
- package/tsconfig.json +43 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { SUBJECTS } from '../../../../lib/subjects';
|
|
5
|
+
import { useNatsAction } from '../hooks/useNatsAction';
|
|
6
|
+
import { useNatsRequest } from '../hooks/useNatsRequest';
|
|
7
|
+
|
|
8
|
+
// --- Types matching service responses ---
|
|
9
|
+
|
|
10
|
+
interface AgentInfo {
|
|
11
|
+
name: string;
|
|
12
|
+
color: string;
|
|
13
|
+
state: string;
|
|
14
|
+
role: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface PaneData {
|
|
18
|
+
id: string;
|
|
19
|
+
agent: AgentInfo | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface WindowData {
|
|
23
|
+
panes: PaneData[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface SessionData {
|
|
27
|
+
name: string;
|
|
28
|
+
windows: WindowData[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface AgentsResponse {
|
|
32
|
+
sessions: SessionData[];
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface FlatAgent {
|
|
37
|
+
name: string;
|
|
38
|
+
role: string;
|
|
39
|
+
team: string;
|
|
40
|
+
state: string;
|
|
41
|
+
color: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// --- State dot colors ---
|
|
45
|
+
|
|
46
|
+
const STATE_DOT: Record<string, { color: string; label: string }> = {
|
|
47
|
+
working: { color: '#22c55e', label: 'Working' },
|
|
48
|
+
running: { color: '#22c55e', label: 'Running' },
|
|
49
|
+
active: { color: '#22c55e', label: 'Active' },
|
|
50
|
+
spawning: { color: '#eab308', label: 'Spawning' },
|
|
51
|
+
starting: { color: '#eab308', label: 'Starting' },
|
|
52
|
+
idle: { color: '#6b7280', label: 'Idle' },
|
|
53
|
+
offline: { color: '#6b7280', label: 'Offline' },
|
|
54
|
+
unknown: { color: '#6b7280', label: 'Unknown' },
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
function getStateDot(state: string) {
|
|
58
|
+
return STATE_DOT[state] ?? STATE_DOT.unknown;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// --- Flatten sessions → agents ---
|
|
62
|
+
|
|
63
|
+
function flattenAgents(sessions: SessionData[]): FlatAgent[] {
|
|
64
|
+
const agents: FlatAgent[] = [];
|
|
65
|
+
for (const session of sessions) {
|
|
66
|
+
for (const window of session.windows) {
|
|
67
|
+
for (const pane of window.panes) {
|
|
68
|
+
if (pane.agent) {
|
|
69
|
+
agents.push({
|
|
70
|
+
name: pane.agent.name,
|
|
71
|
+
role: pane.agent.role,
|
|
72
|
+
team: session.name,
|
|
73
|
+
state: pane.agent.state,
|
|
74
|
+
color: pane.agent.color,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return agents;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// --- Answer dialog ---
|
|
84
|
+
|
|
85
|
+
function AnswerDialog({ agentName, onClose }: { agentName: string; onClose: () => void }) {
|
|
86
|
+
const [input, setInput] = useState('');
|
|
87
|
+
const { execute, loading, error } = useNatsAction(SUBJECTS.agent.answer());
|
|
88
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
inputRef.current?.focus();
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
const handleSubmit = useCallback(async () => {
|
|
95
|
+
if (!input.trim()) return;
|
|
96
|
+
try {
|
|
97
|
+
await execute({ name: agentName, choice: input.trim() });
|
|
98
|
+
onClose();
|
|
99
|
+
} catch {
|
|
100
|
+
// error is surfaced via the hook
|
|
101
|
+
}
|
|
102
|
+
}, [input, agentName, execute, onClose]);
|
|
103
|
+
|
|
104
|
+
const handleKeyDown = useCallback(
|
|
105
|
+
(e: React.KeyboardEvent) => {
|
|
106
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
handleSubmit();
|
|
109
|
+
}
|
|
110
|
+
if (e.key === 'Escape') {
|
|
111
|
+
onClose();
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
[handleSubmit, onClose]
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60" onClick={onClose}>
|
|
119
|
+
<div
|
|
120
|
+
className="w-80 rounded-lg border border-white/10 bg-[#1a1a2e] p-4 shadow-xl"
|
|
121
|
+
onClick={(e) => e.stopPropagation()}
|
|
122
|
+
>
|
|
123
|
+
<h3 className="text-sm font-semibold text-[var(--os-text-primary)] mb-1">Answer: {agentName}</h3>
|
|
124
|
+
<p className="text-xs text-[var(--os-text-secondary)] mb-3">
|
|
125
|
+
Enter a number for choices, or "text:your message" for free-form input.
|
|
126
|
+
</p>
|
|
127
|
+
|
|
128
|
+
<input
|
|
129
|
+
ref={inputRef}
|
|
130
|
+
type="text"
|
|
131
|
+
value={input}
|
|
132
|
+
onChange={(e) => setInput(e.target.value)}
|
|
133
|
+
onKeyDown={handleKeyDown}
|
|
134
|
+
placeholder="e.g. 1 or text:continue"
|
|
135
|
+
className="w-full rounded border border-white/10 bg-white/5 px-2 py-1.5 text-xs text-[var(--os-text-primary)] placeholder:text-[var(--os-text-secondary)] focus:border-blue-500/50 focus:outline-none"
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
{error && <p className="mt-1 text-xs text-red-400">{error}</p>}
|
|
139
|
+
|
|
140
|
+
<div className="mt-3 flex justify-end gap-2">
|
|
141
|
+
<button
|
|
142
|
+
type="button"
|
|
143
|
+
onClick={onClose}
|
|
144
|
+
className="rounded px-2.5 py-1 text-xs text-[var(--os-text-secondary)] hover:bg-white/10"
|
|
145
|
+
>
|
|
146
|
+
Cancel
|
|
147
|
+
</button>
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
onClick={handleSubmit}
|
|
151
|
+
disabled={loading || !input.trim()}
|
|
152
|
+
className="rounded bg-blue-600 px-2.5 py-1 text-xs text-white hover:bg-blue-500 disabled:opacity-50"
|
|
153
|
+
>
|
|
154
|
+
{loading ? 'Sending...' : 'Send'}
|
|
155
|
+
</button>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// --- Kill confirmation dialog ---
|
|
163
|
+
|
|
164
|
+
function KillConfirmDialog({
|
|
165
|
+
agentName,
|
|
166
|
+
onConfirm,
|
|
167
|
+
onCancel,
|
|
168
|
+
loading,
|
|
169
|
+
}: {
|
|
170
|
+
agentName: string;
|
|
171
|
+
onConfirm: () => void;
|
|
172
|
+
onCancel: () => void;
|
|
173
|
+
loading: boolean;
|
|
174
|
+
}) {
|
|
175
|
+
return (
|
|
176
|
+
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60" onClick={onCancel}>
|
|
177
|
+
<div
|
|
178
|
+
className="w-72 rounded-lg border border-white/10 bg-[#1a1a2e] p-4 shadow-xl"
|
|
179
|
+
onClick={(e) => e.stopPropagation()}
|
|
180
|
+
>
|
|
181
|
+
<h3 className="text-sm font-semibold text-[var(--os-text-primary)] mb-2">Kill Agent</h3>
|
|
182
|
+
<p className="text-xs text-[var(--os-text-secondary)] mb-4">
|
|
183
|
+
Are you sure you want to kill <span className="text-red-400 font-semibold">{agentName}</span>? This action
|
|
184
|
+
cannot be undone.
|
|
185
|
+
</p>
|
|
186
|
+
<div className="flex justify-end gap-2">
|
|
187
|
+
<button
|
|
188
|
+
type="button"
|
|
189
|
+
onClick={onCancel}
|
|
190
|
+
className="rounded px-2.5 py-1 text-xs text-[var(--os-text-secondary)] hover:bg-white/10"
|
|
191
|
+
>
|
|
192
|
+
Cancel
|
|
193
|
+
</button>
|
|
194
|
+
<button
|
|
195
|
+
type="button"
|
|
196
|
+
onClick={onConfirm}
|
|
197
|
+
disabled={loading}
|
|
198
|
+
className="rounded bg-red-600 px-2.5 py-1 text-xs text-white hover:bg-red-500 disabled:opacity-50"
|
|
199
|
+
>
|
|
200
|
+
{loading ? 'Killing...' : 'Kill'}
|
|
201
|
+
</button>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// --- Agent row ---
|
|
209
|
+
|
|
210
|
+
function AgentRow({
|
|
211
|
+
agent,
|
|
212
|
+
onKill,
|
|
213
|
+
onStop,
|
|
214
|
+
onAnswer,
|
|
215
|
+
}: {
|
|
216
|
+
agent: FlatAgent;
|
|
217
|
+
onKill: () => void;
|
|
218
|
+
onStop: () => void;
|
|
219
|
+
onAnswer: () => void;
|
|
220
|
+
}) {
|
|
221
|
+
const dot = getStateDot(agent.state);
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<div className="group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-white/5">
|
|
225
|
+
{/* State dot */}
|
|
226
|
+
<div className="h-2 w-2 shrink-0 rounded-full" style={{ backgroundColor: dot.color }} title={dot.label} />
|
|
227
|
+
|
|
228
|
+
{/* Name + meta */}
|
|
229
|
+
<div className="min-w-0 flex-1">
|
|
230
|
+
<div className="truncate text-xs font-medium text-[var(--os-text-primary)]">{agent.name}</div>
|
|
231
|
+
<div className="flex items-center gap-1.5 text-[10px] text-[var(--os-text-secondary)]">
|
|
232
|
+
{agent.role && <span className="rounded bg-white/10 px-1 py-px">{agent.role}</span>}
|
|
233
|
+
<span className="truncate">{agent.team}</span>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
{/* Action buttons — visible on hover */}
|
|
238
|
+
<div className="flex shrink-0 items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
239
|
+
{/* Answer */}
|
|
240
|
+
<button
|
|
241
|
+
type="button"
|
|
242
|
+
onClick={onAnswer}
|
|
243
|
+
className="rounded p-1 text-[var(--os-text-secondary)] hover:bg-blue-500/20 hover:text-blue-400"
|
|
244
|
+
title="Answer"
|
|
245
|
+
>
|
|
246
|
+
<svg
|
|
247
|
+
width="12"
|
|
248
|
+
height="12"
|
|
249
|
+
viewBox="0 0 12 12"
|
|
250
|
+
fill="none"
|
|
251
|
+
stroke="currentColor"
|
|
252
|
+
strokeWidth="1.5"
|
|
253
|
+
strokeLinecap="round"
|
|
254
|
+
strokeLinejoin="round"
|
|
255
|
+
>
|
|
256
|
+
<title>Answer</title>
|
|
257
|
+
<path d="M1 3h10a.5.5 0 01.5.5v5a.5.5 0 01-.5.5H4l-2 1.5V3.5A.5.5 0 011 3z" />
|
|
258
|
+
</svg>
|
|
259
|
+
</button>
|
|
260
|
+
|
|
261
|
+
{/* Stop */}
|
|
262
|
+
<button
|
|
263
|
+
type="button"
|
|
264
|
+
onClick={onStop}
|
|
265
|
+
className="rounded p-1 text-[var(--os-text-secondary)] hover:bg-yellow-500/20 hover:text-yellow-400"
|
|
266
|
+
title="Stop"
|
|
267
|
+
>
|
|
268
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.5">
|
|
269
|
+
<title>Stop</title>
|
|
270
|
+
<rect x="2" y="2" width="3" height="8" rx="0.5" />
|
|
271
|
+
<rect x="7" y="2" width="3" height="8" rx="0.5" />
|
|
272
|
+
</svg>
|
|
273
|
+
</button>
|
|
274
|
+
|
|
275
|
+
{/* Kill */}
|
|
276
|
+
<button
|
|
277
|
+
type="button"
|
|
278
|
+
onClick={onKill}
|
|
279
|
+
className="rounded p-1 text-[var(--os-text-secondary)] hover:bg-red-500/20 hover:text-red-400"
|
|
280
|
+
title="Kill"
|
|
281
|
+
>
|
|
282
|
+
<svg
|
|
283
|
+
width="12"
|
|
284
|
+
height="12"
|
|
285
|
+
viewBox="0 0 12 12"
|
|
286
|
+
fill="none"
|
|
287
|
+
stroke="currentColor"
|
|
288
|
+
strokeWidth="1.5"
|
|
289
|
+
strokeLinecap="round"
|
|
290
|
+
>
|
|
291
|
+
<title>Kill</title>
|
|
292
|
+
<path d="M2 2l8 8M10 2l-8 8" />
|
|
293
|
+
</svg>
|
|
294
|
+
</button>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// --- Main panel ---
|
|
301
|
+
|
|
302
|
+
export function AgentsPanel() {
|
|
303
|
+
const { data, loading, error, refetch } = useNatsRequest<AgentsResponse>(SUBJECTS.agents.list(), undefined, 5000);
|
|
304
|
+
|
|
305
|
+
const killAction = useNatsAction(SUBJECTS.agent.kill());
|
|
306
|
+
const stopAction = useNatsAction(SUBJECTS.agent.stop());
|
|
307
|
+
|
|
308
|
+
const [answerTarget, setAnswerTarget] = useState<string | null>(null);
|
|
309
|
+
const [killTarget, setKillTarget] = useState<string | null>(null);
|
|
310
|
+
|
|
311
|
+
const agents = data?.sessions ? flattenAgents(data.sessions) : [];
|
|
312
|
+
|
|
313
|
+
const handleKillConfirm = useCallback(async () => {
|
|
314
|
+
if (!killTarget) return;
|
|
315
|
+
try {
|
|
316
|
+
await killAction.execute({ name: killTarget });
|
|
317
|
+
setKillTarget(null);
|
|
318
|
+
refetch();
|
|
319
|
+
} catch {
|
|
320
|
+
// error surfaced via hook
|
|
321
|
+
}
|
|
322
|
+
}, [killTarget, killAction, refetch]);
|
|
323
|
+
|
|
324
|
+
const handleStop = useCallback(
|
|
325
|
+
async (name: string) => {
|
|
326
|
+
try {
|
|
327
|
+
await stopAction.execute({ name });
|
|
328
|
+
refetch();
|
|
329
|
+
} catch {
|
|
330
|
+
// error surfaced via hook
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
[stopAction, refetch]
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
if (loading && !data) {
|
|
337
|
+
return (
|
|
338
|
+
<div className="flex h-32 items-center justify-center">
|
|
339
|
+
<p className="text-xs text-[var(--os-text-secondary)]">Loading agents...</p>
|
|
340
|
+
</div>
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (error && !data) {
|
|
345
|
+
return (
|
|
346
|
+
<div className="flex flex-col items-center justify-center gap-2 p-4">
|
|
347
|
+
<p className="text-xs text-red-400">{error}</p>
|
|
348
|
+
<button type="button" onClick={refetch} className="rounded bg-white/10 px-2 py-0.5 text-xs hover:bg-white/20">
|
|
349
|
+
Retry
|
|
350
|
+
</button>
|
|
351
|
+
</div>
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return (
|
|
356
|
+
<div className="flex flex-col gap-1 p-2">
|
|
357
|
+
{/* Header with count */}
|
|
358
|
+
<div className="flex items-center justify-between px-1 mb-1">
|
|
359
|
+
<span className="text-[10px] text-[var(--os-text-secondary)]">
|
|
360
|
+
{agents.length} agent{agents.length !== 1 ? 's' : ''}
|
|
361
|
+
</span>
|
|
362
|
+
{(killAction.error || stopAction.error) && (
|
|
363
|
+
<span className="text-[10px] text-red-400 truncate max-w-[150px]">
|
|
364
|
+
{killAction.error || stopAction.error}
|
|
365
|
+
</span>
|
|
366
|
+
)}
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
{agents.length === 0 ? (
|
|
370
|
+
<div className="flex h-20 items-center justify-center">
|
|
371
|
+
<p className="text-xs text-[var(--os-text-secondary)]">No agents running</p>
|
|
372
|
+
</div>
|
|
373
|
+
) : (
|
|
374
|
+
agents.map((agent) => (
|
|
375
|
+
<AgentRow
|
|
376
|
+
key={agent.name}
|
|
377
|
+
agent={agent}
|
|
378
|
+
onKill={() => setKillTarget(agent.name)}
|
|
379
|
+
onStop={() => handleStop(agent.name)}
|
|
380
|
+
onAnswer={() => setAnswerTarget(agent.name)}
|
|
381
|
+
/>
|
|
382
|
+
))
|
|
383
|
+
)}
|
|
384
|
+
|
|
385
|
+
{/* Answer dialog */}
|
|
386
|
+
{answerTarget && <AnswerDialog agentName={answerTarget} onClose={() => setAnswerTarget(null)} />}
|
|
387
|
+
|
|
388
|
+
{/* Kill confirmation */}
|
|
389
|
+
{killTarget && (
|
|
390
|
+
<KillConfirmDialog
|
|
391
|
+
agentName={killTarget}
|
|
392
|
+
onConfirm={handleKillConfirm}
|
|
393
|
+
onCancel={() => setKillTarget(null)}
|
|
394
|
+
loading={killAction.loading}
|
|
395
|
+
/>
|
|
396
|
+
)}
|
|
397
|
+
</div>
|
|
398
|
+
);
|
|
399
|
+
}
|