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.
Files changed (408) hide show
  1. package/.env.example +23 -0
  2. package/.genie/mailbox/cli-sent.jsonl +3 -0
  3. package/.genie/mailbox/ds1-wave2-engineer-1.json +15 -0
  4. package/.genie/mailbox/ds1-wave2-engineer-2.json +15 -0
  5. package/.genie/mailbox/ds1-wave2-engineer-3.json +15 -0
  6. package/.genie/state/os-observability.json +39 -0
  7. package/.genie/state/tmux-control-mode-terminal.json +28 -0
  8. package/.genie/wishes/genieos-one-theme/WISH.md +417 -0
  9. package/.genie/wishes/workos-prod-rbac/WISH.md +345 -0
  10. package/.github/workflows/ci.yml +39 -0
  11. package/.github/workflows/release.yml +78 -0
  12. package/.github/workflows/version.yml +122 -0
  13. package/.husky/pre-commit +1 -0
  14. package/.pnpm-approve-builds.json +1 -0
  15. package/CLAUDE.md +117 -0
  16. package/LICENSE +21 -0
  17. package/README.md +38 -0
  18. package/biome.json +124 -0
  19. package/bun.lock +1249 -0
  20. package/docs/workos-setup.md +116 -0
  21. package/ecosystem.config.cjs +26 -0
  22. package/instrumentation.ts +8 -0
  23. package/knip.json +35 -0
  24. package/nats.conf +7 -0
  25. package/next.config.ts +25 -0
  26. package/package.json +78 -0
  27. package/packages/dev3000-app/components.ts +12 -0
  28. package/packages/dev3000-app/manifest.ts +19 -0
  29. package/packages/dev3000-app/package.json +23 -0
  30. package/packages/dev3000-app/views/dev3000/Dev3000App.tsx +758 -0
  31. package/packages/dev3000-app/views/dev3000/ErrorsPanel.tsx +160 -0
  32. package/packages/dev3000-app/views/dev3000/dev3000-context.tsx +21 -0
  33. package/packages/dev3000-app/views/dev3000/index.ts +4 -0
  34. package/packages/dev3000-app/views/dev3000/schema.ts +55 -0
  35. package/packages/dev3000-app/views/dev3000/service/index.ts +358 -0
  36. package/packages/dev3000-app/views/dev3000/service/runtime +1 -0
  37. package/packages/dev3000-app/views/dev3000/subjects.ts +9 -0
  38. package/packages/dev3000-app/views/dev3000/types.ts +77 -0
  39. package/packages/files-app/components.ts +12 -0
  40. package/packages/files-app/manifest.ts +19 -0
  41. package/packages/files-app/package.json +23 -0
  42. package/packages/files-app/views/files/ContextMenu.tsx +151 -0
  43. package/packages/files-app/views/files/DeleteConfirmDialog.tsx +39 -0
  44. package/packages/files-app/views/files/FileItem.tsx +128 -0
  45. package/packages/files-app/views/files/FilesApp.tsx +509 -0
  46. package/packages/files-app/views/files/FilesListView.tsx +201 -0
  47. package/packages/files-app/views/files/FilesToolbar.tsx +117 -0
  48. package/packages/files-app/views/files/GridView.tsx +90 -0
  49. package/packages/files-app/views/files/InlineInput.tsx +131 -0
  50. package/packages/files-app/views/files/UploadOverlay.tsx +61 -0
  51. package/packages/files-app/views/files/schema.ts +49 -0
  52. package/packages/files-app/views/files/service/index.ts +184 -0
  53. package/packages/files-app/views/files/service/runtime +1 -0
  54. package/packages/files-app/views/files/use-files.ts +201 -0
  55. package/packages/files-app/views/files/use-upload.ts +105 -0
  56. package/packages/genie-app/components.ts +12 -0
  57. package/packages/genie-app/lib/subjects.ts +87 -0
  58. package/packages/genie-app/manifest.ts +19 -0
  59. package/packages/genie-app/package.json +29 -0
  60. package/packages/genie-app/views/genie/service/agent-lifecycle.ts +136 -0
  61. package/packages/genie-app/views/genie/service/cli.ts +114 -0
  62. package/packages/genie-app/views/genie/service/comms.ts +141 -0
  63. package/packages/genie-app/views/genie/service/directory.ts +167 -0
  64. package/packages/genie-app/views/genie/service/index.ts +219 -0
  65. package/packages/genie-app/views/genie/service/system.ts +123 -0
  66. package/packages/genie-app/views/genie/service/teams.ts +191 -0
  67. package/packages/genie-app/views/genie/service/terminal-proxy.ts +184 -0
  68. package/packages/genie-app/views/genie/service/tmux-control.ts +318 -0
  69. package/packages/genie-app/views/genie/service/wishes.ts +270 -0
  70. package/packages/genie-app/views/genie/ui/GenieApp.tsx +5 -0
  71. package/packages/genie-app/views/genie/ui/PaneCard.tsx +307 -0
  72. package/packages/genie-app/views/genie/ui/Sidebar.tsx +212 -0
  73. package/packages/genie-app/views/genie/ui/TabBar.tsx +70 -0
  74. package/packages/genie-app/views/genie/ui/WorkspaceCanvas.tsx +343 -0
  75. package/packages/genie-app/views/genie/ui/XTermPane.tsx +306 -0
  76. package/packages/genie-app/views/genie/ui/hooks/useNatsAction.ts +54 -0
  77. package/packages/genie-app/views/genie/ui/hooks/useNatsRequest.ts +68 -0
  78. package/packages/genie-app/views/genie/ui/panels/AgentsPanel.tsx +399 -0
  79. package/packages/genie-app/views/genie/ui/panels/ChatPanel.tsx +351 -0
  80. package/packages/genie-app/views/genie/ui/panels/SystemPanel.tsx +195 -0
  81. package/packages/genie-app/views/genie/ui/panels/TeamsPanel.tsx +560 -0
  82. package/packages/genie-app/views/genie/ui/panels/WishesPanel.tsx +424 -0
  83. package/packages/nats-viewer-app/components.ts +12 -0
  84. package/packages/nats-viewer-app/manifest.ts +18 -0
  85. package/packages/nats-viewer-app/package.json +14 -0
  86. package/packages/nats-viewer-app/views/nats-viewer/ActiveSubs.tsx +34 -0
  87. package/packages/nats-viewer-app/views/nats-viewer/MessageLog.tsx +247 -0
  88. package/packages/nats-viewer-app/views/nats-viewer/NatsViewer.tsx +209 -0
  89. package/packages/nats-viewer-app/views/nats-viewer/PublishPanel.tsx +111 -0
  90. package/packages/nats-viewer-app/views/nats-viewer/RequestPanel.tsx +165 -0
  91. package/packages/nats-viewer-app/views/nats-viewer/Sidebar.tsx +59 -0
  92. package/packages/nats-viewer-app/views/nats-viewer/SubjectCatalog.tsx +63 -0
  93. package/packages/nats-viewer-app/views/nats-viewer/SubscribeInput.tsx +59 -0
  94. package/packages/nats-viewer-app/views/nats-viewer/index.ts +5 -0
  95. package/packages/nats-viewer-app/views/nats-viewer/nats-viewer-context.tsx +31 -0
  96. package/packages/nats-viewer-app/views/nats-viewer/types.ts +7 -0
  97. package/packages/nats-viewer-app/views/nats-viewer/use-message-buffer.ts +55 -0
  98. package/packages/os-cli/package.json +18 -0
  99. package/packages/os-cli/src/commands/events.ts +176 -0
  100. package/packages/os-cli/src/commands/logs.ts +96 -0
  101. package/packages/os-cli/src/commands/status.ts +53 -0
  102. package/packages/os-cli/src/commands/traces.ts +115 -0
  103. package/packages/os-cli/src/index.ts +15 -0
  104. package/packages/os-cli/src/lib/formatter.ts +123 -0
  105. package/packages/os-cli/src/lib/nats.ts +16 -0
  106. package/packages/os-cli/src/lib/trace-tree.ts +144 -0
  107. package/packages/os-cli/tsconfig.json +12 -0
  108. package/packages/os-sdk/package.json +27 -0
  109. package/packages/os-sdk/src/api/handler.ts +67 -0
  110. package/packages/os-sdk/src/config.ts +68 -0
  111. package/packages/os-sdk/src/db/factory.test.ts +42 -0
  112. package/packages/os-sdk/src/db/factory.ts +72 -0
  113. package/packages/os-sdk/src/db/migrate.ts +140 -0
  114. package/packages/os-sdk/src/db/provision.ts +44 -0
  115. package/packages/os-sdk/src/index.ts +36 -0
  116. package/packages/os-sdk/src/service/console-intercept.ts +60 -0
  117. package/packages/os-sdk/src/service/logger.ts +88 -0
  118. package/packages/os-sdk/src/service/o11y-streams.ts +88 -0
  119. package/packages/os-sdk/src/service/runtime.ts +259 -0
  120. package/packages/os-sdk/src/service/trace.ts +71 -0
  121. package/packages/os-sdk/tsconfig.json +16 -0
  122. package/packages/os-ui/package.json +13 -0
  123. package/packages/os-ui/src/index.ts +29 -0
  124. package/packages/os-ui/src/server.ts +4 -0
  125. package/packages/os-ui/tsconfig.json +19 -0
  126. package/packages/settings-app/components.ts +12 -0
  127. package/packages/settings-app/manifest.ts +18 -0
  128. package/packages/settings-app/package.json +14 -0
  129. package/packages/settings-app/views/settings/Settings.tsx +492 -0
  130. package/packages/terminal-app/components.ts +12 -0
  131. package/packages/terminal-app/manifest.ts +20 -0
  132. package/packages/terminal-app/package.json +23 -0
  133. package/packages/terminal-app/views/terminal/schema.ts +82 -0
  134. package/packages/terminal-app/views/terminal/service/index.ts +133 -0
  135. package/packages/terminal-app/views/terminal/service/runtime +1 -0
  136. package/packages/terminal-app/views/terminal/service/session.ts +290 -0
  137. package/packages/terminal-app/views/terminal/service/shell-hooks/bashrc-hook.sh +21 -0
  138. package/packages/terminal-app/views/terminal/types.ts +26 -0
  139. package/packages/terminal-app/views/terminal/ui/MultiTerminalApp.tsx +615 -0
  140. package/packages/terminal-app/views/terminal/ui/SplitDragHandle.tsx +91 -0
  141. package/packages/terminal-app/views/terminal/ui/SplitPaneRenderer.tsx +112 -0
  142. package/packages/terminal-app/views/terminal/ui/TerminalPane.tsx +478 -0
  143. package/packages/terminal-app/views/terminal/ui/TerminalTabBar.tsx +131 -0
  144. package/pnpm-workspace.yaml +9 -0
  145. package/postcss.config.mjs +7 -0
  146. package/public/file.svg +1 -0
  147. package/public/globe.svg +1 -0
  148. package/public/icons/code-server.svg +6 -0
  149. package/public/icons/default.svg +5 -0
  150. package/public/icons/dusk/1password.svg +1 -0
  151. package/public/icons/dusk/activity_monitor.svg +1 -0
  152. package/public/icons/dusk/app_store.svg +1 -0
  153. package/public/icons/dusk/atom.svg +1 -0
  154. package/public/icons/dusk/brave.svg +1 -0
  155. package/public/icons/dusk/calculator.svg +1 -0
  156. package/public/icons/dusk/calendar.svg +1 -0
  157. package/public/icons/dusk/chrome.svg +1 -0
  158. package/public/icons/dusk/chrome2.svg +1 -0
  159. package/public/icons/dusk/dashboard.svg +13 -0
  160. package/public/icons/dusk/discord.svg +1 -0
  161. package/public/icons/dusk/dropbox.svg +1 -0
  162. package/public/icons/dusk/electron.svg +1 -0
  163. package/public/icons/dusk/figma.svg +1 -0
  164. package/public/icons/dusk/finder.svg +1 -0
  165. package/public/icons/dusk/finder2.svg +1 -0
  166. package/public/icons/dusk/finder3.svg +1 -0
  167. package/public/icons/dusk/firefox.svg +1 -0
  168. package/public/icons/dusk/framer.svg +1 -0
  169. package/public/icons/dusk/gimp.svg +1 -0
  170. package/public/icons/dusk/github_desktop.svg +1 -0
  171. package/public/icons/dusk/hyper.svg +1 -0
  172. package/public/icons/dusk/hyper3.svg +1 -0
  173. package/public/icons/dusk/intellij.svg +1 -0
  174. package/public/icons/dusk/iterm2.svg +1 -0
  175. package/public/icons/dusk/itunes.svg +1 -0
  176. package/public/icons/dusk/mail.svg +1 -0
  177. package/public/icons/dusk/messenger.svg +1 -0
  178. package/public/icons/dusk/mongodb.svg +1 -0
  179. package/public/icons/dusk/notes.svg +1 -0
  180. package/public/icons/dusk/notion.svg +1 -0
  181. package/public/icons/dusk/obs.svg +1 -0
  182. package/public/icons/dusk/pages.svg +1 -0
  183. package/public/icons/dusk/photos.svg +1 -0
  184. package/public/icons/dusk/postman.svg +1 -0
  185. package/public/icons/dusk/preview.svg +1 -0
  186. package/public/icons/dusk/reminders.svg +1 -0
  187. package/public/icons/dusk/safari.svg +1 -0
  188. package/public/icons/dusk/sequel_pro.svg +1 -0
  189. package/public/icons/dusk/sketch.svg +1 -0
  190. package/public/icons/dusk/skype.svg +1 -0
  191. package/public/icons/dusk/slack.svg +1 -0
  192. package/public/icons/dusk/slack2.svg +1 -0
  193. package/public/icons/dusk/spotify.svg +1 -0
  194. package/public/icons/dusk/steam.svg +1 -0
  195. package/public/icons/dusk/system_preferences.svg +1 -0
  196. package/public/icons/dusk/tableplus.svg +1 -0
  197. package/public/icons/dusk/teams.svg +1 -0
  198. package/public/icons/dusk/telegram.svg +1 -0
  199. package/public/icons/dusk/terminal.svg +1 -0
  200. package/public/icons/dusk/todoist.svg +1 -0
  201. package/public/icons/dusk/trash.svg +1 -0
  202. package/public/icons/dusk/trello.svg +1 -0
  203. package/public/icons/dusk/vivaldi.svg +1 -0
  204. package/public/icons/dusk/vlc.svg +1 -0
  205. package/public/icons/dusk/vscode.svg +1 -0
  206. package/public/icons/dusk/whatsapp.svg +1 -0
  207. package/public/icons/dusk/xeyes.svg +1 -0
  208. package/public/icons/dusk/zoom.svg +1 -0
  209. package/public/icons/files.svg +5 -0
  210. package/public/icons/pwa/icon-192.png +0 -0
  211. package/public/icons/pwa/icon-512.png +0 -0
  212. package/public/icons/settings.svg +14 -0
  213. package/public/icons/terminal.svg +5 -0
  214. package/public/icons/text-editor.svg +7 -0
  215. package/public/manifest.json +38 -0
  216. package/public/next.svg +1 -0
  217. package/public/sw.js +41 -0
  218. package/public/vercel.svg +1 -0
  219. package/public/wallpapers/default.svg +10 -0
  220. package/public/window.svg +1 -0
  221. package/scripts/generate-pwa-icons.mjs +33 -0
  222. package/scripts/install-nats.sh +37 -0
  223. package/sentry.client.config.ts +21 -0
  224. package/sentry.edge.config.ts +12 -0
  225. package/sentry.server.config.ts +12 -0
  226. package/src/app/api/files/download/route.ts +81 -0
  227. package/src/app/api/files/download-zip/route.ts +102 -0
  228. package/src/app/api/files/upload/route.ts +58 -0
  229. package/src/app/api/webhooks/workos/route.ts +98 -0
  230. package/src/app/auth/callback/route.ts +16 -0
  231. package/src/app/auth/logout/route.ts +15 -0
  232. package/src/app/desktop/desktop-shell.tsx +110 -0
  233. package/src/app/desktop/layout.tsx +8 -0
  234. package/src/app/desktop/page.tsx +24 -0
  235. package/src/app/favicon.ico +0 -0
  236. package/src/app/globals.css +7 -0
  237. package/src/app/layout.tsx +64 -0
  238. package/src/app/offline/page.tsx +83 -0
  239. package/src/app/page.tsx +5 -0
  240. package/src/app/standalone/[appId]/page.tsx +28 -0
  241. package/src/app/standalone/layout.tsx +10 -0
  242. package/src/components/app-icon.tsx +55 -0
  243. package/src/components/apps/_echo/schema.ts +14 -0
  244. package/src/components/apps/_echo/service/index.ts +42 -0
  245. package/src/components/apps/app-manifest.ts +97 -0
  246. package/src/components/apps/app-registry.ts +55 -0
  247. package/src/components/apps/dev3000/Dev3000App.tsx +224 -0
  248. package/src/components/apps/dev3000/ErrorsPanel.tsx +160 -0
  249. package/src/components/apps/dev3000/Sidebar.tsx +41 -0
  250. package/src/components/apps/dev3000/TimelineLog.tsx +173 -0
  251. package/src/components/apps/dev3000/dev3000-context.tsx +29 -0
  252. package/src/components/apps/dev3000/index.ts +4 -0
  253. package/src/components/apps/dev3000/schema.ts +48 -0
  254. package/src/components/apps/dev3000/service/index.ts +520 -0
  255. package/src/components/apps/dev3000/service/runtime +1 -0
  256. package/src/components/apps/dev3000/types.ts +15 -0
  257. package/src/components/apps/dev3000/use-message-buffer.ts +46 -0
  258. package/src/components/apps/files/ContextMenu.tsx +151 -0
  259. package/src/components/apps/files/DeleteConfirmDialog.tsx +78 -0
  260. package/src/components/apps/files/FileItem.tsx +128 -0
  261. package/src/components/apps/files/FilesApp.tsx +509 -0
  262. package/src/components/apps/files/FilesListView.tsx +201 -0
  263. package/src/components/apps/files/FilesToolbar.tsx +117 -0
  264. package/src/components/apps/files/GridView.tsx +90 -0
  265. package/src/components/apps/files/InlineInput.tsx +131 -0
  266. package/src/components/apps/files/UploadOverlay.tsx +61 -0
  267. package/src/components/apps/files/schema.ts +49 -0
  268. package/src/components/apps/files/service/index.ts +227 -0
  269. package/src/components/apps/files/service/runtime +1 -0
  270. package/src/components/apps/files/use-files.ts +201 -0
  271. package/src/components/apps/files/use-upload.ts +105 -0
  272. package/src/components/apps/nats-viewer/ActiveSubs.tsx +34 -0
  273. package/src/components/apps/nats-viewer/MessageLog.tsx +247 -0
  274. package/src/components/apps/nats-viewer/NatsViewer.tsx +209 -0
  275. package/src/components/apps/nats-viewer/PublishPanel.tsx +113 -0
  276. package/src/components/apps/nats-viewer/RequestPanel.tsx +167 -0
  277. package/src/components/apps/nats-viewer/Sidebar.tsx +62 -0
  278. package/src/components/apps/nats-viewer/SubjectCatalog.tsx +64 -0
  279. package/src/components/apps/nats-viewer/SubscribeInput.tsx +59 -0
  280. package/src/components/apps/nats-viewer/index.ts +5 -0
  281. package/src/components/apps/nats-viewer/nats-viewer-context.tsx +31 -0
  282. package/src/components/apps/nats-viewer/types.ts +7 -0
  283. package/src/components/apps/nats-viewer/use-message-buffer.ts +55 -0
  284. package/src/components/apps/settings/Settings.tsx +492 -0
  285. package/src/components/apps/terminal/schema.ts +82 -0
  286. package/src/components/apps/terminal/service/index.ts +189 -0
  287. package/src/components/apps/terminal/service/runtime +1 -0
  288. package/src/components/apps/terminal/service/session.ts +296 -0
  289. package/src/components/apps/terminal/service/shell-hooks/bashrc-hook.sh +21 -0
  290. package/src/components/apps/terminal/types.ts +26 -0
  291. package/src/components/apps/terminal/ui/MultiTerminalApp.tsx +617 -0
  292. package/src/components/apps/terminal/ui/SplitDragHandle.tsx +91 -0
  293. package/src/components/apps/terminal/ui/SplitPaneRenderer.tsx +112 -0
  294. package/src/components/apps/terminal/ui/TerminalPane.tsx +476 -0
  295. package/src/components/apps/terminal/ui/TerminalTabBar.tsx +131 -0
  296. package/src/components/desktop/AnimatedBackground.tsx +69 -0
  297. package/src/components/desktop/Desktop.tsx +79 -0
  298. package/src/components/desktop/DesktopBackground.tsx +16 -0
  299. package/src/components/desktop/DesktopIcon.tsx +49 -0
  300. package/src/components/desktop/ShortcutViewer.tsx +136 -0
  301. package/src/components/desktop/WindowRenderer.tsx +34 -0
  302. package/src/components/desktop/WindowSwitcher.tsx +42 -0
  303. package/src/components/notifications/NotificationCenter.tsx +153 -0
  304. package/src/components/notifications/NotificationToasts.tsx +66 -0
  305. package/src/components/notifications/OrphanSessionToast.tsx +293 -0
  306. package/src/components/os-primitives/collapsible-sidebar.tsx +226 -0
  307. package/src/components/os-primitives/dialog.tsx +76 -0
  308. package/src/components/os-primitives/empty-state.tsx +43 -0
  309. package/src/components/os-primitives/index.ts +21 -0
  310. package/src/components/os-primitives/list-view.tsx +155 -0
  311. package/src/components/os-primitives/property-panel.tsx +108 -0
  312. package/src/components/os-primitives/section-header.tsx +19 -0
  313. package/src/components/os-primitives/sidebar-nav.tsx +110 -0
  314. package/src/components/os-primitives/split-pane.tsx +146 -0
  315. package/src/components/os-primitives/status-badge.tsx +10 -0
  316. package/src/components/os-primitives/status-bar.tsx +100 -0
  317. package/src/components/os-primitives/toolbar.tsx +152 -0
  318. package/src/components/taskbar/AppLauncher.tsx +114 -0
  319. package/src/components/taskbar/RunningApps.tsx +71 -0
  320. package/src/components/taskbar/SystemTray.tsx +134 -0
  321. package/src/components/taskbar/Taskbar.tsx +45 -0
  322. package/src/components/taskbar/UserMenu.tsx +138 -0
  323. package/src/components/taskbar/WorkspaceSwitcher.tsx +9 -0
  324. package/src/components/ui/ContextMenu.tsx +130 -0
  325. package/src/components/ui/badge.tsx +39 -0
  326. package/src/components/ui/button.tsx +102 -0
  327. package/src/components/ui/command.tsx +165 -0
  328. package/src/components/ui/dropdown-menu.tsx +233 -0
  329. package/src/components/ui/input.tsx +48 -0
  330. package/src/components/ui/note.tsx +55 -0
  331. package/src/components/ui/separator.tsx +25 -0
  332. package/src/components/ui/spinner.tsx +42 -0
  333. package/src/components/ui/switch.tsx +36 -0
  334. package/src/components/ui/theme-provider.tsx +24 -0
  335. package/src/components/ui/theme-switcher.tsx +51 -0
  336. package/src/components/ui/tooltip.tsx +62 -0
  337. package/src/components/window/MobileWindowStack.tsx +218 -0
  338. package/src/components/window/SnapPreview.tsx +37 -0
  339. package/src/components/window/StandaloneFrame.tsx +170 -0
  340. package/src/components/window/Window.tsx +423 -0
  341. package/src/components/window/WindowContent.tsx +14 -0
  342. package/src/components/window/WindowControlsOverlay.tsx +89 -0
  343. package/src/components/window/WindowFrame.tsx +124 -0
  344. package/src/lib/auth/index.ts +27 -0
  345. package/src/lib/auth/roles.ts +50 -0
  346. package/src/lib/auth/types.ts +32 -0
  347. package/src/lib/auth/use-auth.ts +53 -0
  348. package/src/lib/auth/webhook-handler.ts +87 -0
  349. package/src/lib/auth/workos.ts +67 -0
  350. package/src/lib/constants.ts +1 -0
  351. package/src/lib/desktop/dedup.ts +57 -0
  352. package/src/lib/desktop/schema.ts +55 -0
  353. package/src/lib/files/filename-validation.ts +41 -0
  354. package/src/lib/files/safe-path.ts +49 -0
  355. package/src/lib/hooks/use-desktop-nats.ts +438 -0
  356. package/src/lib/hooks/use-is-mobile.ts +23 -0
  357. package/src/lib/hooks/use-launch-app.ts +79 -0
  358. package/src/lib/hooks/use-nats-notifications.ts +84 -0
  359. package/src/lib/hooks/use-nats.ts +60 -0
  360. package/src/lib/hooks/use-visual-viewport.ts +72 -0
  361. package/src/lib/icons/resolve-window-icon.ts +10 -0
  362. package/src/lib/keyboard/defaults.ts +146 -0
  363. package/src/lib/keyboard/types.ts +52 -0
  364. package/src/lib/keyboard/use-global-keybinds.ts +231 -0
  365. package/src/lib/nats-client.ts +255 -0
  366. package/src/lib/nats.ts +35 -0
  367. package/src/lib/notifications/schema.ts +12 -0
  368. package/src/lib/service-loader.ts +171 -0
  369. package/src/lib/subjects.ts +64 -0
  370. package/src/lib/utils.ts +6 -0
  371. package/src/lib/ws-bridge.ts +288 -0
  372. package/src/lib/ws-protocol.ts +53 -0
  373. package/src/lib/ws-server.ts +167 -0
  374. package/src/middleware.ts +57 -0
  375. package/src/stores/desktop-store.ts +112 -0
  376. package/src/stores/keybind-store.ts +66 -0
  377. package/src/stores/notification-store.ts +271 -0
  378. package/src/stores/theme-store.ts +25 -0
  379. package/src/stores/window-store.ts +294 -0
  380. package/src/theme/animations.css +68 -0
  381. package/src/theme/base.css +123 -0
  382. package/src/theme/controls.css +35 -0
  383. package/src/theme/design-tokens.css +276 -0
  384. package/src/theme/index.css +23 -0
  385. package/src/theme/menus.css +45 -0
  386. package/src/theme/status.css +41 -0
  387. package/src/theme/surfaces.css +94 -0
  388. package/src/theme/tailwind-map.css +138 -0
  389. package/src/theme/taskbar.css +25 -0
  390. package/src/theme/terminal.css +55 -0
  391. package/src/theme/typography.css +26 -0
  392. package/src/theme/utilities.css +156 -0
  393. package/src/theme/window.css +103 -0
  394. package/src/types/desktop-entry.ts +12 -0
  395. package/src/types/use-descendants.d.ts +13 -0
  396. package/src/types/window.ts +28 -0
  397. package/src/types.d.ts +9 -0
  398. package/tauri/Cargo.lock +5464 -0
  399. package/tauri/Cargo.toml +19 -0
  400. package/tauri/build.rs +3 -0
  401. package/tauri/capabilities/default.json +36 -0
  402. package/tauri/icons/128x128.png +0 -0
  403. package/tauri/icons/128x128@2x.png +0 -0
  404. package/tauri/icons/32x32.png +0 -0
  405. package/tauri/icons/icon.png +0 -0
  406. package/tauri/src/main.rs +396 -0
  407. package/tauri/tauri.conf.json +23 -0
  408. package/tsconfig.json +43 -0
package/.env.example ADDED
@@ -0,0 +1,23 @@
1
+ # Sentry (Error Tracking)
2
+ SENTRY_DSN=
3
+ NEXT_PUBLIC_SENTRY_DSN=
4
+ SENTRY_ENVIRONMENT=development
5
+ SENTRY_AUTH_TOKEN=
6
+
7
+ # Auth
8
+ OS_SECRET=
9
+ WORKOS_API_KEY=
10
+ WORKOS_CLIENT_ID=
11
+ NEXT_PUBLIC_WORKOS_REDIRECT_URI=
12
+ WORKOS_COOKIE_PASSWORD=
13
+ WORKOS_WEBHOOK_SECRET=
14
+
15
+ # Instance (single-tenant: fixed per deployment)
16
+ KHAL_INSTANCE_ID=default
17
+ NEXT_PUBLIC_KHAL_INSTANCE_ID=default
18
+
19
+ # NATS
20
+ NATS_URL=nats://localhost:4222
21
+
22
+ # WebSocket Bridge
23
+ WS_BRIDGE_PORT=4280
@@ -0,0 +1,3 @@
1
+ {"id":"msg-04edd038-6b36-434e-9053-27107c9a7719","from":"cli","to":"ds1-wave2-engineer-1","body":"Execute Group 1 of wish \"genieos-one-theme\". Your full context is in the system prompt. Read the wish at /home/genie/.genie/worktrees/genie-os/ds1-wave2/.genie/wishes/genieos-one-theme/WISH.md if needed. Implement all deliverables, run validation, and report completion.\n\nWhen done:\n1. Run: genie done genieos-one-theme#1\n2. Run: genie send 'Group 1 complete. <summary>' --to team-lead","createdAt":"2026-03-24T03:05:34.879Z","read":false,"deliveredAt":null}
2
+ {"id":"msg-c2b08ef2-b828-4f36-aeac-cf25d61d88df","from":"cli","to":"ds1-wave2-engineer-2","body":"Execute Group 2 of wish \"genieos-one-theme\". Your full context is in the system prompt. Read the wish at /home/genie/.genie/worktrees/genie-os/ds1-wave2/.genie/wishes/genieos-one-theme/WISH.md if needed. Implement all deliverables, run validation, and report completion.\n\nWhen done:\n1. Run: genie done genieos-one-theme#2\n2. Run: genie send 'Group 2 complete. <summary>' --to team-lead","createdAt":"2026-03-24T03:05:34.958Z","read":false,"deliveredAt":null}
3
+ {"id":"msg-7ae7c3d3-9695-4771-8c7a-0d43d40b4364","from":"cli","to":"ds1-wave2-engineer-3","body":"Execute Group 3 of wish \"genieos-one-theme\". Your full context is in the system prompt. Read the wish at /home/genie/.genie/worktrees/genie-os/ds1-wave2/.genie/wishes/genieos-one-theme/WISH.md if needed. Implement all deliverables, run validation, and report completion.\n\nWhen done:\n1. Run: genie done genieos-one-theme#3\n2. Run: genie send 'Group 3 complete. <summary>' --to team-lead","createdAt":"2026-03-24T03:13:51.976Z","read":false,"deliveredAt":null}
@@ -0,0 +1,15 @@
1
+ {
2
+ "workerId": "ds1-wave2-engineer-1",
3
+ "messages": [
4
+ {
5
+ "id": "msg-04edd038-6b36-434e-9053-27107c9a7719",
6
+ "from": "cli",
7
+ "to": "ds1-wave2-engineer-1",
8
+ "body": "Execute Group 1 of wish \"genieos-one-theme\". Your full context is in the system prompt. Read the wish at /home/genie/.genie/worktrees/genie-os/ds1-wave2/.genie/wishes/genieos-one-theme/WISH.md if needed. Implement all deliverables, run validation, and report completion.\n\nWhen done:\n1. Run: genie done genieos-one-theme#1\n2. Run: genie send 'Group 1 complete. <summary>' --to team-lead",
9
+ "createdAt": "2026-03-24T03:05:34.879Z",
10
+ "read": false,
11
+ "deliveredAt": "2026-03-24T03:05:34.923Z"
12
+ }
13
+ ],
14
+ "lastUpdated": "2026-03-24T03:05:34.924Z"
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "workerId": "ds1-wave2-engineer-2",
3
+ "messages": [
4
+ {
5
+ "id": "msg-c2b08ef2-b828-4f36-aeac-cf25d61d88df",
6
+ "from": "cli",
7
+ "to": "ds1-wave2-engineer-2",
8
+ "body": "Execute Group 2 of wish \"genieos-one-theme\". Your full context is in the system prompt. Read the wish at /home/genie/.genie/worktrees/genie-os/ds1-wave2/.genie/wishes/genieos-one-theme/WISH.md if needed. Implement all deliverables, run validation, and report completion.\n\nWhen done:\n1. Run: genie done genieos-one-theme#2\n2. Run: genie send 'Group 2 complete. <summary>' --to team-lead",
9
+ "createdAt": "2026-03-24T03:05:34.958Z",
10
+ "read": false,
11
+ "deliveredAt": "2026-03-24T03:05:34.960Z"
12
+ }
13
+ ],
14
+ "lastUpdated": "2026-03-24T03:05:34.960Z"
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "workerId": "ds1-wave2-engineer-3",
3
+ "messages": [
4
+ {
5
+ "id": "msg-7ae7c3d3-9695-4771-8c7a-0d43d40b4364",
6
+ "from": "cli",
7
+ "to": "ds1-wave2-engineer-3",
8
+ "body": "Execute Group 3 of wish \"genieos-one-theme\". Your full context is in the system prompt. Read the wish at /home/genie/.genie/worktrees/genie-os/ds1-wave2/.genie/wishes/genieos-one-theme/WISH.md if needed. Implement all deliverables, run validation, and report completion.\n\nWhen done:\n1. Run: genie done genieos-one-theme#3\n2. Run: genie send 'Group 3 complete. <summary>' --to team-lead",
9
+ "createdAt": "2026-03-24T03:13:51.976Z",
10
+ "read": false,
11
+ "deliveredAt": "2026-03-24T03:13:52.020Z"
12
+ }
13
+ ],
14
+ "lastUpdated": "2026-03-24T03:13:52.020Z"
15
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "wish": "os-observability",
3
+ "groups": {
4
+ "1": {
5
+ "status": "done",
6
+ "assignee": "engineer",
7
+ "dependsOn": [],
8
+ "startedAt": "2026-03-20T20:27:19.012Z",
9
+ "completedAt": "2026-03-20T20:35:10.098Z"
10
+ },
11
+ "2": {
12
+ "status": "done",
13
+ "assignee": "engineer",
14
+ "dependsOn": [],
15
+ "startedAt": "2026-03-20T20:27:18.961Z",
16
+ "completedAt": "2026-03-20T20:38:16.419Z"
17
+ },
18
+ "3": {
19
+ "status": "in_progress",
20
+ "dependsOn": ["1", "2"],
21
+ "assignee": "engineer",
22
+ "startedAt": "2026-03-20T20:38:19.252Z"
23
+ },
24
+ "4": {
25
+ "status": "ready",
26
+ "dependsOn": ["2"]
27
+ },
28
+ "5": {
29
+ "status": "blocked",
30
+ "dependsOn": ["4"]
31
+ },
32
+ "6": {
33
+ "status": "blocked",
34
+ "dependsOn": ["3"]
35
+ }
36
+ },
37
+ "createdAt": "2026-03-20T20:27:18.955Z",
38
+ "updatedAt": "2026-03-20T20:38:19.252Z"
39
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "wish": "tmux-control-mode-terminal",
3
+ "groups": {
4
+ "1": {
5
+ "status": "done",
6
+ "assignee": "engineer",
7
+ "dependsOn": [],
8
+ "startedAt": "2026-03-19T20:59:01.515Z",
9
+ "completedAt": "2026-03-19T21:06:10.282Z"
10
+ },
11
+ "2": {
12
+ "status": "done",
13
+ "assignee": "engineer",
14
+ "dependsOn": ["1"],
15
+ "startedAt": "2026-03-19T21:06:31.718Z",
16
+ "completedAt": "2026-03-19T21:09:19.797Z"
17
+ },
18
+ "3": {
19
+ "status": "done",
20
+ "assignee": "engineer",
21
+ "dependsOn": ["2"],
22
+ "startedAt": "2026-03-19T21:09:31.903Z",
23
+ "completedAt": "2026-03-19T21:12:26.511Z"
24
+ }
25
+ },
26
+ "createdAt": "2026-03-19T20:59:01.511Z",
27
+ "updatedAt": "2026-03-19T21:12:26.512Z"
28
+ }
@@ -0,0 +1,417 @@
1
+ # Wish: ONE Theme — Kill Concepts, Build Perfect
2
+
3
+ | Field | Value |
4
+ |-------|-------|
5
+ | **Status** | DRAFT |
6
+ | **Slug** | `genieos-one-theme` |
7
+ | **Date** | 2026-03-23 |
8
+ | **Design** | [DESIGN.md](../../.genie/brainstorms/genieos-design-system-v2/DESIGN.md) |
9
+ | **Repo** | `namastexlabs/genie-os` (branch from `dev`) |
10
+
11
+ ## Summary
12
+ Replace 8 competing theme concepts (3109-line globals.css) with ONE perfect theme structured as a `src/theme/` directory. Delete all concept-switching infrastructure. macOS-level: one look, dark + light modes, that's it. The designer's khal-landing mockups ARE the spec for dark mode.
13
+
14
+ ## Scope
15
+
16
+ ### IN
17
+ - **Create `src/theme/` directory** with 10 semantic CSS files (surfaces, typography, controls, window, taskbar, status, terminal, animations, menus, index)
18
+ - **Delete all `[data-concept=]` CSS blocks** from globals.css (~2800 lines removed)
19
+ - **Delete concept infrastructure:** `concept-registry.ts`, `use-concept.ts`, `ThemeConcept` type, `setConcept`, `data-concept` attribute
20
+ - **Delete concept-specific components:** `OmniGlassStack.tsx`, `OmniDock.tsx`, `OmniDockItem.tsx`
21
+ - **Simplify WindowFrame.tsx** — one control style (glass), remove concept branching
22
+ - **Simplify Taskbar.tsx** — one layout (bottom bar), remove concept branching
23
+ - **Simplify theme-store.ts** — mode only (light/dark/system), no concept
24
+ - **Simplify Settings Appearance** — dark/light/system toggle only, no theme picker grid
25
+ - **Update layout.tsx** — remove `data-concept` attribute
26
+ - **Fix all 17 files** that reference the concept system
27
+ - **Production build** must compile and deploy cleanly
28
+ - **Both auth fixes** (middleware HeadlessChrome + permission mapping) committed in same branch
29
+
30
+ ### OUT
31
+ - New components (separate wish)
32
+ - App platform / genie.yaml (separate wish)
33
+ - Design system documentation app (after theme)
34
+ - Light mode perfection (ship dark mode as designed, light mode best-effort — iterate later)
35
+
36
+ ## Decisions
37
+
38
+ | Decision | Rationale |
39
+ |----------|-----------|
40
+ | Structured directory (10 files) not single file | Each domain independently reviewable. Designer's mockups map to files. Scales to hundreds of tokens. |
41
+ | Glass controls as THE only style | macOS doesn't let you pick window control styles. One style, perfected. |
42
+ | Bottom bar taskbar only (no floating dock) | One layout. OmniDock was a concept-specific experiment. |
43
+ | Keep `--khal-*` variable names | All components already use them. Renaming touches 50+ files for zero user benefit. |
44
+ | Dark mode from mockup palette, light mode derived | 16 mockup screens define dark mode exactly. No light-mode mockups exist. Derive and iterate. |
45
+ | Commit auth fixes in same branch | middleware.ts and use-auth.ts are already modified on prod. Clean them up and commit with the theme work. |
46
+
47
+ ## Success Criteria
48
+
49
+ - [ ] `src/theme/` directory exists with all 10 CSS files
50
+ - [ ] `src/app/globals.css` is < 100 lines (imports + radii + base only)
51
+ - [ ] Zero `[data-concept=` selectors in entire codebase
52
+ - [ ] Zero imports of `concept-registry` or `use-concept` in codebase
53
+ - [ ] `OmniGlassStack.tsx`, `OmniDock.tsx`, `OmniDockItem.tsx` deleted
54
+ - [ ] `theme-store.ts` has no `concept` field — only `mode`
55
+ - [ ] Settings Appearance shows dark/light/system toggle only
56
+ - [ ] `layout.tsx` has no `data-concept` attribute
57
+ - [ ] WindowFrame.tsx has one control style (glass), no branching
58
+ - [ ] Taskbar.tsx has one layout (bar), no concept checks
59
+ - [ ] All 5 apps render correctly in dark mode (matching designer's mockup palette)
60
+ - [ ] All 5 apps render correctly in light mode (coherent, readable)
61
+ - [ ] Terminal ANSI colors correct in both modes
62
+ - [ ] `bun next build` exits 0 (production build works)
63
+ - [ ] `bun biome check .` passes (or no new errors)
64
+ - [ ] Deployed at alpha.khal.namastex.io and rendering correctly
65
+
66
+ ## Execution Strategy
67
+
68
+ ### Wave 1 (parallel — foundation)
69
+ | Group | Agent | Description |
70
+ |-------|-------|-------------|
71
+ | 1 | engineer | Create `src/theme/` directory with all 10 CSS files, extracting tokens from the `genie` concept block |
72
+ | 2 | engineer | Delete concept infrastructure: registry, use-concept, ThemeConcept type, theme-store simplification |
73
+
74
+ ### Wave 2 (after Wave 1 — component cleanup)
75
+ | Group | Agent | Description |
76
+ |-------|-------|-------------|
77
+ | 3 | engineer | Simplify window + taskbar: delete OmniGlassStack/OmniDock, single control style, fix all 17 files |
78
+ | 4 | engineer | Gut globals.css, update layout.tsx, Settings.tsx, commit auth fixes, production build test |
79
+
80
+ ### Wave 3
81
+ | Group | Agent | Description |
82
+ |-------|-------|-------------|
83
+ | review | reviewer | Review all groups, verify production build |
84
+
85
+ ## Execution Groups
86
+
87
+ ### Group 1: Create src/theme/ Directory
88
+
89
+ **Goal:** Build the 10-file theme directory with all tokens for dark + light modes, sourced from the designer's mockup palette.
90
+
91
+ **Deliverables:**
92
+
93
+ 1. **`src/theme/index.css`** — imports all other files
94
+ 2. **`src/theme/surfaces.css`** — 6-layer depth system (desktop → chrome → inactive → raised → border → hover), glass tokens (blur, opacity, tint, border), overlay backgrounds. `:root` (light) + `.dark` (dark).
95
+ 3. **`src/theme/typography.css`** — 4-tier text hierarchy (primary → secondary → muted → inverse), font families (Geist Sans, Geist Mono), line-heights
96
+ 4. **`src/theme/controls.css`** — accent colors (primary, secondary, hover, active, subtle), button backgrounds, input borders, switch colors, focus rings
97
+ 5. **`src/theme/window.css`** — window radius, bg, border (focused/unfocused), shadow (focused/unfocused), title bar bg, frame height/padding, control button styles (glass only), close hover color
98
+ 6. **`src/theme/taskbar.css`** — taskbar bg, border, shadow, active indicator, hover bg, glass blur
99
+ 7. **`src/theme/status.css`** — pipeline stage colors (7), product identity colors (4), status indicators (live/idle/warning/error), event type colors (6)
100
+ 8. **`src/theme/terminal.css`** — terminal bg + 16 ANSI colors (standard + bright) for dark and light modes
101
+ 9. **`src/theme/animations.css`** — easing curves, duration tokens, orb drift keyframes, pulse animation
102
+ 10. **`src/theme/menus.css`** — command palette bg/border/shadow/hover, dropdown/context menu, tooltip, notification position
103
+
104
+ **Dark mode values** — sourced from the designer's 16 mockup screens in `repos/khal-landing/components/mockups/`. The following reference table maps each token to the exact mockup file and line where the designer used that value:
105
+
106
+ ### Mockup Color Reference (Dark Mode)
107
+
108
+ **Surfaces (→ surfaces.css)**
109
+ | Token | Value | Source Mockup | File:Line | Usage |
110
+ |-------|-------|---------------|-----------|-------|
111
+ | `--khal-bg-desktop` | `#0a0a0f` | MockupChrome, MissionControl, AuditTrail, AgentInspector | mockup-chrome.tsx:24, mission-control.tsx:90, audit-trail.tsx:118 | Window/app background |
112
+ | `--khal-bg-primary` (chrome) | `#0d0d14` | MockupChrome title bar | mockup-chrome.tsx:29 | Title bar, chrome header |
113
+ | `--khal-bg-secondary` (inactive) | `#0f0f18` | WorkflowBuilder inactive nodes | workflow-builder.tsx (inactive stage bg) | Inactive cards, background areas |
114
+ | `--khal-surface-default` (raised) | `#141420` | All mockups — active cards | agent-inspector.tsx:108, audit-trail.tsx:121, channel-hub.tsx (cards) | Cards, panels (often at /80 opacity with backdrop-blur-sm) |
115
+ | `--khal-border-default` | `#1e1e30` | ALL 16 mockups | mockup-chrome.tsx:23,28, agent-inspector.tsx:131,153, audit-trail.tsx:230 | Every border, divider, separator |
116
+
117
+ **Text (→ typography.css)**
118
+ | Token | Value | Source Mockup | File:Line | Usage |
119
+ |-------|-------|---------------|-----------|-------|
120
+ | `--khal-text-primary` | `#e2e8f0` | All mockups — titles, values | mockup-chrome.tsx:52, agent-inspector.tsx:111, mission-control.tsx:113 | Titles, active text, values |
121
+ | `--khal-text-secondary` | `#94a3b8` | All mockups — descriptions | agent-inspector.tsx:201,255, audit-trail.tsx:163, task-detail.tsx:123 | Body text, descriptions, events |
122
+ | `--khal-text-muted` | `#64748b` | All mockups — labels, metadata | mockup-chrome.tsx:47,53,64, agent-inspector.tsx:115,142, status-dot.tsx:26-27 | Labels, timestamps, metadata, breadcrumbs |
123
+ | `--khal-text-faint` | `#475569` | AuditTrail, AgentInspector | audit-trail.tsx:230,247,264, agent-inspector.tsx:218 | Timestamps, deeply muted text, disabled |
124
+
125
+ **Accent (→ controls.css)**
126
+ | Token | Value | Source Mockup | File:Line | Usage |
127
+ |-------|-------|---------------|-----------|-------|
128
+ | `--khal-accent-primary` | `#3b82f6` | TaskDetail, WorkflowBuilder, AgentInspector | task-detail.tsx:46,91, agent-inspector.tsx:22,200,246 | Primary action, links, selected state, BUILD stage |
129
+ | `--khal-accent-subtle` | `rgba(59,130,246,0.12)` | TaskDetail auto-created badge, AgentInspector selected | task-detail.tsx:202, agent-inspector.tsx:200 | Background tint for selected/active states |
130
+
131
+ **Window Chrome (→ window.css)**
132
+ | Token | Value | Source Mockup | File:Line | Usage |
133
+ |-------|-------|---------------|-----------|-------|
134
+ | `--khal-window-shadow` | `0 4px 24px rgba(0,0,0,0.4)` | MockupChrome | mockup-chrome.tsx:23 | Window drop shadow |
135
+ | Close button | `#ff5f57` | MockupChrome traffic lights | mockup-chrome.tsx:34 | Close button color |
136
+ | Minimize button | `#febc2e` | MockupChrome | mockup-chrome.tsx:35 | Minimize button color |
137
+ | Maximize button | `#28c840` | MockupChrome | mockup-chrome.tsx:36 | Maximize button color |
138
+
139
+ **Status & Stage Colors (→ status.css)**
140
+ | Token | Value | Source Mockup | File:Line | Usage |
141
+ |-------|-------|---------------|-----------|-------|
142
+ | `--khal-stage-triage` | `#f59e0b` | MissionControl, TaskDetail | mission-control.tsx:71, task-detail.tsx:45 | TRIAGE stage |
143
+ | `--khal-stage-plan` | `#8b5cf6` | MissionControl | mission-control.tsx:72 | PLAN/BRAINSTORM stage |
144
+ | `--khal-stage-build` | `#3b82f6` | MissionControl, TaskDetail | mission-control.tsx:73, task-detail.tsx:46 | BUILD stage |
145
+ | `--khal-stage-review` | `#06b6d4` | MissionControl, TaskDetail | mission-control.tsx:74, task-detail.tsx:47 | REVIEW stage |
146
+ | `--khal-stage-qa` | `#22c55e` | MissionControl, TaskDetail | mission-control.tsx:75, task-detail.tsx:48 | QA stage |
147
+ | `--khal-stage-ship` | `#22c55e` | MissionControl | mission-control.tsx:76 | SHIP stage (same as QA — both "done") |
148
+ | `--khal-status-live` | `#22c55e` | StatusDot | status-dot.tsx:22-25 | Live/online/active/working (with pulse) |
149
+ | `--khal-status-idle` | `#64748b` | StatusDot | status-dot.tsx:26-27 | Idle/away (no pulse) |
150
+ | `--khal-status-warning` | `#f59e0b` | StatusDot | status-dot.tsx:28 | Queued (no pulse) |
151
+ | `--khal-status-error` | `#ef4444` | StatusDot | status-dot.tsx:29 | Error (with pulse) |
152
+ | `--khal-event-stage` | `#3b82f6` | AuditTrail | audit-trail.tsx:42 | task.stage_change events |
153
+ | `--khal-event-tool` | `#22c55e` | AuditTrail | audit-trail.tsx:50 | tool.result events |
154
+ | `--khal-event-agent` | `#8b5cf6` | AuditTrail | audit-trail.tsx:58 | agent.decision events |
155
+ | `--khal-event-api` | `#f59e0b` | AuditTrail | audit-trail.tsx:74 | api.request events |
156
+ | `--khal-event-hire` | `#06b6d4` | AuditTrail | audit-trail.tsx:82 | agent.hired events |
157
+ | `--khal-event-omni` | `#25d366` | AuditTrail | audit-trail.tsx:106 | omni.event / WhatsApp events |
158
+ | `--khal-product-genie` | `#b4a0f4` | Landing page (not mockups) | — | Product identity: orchestration |
159
+ | `--khal-product-omni` | `#2dd4bf` | Landing page | — | Product identity: messaging |
160
+ | `--khal-product-khal` | `#fb923c` | Landing page | — | Product identity: product |
161
+ | `--khal-product-os` | `#60a5fa` | Landing page | — | Product identity: infrastructure |
162
+
163
+ **Cost Display (→ controls.css or status.css)**
164
+ | Token | Value | Source Mockup | File:Line | Usage |
165
+ |-------|-------|---------------|-----------|-------|
166
+ | Cost green | `#22c55e` | CostCounter, AuditTrail | cost-counter.tsx ($ symbol), audit-trail.tsx:186 | Dollar sign, positive costs |
167
+ | Cost threshold blue | `#3b82f6` | CostCounter | cost-counter.tsx (budget bar <60%) | Budget bar under 60% |
168
+ | Cost threshold amber | `#f59e0b` | CostCounter | cost-counter.tsx (budget bar 60-80%) | Budget bar 60-80% |
169
+ | Cost threshold red | `#ef4444` | CostCounter | cost-counter.tsx (budget bar >80%) | Budget bar over 80% |
170
+
171
+ ### Light Mode Derivation Rules
172
+
173
+ Light mode is derived from dark mode by applying these explicit transformations:
174
+
175
+ | Category | Dark Value | Light Value | Rule |
176
+ |----------|-----------|-------------|------|
177
+ | **Desktop bg** | `#0a0a0f` | `linear-gradient(135deg, #f0f2f8, #dfe4ef)` | Invert to light gradient |
178
+ | **Chrome bg** | `#0d0d14` | `#ffffff` | Invert to white |
179
+ | **Inactive bg** | `#0f0f18` | `#f8f9fb` | Invert to near-white |
180
+ | **Raised surface** | `#141420` | `#ffffff` | Invert to white |
181
+ | **Borders** | `#1e1e30` | `#e2e4ea` | Shift from dark separator to light separator |
182
+ | **Text primary** | `#e2e8f0` | `#1a1a2e` | Swap: light text on dark → dark text on light |
183
+ | **Text secondary** | `#94a3b8` | `#4a5568` | Darken for contrast on light bg |
184
+ | **Text muted** | `#64748b` | `#94a3b8` | Lighten (less contrast needed on light bg) |
185
+ | **Accent primary** | `#3b82f6` | `#2563eb` | Darken slightly for contrast on white |
186
+ | **Accent subtle bg** | `rgba(59,130,246,0.12)` | `rgba(37,99,235,0.08)` | Lower opacity on light bg |
187
+ | **Glass tint** | `rgba(20,20,32,0.8)` | `rgba(255,255,255,0.6)` | Dark tint → light tint |
188
+ | **Glass border** | `rgba(255,255,255,0.06)` | `rgba(0,0,0,0.06)` | White border on dark → dark border on light |
189
+ | **Shadows** | `rgba(0,0,0,0.4)` | `rgba(0,0,0,0.08)` | Lighter shadows on light bg |
190
+ | **Status/stage colors** | (unchanged) | (unchanged) | Functional colors stay the same in both modes |
191
+ | **ANSI terminal colors** | Dark palette | Adjusted for light bg | Darker variants for readability |
192
+
193
+ **Starting point:** Use the existing light mode values from globals.css lines 2298-2434 (`[data-concept="genie"]:not(.dark)` block). These were already derived using these rules.
194
+
195
+ **Token naming** — keep ALL existing `--khal-*` names exactly. Components already use them.
196
+
197
+ **Acceptance Criteria:**
198
+ - [ ] All 10 files exist in `src/theme/`
199
+ - [ ] `index.css` imports all 9 other files
200
+ - [ ] Every `--khal-*` variable currently defined in the `genie` concept block exists in the new files
201
+ - [ ] `:root` contains light mode values
202
+ - [ ] `.dark` contains dark mode values
203
+ - [ ] No `[data-concept=` selectors in any theme file
204
+
205
+ **Validation:**
206
+ ```bash
207
+ cd /home/genie/agents/sofia/repos/genie-os && ls src/theme/index.css src/theme/surfaces.css src/theme/typography.css src/theme/controls.css src/theme/window.css src/theme/taskbar.css src/theme/status.css src/theme/terminal.css src/theme/animations.css src/theme/menus.css && grep -c 'data-concept' src/theme/*.css | grep -v ':0$' | wc -l | grep '^0$' && echo "PASS"
208
+ ```
209
+
210
+ **depends-on:** none
211
+
212
+ ---
213
+
214
+ ### Group 2: Delete Concept Infrastructure
215
+
216
+ **Goal:** Remove all concept-switching code from the codebase.
217
+
218
+ **Deliverables:**
219
+
220
+ 1. **Delete files:**
221
+ - `src/lib/theme/concept-registry.ts`
222
+ - `src/lib/theme/use-concept.ts`
223
+
224
+ 2. **Simplify `src/stores/theme-store.ts`:**
225
+ - Remove `ThemeConcept` type
226
+ - Remove `concept` state field
227
+ - Remove `setConcept` action
228
+ - Keep: `mode` ('light' | 'dark' | 'system'), `setMode`, `reduceMotion`, `setReduceMotion`
229
+
230
+ 3. **Update `src/components/ui/theme-provider.tsx`:**
231
+ - Remove any concept-related logic
232
+ - Keep: next-themes ThemeProvider wrapping
233
+
234
+ 4. **Fix all imports** — grep for `concept-registry`, `use-concept`, `useConcept`, `ThemeConcept`, `setConcept` and remove/fix every reference across the codebase
235
+
236
+ **Acceptance Criteria:**
237
+ - [ ] `concept-registry.ts` deleted
238
+ - [ ] `use-concept.ts` deleted
239
+ - [ ] `theme-store.ts` has no `concept` or `ThemeConcept`
240
+ - [ ] Zero imports of deleted files anywhere
241
+ - [ ] `bunx tsc --noEmit` shows no new errors from deletions
242
+
243
+ **Validation:**
244
+ ```bash
245
+ cd /home/genie/agents/sofia/repos/genie-os && test ! -f src/lib/theme/concept-registry.ts && test ! -f src/lib/theme/use-concept.ts && grep -r "concept-registry\|use-concept\|useConcept\|ThemeConcept\|setConcept" src/ packages/ --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v node_modules | grep -v ".next" | wc -l | grep '^0$' && echo "PASS"
246
+ ```
247
+
248
+ **depends-on:** none (parallel with Group 1)
249
+
250
+ ---
251
+
252
+ ### Group 3: Simplify Window + Taskbar + Component Cleanup
253
+
254
+ **Goal:** Remove concept-specific components and branching from all OS shell components.
255
+
256
+ **Deliverables:**
257
+
258
+ 1. **Delete files:**
259
+ - `src/components/window/OmniGlassStack.tsx`
260
+ - `src/components/taskbar/OmniDock.tsx`
261
+ - `src/components/taskbar/OmniDockItem.tsx`
262
+
263
+ 2. **Simplify `Window.tsx`:**
264
+ - Remove `hasGlassStack` checks and OmniGlassStack rendering
265
+ - Remove concept-based conditional styling
266
+ - Use `--khal-*` CSS vars directly (they now come from theme/ files)
267
+
268
+ 3. **Simplify `WindowFrame.tsx`:**
269
+ - Remove concept-based control style branching (traffic-light / minimal / glass)
270
+ - Keep ONLY glass controls style
271
+ - Remove `useConcept()` import
272
+
273
+ 4. **Simplify `WindowControlsOverlay.tsx`:**
274
+ - Remove concept checks
275
+
276
+ 5. **Simplify `Taskbar.tsx`:**
277
+ - Remove concept check for OmniDock vs bar
278
+ - Always render bottom bar
279
+ - Remove `useConcept()` import
280
+
281
+ 6. **Fix `TerminalTabBar.tsx`** (both `src/components/apps/` and `packages/terminal-app/`):
282
+ - Remove concept reference
283
+
284
+ 7. **Fix any other files** referencing concepts (from the 17-file list)
285
+
286
+ **Acceptance Criteria:**
287
+ - [ ] `OmniGlassStack.tsx`, `OmniDock.tsx`, `OmniDockItem.tsx` deleted
288
+ - [ ] WindowFrame has one control style, no branching
289
+ - [ ] Taskbar always renders bottom bar
290
+ - [ ] Zero `useConcept()` calls in codebase
291
+ - [ ] Zero `hasGlassStack` references in codebase
292
+
293
+ **Validation:**
294
+ ```bash
295
+ cd /home/genie/agents/sofia/repos/genie-os && test ! -f src/components/window/OmniGlassStack.tsx && test ! -f src/components/taskbar/OmniDock.tsx && test ! -f src/components/taskbar/OmniDockItem.tsx && grep -r "useConcept\|hasGlassStack\|OmniGlassStack\|OmniDock" src/ packages/ --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v node_modules | grep -v ".next" | wc -l | grep '^0$' && echo "PASS"
296
+ ```
297
+
298
+ **depends-on:** Group 2 (concept infrastructure deleted first)
299
+
300
+ ---
301
+
302
+ ### Group 4: Globals.css Gut + Layout + Settings + Auth + Build
303
+
304
+ **Goal:** Reduce globals.css to imports-only, update layout.tsx, simplify Settings, commit auth fixes, verify production build.
305
+
306
+ **Deliverables:**
307
+
308
+ 1. **Gut `globals.css`:**
309
+ - Remove ALL `[data-concept=...]` blocks (~2800 lines)
310
+ - Keep: Tailwind imports, `@import "./theme/index.css"`, base tokens (radii, z-index, safe-area), any non-concept utility classes (`.khal-animated-bg`, `.khal-orb`, keyframes, scrollbar hiding, etc.)
311
+ - Result should be < 100 lines of actual content
312
+
313
+ 2. **Update `layout.tsx`:**
314
+ - Remove `data-concept="genie"` attribute from `<html>`
315
+ - Keep: `class` for dark/light, `suppressHydrationWarning`, etc.
316
+
317
+ 3. **Simplify Settings Appearance (both `src/components/apps/settings/Settings.tsx` AND `packages/settings-app/views/settings/Settings.tsx`):**
318
+ - Remove the entire `THEME_CONCEPTS` array and theme picker grid
319
+ - Keep: dark/light/system toggle (the "Change theme" button already does this)
320
+ - Keep: keyboard shortcuts, about, NATS echo sections
321
+
322
+ 4. **Commit auth fixes** (already modified on prod, need to be in the branch):
323
+ - `src/middleware.ts` — HeadlessChrome bypass checks for session cookie
324
+ - `src/lib/auth/use-auth.ts` — always use role-based permissions, ignore WorkOS org permissions
325
+
326
+ 5. **Production build test:**
327
+ - `bun next build` must exit 0
328
+ - Deploy to alpha.khal.namastex.io and verify
329
+
330
+ **Acceptance Criteria:**
331
+ - [ ] `globals.css` < 100 lines
332
+ - [ ] `layout.tsx` has no `data-concept`
333
+ - [ ] Settings has no theme concept picker
334
+ - [ ] Auth fixes committed
335
+ - [ ] `bun next build` exits 0
336
+ - [ ] alpha.khal.namastex.io renders correctly after deploy
337
+
338
+ **Validation:**
339
+ ```bash
340
+ cd /home/genie/agents/sofia/repos/genie-os && wc -l src/app/globals.css | awk '{if($1<100) print "PASS: "$1" lines"; else print "FAIL: "$1" lines"}' && grep -c 'data-concept' src/app/layout.tsx | grep '^0$' && grep -c 'THEME_CONCEPTS\|theme.*concept.*picker' packages/settings-app/views/settings/Settings.tsx | grep '^0$' && bun next build 2>&1 | tail -5
341
+ ```
342
+
343
+ **depends-on:** Group 1 (theme files must exist before gutting globals.css), Group 3 (components must be cleaned before build)
344
+
345
+ ---
346
+
347
+ ## QA Criteria
348
+
349
+ - [ ] Desktop renders in dark mode with mockup palette colors
350
+ - [ ] Desktop renders in light mode (coherent, readable)
351
+ - [ ] All 5 apps open and function: Terminal, Files, Settings, NATS Viewer, dev3000
352
+ - [ ] Terminal ANSI colors render correctly in both modes
353
+ - [ ] Window chrome (title bar, glass controls, shadows) looks correct
354
+ - [ ] Taskbar glass blur and borders render correctly
355
+ - [ ] Launcher opens and lists all apps
356
+ - [ ] Settings opens (no "Permission denied")
357
+ - [ ] Settings Appearance shows dark/light/system toggle only
358
+ - [ ] No visual glitches or missing styles
359
+ - [ ] No console errors related to missing CSS variables
360
+
361
+ ## Assumptions / Risks
362
+
363
+ | Risk | Severity | Mitigation |
364
+ |------|----------|------------|
365
+ | Some `--khal-*` variables only existed in specific concepts (not in genie block) | Medium | Grep all variable USAGE across components. Cross-reference with genie concept block. Add any missing vars to theme files. |
366
+ | Utility classes in globals.css (khal-animated-bg, scrollbar, etc.) get accidentally deleted | Medium | Carefully separate concept blocks from utility classes. Keep all non-concept CSS. |
367
+ | Production build fails due to missing imports | Medium | Run `bunx tsc --noEmit` after each group. Fix immediately. |
368
+ | Light mode looks wrong | Low | Ship as best-effort. Iterate post-merge. Dark mode is the primary. |
369
+
370
+ ---
371
+
372
+ ## Review Results
373
+
374
+ _Populated by `/review` after execution completes._
375
+
376
+ ---
377
+
378
+ ## Files to Create/Modify
379
+
380
+ ```
381
+ # CREATE (theme directory)
382
+ src/theme/index.css
383
+ src/theme/surfaces.css
384
+ src/theme/typography.css
385
+ src/theme/controls.css
386
+ src/theme/window.css
387
+ src/theme/taskbar.css
388
+ src/theme/status.css
389
+ src/theme/terminal.css
390
+ src/theme/animations.css
391
+ src/theme/menus.css
392
+
393
+ # DELETE (concept infrastructure)
394
+ src/lib/theme/concept-registry.ts
395
+ src/lib/theme/use-concept.ts
396
+ src/components/window/OmniGlassStack.tsx
397
+ src/components/taskbar/OmniDock.tsx
398
+ src/components/taskbar/OmniDockItem.tsx
399
+
400
+ # MODIFY (simplify)
401
+ src/app/globals.css (gut from 3109 → <100 lines)
402
+ src/app/layout.tsx (remove data-concept)
403
+ src/stores/theme-store.ts (remove concept, keep mode)
404
+ src/components/ui/theme-provider.tsx (remove concept logic)
405
+ src/components/window/Window.tsx (remove glass stack + concept)
406
+ src/components/window/WindowFrame.tsx (one control style)
407
+ src/components/window/WindowControlsOverlay.tsx (remove concept)
408
+ src/components/taskbar/Taskbar.tsx (one layout, no OmniDock)
409
+ src/components/apps/terminal/ui/TerminalTabBar.tsx (remove concept)
410
+ src/components/apps/settings/Settings.tsx (remove theme picker)
411
+ packages/terminal-app/views/terminal/ui/TerminalTabBar.tsx (remove concept)
412
+ packages/settings-app/views/settings/Settings.tsx (remove theme picker)
413
+
414
+ # MODIFY (auth fixes — already changed on prod, commit properly)
415
+ src/middleware.ts
416
+ src/lib/auth/use-auth.ts
417
+ ```