agent-comms 3.24.0 → 3.25.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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/dist/bridges/user/web/dist/bundle.js +15 -15
- package/dist/bridges/user/web/dist/sw.js +1 -1
- package/dist/bridges/user/web/frontend/api.d.ts +3 -1
- package/dist/bridges/user/web/frontend/api.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/api.js +47 -0
- package/dist/bridges/user/web/frontend/api.js.map +1 -1
- package/dist/bridges/user/web/frontend/components/App.d.ts +2 -1
- package/dist/bridges/user/web/frontend/components/App.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/components/App.js +8 -2
- package/dist/bridges/user/web/frontend/components/App.js.map +1 -1
- package/dist/bridges/user/web/frontend/components/MeshGraphView.d.ts +14 -0
- package/dist/bridges/user/web/frontend/components/MeshGraphView.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/MeshGraphView.js +58 -0
- package/dist/bridges/user/web/frontend/components/MeshGraphView.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/MeshPanel.d.ts +12 -0
- package/dist/bridges/user/web/frontend/components/MeshPanel.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/MeshPanel.js +39 -0
- package/dist/bridges/user/web/frontend/components/MeshPanel.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/MeshTraceView.d.ts +18 -0
- package/dist/bridges/user/web/frontend/components/MeshTraceView.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/MeshTraceView.js +29 -0
- package/dist/bridges/user/web/frontend/components/MeshTraceView.js.map +1 -0
- package/dist/bridges/user/web/frontend/main.js +12 -2
- package/dist/bridges/user/web/frontend/main.js.map +1 -1
- package/dist/bridges/user/web/frontend/state.d.ts +4 -1
- package/dist/bridges/user/web/frontend/state.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/state.js +5 -0
- package/dist/bridges/user/web/frontend/state.js.map +1 -1
- package/dist/bridges/user/web/frontend/types.d.ts +28 -0
- package/dist/bridges/user/web/frontend/types.d.ts.map +1 -1
- package/dist/bridges/user/web/server.d.ts +2 -0
- package/dist/bridges/user/web/server.d.ts.map +1 -1
- package/dist/bridges/user/web/server.js +44 -0
- package/dist/bridges/user/web/server.js.map +1 -1
- package/dist/bridges/user/web/test/web-server.integration.test.js +42 -0
- package/dist/bridges/user/web/test/web-server.integration.test.js.map +1 -1
- package/dist/core/mesh-graph.d.ts +5 -1
- package/dist/core/mesh-graph.d.ts.map +1 -1
- package/dist/core/mesh-graph.js +21 -12
- package/dist/core/mesh-graph.js.map +1 -1
- package/dist/test/mesh-graph.test.d.ts +5 -0
- package/dist/test/mesh-graph.test.d.ts.map +1 -0
- package/dist/test/mesh-graph.test.js +87 -0
- package/dist/test/mesh-graph.test.js.map +1 -0
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`agent-comms-v1`,t=[{"revision":"f5ef9303cc739920f0b1e2b5aab51b99","url":"mesh-worker.js"},{"revision":"f1ee3afb8c9e8f0d7315fd93d6457316","url":"index.html"},{"revision":"
|
|
1
|
+
var e=`agent-comms-v1`,t=[{"revision":"f5ef9303cc739920f0b1e2b5aab51b99","url":"mesh-worker.js"},{"revision":"f1ee3afb8c9e8f0d7315fd93d6457316","url":"index.html"},{"revision":"4a5da05e58fcea230eead72960e25fb1","url":"bundle.js"}].map(e=>e.url);self.addEventListener(`install`,n=>{n.waitUntil(self.caches.open(e).then(async e=>e.addAll(t)).then(async()=>self.skipWaiting()))}),self.addEventListener(`activate`,t=>{t.waitUntil(self.caches.keys().then(async t=>Promise.all(t.filter(t=>t!==e).map(async e=>self.caches.delete(e)))))});var n=200,r=300;function i(e,t){return e.method===`GET`&&t.status>=n&&t.status<r}self.addEventListener(`fetch`,t=>{if(new URL(t.request.url).pathname.startsWith(`/api/`)){t.respondWith(fetch(t.request).then(n=>{if(i(t.request,n)){let r=n.clone();self.caches.open(e).then(async e=>e.put(t.request,r))}return n}).catch(async()=>self.caches.open(e).then(async e=>e.match(t.request)).then(e=>e??new Response(`Offline`,{status:503}))));return}t.respondWith(self.caches.open(e).then(async e=>e.match(t.request)).then(async n=>n||fetch(t.request).then(n=>{if(i(t.request,n)){let r=n.clone();self.caches.open(e).then(async e=>e.put(t.request,r))}return n})))}),self.addEventListener(`push`,e=>{let t=`Agent Comms`,n=`New message`;if(e.data)try{let r=e.data.json();typeof r.title==`string`&&(t=r.title),typeof r.body==`string`&&(n=r.body)}catch{let t=e.data.text();t&&(n=t)}e.waitUntil(self.registration.showNotification(t,{body:n,data:{url:self.location.origin}}))}),self.addEventListener(`notificationclick`,e=>{e.notification.close();let t=e.notification.data,n=typeof t==`object`&&t&&`url`in t&&typeof t.url==`string`?t.url:self.location.origin;e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(async e=>{for(let t of e)if(t.url===n&&`focus`in t)return t.focus();return self.clients.openWindow(n)}))});
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
*
|
|
7
7
|
* JSON boundaries use runtime validation with type predicates — no assertions.
|
|
8
8
|
*/
|
|
9
|
-
import type { Action, ActionResult, AgentsResponse, MessagesResponse, RoomsResponse, WsFrame } from "./types.js";
|
|
9
|
+
import type { Action, ActionResult, AgentsResponse, MeshGraph, MeshTraceResult, MessagesResponse, RoomsResponse, WsFrame } from "./types.js";
|
|
10
10
|
export declare function fetchAgents(): Promise<AgentsResponse>;
|
|
11
11
|
export declare function fetchRooms(): Promise<RoomsResponse>;
|
|
12
12
|
export declare function fetchRoomMessages(roomId: string, since?: string): Promise<MessagesResponse>;
|
|
13
|
+
export declare function fetchMeshGraph(): Promise<MeshGraph>;
|
|
14
|
+
export declare function fetchMeshTrace(target: string, timeoutMs?: number): Promise<MeshTraceResult>;
|
|
13
15
|
export declare function postAction(action: Action): Promise<ActionResult>;
|
|
14
16
|
export interface WsEventHandler {
|
|
15
17
|
onOpen?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/api.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,OAAO,EACR,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/api.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,OAAO,EACR,MAAM,YAAY,CAAC;AAmDpB,wBAAsB,WAAW,IAAI,OAAO,CAAC,cAAc,CAAC,CAK3D;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC,CAKzD;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,CAAC,CAS3B;AAaD,wBAAsB,cAAc,IAAI,OAAO,CAAC,SAAS,CAAC,CAMzD;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAQ1B;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAStE;AASD,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,EAAE,CAAwB;IAClC,OAAO,CAAC,cAAc,CAA4C;IAClE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;gBAE7B,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC;IAI7C,OAAO,IAAI,IAAI;IA2Bf,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOhC,UAAU,IAAI,IAAI;IAYlB,OAAO,CAAC,iBAAiB;CAK1B"}
|
|
@@ -29,6 +29,20 @@ function isActionResult(value) {
|
|
|
29
29
|
function isWsFrame(value) {
|
|
30
30
|
return isObject(value) && typeof value.type === "string";
|
|
31
31
|
}
|
|
32
|
+
function isMeshGraph(value) {
|
|
33
|
+
return (isObject(value) && Array.isArray(value.nodes) && Array.isArray(value.edges));
|
|
34
|
+
}
|
|
35
|
+
function isMeshTraceResult(value) {
|
|
36
|
+
if (!isObject(value))
|
|
37
|
+
return false;
|
|
38
|
+
if (typeof value.rttMs !== "number")
|
|
39
|
+
return false;
|
|
40
|
+
if (!isObject(value.local))
|
|
41
|
+
return false;
|
|
42
|
+
if (!isObject(value.outcome))
|
|
43
|
+
return false;
|
|
44
|
+
return typeof value.outcome.result === "string";
|
|
45
|
+
}
|
|
32
46
|
// ---------------------------------------------------------------------------
|
|
33
47
|
// REST client
|
|
34
48
|
// ---------------------------------------------------------------------------
|
|
@@ -56,6 +70,39 @@ export async function fetchRoomMessages(roomId, since) {
|
|
|
56
70
|
throw new Error("Invalid messages response");
|
|
57
71
|
return body;
|
|
58
72
|
}
|
|
73
|
+
/** Reads server.ts's mesh endpoints' own jsonError response body (an "error" string field), falling back to the response's own status text when the body isn't the expected shape (e.g. a network-level failure with no JSON body at all). */
|
|
74
|
+
async function readMeshErrorMessage(res) {
|
|
75
|
+
try {
|
|
76
|
+
const body = await res.json();
|
|
77
|
+
if (isObject(body) && typeof body.error === "string")
|
|
78
|
+
return body.error;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// fall through to statusText below
|
|
82
|
+
}
|
|
83
|
+
return res.statusText || `HTTP ${String(res.status)}`;
|
|
84
|
+
}
|
|
85
|
+
export async function fetchMeshGraph() {
|
|
86
|
+
const res = await fetch("/api/mesh/graph");
|
|
87
|
+
if (!res.ok)
|
|
88
|
+
throw new Error(await readMeshErrorMessage(res));
|
|
89
|
+
const body = await res.json();
|
|
90
|
+
if (!isMeshGraph(body))
|
|
91
|
+
throw new Error("Invalid mesh graph response");
|
|
92
|
+
return body;
|
|
93
|
+
}
|
|
94
|
+
export async function fetchMeshTrace(target, timeoutMs) {
|
|
95
|
+
const params = new URLSearchParams({ target });
|
|
96
|
+
if (timeoutMs !== undefined)
|
|
97
|
+
params.set("timeoutMs", String(timeoutMs));
|
|
98
|
+
const res = await fetch(`/api/mesh/trace?${params.toString()}`);
|
|
99
|
+
if (!res.ok)
|
|
100
|
+
throw new Error(await readMeshErrorMessage(res));
|
|
101
|
+
const body = await res.json();
|
|
102
|
+
if (!isMeshTraceResult(body))
|
|
103
|
+
throw new Error("Invalid mesh trace response");
|
|
104
|
+
return body;
|
|
105
|
+
}
|
|
59
106
|
export async function postAction(action) {
|
|
60
107
|
const res = await fetch("/api/action", {
|
|
61
108
|
method: "POST",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/api.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/api.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,8EAA8E;AAC9E,qDAAqD;AACrD,8EAA8E;AAE9E,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,eAAe,CAAC,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|
|
|
3
3
|
*
|
|
4
4
|
* Renders sidebar + chat area inside an AppShell. Receives state and action callbacks from the imperative shell in main.tsx.
|
|
5
5
|
*/
|
|
6
|
-
import type { Agent, DisplayMessage, Room } from "../types.js";
|
|
6
|
+
import type { Agent, DisplayMessage, MeshGraph, Room } from "../types.js";
|
|
7
7
|
export interface AppProps {
|
|
8
8
|
rooms: readonly Room[];
|
|
9
9
|
agents: readonly Agent[];
|
|
@@ -11,6 +11,7 @@ export interface AppProps {
|
|
|
11
11
|
dmTarget: string | undefined;
|
|
12
12
|
messages: readonly DisplayMessage[];
|
|
13
13
|
connected: boolean;
|
|
14
|
+
meshGraph: MeshGraph | undefined;
|
|
14
15
|
onJoinRoom: (roomId: string) => void;
|
|
15
16
|
onSelectAgent: (agentId: string) => void;
|
|
16
17
|
onRenameAgent: (agentId: string, newName: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/App.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/App.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAO1E,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,EAAE,CACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,EACrC,WAAW,EAAE,MAAM,KAChB,IAAI,CAAC;IACV,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,+BAuDlC"}
|
|
@@ -4,16 +4,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
*
|
|
5
5
|
* Renders sidebar + chat area inside an AppShell. Receives state and action callbacks from the imperative shell in main.tsx.
|
|
6
6
|
*/
|
|
7
|
-
import { AppShell } from "@mantine/core";
|
|
7
|
+
import { AppShell, SegmentedControl } from "@mantine/core";
|
|
8
8
|
import { useDisclosure } from "@mantine/hooks";
|
|
9
|
+
import { useState } from "react";
|
|
9
10
|
import { ChatArea } from "./ChatArea.js";
|
|
11
|
+
import { MeshPanel } from "./MeshPanel.js";
|
|
10
12
|
import { Sidebar } from "./Sidebar.js";
|
|
11
13
|
export function App(props) {
|
|
12
14
|
const [navOpened, { toggle: toggleNav }] = useDisclosure(true);
|
|
15
|
+
const [mainView, setMainView] = useState("chat");
|
|
13
16
|
return (_jsxs(AppShell, { navbar: {
|
|
14
17
|
width: 260,
|
|
15
18
|
breakpoint: "sm",
|
|
16
19
|
collapsed: { desktop: !navOpened, mobile: !navOpened },
|
|
17
|
-
}, children: [
|
|
20
|
+
}, children: [_jsxs(AppShell.Navbar, { children: [_jsx(Sidebar, { rooms: props.rooms, agents: props.agents, currentRoom: props.currentRoom, onJoinRoom: props.onJoinRoom, onSelectAgent: props.onSelectAgent, onRenameAgent: props.onRenameAgent, onCreateRoom: props.onCreateRoom, onJoinRoomInput: props.onJoinRoomInput }), _jsx(SegmentedControl, { m: "xs", size: "xs", fullWidth: true, value: mainView, onChange: setMainView, data: [
|
|
21
|
+
{ label: "Chat", value: "chat" },
|
|
22
|
+
{ label: "Mesh", value: "mesh" },
|
|
23
|
+
] })] }), _jsx(AppShell.Main, { h: "100vh", children: mainView === "chat" ? (_jsx(ChatArea, { messages: props.messages, rooms: props.rooms, currentRoom: props.currentRoom, dmTarget: props.dmTarget, connected: props.connected, sidebarOpened: navOpened, onToggleSidebar: toggleNav, onSendAction: props.onSendAction, onLeaveRoom: props.onLeaveRoom, onConnectToMesh: props.onConnectToMesh })) : (_jsx(MeshPanel, { graph: props.meshGraph })) })] }));
|
|
18
24
|
}
|
|
19
25
|
//# sourceMappingURL=App.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/App.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/App.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM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AK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,aAAa,EAAE,SAAS,EACxB,eAAe,EAAE,SAAS,EAC1B,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,eAAe,EAAE,KAAK,CAAC,eAAe,GACtC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,CAAC,SAAS,GAAI,CACtC,GACa,IACP,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MeshGraphView — force-directed rendering of the mesh's connection graph (agent-comms#201).
|
|
3
|
+
*
|
|
4
|
+
* Uses d3-force purely for layout: forceSimulation computes node positions, which are then rendered as plain SVG driven by React, not by d3's own DOM manipulation. The simulation is run to convergence synchronously (a fixed tick count, no requestAnimationFrame loop) so a render is a pure function of `graph` -- deterministic, and cheap enough to redo in full whenever the graph changes, matching how the rest of the mesh's live state already re-renders wholesale on every WS-driven refresh rather than patching in place.
|
|
5
|
+
*/
|
|
6
|
+
import type { MeshGraph } from "../types.js";
|
|
7
|
+
interface MeshGraphViewProps {
|
|
8
|
+
graph: MeshGraph;
|
|
9
|
+
selectedDevice: string | undefined;
|
|
10
|
+
onSelectDevice: (deviceId: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function MeshGraphView({ graph, selectedDevice, onSelectDevice, }: MeshGraphViewProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=MeshGraphView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeshGraphView.d.ts","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/MeshGraphView.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,UAAU,kBAAkB;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAyDD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,cAAc,EACd,cAAc,GACf,EAAE,kBAAkB,+BAuEpB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* MeshGraphView — force-directed rendering of the mesh's connection graph (agent-comms#201).
|
|
4
|
+
*
|
|
5
|
+
* Uses d3-force purely for layout: forceSimulation computes node positions, which are then rendered as plain SVG driven by React, not by d3's own DOM manipulation. The simulation is run to convergence synchronously (a fixed tick count, no requestAnimationFrame loop) so a render is a pure function of `graph` -- deterministic, and cheap enough to redo in full whenever the graph changes, matching how the rest of the mesh's live state already re-renders wholesale on every WS-driven refresh rather than patching in place.
|
|
6
|
+
*/
|
|
7
|
+
import { Box, Text } from "@mantine/core";
|
|
8
|
+
import { useMemo } from "react";
|
|
9
|
+
import { forceCenter, forceLink, forceManyBody, forceSimulation, } from "d3-force";
|
|
10
|
+
/** Fixed simulation extent -- the SVG's own viewBox is set to match, so layout is independent of the element's actual rendered size on screen. */
|
|
11
|
+
const LAYOUT_WIDTH = 600;
|
|
12
|
+
const LAYOUT_HEIGHT = 400;
|
|
13
|
+
/** How many ticks to run the simulation before treating it as settled. d3-force's own alphaDecay (default ~0.0228) reaches alpha's minimum (0.001) in ~300 ticks; running a fixed, generous count synchronously is simpler and just as deterministic as watching for convergence, for a graph this small. */
|
|
14
|
+
const SIMULATION_TICKS = 300;
|
|
15
|
+
const NODE_RADIUS = 10;
|
|
16
|
+
/** Length of the truncated device-id hex label shown next to each node -- enough to distinguish devices at a glance without a full 64-character hash crowding the graph. */
|
|
17
|
+
const LABEL_HEX_LENGTH = 8;
|
|
18
|
+
/** Vertical gap between a node's own circle and its label, below NODE_RADIUS. */
|
|
19
|
+
const LABEL_OFFSET = 12;
|
|
20
|
+
function layoutGraph(graph) {
|
|
21
|
+
const nodes = graph.nodes.map((id) => ({ id }));
|
|
22
|
+
const links = graph.edges.map((edge) => ({
|
|
23
|
+
source: edge.from,
|
|
24
|
+
target: edge.to,
|
|
25
|
+
kind: edge.kind,
|
|
26
|
+
}));
|
|
27
|
+
const simulation = forceSimulation(nodes)
|
|
28
|
+
.force("link", forceLink(links).id((node) => node.id))
|
|
29
|
+
.force("charge", forceManyBody())
|
|
30
|
+
.force("center", forceCenter(LAYOUT_WIDTH / 2, LAYOUT_HEIGHT / 2))
|
|
31
|
+
.stop();
|
|
32
|
+
for (let tick = 0; tick < SIMULATION_TICKS; tick++) {
|
|
33
|
+
simulation.tick();
|
|
34
|
+
}
|
|
35
|
+
return { nodes, links };
|
|
36
|
+
}
|
|
37
|
+
/** A force-linked node's own source/target start as the plain device-id strings passed into forceLink's data; forceSimulation mutates them in place into the resolved LaidOutNode objects once the simulation runs. Narrows a link endpoint back to that resolved node so its x/y can be read for rendering. */
|
|
38
|
+
function resolvedNode(endpoint) {
|
|
39
|
+
return typeof endpoint === "object" ? endpoint : undefined;
|
|
40
|
+
}
|
|
41
|
+
export function MeshGraphView({ graph, selectedDevice, onSelectDevice, }) {
|
|
42
|
+
const { nodes, links } = useMemo(() => layoutGraph(graph), [graph]);
|
|
43
|
+
if (nodes.length === 0) {
|
|
44
|
+
return (_jsx(Text, { c: "dimmed", p: "md", children: "No known devices in the mesh graph." }));
|
|
45
|
+
}
|
|
46
|
+
return (_jsx(Box, { p: "md", children: _jsxs("svg", { role: "img", "aria-label": "Mesh connection graph", viewBox: `0 0 ${String(LAYOUT_WIDTH)} ${String(LAYOUT_HEIGHT)}`, width: "100%", style: { maxHeight: LAYOUT_HEIGHT }, children: [links.map((link) => {
|
|
47
|
+
const source = resolvedNode(link.source);
|
|
48
|
+
const target = resolvedNode(link.target);
|
|
49
|
+
if (!source || !target)
|
|
50
|
+
return null;
|
|
51
|
+
return (_jsx("line", { x1: source.x, y1: source.y, x2: target.x, y2: target.y, stroke: "var(--mantine-color-dark-3)", strokeWidth: 1.5, strokeDasharray: link.kind === "relay" ? "4 3" : undefined }, `${source.id}-${target.id}`));
|
|
52
|
+
}), nodes.map((node) => (_jsxs("g", { transform: `translate(${String(node.x ?? 0)}, ${String(node.y ?? 0)})`, onClick: () => {
|
|
53
|
+
onSelectDevice(node.id);
|
|
54
|
+
}, style: { cursor: "pointer" }, role: "button", "aria-label": `Device ${node.id}`, children: [_jsx("circle", { r: NODE_RADIUS, fill: node.id === selectedDevice
|
|
55
|
+
? "var(--mantine-color-accent-5)"
|
|
56
|
+
: "var(--mantine-color-dark-2)", stroke: "var(--mantine-color-accent-5)", strokeWidth: node.id === selectedDevice ? 2 : 0 }), _jsx("text", { y: NODE_RADIUS + LABEL_OFFSET, textAnchor: "middle", fontSize: 10, fill: "var(--mantine-color-text)", children: node.id.slice(0, LABEL_HEX_LENGTH) })] }, node.id)))] }) }));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=MeshGraphView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeshGraphView.js","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/MeshGraphView.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,eAAe,GAGhB,MAAM,UAAU,CAAC;AAiBlB,kJAAkJ;AAClJ,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,6SAA6S;AAC7S,MAAM,gBAAgB,GAAG,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CAAC,EAAE,IAAI,MAAM,CAAC,EAAE,EAAE,CAQhC,CACH,CAAC;gBACJ,CAAC,CAAC,EACD,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,aAEE,SAAS,EAAE,aAAa,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EACtE,OAAO,EAAE,GAAG,EAAE;wBACZ,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAC1B,CAAC,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAC5B,IAAI,EAAC,QAAQ,gBACD,UAAU,IAAI,CAAC,EAAE,EAAE,aAE/B,iBACE,CAAC,EAAE,WAAW,EACd,IAAI,EACF,IAAI,CAAC,EAAE,KAAK,cAAc;gCACxB,CAAC,CAAC,+BAA+B;gCACjC,CAAC,CAAC,6BAA6B,EAEnC,MAAM,EAAC,+BAA+B,EACtC,WAAW,EAAE,IAAI,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC/C,EACF,eACE,CAAC,EAAE,WAAW,GAAG,YAAY,EAC7B,UAAU,EAAC,QAAQ,EACnB,QAAQ,EAAE,EAAE,EACZ,IAAI,EAAC,2BAA2B,YAE/B,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAC9B,KA1BF,IAAI,CAAC,EAAE,CA2BV,CACL,CAAC,IACE,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MeshPanel — the mesh view: connection graph plus path-trace (agent-comms#201).
|
|
3
|
+
*
|
|
4
|
+
* Owns the trace request lifecycle (loading/error/result) since it's a genuine on-demand network round trip, not reactive state the way agents/rooms/the graph itself are. Clicking a node in the graph selects it as the trace target, so the two sub-views share one selection.
|
|
5
|
+
*/
|
|
6
|
+
import type { MeshGraph } from "../types.js";
|
|
7
|
+
interface MeshPanelProps {
|
|
8
|
+
graph: MeshGraph | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function MeshPanel({ graph }: MeshPanelProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=MeshPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeshPanel.d.ts","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/MeshPanel.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAI9D,UAAU,cAAc;IACtB,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;CAC9B;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,cAAc,+BA6DlD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* MeshPanel — the mesh view: connection graph plus path-trace (agent-comms#201).
|
|
4
|
+
*
|
|
5
|
+
* Owns the trace request lifecycle (loading/error/result) since it's a genuine on-demand network round trip, not reactive state the way agents/rooms/the graph itself are. Clicking a node in the graph selects it as the trace target, so the two sub-views share one selection.
|
|
6
|
+
*/
|
|
7
|
+
import { Stack, Tabs, Text } from "@mantine/core";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { fetchMeshTrace } from "../api.js";
|
|
10
|
+
import { MeshGraphView } from "./MeshGraphView.js";
|
|
11
|
+
import { MeshTraceView } from "./MeshTraceView.js";
|
|
12
|
+
export function MeshPanel({ graph }) {
|
|
13
|
+
const [selectedTarget, setSelectedTarget] = useState(undefined);
|
|
14
|
+
const [loading, setLoading] = useState(false);
|
|
15
|
+
const [error, setError] = useState(undefined);
|
|
16
|
+
const [result, setResult] = useState(undefined);
|
|
17
|
+
function handleTrace() {
|
|
18
|
+
if (selectedTarget === undefined)
|
|
19
|
+
return;
|
|
20
|
+
setLoading(true);
|
|
21
|
+
setError(undefined);
|
|
22
|
+
setResult(undefined);
|
|
23
|
+
fetchMeshTrace(selectedTarget)
|
|
24
|
+
.then((traceResult) => {
|
|
25
|
+
setResult(traceResult);
|
|
26
|
+
})
|
|
27
|
+
.catch((err) => {
|
|
28
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
29
|
+
})
|
|
30
|
+
.finally(() => {
|
|
31
|
+
setLoading(false);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (graph === undefined) {
|
|
35
|
+
return (_jsx(Text, { c: "dimmed", p: "md", children: "Mesh graph is not available on this connection." }));
|
|
36
|
+
}
|
|
37
|
+
return (_jsxs(Tabs, { defaultValue: "graph", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Tab, { value: "graph", children: "Graph" }), _jsx(Tabs.Tab, { value: "trace", children: "Trace" })] }), _jsx(Tabs.Panel, { value: "graph", children: _jsx(MeshGraphView, { graph: graph, selectedDevice: selectedTarget, onSelectDevice: setSelectedTarget }) }), _jsx(Tabs.Panel, { value: "trace", children: _jsx(Stack, { children: _jsx(MeshTraceView, { targets: graph.nodes, selectedTarget: selectedTarget, onSelectTarget: setSelectedTarget, onTrace: handleTrace, loading: loading, error: error, result: result }) }) })] }));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=MeshPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeshPanel.js","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/MeshPanel.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,WA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CACL,MAAC,IAAI,IAAC,YAAY,EAAC,OAAO,aACxB,MAAC,IAAI,CAAC,IAAI,eACR,KAAC,IAAI,CAAC,GAAG,IAAC,KAAK,EAAC,OAAO,sBAAiB,EACxC,KAAC,IAAI,CAAC,GAAG,IAAC,KAAK,EAAC,OAAO,sBAAiB,IAC9B,EACZ,KAAC,IAAI,CAAC,KAAK,IAAC,KAAK,EAAC,OAAO,YACvB,KAAC,aAAa,IACZ,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,iBAAiB,GACjC,GACS,EACb,KAAC,IAAI,CAAC,KAAK,IAAC,KAAK,EAAC,OAAO,YACvB,KAAC,KAAK,cACJ,KAAC,aAAa,IACZ,OAAO,EAAE,KAAK,CAAC,KAAK,EACpB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,iBAAiB,EACjC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GACd,GACI,GACG,IACR,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MeshTraceView — target picker plus live path-trace result for mesh_trace (agent-comms#201).
|
|
3
|
+
*
|
|
4
|
+
* Purely presentational: the trace itself (a real, on-demand network round trip rather than reactive state) is owned by the parent, which fetches on the "Trace" click and passes the outcome back down. This keeps the component trivially testable without mocking fetch.
|
|
5
|
+
*/
|
|
6
|
+
import type { MeshTraceResult } from "../types.js";
|
|
7
|
+
interface MeshTraceViewProps {
|
|
8
|
+
targets: readonly string[];
|
|
9
|
+
selectedTarget: string | undefined;
|
|
10
|
+
onSelectTarget: (deviceId: string) => void;
|
|
11
|
+
onTrace: () => void;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
error: string | undefined;
|
|
14
|
+
result: MeshTraceResult | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function MeshTraceView({ targets, selectedTarget, onSelectTarget, onTrace, loading, error, result, }: MeshTraceViewProps): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=MeshTraceView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeshTraceView.d.ts","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/MeshTraceView.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC;CACrC;AAcD,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,cAAc,EACd,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,GACP,EAAE,kBAAkB,+BAqDpB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* MeshTraceView — target picker plus live path-trace result for mesh_trace (agent-comms#201).
|
|
4
|
+
*
|
|
5
|
+
* Purely presentational: the trace itself (a real, on-demand network round trip rather than reactive state) is owned by the parent, which fetches on the "Trace" click and passes the outcome back down. This keeps the component trivially testable without mocking fetch.
|
|
6
|
+
*/
|
|
7
|
+
import { Badge, Button, Group, Select, Stack, Text } from "@mantine/core";
|
|
8
|
+
/** Length of the truncated device-id hex label shown in the target picker -- matches MeshGraphView's own node-label truncation. */
|
|
9
|
+
const LABEL_HEX_LENGTH = 8;
|
|
10
|
+
function describeSide(side) {
|
|
11
|
+
if (!side.relayed)
|
|
12
|
+
return "direct";
|
|
13
|
+
return side.hubAddress !== undefined
|
|
14
|
+
? `relayed via ${side.hubAddress}`
|
|
15
|
+
: "relayed";
|
|
16
|
+
}
|
|
17
|
+
export function MeshTraceView({ targets, selectedTarget, onSelectTarget, onTrace, loading, error, result, }) {
|
|
18
|
+
const options = targets.map((id) => ({
|
|
19
|
+
value: id,
|
|
20
|
+
label: id.slice(0, LABEL_HEX_LENGTH),
|
|
21
|
+
}));
|
|
22
|
+
return (_jsxs(Stack, { p: "md", gap: "sm", children: [_jsxs(Group, { align: "flex-end", gap: "xs", children: [_jsx(Select, { label: "Target device", placeholder: "Choose a device", size: "xs", data: options, value: selectedTarget ?? null, onChange: (value) => {
|
|
23
|
+
if (value !== null)
|
|
24
|
+
onSelectTarget(value);
|
|
25
|
+
} }), _jsx(Button, { size: "xs", disabled: selectedTarget === undefined || loading, loading: loading, onClick: onTrace, children: "Trace" })] }), error !== undefined && _jsx(Text, { c: "red", children: error }), result !== undefined && (_jsxs(Stack, { gap: 4, children: [_jsxs(Group, { gap: "xs", children: [_jsx(Badge, { color: result.outcome.result === "ok" ? "green" : "red", children: result.outcome.result === "ok"
|
|
26
|
+
? "ok"
|
|
27
|
+
: (result.outcome.code ?? "error") }), _jsxs(Text, { size: "sm", children: [result.rttMs, "ms round trip"] })] }), _jsxs(Text, { size: "sm", c: "dimmed", children: ["Local: ", describeSide(result.local)] }), result.remote !== undefined && (_jsxs(Text, { size: "sm", c: "dimmed", children: ["Remote: ", describeSide(result.remote)] }))] }))] }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=MeshTraceView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeshTraceView.js","sourceRoot":"","sources":["../../../../../../src/bridges/user/web/frontend/components/MeshTraceView.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAA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,IACH,EAEP,KAAK,KAAK,SAAS,IAAI,KAAC,IAAI,IAAC,CAAC,EAAC,KAAK,YAAE,KAAK,GAAQ,EAEnD,MAAM,KAAK,SAAS,IAAI,CACvB,MAAC,KAAK,IAAC,GAAG,EAAE,CAAC,aACX,MAAC,KAAK,IAAC,GAAG,EAAC,IAAI,aACb,KAAC,KAAK,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,YAC3D,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI;oCAC7B,CAAC,CAAC,IAAI;oCACN,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,GAC9B,EACR,MAAC,IAAI,IAAC,IAAI,EAAC,IAAI,aAAE,MAAM,CAAC,KAAK,qBAAqB,IAC5C,EACR,MAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,CAAC,EAAC,QAAQ,wBAChB,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,IAC7B,EACN,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,CAC9B,MAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,CAAC,EAAC,QAAQ,yBACf,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,IAC/B,CACR,IACK,CACT,IACK,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { createRoot } from "react-dom/client";
|
|
|
9
9
|
import { MantineProvider } from "@mantine/core";
|
|
10
10
|
import { useEffect } from "react";
|
|
11
11
|
import { App } from "./components/App.js";
|
|
12
|
-
import { CommsWs, fetchAgents, fetchRoomMessages, fetchRooms } from "./api.js";
|
|
12
|
+
import { CommsWs, fetchAgents, fetchMeshGraph, fetchRoomMessages, fetchRooms, } from "./api.js";
|
|
13
13
|
import { parseInput, routeAction } from "./input.js";
|
|
14
14
|
import { State } from "./state.js";
|
|
15
15
|
import { useClientState } from "./use-client-state.js";
|
|
@@ -120,6 +120,16 @@ async function refreshState() {
|
|
|
120
120
|
const [agents, rooms] = await Promise.all([fetchAgents(), fetchRooms()]);
|
|
121
121
|
state.setAgents(agents);
|
|
122
122
|
state.setRooms(rooms);
|
|
123
|
+
await refreshMeshGraph();
|
|
124
|
+
}
|
|
125
|
+
/** Refreshes the mesh's connection graph on the same triggers refreshState already reacts to (agent-comms#201) -- a failure here (most commonly this bridge running on a FileStore rather than a real mesh transport, so mesh_graph simply isn't supported) leaves state.meshGraph as it was rather than breaking the agents/rooms refresh it rides alongside. */
|
|
126
|
+
async function refreshMeshGraph() {
|
|
127
|
+
try {
|
|
128
|
+
state.setMeshGraph(await fetchMeshGraph());
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// Not mesh-backed, or the transport doesn't support mesh_graph -- leave meshGraph unset.
|
|
132
|
+
}
|
|
123
133
|
}
|
|
124
134
|
async function onJoinRoom(roomId) {
|
|
125
135
|
state.setDmTarget(undefined);
|
|
@@ -205,7 +215,7 @@ function Root() {
|
|
|
205
215
|
useEffect(() => {
|
|
206
216
|
syncUrl({ currentRoom: s.currentRoom, dmTarget: s.dmTarget });
|
|
207
217
|
}, [s.currentRoom, s.dmTarget]);
|
|
208
|
-
return (_jsx(App, { rooms: s.rooms, agents: s.agents, currentRoom: s.currentRoom, dmTarget: s.dmTarget, messages: s.messages, connected: s.connected, onJoinRoom: (roomId) => {
|
|
218
|
+
return (_jsx(App, { rooms: s.rooms, agents: s.agents, currentRoom: s.currentRoom, dmTarget: s.dmTarget, messages: s.messages, connected: s.connected, meshGraph: s.meshGraph, onJoinRoom: (roomId) => {
|
|
209
219
|
void onJoinRoom(roomId);
|
|
210
220
|
}, onSelectAgent: onSelectAgent, onRenameAgent: onRenameAgent, onLeaveRoom: onLeaveRoom, onSendAction: handleSendAction, onCreateRoom: onCreateRoom, onJoinRoomInput: onJoinRoomInput, onConnectToMesh: onConnectToMesh }));
|
|
211
221
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/main.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,aAAa,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/main.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,aAAa,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,UAAU,GACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACvD,cAAc,CAAC,WAA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CAAC,CAAC;YACnC,MAAM;QACR,KAAK,IAAI;YACP,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACjC,MAAM;IACV,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* No DOM dependency. Testable in isolation.
|
|
5
5
|
* Consumers subscribe to changes and re-render as needed.
|
|
6
6
|
*/
|
|
7
|
-
import type { Agent, DisplayMessage, Room } from "./types.js";
|
|
7
|
+
import type { Agent, DisplayMessage, MeshGraph, Room } from "./types.js";
|
|
8
8
|
export type StateChangeListener = (state: Readonly<ClientState>) => void;
|
|
9
9
|
export interface ClientState {
|
|
10
10
|
currentRoom: string | undefined;
|
|
@@ -13,6 +13,8 @@ export interface ClientState {
|
|
|
13
13
|
rooms: readonly Room[];
|
|
14
14
|
messages: readonly DisplayMessage[];
|
|
15
15
|
connected: boolean;
|
|
16
|
+
/** The mesh's connection graph (agent-comms#199/#201), refreshed on the same WS-driven triggers as agents/rooms. Undefined until the first successful fetch, or when this bridge isn't mesh-backed. */
|
|
17
|
+
meshGraph: MeshGraph | undefined;
|
|
16
18
|
}
|
|
17
19
|
export declare class State {
|
|
18
20
|
private state;
|
|
@@ -26,6 +28,7 @@ export declare class State {
|
|
|
26
28
|
setAgents(agents: readonly Agent[]): void;
|
|
27
29
|
setRooms(rooms: readonly Room[]): void;
|
|
28
30
|
setConnected(connected: boolean): void;
|
|
31
|
+
setMeshGraph(meshGraph: MeshGraph): void;
|
|
29
32
|
/** Add a display message to the message list. */
|
|
30
33
|
addMessage(message: DisplayMessage): void;
|
|
31
34
|
/** Replace all messages (e.g. when loading history). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,YAAY,CAA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,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAKzC,wDAAwD;IACxD,WAAW,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,IAAI;IAKtD,0BAA0B;IAC1B,aAAa,IAAI,IAAI;IAKrB,8DAA8D;IAC9D,UAAU,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI;IAKlE,8BAA8B;IAC9B,KAAK,IAAI,IAAI;IASb,OAAO,CAAC,MAAM;CAMf"}
|
|
@@ -11,6 +11,7 @@ const INITIAL_STATE = {
|
|
|
11
11
|
rooms: [],
|
|
12
12
|
messages: [],
|
|
13
13
|
connected: false,
|
|
14
|
+
meshGraph: undefined,
|
|
14
15
|
};
|
|
15
16
|
export class State {
|
|
16
17
|
state = { ...INITIAL_STATE };
|
|
@@ -49,6 +50,10 @@ export class State {
|
|
|
49
50
|
this.state = { ...this.state, connected };
|
|
50
51
|
this.notify();
|
|
51
52
|
}
|
|
53
|
+
setMeshGraph(meshGraph) {
|
|
54
|
+
this.state = { ...this.state, meshGraph };
|
|
55
|
+
this.notify();
|
|
56
|
+
}
|
|
52
57
|
/** Add a display message to the message list. */
|
|
53
58
|
addMessage(message) {
|
|
54
59
|
this.state = { ...this.state, messages: [...this.state.messages, message] };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,MAAM,aAAa,GAAgB;IACjC,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;IACZ,SAAS,EAAE,KAAK;IAChB,S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,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -177,6 +177,34 @@ export type DisplayMessage = {
|
|
|
177
177
|
type: "status";
|
|
178
178
|
text: string;
|
|
179
179
|
};
|
|
180
|
+
export interface MeshGraphEdge {
|
|
181
|
+
kind: "direct" | "relay";
|
|
182
|
+
from: string;
|
|
183
|
+
to: string;
|
|
184
|
+
via?: string;
|
|
185
|
+
}
|
|
186
|
+
export interface MeshGraph {
|
|
187
|
+
nodes: string[];
|
|
188
|
+
edges: MeshGraphEdge[];
|
|
189
|
+
}
|
|
190
|
+
export interface MeshTraceLocal {
|
|
191
|
+
relayed: boolean;
|
|
192
|
+
hubAddress?: string;
|
|
193
|
+
}
|
|
194
|
+
export interface MeshTraceRemote {
|
|
195
|
+
relayed: boolean;
|
|
196
|
+
hubAddress?: string;
|
|
197
|
+
}
|
|
198
|
+
export interface MeshTraceOutcome {
|
|
199
|
+
result: "ok" | "error";
|
|
200
|
+
code?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface MeshTraceResult {
|
|
203
|
+
rttMs: number;
|
|
204
|
+
local: MeshTraceLocal;
|
|
205
|
+
remote?: MeshTraceRemote;
|
|
206
|
+
outcome: MeshTraceOutcome;
|
|
207
|
+
}
|
|
180
208
|
export type AgentsResponse = Agent[];
|
|
181
209
|
export type RoomsResponse = Room[];
|
|
182
210
|
export type MessagesResponse = RoomMessage[];
|