This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

perf: summary mode for getIslands, lazy vertexMeta on detail view

Explore page fetches ?summary=true — skips vertexMeta (244KB saved)
and trims edges to source/target/connectionType. Full data loads
on demand when viewing an island detail. Also skips contrail init
in summary mode for faster cold starts.

523KB → 216KB, 1.2s → 230ms cold, 90ms warm.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>

author
nandi
co-author
Letta Code
date (May 14, 2026, 3:49 AM UTC) commit b7bce104 parent 244c0c83
+28 -6
+17 -2
src/frontend/app.ts
··· 549 549 const content = document.getElementById("page-content"); 550 550 if (!content) return; 551 551 552 - const island = islands.find(i => i.id === islandId); 552 + let island = islands.find(i => i.id === islandId); 553 553 if (!island) { 554 554 content.innerHTML = '<div class="empty">Island not found.</div>'; 555 555 return; 556 + } 557 + 558 + // If vertexMeta is missing (summary mode), fetch full data 559 + if (!island.vertexMeta || Object.keys(island.vertexMeta).length === 0) { 560 + try { 561 + const data = await apiGet<{ islands: Island[] }>("/xrpc/org.latha.strata.getIslands?limit=50"); 562 + const full = data.islands?.find(i => i.id === islandId); 563 + if (full) { 564 + island = full; 565 + // Update cached island too 566 + const idx = islands.findIndex(i => i.id === islandId); 567 + if (idx >= 0) islands[idx] = full; 568 + } 569 + } catch {} 556 570 } 557 571 558 572 const edgeList = island.edges!.map(e => { ··· 858 872 currentPage = "explore"; 859 873 860 874 // Try API first, fall back to server-rendered data 875 + // Use summary mode — skip vertexMeta (saves ~250KB) 861 876 try { 862 - const data = await apiGet<{ islands: Island[] }>("/xrpc/org.latha.strata.getIslands"); 877 + const data = await apiGet<{ islands: Island[] }>("/xrpc/org.latha.strata.getIslands?summary=true"); 863 878 islands = data.islands || []; 864 879 } catch { 865 880 const serverData = (window as any).__ISLANDS__;
+11 -4
src/worker.ts
··· 410 410 411 411 app.get("/xrpc/org.latha.strata.getIslands", async (c) => { 412 412 const limit = Math.min(parseInt(c.req.query("limit") || "50"), 100); 413 - await ensureContrailReady(db); 413 + const summary = c.req.query("summary") === "true"; 414 + if (!summary) await ensureContrailReady(db); 414 415 415 416 const rows = await db 416 417 .prepare("SELECT uri, record FROM records_strata ORDER BY time_us DESC LIMIT ?") ··· 441 442 } 442 443 443 444 const vertices = [...vertexSet].sort(); 444 - const vertexMeta = Object.fromEntries(await resolveVertexMeta(db, vertices)); 445 + const analysis = rec.analysis || {}; 445 446 446 - const analysis = rec.analysis || {}; 447 + // Summary mode: minimal payload for explore page canvas 448 + // Skip vertexMeta (122KB) and trim edges to just source/target 449 + const vertexMeta = summary ? {} : Object.fromEntries(await resolveVertexMeta(db, vertices)); 450 + const trimmedEdges = summary 451 + ? edges.map(e => ({ source: e.source, target: e.target, connectionType: e.connectionType })) 452 + : edges; 453 + 447 454 islands.push({ 448 - id, lexmin, vertices, edges, vertexMeta, 455 + id, lexmin, vertices, edges: trimmedEdges, vertexMeta, 449 456 title: analysis.title || null, 450 457 strata: analysis.synthesis ? { 451 458 prose: analysis.synthesis || "", title: analysis.title || "",