agent-relay-server 0.5.0 → 0.6.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/README.md +8 -8
- package/package.json +1 -1
- package/public/dashboard.js +106 -17
- package/public/icons/agent-relay-192.png +0 -0
- package/public/icons/agent-relay-512.png +0 -0
- package/public/icons/agent-relay.svg +14 -0
- package/public/index.html +91 -4
- package/public/manifest.webmanifest +33 -0
- package/public/sw.js +58 -0
- package/src/cli.ts +80 -17
- package/src/connectors.ts +256 -0
- package/src/db.ts +413 -25
- package/src/index.ts +25 -1
- package/src/routes.ts +380 -32
- package/src/security.ts +2 -1
- package/src/sse.ts +6 -0
- package/src/types.ts +92 -3
package/src/types.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export type AgentKind = "provider" | "channel" | "orchestrator" | "system" | "user";
|
|
2
|
+
|
|
1
3
|
export interface AgentCard {
|
|
2
4
|
id: string;
|
|
3
5
|
name: string;
|
|
6
|
+
kind: AgentKind;
|
|
4
7
|
label?: string; // human-friendly alias; acts as a fan-out target ("label:foo")
|
|
5
8
|
tags: string[];
|
|
6
9
|
machine?: string;
|
|
@@ -15,13 +18,19 @@ export interface AgentCard {
|
|
|
15
18
|
createdAt: number;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
export type
|
|
21
|
+
export type MessageKind =
|
|
22
|
+
| "chat"
|
|
23
|
+
| "channel.event"
|
|
24
|
+
| "task"
|
|
25
|
+
| "pair"
|
|
26
|
+
| "control"
|
|
27
|
+
| "system";
|
|
19
28
|
|
|
20
29
|
export interface Message {
|
|
21
30
|
id: number;
|
|
22
31
|
from: string;
|
|
23
32
|
to: string; // agent-id | "tag:<name>" | "broadcast" | "cap:<name>"
|
|
24
|
-
|
|
33
|
+
kind: MessageKind;
|
|
25
34
|
channel?: string;
|
|
26
35
|
subject?: string;
|
|
27
36
|
body: string;
|
|
@@ -32,6 +41,7 @@ export interface Message {
|
|
|
32
41
|
claimedAt?: number;
|
|
33
42
|
claimExpiresAt?: number;
|
|
34
43
|
idempotencyKey?: string;
|
|
44
|
+
payload: Record<string, unknown>;
|
|
35
45
|
meta?: Record<string, unknown>;
|
|
36
46
|
readBy: string[];
|
|
37
47
|
createdAt: number;
|
|
@@ -40,16 +50,71 @@ export interface Message {
|
|
|
40
50
|
export interface SendMessageInput {
|
|
41
51
|
from: string;
|
|
42
52
|
to: string;
|
|
43
|
-
|
|
53
|
+
kind?: MessageKind;
|
|
44
54
|
channel?: string;
|
|
45
55
|
subject?: string;
|
|
46
56
|
body: string;
|
|
47
57
|
replyTo?: number;
|
|
48
58
|
claimable?: boolean;
|
|
49
59
|
idempotencyKey?: string;
|
|
60
|
+
payload?: Record<string, unknown>;
|
|
50
61
|
meta?: Record<string, unknown>;
|
|
51
62
|
}
|
|
52
63
|
|
|
64
|
+
export type ConnectorKind = "channel" | "event" | "provider" | "orchestrator";
|
|
65
|
+
export type ConnectorAction = "install" | "uninstall" | "enable" | "disable" | "start" | "stop" | "restart" | "status" | "doctor";
|
|
66
|
+
|
|
67
|
+
export interface ConnectorManifest {
|
|
68
|
+
schema: "agent-relay.connector.v1";
|
|
69
|
+
id: string;
|
|
70
|
+
kind: ConnectorKind;
|
|
71
|
+
packageName?: string;
|
|
72
|
+
binary: string;
|
|
73
|
+
displayName: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
version: string;
|
|
76
|
+
capabilities: string[];
|
|
77
|
+
commands: Partial<Record<ConnectorAction, string[]>>;
|
|
78
|
+
configSchema?: Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface ConnectorRuntime {
|
|
82
|
+
installed: boolean;
|
|
83
|
+
enabled?: boolean;
|
|
84
|
+
running?: boolean;
|
|
85
|
+
status?: "ok" | "warn" | "error" | "unknown";
|
|
86
|
+
detail?: string;
|
|
87
|
+
updatedAt?: string;
|
|
88
|
+
raw?: unknown;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ConnectorSummary {
|
|
92
|
+
id: string;
|
|
93
|
+
kind: ConnectorKind;
|
|
94
|
+
displayName: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
version: string;
|
|
97
|
+
packageName?: string;
|
|
98
|
+
binary: string;
|
|
99
|
+
capabilities: string[];
|
|
100
|
+
registryPath: string;
|
|
101
|
+
manifest: ConnectorManifest;
|
|
102
|
+
config?: Record<string, unknown>;
|
|
103
|
+
state?: Record<string, unknown>;
|
|
104
|
+
runtime: ConnectorRuntime;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface ConnectorActionResult {
|
|
108
|
+
connectorId: string;
|
|
109
|
+
action: ConnectorAction;
|
|
110
|
+
command?: string[];
|
|
111
|
+
ok: boolean;
|
|
112
|
+
exitCode?: number | null;
|
|
113
|
+
stdout?: string;
|
|
114
|
+
stderr?: string;
|
|
115
|
+
parsed?: unknown;
|
|
116
|
+
}
|
|
117
|
+
|
|
53
118
|
export type PairStatus = "pending" | "active" | "ended" | "rejected" | "expired";
|
|
54
119
|
|
|
55
120
|
export interface PairSession {
|
|
@@ -99,6 +164,7 @@ export interface PollQuery {
|
|
|
99
164
|
export interface RegisterAgentInput {
|
|
100
165
|
id: string;
|
|
101
166
|
name: string;
|
|
167
|
+
kind?: AgentKind;
|
|
102
168
|
label?: string | null;
|
|
103
169
|
tags?: string[];
|
|
104
170
|
machine?: string;
|
|
@@ -203,16 +269,39 @@ export interface IntegrationSummary {
|
|
|
203
269
|
|
|
204
270
|
export type ChannelDirection = "inbound" | "outbound" | "bidirectional";
|
|
205
271
|
|
|
272
|
+
export type ChannelRouteTarget =
|
|
273
|
+
| { type: "agent"; id: string }
|
|
274
|
+
| { type: "label"; id: string }
|
|
275
|
+
| { type: "tag"; id: string }
|
|
276
|
+
| { type: "capability"; id: string }
|
|
277
|
+
| { type: "broadcast" }
|
|
278
|
+
| { type: "orchestrator"; id: string };
|
|
279
|
+
|
|
280
|
+
export type ChannelBindingMode = "exclusive" | "claimable" | "broadcast";
|
|
281
|
+
|
|
282
|
+
export interface ChannelBinding {
|
|
283
|
+
id: string;
|
|
284
|
+
channelId: string;
|
|
285
|
+
conversationId?: string;
|
|
286
|
+
target: ChannelRouteTarget;
|
|
287
|
+
mode: ChannelBindingMode;
|
|
288
|
+
priority: number;
|
|
289
|
+
createdAt: number;
|
|
290
|
+
updatedAt: number;
|
|
291
|
+
}
|
|
292
|
+
|
|
206
293
|
export interface ChannelSummary {
|
|
207
294
|
id: string;
|
|
208
295
|
name: string;
|
|
209
296
|
type: string;
|
|
210
297
|
transport: string;
|
|
211
298
|
agentId: string;
|
|
299
|
+
accountId: string;
|
|
212
300
|
status: AgentCard["status"];
|
|
213
301
|
ready: boolean;
|
|
214
302
|
direction: ChannelDirection;
|
|
215
303
|
target?: string;
|
|
304
|
+
binding?: ChannelBinding;
|
|
216
305
|
topicChannels: string[];
|
|
217
306
|
capabilities: string[];
|
|
218
307
|
tags: string[];
|