agent-comms 1.12.0 → 1.14.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/plugin.json +1 -1
- package/README.md +1 -1
- package/dist/bridges/pi/index.d.ts +5 -2
- package/dist/bridges/pi/index.d.ts.map +1 -1
- package/dist/bridges/pi/index.js +118 -7
- package/dist/bridges/pi/index.js.map +1 -1
- package/dist/bridges/user/controller.d.ts +1 -0
- package/dist/bridges/user/controller.d.ts.map +1 -1
- package/dist/bridges/user/controller.js +12 -0
- package/dist/bridges/user/controller.js.map +1 -1
- package/dist/bridges/user/tui.js +2 -0
- package/dist/bridges/user/tui.js.map +1 -1
- package/dist/bridges/user/web/build.d.ts +10 -0
- package/dist/bridges/user/web/build.d.ts.map +1 -0
- package/dist/bridges/user/web/build.js +58 -0
- package/dist/bridges/user/web/build.js.map +1 -0
- package/dist/bridges/user/web/frontend/api.d.ts +29 -0
- package/dist/bridges/user/web/frontend/api.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/api.js +121 -0
- package/dist/bridges/user/web/frontend/api.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/App.d.ts +23 -0
- package/dist/bridges/user/web/frontend/components/App.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/App.js +7 -0
- package/dist/bridges/user/web/frontend/components/App.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/ChatArea.d.ts +14 -0
- package/dist/bridges/user/web/frontend/components/ChatArea.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/ChatArea.js +38 -0
- package/dist/bridges/user/web/frontend/components/ChatArea.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/CreateRoomForm.d.ts +11 -0
- package/dist/bridges/user/web/frontend/components/CreateRoomForm.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/CreateRoomForm.js +33 -0
- package/dist/bridges/user/web/frontend/components/CreateRoomForm.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/JoinForm.d.ts +11 -0
- package/dist/bridges/user/web/frontend/components/JoinForm.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/JoinForm.js +28 -0
- package/dist/bridges/user/web/frontend/components/JoinForm.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/Message.d.ts +8 -0
- package/dist/bridges/user/web/frontend/components/Message.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/Message.js +15 -0
- package/dist/bridges/user/web/frontend/components/Message.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/MessageList.d.ts +8 -0
- package/dist/bridges/user/web/frontend/components/MessageList.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/MessageList.js +16 -0
- package/dist/bridges/user/web/frontend/components/MessageList.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/ProjectTree.d.ts +17 -0
- package/dist/bridges/user/web/frontend/components/ProjectTree.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/ProjectTree.js +59 -0
- package/dist/bridges/user/web/frontend/components/ProjectTree.js.map +1 -0
- package/dist/bridges/user/web/frontend/components/Sidebar.d.ts +16 -0
- package/dist/bridges/user/web/frontend/components/Sidebar.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/components/Sidebar.js +31 -0
- package/dist/bridges/user/web/frontend/components/Sidebar.js.map +1 -0
- package/dist/bridges/user/web/frontend/dom.d.ts +28 -0
- package/dist/bridges/user/web/frontend/dom.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/dom.js +46 -0
- package/dist/bridges/user/web/frontend/dom.js.map +1 -0
- package/dist/bridges/user/web/frontend/input.d.ts +37 -0
- package/dist/bridges/user/web/frontend/input.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/input.js +167 -0
- package/dist/bridges/user/web/frontend/input.js.map +1 -0
- package/dist/bridges/user/web/frontend/main.d.ts +8 -0
- package/dist/bridges/user/web/frontend/main.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/main.js +156 -0
- package/dist/bridges/user/web/frontend/main.js.map +1 -0
- package/dist/bridges/user/web/frontend/messages.d.ts +17 -0
- package/dist/bridges/user/web/frontend/messages.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/messages.js +82 -0
- package/dist/bridges/user/web/frontend/messages.js.map +1 -0
- package/dist/bridges/user/web/frontend/project-tree.d.ts +9 -0
- package/dist/bridges/user/web/frontend/project-tree.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/project-tree.js +173 -0
- package/dist/bridges/user/web/frontend/project-tree.js.map +1 -0
- package/dist/bridges/user/web/frontend/state.d.ts +41 -0
- package/dist/bridges/user/web/frontend/state.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/state.js +87 -0
- package/dist/bridges/user/web/frontend/state.js.map +1 -0
- package/dist/bridges/user/web/frontend/types.d.ts +209 -0
- package/dist/bridges/user/web/frontend/types.d.ts.map +1 -0
- package/dist/bridges/user/web/frontend/types.js +8 -0
- package/dist/bridges/user/web/frontend/types.js.map +1 -0
- package/dist/bridges/user/web/generated-html.d.ts +6 -0
- package/dist/bridges/user/web/generated-html.d.ts.map +1 -0
- package/dist/bridges/user/web/generated-html.js +179 -0
- package/dist/bridges/user/web/generated-html.js.map +1 -0
- package/dist/bridges/user/web/server.d.ts.map +1 -1
- package/dist/bridges/user/web/server.js +26 -3
- package/dist/bridges/user/web/server.js.map +1 -1
- package/dist/bridges/user/web/test/web-server.integration.test.d.ts +7 -0
- package/dist/bridges/user/web/test/web-server.integration.test.d.ts.map +1 -0
- package/dist/bridges/user/web/test/web-server.integration.test.js +187 -0
- package/dist/bridges/user/web/test/web-server.integration.test.js.map +1 -0
- package/dist/core/bridge.d.ts +15 -0
- package/dist/core/bridge.d.ts.map +1 -1
- package/dist/core/bridge.js +60 -0
- package/dist/core/bridge.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/mesh-store.d.ts +3 -0
- package/dist/core/mesh-store.d.ts.map +1 -1
- package/dist/core/mesh-store.js +107 -7
- package/dist/core/mesh-store.js.map +1 -1
- package/dist/core/test/bridge.unit.test.d.ts +5 -0
- package/dist/core/test/bridge.unit.test.d.ts.map +1 -0
- package/dist/core/test/bridge.unit.test.js +120 -0
- package/dist/core/test/bridge.unit.test.js.map +1 -0
- package/dist/core/types.d.ts +10 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +6 -0
- package/dist/core/types.js.map +1 -1
- package/dist/test/{coordinator-socket-error.test.d.ts → coordinator-socket-error.integration.test.d.ts} +1 -1
- package/dist/test/coordinator-socket-error.integration.test.d.ts.map +1 -0
- package/dist/test/{coordinator-socket-error.test.js → coordinator-socket-error.integration.test.js} +1 -1
- package/dist/test/coordinator-socket-error.integration.test.js.map +1 -0
- package/dist/test/{mesh-e2e.test.d.ts → mesh-e2e.integration.test.d.ts} +1 -1
- package/dist/test/mesh-e2e.integration.test.d.ts.map +1 -0
- package/dist/test/{mesh-e2e.test.js → mesh-e2e.integration.test.js} +1 -1
- package/dist/test/mesh-e2e.integration.test.js.map +1 -0
- package/dist/test/{mesh-smoke.test.d.ts → mesh-smoke.integration.test.d.ts} +1 -1
- package/dist/test/mesh-smoke.integration.test.d.ts.map +1 -0
- package/dist/test/{mesh-smoke.test.js → mesh-smoke.integration.test.js} +1 -1
- package/dist/test/mesh-smoke.integration.test.js.map +1 -0
- package/package.json +11 -4
- package/dist/bridges/user/web/index.html.d.ts +0 -8
- package/dist/bridges/user/web/index.html.d.ts.map +0 -1
- package/dist/bridges/user/web/index.html.js +0 -391
- package/dist/bridges/user/web/index.html.js.map +0 -1
- package/dist/test/coordinator-socket-error.test.d.ts.map +0 -1
- package/dist/test/coordinator-socket-error.test.js.map +0 -1
- package/dist/test/mesh-e2e.test.d.ts.map +0 -1
- package/dist/test/mesh-e2e.test.js.map +0 -1
- package/dist/test/mesh-smoke.test.d.ts.map +0 -1
- package/dist/test/mesh-smoke.test.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client state — minimal observable state for the UI.
|
|
3
|
+
*
|
|
4
|
+
* No DOM dependency. Testable in isolation.
|
|
5
|
+
* Consumers subscribe to changes and re-render as needed.
|
|
6
|
+
*/
|
|
7
|
+
import type { Agent, DisplayMessage, Room } from "./types.js";
|
|
8
|
+
export type StateChangeListener = (state: Readonly<ClientState>) => void;
|
|
9
|
+
export interface ClientState {
|
|
10
|
+
currentRoom: string | undefined;
|
|
11
|
+
dmTarget: string | undefined;
|
|
12
|
+
agents: Agent[];
|
|
13
|
+
rooms: Room[];
|
|
14
|
+
messages: DisplayMessage[];
|
|
15
|
+
connected: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class State {
|
|
18
|
+
private state;
|
|
19
|
+
private readonly listeners;
|
|
20
|
+
/** Subscribe to state changes. Returns an unsubscribe function. */
|
|
21
|
+
subscribe(listener: StateChangeListener): () => void;
|
|
22
|
+
/** Read the current state (shallow copy). */
|
|
23
|
+
get(): Readonly<ClientState>;
|
|
24
|
+
setCurrentRoom(roomId: string | undefined): void;
|
|
25
|
+
setDmTarget(agentId: string | undefined): void;
|
|
26
|
+
setAgents(agents: Agent[]): void;
|
|
27
|
+
setRooms(rooms: Room[]): void;
|
|
28
|
+
setConnected(connected: boolean): void;
|
|
29
|
+
/** Add a display message to the message list. */
|
|
30
|
+
addMessage(message: DisplayMessage): void;
|
|
31
|
+
/** Replace all messages (e.g. when loading history). */
|
|
32
|
+
setMessages(messages: DisplayMessage[]): void;
|
|
33
|
+
/** Clear all messages. */
|
|
34
|
+
clearMessages(): void;
|
|
35
|
+
/** Bulk update from a state frame (initial WS connection). */
|
|
36
|
+
applyState(agents: Agent[], rooms: Room[]): void;
|
|
37
|
+
/** Reset to initial state. */
|
|
38
|
+
reset(): void;
|
|
39
|
+
private notify;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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8DAA8D;IAC9D,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAKhD,8BAA8B;IAC9B,KAAK,IAAI,IAAI;IASb,OAAO,CAAC,MAAM;CAMf"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client state — minimal observable state for the UI.
|
|
3
|
+
*
|
|
4
|
+
* No DOM dependency. Testable in isolation.
|
|
5
|
+
* Consumers subscribe to changes and re-render as needed.
|
|
6
|
+
*/
|
|
7
|
+
const INITIAL_STATE = {
|
|
8
|
+
currentRoom: undefined,
|
|
9
|
+
dmTarget: undefined,
|
|
10
|
+
agents: [],
|
|
11
|
+
rooms: [],
|
|
12
|
+
messages: [],
|
|
13
|
+
connected: false,
|
|
14
|
+
};
|
|
15
|
+
export class State {
|
|
16
|
+
state = { ...INITIAL_STATE };
|
|
17
|
+
listeners = new Set();
|
|
18
|
+
/** Subscribe to state changes. Returns an unsubscribe function. */
|
|
19
|
+
subscribe(listener) {
|
|
20
|
+
this.listeners.add(listener);
|
|
21
|
+
return () => {
|
|
22
|
+
this.listeners.delete(listener);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Read the current state (shallow copy). */
|
|
26
|
+
get() {
|
|
27
|
+
return this.state;
|
|
28
|
+
}
|
|
29
|
+
// -----------------------------------------------------------------------
|
|
30
|
+
// Mutations — each notifies listeners
|
|
31
|
+
// -----------------------------------------------------------------------
|
|
32
|
+
setCurrentRoom(roomId) {
|
|
33
|
+
this.state = { ...this.state, currentRoom: roomId };
|
|
34
|
+
this.notify();
|
|
35
|
+
}
|
|
36
|
+
setDmTarget(agentId) {
|
|
37
|
+
this.state = { ...this.state, dmTarget: agentId };
|
|
38
|
+
this.notify();
|
|
39
|
+
}
|
|
40
|
+
setAgents(agents) {
|
|
41
|
+
this.state = { ...this.state, agents };
|
|
42
|
+
this.notify();
|
|
43
|
+
}
|
|
44
|
+
setRooms(rooms) {
|
|
45
|
+
this.state = { ...this.state, rooms };
|
|
46
|
+
this.notify();
|
|
47
|
+
}
|
|
48
|
+
setConnected(connected) {
|
|
49
|
+
this.state = { ...this.state, connected };
|
|
50
|
+
this.notify();
|
|
51
|
+
}
|
|
52
|
+
/** Add a display message to the message list. */
|
|
53
|
+
addMessage(message) {
|
|
54
|
+
this.state = { ...this.state, messages: [...this.state.messages, message] };
|
|
55
|
+
this.notify();
|
|
56
|
+
}
|
|
57
|
+
/** Replace all messages (e.g. when loading history). */
|
|
58
|
+
setMessages(messages) {
|
|
59
|
+
this.state = { ...this.state, messages };
|
|
60
|
+
this.notify();
|
|
61
|
+
}
|
|
62
|
+
/** Clear all messages. */
|
|
63
|
+
clearMessages() {
|
|
64
|
+
this.state = { ...this.state, messages: [] };
|
|
65
|
+
this.notify();
|
|
66
|
+
}
|
|
67
|
+
/** Bulk update from a state frame (initial WS connection). */
|
|
68
|
+
applyState(agents, rooms) {
|
|
69
|
+
this.state = { ...this.state, agents, rooms };
|
|
70
|
+
this.notify();
|
|
71
|
+
}
|
|
72
|
+
/** Reset to initial state. */
|
|
73
|
+
reset() {
|
|
74
|
+
this.state = { ...INITIAL_STATE, messages: [] };
|
|
75
|
+
this.notify();
|
|
76
|
+
}
|
|
77
|
+
// -----------------------------------------------------------------------
|
|
78
|
+
// Internal
|
|
79
|
+
// -----------------------------------------------------------------------
|
|
80
|
+
notify() {
|
|
81
|
+
const snapshot = this.state;
|
|
82
|
+
for (const listener of this.listeners) {
|
|
83
|
+
listener(snapshot);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,MAAM,aAAa,GAAgB;IACjC,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,SAA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AE,CAAC;YACtC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side types for the agent-comms web UI.
|
|
3
|
+
*
|
|
4
|
+
* These mirror the wire format from server.ts and core/types.ts.
|
|
5
|
+
* No Zod — just interfaces for the browser bundle.
|
|
6
|
+
*/
|
|
7
|
+
export interface Agent {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
harness: string;
|
|
11
|
+
cwd: string;
|
|
12
|
+
pid: number;
|
|
13
|
+
startedAt: string;
|
|
14
|
+
visibility: "visible" | "hidden" | "ghost";
|
|
15
|
+
status: "active" | "idle" | "busy" | "offline";
|
|
16
|
+
tags: string[];
|
|
17
|
+
subscribedRooms: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface Room {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
type: "public" | "private" | "secret";
|
|
23
|
+
owner: string;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
description: string;
|
|
26
|
+
members: string[];
|
|
27
|
+
invited: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface RoomMessage {
|
|
30
|
+
id: string;
|
|
31
|
+
from: string;
|
|
32
|
+
room: string;
|
|
33
|
+
content: string;
|
|
34
|
+
timestamp: string;
|
|
35
|
+
replyTo?: string;
|
|
36
|
+
readBy: string[];
|
|
37
|
+
}
|
|
38
|
+
export interface DmMessage {
|
|
39
|
+
id: string;
|
|
40
|
+
from: string;
|
|
41
|
+
to: string;
|
|
42
|
+
content: string;
|
|
43
|
+
timestamp: string;
|
|
44
|
+
readBy: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface RoomMember {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
status: Agent["status"];
|
|
50
|
+
}
|
|
51
|
+
export type DeliveryEvent = {
|
|
52
|
+
type: "room_message";
|
|
53
|
+
message: RoomMessage;
|
|
54
|
+
} | {
|
|
55
|
+
type: "dm";
|
|
56
|
+
message: DmMessage;
|
|
57
|
+
} | {
|
|
58
|
+
type: "room_invite";
|
|
59
|
+
room: string;
|
|
60
|
+
roomDescription: string;
|
|
61
|
+
from: string;
|
|
62
|
+
fromName: string;
|
|
63
|
+
fromCwd: string;
|
|
64
|
+
} | {
|
|
65
|
+
type: "member_joined";
|
|
66
|
+
room: string;
|
|
67
|
+
agent: string;
|
|
68
|
+
} | {
|
|
69
|
+
type: "member_left";
|
|
70
|
+
room: string;
|
|
71
|
+
agent: string;
|
|
72
|
+
} | {
|
|
73
|
+
type: "room_members";
|
|
74
|
+
room: string;
|
|
75
|
+
members: RoomMember[];
|
|
76
|
+
} | {
|
|
77
|
+
type: "member_status";
|
|
78
|
+
room: string;
|
|
79
|
+
agent: string;
|
|
80
|
+
status: Agent["status"];
|
|
81
|
+
} | {
|
|
82
|
+
type: "delivery_status";
|
|
83
|
+
messageId: string;
|
|
84
|
+
agent: string;
|
|
85
|
+
status: "delivered" | "read";
|
|
86
|
+
room?: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: "invite_declined";
|
|
89
|
+
room: string;
|
|
90
|
+
agent: string;
|
|
91
|
+
agentName: string;
|
|
92
|
+
reason: string;
|
|
93
|
+
} | {
|
|
94
|
+
type: "name_changed";
|
|
95
|
+
agent: string;
|
|
96
|
+
oldName: string;
|
|
97
|
+
newName: string;
|
|
98
|
+
};
|
|
99
|
+
export type WsFrame = {
|
|
100
|
+
type: "delivery";
|
|
101
|
+
event: DeliveryEvent;
|
|
102
|
+
} | {
|
|
103
|
+
type: "result";
|
|
104
|
+
result: ActionResult;
|
|
105
|
+
} | {
|
|
106
|
+
type: "error";
|
|
107
|
+
message: string;
|
|
108
|
+
} | {
|
|
109
|
+
type: "state";
|
|
110
|
+
agents: Agent[];
|
|
111
|
+
rooms: Room[];
|
|
112
|
+
};
|
|
113
|
+
export type Action = {
|
|
114
|
+
action: "send";
|
|
115
|
+
target: string;
|
|
116
|
+
content: string;
|
|
117
|
+
} | {
|
|
118
|
+
action: "dm";
|
|
119
|
+
target: string;
|
|
120
|
+
content: string;
|
|
121
|
+
} | {
|
|
122
|
+
action: "join_room";
|
|
123
|
+
room: string;
|
|
124
|
+
} | {
|
|
125
|
+
action: "leave_room";
|
|
126
|
+
room: string;
|
|
127
|
+
} | {
|
|
128
|
+
action: "create_room";
|
|
129
|
+
name: string;
|
|
130
|
+
type: "public" | "private" | "secret";
|
|
131
|
+
description?: string;
|
|
132
|
+
} | {
|
|
133
|
+
action: "list_rooms";
|
|
134
|
+
} | {
|
|
135
|
+
action: "list_agents";
|
|
136
|
+
} | {
|
|
137
|
+
action: "read_room";
|
|
138
|
+
room: string;
|
|
139
|
+
} | {
|
|
140
|
+
action: "destroy_room";
|
|
141
|
+
room: string;
|
|
142
|
+
} | {
|
|
143
|
+
action: "invite";
|
|
144
|
+
room: string;
|
|
145
|
+
agent: string;
|
|
146
|
+
} | {
|
|
147
|
+
action: "decline_invite";
|
|
148
|
+
room: string;
|
|
149
|
+
reason: string;
|
|
150
|
+
} | {
|
|
151
|
+
action: "kick";
|
|
152
|
+
room: string;
|
|
153
|
+
agent: string;
|
|
154
|
+
} | {
|
|
155
|
+
action: "rename_agent";
|
|
156
|
+
agent: string;
|
|
157
|
+
name: string;
|
|
158
|
+
};
|
|
159
|
+
export interface ActionResult {
|
|
160
|
+
content: string;
|
|
161
|
+
isError: boolean;
|
|
162
|
+
}
|
|
163
|
+
export type DisplayMessage = {
|
|
164
|
+
type: "chat";
|
|
165
|
+
sender: string;
|
|
166
|
+
content: string;
|
|
167
|
+
timestamp: string;
|
|
168
|
+
} | {
|
|
169
|
+
type: "dm";
|
|
170
|
+
sender: string;
|
|
171
|
+
content: string;
|
|
172
|
+
timestamp: string;
|
|
173
|
+
} | {
|
|
174
|
+
type: "system";
|
|
175
|
+
text: string;
|
|
176
|
+
} | {
|
|
177
|
+
type: "status";
|
|
178
|
+
text: string;
|
|
179
|
+
};
|
|
180
|
+
export type AgentsResponse = Agent[];
|
|
181
|
+
export type RoomsResponse = Room[];
|
|
182
|
+
export type MessagesResponse = RoomMessage[];
|
|
183
|
+
/** A directory node in the project tree. Contains child directories and agents. */
|
|
184
|
+
export interface DirectoryNode {
|
|
185
|
+
type: "directory";
|
|
186
|
+
/** Directory basename (e.g. "agent-comms") */
|
|
187
|
+
name: string;
|
|
188
|
+
/** Full absolute path */
|
|
189
|
+
path: string;
|
|
190
|
+
/** Project room ID if a room exists for this directory */
|
|
191
|
+
roomId?: string;
|
|
192
|
+
children: TreeNode[];
|
|
193
|
+
}
|
|
194
|
+
/** An agent leaf node in the project tree. */
|
|
195
|
+
export interface AgentNode {
|
|
196
|
+
type: "agent";
|
|
197
|
+
name: string;
|
|
198
|
+
agentId: string;
|
|
199
|
+
status: Agent["status"];
|
|
200
|
+
cwd: string;
|
|
201
|
+
}
|
|
202
|
+
export type TreeNode = DirectoryNode | AgentNode;
|
|
203
|
+
/** The full project tree with manually-created rooms separated out. */
|
|
204
|
+
export interface ProjectTree {
|
|
205
|
+
roots: TreeNode[];
|
|
206
|
+
/** Rooms not auto-created per cwd */
|
|
207
|
+
manualRooms: Room[];
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC3C,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,G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AC,QAAQ,CAAC,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC;AAEjD,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,qCAAqC;IACrC,WAAW,EAAE,IAAI,EAAE,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — do not edit.
|
|
3
|
+
* Rebuild with: pnpm build:frontend
|
|
4
|
+
*/
|
|
5
|
+
export declare const FRONTEND_HTML = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Agent Comms</title>\n</head>\n<body>\n\n<div id=\"sidebar\">\n <h2>Agent Comms</h2>\n <div class=\"sidebar-section\">\n <h3>Rooms</h3>\n <div id=\"room-list\"></div>\n <h3>Agents</h3>\n <div id=\"agent-list\"></div>\n </div>\n</div>\n\n<div id=\"main\">\n <div id=\"header\">Select a room</div>\n <div id=\"messages\"></div>\n <div id=\"input-bar\">\n <input id=\"input\" type=\"text\" placeholder=\"Type a message or /command...\" autocomplete=\"off\" />\n <button id=\"send-btn\">Send</button>\n </div>\n</div>\n\n <script>\n\"use strict\";(()=>{var O=Object.defineProperty;var U=(e,n,t)=>n in e?O(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var m=(e,n,t)=>U(e,typeof n!=\"symbol\"?n+\"\":n,t);document.head.appendChild(Object.assign(document.createElement(\"style\"),{textContent:`:root {\n --bg: #1a1a2e;\n --surface: #16213e;\n --border: #0f3460;\n --text: #e4e4e4;\n --dim: #888;\n --accent: #00b4d8;\n --green: #06d6a0;\n --red: #ef476f;\n --yellow: #ffd166;\n --purple: #b5838d;\n}\n* { margin: 0; padding: 0; box-sizing: border-box; }\nbody {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n background: var(--bg);\n color: var(--text);\n height: 100vh;\n display: flex;\n}\n#sidebar {\n width: 260px;\n background: var(--surface);\n border-right: 1px solid var(--border);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n#sidebar h2 {\n padding: 12px 16px;\n font-size: 14px;\n color: var(--accent);\n border-bottom: 1px solid var(--border);\n}\n.sidebar-section {\n flex: 1;\n overflow-y: auto;\n padding: 8px;\n}\n.sidebar-section h3 {\n font-size: 11px;\n text-transform: uppercase;\n color: var(--dim);\n padding: 8px 8px 4px;\n}\n.room-item, .agent-item {\n padding: 6px 10px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 13px;\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.room-item:hover, .agent-item:hover { background: rgba(255,255,255,0.05); }\n.room-item.active { background: var(--border); }\n.status-dot {\n width: 8px; height: 8px;\n border-radius: 50%;\n display: inline-block;\n}\n.status-dot.active { background: var(--green); }\n.status-dot.idle { background: var(--yellow); }\n.status-dot.busy { background: var(--red); }\n.status-dot.offline { background: var(--dim); }\n#main {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n#header {\n padding: 12px 20px;\n border-bottom: 1px solid var(--border);\n font-size: 15px;\n font-weight: 600;\n background: var(--surface);\n}\n#messages {\n flex: 1;\n overflow-y: auto;\n padding: 16px 20px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.msg {\n font-size: 13px;\n line-height: 1.5;\n}\n.msg .sender { font-weight: 600; color: var(--accent); }\n.msg .time { color: var(--dim); font-size: 11px; margin-left: 8px; }\n.msg.system { color: var(--dim); font-style: italic; }\n.msg.status { color: var(--yellow); font-size: 12px; }\n.msg.dm { color: var(--purple); }\n.msg .dm-badge {\n background: var(--purple);\n color: #fff;\n font-size: 10px;\n padding: 1px 5px;\n border-radius: 3px;\n font-weight: 600;\n}\n#input-bar {\n display: flex;\n padding: 12px 20px;\n gap: 8px;\n background: var(--surface);\n border-top: 1px solid var(--border);\n}\n#input {\n flex: 1;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 6px;\n padding: 8px 12px;\n color: var(--text);\n font-size: 13px;\n outline: none;\n}\n#input:focus { border-color: var(--accent); }\n#send-btn {\n background: var(--accent);\n border: none;\n border-radius: 6px;\n padding: 8px 16px;\n color: #fff;\n font-weight: 600;\n cursor: pointer;\n}\n#send-btn:hover { opacity: 0.9; }\n#empty-state {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--dim);\n font-size: 14px;\n}\n`}));function q(e){return typeof e==\"object\"&&e!==null}function K(e){return Array.isArray(e)}function J(e){return Array.isArray(e)}function B(e){return Array.isArray(e)}function G(e){return q(e)&&typeof e.type==\"string\"}async function M(){let n=await(await fetch(\"/api/agents\")).json();if(!K(n))throw new Error(\"Invalid agents response\");return n}async function A(){let n=await(await fetch(\"/api/rooms\")).json();if(!J(n))throw new Error(\"Invalid rooms response\");return n}async function C(e,n){let t=n?`/api/rooms/${encodeURIComponent(e)}/messages?since=${encodeURIComponent(n)}`:`/api/rooms/${encodeURIComponent(e)}/messages`,s=await(await fetch(t)).json();if(!B(s))throw new Error(\"Invalid messages response\");return s}var f=class{constructor(n){m(this,\"ws\");m(this,\"reconnectTimer\");m(this,\"handler\");this.handler=n}connect(){let n=location.protocol===\"https:\"?\"wss:\":\"ws:\",t=new WebSocket(`${n}//${location.host}`);this.ws=t,t.onopen=()=>{this.handler.onOpen?.()},t.onclose=()=>{this.handler.onClose?.(),this.scheduleReconnect()},t.onerror=()=>{},t.onmessage=o=>{let s=JSON.parse(typeof o.data==\"string\"?o.data:String(o.data));G(s)&&this.handler.onFrame?.(s)}}sendAction(n){let t=this.ws;t?.readyState===WebSocket.OPEN&&t.send(JSON.stringify(n))}disconnect(){this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0);let n=this.ws;n&&n.close(),this.ws=void 0}scheduleReconnect(){this.reconnectTimer=setTimeout(()=>{this.connect()},3e3)}};function l(e,n,t){let o=e.querySelector(n);if(!o)throw new Error(`Required element not found: ${n}`);if(t&&o.tagName.toLowerCase()!==t)throw new Error(`Element ${n} must be <${t}>, got <${o.tagName.toLowerCase()}>`);return o}function p(e,n){let t=e.createElement(\"div\");return t.textContent=n,t.innerHTML}function $(e,n,t,...o){let s=e.createElement(n);if(t)for(let[r,a]of Object.entries(t))s.setAttribute(r,a);for(let r of o)typeof r==\"string\"?s.appendChild(e.createTextNode(r)):s.appendChild(r);return s}function h(e){e.innerHTML=\"\"}function k(e){return e.slice(11,19)}function L(e,n,t){let o=e.trim();return o.length===0?{kind:\"ignored\"}:o.startsWith(\"/\")?Q(o,n):n?{kind:\"action\",action:{action:\"send\",target:n,content:o}}:t?{kind:\"action\",action:{action:\"dm\",target:t,content:o}}:{kind:\"local\",result:{type:\"error\",text:\"Join a room or select an agent first\"}}}function Q(e,n){let t=e.slice(1).split(/\\s+/),o=(t[0]??\"\").toLowerCase();switch(o){case\"join\":return t[1]?{kind:\"action\",action:{action:\"join_room\",room:t[1]}}:{kind:\"local\",result:{type:\"error\",text:\"Usage: /join <room>\"}};case\"leave\":return{kind:\"action\",action:{action:\"leave_room\",room:t[1]??n??\"\"}};case\"rooms\":return{kind:\"action\",action:{action:\"list_rooms\"}};case\"agents\":return{kind:\"action\",action:{action:\"list_agents\"}};case\"dm\":return!t[1]||!t[2]?{kind:\"local\",result:{type:\"error\",text:\"Usage: /dm <agent> <message>\"}}:{kind:\"action\",action:{action:\"dm\",target:t[1],content:t.slice(2).join(\" \")}};case\"create\":return t[1]?{kind:\"action\",action:{action:\"create_room\",name:t[1],type:\"public\"}}:{kind:\"local\",result:{type:\"error\",text:\"Usage: /create <name>\"}};case\"destroy\":return t[1]?{kind:\"action\",action:{action:\"destroy_room\",room:t[1]}}:{kind:\"local\",result:{type:\"error\",text:\"Usage: /destroy <room>\"}};case\"help\":return{kind:\"local\",result:{type:\"help\",text:\"Commands: /join, /leave, /rooms, /agents, /dm, /create, /destroy, /help\"}};default:return{kind:\"local\",result:{type:\"unknown\",text:`Unknown command: /${o}`}}}}function S(e,n,t,o,s){let r=k(s),a=e.createElement(\"div\");a.className=\"msg\",a.innerHTML=`<span class=\"sender\">${p(e,t)}</span><span class=\"time\">${r}</span>: ${p(e,o)}`,n.messagesEl.appendChild(a),n.messagesEl.scrollTop=n.messagesEl.scrollHeight}function V(e,n,t,o,s){let r=k(s),a=e.createElement(\"div\");a.className=\"msg dm\",a.innerHTML=`<span class=\"dm-badge\">DM</span> <span class=\"sender\">${p(e,t)}</span><span class=\"time\">${r}</span>: ${p(e,o)}`,n.messagesEl.appendChild(a),n.messagesEl.scrollTop=n.messagesEl.scrollHeight}function c(e,n,t){let o=e.createElement(\"div\");o.className=\"msg system\",o.textContent=t,n.messagesEl.appendChild(o),n.messagesEl.scrollTop=n.messagesEl.scrollHeight}function y(e,n,t){let o=e.createElement(\"div\");o.className=\"msg status\",o.textContent=t,n.messagesEl.appendChild(o),n.messagesEl.scrollTop=n.messagesEl.scrollHeight}function w(e){h(e.messagesEl)}function H(e,n,t,o){switch(t.type){case\"room_message\":o===t.message.room&&S(e,n,t.message.from,t.message.content,t.message.timestamp);break;case\"dm\":V(e,n,t.message.from,t.message.content,t.message.timestamp);break;case\"member_joined\":c(e,n,`${t.agent} joined ${t.room}`);break;case\"member_left\":c(e,n,`${t.agent} left ${t.room}`);break;case\"member_status\":y(e,n,`${t.agent} is now ${t.status} in ${t.room}`);break;case\"delivery_status\":y(e,n,`Message ${t.messageId} ${t.status} by ${t.agent}`);break;case\"room_members\":if(o===t.room){let s=t.members.map(r=>`${r.name} (${r.status})`).join(\", \");c(e,n,`Members: ${s}`)}break;case\"room_invite\":{let s=t.roomDescription?` \\u2014 ${t.roomDescription}`:\"\";c(e,n,`${t.fromName} invited you to \"${t.room}\"${s}`);break}case\"invite_declined\":c(e,n,`${t.agentName} declined invite to ${t.room}: \"${t.reason}\"`);break}}function N(e,n,t,o,s){h(n.roomListEl);for(let r of t){let a=o===r.id,E=r.type.charAt(0).toUpperCase(),F=r.members.length,g=e.createElement(\"div\");g.className=`room-item${a?\" active\":\"\"}`,g.innerHTML=`${E} ${p(e,r.name)} <span style=\"color:var(--dim)\">(${String(F)})</span>`,g.onclick=()=>{s(r.id)},n.roomListEl.appendChild(g)}}function j(e,n,t,o){h(n.agentListEl);for(let s of t){let r=e.createElement(\"div\");r.className=\"agent-item\";let a=$(e,\"span\",{class:`status-dot ${s.status}`}),E=e.createTextNode(` ${s.name}`);r.appendChild(a),r.appendChild(E),o&&(r.onclick=()=>{o(s.id)}),n.agentListEl.appendChild(r)}}function x(e,n){e.headerEl.textContent=n}function D(e,n,t){for(let o of t)S(e,n,o.from,o.content,o.timestamp)}var _={currentRoom:void 0,dmTarget:void 0,agents:[],rooms:[],connected:!1},b=class{constructor(){m(this,\"state\",{..._});m(this,\"listeners\",new Set)}subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}get(){return this.state}setCurrentRoom(n){this.state={...this.state,currentRoom:n},this.notify()}setDmTarget(n){this.state={...this.state,dmTarget:n},this.notify()}setAgents(n){this.state={...this.state,agents:n},this.notify()}setRooms(n){this.state={...this.state,rooms:n},this.notify()}setConnected(n){this.state={...this.state,connected:n},this.notify()}applyState(n,t){this.state={...this.state,agents:n,rooms:t},this.notify()}reset(){this.state={..._},this.notify()}notify(){let n=this.state;for(let t of this.listeners)t(n)}};var X=l(document,\"#messages\"),u=l(document,\"#input\",\"input\"),R=l(document,\"#header\"),Y=l(document,\"#room-list\"),Z=l(document,\"#agent-list\"),d={messagesEl:X},I={roomListEl:Y,agentListEl:Z},i=new b;i.subscribe(e=>{N(document,I,e.rooms,e.currentRoom,ne),j(document,I,e.agents,te)});var P=new f({onOpen:()=>{i.setConnected(!0),c(document,d,\"Connected to mesh\")},onClose:()=>{i.setConnected(!1),c(document,d,\"Disconnected \\u2014 reconnecting...\")},onFrame:ee});function ee(e){switch(e.type){case\"delivery\":H(document,d,e.event,i.get().currentRoom),(e.event.type===\"member_joined\"||e.event.type===\"member_left\"||e.event.type===\"member_status\")&&T();break;case\"result\":if(c(document,d,e.result.content),!e.result.isError){if(v?.action===\"join_room\"&&!i.get().currentRoom){let n=v.room;i.setDmTarget(void 0),i.setCurrentRoom(n),x({headerEl:R},n)}T()}v=void 0;break;case\"error\":y(document,d,`Error: ${e.message}`);break;case\"state\":i.applyState(e.agents,e.rooms);break}}var v;function W(e){v=e,P.sendAction(e)}async function T(){let[e,n]=await Promise.all([M(),A()]);i.setAgents(e),i.setRooms(n)}async function ne(e){i.setDmTarget(void 0),i.setCurrentRoom(e),x({headerEl:R},e),w(d),W({action:\"join_room\",room:e});let n=await C(e);D(document,d,n),c(document,d,`Joined ${e}`),u.focus()}function te(e){i.setCurrentRoom(void 0),i.setDmTarget(e),w(d),x({headerEl:R},`DM with ${e}`),u.focus()}function z(){let e=u.value;u.value=\"\";let n=L(e,i.get().currentRoom,i.get().dmTarget);switch(n.kind){case\"action\":W(n.action);break;case\"local\":c(document,d,n.result.text);break;case\"ignored\":break}}var oe=l(document,\"#send-btn\");oe.onclick=z;u.addEventListener(\"keydown\",e=>{e.key===\"Enter\"&&z()});P.connect();T();u.focus();})();\n\n </script>\n</body>\n</html>\n";
|
|
6
|
+
//# sourceMappingURL=generated-html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-html.d.ts","sourceRoot":"","sources":["../../../../src/bridges/user/web/generated-html.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,aAAa,ggZA6KzB,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — do not edit.
|
|
3
|
+
* Rebuild with: pnpm build:frontend
|
|
4
|
+
*/
|
|
5
|
+
export const FRONTEND_HTML = `<!DOCTYPE html>
|
|
6
|
+
<html lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<meta charset="utf-8">
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
|
+
<title>Agent Comms</title>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
|
|
14
|
+
<div id="sidebar">
|
|
15
|
+
<h2>Agent Comms</h2>
|
|
16
|
+
<div class="sidebar-section">
|
|
17
|
+
<h3>Rooms</h3>
|
|
18
|
+
<div id="room-list"></div>
|
|
19
|
+
<h3>Agents</h3>
|
|
20
|
+
<div id="agent-list"></div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div id="main">
|
|
25
|
+
<div id="header">Select a room</div>
|
|
26
|
+
<div id="messages"></div>
|
|
27
|
+
<div id="input-bar">
|
|
28
|
+
<input id="input" type="text" placeholder="Type a message or /command..." autocomplete="off" />
|
|
29
|
+
<button id="send-btn">Send</button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
"use strict";(()=>{var O=Object.defineProperty;var U=(e,n,t)=>n in e?O(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var m=(e,n,t)=>U(e,typeof n!="symbol"?n+"":n,t);document.head.appendChild(Object.assign(document.createElement("style"),{textContent:\`:root {
|
|
35
|
+
--bg: #1a1a2e;
|
|
36
|
+
--surface: #16213e;
|
|
37
|
+
--border: #0f3460;
|
|
38
|
+
--text: #e4e4e4;
|
|
39
|
+
--dim: #888;
|
|
40
|
+
--accent: #00b4d8;
|
|
41
|
+
--green: #06d6a0;
|
|
42
|
+
--red: #ef476f;
|
|
43
|
+
--yellow: #ffd166;
|
|
44
|
+
--purple: #b5838d;
|
|
45
|
+
}
|
|
46
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
47
|
+
body {
|
|
48
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
49
|
+
background: var(--bg);
|
|
50
|
+
color: var(--text);
|
|
51
|
+
height: 100vh;
|
|
52
|
+
display: flex;
|
|
53
|
+
}
|
|
54
|
+
#sidebar {
|
|
55
|
+
width: 260px;
|
|
56
|
+
background: var(--surface);
|
|
57
|
+
border-right: 1px solid var(--border);
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
}
|
|
62
|
+
#sidebar h2 {
|
|
63
|
+
padding: 12px 16px;
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
color: var(--accent);
|
|
66
|
+
border-bottom: 1px solid var(--border);
|
|
67
|
+
}
|
|
68
|
+
.sidebar-section {
|
|
69
|
+
flex: 1;
|
|
70
|
+
overflow-y: auto;
|
|
71
|
+
padding: 8px;
|
|
72
|
+
}
|
|
73
|
+
.sidebar-section h3 {
|
|
74
|
+
font-size: 11px;
|
|
75
|
+
text-transform: uppercase;
|
|
76
|
+
color: var(--dim);
|
|
77
|
+
padding: 8px 8px 4px;
|
|
78
|
+
}
|
|
79
|
+
.room-item, .agent-item {
|
|
80
|
+
padding: 6px 10px;
|
|
81
|
+
border-radius: 6px;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
font-size: 13px;
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: 6px;
|
|
87
|
+
}
|
|
88
|
+
.room-item:hover, .agent-item:hover { background: rgba(255,255,255,0.05); }
|
|
89
|
+
.room-item.active { background: var(--border); }
|
|
90
|
+
.status-dot {
|
|
91
|
+
width: 8px; height: 8px;
|
|
92
|
+
border-radius: 50%;
|
|
93
|
+
display: inline-block;
|
|
94
|
+
}
|
|
95
|
+
.status-dot.active { background: var(--green); }
|
|
96
|
+
.status-dot.idle { background: var(--yellow); }
|
|
97
|
+
.status-dot.busy { background: var(--red); }
|
|
98
|
+
.status-dot.offline { background: var(--dim); }
|
|
99
|
+
#main {
|
|
100
|
+
flex: 1;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
105
|
+
#header {
|
|
106
|
+
padding: 12px 20px;
|
|
107
|
+
border-bottom: 1px solid var(--border);
|
|
108
|
+
font-size: 15px;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
background: var(--surface);
|
|
111
|
+
}
|
|
112
|
+
#messages {
|
|
113
|
+
flex: 1;
|
|
114
|
+
overflow-y: auto;
|
|
115
|
+
padding: 16px 20px;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: 4px;
|
|
119
|
+
}
|
|
120
|
+
.msg {
|
|
121
|
+
font-size: 13px;
|
|
122
|
+
line-height: 1.5;
|
|
123
|
+
}
|
|
124
|
+
.msg .sender { font-weight: 600; color: var(--accent); }
|
|
125
|
+
.msg .time { color: var(--dim); font-size: 11px; margin-left: 8px; }
|
|
126
|
+
.msg.system { color: var(--dim); font-style: italic; }
|
|
127
|
+
.msg.status { color: var(--yellow); font-size: 12px; }
|
|
128
|
+
.msg.dm { color: var(--purple); }
|
|
129
|
+
.msg .dm-badge {
|
|
130
|
+
background: var(--purple);
|
|
131
|
+
color: #fff;
|
|
132
|
+
font-size: 10px;
|
|
133
|
+
padding: 1px 5px;
|
|
134
|
+
border-radius: 3px;
|
|
135
|
+
font-weight: 600;
|
|
136
|
+
}
|
|
137
|
+
#input-bar {
|
|
138
|
+
display: flex;
|
|
139
|
+
padding: 12px 20px;
|
|
140
|
+
gap: 8px;
|
|
141
|
+
background: var(--surface);
|
|
142
|
+
border-top: 1px solid var(--border);
|
|
143
|
+
}
|
|
144
|
+
#input {
|
|
145
|
+
flex: 1;
|
|
146
|
+
background: var(--bg);
|
|
147
|
+
border: 1px solid var(--border);
|
|
148
|
+
border-radius: 6px;
|
|
149
|
+
padding: 8px 12px;
|
|
150
|
+
color: var(--text);
|
|
151
|
+
font-size: 13px;
|
|
152
|
+
outline: none;
|
|
153
|
+
}
|
|
154
|
+
#input:focus { border-color: var(--accent); }
|
|
155
|
+
#send-btn {
|
|
156
|
+
background: var(--accent);
|
|
157
|
+
border: none;
|
|
158
|
+
border-radius: 6px;
|
|
159
|
+
padding: 8px 16px;
|
|
160
|
+
color: #fff;
|
|
161
|
+
font-weight: 600;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
}
|
|
164
|
+
#send-btn:hover { opacity: 0.9; }
|
|
165
|
+
#empty-state {
|
|
166
|
+
flex: 1;
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
color: var(--dim);
|
|
171
|
+
font-size: 14px;
|
|
172
|
+
}
|
|
173
|
+
\`}));function q(e){return typeof e=="object"&&e!==null}function K(e){return Array.isArray(e)}function J(e){return Array.isArray(e)}function B(e){return Array.isArray(e)}function G(e){return q(e)&&typeof e.type=="string"}async function M(){let n=await(await fetch("/api/agents")).json();if(!K(n))throw new Error("Invalid agents response");return n}async function A(){let n=await(await fetch("/api/rooms")).json();if(!J(n))throw new Error("Invalid rooms response");return n}async function C(e,n){let t=n?\`/api/rooms/\${encodeURIComponent(e)}/messages?since=\${encodeURIComponent(n)}\`:\`/api/rooms/\${encodeURIComponent(e)}/messages\`,s=await(await fetch(t)).json();if(!B(s))throw new Error("Invalid messages response");return s}var f=class{constructor(n){m(this,"ws");m(this,"reconnectTimer");m(this,"handler");this.handler=n}connect(){let n=location.protocol==="https:"?"wss:":"ws:",t=new WebSocket(\`\${n}//\${location.host}\`);this.ws=t,t.onopen=()=>{this.handler.onOpen?.()},t.onclose=()=>{this.handler.onClose?.(),this.scheduleReconnect()},t.onerror=()=>{},t.onmessage=o=>{let s=JSON.parse(typeof o.data=="string"?o.data:String(o.data));G(s)&&this.handler.onFrame?.(s)}}sendAction(n){let t=this.ws;t?.readyState===WebSocket.OPEN&&t.send(JSON.stringify(n))}disconnect(){this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0);let n=this.ws;n&&n.close(),this.ws=void 0}scheduleReconnect(){this.reconnectTimer=setTimeout(()=>{this.connect()},3e3)}};function l(e,n,t){let o=e.querySelector(n);if(!o)throw new Error(\`Required element not found: \${n}\`);if(t&&o.tagName.toLowerCase()!==t)throw new Error(\`Element \${n} must be <\${t}>, got <\${o.tagName.toLowerCase()}>\`);return o}function p(e,n){let t=e.createElement("div");return t.textContent=n,t.innerHTML}function \$(e,n,t,...o){let s=e.createElement(n);if(t)for(let[r,a]of Object.entries(t))s.setAttribute(r,a);for(let r of o)typeof r=="string"?s.appendChild(e.createTextNode(r)):s.appendChild(r);return s}function h(e){e.innerHTML=""}function k(e){return e.slice(11,19)}function L(e,n,t){let o=e.trim();return o.length===0?{kind:"ignored"}:o.startsWith("/")?Q(o,n):n?{kind:"action",action:{action:"send",target:n,content:o}}:t?{kind:"action",action:{action:"dm",target:t,content:o}}:{kind:"local",result:{type:"error",text:"Join a room or select an agent first"}}}function Q(e,n){let t=e.slice(1).split(/\\s+/),o=(t[0]??"").toLowerCase();switch(o){case"join":return t[1]?{kind:"action",action:{action:"join_room",room:t[1]}}:{kind:"local",result:{type:"error",text:"Usage: /join <room>"}};case"leave":return{kind:"action",action:{action:"leave_room",room:t[1]??n??""}};case"rooms":return{kind:"action",action:{action:"list_rooms"}};case"agents":return{kind:"action",action:{action:"list_agents"}};case"dm":return!t[1]||!t[2]?{kind:"local",result:{type:"error",text:"Usage: /dm <agent> <message>"}}:{kind:"action",action:{action:"dm",target:t[1],content:t.slice(2).join(" ")}};case"create":return t[1]?{kind:"action",action:{action:"create_room",name:t[1],type:"public"}}:{kind:"local",result:{type:"error",text:"Usage: /create <name>"}};case"destroy":return t[1]?{kind:"action",action:{action:"destroy_room",room:t[1]}}:{kind:"local",result:{type:"error",text:"Usage: /destroy <room>"}};case"help":return{kind:"local",result:{type:"help",text:"Commands: /join, /leave, /rooms, /agents, /dm, /create, /destroy, /help"}};default:return{kind:"local",result:{type:"unknown",text:\`Unknown command: /\${o}\`}}}}function S(e,n,t,o,s){let r=k(s),a=e.createElement("div");a.className="msg",a.innerHTML=\`<span class="sender">\${p(e,t)}</span><span class="time">\${r}</span>: \${p(e,o)}\`,n.messagesEl.appendChild(a),n.messagesEl.scrollTop=n.messagesEl.scrollHeight}function V(e,n,t,o,s){let r=k(s),a=e.createElement("div");a.className="msg dm",a.innerHTML=\`<span class="dm-badge">DM</span> <span class="sender">\${p(e,t)}</span><span class="time">\${r}</span>: \${p(e,o)}\`,n.messagesEl.appendChild(a),n.messagesEl.scrollTop=n.messagesEl.scrollHeight}function c(e,n,t){let o=e.createElement("div");o.className="msg system",o.textContent=t,n.messagesEl.appendChild(o),n.messagesEl.scrollTop=n.messagesEl.scrollHeight}function y(e,n,t){let o=e.createElement("div");o.className="msg status",o.textContent=t,n.messagesEl.appendChild(o),n.messagesEl.scrollTop=n.messagesEl.scrollHeight}function w(e){h(e.messagesEl)}function H(e,n,t,o){switch(t.type){case"room_message":o===t.message.room&&S(e,n,t.message.from,t.message.content,t.message.timestamp);break;case"dm":V(e,n,t.message.from,t.message.content,t.message.timestamp);break;case"member_joined":c(e,n,\`\${t.agent} joined \${t.room}\`);break;case"member_left":c(e,n,\`\${t.agent} left \${t.room}\`);break;case"member_status":y(e,n,\`\${t.agent} is now \${t.status} in \${t.room}\`);break;case"delivery_status":y(e,n,\`Message \${t.messageId} \${t.status} by \${t.agent}\`);break;case"room_members":if(o===t.room){let s=t.members.map(r=>\`\${r.name} (\${r.status})\`).join(", ");c(e,n,\`Members: \${s}\`)}break;case"room_invite":{let s=t.roomDescription?\` \\u2014 \${t.roomDescription}\`:"";c(e,n,\`\${t.fromName} invited you to "\${t.room}"\${s}\`);break}case"invite_declined":c(e,n,\`\${t.agentName} declined invite to \${t.room}: "\${t.reason}"\`);break}}function N(e,n,t,o,s){h(n.roomListEl);for(let r of t){let a=o===r.id,E=r.type.charAt(0).toUpperCase(),F=r.members.length,g=e.createElement("div");g.className=\`room-item\${a?" active":""}\`,g.innerHTML=\`\${E} \${p(e,r.name)} <span style="color:var(--dim)">(\${String(F)})</span>\`,g.onclick=()=>{s(r.id)},n.roomListEl.appendChild(g)}}function j(e,n,t,o){h(n.agentListEl);for(let s of t){let r=e.createElement("div");r.className="agent-item";let a=\$(e,"span",{class:\`status-dot \${s.status}\`}),E=e.createTextNode(\` \${s.name}\`);r.appendChild(a),r.appendChild(E),o&&(r.onclick=()=>{o(s.id)}),n.agentListEl.appendChild(r)}}function x(e,n){e.headerEl.textContent=n}function D(e,n,t){for(let o of t)S(e,n,o.from,o.content,o.timestamp)}var _={currentRoom:void 0,dmTarget:void 0,agents:[],rooms:[],connected:!1},b=class{constructor(){m(this,"state",{..._});m(this,"listeners",new Set)}subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}get(){return this.state}setCurrentRoom(n){this.state={...this.state,currentRoom:n},this.notify()}setDmTarget(n){this.state={...this.state,dmTarget:n},this.notify()}setAgents(n){this.state={...this.state,agents:n},this.notify()}setRooms(n){this.state={...this.state,rooms:n},this.notify()}setConnected(n){this.state={...this.state,connected:n},this.notify()}applyState(n,t){this.state={...this.state,agents:n,rooms:t},this.notify()}reset(){this.state={..._},this.notify()}notify(){let n=this.state;for(let t of this.listeners)t(n)}};var X=l(document,"#messages"),u=l(document,"#input","input"),R=l(document,"#header"),Y=l(document,"#room-list"),Z=l(document,"#agent-list"),d={messagesEl:X},I={roomListEl:Y,agentListEl:Z},i=new b;i.subscribe(e=>{N(document,I,e.rooms,e.currentRoom,ne),j(document,I,e.agents,te)});var P=new f({onOpen:()=>{i.setConnected(!0),c(document,d,"Connected to mesh")},onClose:()=>{i.setConnected(!1),c(document,d,"Disconnected \\u2014 reconnecting...")},onFrame:ee});function ee(e){switch(e.type){case"delivery":H(document,d,e.event,i.get().currentRoom),(e.event.type==="member_joined"||e.event.type==="member_left"||e.event.type==="member_status")&&T();break;case"result":if(c(document,d,e.result.content),!e.result.isError){if(v?.action==="join_room"&&!i.get().currentRoom){let n=v.room;i.setDmTarget(void 0),i.setCurrentRoom(n),x({headerEl:R},n)}T()}v=void 0;break;case"error":y(document,d,\`Error: \${e.message}\`);break;case"state":i.applyState(e.agents,e.rooms);break}}var v;function W(e){v=e,P.sendAction(e)}async function T(){let[e,n]=await Promise.all([M(),A()]);i.setAgents(e),i.setRooms(n)}async function ne(e){i.setDmTarget(void 0),i.setCurrentRoom(e),x({headerEl:R},e),w(d),W({action:"join_room",room:e});let n=await C(e);D(document,d,n),c(document,d,\`Joined \${e}\`),u.focus()}function te(e){i.setCurrentRoom(void 0),i.setDmTarget(e),w(d),x({headerEl:R},\`DM with \${e}\`),u.focus()}function z(){let e=u.value;u.value="";let n=L(e,i.get().currentRoom,i.get().dmTarget);switch(n.kind){case"action":W(n.action);break;case"local":c(document,d,n.result.text);break;case"ignored":break}}var oe=l(document,"#send-btn");oe.onclick=z;u.addEventListener("keydown",e=>{e.key==="Enter"&&z()});P.connect();T();u.focus();})();
|
|
174
|
+
|
|
175
|
+
</script>
|
|
176
|
+
</body>
|
|
177
|
+
</html>
|
|
178
|
+
`;
|
|
179
|
+
//# sourceMappingURL=generated-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-html.js","sourceRoot":"","sources":["../../../../src/bridges/user/web/generated-html.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6K5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/bridges/user/web/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/bridges/user/web/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwBlD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,GAAG,EAAE,eAAe,CAAC;CACtB;AAMD;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAChD,eAAe,GAAG,SAAS,CAC5B,CAEA;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,SAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAoBxE;AAMD,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BtE"}
|