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,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Communication domain — inter-agent messaging and team chat.
|
|
3
|
+
*
|
|
4
|
+
* Endpoints:
|
|
5
|
+
* os.genie.comms.send — send message to a specific agent
|
|
6
|
+
* os.genie.comms.broadcast — broadcast message to all/team agents
|
|
7
|
+
* os.genie.comms.inbox — read agent inbox
|
|
8
|
+
* os.genie.comms.chat.post — post to team chat
|
|
9
|
+
* os.genie.comms.chat.read — read team chat history
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { ServiceHandler } from '@genie-os/sdk/service';
|
|
13
|
+
import { SUBJECTS } from '../../../lib/subjects';
|
|
14
|
+
import { runGenie } from './cli';
|
|
15
|
+
|
|
16
|
+
export const commsHandlers: ServiceHandler[] = [
|
|
17
|
+
// --- Send message to agent ---
|
|
18
|
+
{
|
|
19
|
+
subject: SUBJECTS.comms.send(),
|
|
20
|
+
handler: (msg) => {
|
|
21
|
+
try {
|
|
22
|
+
const req = msg.json<{ body: string; to: string; from?: string }>();
|
|
23
|
+
if (!req.body || !req.to) {
|
|
24
|
+
msg.respond(JSON.stringify({ error: 'Missing required fields: body, to' }));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const args = ['send', req.body, '--to', req.to];
|
|
29
|
+
if (req.from) args.push('--from', req.from);
|
|
30
|
+
|
|
31
|
+
const result = runGenie(args, { json: false });
|
|
32
|
+
if (!result.ok) {
|
|
33
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
msg.respond(JSON.stringify({ ok: true }));
|
|
37
|
+
} catch (err) {
|
|
38
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// --- Broadcast message ---
|
|
44
|
+
{
|
|
45
|
+
subject: SUBJECTS.comms.broadcast(),
|
|
46
|
+
handler: (msg) => {
|
|
47
|
+
try {
|
|
48
|
+
const req = msg.json<{ body: string; team?: string }>();
|
|
49
|
+
if (!req.body) {
|
|
50
|
+
msg.respond(JSON.stringify({ error: 'Missing required field: body' }));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const args = ['broadcast', req.body];
|
|
55
|
+
if (req.team) args.push('--team', req.team);
|
|
56
|
+
|
|
57
|
+
const result = runGenie(args, { json: false });
|
|
58
|
+
if (!result.ok) {
|
|
59
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
msg.respond(JSON.stringify({ ok: true }));
|
|
63
|
+
} catch (err) {
|
|
64
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// --- Read inbox ---
|
|
70
|
+
{
|
|
71
|
+
subject: SUBJECTS.comms.inbox(),
|
|
72
|
+
handler: (msg) => {
|
|
73
|
+
try {
|
|
74
|
+
const req = msg.json<{ agent?: string; unread?: boolean }>();
|
|
75
|
+
const args = ['inbox'];
|
|
76
|
+
if (req.agent) args.push(req.agent);
|
|
77
|
+
args.push('--json');
|
|
78
|
+
if (req.unread) args.push('--unread');
|
|
79
|
+
|
|
80
|
+
const result = runGenie<unknown[]>(args);
|
|
81
|
+
if (!result.ok) {
|
|
82
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const messages = Array.isArray(result.data) ? result.data : [];
|
|
86
|
+
msg.respond(JSON.stringify({ messages }));
|
|
87
|
+
} catch (err) {
|
|
88
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
// --- Post to team chat ---
|
|
94
|
+
{
|
|
95
|
+
subject: SUBJECTS.comms.chat.post(),
|
|
96
|
+
handler: (msg) => {
|
|
97
|
+
try {
|
|
98
|
+
const req = msg.json<{ message: string; team?: string }>();
|
|
99
|
+
if (!req.message) {
|
|
100
|
+
msg.respond(JSON.stringify({ error: 'Missing required field: message' }));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const args = ['chat', req.message];
|
|
105
|
+
if (req.team) args.push('--team', req.team);
|
|
106
|
+
|
|
107
|
+
const result = runGenie(args, { json: false });
|
|
108
|
+
if (!result.ok) {
|
|
109
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
msg.respond(JSON.stringify({ ok: true }));
|
|
113
|
+
} catch (err) {
|
|
114
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// --- Read team chat ---
|
|
120
|
+
{
|
|
121
|
+
subject: SUBJECTS.comms.chat.read(),
|
|
122
|
+
handler: (msg) => {
|
|
123
|
+
try {
|
|
124
|
+
const req = msg.json<{ team?: string; since?: string }>();
|
|
125
|
+
const args = ['chat', 'read', '--json'];
|
|
126
|
+
if (req.team) args.push('--team', req.team);
|
|
127
|
+
if (req.since) args.push('--since', req.since);
|
|
128
|
+
|
|
129
|
+
const result = runGenie<unknown[]>(args);
|
|
130
|
+
if (!result.ok) {
|
|
131
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const messages = Array.isArray(result.data) ? result.data : [];
|
|
135
|
+
msg.respond(JSON.stringify({ messages }));
|
|
136
|
+
} catch (err) {
|
|
137
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
];
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { SUBJECTS } from '../../../lib/subjects';
|
|
2
|
+
import { runGenie } from './cli';
|
|
3
|
+
|
|
4
|
+
interface DirListPayload {
|
|
5
|
+
builtins?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface DirGetPayload {
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface DirAddPayload {
|
|
13
|
+
name: string;
|
|
14
|
+
dir?: string;
|
|
15
|
+
repo?: string;
|
|
16
|
+
model?: string;
|
|
17
|
+
roles?: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface DirRemovePayload {
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface DirEditPayload {
|
|
25
|
+
name: string;
|
|
26
|
+
model?: string;
|
|
27
|
+
dir?: string;
|
|
28
|
+
repo?: string;
|
|
29
|
+
roles?: string[];
|
|
30
|
+
description?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const directorySubscriptions = [
|
|
34
|
+
// --- List directory entries ---
|
|
35
|
+
{
|
|
36
|
+
subject: SUBJECTS.dir.list(),
|
|
37
|
+
handler: (msg: { data: Uint8Array; json: <T>() => T; respond: (data: string) => void }) => {
|
|
38
|
+
try {
|
|
39
|
+
const payload = msg.data.length > 0 ? msg.json<DirListPayload>() : {};
|
|
40
|
+
const args = ['dir', 'ls', '--json'];
|
|
41
|
+
if (payload.builtins) args.push('--builtins');
|
|
42
|
+
|
|
43
|
+
const result = runGenie(args);
|
|
44
|
+
if (!result.ok) {
|
|
45
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
msg.respond(JSON.stringify({ entries: result.data }));
|
|
49
|
+
} catch (err) {
|
|
50
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
// --- Get single directory entry ---
|
|
56
|
+
{
|
|
57
|
+
subject: SUBJECTS.dir.get(),
|
|
58
|
+
handler: (msg: { data: Uint8Array; json: <T>() => T; respond: (data: string) => void }) => {
|
|
59
|
+
try {
|
|
60
|
+
const { name } = msg.json<DirGetPayload>();
|
|
61
|
+
if (!name) {
|
|
62
|
+
msg.respond(JSON.stringify({ error: 'name is required' }));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const result = runGenie(['dir', 'ls', name, '--json']);
|
|
67
|
+
if (!result.ok) {
|
|
68
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
msg.respond(JSON.stringify({ entry: result.data }));
|
|
72
|
+
} catch (err) {
|
|
73
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// --- Add directory entry ---
|
|
79
|
+
{
|
|
80
|
+
subject: SUBJECTS.dir.add(),
|
|
81
|
+
handler: (msg: { data: Uint8Array; json: <T>() => T; respond: (data: string) => void }) => {
|
|
82
|
+
try {
|
|
83
|
+
const { name, dir, repo, model, roles } = msg.json<DirAddPayload>();
|
|
84
|
+
if (!name) {
|
|
85
|
+
msg.respond(JSON.stringify({ error: 'name is required' }));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const args = ['dir', 'add', name];
|
|
90
|
+
if (dir) args.push('--dir', dir);
|
|
91
|
+
if (repo) args.push('--repo', repo);
|
|
92
|
+
if (model) args.push('--model', model);
|
|
93
|
+
if (roles) {
|
|
94
|
+
for (const role of roles) {
|
|
95
|
+
args.push('--role', role);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const result = runGenie(args, { json: false });
|
|
100
|
+
if (!result.ok) {
|
|
101
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
msg.respond(JSON.stringify({ ok: true }));
|
|
105
|
+
} catch (err) {
|
|
106
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
// --- Remove directory entry ---
|
|
112
|
+
{
|
|
113
|
+
subject: SUBJECTS.dir.remove(),
|
|
114
|
+
handler: (msg: { data: Uint8Array; json: <T>() => T; respond: (data: string) => void }) => {
|
|
115
|
+
try {
|
|
116
|
+
const { name } = msg.json<DirRemovePayload>();
|
|
117
|
+
if (!name) {
|
|
118
|
+
msg.respond(JSON.stringify({ error: 'name is required' }));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const result = runGenie(['dir', 'rm', name], { json: false });
|
|
123
|
+
if (!result.ok) {
|
|
124
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
msg.respond(JSON.stringify({ ok: true }));
|
|
128
|
+
} catch (err) {
|
|
129
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// --- Edit directory entry ---
|
|
135
|
+
{
|
|
136
|
+
subject: SUBJECTS.dir.edit(),
|
|
137
|
+
handler: (msg: { data: Uint8Array; json: <T>() => T; respond: (data: string) => void }) => {
|
|
138
|
+
try {
|
|
139
|
+
const { name, model, dir, repo, roles, description } = msg.json<DirEditPayload>();
|
|
140
|
+
if (!name) {
|
|
141
|
+
msg.respond(JSON.stringify({ error: 'name is required' }));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const args = ['dir', 'edit', name];
|
|
146
|
+
if (model) args.push('--model', model);
|
|
147
|
+
if (dir) args.push('--dir', dir);
|
|
148
|
+
if (repo) args.push('--repo', repo);
|
|
149
|
+
if (description) args.push('--description', description);
|
|
150
|
+
if (roles) {
|
|
151
|
+
for (const role of roles) {
|
|
152
|
+
args.push('--role', role);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const result = runGenie(args, { json: false });
|
|
157
|
+
if (!result.ok) {
|
|
158
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
msg.respond(JSON.stringify({ ok: true }));
|
|
162
|
+
} catch (err) {
|
|
163
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
];
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type { NatsConnection } from '@genie-os/sdk/service';
|
|
2
|
+
import { createService } from '@genie-os/sdk/service';
|
|
3
|
+
import { agentLifecycleHandlers } from './agent-lifecycle';
|
|
4
|
+
import { commsHandlers } from './comms';
|
|
5
|
+
import { directorySubscriptions } from './directory';
|
|
6
|
+
import { systemSubscriptions } from './system';
|
|
7
|
+
import { teamsHandlers } from './teams';
|
|
8
|
+
import { createTerminalProxy } from './terminal-proxy';
|
|
9
|
+
import { TmuxControl } from './tmux-control';
|
|
10
|
+
import { wishHandlers } from './wishes';
|
|
11
|
+
|
|
12
|
+
let tmux: TmuxControl;
|
|
13
|
+
let nc: NatsConnection;
|
|
14
|
+
let termProxy: ReturnType<typeof createTerminalProxy>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Merge tmux pane data with genie agent registry for richer agent info.
|
|
18
|
+
*/
|
|
19
|
+
function loadAgentRegistry(): Record<string, { name: string; color: string; state: string; role: string }> {
|
|
20
|
+
try {
|
|
21
|
+
const fs = require('node:fs');
|
|
22
|
+
const data = fs.readFileSync(`${process.env.HOME}/.genie/workers.json`, 'utf-8');
|
|
23
|
+
const workers = JSON.parse(data);
|
|
24
|
+
const map: Record<string, { name: string; color: string; state: string; role: string }> = {};
|
|
25
|
+
for (const [id, worker] of Object.entries(workers as Record<string, Record<string, unknown>>)) {
|
|
26
|
+
const paneId = worker.paneId as string | undefined;
|
|
27
|
+
if (paneId) {
|
|
28
|
+
map[paneId] = {
|
|
29
|
+
name: (worker.name || worker.agentName || id) as string,
|
|
30
|
+
color: (worker.nativeColor || worker.color || 'blue') as string,
|
|
31
|
+
state: (worker.state || 'unknown') as string,
|
|
32
|
+
role: (worker.role || worker.agentRole || '') as string,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return map;
|
|
37
|
+
} catch {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
createService({
|
|
43
|
+
name: 'genie-control',
|
|
44
|
+
onReady: (_nc: NatsConnection) => {
|
|
45
|
+
nc = _nc;
|
|
46
|
+
tmux = new TmuxControl();
|
|
47
|
+
termProxy = createTerminalProxy(nc, tmux);
|
|
48
|
+
|
|
49
|
+
// Event stream disabled — polling is sufficient for the dashboard refresh cycle
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
onShutdown: () => {
|
|
53
|
+
termProxy?.shutdown();
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
subscriptions: [
|
|
57
|
+
// --- List all agents ---
|
|
58
|
+
{
|
|
59
|
+
subject: 'os.genie.agents.list',
|
|
60
|
+
handler: (msg) => {
|
|
61
|
+
try {
|
|
62
|
+
const sessions = tmux.listSessions();
|
|
63
|
+
const windows = tmux.listWindows();
|
|
64
|
+
const panes = tmux.listPanes();
|
|
65
|
+
const registry = loadAgentRegistry();
|
|
66
|
+
|
|
67
|
+
const tree = sessions.map((session) => ({
|
|
68
|
+
...session,
|
|
69
|
+
windows: windows
|
|
70
|
+
.filter((w) => w.sessionId === session.id)
|
|
71
|
+
.map((window) => ({
|
|
72
|
+
...window,
|
|
73
|
+
panes: panes
|
|
74
|
+
.filter((p) => p.windowId === window.id)
|
|
75
|
+
.map((pane) => ({ ...pane, agent: registry[pane.id] || null })),
|
|
76
|
+
})),
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
msg.respond(JSON.stringify({ sessions: tree, ts: Date.now() }));
|
|
80
|
+
} catch (err) {
|
|
81
|
+
msg.respond(JSON.stringify({ error: String(err), sessions: [] }));
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
// --- List sessions only ---
|
|
87
|
+
{
|
|
88
|
+
subject: 'os.genie.sessions.list',
|
|
89
|
+
handler: (msg) => {
|
|
90
|
+
try {
|
|
91
|
+
msg.respond(JSON.stringify({ sessions: tmux.listSessions() }));
|
|
92
|
+
} catch (err) {
|
|
93
|
+
msg.respond(JSON.stringify({ error: String(err), sessions: [] }));
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// --- Capture pane content ---
|
|
99
|
+
{
|
|
100
|
+
subject: 'os.genie.pane.*.capture',
|
|
101
|
+
handler: (msg) => {
|
|
102
|
+
const paneId = `%${msg.subject.split('.')[3]}`;
|
|
103
|
+
try {
|
|
104
|
+
let lines = 50;
|
|
105
|
+
if (msg.data.length > 0) {
|
|
106
|
+
const req = msg.json<{ lines?: number }>();
|
|
107
|
+
if (req.lines) lines = req.lines;
|
|
108
|
+
}
|
|
109
|
+
msg.respond(JSON.stringify({ paneId, content: tmux.capturePane(paneId, lines) }));
|
|
110
|
+
} catch (err) {
|
|
111
|
+
msg.respond(JSON.stringify({ paneId, error: String(err), content: '' }));
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
// --- Send keys to pane ---
|
|
117
|
+
{
|
|
118
|
+
subject: 'os.genie.pane.*.send',
|
|
119
|
+
handler: (msg) => {
|
|
120
|
+
const paneId = `%${msg.subject.split('.')[3]}`;
|
|
121
|
+
try {
|
|
122
|
+
const req = msg.json<{ keys: string }>();
|
|
123
|
+
tmux.sendKeys(paneId, req.keys);
|
|
124
|
+
msg.respond(JSON.stringify({ ok: true }));
|
|
125
|
+
} catch (err) {
|
|
126
|
+
msg.respond(JSON.stringify({ ok: false, error: String(err) }));
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
// --- Spawn agent ---
|
|
132
|
+
{
|
|
133
|
+
subject: 'os.genie.spawn',
|
|
134
|
+
handler: (msg) => {
|
|
135
|
+
try {
|
|
136
|
+
const { execSync } = require('node:child_process');
|
|
137
|
+
const req = msg.json<{ role: string; team?: string; repo?: string }>();
|
|
138
|
+
const args = [req.role];
|
|
139
|
+
if (req.team) args.push('--team', req.team);
|
|
140
|
+
const result = execSync(`genie spawn ${args.join(' ')}`, {
|
|
141
|
+
cwd: req.repo || process.env.HOME,
|
|
142
|
+
timeout: 15000,
|
|
143
|
+
encoding: 'utf-8',
|
|
144
|
+
});
|
|
145
|
+
msg.respond(JSON.stringify({ ok: true, output: result.trim() }));
|
|
146
|
+
} catch (err) {
|
|
147
|
+
msg.respond(JSON.stringify({ ok: false, error: String(err) }));
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
// --- Terminal proxy: create PTY attached to tmux pane ---
|
|
153
|
+
{
|
|
154
|
+
subject: 'os.genie.term.create',
|
|
155
|
+
handler: (msg) => {
|
|
156
|
+
try {
|
|
157
|
+
const req = msg.json<{ tmuxPaneId: string; cols?: number; rows?: number }>();
|
|
158
|
+
const sessionId = termProxy.create(req.tmuxPaneId, req.cols, req.rows);
|
|
159
|
+
msg.respond(JSON.stringify({ sessionId }));
|
|
160
|
+
} catch (err) {
|
|
161
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
// --- Terminal proxy: destroy ---
|
|
167
|
+
{
|
|
168
|
+
subject: 'os.genie.term.destroy',
|
|
169
|
+
handler: (msg) => {
|
|
170
|
+
try {
|
|
171
|
+
const req = msg.json<{ sessionId: string }>();
|
|
172
|
+
termProxy.destroy(req.sessionId);
|
|
173
|
+
msg.respond(JSON.stringify({ ok: true }));
|
|
174
|
+
} catch (err) {
|
|
175
|
+
msg.respond(JSON.stringify({ ok: false, error: String(err) }));
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
// --- Terminal proxy: input (fire-and-forget) ---
|
|
181
|
+
{
|
|
182
|
+
subject: 'os.genie.term.*.input',
|
|
183
|
+
handler: (msg) => {
|
|
184
|
+
const sessionId = msg.subject.split('.')[3];
|
|
185
|
+
if (msg.data.length > 0) {
|
|
186
|
+
const parsed = msg.json<{ data: string }>();
|
|
187
|
+
termProxy.write(sessionId, parsed.data);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
// --- Terminal proxy: resize (fire-and-forget) ---
|
|
193
|
+
{
|
|
194
|
+
subject: 'os.genie.term.*.resize',
|
|
195
|
+
handler: (msg) => {
|
|
196
|
+
const sessionId = msg.subject.split('.')[3];
|
|
197
|
+
const req = msg.json<{ cols: number; rows: number }>();
|
|
198
|
+
termProxy.resize(sessionId, req.cols, req.rows);
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
// --- Terminal proxy: replay buffer ---
|
|
203
|
+
{
|
|
204
|
+
subject: 'os.genie.term.*.replay',
|
|
205
|
+
handler: (msg) => {
|
|
206
|
+
const sessionId = msg.subject.split('.')[3];
|
|
207
|
+
termProxy.replay(sessionId);
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
// --- Domain modules ---
|
|
212
|
+
...teamsHandlers,
|
|
213
|
+
...agentLifecycleHandlers,
|
|
214
|
+
...commsHandlers,
|
|
215
|
+
...wishHandlers,
|
|
216
|
+
...directorySubscriptions,
|
|
217
|
+
...systemSubscriptions,
|
|
218
|
+
],
|
|
219
|
+
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { SUBJECTS } from '../../../lib/subjects';
|
|
2
|
+
import { runGenie } from './cli';
|
|
3
|
+
|
|
4
|
+
interface DoctorCheck {
|
|
5
|
+
name: string;
|
|
6
|
+
status: 'pass' | 'warn' | 'fail';
|
|
7
|
+
detail: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface DoctorResult {
|
|
11
|
+
prerequisites: DoctorCheck[];
|
|
12
|
+
configuration: DoctorCheck[];
|
|
13
|
+
tmux: DoctorCheck[];
|
|
14
|
+
workerProfiles: DoctorCheck[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Parse `genie doctor` text output into structured sections.
|
|
19
|
+
*
|
|
20
|
+
* The output uses ANSI-colored lines like:
|
|
21
|
+
* ✓ tmux → pass
|
|
22
|
+
* ! Session 'genie'... → warn
|
|
23
|
+
* ✗ something → fail
|
|
24
|
+
*/
|
|
25
|
+
function parseDoctorOutput(text: string): DoctorResult {
|
|
26
|
+
const result: DoctorResult = {
|
|
27
|
+
prerequisites: [],
|
|
28
|
+
configuration: [],
|
|
29
|
+
tmux: [],
|
|
30
|
+
workerProfiles: [],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Strip ANSI escape codes
|
|
34
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape stripping requires matching \x1b
|
|
35
|
+
const clean = text.replace(/\x1b\[[0-9;]*m/g, '');
|
|
36
|
+
|
|
37
|
+
let currentSection: keyof DoctorResult | null = null;
|
|
38
|
+
|
|
39
|
+
for (const line of clean.split('\n')) {
|
|
40
|
+
const trimmed = line.trim();
|
|
41
|
+
|
|
42
|
+
// Detect section headers
|
|
43
|
+
if (/^prerequisites:/i.test(trimmed)) {
|
|
44
|
+
currentSection = 'prerequisites';
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (/^configuration:/i.test(trimmed)) {
|
|
48
|
+
currentSection = 'configuration';
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (/^tmux:/i.test(trimmed)) {
|
|
52
|
+
currentSection = 'tmux';
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (/^worker\s*profiles?:/i.test(trimmed)) {
|
|
56
|
+
currentSection = 'workerProfiles';
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!currentSection) continue;
|
|
61
|
+
|
|
62
|
+
// Parse check lines: ✓ / ! / ✗ followed by description
|
|
63
|
+
let status: 'pass' | 'warn' | 'fail' | null = null;
|
|
64
|
+
let detail = '';
|
|
65
|
+
|
|
66
|
+
if (trimmed.startsWith('✓') || trimmed.startsWith('√')) {
|
|
67
|
+
status = 'pass';
|
|
68
|
+
detail = trimmed.slice(1).trim();
|
|
69
|
+
} else if (trimmed.startsWith('!')) {
|
|
70
|
+
status = 'warn';
|
|
71
|
+
detail = trimmed.slice(1).trim();
|
|
72
|
+
} else if (trimmed.startsWith('✗') || trimmed.startsWith('×') || trimmed.startsWith('x ')) {
|
|
73
|
+
status = 'fail';
|
|
74
|
+
detail = trimmed.slice(1).trim();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (status && detail) {
|
|
78
|
+
// Extract a short name from the first word(s) before any version/path info
|
|
79
|
+
const name = detail.split(/\s+/)[0].toLowerCase();
|
|
80
|
+
result[currentSection].push({ name, status, detail });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const systemSubscriptions = [
|
|
88
|
+
// --- System doctor ---
|
|
89
|
+
{
|
|
90
|
+
subject: SUBJECTS.system.doctor(),
|
|
91
|
+
handler: (msg: { data: Uint8Array; json: <T>() => T; respond: (data: string) => void }) => {
|
|
92
|
+
try {
|
|
93
|
+
const result = runGenie(['doctor'], { json: false });
|
|
94
|
+
if (!result.ok) {
|
|
95
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const parsed = parseDoctorOutput(result.data as string);
|
|
99
|
+
msg.respond(JSON.stringify(parsed));
|
|
100
|
+
} catch (err) {
|
|
101
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
// --- System version ---
|
|
107
|
+
{
|
|
108
|
+
subject: SUBJECTS.system.version(),
|
|
109
|
+
handler: (msg: { data: Uint8Array; json: <T>() => T; respond: (data: string) => void }) => {
|
|
110
|
+
try {
|
|
111
|
+
const result = runGenie(['--version'], { json: false });
|
|
112
|
+
if (!result.ok) {
|
|
113
|
+
msg.respond(JSON.stringify({ error: result.error }));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const version = (result.data as string).trim();
|
|
117
|
+
msg.respond(JSON.stringify({ version }));
|
|
118
|
+
} catch (err) {
|
|
119
|
+
msg.respond(JSON.stringify({ error: String(err) }));
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
];
|