digital-workers 2.0.2 → 2.1.3
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/.turbo/turbo-build.log +4 -5
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +134 -180
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +1 -0
- package/dist/actions.js.map +1 -1
- package/dist/agent-comms.d.ts +438 -0
- package/dist/agent-comms.d.ts.map +1 -0
- package/dist/agent-comms.js +666 -0
- package/dist/agent-comms.js.map +1 -0
- package/dist/capability-tiers.d.ts +230 -0
- package/dist/capability-tiers.d.ts.map +1 -0
- package/dist/capability-tiers.js +388 -0
- package/dist/capability-tiers.js.map +1 -0
- package/dist/cascade-context.d.ts +523 -0
- package/dist/cascade-context.d.ts.map +1 -0
- package/dist/cascade-context.js +494 -0
- package/dist/cascade-context.js.map +1 -0
- package/dist/error-escalation.d.ts +416 -0
- package/dist/error-escalation.d.ts.map +1 -0
- package/dist/error-escalation.js +656 -0
- package/dist/error-escalation.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/dist/load-balancing.d.ts +395 -0
- package/dist/load-balancing.d.ts.map +1 -0
- package/dist/load-balancing.js +905 -0
- package/dist/load-balancing.js.map +1 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +14 -14
- package/src/actions.js +436 -0
- package/src/actions.ts +9 -8
- package/src/agent-comms.ts +1238 -0
- package/src/approve.js +234 -0
- package/src/ask.js +226 -0
- package/src/capability-tiers.ts +545 -0
- package/src/cascade-context.ts +648 -0
- package/src/decide.js +244 -0
- package/src/do.js +227 -0
- package/src/error-escalation.ts +1135 -0
- package/src/generate.js +298 -0
- package/src/goals.js +205 -0
- package/src/index.js +68 -0
- package/src/index.ts +223 -0
- package/src/is.js +317 -0
- package/src/kpis.js +270 -0
- package/src/load-balancing.ts +1381 -0
- package/src/notify.js +219 -0
- package/src/role.js +110 -0
- package/src/team.js +130 -0
- package/src/transports.js +357 -0
- package/src/types.js +71 -0
- package/src/types.ts +8 -0
- package/test/actions.test.js +401 -0
- package/test/agent-comms.test.ts +1397 -0
- package/test/capability-tiers.test.ts +631 -0
- package/test/cascade-context.test.ts +692 -0
- package/test/error-escalation.test.ts +1205 -0
- package/test/load-balancing-thread-safety.test.ts +464 -0
- package/test/load-balancing.test.ts +1145 -0
- package/test/standalone.test.js +250 -0
- package/test/types.test.js +371 -0
- package/test/types.test.ts +35 -0
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-to-Agent Communication Layer
|
|
3
|
+
*
|
|
4
|
+
* Provides structured messaging, coordination patterns, and handoff protocols
|
|
5
|
+
* for communication between agents in the digital-workers system.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// AgentMessageBus Implementation
|
|
11
|
+
// =============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* Agent message bus for routing messages between agents
|
|
14
|
+
*/
|
|
15
|
+
export class AgentMessageBus {
|
|
16
|
+
subscriptions = new Map();
|
|
17
|
+
pendingAcks = new Map();
|
|
18
|
+
messageStatus = new Map();
|
|
19
|
+
handoffs = new Map();
|
|
20
|
+
storedMessages = [];
|
|
21
|
+
messageQueue = new Map();
|
|
22
|
+
processingAgent = new Set();
|
|
23
|
+
disposed = false;
|
|
24
|
+
options;
|
|
25
|
+
constructor(options = {}) {
|
|
26
|
+
this.options = {
|
|
27
|
+
persistence: options.persistence ?? false,
|
|
28
|
+
defaultTtl: options.defaultTtl ?? 30000,
|
|
29
|
+
maxQueueSize: options.maxQueueSize ?? 1000,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Send a message to an agent
|
|
34
|
+
*/
|
|
35
|
+
async send(message) {
|
|
36
|
+
if (this.disposed) {
|
|
37
|
+
return this.createFailedEnvelope(message, 'Message bus disposed');
|
|
38
|
+
}
|
|
39
|
+
const envelope = {
|
|
40
|
+
message,
|
|
41
|
+
deliveryAttempts: 1,
|
|
42
|
+
firstAttemptAt: new Date(),
|
|
43
|
+
lastAttemptAt: new Date(),
|
|
44
|
+
status: 'pending',
|
|
45
|
+
};
|
|
46
|
+
// Store message if persistence is enabled
|
|
47
|
+
if (this.options.persistence) {
|
|
48
|
+
this.storedMessages.push({ envelope: envelope, storedAt: new Date() });
|
|
49
|
+
}
|
|
50
|
+
// Get subscriptions for recipient
|
|
51
|
+
const subs = this.subscriptions.get(message.recipient);
|
|
52
|
+
if (!subs || subs.length === 0) {
|
|
53
|
+
envelope.status = 'failed';
|
|
54
|
+
envelope.error = `Agent '${message.recipient}' not found`;
|
|
55
|
+
this.messageStatus.set(message.id, 'failed');
|
|
56
|
+
return envelope;
|
|
57
|
+
}
|
|
58
|
+
// Track pending acknowledgment
|
|
59
|
+
if (message.type === 'request') {
|
|
60
|
+
const senderAcks = this.pendingAcks.get(message.sender) ?? new Set();
|
|
61
|
+
senderAcks.add(message.id);
|
|
62
|
+
this.pendingAcks.set(message.sender, senderAcks);
|
|
63
|
+
}
|
|
64
|
+
// Setup TTL expiration
|
|
65
|
+
if (message.ttl) {
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
if (this.messageStatus.get(message.id) !== 'acknowledged') {
|
|
68
|
+
this.messageStatus.set(message.id, 'expired');
|
|
69
|
+
}
|
|
70
|
+
}, message.ttl);
|
|
71
|
+
}
|
|
72
|
+
// Deliver to matching subscribers
|
|
73
|
+
try {
|
|
74
|
+
await this.deliverMessage(message, subs);
|
|
75
|
+
envelope.status = 'delivered';
|
|
76
|
+
this.messageStatus.set(message.id, 'delivered');
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
envelope.status = 'failed';
|
|
80
|
+
envelope.error = error instanceof Error ? error.message : String(error);
|
|
81
|
+
this.messageStatus.set(message.id, 'failed');
|
|
82
|
+
}
|
|
83
|
+
return envelope;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Deliver message to subscribers with queue handling
|
|
87
|
+
*/
|
|
88
|
+
async deliverMessage(message, subs) {
|
|
89
|
+
const matchingSubs = subs.filter((sub) => this.matchesFilter(message, sub.options));
|
|
90
|
+
if (matchingSubs.length === 0) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// Queue messages if agent is busy
|
|
94
|
+
if (this.processingAgent.has(message.recipient)) {
|
|
95
|
+
const queue = this.messageQueue.get(message.recipient) ?? [];
|
|
96
|
+
queue.push(message);
|
|
97
|
+
this.messageQueue.set(message.recipient, queue);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.processingAgent.add(message.recipient);
|
|
101
|
+
try {
|
|
102
|
+
await Promise.all(matchingSubs.map((sub) => sub.handler(message)));
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
this.processingAgent.delete(message.recipient);
|
|
106
|
+
await this.processQueue(message.recipient, subs);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Process queued messages
|
|
111
|
+
*/
|
|
112
|
+
async processQueue(agentId, subs) {
|
|
113
|
+
const queue = this.messageQueue.get(agentId);
|
|
114
|
+
if (!queue || queue.length === 0)
|
|
115
|
+
return;
|
|
116
|
+
const nextMessage = queue.shift();
|
|
117
|
+
this.messageQueue.set(agentId, queue);
|
|
118
|
+
await this.deliverMessage(nextMessage, subs);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Check if message matches subscription filter
|
|
122
|
+
*/
|
|
123
|
+
matchesFilter(message, options) {
|
|
124
|
+
if (!options)
|
|
125
|
+
return true;
|
|
126
|
+
if (options.types && !options.types.includes(message.type))
|
|
127
|
+
return false;
|
|
128
|
+
if (options.from && message.sender !== options.from)
|
|
129
|
+
return false;
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Subscribe to messages for an agent
|
|
134
|
+
*/
|
|
135
|
+
subscribe(agentId, handler, options) {
|
|
136
|
+
const subs = this.subscriptions.get(agentId) ?? [];
|
|
137
|
+
const subscription = { handler, options };
|
|
138
|
+
subs.push(subscription);
|
|
139
|
+
this.subscriptions.set(agentId, subs);
|
|
140
|
+
return () => {
|
|
141
|
+
const currentSubs = this.subscriptions.get(agentId) ?? [];
|
|
142
|
+
const index = currentSubs.indexOf(subscription);
|
|
143
|
+
if (index !== -1) {
|
|
144
|
+
currentSubs.splice(index, 1);
|
|
145
|
+
this.subscriptions.set(agentId, currentSubs);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Acknowledge a message
|
|
151
|
+
*/
|
|
152
|
+
async acknowledge(messageId, agentId, status) {
|
|
153
|
+
this.messageStatus.set(messageId, 'acknowledged');
|
|
154
|
+
// Remove from pending acks
|
|
155
|
+
for (const entry of Array.from(this.pendingAcks.entries())) {
|
|
156
|
+
const [sender, acks] = entry;
|
|
157
|
+
if (acks.has(messageId)) {
|
|
158
|
+
acks.delete(messageId);
|
|
159
|
+
this.pendingAcks.set(sender, acks);
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get pending acknowledgments for a sender
|
|
166
|
+
*/
|
|
167
|
+
getPendingAcks(senderId) {
|
|
168
|
+
const acks = this.pendingAcks.get(senderId);
|
|
169
|
+
return acks ? Array.from(acks) : [];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get message delivery status
|
|
173
|
+
*/
|
|
174
|
+
getMessageStatus(messageId) {
|
|
175
|
+
return this.messageStatus.get(messageId);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get handoff status
|
|
179
|
+
*/
|
|
180
|
+
getHandoffStatus(handoffId) {
|
|
181
|
+
return this.handoffs.get(handoffId)?.status;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get handoff history (previous attempts)
|
|
185
|
+
*/
|
|
186
|
+
getHandoffHistory(handoffId) {
|
|
187
|
+
return this.handoffs.get(handoffId)?.previousAttempts ?? [];
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Register a handoff
|
|
191
|
+
*/
|
|
192
|
+
registerHandoff(request, originalMessage) {
|
|
193
|
+
const state = {
|
|
194
|
+
request,
|
|
195
|
+
status: 'pending',
|
|
196
|
+
previousAttempts: request.previousAttempt ? [request.previousAttempt] : [],
|
|
197
|
+
originalMessage,
|
|
198
|
+
};
|
|
199
|
+
// Setup timeout if specified
|
|
200
|
+
if (request.timeout) {
|
|
201
|
+
state.timeoutId = setTimeout(() => {
|
|
202
|
+
const currentState = this.handoffs.get(request.id);
|
|
203
|
+
if (currentState && currentState.status === 'pending') {
|
|
204
|
+
currentState.status = 'expired';
|
|
205
|
+
this.handoffs.set(request.id, currentState);
|
|
206
|
+
// Notify initiator of timeout
|
|
207
|
+
if (request.onTimeout) {
|
|
208
|
+
const timeoutMsg = {
|
|
209
|
+
id: `timeout_${request.id}`,
|
|
210
|
+
type: 'handoff',
|
|
211
|
+
sender: 'system',
|
|
212
|
+
recipient: request.fromAgent,
|
|
213
|
+
payload: { action: 'timeout', handoffId: request.id },
|
|
214
|
+
timestamp: new Date(),
|
|
215
|
+
};
|
|
216
|
+
request.onTimeout(timeoutMsg);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}, request.timeout);
|
|
220
|
+
}
|
|
221
|
+
this.handoffs.set(request.id, state);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get handoff request info
|
|
225
|
+
*/
|
|
226
|
+
getHandoffRequest(handoffId) {
|
|
227
|
+
return this.handoffs.get(handoffId)?.request;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Update handoff status
|
|
231
|
+
*/
|
|
232
|
+
updateHandoffStatus(handoffId, status) {
|
|
233
|
+
const state = this.handoffs.get(handoffId);
|
|
234
|
+
if (state) {
|
|
235
|
+
// Clear timeout if pending timeout exists
|
|
236
|
+
if (state.timeoutId) {
|
|
237
|
+
clearTimeout(state.timeoutId);
|
|
238
|
+
}
|
|
239
|
+
state.status = status;
|
|
240
|
+
this.handoffs.set(handoffId, state);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get stored messages (for persistence)
|
|
245
|
+
*/
|
|
246
|
+
getStoredMessages() {
|
|
247
|
+
return this.storedMessages.map((s) => s.envelope);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get message history for an agent
|
|
251
|
+
*/
|
|
252
|
+
getMessageHistory(agentId, options) {
|
|
253
|
+
let messages = this.storedMessages
|
|
254
|
+
.filter((s) => s.envelope.message.recipient === agentId ||
|
|
255
|
+
s.envelope.message.sender === agentId)
|
|
256
|
+
.map((s) => s.envelope);
|
|
257
|
+
if (options?.from) {
|
|
258
|
+
messages = messages.filter((m) => m.message.timestamp >= options.from);
|
|
259
|
+
}
|
|
260
|
+
if (options?.to) {
|
|
261
|
+
messages = messages.filter((m) => m.message.timestamp <= options.to);
|
|
262
|
+
}
|
|
263
|
+
if (options?.limit) {
|
|
264
|
+
messages = messages.slice(-options.limit);
|
|
265
|
+
}
|
|
266
|
+
return messages;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Clear old messages
|
|
270
|
+
*/
|
|
271
|
+
clearMessages(options) {
|
|
272
|
+
if (options?.olderThan) {
|
|
273
|
+
this.storedMessages = this.storedMessages.filter((s) => s.storedAt >= options.olderThan);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
this.storedMessages = [];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Dispose the message bus
|
|
281
|
+
*/
|
|
282
|
+
dispose() {
|
|
283
|
+
this.disposed = true;
|
|
284
|
+
this.subscriptions.clear();
|
|
285
|
+
this.pendingAcks.clear();
|
|
286
|
+
this.messageStatus.clear();
|
|
287
|
+
this.messageQueue.clear();
|
|
288
|
+
this.processingAgent.clear();
|
|
289
|
+
// Clear all handoff timeouts
|
|
290
|
+
for (const state of Array.from(this.handoffs.values())) {
|
|
291
|
+
if (state.timeoutId) {
|
|
292
|
+
clearTimeout(state.timeoutId);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
this.handoffs.clear();
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Create a failed envelope
|
|
299
|
+
*/
|
|
300
|
+
createFailedEnvelope(message, error) {
|
|
301
|
+
return {
|
|
302
|
+
message,
|
|
303
|
+
deliveryAttempts: 0,
|
|
304
|
+
firstAttemptAt: new Date(),
|
|
305
|
+
lastAttemptAt: new Date(),
|
|
306
|
+
status: 'failed',
|
|
307
|
+
error,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
// =============================================================================
|
|
312
|
+
// Factory Function
|
|
313
|
+
// =============================================================================
|
|
314
|
+
/**
|
|
315
|
+
* Create a new message bus instance
|
|
316
|
+
*/
|
|
317
|
+
export function createMessageBus(options) {
|
|
318
|
+
return new AgentMessageBus(options);
|
|
319
|
+
}
|
|
320
|
+
// =============================================================================
|
|
321
|
+
// Helper Functions
|
|
322
|
+
// =============================================================================
|
|
323
|
+
/**
|
|
324
|
+
* Generate a unique message ID
|
|
325
|
+
*/
|
|
326
|
+
function generateMessageId() {
|
|
327
|
+
return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Generate a unique handoff ID
|
|
331
|
+
*/
|
|
332
|
+
function generateHandoffId() {
|
|
333
|
+
return `handoff_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Generate a unique correlation ID
|
|
337
|
+
*/
|
|
338
|
+
function generateCorrelationId() {
|
|
339
|
+
return `corr_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Resolve agent ID from Worker, WorkerRef, or string
|
|
343
|
+
*/
|
|
344
|
+
function resolveAgentId(agent) {
|
|
345
|
+
if (typeof agent === 'string')
|
|
346
|
+
return agent;
|
|
347
|
+
return agent.id;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Send a message to a specific agent
|
|
351
|
+
*/
|
|
352
|
+
export async function sendToAgent(bus, sender, recipient, payload, options) {
|
|
353
|
+
const message = {
|
|
354
|
+
id: generateMessageId(),
|
|
355
|
+
type: 'notification',
|
|
356
|
+
sender: resolveAgentId(sender),
|
|
357
|
+
recipient: resolveAgentId(recipient),
|
|
358
|
+
payload,
|
|
359
|
+
timestamp: new Date(),
|
|
360
|
+
priority: options?.priority,
|
|
361
|
+
ttl: options?.ttl,
|
|
362
|
+
correlationId: options?.correlationId,
|
|
363
|
+
metadata: options?.metadata,
|
|
364
|
+
};
|
|
365
|
+
return bus.send(message);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Broadcast a message to multiple agents
|
|
369
|
+
*/
|
|
370
|
+
export async function broadcastToGroup(bus, sender, recipients, payload, options) {
|
|
371
|
+
const correlationId = options?.correlationId ?? generateCorrelationId();
|
|
372
|
+
const results = await Promise.all(recipients.map((recipient) => sendToAgent(bus, sender, recipient, payload, {
|
|
373
|
+
...options,
|
|
374
|
+
correlationId,
|
|
375
|
+
})));
|
|
376
|
+
return results;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Send a request to an agent and await response
|
|
380
|
+
*/
|
|
381
|
+
export async function requestFromAgent(bus, sender, recipient, payload, options) {
|
|
382
|
+
const senderId = resolveAgentId(sender);
|
|
383
|
+
const recipientId = resolveAgentId(recipient);
|
|
384
|
+
const messageId = generateMessageId();
|
|
385
|
+
const timeout = options?.timeout ?? 30000;
|
|
386
|
+
return new Promise((resolve, reject) => {
|
|
387
|
+
let timeoutId;
|
|
388
|
+
let unsubscribe;
|
|
389
|
+
// Setup response handler
|
|
390
|
+
unsubscribe = bus.subscribe(senderId, (response) => {
|
|
391
|
+
if (response.correlationId === messageId) {
|
|
392
|
+
clearTimeout(timeoutId);
|
|
393
|
+
unsubscribe?.();
|
|
394
|
+
if (response.type === 'error') {
|
|
395
|
+
const errorPayload = response.payload;
|
|
396
|
+
reject(new Error(errorPayload.error ?? 'Request failed'));
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
resolve(response);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
// Setup timeout
|
|
404
|
+
timeoutId = setTimeout(() => {
|
|
405
|
+
unsubscribe?.();
|
|
406
|
+
reject(new Error('Request timeout'));
|
|
407
|
+
}, timeout);
|
|
408
|
+
// Send request
|
|
409
|
+
const message = {
|
|
410
|
+
id: messageId,
|
|
411
|
+
type: 'request',
|
|
412
|
+
sender: senderId,
|
|
413
|
+
recipient: recipientId,
|
|
414
|
+
payload,
|
|
415
|
+
timestamp: new Date(),
|
|
416
|
+
correlationId: messageId,
|
|
417
|
+
replyTo: senderId,
|
|
418
|
+
priority: options?.priority,
|
|
419
|
+
ttl: options?.ttl,
|
|
420
|
+
metadata: options?.metadata,
|
|
421
|
+
};
|
|
422
|
+
bus.send(message).then((envelope) => {
|
|
423
|
+
// Fail fast if delivery failed (recipient not found, etc.)
|
|
424
|
+
if (envelope.status === 'failed') {
|
|
425
|
+
clearTimeout(timeoutId);
|
|
426
|
+
unsubscribe?.();
|
|
427
|
+
reject(new Error(envelope.error ?? 'Message delivery failed'));
|
|
428
|
+
}
|
|
429
|
+
}).catch((error) => {
|
|
430
|
+
clearTimeout(timeoutId);
|
|
431
|
+
unsubscribe?.();
|
|
432
|
+
reject(error);
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Register a message handler for an agent
|
|
438
|
+
*/
|
|
439
|
+
export function onMessage(bus, agentId, handler, options) {
|
|
440
|
+
return bus.subscribe(agentId, handler, {
|
|
441
|
+
from: options?.from,
|
|
442
|
+
types: options?.types,
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Send an acknowledgment for a received message
|
|
447
|
+
*/
|
|
448
|
+
export async function acknowledge(bus, message, status, result) {
|
|
449
|
+
// Send ack message to original sender
|
|
450
|
+
const ackMessage = {
|
|
451
|
+
id: generateMessageId(),
|
|
452
|
+
type: 'ack',
|
|
453
|
+
sender: message.recipient,
|
|
454
|
+
recipient: message.sender,
|
|
455
|
+
payload: {
|
|
456
|
+
messageId: message.id,
|
|
457
|
+
status,
|
|
458
|
+
timestamp: new Date(),
|
|
459
|
+
agentId: message.recipient,
|
|
460
|
+
result,
|
|
461
|
+
},
|
|
462
|
+
timestamp: new Date(),
|
|
463
|
+
correlationId: message.id,
|
|
464
|
+
};
|
|
465
|
+
await bus.send(ackMessage);
|
|
466
|
+
await bus.acknowledge(message.id, message.recipient, status);
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Execute request-response pattern
|
|
470
|
+
*/
|
|
471
|
+
export async function requestResponse(bus, options) {
|
|
472
|
+
return requestFromAgent(bus, options.from, options.to, options.payload, {
|
|
473
|
+
timeout: options.timeout,
|
|
474
|
+
priority: options.priority,
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Execute fan-out pattern - distribute work to multiple agents
|
|
479
|
+
*/
|
|
480
|
+
export async function fanOut(bus, options) {
|
|
481
|
+
const correlationId = generateCorrelationId();
|
|
482
|
+
const timeout = options.timeout ?? 30000;
|
|
483
|
+
const fromId = resolveAgentId(options.from);
|
|
484
|
+
const results = await Promise.all(options.to.map(async (agent) => {
|
|
485
|
+
const agentId = resolveAgentId(agent);
|
|
486
|
+
try {
|
|
487
|
+
const response = await requestFromAgent(bus, fromId, agentId, options.payload, { timeout, correlationId });
|
|
488
|
+
return {
|
|
489
|
+
agentId,
|
|
490
|
+
success: true,
|
|
491
|
+
payload: response.payload,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
catch (error) {
|
|
495
|
+
if (!options.continueOnError) {
|
|
496
|
+
throw error;
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
agentId,
|
|
500
|
+
success: false,
|
|
501
|
+
error: error instanceof Error ? error.message : String(error),
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
}));
|
|
505
|
+
return results;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Execute fan-in pattern - collect responses from multiple agents
|
|
509
|
+
*/
|
|
510
|
+
export async function fanIn(bus, options) {
|
|
511
|
+
const results = await Promise.all(options.sources.map((source) => {
|
|
512
|
+
const sourceId = resolveAgentId(source);
|
|
513
|
+
return options.onSourceMessage(sourceId);
|
|
514
|
+
}));
|
|
515
|
+
return results;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Execute pipeline pattern - chain agents in sequence
|
|
519
|
+
*/
|
|
520
|
+
export async function pipeline(bus, options) {
|
|
521
|
+
const initiatorId = resolveAgentId(options.initiator);
|
|
522
|
+
let currentPayload = options.input;
|
|
523
|
+
let lastResponse;
|
|
524
|
+
for (const stage of options.stages) {
|
|
525
|
+
const stageId = resolveAgentId(stage);
|
|
526
|
+
lastResponse = await requestFromAgent(bus, initiatorId, stageId, currentPayload, { timeout: options.stageTimeout });
|
|
527
|
+
currentPayload = lastResponse.payload;
|
|
528
|
+
}
|
|
529
|
+
return lastResponse;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Initiate a handoff to another agent
|
|
533
|
+
*/
|
|
534
|
+
export async function initiateHandoff(bus, options) {
|
|
535
|
+
const handoffId = generateHandoffId();
|
|
536
|
+
const fromAgentId = resolveAgentId(options.fromAgent);
|
|
537
|
+
const toAgentId = resolveAgentId(options.toAgent);
|
|
538
|
+
const request = {
|
|
539
|
+
id: handoffId,
|
|
540
|
+
fromAgent: fromAgentId,
|
|
541
|
+
toAgent: toAgentId,
|
|
542
|
+
context: options.context,
|
|
543
|
+
reason: options.reason,
|
|
544
|
+
timestamp: new Date(),
|
|
545
|
+
timeout: options.timeout,
|
|
546
|
+
previousAttempt: options.previousAttempt,
|
|
547
|
+
onTimeout: options.onTimeout,
|
|
548
|
+
};
|
|
549
|
+
// Register handoff in bus
|
|
550
|
+
bus.registerHandoff(request);
|
|
551
|
+
// Send handoff request message
|
|
552
|
+
const message = {
|
|
553
|
+
id: generateMessageId(),
|
|
554
|
+
type: 'handoff',
|
|
555
|
+
sender: fromAgentId,
|
|
556
|
+
recipient: toAgentId,
|
|
557
|
+
payload: {
|
|
558
|
+
action: 'request',
|
|
559
|
+
handoffId,
|
|
560
|
+
context: options.context,
|
|
561
|
+
reason: options.reason,
|
|
562
|
+
},
|
|
563
|
+
timestamp: new Date(),
|
|
564
|
+
correlationId: handoffId,
|
|
565
|
+
};
|
|
566
|
+
await bus.send(message);
|
|
567
|
+
return { handoffId, status: 'pending' };
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Accept a pending handoff
|
|
571
|
+
*/
|
|
572
|
+
export async function acceptHandoff(bus, handoffId, agentId) {
|
|
573
|
+
const status = bus.getHandoffStatus(handoffId);
|
|
574
|
+
if (!status) {
|
|
575
|
+
throw new Error('Handoff not found');
|
|
576
|
+
}
|
|
577
|
+
if (status !== 'pending') {
|
|
578
|
+
throw new Error(`Cannot accept handoff in '${status}' state`);
|
|
579
|
+
}
|
|
580
|
+
bus.updateHandoffStatus(handoffId, 'accepted');
|
|
581
|
+
// Get the handoff request to find the initiating agent
|
|
582
|
+
const request = bus.getHandoffRequest(handoffId);
|
|
583
|
+
if (request) {
|
|
584
|
+
const acceptMessage = {
|
|
585
|
+
id: generateMessageId(),
|
|
586
|
+
type: 'handoff',
|
|
587
|
+
sender: agentId,
|
|
588
|
+
recipient: request.fromAgent,
|
|
589
|
+
payload: {
|
|
590
|
+
action: 'accepted',
|
|
591
|
+
handoffId,
|
|
592
|
+
},
|
|
593
|
+
timestamp: new Date(),
|
|
594
|
+
correlationId: handoffId,
|
|
595
|
+
};
|
|
596
|
+
await bus.send(acceptMessage);
|
|
597
|
+
}
|
|
598
|
+
return { handoffId, status: 'accepted' };
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Reject a pending handoff
|
|
602
|
+
*/
|
|
603
|
+
export async function rejectHandoff(bus, handoffId, agentId, options) {
|
|
604
|
+
const status = bus.getHandoffStatus(handoffId);
|
|
605
|
+
if (!status) {
|
|
606
|
+
throw new Error('Handoff not found');
|
|
607
|
+
}
|
|
608
|
+
bus.updateHandoffStatus(handoffId, 'rejected');
|
|
609
|
+
// Get the handoff request to find the initiating agent
|
|
610
|
+
const request = bus.getHandoffRequest(handoffId);
|
|
611
|
+
if (request) {
|
|
612
|
+
const rejectMessage = {
|
|
613
|
+
id: generateMessageId(),
|
|
614
|
+
type: 'handoff',
|
|
615
|
+
sender: agentId,
|
|
616
|
+
recipient: request.fromAgent,
|
|
617
|
+
payload: {
|
|
618
|
+
action: 'rejected',
|
|
619
|
+
handoffId,
|
|
620
|
+
reason: options?.reason,
|
|
621
|
+
},
|
|
622
|
+
timestamp: new Date(),
|
|
623
|
+
correlationId: handoffId,
|
|
624
|
+
};
|
|
625
|
+
await bus.send(rejectMessage);
|
|
626
|
+
}
|
|
627
|
+
return { handoffId, status: 'rejected', reason: options?.reason };
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Complete a handoff (mark work as done)
|
|
631
|
+
*/
|
|
632
|
+
export async function completeHandoff(bus, handoffId, agentId, options) {
|
|
633
|
+
const status = bus.getHandoffStatus(handoffId);
|
|
634
|
+
if (!status) {
|
|
635
|
+
throw new Error('Handoff not found');
|
|
636
|
+
}
|
|
637
|
+
if (status !== 'accepted') {
|
|
638
|
+
throw new Error('Handoff not accepted');
|
|
639
|
+
}
|
|
640
|
+
bus.updateHandoffStatus(handoffId, 'completed');
|
|
641
|
+
// Get the handoff request to find the initiating agent
|
|
642
|
+
const request = bus.getHandoffRequest(handoffId);
|
|
643
|
+
if (request) {
|
|
644
|
+
const completeMessage = {
|
|
645
|
+
id: generateMessageId(),
|
|
646
|
+
type: 'handoff',
|
|
647
|
+
sender: agentId,
|
|
648
|
+
recipient: request.fromAgent,
|
|
649
|
+
payload: {
|
|
650
|
+
action: 'completed',
|
|
651
|
+
handoffId,
|
|
652
|
+
result: options?.result,
|
|
653
|
+
},
|
|
654
|
+
timestamp: new Date(),
|
|
655
|
+
correlationId: handoffId,
|
|
656
|
+
};
|
|
657
|
+
await bus.send(completeMessage);
|
|
658
|
+
}
|
|
659
|
+
return {
|
|
660
|
+
handoffId,
|
|
661
|
+
status: 'completed',
|
|
662
|
+
result: options?.result,
|
|
663
|
+
completedAt: new Date(),
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
//# sourceMappingURL=agent-comms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-comms.js","sourceRoot":"","sources":["../src/agent-comms.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA6NH,gFAAgF;AAChF,iCAAiC;AACjC,gFAAgF;AAEhF;;GAEG;AACH,MAAM,OAAO,eAAe;IAClB,aAAa,GAAG,IAAI,GAAG,EAA0B,CAAA;IACjD,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAA;IAC5C,aAAa,GAAG,IAAI,GAAG,EAA0B,CAAA;IACjD,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAA;IAC1C,cAAc,GAAoB,EAAE,CAAA;IACpC,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAA;IAChD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAA;IACnC,QAAQ,GAAG,KAAK,CAAA;IAChB,OAAO,CAA6B;IAE5C,YAAY,UAA6B,EAAE;QACzC,IAAI,CAAC,OAA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