@cryptiklemur/lattice 1.44.1 → 1.44.3

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.
@@ -294,6 +294,13 @@ export function useSession(): UseSessionReturn {
294
294
 
295
295
  function handleHistory(msg: ServerMessage) {
296
296
  var m = msg as SessionHistoryMessage;
297
+ if (m.sessionId && m.messages && m.messages.length === 0 && m.title) {
298
+ updateSessionTabTitle(m.sessionId, m.title);
299
+ if (m.sessionId === getSessionStore().state.activeSessionId) {
300
+ getSessionStore().setState(function (s) { return { ...s, activeSessionTitle: m.title ?? s.activeSessionTitle }; });
301
+ }
302
+ return;
303
+ }
297
304
  setCurrentAssistantUuid(null);
298
305
  if (m.sessionId) {
299
306
  var projectSlug = m.projectSlug || getSessionStore().state.activeProjectSlug;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptiklemur/lattice",
3
- "version": "1.44.1",
3
+ "version": "1.44.3",
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>",
@@ -321,6 +321,16 @@ export async function startDaemon(portOverride?: number | null): Promise<void> {
321
321
  addClient(ws);
322
322
  log.ws("Client connected: %s", ws.data.id);
323
323
  sendTo(ws.data.id, { type: "mesh:nodes", nodes: buildNodesMessage() });
324
+ var connectConfig = loadConfig();
325
+ var connectIdentity = loadOrCreateIdentity();
326
+ var localProjects = connectConfig.projects.map(function (p: typeof connectConfig.projects[number]) {
327
+ return { slug: p.slug, path: p.path, title: p.title, nodeId: connectIdentity.id, nodeName: connectConfig.name, isRemote: false, ideProjectName: detectIdeProjectName(p.path), activeSessions: getActiveSessionCountForProject(p.path) };
328
+ });
329
+ var connectRemoteProjects = getAllRemoteProjects(connectIdentity.id);
330
+ sendTo(ws.data.id, {
331
+ type: "projects:list",
332
+ projects: localProjects.concat(connectRemoteProjects as unknown as typeof localProjects),
333
+ });
324
334
  },
325
335
  message(ws: ServerWebSocket<WsData>, message: string | Buffer) {
326
336
  var now = Date.now();
@@ -107,13 +107,9 @@ registerHandler("session", function (clientId: string, message: ClientMessage) {
107
107
  setActiveProject(clientId, activateMsg.projectSlug);
108
108
  watchSessionLock(activateMsg.sessionId);
109
109
  var activateT0 = Date.now();
110
- void Promise.all([
111
- loadSessionHistory(activateMsg.projectSlug, activateMsg.sessionId),
112
- getSessionTitle(activateMsg.projectSlug, activateMsg.sessionId).catch(function () { return null; }),
113
- ]).then(function (results) {
114
- log.session("session:activate history+title: %dms", Date.now() - activateT0);
115
- var historyResult = results[0];
116
- var title = results[1];
110
+ void loadSessionHistory(activateMsg.projectSlug, activateMsg.sessionId).then(function (historyResult) {
111
+ log.session("session:activate history: %dms", Date.now() - activateT0);
112
+ var title: string | null = null;
117
113
  var interrupted = wasSessionInterrupted(activateMsg.sessionId);
118
114
  if (interrupted) {
119
115
  clearInterruptedFlag(activateMsg.sessionId);
@@ -137,6 +133,12 @@ registerHandler("session", function (clientId: string, message: ClientMessage) {
137
133
  sendTo(clientId, { type: "chat:error", message: "Failed to load session history" });
138
134
  });
139
135
 
136
+ setTimeout(function () {
137
+ void getSessionTitle(activateMsg.projectSlug, activateMsg.sessionId).then(function (sessionTitle) {
138
+ if (sessionTitle) {
139
+ sendTo(clientId, { type: "session:history", projectSlug: activateMsg.projectSlug, sessionId: activateMsg.sessionId, messages: [], title: sessionTitle });
140
+ }
141
+ }).catch(function () {});
140
142
  void Promise.all([
141
143
  getSessionUsage(activateMsg.projectSlug, activateMsg.sessionId).catch(function () { return null; }),
142
144
  getContextBreakdown(activateMsg.projectSlug, activateMsg.sessionId).catch(function () { return null; }),
@@ -173,6 +175,7 @@ registerHandler("session", function (clientId: string, message: ClientMessage) {
173
175
  log.session("Failed to activate session: %O", err);
174
176
  sendTo(clientId, { type: "chat:error", message: "Failed to activate session" });
175
177
  });
178
+ }, 50);
176
179
  return;
177
180
  }
178
181
 
@@ -189,9 +189,16 @@ export async function getContextBreakdown(projectSlug: string, sessionId: string
189
189
  var instructionsTokens = countTokens(globalClaudeMd + globalRulesContent + projectClaudeMd + projectLocalClaudeMd);
190
190
  var memoryTokens = countTokens(memoryContent + memoryIndex);
191
191
 
192
- // Parse session
193
- var content = readFileSync(sessionFile, "utf-8");
194
- var lines = content.trim().split("\n");
192
+ // Parse session — read last 2MB for recent context (avoids reading 35MB+ files)
193
+ var { openSync, readSync: fsReadSync, fstatSync: fsFstatSync, closeSync: fsCloseSync } = require("node:fs") as typeof import("node:fs");
194
+ var fd = openSync(sessionFile, "r");
195
+ var fileStat = fsFstatSync(fd);
196
+ var readSize = Math.min(fileStat.size, 2 * 1024 * 1024);
197
+ var readBuf = Buffer.alloc(readSize);
198
+ fsReadSync(fd, readBuf, 0, readSize, fileStat.size - readSize);
199
+ fsCloseSync(fd);
200
+ var content = readBuf.toString("utf-8");
201
+ var lines = content.split("\n").filter(function (l) { return l.length > 0; });
195
202
 
196
203
  // Extract tool info
197
204
  var toolCounts = extractToolsFromSession(lines);
@@ -294,8 +294,16 @@ export async function getSessionUsage(projectSlug: string, sessionId: string): P
294
294
  if (!existsSync(sessionFile)) return null;
295
295
 
296
296
  try {
297
- var content = readFileSync(sessionFile, "utf-8");
298
- var lines = content.trim().split("\n");
297
+ var { openSync, readSync, fstatSync, closeSync } = require("node:fs") as typeof import("node:fs");
298
+ var fd = openSync(sessionFile, "r");
299
+ var stat = fstatSync(fd);
300
+ var tailSize = Math.min(stat.size, 512 * 1024);
301
+ var buf = Buffer.alloc(tailSize);
302
+ readSync(fd, buf, 0, tailSize, stat.size - tailSize);
303
+ closeSync(fd);
304
+
305
+ var text = buf.toString("utf-8");
306
+ var lines = text.split("\n");
299
307
 
300
308
  for (var i = lines.length - 1; i >= 0; i--) {
301
309
  var line = lines[i].trim();