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
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Khal
|
|
2
|
+
|
|
3
|
+
Next.js desktop environment with NATS-based services.
|
|
4
|
+
|
|
5
|
+
## Running
|
|
6
|
+
|
|
7
|
+
All processes managed via PM2 from project root:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pm2 start ecosystem.config.cjs # start all
|
|
11
|
+
pm2 restart <name> # restart one (does NOT reload config)
|
|
12
|
+
pm2 delete <name> && pm2 start ecosystem.config.cjs --only <name> # reload config
|
|
13
|
+
pm2 logs <name> --lines 20 # view logs
|
|
14
|
+
pm2 flush <name> # clear logs
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### PM2 Processes
|
|
18
|
+
|
|
19
|
+
| Name | What | Port |
|
|
20
|
+
|------|------|------|
|
|
21
|
+
| `khal-nats` | NATS server (`nats.conf`, JetStream enabled) | 4222 (localhost only) |
|
|
22
|
+
| `khal-services` | Service loader — auto-discovers `**/service/index.ts` under `src/components/apps/`. The dev3000 service spawns d3k which runs `bun dev` (headless Chrome + log capture). | 8888 (via d3k) |
|
|
23
|
+
| `khal-ws-bridge` | WebSocket-to-NATS bridge (`src/lib/ws-server.ts`) | 4280 |
|
|
24
|
+
|
|
25
|
+
### Service Loader Runtime
|
|
26
|
+
|
|
27
|
+
Services run under **Bun** by default. Services that need Node.js (e.g. `node-pty`) place a `service/runtime` file containing `node` — the loader spawns them via `npx tsx` instead.
|
|
28
|
+
|
|
29
|
+
- `node-pty` does NOT work under Bun (PTY gets SIGHUP immediately). The terminal service uses `runtime: node`.
|
|
30
|
+
- `import.meta.dir` is Bun-only. Use `import.meta.dirname ?? dirname(fileURLToPath(import.meta.url))` for cross-runtime compat.
|
|
31
|
+
- `import pty from 'node-pty'` fails under tsx (CJS compat). Use `import * as pty from 'node-pty'`.
|
|
32
|
+
|
|
33
|
+
### Caddy (reverse proxy)
|
|
34
|
+
|
|
35
|
+
- `dev.khal.namastex.io` → Next.js (:8888) + WS bridge (:4280 at `/ws/*`)
|
|
36
|
+
- Caddyfile at `/etc/caddy/Caddyfile` (needs `sudo` to edit)
|
|
37
|
+
- `sudo caddy validate --config /etc/caddy/Caddyfile && sudo caddy reload --config /etc/caddy/Caddyfile`
|
|
38
|
+
|
|
39
|
+
## Architecture
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Browser ↔ Caddy ↔ Next.js (UI, SSR)
|
|
43
|
+
↔ WS bridge ↔ NATS ↔ Services (PTY, echo, …)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- **Browser**: `NatsClient` singleton connects to `/ws/nats`, provides `subscribe/publish/request`
|
|
47
|
+
- **WS bridge**: multiplexes browser WS frames to NATS subjects (sub/unsub/pub/req)
|
|
48
|
+
- **Services**: colocated with their UI app under `src/components/apps/<name>/service/`
|
|
49
|
+
- **NATS subjects**: all prefixed `khal.` — see `src/lib/subjects.ts`
|
|
50
|
+
|
|
51
|
+
### dev3000 (d3k — browser monitoring)
|
|
52
|
+
|
|
53
|
+
- Service: `src/components/apps/dev3000/service/` (runs under Node/tsx)
|
|
54
|
+
- UI: `src/components/apps/dev3000/` (Dev3000App, TimelineLog, ErrorsPanel, Sidebar)
|
|
55
|
+
- d3k spawns headless Chrome + `bun dev` on port 8888, captures server logs, browser console, network requests, DOM events, and screenshots via CDP
|
|
56
|
+
- Logs are tailed from `~/.d3k/khal-*/logs/` and published to NATS `khal.{orgId}.d3k.log`
|
|
57
|
+
- d3k binary and Chrome are discovered at runtime (`findBin()`, `findChromeBin()`)
|
|
58
|
+
- `VERCEL_SANDBOX=1` env disables d3k's health check (prevents crash loop under PM2)
|
|
59
|
+
- Auto-restarts d3k on crash with 5s delay
|
|
60
|
+
|
|
61
|
+
#### Machine auth bypass (OS_SECRET)
|
|
62
|
+
|
|
63
|
+
d3k's headless Chrome needs to render `/desktop` without logging in. When `OS_SECRET` is set in `.env`:
|
|
64
|
+
|
|
65
|
+
- **Middleware** (`src/middleware.ts`): detects `HeadlessChrome` User-Agent, sets `x-workos-middleware: true` header, skips WorkOS redirect. `withAuth()` returns `{ user: null }` gracefully.
|
|
66
|
+
- **WS bridge** (`src/lib/ws-server.ts`): detects `HeadlessChrome` User-Agent, creates synthetic machine session (`userId: 'machine'`, `role: 'admin'`).
|
|
67
|
+
- Desktop renders in `LOCAL_WORKSPACE_ID` mode (no real user context).
|
|
68
|
+
- Only active on localhost; external traffic goes through Caddy → WorkOS auth as normal.
|
|
69
|
+
|
|
70
|
+
#### agent-browser (CDP automation)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
d3k cdp-port # show CDP port (default 9222)
|
|
74
|
+
d3k agent-browser --cdp 9222 screenshot out.png # screenshot d3k's Chrome
|
|
75
|
+
d3k agent-browser --cdp 9222 snapshot -i # accessibility tree
|
|
76
|
+
d3k agent-browser --cdp 9222 get url # current URL
|
|
77
|
+
d3k agent-browser --cdp 9222 get title # page title
|
|
78
|
+
d3k agent-browser --cdp 9222 click <selector> # click element
|
|
79
|
+
d3k agent-browser --cdp 9222 eval "document.title" # run JS
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Requires `agent-browser` installed globally (`bun install -g agent-browser`).
|
|
83
|
+
|
|
84
|
+
### Terminal (PTY via NATS)
|
|
85
|
+
|
|
86
|
+
- Service: `src/components/apps/terminal/service/` (runs under Node/tsx)
|
|
87
|
+
- UI: `src/components/apps/terminal/ui/`
|
|
88
|
+
- Schemas: `src/components/apps/terminal/schema.ts` (TypeBox)
|
|
89
|
+
- Sessions persist across page reloads (72h TTL, 1MB ring buffer)
|
|
90
|
+
- Buffer replay is **client-initiated**: client subscribes first, then publishes `.replay`
|
|
91
|
+
- `useNats()` hook → `subscribe/publish/request` over the WS bridge
|
|
92
|
+
|
|
93
|
+
## Lint / Build
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
bun biome check --write . # lint + format
|
|
97
|
+
bunx tsc --noEmit # typecheck
|
|
98
|
+
bun next build # production build
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- Biome config: `biome.json` — `**/service/**` override allows console.log
|
|
102
|
+
- `serverExternalPackages: ['node-pty']` in `next.config.ts`
|
|
103
|
+
|
|
104
|
+
## Verification Gate
|
|
105
|
+
|
|
106
|
+
Before claiming any work is complete, **run verification first**:
|
|
107
|
+
|
|
108
|
+
1. `bun biome check .` — lint + format clean
|
|
109
|
+
2. `bunx tsc --noEmit` — no type errors
|
|
110
|
+
|
|
111
|
+
Never say "tests pass", "build succeeds", or "should work now" without showing command output.
|
|
112
|
+
These hooks run automatically on Stop (after each response that edits .ts/.tsx files).
|
|
113
|
+
|
|
114
|
+
## Hooks
|
|
115
|
+
|
|
116
|
+
- **git-safety** (`PreToolUse/Bash`): blocks `push --force`, `reset --hard`, `checkout .`, `clean -f`, `branch -D`
|
|
117
|
+
- **verify-build** (`Stop`): runs Biome + TypeScript check if .ts/.tsx files were modified in the last 60s
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Vercel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Khal
|
|
2
|
+
|
|
3
|
+
A desktop-in-browser OS shell built with Next.js, React, and Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install
|
|
9
|
+
pnpm dev # Next.js on port 1111
|
|
10
|
+
node pty-server.mjs # PTY + WebSocket on port 1112
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Open http://localhost:1111 to see the desktop.
|
|
14
|
+
|
|
15
|
+
## Default Apps
|
|
16
|
+
|
|
17
|
+
- **Terminal** — Full terminal emulator (xterm.js + node-pty)
|
|
18
|
+
- **Settings** — Theme switcher and desktop configuration
|
|
19
|
+
- **Files** — Example stub app (replace with your own)
|
|
20
|
+
|
|
21
|
+
## Adding a New App
|
|
22
|
+
|
|
23
|
+
1. Create a component in `src/components/apps/<your-app>/`
|
|
24
|
+
- Must accept `{ windowId: string; meta?: Record<string, unknown> }`
|
|
25
|
+
2. Register in `src/components/apps/app-registry.ts`
|
|
26
|
+
3. Add a `DesktopEntry` in `src/stores/desktop-store.ts`
|
|
27
|
+
4. (Optional) Set default window size in `src/lib/hooks/use-launch-app.ts`
|
|
28
|
+
5. (Optional) Add a keyboard shortcut in `src/lib/keyboard/defaults.ts`
|
|
29
|
+
|
|
30
|
+
## Architecture
|
|
31
|
+
|
|
32
|
+
- **Window Manager** — Draggable, resizable windows with snap, minimize, maximize
|
|
33
|
+
- **Taskbar** — App launcher, running apps, system tray, workspace switcher
|
|
34
|
+
- **Workspaces** — Virtual desktops
|
|
35
|
+
- **Keyboard Shortcuts** — Configurable global hotkeys
|
|
36
|
+
- **Notifications** — Toast + notification center
|
|
37
|
+
- **PTY Server** — WebSocket-based terminal backend with session persistence
|
|
38
|
+
- **Theme System** — Light/dark mode via CSS custom properties
|
package/biome.json
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.4.2/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": true,
|
|
7
|
+
"defaultBranch": "main"
|
|
8
|
+
},
|
|
9
|
+
"formatter": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"indentStyle": "tab",
|
|
12
|
+
"indentWidth": 2,
|
|
13
|
+
"lineWidth": 120
|
|
14
|
+
},
|
|
15
|
+
"linter": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"rules": {
|
|
18
|
+
"recommended": true,
|
|
19
|
+
"a11y": {
|
|
20
|
+
"useButtonType": "off",
|
|
21
|
+
"useSemanticElements": "off",
|
|
22
|
+
"noStaticElementInteractions": "off",
|
|
23
|
+
"useKeyWithClickEvents": "off",
|
|
24
|
+
"noSvgWithoutTitle": "off",
|
|
25
|
+
"useFocusableInteractive": "off",
|
|
26
|
+
"useAriaPropsForRole": "off",
|
|
27
|
+
"noLabelWithoutControl": "off",
|
|
28
|
+
"useAriaPropsSupportedByRole": "off",
|
|
29
|
+
"noNoninteractiveTabindex": "off"
|
|
30
|
+
},
|
|
31
|
+
"suspicious": {
|
|
32
|
+
"noExplicitAny": "error",
|
|
33
|
+
"noConsole": "warn",
|
|
34
|
+
"noTsIgnore": "off",
|
|
35
|
+
"useBiomeIgnoreFolder": "off"
|
|
36
|
+
},
|
|
37
|
+
"style": {
|
|
38
|
+
"noUnusedTemplateLiteral": "error",
|
|
39
|
+
"useImportType": "off",
|
|
40
|
+
"noNonNullAssertion": "off",
|
|
41
|
+
"useTemplate": "off",
|
|
42
|
+
"useNodejsImportProtocol": "off",
|
|
43
|
+
"useConst": "error"
|
|
44
|
+
},
|
|
45
|
+
"correctness": {
|
|
46
|
+
"noUnusedImports": "error",
|
|
47
|
+
"noUnusedVariables": "error",
|
|
48
|
+
"noUnusedFunctionParameters": "error",
|
|
49
|
+
"useExhaustiveDependencies": "off",
|
|
50
|
+
"useHookAtTopLevel": "off"
|
|
51
|
+
},
|
|
52
|
+
"complexity": {
|
|
53
|
+
"useLiteralKeys": "off",
|
|
54
|
+
"noImportantStyles": "off",
|
|
55
|
+
"useOptionalChain": "off",
|
|
56
|
+
"noExcessiveCognitiveComplexity": "warn",
|
|
57
|
+
"useFlatMap": "error"
|
|
58
|
+
},
|
|
59
|
+
"performance": {
|
|
60
|
+
"noImgElement": "off"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"css": {
|
|
65
|
+
"parser": {
|
|
66
|
+
"cssModules": false,
|
|
67
|
+
"allowWrongLineComments": false
|
|
68
|
+
},
|
|
69
|
+
"linter": {
|
|
70
|
+
"enabled": false
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"javascript": {
|
|
74
|
+
"globals": ["React"],
|
|
75
|
+
"formatter": {
|
|
76
|
+
"quoteStyle": "single",
|
|
77
|
+
"trailingCommas": "es5",
|
|
78
|
+
"semicolons": "always"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"files": {
|
|
82
|
+
"includes": [
|
|
83
|
+
"**",
|
|
84
|
+
"!node_modules/**",
|
|
85
|
+
"!.next/**",
|
|
86
|
+
"!**/dist/**",
|
|
87
|
+
"!.genie/**",
|
|
88
|
+
"!src/types/use-descendants.d.ts",
|
|
89
|
+
"!**/*.css"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"overrides": [
|
|
93
|
+
{
|
|
94
|
+
"includes": [
|
|
95
|
+
"scripts/**",
|
|
96
|
+
"src/lib/service-loader.ts",
|
|
97
|
+
"src/lib/nats.ts",
|
|
98
|
+
"src/lib/ws-bridge.ts",
|
|
99
|
+
"src/lib/ws-server.ts",
|
|
100
|
+
"**/service/**",
|
|
101
|
+
"src/app/api/webhooks/**",
|
|
102
|
+
"src/lib/auth/webhook-handler.ts",
|
|
103
|
+
"packages/os-cli/**"
|
|
104
|
+
],
|
|
105
|
+
"linter": {
|
|
106
|
+
"rules": {
|
|
107
|
+
"suspicious": {
|
|
108
|
+
"noConsole": "off"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"includes": ["sentry.*.config.ts", "instrumentation.ts"],
|
|
115
|
+
"linter": {
|
|
116
|
+
"rules": {
|
|
117
|
+
"style": {
|
|
118
|
+
"useImportType": "off"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|