@cryptiklemur/lattice 1.41.3 → 1.42.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.
@@ -19,6 +19,7 @@ function getProjectInitials(title: string): string {
19
19
  interface ProjectGroup {
20
20
  slug: string;
21
21
  title: string;
22
+ activeSessions: number;
22
23
  nodes: Array<{ nodeId: string; nodeName: string; online: boolean; path: string }>;
23
24
  }
24
25
 
@@ -36,8 +37,9 @@ function groupProjectsBySlug(projects: ProjectInfo[], nodes: NodeInfo[]): Projec
36
37
  };
37
38
  if (existing) {
38
39
  existing.nodes.push(nodeEntry);
40
+ existing.activeSessions += p.activeSessions ?? 0;
39
41
  } else {
40
- groups.set(p.slug, { slug: p.slug, title: p.title, nodes: [nodeEntry] });
42
+ groups.set(p.slug, { slug: p.slug, title: p.title, activeSessions: p.activeSessions ?? 0, nodes: [nodeEntry] });
41
43
  }
42
44
  }
43
45
  return Array.from(groups.values());
@@ -95,6 +97,12 @@ function ProjectButton(props: ProjectButtonProps) {
95
97
  {initials}
96
98
  </button>
97
99
 
100
+ {props.group.activeSessions > 0 && (
101
+ <div className="absolute -top-1 -right-1 min-w-[16px] h-[16px] rounded-full bg-primary text-primary-content text-[9px] font-bold flex items-center justify-center pointer-events-none px-1">
102
+ {props.group.activeSessions}
103
+ </div>
104
+ )}
105
+
98
106
  <div className="absolute bottom-0 right-0 flex gap-[2px] pointer-events-none">
99
107
  {props.group.nodes.map(function (n) {
100
108
  return (
@@ -137,6 +145,59 @@ function ProjectButton(props: ProjectButtonProps) {
137
145
  );
138
146
  }
139
147
 
148
+ function NodeIndicator({ node }: { node: NodeInfo }) {
149
+ var [hovered, setHovered] = useState(false);
150
+ var [tooltipTop, setTooltipTop] = useState(0);
151
+ var sidebar = useSidebar();
152
+ var initial = node.name.charAt(0).toUpperCase();
153
+
154
+ return (
155
+ <div className="relative flex items-center">
156
+ <button
157
+ onClick={function () { sidebar.openSettings("nodes"); }}
158
+ onMouseEnter={function (e) {
159
+ var rect = e.currentTarget.getBoundingClientRect();
160
+ setTooltipTop(rect.top + rect.height / 2);
161
+ setHovered(true);
162
+ }}
163
+ onMouseLeave={function () { setHovered(false); }}
164
+ className={
165
+ "w-[28px] h-[28px] flex items-center justify-center text-[10px] font-bold rounded-full cursor-pointer transition-all duration-[120ms] flex-shrink-0 border-2 " +
166
+ (node.online
167
+ ? "border-success/50 bg-base-200 text-base-content/50 hover:bg-base-200/80"
168
+ : "border-error/30 bg-base-200/50 text-base-content/25 hover:bg-base-200/60")
169
+ }
170
+ >
171
+ {initial}
172
+ </button>
173
+ {hovered && (
174
+ <div
175
+ className="pointer-events-none z-[9000] bg-base-300 border border-base-content/20 rounded-lg px-2.5 py-1.5 shadow-xl"
176
+ style={{
177
+ position: "fixed",
178
+ left: "calc(64px + 8px)",
179
+ top: tooltipTop + "px",
180
+ transform: "translateY(-50%)",
181
+ }}
182
+ >
183
+ <div className="flex items-center gap-1.5">
184
+ <div className={"w-[6px] h-[6px] rounded-full flex-shrink-0 " + (node.online ? "bg-success" : "bg-error")} />
185
+ <span className="text-[12px] font-bold text-base-content whitespace-nowrap">{node.name}</span>
186
+ </div>
187
+ {node.addresses && node.addresses.length > 0 && (
188
+ <div className="text-[10px] text-base-content/40 mt-0.5 whitespace-nowrap">
189
+ {node.addresses[0]}
190
+ </div>
191
+ )}
192
+ <div className="text-[10px] text-base-content/30 mt-0.5">
193
+ {node.projects.length} project{node.projects.length !== 1 ? "s" : ""}
194
+ </div>
195
+ </div>
196
+ )}
197
+ </div>
198
+ );
199
+ }
200
+
140
201
  interface ProjectRailProps {
141
202
  projects: ProjectInfo[];
142
203
  nodes: NodeInfo[];
@@ -151,6 +212,7 @@ export function ProjectRail(props: ProjectRailProps) {
151
212
  var ws = useWebSocket();
152
213
  var sidebar = useSidebar();
153
214
  var groups = groupProjectsBySlug(props.projects, props.nodes);
215
+ var remoteNodes = props.nodes.filter(function (n) { return !n.isLocal; });
154
216
  var [contextMenu, setContextMenu] = useState<ContextMenuState>({
155
217
  visible: false,
156
218
  x: 0,
@@ -255,10 +317,18 @@ export function ProjectRail(props: ProjectRailProps) {
255
317
  })}
256
318
 
257
319
 
258
- {groups.length > 0 && (
320
+ {groups.length > 0 && remoteNodes.length > 0 && (
259
321
  <div className="w-6 h-px bg-base-300 my-0.5 flex-shrink-0" />
260
322
  )}
261
323
 
324
+ {remoteNodes.map(function (node) {
325
+ return (
326
+ <NodeIndicator key={node.id} node={node} />
327
+ );
328
+ })}
329
+
330
+ <div className="w-6 h-px bg-base-300 my-0.5 flex-shrink-0" />
331
+
262
332
  <button
263
333
  onClick={function () { sidebar.openAddProject(); }}
264
334
  className="w-[42px] h-[42px] flex items-center justify-center rounded-full border-2 border-dashed border-base-content/25 text-base-content/20 hover:border-base-content/40 hover:text-base-content/40 transition-colors duration-[120ms] flex-shrink-0 cursor-pointer"
@@ -15,7 +15,6 @@ import { AddProjectModal } from "./components/sidebar/AddProjectModal";
15
15
  import { useSidebar } from "./hooks/useSidebar";
16
16
  import { useWorkspace } from "./hooks/useWorkspace";
17
17
  import { useWebSocket } from "./hooks/useWebSocket";
18
- import { UpdateBanner } from "./components/ui/UpdateBanner";
19
18
  import { NodeDisconnectedOverlay } from "./components/ui/NodeDisconnectedOverlay";
20
19
  import { useSwipeDrawer } from "./hooks/useSwipeDrawer";
21
20
  import { exitSettings, getSidebarStore, handlePopState, closeDrawer, toggleDrawer } from "./stores/sidebar";
@@ -424,7 +423,6 @@ function RootLayout() {
424
423
  />
425
424
 
426
425
  <main id="main-content" className="drawer-content flex flex-col h-full min-w-0 overflow-hidden relative">
427
- <UpdateBanner />
428
426
  <Outlet />
429
427
  <NodeDisconnectedOverlay />
430
428
  </main>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptiklemur/lattice",
3
- "version": "1.41.3",
3
+ "version": "1.42.0",
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>",
@@ -18,7 +18,7 @@ import { detectIdeProjectName } from "./handlers/settings";
18
18
  import "./handlers/session";
19
19
  import "./handlers/chat";
20
20
  import "./handlers/attachment";
21
- import { loadInterruptedSessions, unwatchSessionLock, cleanupClientPermissions } from "./project/sdk-bridge";
21
+ import { loadInterruptedSessions, unwatchSessionLock, cleanupClientPermissions, getActiveSessionCountForProject } from "./project/sdk-bridge";
22
22
  import { clearActiveSession, getActiveSession } from "./handlers/chat";
23
23
  import { clearActiveProject } from "./handlers/fs";
24
24
  import { clearClientRemoteNode } from "./ws/router";
@@ -410,7 +410,7 @@ export async function startDaemon(portOverride?: number | null): Promise<void> {
410
410
  var currentIdentity = loadOrCreateIdentity();
411
411
  broadcast({ type: "mesh:nodes", nodes: buildNodesMessage() });
412
412
  var localProjects = currentConfig.projects.map(function (p: typeof currentConfig.projects[number]) {
413
- return { slug: p.slug, path: p.path, title: p.title, nodeId: currentIdentity.id, nodeName: currentConfig.name, isRemote: false, ideProjectName: detectIdeProjectName(p.path) };
413
+ return { slug: p.slug, path: p.path, title: p.title, nodeId: currentIdentity.id, nodeName: currentConfig.name, isRemote: false, ideProjectName: detectIdeProjectName(p.path), activeSessions: getActiveSessionCountForProject(p.path) };
414
414
  });
415
415
  var remoteProjects = getAllRemoteProjects(currentIdentity.id);
416
416
  broadcast({
@@ -212,6 +212,41 @@ export function getActiveStreamCount(): number {
212
212
  return activeStreams.size;
213
213
  }
214
214
 
215
+ export function getActiveSessionCountForProject(projectPath: string): number {
216
+ var count = 0;
217
+ var hash = projectPath.replace(/\//g, "-");
218
+ var dir = join(homedir(), ".claude", "projects", hash);
219
+
220
+ for (var [sessionId] of activeStreams) {
221
+ if (existsSync(join(dir, sessionId + ".jsonl"))) count++;
222
+ }
223
+
224
+ for (var [sessionId2] of streamMetadata) {
225
+ void sessionId2;
226
+ }
227
+
228
+ if (isClaudeCliRunningInProject(projectPath)) count++;
229
+
230
+ return count;
231
+ }
232
+
233
+ function isClaudeCliRunningInProject(projectPath: string): boolean {
234
+ try {
235
+ var result = Bun.spawnSync(["pgrep", "-x", "claude"], { stderr: "ignore" });
236
+ if (result.exitCode !== 0) return false;
237
+ var pids = result.stdout.toString().trim().split("\n");
238
+ for (var i = 0; i < pids.length; i++) {
239
+ var pid = parseInt(pids[i], 10);
240
+ if (isNaN(pid) || pid === process.pid) continue;
241
+ try {
242
+ var cwd = readlinkSync("/proc/" + pid + "/cwd");
243
+ if (cwd === projectPath) return true;
244
+ } catch {}
245
+ }
246
+ } catch {}
247
+ return false;
248
+ }
249
+
215
250
  /**
216
251
  * Check if a session is controlled by an external process (not Lattice).
217
252
  * Lattice's own active streams are handled by isProcessing on the client,
@@ -23,6 +23,7 @@ export interface ProjectInfo extends ProjectSummary {
23
23
  isRemote: boolean;
24
24
  online?: boolean;
25
25
  ideProjectName?: string;
26
+ activeSessions?: number;
26
27
  }
27
28
 
28
29
  export interface SessionSummary {