Forked clean from public hackathon repo (Starfire-AgentTeam, BSL 1.1) with full rebrand to Molecule AI under github.com/Molecule-AI/molecule-monorepo. Brand: Starfire → Molecule AI. Slug: starfire / agent-molecule → molecule. Env vars: STARFIRE_* → MOLECULE_*. Go module: github.com/agent-molecule/platform → github.com/Molecule-AI/molecule-monorepo/platform. Python packages: starfire_plugin → molecule_plugin, starfire_agent → molecule_agent. DB: agentmolecule → molecule. History truncated; see public repo for prior commits and contributor attribution. Verified green: go test -race ./... (platform), pytest (workspace-template 1129 + sdk 132), vitest (canvas 352), build (mcp). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { Canvas } from "@/components/Canvas";
|
|
import { Legend } from "@/components/Legend";
|
|
import { CommunicationOverlay } from "@/components/CommunicationOverlay";
|
|
import { connectSocket, disconnectSocket } from "@/store/socket";
|
|
import { useCanvasStore } from "@/store/canvas";
|
|
import { api } from "@/lib/api";
|
|
import type { WorkspaceData } from "@/store/socket";
|
|
|
|
export default function Home() {
|
|
useEffect(() => {
|
|
connectSocket();
|
|
|
|
// Hydrate workspaces and restore viewport in parallel
|
|
Promise.all([
|
|
api.get<WorkspaceData[]>("/workspaces"),
|
|
api.get<{ x: number; y: number; zoom: number }>("/canvas/viewport").catch(() => null),
|
|
]).then(([workspaces, viewport]) => {
|
|
useCanvasStore.getState().hydrate(workspaces);
|
|
if (viewport) {
|
|
useCanvasStore.getState().setViewport(viewport);
|
|
}
|
|
}).catch((err) => {
|
|
// Initial hydration failed — socket reconnect will retry
|
|
console.error("Canvas: initial hydration failed", err);
|
|
});
|
|
|
|
return () => {
|
|
disconnectSocket();
|
|
};
|
|
}, []);
|
|
|
|
return (
|
|
<>
|
|
<Canvas />
|
|
<Legend />
|
|
<CommunicationOverlay />
|
|
</>
|
|
);
|
|
}
|