@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
@@ -92,6 +92,209 @@
92
92
  }
93
93
  }
94
94
 
95
+ /* The veil behind a dialog.
96
+ *
97
+ * It must DARKEN the app in both variants, and `bg-ink/40` cannot: `ink` is the
98
+ * foreground, so it is dark on a light theme and LIGHT on a dark one — measured
99
+ * on `one-dark-pro-soft`, every dialog sat in a `rgb(127,136,149)` field, i.e.
100
+ * lit from behind, and a dialog then read as a dark hole. One class, one fact:
101
+ * the ink on light, black on dark. */
102
+ .modal-scrim {
103
+ background-color: color-mix(in srgb, var(--theme-ink) 40%, transparent);
104
+ }
105
+
106
+ [data-theme-variant='dark'] .modal-scrim {
107
+ /* 58% black put the dialog at 1.01:1 against its own scrim — measured, the
108
+ * panel disappeared into the veil. The veil's job is to recede, not to match:
109
+ * 42% leaves the paper visibly above it while still dimming the app. */
110
+ background-color: color-mix(in srgb, #000 42%, transparent);
111
+ }
112
+
113
+ /* Under the glass surface the veil is FROSTED, not just dimmed.
114
+ *
115
+ * A dialog's own 96% tint contributes almost nothing of what is behind it, so
116
+ * the material has to be legible in the margin AROUND the panel — and there a
117
+ * flat wash reads as "the app is off", not as glass. Blurring the veil is what
118
+ * turns that margin into a pane: the app stays in place, its detail goes soft,
119
+ * and the panel's edge sits on a field that is visibly blurred rather than
120
+ * merely dark. The tint is NOT touched, so the panel's own luminance and every
121
+ * text contrast on it are exactly what they were measured at.
122
+ *
123
+ * One blur pass, only while a modal is open — a modal is exclusive, so this
124
+ * never stacks with a streaming transcript. */
125
+ [data-surface='glass'] .modal-scrim {
126
+ backdrop-filter: blur(20px) saturate(120%);
127
+ -webkit-backdrop-filter: blur(20px) saturate(120%);
128
+ }
129
+
130
+ /* The checkbox, drawn here rather than by the engine.
131
+ *
132
+ * A native `<input type="checkbox">` is the right CONTROL and the wrong
133
+ * RENDERING. The engine paints an unchecked box that is barely there and a
134
+ * checked one in its own accent; measured in the session sidebar, the unchecked
135
+ * box composited to `(236,238,235)` on a `(250,248,242)` row — **1.10:1** —
136
+ * against 10.84:1 for the checked one, which is "checkbox gk kelihatan on off
137
+ * nya". The input stays (semantics, keyboard, `indeterminate`); its box is
138
+ * replaced.
139
+ *
140
+ * Three numbers here, each a budget:
141
+ *
142
+ * - **The ring is `ink 75%`.** WCAG's non-text floor is 3:1, and across all 43
143
+ * palettes `ink 75%` is the first alpha whose worst case clears it (3.02:1 on
144
+ * `solarized-light`). 60% is 2.34:1; the `border-ink/30` these shipped with is
145
+ * 1.71:1 — the bug.
146
+ * - **The checked fill is the full ink**, so the tick is `paper` and the pair is
147
+ * the palette's own ink/paper contrast: 17.5:1 on `paper`, 4.85:1 worst case.
148
+ * - **The dash uses the same ink**, because indeterminate is a THIRD state and
149
+ * has to read as "on, partly" rather than as "off with a line in it".
150
+ *
151
+ * `accent-color` stays set at the call sites: an engine that cannot draw the
152
+ * pseudo-element falls back to the platform control instead of a blank square.
153
+ *
154
+ * The pseudo-elements only carry `content`, so the shared `box-sizing` and the
155
+ * palette tokens do the rest; `:disabled` dims instead of changing colour, so a
156
+ * disabled checked box still reads as checked.
157
+ */
158
+ @layer components {
159
+ .kabmo-checkbox {
160
+ appearance: none;
161
+ -webkit-appearance: none;
162
+ position: relative;
163
+ display: inline-block;
164
+ flex-shrink: 0;
165
+ /* A DEFAULT size, because `appearance: none` removes the intrinsic one: a
166
+ * call site that never passed `w-3.5` (the settings rows relied on the
167
+ * engine's 13px box) measured **4x4px** — the border box with nothing
168
+ * inside. This sits in `@layer components`, so a call site's `w-4`/`size-3.5`
169
+ * utility still wins. */
170
+ width: 0.875rem;
171
+ height: 0.875rem;
172
+ box-sizing: border-box;
173
+ /* 2px, not 1.5px: at a device pixel ratio of 1 a 1.5px border lands on a
174
+ * half pixel and antialiases into a ~50% blend, so the intended
175
+ * `ink 75%` ring rendered as `(166,169,166)` on a `(223,229,220)` row — 1.85:1,
176
+ * below the floor the alpha was chosen for. 2px gives two full device pixels
177
+ * with no partial coverage in the middle. */
178
+ border: 2px solid color-mix(in srgb, var(--theme-ink) 75%, transparent);
179
+ border-radius: 3px;
180
+ background-color: transparent;
181
+ transition: background-color 120ms ease, border-color 120ms ease;
182
+ }
183
+
184
+ .kabmo-checkbox:hover:not(:disabled) {
185
+ border-color: var(--theme-ink);
186
+ }
187
+
188
+ .kabmo-checkbox::after {
189
+ content: '';
190
+ position: absolute;
191
+ /* 1px, not 3px: `inset` is measured from the PADDING box, so on a 14px
192
+ * control with a 2px ring the interior is 10px — a 3px inset left a 4px
193
+ * mark, which renders as a blob rather than a tick. 1px leaves 8px, the
194
+ * size a checkmark needs at this scale. */
195
+ inset: 1px;
196
+ transform: scale(0);
197
+ transition: transform 100ms ease;
198
+ /* The tick is a mask, not a glyph: an SVG path in `currentColor` would inherit
199
+ * whatever the caller's text colour is, and these controls sit in rows that
200
+ * set `text-ink/NN` for their own reasons. A masked box paints `paper`, which
201
+ * is the pair the fill guarantees. */
202
+ background-color: var(--theme-paper);
203
+ mask: center / contain no-repeat
204
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5 9.5 18 20 6.5'/%3E%3C/svg%3E");
205
+ -webkit-mask: center / contain no-repeat
206
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5 9.5 18 20 6.5'/%3E%3C/svg%3E");
207
+ }
208
+
209
+ .kabmo-checkbox:checked,
210
+ .kabmo-checkbox:indeterminate {
211
+ background-color: var(--theme-ink);
212
+ border-color: var(--theme-ink);
213
+ }
214
+
215
+ .kabmo-checkbox:checked::after {
216
+ transform: scale(1);
217
+ }
218
+
219
+ /* Indeterminate is a DASH: the tick is replaced, not overlaid, so the two states
220
+ * cannot be confused at 14px. */
221
+ .kabmo-checkbox:indeterminate::after {
222
+ inset: auto 2px;
223
+ top: calc(50% - 1px);
224
+ height: 2px;
225
+ border-radius: 1px;
226
+ transform: scale(1);
227
+ mask: none;
228
+ -webkit-mask: none;
229
+ }
230
+
231
+ /* No `opacity` here: the call sites already say `disabled:opacity-60` /
232
+ * `disabled:opacity-50`, and an unlayered declaration would beat every one of
233
+ * them — a control that dims to 0.45 no matter what its owner asked for. */
234
+ .kabmo-checkbox:disabled {
235
+ cursor: not-allowed;
236
+ }
237
+ }
238
+
239
+ /* FULL COLOUR MODE: on is GREEN, off is RED.
240
+ *
241
+ * The colour mode is the one place a user asks for chroma, so the checkbox
242
+ * answers it: a checked box fills with the palette's success colour and an
243
+ * unchecked one shows the error colour in its ring. Monochrome — the absence of
244
+ * the attribute — keeps the ink-based pair, because that mode has no colour to
245
+ * state a state with.
246
+ *
247
+ * Both are MIXED TOWARD THE INK, and that is a contrast budget, not taste. At
248
+ * full strength the ring measures 2.73:1 worst case (`mono-light`) and the fill
249
+ * 1.75:1 (`nord-light`) against the surface they sit on — both below the 3:1
250
+ * non-text floor. Mixing toward the ink moves them along the one axis the
251
+ * palette already guarantees: `error 75%` clears 3.56:1 and `success 55%`
252
+ * 3.63:1 across all 63 palettes, measured on the REAL chrome composite (paper
253
+ * over plane over canvas), not on bare paper.
254
+ *
255
+ * The tick stays `--theme-paper`: on the green fill that is the palette's own
256
+ * paper/ink relationship read backwards, 3.60:1 worst case.
257
+ */
258
+ [data-icon-style="color"] .kabmo-checkbox {
259
+ border-color: color-mix(in srgb, var(--theme-error) 75%, var(--theme-ink));
260
+ }
261
+
262
+ /* Hover deepens toward the error colour, but stops at 85%: at full strength the
263
+ * ring measures 2.77:1 on `mono-light` — under the floor the resting state was
264
+ * chosen to clear — so the hover would be LESS legible than the idle box it is
265
+ * trying to highlight. 85% reads 3.47:1 and is still visibly warmer. */
266
+ [data-icon-style="color"] .kabmo-checkbox:hover:not(:disabled) {
267
+ border-color: color-mix(in srgb, var(--theme-error) 85%, var(--theme-ink));
268
+ }
269
+
270
+ [data-icon-style="color"] .kabmo-checkbox:checked,
271
+ [data-icon-style="color"] .kabmo-checkbox:indeterminate {
272
+ background-color: color-mix(in srgb, var(--theme-success) 55%, var(--theme-ink));
273
+ border-color: color-mix(in srgb, var(--theme-success) 55%, var(--theme-ink));
274
+ }
275
+
276
+ /* A SWITCH states the same two facts as a checkbox, so it states them in the same
277
+ * two colours — keyed on the ROLE and `aria-checked`, not on a class, because
278
+ * six call sites paint their track with five different utilities (`bg-ink`,
279
+ * `bg-ink/70`, `bg-ink/20`, `bg-ink/15`) and none of them is the thing that
280
+ * means "on".
281
+ *
282
+ * The alphas are the checkbox's, and for the same reason: measured over all 43
283
+ * palettes, `success 55%` clears 3.60:1 and `error 75%` 3.46:1 against the panel
284
+ * a switch sits on, while the canvas knob clears 3.72:1 / 3.87:1 against those
285
+ * tracks. The raw signal colours do not: `success` reaches 1.75:1 worst case.
286
+ *
287
+ * `[aria-checked="false"]` rather than `:not([aria-checked="true"])`: a switch
288
+ * that forgot the attribute is a bug in the control, and painting it red would
289
+ * hide that behind a plausible state. */
290
+ [data-icon-style="color"] [role="switch"][aria-checked="true"] {
291
+ background-color: color-mix(in srgb, var(--theme-success) 55%, var(--theme-ink));
292
+ }
293
+
294
+ [data-icon-style="color"] [role="switch"][aria-checked="false"] {
295
+ background-color: color-mix(in srgb, var(--theme-error) 75%, var(--theme-ink));
296
+ }
297
+
95
298
  /* Dot grain texture for Hero production card */
96
299
  .dot-grain-texture {
97
300
  background-image: radial-gradient(color-mix(in srgb, var(--theme-ink) 6%, transparent) 0.65px, transparent 0.65px);
@@ -380,19 +583,36 @@
380
583
  * paper. It has a real subject when the phone STRETCHES the composer over the
381
584
  * transcript (`fixed inset-0`), which is the state the effect was drawn for.
382
585
  */
586
+ /* The material comes from `glass.css`, NOT from a second recipe here: one
587
+ * `--glass-*` token set states tint, bloom, sheen, shadow and the two blur
588
+ * budgets. The card takes `--glass-card-filter`, not the plane's — a 30px blur
589
+ * behind a card floating over a static transcript is a pass nobody can see.
590
+ * Under the classic look every token resolves to the values this block used to
591
+ * hardcode, so the style is unchanged when the surface is.
592
+ *
593
+ * Four layers, because one tint cannot be a pane of glass: the tint
594
+ * (`--glass-card`), the bloom (`--glass-bloom`, the light that passed through
595
+ * and landed in the corners), the sheen (`--glass-sheen`, the specular
596
+ * reflection on the face) and the rim + shadow (`--glass-edge`,
597
+ * `--glass-shadow`). Measured on the docked card, tint-only read 1.03:1
598
+ * (light) / 1.04:1 (dark) against the surface beside it — a card you could not
599
+ * see. The corner bloom is what makes the frost legible where nothing is
600
+ * behind it to blur. */
383
601
  [data-composer-style="glass"] {
384
602
  border-radius: 1.25rem;
385
- border-color: color-mix(in srgb, var(--theme-ink) 12%, transparent);
386
- background-color: color-mix(in srgb, var(--theme-paper) 58%, transparent);
387
- background-image: linear-gradient(
388
- 180deg,
389
- color-mix(in srgb, var(--theme-ink) 5%, transparent) 0%,
390
- color-mix(in srgb, var(--theme-ink) 1.5%, transparent) 38%,
391
- transparent 100%
392
- );
393
- backdrop-filter: blur(16px) saturate(1.15);
394
- -webkit-backdrop-filter: blur(16px) saturate(1.15);
395
- box-shadow: 0 1px 0 0 color-mix(in srgb, var(--theme-ink) 6%, transparent);
603
+ /* The RIM is what makes the surface legible — the fill cannot, because the
604
+ * plane under a docked composer is within 3 points of paper. It is the CARD's
605
+ * rim (`--glass-card-edge`), not the window's: the window's 1.5px `#fff 95%`
606
+ * line is right for a 1400px frame and reads as glare across 620px. */
607
+ border-color: transparent;
608
+ background-color: var(--glass-card);
609
+ /* NOT the plane's gradient stack (`--glass-glow`): that belongs to the window,
610
+ * and a card that borrowed it would paint a second highlight inside the first.
611
+ * The reflection sits ABOVE the transmitted light, as it does on real glass. */
612
+ background-image: var(--glass-sheen), var(--glass-bloom);
613
+ backdrop-filter: var(--glass-card-filter);
614
+ -webkit-backdrop-filter: var(--glass-card-filter);
615
+ box-shadow: var(--glass-card-edge), var(--glass-shadow);
396
616
  }
397
617
  [data-composer-style="glass"] .composer-attach-row {
398
618
  padding-bottom: 0.25rem;
@@ -757,6 +977,39 @@ html[data-theme-variant="dark"] .shiki span { color: var(--shiki-dark); }
757
977
  will-change: transform;
758
978
  }
759
979
 
980
+ /* The header wordmark's halo (`common/brand-wordmark`, `glow`).
981
+ *
982
+ * Why it exists: the lockup ends in `text-ink` and starts in a warm gradient,
983
+ * and on a dark palette both sit on a near-black bar — the word is legible but
984
+ * flat, which is the state a title should not be in. The halo is what gives it
985
+ * a light source.
986
+ *
987
+ * Two `drop-shadow`s, not `text-shadow`: the first run is an SVG (the K's
988
+ * plate) and the second is gradient-clipped text, so a glyph shadow would paint
989
+ * under neither. `drop-shadow` follows the rendered alpha of all three runs.
990
+ *
991
+ * WHITE at 10%, and that is a decision with a measurement behind it. The halo
992
+ * started as `--color-brand` and was rejected twice — at 40%/22% it was
993
+ * invisible (the ring 1–8px outside the lockup moved +3 in mean red), and at
994
+ * full strength it tinted the whole bar and read as a lamp, not as light (that
995
+ * ring moved +41 in warm bias). The chroma was the problem: the lockup's own
996
+ * ink is near-white, so an orange halo is a second colour fighting the first.
997
+ * White at the same radius is the letters' own light — the warm bias does not
998
+ * move at all (−10.7 against the bare header's −10.8) while luminance rises
999
+ * +3.0 in the 1–8px ring and +0.7 in the 8–22px one, and the profile falls off
1000
+ * over ~25px. Alphas stay at 10% on BOTH layers: raising one is what made the
1001
+ * earlier attempts either invisible or heavy, and the visible edge of a halo is
1002
+ * its radius, not its opacity.
1003
+ *
1004
+ * DARK VARIANTS ONLY: on paper a white glow is a no-op at best, and the light
1005
+ * palettes never had the problem this fixes. Values are in `em` so the halo
1006
+ * scales with the size the caller sets. */
1007
+ html[data-theme-variant='dark'] .brand-wordmark-glow {
1008
+ filter:
1009
+ drop-shadow(0 0 0.35em rgb(255 255 255 / 10%))
1010
+ drop-shadow(0 0 0.9em rgb(255 255 255 / 10%));
1011
+ }
1012
+
760
1013
  /* PWA Window Controls Overlay and Native Titlebar Styling */
761
1014
  .titlebar-drag-region {
762
1015
  -webkit-app-region: drag;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The `<html>` attributes of the served shell, written in one place.
8
+ *
9
+ * `index.html` is a static template that every request rewrites, and the
10
+ * attributes it carries are the FIRST FRAME's whole appearance: the palette, the
11
+ * surface material and the brand-mark paint. A second replacement pass for the
12
+ * two new attributes was one `String.replace` away from silently missing — a
13
+ * missing attribute is not an error, it is the default look — so all four are
14
+ * stated together, in a function a test can call without rendering the shell.
15
+ *
16
+ * Two properties are load-bearing:
17
+ *
18
+ * - **`data-theme` and `data-theme-variant` are ALWAYS written.** They are the
19
+ * palette; `applyDocumentTheme` owns them after hydration, and a document
20
+ * served without them keeps `:root`'s shipped palette.
21
+ * - **The two style attributes are written only when they are not the default.**
22
+ * `applySurfaceStyle` / `applyIconStyle` remove the attribute for the default,
23
+ * so emitting `data-surface="classic"` here would make the server and the
24
+ * client disagree about the document's own state — and every CSS rule keys on
25
+ * the value, not on its absence.
26
+ */
27
+
28
+ import type { ThemePalette } from '@/shared/types/theme';
29
+ import {
30
+ DEFAULT_ICON_STYLE,
31
+ ICON_STYLE_ATTRIBUTE,
32
+ resolveIconStyle,
33
+ } from '@/shared/lib/theme/icon-style';
34
+ import {
35
+ DEFAULT_SURFACE_STYLE,
36
+ SURFACE_ATTRIBUTE,
37
+ resolveSurfaceStyle,
38
+ } from '@/shared/lib/theme/surface-style';
39
+
40
+ export interface ShellDocumentFacts {
41
+ palette: ThemePalette;
42
+ /** The stored surface style, unresolved — any value this build cannot draw
43
+ * falls to the default rather than to an attribute no rule matches. */
44
+ surfaceStyle: unknown;
45
+ iconStyle: unknown;
46
+ /** The `<meta name="theme-color">` value for this request. */
47
+ chromeColor: string;
48
+ }
49
+
50
+ /** The template's own values, which the replacements below look for. */
51
+ const TEMPLATE_THEME = 'data-theme="paper"';
52
+ const TEMPLATE_VARIANT = 'data-theme-variant="light"';
53
+ const TEMPLATE_META = '<meta name="theme-color" content="#faf8f3" />';
54
+
55
+ /** The extra `<html>` attributes for the stored presentation styles. */
56
+ export function styleAttributes(surfaceStyle: unknown, iconStyle: unknown): string {
57
+ const surface = resolveSurfaceStyle(surfaceStyle);
58
+ const icon = resolveIconStyle(iconStyle);
59
+ const parts: string[] = [];
60
+ if (surface !== DEFAULT_SURFACE_STYLE) parts.push(`${SURFACE_ATTRIBUTE}="${surface}"`);
61
+ if (icon !== DEFAULT_ICON_STYLE) parts.push(`${ICON_STYLE_ATTRIBUTE}="${icon}"`);
62
+ return parts.length > 0 ? ` ${parts.join(' ')}` : '';
63
+ }
64
+
65
+ /**
66
+ * Rewrite the template's palette and chrome placeholders for one request.
67
+ *
68
+ * Returns the html unchanged for a document that predates the markers — the
69
+ * client's `initDocumentTheme` / `initSurfaceStyle` repair that case, which is
70
+ * why this does not throw: a stale template must still serve a page.
71
+ */
72
+ export function applyShellDocumentFacts(html: string, facts: ShellDocumentFacts): string {
73
+ return html
74
+ .replace(
75
+ TEMPLATE_THEME,
76
+ `data-theme="${facts.palette.id}"${styleAttributes(facts.surfaceStyle, facts.iconStyle)}`,
77
+ )
78
+ .replace(TEMPLATE_VARIANT, `data-theme-variant="${facts.palette.variant}"`)
79
+ .replace(TEMPLATE_META, `<meta name="theme-color" content="${facts.chromeColor}" />`);
80
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The first frame's `<html>` attributes.
8
+ *
9
+ * The rule worth pinning is the ASYMMETRY: the palette is always written, and
10
+ * the two presentation styles are written only when they are not the default —
11
+ * because the client's writers REMOVE the attribute for the default, and a
12
+ * server that emitted `data-surface="classic"` would leave a document the
13
+ * client thinks is "explicitly classic" and a reload flipping between two
14
+ * spellings of the same state.
15
+ */
16
+
17
+ import { describe, expect, test } from 'bun:test';
18
+ import {
19
+ applyShellDocumentFacts,
20
+ styleAttributes,
21
+ } from '@/server/lib/assets/shell-attributes.server';
22
+ import { KABMO_PALETTES } from '@/shared/lib/theme/palettes/kabmo';
23
+
24
+ const TEMPLATE = `<html lang="en" data-theme="paper" data-theme-variant="light">
25
+ <head>
26
+ <meta name="theme-color" content="#faf8f3" />
27
+ </head>
28
+ </html>`;
29
+
30
+ const dark = KABMO_PALETTES[0];
31
+
32
+ describe('styleAttributes', () => {
33
+ test('the defaults add nothing at all', () => {
34
+ expect(styleAttributes('classic', 'monochrome')).toBe('');
35
+ expect(styleAttributes(undefined, undefined)).toBe('');
36
+ expect(styleAttributes('nonsense', 'nonsense')).toBe('');
37
+ });
38
+
39
+ test('each non-default style contributes its own attribute', () => {
40
+ expect(styleAttributes('glass', 'monochrome')).toBe(' data-surface="glass"');
41
+ expect(styleAttributes('classic', 'color')).toBe(' data-icon-style="color"');
42
+ expect(styleAttributes('glass', 'color')).toBe(' data-surface="glass" data-icon-style="color"');
43
+ });
44
+ });
45
+
46
+ describe('applyShellDocumentFacts', () => {
47
+ test('writes the palette and the chrome colour, and nothing else by default', () => {
48
+ const html = applyShellDocumentFacts(TEMPLATE, {
49
+ palette: dark,
50
+ surfaceStyle: undefined,
51
+ iconStyle: undefined,
52
+ chromeColor: '#123456',
53
+ });
54
+
55
+ expect(html).toContain(`<html lang="en" data-theme="${dark.id}" data-theme-variant="${dark.variant}">`);
56
+ expect(html).toContain('<meta name="theme-color" content="#123456" />');
57
+ expect(html).not.toContain('data-surface');
58
+ expect(html).not.toContain('data-icon-style');
59
+ });
60
+
61
+ test('a stored glass style lands on the FIRST frame, not after hydration', () => {
62
+ const html = applyShellDocumentFacts(TEMPLATE, {
63
+ palette: dark,
64
+ surfaceStyle: 'glass',
65
+ iconStyle: 'color',
66
+ chromeColor: '#123456',
67
+ });
68
+
69
+ expect(html).toContain(
70
+ `<html lang="en" data-theme="${dark.id}" data-surface="glass" data-icon-style="color" data-theme-variant="${dark.variant}">`,
71
+ );
72
+ });
73
+
74
+ test('a document without the template markers is returned untouched, not thrown', () => {
75
+ const stale = '<html><head></head><body>an older build</body></html>';
76
+
77
+ expect(
78
+ applyShellDocumentFacts(stale, {
79
+ palette: dark,
80
+ surfaceStyle: 'glass',
81
+ iconStyle: 'color',
82
+ chromeColor: '#123456',
83
+ }),
84
+ ).toBe(stale);
85
+ });
86
+ });
@@ -44,6 +44,11 @@ describe('the tls flag', () => {
44
44
  });
45
45
 
46
46
  describe('ensureTlsCertificate', () => {
47
+ // A GENEROUS budget, because this spawns a real `openssl req -newkey rsa:2048`
48
+ // and the runner is not the machine this was written on: 63 ms here, and on
49
+ // the Windows gate it outran Bun's 5 s default and reported `ok: false` for a
50
+ // certificate that was being generated correctly. The work is unchanged; only
51
+ // the window it has to finish in is honest about RSA keygen on a slow host.
47
52
  test('generates a usable pair on first call', () => {
48
53
  const result = ensureTlsCertificate();
49
54
 
@@ -62,7 +67,7 @@ describe('ensureTlsCertificate', () => {
62
67
  // mismatch on top of the self-signed warning.
63
68
  expect(san).toContain('DNS:localhost');
64
69
  expect(san).toContain('IP Address:127.0.0.1');
65
- });
70
+ }, 60_000);
66
71
 
67
72
  test('reuses an existing pair rather than regenerating it', () => {
68
73
  const first = ensureTlsCertificate();
@@ -29,6 +29,7 @@ export function makeHost(overrides: Partial<SessionFrameHost> = {}): SessionFram
29
29
  promptRunning: false,
30
30
  streaming: false,
31
31
  compacting: false,
32
+ runAborted: false,
32
33
  awaitingAgentStart: false,
33
34
  awaitingAgentStartDeadline: 0,
34
35
  continuationGraceUntil: 0,
@@ -25,37 +25,9 @@
25
25
 
26
26
  import { describe, expect, test } from 'bun:test';
27
27
 
28
- import { foldSessionFrame, type SessionFrameHost } from '@/server/lib/omp/rpc/frame-fold';
28
+ import { foldSessionFrame } from '@/server/lib/omp/rpc/frame-fold';
29
+ import { makeHost } from '@/server/lib/omp/rpc/frame-fold-host.test-util';
29
30
  import { onRealtimeSignal } from '@/server/lib/realtime/signals.server';
30
- import { ModeMirror } from '@/server/lib/omp/rpc/mode-mirror';
31
-
32
- /** The same minimal host the sibling suite uses. */
33
- function makeHost(overrides: Partial<SessionFrameHost> = {}): SessionFrameHost {
34
- return {
35
- sessionId: '',
36
- autoTitleWindowUntil: 0,
37
- autoTitleClaims: 0,
38
- autoTitleDispatch: null,
39
- autoTitlePending: true,
40
- autoTitleRequested: false,
41
- promptRunning: false,
42
- streaming: false,
43
- compacting: false,
44
- awaitingAgentStart: false,
45
- awaitingAgentStartDeadline: 0,
46
- continuationGraceUntil: 0,
47
- proc: { sendCommand: async () => undefined as never },
48
- emit() {},
49
- trackUiDialog() {},
50
- observeSubagent() {},
51
- syncRunModel() {},
52
- modeMirror: new ModeMirror(),
53
- isAlive: () => true,
54
- isBusy: () => false,
55
- send: async () => undefined,
56
- ...overrides,
57
- };
58
- }
59
31
 
60
32
  /**
61
33
  * The `tool_execution_end` frame is what moves a running session's sidebar row
@@ -119,6 +119,61 @@ describe('auto-title trigger wiring', () => {
119
119
  });
120
120
  });
121
121
 
122
+ describe('the abort verdict survives agent_end compaction', () => {
123
+ test('an aborted assistant message is remembered before agent_end trims it', () => {
124
+ // omp drops the messages it already delivered via `message_end` when the
125
+ // terminal frame is oversized, and the aborted assistant message is one of
126
+ // them — so reading the verdict from `agent_end.messages` alone reports a
127
+ // stopped run as finished. Measured on 18.16.0: `message_end`
128
+ // (role=assistant, stopReason=aborted) arrives BEFORE `agent_end`.
129
+ const host = makeHost();
130
+ fold(host, { type: 'agent_start' });
131
+ fold(host, { type: 'message_end', message: { role: 'user', content: 'go' } });
132
+ fold(host, { type: 'message_end', message: { role: 'assistant', stopReason: 'aborted' } });
133
+
134
+ expect(host.runAborted).toBe(true);
135
+
136
+ // The compacted terminal frame: everything streamed, nothing left to carry
137
+ // the stopReason.
138
+ fold(host, { type: 'agent_end', isTerminal: true, messages: [], messageCount: 2 });
139
+
140
+ // A stopped turn is not a settle, so the title latch must survive.
141
+ expect(host.autoTitlePending).toBe(true);
142
+ });
143
+
144
+ test('a natural stop is not remembered as an abort', () => {
145
+ const host = makeHost();
146
+ fold(host, { type: 'agent_start' });
147
+ fold(host, { type: 'message_end', message: { role: 'assistant', stopReason: 'stop' } });
148
+
149
+ expect(host.runAborted).toBe(false);
150
+ fold(host, { type: 'agent_end', isTerminal: true, messages: [] });
151
+ expect(host.autoTitlePending).toBe(false);
152
+ });
153
+
154
+ test('a new run starts un-aborted', () => {
155
+ const host = makeHost();
156
+ fold(host, { type: 'agent_start' });
157
+ fold(host, { type: 'message_end', message: { role: 'assistant', stopReason: 'aborted' } });
158
+ expect(host.runAborted).toBe(true);
159
+
160
+ fold(host, { type: 'agent_start' });
161
+ expect(host.runAborted).toBe(false);
162
+ });
163
+
164
+ test('the frame is still read for a host that attached mid-run', () => {
165
+ // A synthetic terminal frame (`run-settle.server.ts`) carries no
166
+ // `message_end` history, so the array remains the fallback source.
167
+ const host = makeHost();
168
+ fold(host, {
169
+ type: 'agent_end',
170
+ isTerminal: true,
171
+ messages: [{ role: 'assistant', stopReason: 'aborted' }],
172
+ });
173
+ expect(host.autoTitlePending).toBe(true);
174
+ });
175
+ });
176
+
122
177
  /**
123
178
  * The Kabmo's own background `/rename` answers on `prompt_result` with
124
179
  * `agentInvoked:false` — auto-title fires it right after the first settled user
@@ -46,6 +46,8 @@ export interface SessionFrameHost extends AutoTitleHost, QueueDeliveryHost {
46
46
  promptRunning: boolean;
47
47
  streaming: boolean;
48
48
  compacting: boolean;
49
+ /** Abort verdict of the current run — see `endedAborted` in `terminal-settle.ts`. */
50
+ runAborted: boolean;
49
51
  awaitingAgentStart: boolean;
50
52
  awaitingAgentStartDeadline: number;
51
53
  continuationGraceUntil: number;
@@ -99,6 +101,7 @@ export interface FrameFoldResult {
99
101
  */
100
102
  function handleMessageEnd(host: SessionFrameHost, event: AgentEvent): void {
101
103
  const message = event.message as Record<string, unknown> | undefined;
104
+ if (message?.role === 'assistant' && message.stopReason === 'aborted') host.runAborted = true;
102
105
  if (message?.role === 'user') void triggerAutoSessionTitle(host, 'opening');
103
106
  else if (message?.role === 'custom' && message.customType === SKILL_PROMPT_CUSTOM_TYPE) {
104
107
  void triggerAutoSessionTitle(host, 'opening');
@@ -188,6 +191,7 @@ export function foldSessionFrame(host: SessionFrameHost, event: AgentEvent): Fra
188
191
  case 'agent_start':
189
192
  host.promptRunning = true;
190
193
  host.streaming = true;
194
+ host.runAborted = false;
191
195
  host.awaitingAgentStart = false;
192
196
  host.awaitingAgentStartDeadline = 0;
193
197
  host.continuationGraceUntil = 0;
@@ -52,8 +52,7 @@ export class AgentSessionWrapper {
52
52
  promptDispatchPendingCount = 0;
53
53
  awaitingAgentStart = false;
54
54
  awaitingAgentStartDeadline = 0;
55
- /** Watches the deadline above so a dispatch whose turn never opens cannot
56
- * strand the session (see `AgentStartWatchdog`). */
55
+ /** Watches the deadline above so a stranded dispatch is settled (`AgentStartWatchdog`). */
57
56
  private readonly agentStartWatchdog: AgentStartWatchdog;
58
57
  /** Settles a run omp no longer owns (see `run-settle.server.ts`). */
59
58
  readonly runSettle: RunSettle;
@@ -61,6 +60,7 @@ export class AgentSessionWrapper {
61
60
  bashRunning = false;
62
61
  streaming = false;
63
62
  compacting = false;
63
+ runAborted = false;
64
64
  fastModeEnabled = false;
65
65
  runModel: SessionRunModel | null = null;
66
66
  private onDestroyCallback: (() => void) | null = null;
@@ -68,3 +68,14 @@ export interface RpcProcessOptions {
68
68
  }
69
69
 
70
70
  export const STDERR_TAIL_LIMIT = 8 * 1024;
71
+
72
+ /**
73
+ * How many transport notices one child may push before the reader stops
74
+ * repeating itself.
75
+ *
76
+ * A malformed chunk sequence is recoverable (the logical frame is lost, the
77
+ * session is not), but a server stuck emitting invalid chunks would otherwise
78
+ * append a notice per line and bury the transcript. Three is enough to prove
79
+ * the fault is real; the stderr tail keeps the full account for diagnostics.
80
+ */
81
+ export const MAX_PROTOCOL_ERROR_NOTICES = 3;