@kabmo-labs/kabmo 0.18.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/README.md +43 -13
  2. package/dist/client/index.html +3 -3
  3. package/dist/client/index.js +485 -484
  4. package/dist/client/static/js/index-0721wrkf.css +1 -0
  5. package/dist/client/static/js/{index-tc09dtca.js → index-zg32n2sk.js} +778 -777
  6. package/dist/client/static/{manifest-42r8wcmg.webmanifest → manifest-q6h8k9e0.webmanifest} +1 -1
  7. package/index.html +1 -1
  8. package/marketplace/plugins/command-runner/package.json +3 -2
  9. package/marketplace/plugins/git-forge/package.json +3 -2
  10. package/marketplace/plugins/session-info/package.json +3 -2
  11. package/marketplace/plugins/stats/package.json +3 -2
  12. package/package.json +3 -1
  13. package/public/manifest.webmanifest +1 -1
  14. package/src/client/components/auth/login-screen/index.tsx +2 -1
  15. package/src/client/components/common/ComposerPicker.tsx +1 -1
  16. package/src/client/components/common/FolderPicker.tsx +2 -2
  17. package/src/client/components/common/Modal.tsx +2 -2
  18. package/src/client/components/common/PWAInstallButton.tsx +2 -2
  19. package/src/client/components/common/ViewportSelector.tsx +1 -1
  20. package/src/client/components/common/anchored-menu/index.tsx +5 -1
  21. package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
  22. package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
  23. package/src/client/components/common/brand-wordmark/index.tsx +13 -2
  24. package/src/client/components/common/checkbox/style.test.ts +142 -0
  25. package/src/client/components/common/checkbox/style.ts +51 -0
  26. package/src/client/components/common/context-usage-button/index.tsx +2 -2
  27. package/src/client/components/common/file-icon/index.tsx +23 -9
  28. package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
  29. package/src/client/components/common/markdown-review/ReviewPopover.tsx +1 -1
  30. package/src/client/components/common/panel-mark/index.test.tsx +124 -0
  31. package/src/client/components/common/panel-mark/index.tsx +105 -0
  32. package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
  33. package/src/client/components/common/provider-icon/index.test.ts +14 -0
  34. package/src/client/components/common/provider-icon/index.tsx +4 -0
  35. package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
  36. package/src/client/components/common/provider-icon/resolve.ts +16 -3
  37. package/src/client/components/common/session-actions-menu/index.tsx +1 -1
  38. package/src/client/components/common/toolbar-row/index.tsx +1 -1
  39. package/src/client/components/layout/ActivityBar.tsx +22 -3
  40. package/src/client/components/layout/LeftDock.tsx +9 -2
  41. package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
  42. package/src/client/components/layout/WindowAura.tsx +27 -0
  43. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
  44. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
  45. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
  46. package/src/client/components/layout/desktop-layout/index.tsx +3 -1
  47. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +3 -3
  48. package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
  49. package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
  50. package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
  51. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +2 -2
  52. package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
  53. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +13 -5
  54. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
  55. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
  56. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
  57. package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
  58. package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
  59. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
  60. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
  61. package/src/client/components/mobile/panel-chips.tsx +10 -2
  62. package/src/client/components/settings/Modal.tsx +4 -4
  63. package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
  64. package/src/client/components/settings/apply-side-effects.test.ts +30 -0
  65. package/src/client/components/settings/apply-side-effects.ts +14 -0
  66. package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
  67. package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
  68. package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
  69. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
  70. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
  71. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
  72. package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +2 -1
  73. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +2 -2
  74. package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +1 -1
  75. package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
  76. package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
  77. package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +46 -0
  78. package/src/client/components/settings/categories/panel-plugins/GitFreshness.tsx +1 -1
  79. package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +7 -9
  80. package/src/client/components/settings/categories/panel-plugins/PluginCard.test.tsx +149 -0
  81. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +34 -7
  82. package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +66 -2
  83. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +47 -10
  84. package/src/client/components/settings/categories/panel-plugins/Section.tsx +7 -1
  85. package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +35 -2
  86. package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
  87. package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
  88. package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
  89. package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
  90. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
  91. package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
  92. package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
  93. package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
  94. package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +2 -1
  95. package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
  96. package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
  97. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
  98. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
  99. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
  100. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
  101. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
  102. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
  103. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
  104. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
  105. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
  106. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
  107. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
  108. package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
  109. package/src/client/components/workspace/diff-panel/index.tsx +2 -2
  110. package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
  111. package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
  112. package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
  113. package/src/client/components/workspace/editor/Tabs.tsx +1 -1
  114. package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
  115. package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
  116. package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
  117. package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
  118. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
  119. package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
  120. package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
  121. package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
  122. package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
  123. package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
  124. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
  125. package/src/client/components/workspace/git-panel/index.tsx +7 -0
  126. package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
  127. package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
  128. package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
  129. package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
  130. package/src/client/components/workspace/search-panel/Body.tsx +1 -1
  131. package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
  132. package/src/client/glass-sticky.test.ts +46 -0
  133. package/src/client/glass.css +795 -0
  134. package/src/client/glass.test.ts +306 -0
  135. package/src/client/hooks/ui/glass-support.ts +57 -0
  136. package/src/client/hooks/ui/icon-style.ts +59 -0
  137. package/src/client/hooks/ui/stuck-header.test.ts +213 -0
  138. package/src/client/hooks/ui/stuck-header.ts +122 -0
  139. package/src/client/hooks/ui/style-attributes.test.ts +120 -0
  140. package/src/client/hooks/ui/surface-style.ts +56 -0
  141. package/src/client/hooks/workspace/panel-hues.ts +23 -0
  142. package/src/client/hooks/workspace/panel-registry.ts +8 -4
  143. package/src/client/main.tsx +10 -0
  144. package/src/client/tailwind.css +264 -11
  145. package/src/server/lib/assets/shell-attributes.server.ts +80 -0
  146. package/src/server/lib/assets/shell-attributes.test.ts +86 -0
  147. package/src/server/lib/lifecycle/tls.test.ts +6 -1
  148. package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
  149. package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
  150. package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
  151. package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
  152. package/src/server/lib/omp/rpc/manager.ts +2 -2
  153. package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
  154. package/src/server/lib/omp/rpc/process.test.ts +106 -0
  155. package/src/server/lib/omp/rpc/process.ts +28 -4
  156. package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
  157. package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
  158. package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
  159. package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
  160. package/src/server/lib/omp/rpc/session-commands.ts +11 -0
  161. package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
  162. package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
  163. package/src/server/lib/panels/git-update.server.test.ts +20 -0
  164. package/src/server/lib/panels/git-update.server.ts +20 -4
  165. package/src/server/lib/panels/manifest.test.ts +20 -0
  166. package/src/server/lib/panels/manifest.ts +12 -0
  167. package/src/server/lib/panels/scan.server.ts +4 -0
  168. package/src/server/lib/panels/sync.server.ts +9 -1
  169. package/src/server/lib/panels/update.server.test.ts +193 -0
  170. package/src/server/lib/panels/update.server.ts +210 -0
  171. package/src/server/lib/plugins/server-half.server.ts +42 -0
  172. package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
  173. package/src/server/lib/queue/delivery-harness.ts +8 -4
  174. package/src/server/lib/queue/delivery.server.test.ts +29 -0
  175. package/src/server/lib/queue/delivery.server.ts +39 -0
  176. package/src/server/lib/queue/store.server.test.ts +22 -2
  177. package/src/server/lib/queue/store.server.ts +33 -11
  178. package/src/server/lib/terminal/attach-replay.test.ts +26 -8
  179. package/src/server/plugins/ssr.ts +22 -5
  180. package/src/server/routes/panels/install-route.test.ts +238 -0
  181. package/src/server/routes/panels/install.ts +36 -64
  182. package/src/server/routes/panels/panel-routes.test-util.ts +6 -1
  183. package/src/server/routes/panels/routes.test.ts +1 -118
  184. package/src/shared/lib/icons/file-brand-color.ts +38 -0
  185. package/src/shared/lib/icons/icon-paint-css.test.ts +235 -0
  186. package/src/shared/lib/icons/icon-paint-css.ts +285 -0
  187. package/src/shared/lib/icons/icon-paint-panel.ts +109 -0
  188. package/src/shared/lib/icons/icon-tone.ts +166 -0
  189. package/src/shared/lib/icons/tint-hues.generated.ts +277 -0
  190. package/src/shared/lib/icons/tint.test.ts +333 -0
  191. package/src/shared/lib/icons/tint.ts +248 -0
  192. package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
  193. package/src/shared/lib/models/provider/brand-color.ts +103 -0
  194. package/src/shared/lib/omp/rpc/frame.test.ts +65 -0
  195. package/src/shared/lib/omp/rpc/frame.ts +58 -3
  196. package/src/shared/lib/panels/update.test.ts +107 -0
  197. package/src/shared/lib/panels/update.ts +73 -0
  198. package/src/shared/lib/settings/defaults.ts +4 -0
  199. package/src/shared/lib/theme/catalog.test.ts +5 -4
  200. package/src/shared/lib/theme/catalog.ts +18 -3
  201. package/src/shared/lib/theme/color.ts +50 -0
  202. package/src/shared/lib/theme/glass-support.test.ts +38 -0
  203. package/src/shared/lib/theme/glass-support.ts +73 -0
  204. package/src/shared/lib/theme/icon-style.test.ts +74 -0
  205. package/src/shared/lib/theme/icon-style.ts +90 -0
  206. package/src/shared/lib/theme/legibility.ts +91 -0
  207. package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
  208. package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
  209. package/src/shared/lib/theme/surface-style.test.ts +68 -0
  210. package/src/shared/lib/theme/surface-style.ts +91 -0
  211. package/src/shared/lib/theme/theme.test.ts +11 -7
  212. package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
  213. package/src/shared/lib/workspace/panel-hues.ts +57 -0
  214. package/src/shared/types/panels-registry.ts +6 -0
  215. package/src/shared/types/panels.ts +14 -0
  216. package/src/shared/types/settings/state.ts +26 -0
  217. package/src/test-support/fake-omp-frames.ts +163 -0
  218. package/dist/client/static/js/index-hp75vsv9.css +0 -1
  219. /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The colour a BUILT-IN panel's mark is drawn in, as one fact for every surface.
8
+ *
9
+ * A built-in panel's mark is drawn by the activity bar, the phone's chip strip
10
+ * and the Built-in list in Settings, and each of them used to answer "what
11
+ * colour is this?" differently: the rail hashed the PANEL ID (`files` → 0°),
12
+ * while the two lists drew the glyph and therefore took the GLYPH's hue
13
+ * (`lucide-files` → 320°, and `lucide-book-open` even fell through to the `info`
14
+ * signal colour). One panel, two colours — measured, the same `Files` mark was
15
+ * `hsl(0 …)` in the rail and `hsl(320 …)` in Settings.
16
+ *
17
+ * The answer is computed ONCE, over the whole SET of built-in views rather than
18
+ * over whatever a surface happens to be drawing:
19
+ *
20
+ * - **The universe is fixed, not the drawn set.** Every built-in view plus the
21
+ * dock's own view, including the ones switched OFF — because the Settings list
22
+ * draws exactly those, and the colour must not change when a view is toggled
23
+ * or dragged.
24
+ * - **Collisions are resolved over that same universe** (`assignPanelHues`), so
25
+ * two neighbours never land on one blue, and the answer does not depend on the
26
+ * order a surface asks in.
27
+ *
28
+ * A PLUGIN panel is deliberately absent: its colour is the plugin's OWN mark
29
+ * colour (the brand hex its manifest declares, else the hue of its name), the
30
+ * same one its marketplace card draws. Keying that by the slot id instead would
31
+ * give one plugin two colours — the exact defect this module removes.
32
+ */
33
+
34
+ import { assignPanelHues, hashHue } from '@/shared/lib/icons/tint';
35
+ import { RIGHT_PANEL_TYPES } from '@/shared/lib/workspace/right-panels';
36
+ import { SESSIONS_VIEW_ID } from '@/shared/lib/workspace/left-dock';
37
+
38
+ /** Every id the built-in hue map is computed over: all of them, drawn or not. */
39
+ export function panelHueUniverse(): string[] {
40
+ return [SESSIONS_VIEW_ID, ...RIGHT_PANEL_TYPES];
41
+ }
42
+
43
+ /** The hue map every surface reads. */
44
+ export function resolvePanelHues(): Map<string, number> {
45
+ return assignPanelHues(panelHueUniverse());
46
+ }
47
+
48
+ /**
49
+ * The hue for one panel id, with the plain hash as the fallback.
50
+ *
51
+ * An id outside the universe is one this build does not know — a plugin's slot,
52
+ * an id from a newer version. A stable hash still gives it a colour on the same
53
+ * wheel instead of the neutral default every unknown glyph shares.
54
+ */
55
+ export function panelHueOf(hues: ReadonlyMap<string, number>, panelId: string): number {
56
+ return hues.get(panelId) ?? hashHue(panelId);
57
+ }
@@ -46,6 +46,8 @@ export interface PanelRegistryEntry {
46
46
  cssUrl?: string;
47
47
  /** Absolute URL of the plugin's icon, when it declares one. */
48
48
  iconUrl?: string;
49
+ /** The colour the plugin's mark is drawn in, when its manifest declares one. */
50
+ color?: string;
49
51
  /** Absolute URL of the plugin's README, when it ships one. */
50
52
  readmeUrl?: string;
51
53
  }
@@ -165,6 +167,8 @@ export interface PanelPluginStatus {
165
167
  homepage?: string;
166
168
  /** The slots the manifest DECLARES; live registrations are authoritative. */
167
169
  slots?: PanelSlotName[];
170
+ /** The mark colour the manifest declares, when it declares one. */
171
+ color?: string;
168
172
  capabilities?: string[];
169
173
  /** How many settings the manifest declares, so the card can say what is configurable. */
170
174
  settingsCount?: number;
@@ -203,6 +207,8 @@ export interface PanelCatalogEntry {
203
207
  description?: string;
204
208
  /** Absolute URL of the plugin's icon, when the store's copy declares one. */
205
209
  iconUrl?: string;
210
+ /** The mark colour the store's copy declares, so a card can preview it. */
211
+ color?: string;
206
212
  /** Absolute URL of the plugin's README, when the store's copy ships one. */
207
213
  readmeUrl?: string;
208
214
  /** True once the plugin is installed — the row then offers Enable/Remove. */
@@ -95,6 +95,20 @@ export interface PanelPluginManifest {
95
95
  capabilities?: string[];
96
96
  /** Optional icon file, relative to the plugin root. */
97
97
  icon?: string;
98
+ /**
99
+ * The colour this plugin's mark is drawn in, as a CSS hex (`#RRGGBB`).
100
+ *
101
+ * Declared by the plugin because only the plugin knows its own brand — the
102
+ * host's alternative is a hue hashed from the plugin's NAME, which is stable
103
+ * but arbitrary (`hashHue`), and a marketplace author who ships a logo should
104
+ * not have that logo tinted by a hash. Read by the activity bar's colour mode;
105
+ * absent means the host falls back to the hashed hue.
106
+ *
107
+ * Hex only, and validated on the server: the value reaches an inline custom
108
+ * property, so `color: url(...)` or `red; background: …` must not be able to
109
+ * arrive through a manifest. The same rule the project accent follows.
110
+ */
111
+ color?: string;
98
112
  /**
99
113
  * Optional README, relative to the plugin root. Markdown, shown in the pane's
100
114
  * reader so a user can judge a plugin before installing it.
@@ -3,6 +3,8 @@ import type { ChatWidthMode } from '@/shared/lib/chat/timeline/width-mode';
3
3
  import type { ToolRenderMode } from '@/shared/lib/chat/timeline/tool-render-mode';
4
4
  import type { SidebarStyle } from '@/shared/lib/workspace/sidebar-style';
5
5
  import type { ComposerStyle } from '@/shared/lib/chat/composer/style';
6
+ import type { SurfaceStyle } from '@/shared/lib/theme/surface-style';
7
+ import type { IconStyle } from '@/shared/lib/theme/icon-style';
6
8
 
7
9
  /** Wire protocol for the live agent event stream (chat timeline). */
8
10
  export type SettingsCategoryId =
@@ -127,6 +129,30 @@ export interface SettingsState {
127
129
  * style. `classic` is the default so an upgrade rearranges nothing.
128
130
  */
129
131
  composerStyle: ComposerStyle;
132
+ /**
133
+ * What the app's surfaces are cut from (`classic` | `glass`). A
134
+ * PRESENTATION choice over one shell: both styles draw the same panels, rows,
135
+ * controls and dialogs, and only the material changes. The table lives in
136
+ * `shared/lib/theme/surface-style.ts`; the pixels are the `[data-surface]`
137
+ * blocks in `tailwind.css`.
138
+ *
139
+ * It reaches the document as `data-surface` on `<html>` because the sidebar,
140
+ * navbar, composer and every modal are separate subtrees — a prop would be one
141
+ * call site each. `classic` is the default so an upgrade restyles nothing.
142
+ */
143
+ surfaceStyle: SurfaceStyle;
144
+ /**
145
+ * How EVERY icon is painted (`monochrome` | `color`): functional Lucide
146
+ * glyphs, provider/model marks and file-type marks. `color` gives each glyph
147
+ * its own hue, keeps the palette signals for the ones whose meaning is a
148
+ * signal, and paints brand art in the brand's colour; a colour that would
149
+ * vanish on the active variant falls back to the ink. The rules are
150
+ * `:where()`-wrapped, so a control's own colour still wins.
151
+ *
152
+ * Document attribute `data-icon-style`; see `shared/lib/theme/icon-style.ts`
153
+ * and `shared/lib/icons/icon-paint-css.ts`.
154
+ */
155
+ iconStyle: IconStyle;
130
156
  followUpBehavior: 'queue' | 'steering';
131
157
  keybindingSend: 'Enter' | 'Shift + Enter' | 'Ctrl / Cmd + Enter';
132
158
  keybindingNewLine: 'Enter' | 'Shift + Enter' | 'Ctrl / Cmd + Enter';
@@ -0,0 +1,163 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * @license
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+
7
+ /**
8
+ * A scripted `omp` RPC child for the TRANSPORT questions `RpcProcess` owns.
9
+ *
10
+ * It exists because those questions cannot be asked of a real child: omp 18.16.0
11
+ * never advertises ceilings other than its own, and it never emits a malformed
12
+ * `rpc_chunk` sequence. Both are exactly what the reader must survive, so the
13
+ * child says what the test needs it to say.
14
+ *
15
+ * `ready` advertises what these env vars name, defaulting to omp's own values:
16
+ * FAKE_OMP_READY_MAX_FRAME_BYTES (default 1048576)
17
+ * FAKE_OMP_READY_MAX_REASSEMBLED_BYTES (default 67108864)
18
+ *
19
+ * `bash` is the trigger: it writes `FAKE_OMP_CHUNK` BEFORE answering, which is
20
+ * the only way to put a chunk record in front of the reader from inside the
21
+ * protocol. Values:
22
+ * `valid-1mib` — a complete 1 MiB sequence. Valid under the default 1 MiB
23
+ * physical ceiling, invalid under an advertised 4 MiB one
24
+ * (a frame that small is never chunked there).
25
+ * `bad-index` — a chunk that does not start at index 0: a hard fault.
26
+ * Anything else writes nothing.
27
+ *
28
+ * The source MUST stay constant: it is spawned as-is on every run.
29
+ */
30
+
31
+ import { appendFileSync } from 'node:fs';
32
+
33
+ const encoder = new TextEncoder();
34
+ const write = (frame: unknown) => {
35
+ process.stdout.write(encoder.encode(`${JSON.stringify(frame)}\n`));
36
+ };
37
+
38
+ const numberFromEnv = (name: string, fallback: number): number => {
39
+ const raw = Bun.env[name];
40
+ const parsed = raw === undefined ? Number.NaN : Number(raw);
41
+ return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : fallback;
42
+ };
43
+
44
+ const ready = {
45
+ type: 'ready',
46
+ protocolVersion: 1,
47
+ supportedProtocolVersions: [1, 2],
48
+ maxFrameBytes: numberFromEnv('FAKE_OMP_READY_MAX_FRAME_BYTES', 1024 * 1024),
49
+ maxReassembledFrameBytes: numberFromEnv('FAKE_OMP_READY_MAX_REASSEMBLED_BYTES', 64 * 1024 * 1024),
50
+ };
51
+
52
+ /**
53
+ * A complete, VALID chunk sequence for a 1 MiB logical frame — 4 slices of the
54
+ * 256 KiB a chunk may carry, and a byte length exactly at omp's default physical
55
+ * ceiling (so `byteLength >= maxFrameBytes` holds there and fails under any
56
+ * larger advertised ceiling).
57
+ *
58
+ * The demand is what makes the ceiling test meaningful: the SAME bytes are a
59
+ * valid sequence under the default ceiling and a protocol fault under an
60
+ * advertised 4 MiB one, because a frame that small is never chunked then.
61
+ */
62
+ const CHUNK_BYTES = 1024 * 1024;
63
+ const CHUNK_SLICE = 256 * 1024;
64
+ const CHUNK_COUNT = CHUNK_BYTES / CHUNK_SLICE;
65
+
66
+ function validSequence(): Uint8Array[] {
67
+ const head = '{"type":"noop","pad":"';
68
+ const tail = '"}';
69
+ const json = `${head}${'A'.repeat(CHUNK_BYTES - head.length - tail.length)}${tail}`;
70
+ const bytes = new TextEncoder().encode(json);
71
+ return Array.from({ length: CHUNK_COUNT }, (_, index) => bytes.subarray(index * CHUNK_SLICE, (index + 1) * CHUNK_SLICE));
72
+ }
73
+
74
+ function scriptedChunks(mode: string | undefined): Record<string, unknown>[] {
75
+ if (mode === 'valid-1mib') {
76
+ const slices = validSequence();
77
+ return slices.map((slice, index) => ({
78
+ type: 'rpc_chunk',
79
+ chunkId: 'fake-1',
80
+ index,
81
+ count: CHUNK_COUNT,
82
+ byteLength: CHUNK_BYTES,
83
+ data: slice.toBase64(),
84
+ }));
85
+ }
86
+ if (mode === 'bad-index') {
87
+ return [{
88
+ type: 'rpc_chunk',
89
+ chunkId: 'fake-2',
90
+ index: 5,
91
+ count: CHUNK_COUNT,
92
+ byteLength: CHUNK_BYTES,
93
+ data: new Uint8Array(1024).fill(65).toBase64(),
94
+ }];
95
+ }
96
+ return [];
97
+ }
98
+
99
+ const respond = (id: unknown, command: string, data: unknown) => {
100
+ write({ type: 'response', id, command, success: true, data });
101
+ };
102
+
103
+ const state = {
104
+ sessionId: 'fake-session',
105
+ sessionFile: '/tmp/fake-session.jsonl',
106
+ isStreaming: false,
107
+ isSettled: true,
108
+ isCompacting: false,
109
+ autoCompactionEnabled: true,
110
+ interruptMode: 'immediate',
111
+ steeringMode: 'one-at-a-time',
112
+ followUpMode: 'one-at-a-time',
113
+ messageCount: 0,
114
+ };
115
+
116
+ write(ready);
117
+
118
+ const decoder = new TextDecoder();
119
+ let buffer = '';
120
+ const stdin = Bun.stdin.stream().getReader();
121
+
122
+ for (;;) {
123
+ const { done, value } = await stdin.read();
124
+ if (done) break;
125
+ buffer += decoder.decode(value, { stream: true });
126
+ let newline = buffer.indexOf('\n');
127
+ while (newline !== -1) {
128
+ const line = buffer.slice(0, newline).trim();
129
+ buffer = buffer.slice(newline + 1);
130
+ newline = buffer.indexOf('\n');
131
+ if (!line) continue;
132
+ let frame: Record<string, unknown>;
133
+ try {
134
+ frame = JSON.parse(line) as Record<string, unknown>;
135
+ } catch {
136
+ continue;
137
+ }
138
+ const id = frame.id;
139
+ switch (frame.type) {
140
+ case 'negotiate_protocol':
141
+ respond(id, 'negotiate_protocol', { protocolVersion: 2 });
142
+ break;
143
+ case 'bash': {
144
+ for (const chunk of scriptedChunks(Bun.env.FAKE_OMP_CHUNK)) write(chunk);
145
+ respond(id, 'bash', { output: 'fake', exitCode: 0, cancelled: false, truncated: false, totalLines: 1, totalBytes: 4, outputLines: 1, outputBytes: 4 });
146
+ break;
147
+ }
148
+ case 'prompt': {
149
+ const log = Bun.env.FAKE_OMP_PROMPT_LOG;
150
+ if (log) {
151
+ try {
152
+ appendFileSync(log, `${JSON.stringify({ id, type: frame.type })}\n`);
153
+ } catch {}
154
+ }
155
+ respond(id, 'prompt', { agentInvoked: false });
156
+ break;
157
+ }
158
+ default:
159
+ respond(id, String(frame.type), state);
160
+ break;
161
+ }
162
+ }
163
+ }