@cryptiklemur/lattice 1.46.5 → 1.46.7

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.
@@ -212,20 +212,47 @@ export function setIsProcessing(processing: boolean): void {
212
212
  });
213
213
  }
214
214
 
215
+ var sessionMessageCache = new Map<string, { messages: HistoryMessage[]; title: string | null; hasMore: boolean; totalMessages: number }>();
216
+ var MAX_CACHED_SESSIONS = 10;
217
+
218
+ export function cacheCurrentSession(): void {
219
+ var state = sessionStore.state;
220
+ if (state.activeSessionId && state.messages.length > 0) {
221
+ sessionMessageCache.set(state.activeSessionId, {
222
+ messages: state.messages,
223
+ title: state.activeSessionTitle,
224
+ hasMore: state.historyHasMore,
225
+ totalMessages: state.historyTotalMessages,
226
+ });
227
+ if (sessionMessageCache.size > MAX_CACHED_SESSIONS) {
228
+ var firstKey = sessionMessageCache.keys().next().value;
229
+ if (firstKey) sessionMessageCache.delete(firstKey);
230
+ }
231
+ }
232
+ }
233
+
234
+ export function getCachedSession(sessionId: string): { messages: HistoryMessage[]; title: string | null; hasMore: boolean; totalMessages: number } | undefined {
235
+ return sessionMessageCache.get(sessionId);
236
+ }
237
+
215
238
  export function setActiveSession(projectSlug: string | null, sessionId: string | null, title?: string | null): void {
216
239
  var prevSessionId = sessionStore.state.activeSessionId;
217
240
  if (prevSessionId) {
218
241
  markSessionRead(prevSessionId, sessionStore.state.messages.length);
242
+ cacheCurrentSession();
219
243
  }
220
244
  currentAssistantUuid = null;
221
245
  incrementStreamGeneration();
246
+
247
+ var cached = sessionId ? sessionMessageCache.get(sessionId) : undefined;
248
+
222
249
  sessionStore.setState(function (state) {
223
250
  return {
224
251
  ...state,
225
252
  activeProjectSlug: projectSlug,
226
253
  activeSessionId: sessionId,
227
- activeSessionTitle: title ?? null,
228
- messages: [],
254
+ activeSessionTitle: cached?.title ?? title ?? null,
255
+ messages: cached?.messages ?? [],
229
256
  isProcessing: false,
230
257
  currentStatus: null,
231
258
  contextUsage: null,
@@ -234,12 +261,15 @@ export function setActiveSession(projectSlug: string | null, sessionId: string |
234
261
  lastResponseCost: null,
235
262
  lastResponseDuration: null,
236
263
  lastReadIndex: null,
237
- historyLoading: true,
264
+ historyLoading: !cached,
265
+ historyHasMore: cached?.hasMore ?? false,
266
+ historyTotalMessages: cached?.totalMessages ?? 0,
238
267
  wasInterrupted: false,
239
268
  promptSuggestion: null,
240
269
  failedInput: null,
241
270
  messageQueue: [],
242
271
  isBusy: false,
272
+ busyOwner: null,
243
273
  isPlanMode: false,
244
274
  pendingPrefill: state.pendingPrefill,
245
275
  };
@@ -17,17 +17,19 @@ export default defineConfig({
17
17
  runtimeCaching: [
18
18
  {
19
19
  urlPattern: /^https?:\/\/.*\.(?:js|css|woff2)$/,
20
- handler: "StaleWhileRevalidate",
20
+ handler: "NetworkFirst",
21
21
  options: {
22
22
  cacheName: "static-assets",
23
+ networkTimeoutSeconds: 3,
23
24
  expiration: { maxEntries: 100, maxAgeSeconds: 7 * 24 * 60 * 60 },
24
25
  },
25
26
  },
26
27
  {
27
28
  urlPattern: /^https?:\/\/.*\.(?:svg|png|jpg|jpeg|gif|webp)$/,
28
- handler: "StaleWhileRevalidate",
29
+ handler: "NetworkFirst",
29
30
  options: {
30
31
  cacheName: "images",
32
+ networkTimeoutSeconds: 3,
31
33
  expiration: { maxEntries: 50, maxAgeSeconds: 7 * 24 * 60 * 60 },
32
34
  },
33
35
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptiklemur/lattice",
3
- "version": "1.46.5",
3
+ "version": "1.46.7",
4
4
  "description": "Multi-machine agentic dashboard for Claude Code. Monitor sessions, manage MCP servers and skills, orchestrate across mesh-networked nodes.",
5
5
  "license": "MIT",
6
6
  "author": "Aaron Scherer <me@aaronscherer.me>",