@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
@@ -83,11 +83,28 @@ interface QueueItemInput {
83
83
  model?: unknown;
84
84
  }
85
85
 
86
- /** The session's queued follow-ups in delivery order. */
86
+ /**
87
+ * A claimed row plus the position it held. A failed dispatch puts the item
88
+ * back at exactly that slot: recomputing "one below the current minimum" from
89
+ * a queue two deliveries touched reorders the rest — measured as a live queue
90
+ * whose eight rows walked from positions 0..7 down to -8..-1 while a busy
91
+ * session rejected each dispatch (`agent_busy`) once per retry.
92
+ */
93
+ export interface ClaimedQueueItem extends QueuedMessage {
94
+ position: number;
95
+ }
96
+
97
+ /**
98
+ * The session's queued follow-ups in delivery order.
99
+ *
100
+ * `rowid` breaks a position tie: two rows can share a position when a reorder
101
+ * ships a list that a concurrent append was not part of, and SQLite is free to
102
+ * return equal keys in any order — which reads as the panel shuffling itself.
103
+ */
87
104
  export async function listQueue(sessionId: string): Promise<QueuedMessage[]> {
88
105
  const db = await getDb();
89
106
  const rows = (await db.all(
90
- 'SELECT * FROM queued_messages WHERE session_id = ? ORDER BY position ASC',
107
+ 'SELECT * FROM queued_messages WHERE session_id = ? ORDER BY position ASC, rowid ASC',
91
108
  [sessionId],
92
109
  )) as QueueRow[];
93
110
  return rows.map(rowToQueuedMessage);
@@ -171,18 +188,18 @@ export async function reorderQueue(sessionId: string, orderedIds: string[]): Pro
171
188
  * call and stranded the queue silently, with nudges failing the same way.
172
189
  * `getDb()` re-initializes instead, so a delivery heals the state it needs.
173
190
  */
174
- export async function claimHeadQueueItem(sessionId: string): Promise<QueuedMessage | null> {
191
+ export async function claimHeadQueueItem(sessionId: string): Promise<ClaimedQueueItem | null> {
175
192
  const db = await getDb();
176
193
  return withTransaction(db, () => {
177
194
  const row = db.raw
178
- .query('SELECT * FROM queued_messages WHERE session_id = ? ORDER BY position ASC LIMIT 1')
195
+ .query('SELECT * FROM queued_messages WHERE session_id = ? ORDER BY position ASC, rowid ASC LIMIT 1')
179
196
  .get(sessionId) as QueueRow | undefined;
180
197
  if (!row) return null;
181
198
  db.raw.run('DELETE FROM queued_messages WHERE id = ?', [row.id]);
182
199
  // The head left the queue: a panel showing it must be told, or it keeps
183
200
  // rendering an item that is already being sent.
184
201
  emitRealtimeSignal('session-data-dirty', sessionId);
185
- return rowToQueuedMessage(row);
202
+ return { ...rowToQueuedMessage(row), position: row.position };
186
203
  });
187
204
  }
188
205
 
@@ -203,16 +220,21 @@ export async function hasQueuedItem(sessionId: string): Promise<boolean> {
203
220
  }
204
221
 
205
222
  /**
206
- * Put a failed delivery back at the head (position below the current minimum)
207
- * so it is retried before anything else. The next run end or mount nudge
208
- * picks it up again.
223
+ * Put a failed delivery back where it was: the position it was claimed from,
224
+ * so it is retried before anything queued after it.
225
+ *
226
+ * The position is carried by the claim rather than recomputed. `MIN(position)
227
+ * - 1` looks equivalent and is not: with two attempts in flight the second
228
+ * claim has already removed the next row, so the first requeue lands one slot
229
+ * too low and the pair swaps. Every retry against a busy session then permutes
230
+ * the queue again.
209
231
  */
210
- export async function requeueHeadQueueItem(sessionId: string, item: QueuedMessage): Promise<void> {
232
+ export async function requeueHeadQueueItem(sessionId: string, item: ClaimedQueueItem): Promise<void> {
211
233
  const db = await getDb();
212
234
  db.raw.run(
213
235
  `INSERT INTO queued_messages (id, session_id, position, message, attachments, provider, model_id, thinking_level, access_mode)
214
- VALUES (?, ?, COALESCE((SELECT MIN(position) FROM queued_messages WHERE session_id = ?), 0) - 1, ?, ?, ?, ?, ?, ?)`,
215
- [item.id, sessionId, sessionId, item.text, serializeAttachments(item.attachments),
236
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
237
+ [item.id, sessionId, item.position, item.text, serializeAttachments(item.attachments),
216
238
  item.model?.provider ?? null, item.model?.modelId ?? null, item.model?.thinkingLevel ?? null, item.model?.accessMode ?? null],
217
239
  );
218
240
  emitRealtimeSignal('session-data-dirty', sessionId);
@@ -59,9 +59,21 @@ function join(parts: Uint8Array[]): Uint8Array {
59
59
  return out;
60
60
  }
61
61
 
62
- /** The numbered lines in `text`, in arrival order. */
62
+ /**
63
+ * The numbered lines in `text`, in arrival order.
64
+ *
65
+ * A trailing line with no newline after it is NOT counted: it is a line still
66
+ * arriving, and its prefix is a number that happens to parse. The replay is
67
+ * captured mid-flood by construction, so it routinely ends inside a line —
68
+ * measured on the Linux gate, where the replay ended after the first two bytes
69
+ * of `5136` and this helper turned that fragment into the line `51`, failing
70
+ * `gap(replayed)` with `5135 -> 51 at 5134` on a terminal that was working. The
71
+ * same rule makes the live collectors safe for the same reason: a line counts
72
+ * once the shell has finished writing it.
73
+ */
63
74
  function numbers(text: string): number[] {
64
- return text
75
+ const complete = text.endsWith('\n') ? text : text.slice(0, text.lastIndexOf('\n') + 1);
76
+ return complete
65
77
  .split('\n')
66
78
  .map((line) => line.replace(/\r$/, '').trim())
67
79
  .filter((line) => /^\d+$/.test(line))
@@ -122,11 +134,17 @@ test('a viewer attaching mid-stream sees the replay and live output exactly once
122
134
  expect(replayed.length).toBeGreaterThan(0);
123
135
  expect(gap(replayed)).toBeNull();
124
136
 
125
- // …and its live stream continues from the replay's last line: not one line
126
- // earlier (a duplicate) and not one line later (a gap).
137
+ // …and the replay plus its live stream is ONE seamless rendering: no line
138
+ // twice, none skipped. Asserted on the CONCATENATION rather than by comparing
139
+ // `secondLines[0]` to the replay's last line, because the boundary is allowed
140
+ // to land inside a line — the replay is captured mid-flood, and measured on
141
+ // the Linux gate it ended two bytes into `5135`. A per-side comparison then
142
+ // reads that fragment as its own line and reports a gap on a working
143
+ // terminal; the concatenation is what the viewer actually renders, so a
144
+ // duplicate or a hole still fails here.
145
+ const combined = numbers(dec.decode(attachment.replay) + second.text());
127
146
  expect(secondLines.length).toBeGreaterThan(0);
128
- expect(secondLines[0]).toBe((replayed.at(-1) ?? 0) + 1);
129
- expect(gap([replayed.at(-1) ?? 0, ...secondLines])).toBeNull();
130
- expect(new Set(secondLines).size).toBe(secondLines.length);
131
- expect(secondLines.at(-1)).toBe(TOTAL);
147
+ expect(gap(combined)).toBeNull();
148
+ expect(new Set(combined).size).toBe(combined.length);
149
+ expect(combined.at(-1)).toBe(TOTAL);
132
150
  }, 60_000);
@@ -21,8 +21,15 @@ import {
21
21
  } from '@/server/lib/assets/theme-shell.server';
22
22
  import { readSettingsBlob } from '@/shared/lib/settings/keys';
23
23
  import { resolveTheme } from '@/shared/lib/theme/catalog';
24
+ import { applyShellDocumentFacts } from '@/server/lib/assets/shell-attributes.server';
25
+ import { SURFACE_STYLE_SETTING_KEY } from '@/shared/lib/theme/surface-style';
26
+ import { ICON_STYLE_SETTING_KEY } from '@/shared/lib/theme/icon-style';
24
27
  import { windowChromeColor } from '@/shared/lib/theme/chrome';
25
28
  import { THEME_STYLE_ELEMENT_ID, themeStyleSheet } from '@/shared/lib/theme/css';
29
+ import {
30
+ ICON_PAINT_STYLE_ELEMENT_ID,
31
+ iconPaintStyleSheet,
32
+ } from '@/shared/lib/icons/icon-paint-css';
26
33
  import { isAndroidDevice, shellVersion } from '@/shared/lib/updates/shell-ua';
27
34
 
28
35
  /** HTML-escape a string for interpolation into the failure page's `<pre>`. */
@@ -92,6 +99,7 @@ function storedThemeId(settings: Record<string, unknown>): string | undefined {
92
99
  return typeof theme === 'string' && theme.length > 0 ? theme : undefined;
93
100
  }
94
101
 
102
+
95
103
  /**
96
104
  * The HTML shell is generated per request, so its cacheability is declared
97
105
  * rather than left to the browser's heuristics.
@@ -216,6 +224,10 @@ export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }
216
224
  // a second tag: with both present Chrome reads the first one, so an appended
217
225
  // tag would leave a dark theme painting light browser chrome.
218
226
  const themeStyle = `<style id="${THEME_STYLE_ELEMENT_ID}">${themeStyleSheet()}</style>`;
227
+ // The brand colours are generated from a TS table too, for the same reason:
228
+ // the bundler cannot carry a stylesheet derived from data, and a hand-written
229
+ // copy in `tailwind.css` would be 35 pairs that drift from the table.
230
+ const brandStyle = `<style id="${ICON_PAINT_STYLE_ELEMENT_ID}">${iconPaintStyleSheet()}</style>`;
219
231
  // The frame the browser paints BEFORE the bundle's stylesheet lands: the UA's
220
232
  // own canvas is white, and on a dark install that is a measured white flash
221
233
  // for the length of the CSS request. The palette's ground is the only correct
@@ -243,11 +255,16 @@ export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }
243
255
 
244
256
  return maybeCompress(
245
257
  new Response(
246
- shellHtml
247
- .replace('data-theme="paper"', `data-theme="${theme.id}"`)
248
- .replace('data-theme-variant="light"', `data-theme-variant="${theme.variant}"`)
249
- .replace('<meta name="theme-color" content="#faf8f3" />', `<meta name="theme-color" content="${chrome}" />`)
250
- .replace('<!--app-head-->', firstFrame + themeStyle + fontLink)
258
+ applyShellDocumentFacts(shellHtml, {
259
+ palette: theme,
260
+ // The two presentation styles are read from the same blob as the
261
+ // palette, so the FIRST frame is already the material the user chose:
262
+ // without this a glass install paints one opaque frame and swaps.
263
+ surfaceStyle: readSettingsBlob(settings)[SURFACE_STYLE_SETTING_KEY],
264
+ iconStyle: readSettingsBlob(settings)[ICON_STYLE_SETTING_KEY],
265
+ chromeColor: chrome,
266
+ })
267
+ .replace('<!--app-head-->', firstFrame + themeStyle + brandStyle + fontLink)
251
268
  .replace(SHELL_MARKER, `<script>window.__OMP_BOOTSTRAP__=${bootstrap}</script>`),
252
269
  { headers: HTML_HEADERS },
253
270
  ),
@@ -0,0 +1,238 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The install route's mutation verbs: forget, auto-update, check, update,
8
+ * update_all and force_sync.
9
+ *
10
+ * Split from `routes.test.ts` (which keeps the plugin FILE routes) because the
11
+ * two answer different questions and each now has enough cases to deserve its
12
+ * own budget: the file routes are a security boundary, while these are the
13
+ * pane's buttons.
14
+ *
15
+ * What is pinned here is what a second implementation would get wrong:
16
+ *
17
+ * - **`update` dispatches on the SOURCE.** A bundled install takes the store's
18
+ * copy; a local directory is refused by naming why nothing publishes it, and
19
+ * a missing plugin is refused too. A silent no-op would read as success.
20
+ * - **the store copy goes through the sync's EDIT GATE.** A hand-edited tree is
21
+ * refused and the differing file is named — the override stays the blocked
22
+ * notice's own button — so Update never becomes a one-click force-sync.
23
+ * - **`update_all` never aborts on one refusal.** The plugin with local changes
24
+ * is reported by name while the untouched one still updates, and the response
25
+ * is a 200 because something DID happen.
26
+ */
27
+
28
+ import { describe, expect, test } from 'bun:test';
29
+ import fs from 'node:fs';
30
+ import { join } from 'node:path';
31
+
32
+ import { action as installAction } from '@/server/routes/panels/install';
33
+ import { discoverPanelPlugins, getMarketplacePluginsDir, invalidatePanelScan } from '@/server/lib/panels/registry.server';
34
+ import { writeBaseline } from '@/server/lib/panels/baseline.server';
35
+ import { hashTrackedFiles } from '@/server/lib/panels/local-edits.server';
36
+ import { dirs, MANIFEST, post, usePanelRouteFixtures, writePlugin } from '@/server/routes/panels/panel-routes.test-util';
37
+
38
+ usePanelRouteFixtures();
39
+
40
+ describe('the install route', () => {
41
+ test('forget drops a dangling catalog entry and reports the scan without it', async () => {
42
+ // The reported state: the catalog names a directory that is not there, so
43
+ // the scan rejects it and the pane has a dead-end row.
44
+ writePlugin('other', getMarketplacePluginsDir());
45
+ fs.mkdirSync(dirs.root, { recursive: true });
46
+ fs.writeFileSync(
47
+ join(dirs.root, 'marketplace.json'),
48
+ JSON.stringify({
49
+ name: 'Kabmo',
50
+ plugins: [
51
+ { name: 'ghost', source: 'plugins/ghost' },
52
+ { name: 'other', source: 'plugins/other' },
53
+ ],
54
+ }),
55
+ );
56
+ invalidatePanelScan();
57
+ expect((await discoverPanelPlugins()).errors.map((error) => error.source)).toEqual(['plugins/ghost']);
58
+
59
+ const response = await post(installAction, { type: 'forget', source: 'plugins/ghost' });
60
+ expect(response.status).toBe(200);
61
+ const body = (await response.json()) as { ok: boolean; errors: unknown[] };
62
+ expect(body.ok).toBe(true);
63
+ // The whole payload comes back, so the pane clears the row without a second
64
+ // read that could race the write.
65
+ expect(body.errors).toEqual([]);
66
+
67
+ const catalog = JSON.parse(fs.readFileSync(join(dirs.root, 'marketplace.json'), 'utf8')) as {
68
+ name: string;
69
+ plugins: Array<{ source: string }>;
70
+ };
71
+ expect(catalog.plugins.map((entry) => entry.source)).toEqual(['plugins/other']);
72
+ expect(catalog.name).toBe('Kabmo');
73
+ });
74
+
75
+ test('forget refuses a source that is missing or escapes the marketplace', async () => {
76
+ expect((await post(installAction, { type: 'forget' })).status).toBe(400);
77
+ expect((await post(installAction, { type: 'forget', source: '../../etc' })).status).toBe(400);
78
+ });
79
+
80
+ test('forget leaves the directory alone when one is there', async () => {
81
+ // The repair for a MISSING directory must not become a delete: only the
82
+ // remove action may touch files.
83
+ const dir = writePlugin('demo', getMarketplacePluginsDir());
84
+ fs.mkdirSync(dirs.root, { recursive: true });
85
+ fs.writeFileSync(
86
+ join(dirs.root, 'marketplace.json'),
87
+ JSON.stringify({ plugins: [{ name: 'demo', source: 'plugins/demo' }] }),
88
+ );
89
+
90
+ expect((await post(installAction, { type: 'forget', source: 'plugins/demo' })).status).toBe(200);
91
+ expect(fs.existsSync(dir)).toBe(true);
92
+ // The plugin still loads — the directory is what makes it exist.
93
+ invalidatePanelScan();
94
+ expect((await discoverPanelPlugins()).plugins.map((plugin) => plugin.pluginId)).toEqual(['demo']);
95
+ });
96
+
97
+ test('set_auto_update flips the flag and answers with the payload', async () => {
98
+ const on = await post(installAction, { type: 'set_auto_update', enabled: true });
99
+ expect(on.status).toBe(200);
100
+ const body = (await on.json()) as { ok: boolean; autoUpdate: boolean };
101
+ expect(body.ok).toBe(true);
102
+ expect(body.autoUpdate).toBe(true);
103
+
104
+ const off = await post(installAction, { type: 'set_auto_update', enabled: false });
105
+ expect(((await off.json()) as { autoUpdate: boolean }).autoUpdate).toBe(false);
106
+ });
107
+
108
+ test('check_updates answers even with nothing to probe', async () => {
109
+ // The button is disabled with no git plugins, but the route must not throw
110
+ // for a stale client that asks anyway.
111
+ writePlugin('demo', getMarketplacePluginsDir());
112
+ invalidatePanelScan();
113
+
114
+ const response = await post(installAction, { type: 'check_updates' });
115
+ expect(response.status).toBe(200);
116
+ const body = (await response.json()) as { ok: boolean; gitStatus: Record<string, unknown> };
117
+ expect(body.ok).toBe(true);
118
+ expect(body.gitStatus).toEqual({});
119
+ });
120
+
121
+ test('update refuses a plugin that is not installed', async () => {
122
+ const response = await post(installAction, { type: 'update', pluginId: 'ghost' });
123
+ expect(response.status).toBe(400);
124
+ expect(((await response.json()) as { error: string }).error).toContain('No installed plugin');
125
+ });
126
+
127
+ test('update refuses a local directory by naming why nothing publishes it', async () => {
128
+ // A hand-copied plugin has no remote and the store does not ship it. The
129
+ // refusal is the answer: a silent no-op would read as a successful update.
130
+ writePlugin('demo', getMarketplacePluginsDir());
131
+ invalidatePanelScan();
132
+
133
+ const response = await post(installAction, { type: 'update', pluginId: 'demo' });
134
+ expect(response.status).toBe(400);
135
+ expect(((await response.json()) as { error: string }).error).toContain('local directory');
136
+ });
137
+
138
+ test('update requires a plugin id', async () => {
139
+ expect((await post(installAction, { type: 'update' })).status).toBe(400);
140
+ });
141
+
142
+ test('update applies the store copy of a BUNDLED install', async () => {
143
+ // The button a bundled card renders: the store ships 1.1.0 while the install
144
+ // sits at 1.0.0, and the whole payload comes back with the new version.
145
+ writePlugin('demo', getMarketplacePluginsDir());
146
+ writePlugin('demo', join(dirs.bundled, 'plugins'), { ...MANIFEST, version: '1.1.0' });
147
+ invalidatePanelScan();
148
+
149
+ const response = await post(installAction, { type: 'update', pluginId: 'demo' });
150
+ expect(response.status).toBe(200);
151
+ const body = (await response.json()) as {
152
+ ok: boolean;
153
+ updated: boolean;
154
+ plugins: Array<{ pluginId: string; version: string }>;
155
+ };
156
+ expect(body.ok).toBe(true);
157
+ expect(body.updated).toBe(true);
158
+ const installed = body.plugins.find((plugin) => plugin.pluginId === 'demo');
159
+ expect(installed?.version).toBe('1.1.0');
160
+
161
+ const manifest = JSON.parse(
162
+ fs.readFileSync(join(getMarketplacePluginsDir(), 'demo', 'kabmo.json'), 'utf8'),
163
+ ) as { version: string };
164
+ expect(manifest.version).toBe('1.1.0');
165
+ });
166
+
167
+ test('update refuses a bundled install whose files the user edited', async () => {
168
+ // The edit gate is the sync's, not the button's: an update must not become
169
+ // the force-sync escape hatch by being reachable in one click. The baseline
170
+ // is what PROVES Kabmo wrote the directory, so it is written here — an
171
+ // install with no baseline predates the gate and is meant to run.
172
+ writePlugin('demo', getMarketplacePluginsDir());
173
+ writePlugin('demo', join(dirs.bundled, 'plugins'), { ...MANIFEST, version: '1.1.0' });
174
+ await writeBaseline('demo', await hashTrackedFiles(join(getMarketplacePluginsDir(), 'demo')));
175
+ fs.writeFileSync(join(getMarketplacePluginsDir(), 'demo', 'README.md'), '# edited by hand');
176
+ invalidatePanelScan();
177
+
178
+ const response = await post(installAction, { type: 'update', pluginId: 'demo' });
179
+ expect(response.status).toBe(400);
180
+ const body = (await response.json()) as { error: string; syncBlocked: Record<string, unknown> };
181
+ expect(body.error).toContain('local changes');
182
+ expect(Object.keys(body.syncBlocked)).toEqual(['demo']);
183
+ // Nothing was replaced: the user's file still says what they wrote.
184
+ expect(fs.readFileSync(join(getMarketplacePluginsDir(), 'demo', 'README.md'), 'utf8')).toBe('# edited by hand');
185
+ });
186
+
187
+ test('update_all answers even when nothing is installed', async () => {
188
+ const response = await post(installAction, { type: 'update_all' });
189
+ expect(response.status).toBe(200);
190
+ expect(((await response.json()) as { ok: boolean }).ok).toBe(true);
191
+ });
192
+
193
+ test('update_all updates the store copy and reports a refused plugin', async () => {
194
+ // One pass over every installed plugin: the plugin with an edited file is
195
+ // refused BY NAME while the untouched one still updates — a refusal must
196
+ // never abort the others.
197
+ writePlugin('demo', getMarketplacePluginsDir());
198
+ writePlugin('demo', join(dirs.bundled, 'plugins'), { ...MANIFEST, version: '1.1.0' });
199
+ writePlugin('other', getMarketplacePluginsDir(), { ...MANIFEST, id: 'other', name: 'Other' });
200
+ writePlugin('other', join(dirs.bundled, 'plugins'), { ...MANIFEST, id: 'other', name: 'Other', version: '1.1.0' });
201
+ await writeBaseline('other', await hashTrackedFiles(join(getMarketplacePluginsDir(), 'other')));
202
+ fs.writeFileSync(join(getMarketplacePluginsDir(), 'other', 'README.md'), '# edited by hand');
203
+ invalidatePanelScan();
204
+
205
+ const response = await post(installAction, { type: 'update_all' });
206
+ expect(response.status).toBe(200);
207
+ const body = (await response.json()) as {
208
+ ok: boolean;
209
+ error?: string;
210
+ plugins: Array<{ pluginId: string; version: string }>;
211
+ };
212
+ expect(body.ok).toBe(true);
213
+ expect(body.plugins.find((plugin) => plugin.pluginId === 'demo')?.version).toBe('1.1.0');
214
+ expect(body.plugins.find((plugin) => plugin.pluginId === 'other')?.version).toBe('1.0.0');
215
+ expect(body.error).toContain('other');
216
+ });
217
+
218
+ test('force_sync refuses a plugin that is not a bundled install', async () => {
219
+ writePlugin('demo', getMarketplacePluginsDir());
220
+ invalidatePanelScan();
221
+
222
+ const response = await post(installAction, { type: 'force_sync', pluginId: 'demo' });
223
+ expect(response.status).toBe(400);
224
+ expect(((await response.json()) as { error: string }).error).toContain('No bundled plugin');
225
+ });
226
+
227
+ test('force_sync requires a plugin id', async () => {
228
+ expect((await post(installAction, { type: 'force_sync' })).status).toBe(400);
229
+ });
230
+
231
+ test('the payload carries an empty syncBlocked by default', async () => {
232
+ writePlugin('demo', getMarketplacePluginsDir());
233
+ invalidatePanelScan();
234
+ // The field is always present, so the pane's notice has one shape to read
235
+ // rather than two (absent versus empty).
236
+ expect((await discoverPanelPlugins()).syncBlocked).toEqual({});
237
+ });
238
+ });
@@ -19,53 +19,27 @@
19
19
  *
20
20
  * `enable`/`disable` only flip a flag: the plugin's files stay on disk, which is
21
21
  * what makes disabling reversible and different from `remove`.
22
+ *
23
+ * `update` and `update_all` are the pane's Update buttons. Both go through
24
+ * `update.server.ts`, which dispatches on the install's SOURCE — a git clone is
25
+ * fetched and reset to its remote, a bundled install takes the store's copy
26
+ * under the sync's own edit gate — so one button means one thing to the reader
27
+ * whatever the plugin's origin.
22
28
  */
23
29
 
24
30
  import { json, type ActionFunctionArgs } from '@/server/lib/remix-compat';
25
31
  import { methodNotAllowed } from '@/server/lib/route-adapter';
26
32
  import { discoverPanelPlugins, invalidatePanelScan } from '@/server/lib/panels/registry.server';
27
33
  import { installPanelPluginFromBundled, installPanelPluginFromGit, removePanelPlugin } from '@/server/lib/panels/install.server';
28
- import { probeGitUpdate, updateGitPlugin } from '@/server/lib/panels/git-update.server';
34
+ import { probeGitUpdate } from '@/server/lib/panels/git-update.server';
35
+ import { updateAllPanelPlugins, updatePanelPlugin } from '@/server/lib/panels/update.server';
29
36
  import { forceSyncBundledPlugin } from '@/server/lib/panels/sync.server';
30
37
  import { writeGitStatus } from '@/server/lib/panels/git-status.server';
31
38
  import { forgetCatalogEntry } from '@/server/lib/panels/catalog.server';
32
39
  import { setPluginAutoUpdate, setPluginEnabled } from '@/server/lib/panels/state.server';
33
- import { disposePlugin, loadPluginServer, notePluginLoadFailure } from '@/server/lib/plugins/loader.server';
40
+ import { syncPluginServer } from '@/server/lib/plugins/server-half.server';
34
41
  import { emitRealtimeSignal } from '@/server/lib/realtime/signals.server';
35
42
 
36
- /**
37
- * Bring a plugin's SERVER half in line with its on-disk state, now.
38
- *
39
- * The server half is otherwise loaded once at boot (`loadPluginServers` in the
40
- * entry), so installing or switching a plugin on used to leave its routes, RPC
41
- * methods and realtime topic unregistered until the process restarted — a panel
42
- * that installed cleanly and then answered "no plugin is loaded", or a Stats
43
- * panel stuck on "No sample yet." with nothing on screen to explain it.
44
- *
45
- * Never throws: a plugin whose server half cannot load is a plugin whose PANEL
46
- * still works, and the failure is recorded through `notePluginLoadFailure` —
47
- * the same list `GET /api/plugins/state` serves to the pane — so the reader
48
- * sees WHY. Folding it into a 400 here would hide a successful install behind
49
- * an unrelated fault.
50
- */
51
- async function syncPluginServer(pluginId: string, enabled: boolean): Promise<void> {
52
- try {
53
- if (enabled) {
54
- await loadPluginServer(pluginId);
55
- // A later success clears an earlier failure, or the pane would keep
56
- // reporting a fault the user has already fixed.
57
- notePluginLoadFailure(pluginId, null);
58
- return;
59
- }
60
- await disposePlugin(pluginId);
61
- notePluginLoadFailure(pluginId, null);
62
- } catch (error) {
63
- const reason = error instanceof Error ? error.message : String(error);
64
- notePluginLoadFailure(pluginId, reason);
65
- console.error(`[plugins] ${pluginId}: server half ${enabled ? 'load' : 'unload'} failed — ${reason}`);
66
- }
67
- }
68
-
69
43
  export async function action({ request }: ActionFunctionArgs) {
70
44
  if (request.method !== 'POST') return methodNotAllowed({ request, params: {} });
71
45
 
@@ -152,45 +126,43 @@ export async function action({ request }: ActionFunctionArgs) {
152
126
  return json({ ok: true, ...(await discoverPanelPlugins()) });
153
127
  }
154
128
 
155
- if (type === 'update_git') {
129
+ if (type === 'update') {
156
130
  const pluginId = typeof body.pluginId === 'string' ? body.pluginId.trim() : '';
157
131
  if (!pluginId) return json({ error: 'A plugin id is required.' }, { status: 400 });
158
132
 
159
- // Unload BEFORE the files move, for the same reason a removal does: the
160
- // module is already imported and its registrations are live, so a server
161
- // half that kept running would answer from code the directory no longer
162
- // holds. Reloaded below, after the update.
163
- await syncPluginServer(pluginId, false);
164
- const result = await updateGitPlugin(pluginId);
165
- if (!result.ok) {
166
- // The plugin is still installed and still on its previous commit — the
167
- // refusal is about what an update WOULD do. Its server half goes back up
168
- // either way, or a failed update would leave a working plugin inert.
169
- await syncPluginServer(pluginId, true);
170
- return json({ error: result.error, ...(await discoverPanelPlugins()) }, { status: 400 });
171
- }
172
- await syncPluginServer(pluginId, true);
173
- // The freshness this update just achieved is written rather than probed
174
- // again: the commit is known, and a second round trip could only disagree
175
- // with the reset that already happened.
176
- writeGitStatus(pluginId, {
177
- current: result.commit ?? null,
178
- latest: result.commit ?? null,
179
- updateAvailable: false,
180
- checkedAt: Date.now(),
181
- });
182
- // The statuses and the rebuilt bundle both travel on the scan payload, and
183
- // the server-half reload above may have scanned in between — so the cache is
184
- // dropped once more here, right before the read that answers the caller, and
185
- // the topic is republished for the same reason `check_updates` does it: a
186
- // stale topic snapshot wins over the response on the client.
133
+ // One button for both sources: a git clone is fetched and reset, a bundled
134
+ // install takes the store's copy under the sync's own edit gate. The
135
+ // unload/reload around the files and the freshness write live in
136
+ // `updatePanelPlugin`, so this branch only translates the outcome.
137
+ const result = await updatePanelPlugin(pluginId);
138
+ // The scan holds what either update moved — files, versions, the refusal
139
+ // record — and a stale topic snapshot WINS over the response on the client,
140
+ // so the topic is republished rather than only answered.
187
141
  invalidatePanelScan();
188
142
  emitRealtimeSignal('panels-changed');
189
143
  const payload = await discoverPanelPlugins();
144
+ if (result.error) return json({ error: result.error, ...payload }, { status: 400 });
190
145
  if (result.warning) return json({ ok: true, error: result.warning, ...payload });
191
146
  return json({ ok: true, updated: result.updated, ...payload });
192
147
  }
193
148
 
149
+ if (type === 'update_all') {
150
+ const result = await updateAllPanelPlugins();
151
+ invalidatePanelScan();
152
+ emitRealtimeSignal('panels-changed');
153
+ const payload = await discoverPanelPlugins();
154
+ // A refusal is answered 200 where the pass ALSO updated something: one
155
+ // plugin with local edits must not hide the others' success. The reasons
156
+ // travel in `error` (the pane's warning banner) and, for a blocked bundled
157
+ // copy, in `syncBlocked` beside it.
158
+ const notes = [
159
+ ...result.refused.map((entry) => entry.error),
160
+ ...result.warnings.map((entry) => `${entry.pluginId}: ${entry.warning}`),
161
+ ];
162
+ if (notes.length > 0) return json({ ok: true, error: notes.join(' · '), ...payload });
163
+ return json({ ok: true, ...payload });
164
+ }
165
+
194
166
  if (type === 'force_sync') {
195
167
  // The escape hatch for a blocked bundled sync: the user has seen which files
196
168
  // differ and asked for the store's copy anyway. Answered with the whole
@@ -101,7 +101,10 @@ export { getMarketplacePluginsDir };
101
101
  * - the loaded plugins are DISPOSED, because the loader's registry is
102
102
  * process-wide and a plugin from one test would still answer in the next;
103
103
  * - the load-failure list is cleared, because it is global too and a leftover
104
- * entry makes a later "no errors" assertion pass or fail for the wrong reason.
104
+ * entry makes a later "no errors" assertion pass or fail for the wrong reason;
105
+ * - the freshness cache is cleared, because it is a `globalThis` map that any
106
+ * other suite's git probe writes to — a leftover status made this suite's
107
+ * "nothing to probe" assertion read a plugin it never installed.
105
108
  */
106
109
  export function usePanelRouteFixtures(): void {
107
110
  beforeEach(async () => {
@@ -110,12 +113,14 @@ export function usePanelRouteFixtures(): void {
110
113
  process.env.KABMO_MARKETPLACE_DIR = dirs.root;
111
114
  process.env.KABMO_BUNDLED_MARKETPLACE_DIR = dirs.bundled;
112
115
  await isolateDb();
116
+ globalThis.__kabmoPanelGitStatus?.clear();
113
117
  invalidatePanelScan();
114
118
  });
115
119
 
116
120
  afterEach(async () => {
117
121
  await disposeAllPlugins();
118
122
  globalThis.__kabmoPluginLoadErrors = undefined;
123
+ globalThis.__kabmoPanelGitStatus?.clear();
119
124
  await releaseDb();
120
125
  delete process.env.KABMO_MARKETPLACE_DIR;
121
126
  delete process.env.KABMO_BUNDLED_MARKETPLACE_DIR;