agent-relay-server 0.4.15 → 0.4.17
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 +82 -3
- package/package.json +2 -2
- package/public/dashboard.js +100 -7
- package/public/index.html +26 -1
- package/src/cli.ts +384 -0
- package/src/config.ts +1 -0
- package/src/db.ts +597 -28
- package/src/index.ts +13 -3
- package/src/routes.ts +330 -13
- package/src/security.ts +31 -1
- package/src/sse.ts +8 -2
- package/src/types.ts +65 -0
package/src/types.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface AgentCard {
|
|
|
8
8
|
capabilities: string[];
|
|
9
9
|
ready: boolean;
|
|
10
10
|
status: "online" | "idle" | "busy" | "offline";
|
|
11
|
+
instanceId?: string;
|
|
12
|
+
epoch: number;
|
|
11
13
|
meta?: Record<string, unknown>;
|
|
12
14
|
lastSeen: number;
|
|
13
15
|
createdAt: number;
|
|
@@ -28,6 +30,8 @@ export interface Message {
|
|
|
28
30
|
claimable?: boolean;
|
|
29
31
|
claimedBy?: string;
|
|
30
32
|
claimedAt?: number;
|
|
33
|
+
claimExpiresAt?: number;
|
|
34
|
+
idempotencyKey?: string;
|
|
31
35
|
meta?: Record<string, unknown>;
|
|
32
36
|
readBy: string[];
|
|
33
37
|
createdAt: number;
|
|
@@ -42,9 +46,47 @@ export interface SendMessageInput {
|
|
|
42
46
|
body: string;
|
|
43
47
|
replyTo?: number;
|
|
44
48
|
claimable?: boolean;
|
|
49
|
+
idempotencyKey?: string;
|
|
45
50
|
meta?: Record<string, unknown>;
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
export type PairStatus = "pending" | "active" | "ended" | "rejected" | "expired";
|
|
54
|
+
|
|
55
|
+
export interface PairSession {
|
|
56
|
+
id: string;
|
|
57
|
+
requesterId: string;
|
|
58
|
+
targetId: string;
|
|
59
|
+
status: PairStatus;
|
|
60
|
+
objective?: string;
|
|
61
|
+
createdAt: number;
|
|
62
|
+
updatedAt: number;
|
|
63
|
+
expiresAt: number;
|
|
64
|
+
acceptedAt?: number;
|
|
65
|
+
endedAt?: number;
|
|
66
|
+
endedBy?: string;
|
|
67
|
+
lastMessageAt?: number;
|
|
68
|
+
meta: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface CreatePairInput {
|
|
72
|
+
from: string;
|
|
73
|
+
target: string;
|
|
74
|
+
objective?: string;
|
|
75
|
+
ttlMs?: number;
|
|
76
|
+
meta?: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface PairActionInput {
|
|
80
|
+
agentId: string;
|
|
81
|
+
reason?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface PairMessageInput {
|
|
85
|
+
from: string;
|
|
86
|
+
body: string;
|
|
87
|
+
subject?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
48
90
|
export interface PollQuery {
|
|
49
91
|
for: string; // agent-id
|
|
50
92
|
since?: number; // unix ms (createdAt cursor)
|
|
@@ -64,9 +106,15 @@ export interface RegisterAgentInput {
|
|
|
64
106
|
capabilities?: string[];
|
|
65
107
|
ready?: boolean;
|
|
66
108
|
status?: AgentCard["status"];
|
|
109
|
+
instanceId?: string;
|
|
67
110
|
meta?: Record<string, unknown>;
|
|
68
111
|
}
|
|
69
112
|
|
|
113
|
+
export interface AgentSessionGuard {
|
|
114
|
+
instanceId?: string;
|
|
115
|
+
epoch?: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
70
118
|
export type TaskSeverity = "info" | "warning" | "critical";
|
|
71
119
|
export type TaskStatus =
|
|
72
120
|
| "open"
|
|
@@ -91,6 +139,7 @@ export interface Task {
|
|
|
91
139
|
occurrenceCount: number;
|
|
92
140
|
claimedBy?: string;
|
|
93
141
|
claimedAt?: number;
|
|
142
|
+
claimExpiresAt?: number;
|
|
94
143
|
messageId?: number;
|
|
95
144
|
result?: string;
|
|
96
145
|
metadata: Record<string, unknown>;
|
|
@@ -128,7 +177,23 @@ export interface IntegrationEventInput {
|
|
|
128
177
|
export interface TaskStatusInput {
|
|
129
178
|
status: TaskStatus;
|
|
130
179
|
agentId?: string;
|
|
180
|
+
instanceId?: string;
|
|
181
|
+
epoch?: number;
|
|
131
182
|
result?: string;
|
|
132
183
|
body?: string;
|
|
133
184
|
metadata?: Record<string, unknown>;
|
|
134
185
|
}
|
|
186
|
+
|
|
187
|
+
export interface HealthCheck {
|
|
188
|
+
name: string;
|
|
189
|
+
status: "ok" | "warn" | "error";
|
|
190
|
+
detail?: string;
|
|
191
|
+
count?: number;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface HealthReport {
|
|
195
|
+
status: "ok" | "degraded" | "error";
|
|
196
|
+
version: string;
|
|
197
|
+
generatedAt: number;
|
|
198
|
+
checks: HealthCheck[];
|
|
199
|
+
}
|