Finish the mobile performance pass

- Cache the model catalog once per user and each conversation's setting
  separately; clear both on logout and after model saves
- Compress hashed assets asynchronously with a byte budget and set Vary
- Memoize message parsing and throttle selection reads
- Debounce draft writes to localStorage
- Keep the composer editor on the page and focused, as before
- Add a bundle budget check and run it in CI
- Show a loading block while sessions load and a workspace avatar in the
  mobile conversation header
This commit is contained in:
2026-10-20 14:37:11 +01:00
parent c1a94fc9a5
commit 4f7e0a6bf0
38 changed files with 1320 additions and 334 deletions
@@ -0,0 +1,17 @@
import fetchApi from "@moduletrace/twui/utils/fetch/fetchApi";
import type { APIResponseObject } from "@moduletrace/bunext/types";
import type { HarnessCatalogPayload } from "@/src/types";
/**
* The install-wide models catalog, shared by every conversation's models
* modal and cached once per user.
*/
export default async function fetchHarnessCatalog() {
return await fetchApi<
Record<string, never>,
APIResponseObject<HarnessCatalogPayload>
>(`/api/admin/harness/catalog`, {
method: "POST",
body: {},
});
}
@@ -1,16 +1,16 @@
import fetchApi from "@moduletrace/twui/utils/fetch/fetchApi";
import type { APIResponseObject } from "@moduletrace/bunext/types";
import type { BotConversationRequest } from "@/src/schemas/bot-schema";
import type { BotHarnessOverviewPayload } from "@/src/types";
import type { BotHarnessSettingsPayload } from "@/src/types";
/**
* What a conversation's models modal edits: per harness, the setting, the
* models it can pick and what it runs on now.
* What a conversation's models form edits, without the install-wide
* catalog: the setting, what runs now, and what the default runs on.
*/
export default async function fetchHarnessOverview({ bot_id, workspace_id }: BotConversationRequest) {
return await fetchApi<
BotConversationRequest,
APIResponseObject<BotHarnessOverviewPayload>
APIResponseObject<BotHarnessSettingsPayload>
>(`/api/admin/bots/harness-overview`, {
method: "POST",
body: { bot_id, workspace_id },