@wundr.io/autogen-orchestrator 1.0.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/README.md +1088 -0
- package/dist/group-chat.d.ts +327 -0
- package/dist/group-chat.d.ts.map +1 -0
- package/dist/group-chat.js +724 -0
- package/dist/group-chat.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/nested-chat.d.ts +296 -0
- package/dist/nested-chat.d.ts.map +1 -0
- package/dist/nested-chat.js +600 -0
- package/dist/nested-chat.js.map +1 -0
- package/dist/speaker-selection.d.ts +195 -0
- package/dist/speaker-selection.d.ts.map +1 -0
- package/dist/speaker-selection.js +569 -0
- package/dist/speaker-selection.js.map +1 -0
- package/dist/termination.d.ts +237 -0
- package/dist/termination.d.ts.map +1 -0
- package/dist/termination.js +566 -0
- package/dist/termination.js.map +1 -0
- package/dist/types.d.ts +1248 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +201 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -0
- package/src/group-chat.ts +980 -0
- package/src/index.ts +145 -0
- package/src/nested-chat.ts +795 -0
- package/src/speaker-selection.ts +794 -0
- package/src/termination.ts +704 -0
- package/src/types.ts +876 -0
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Termination Condition Handlers for AutoGen-style Group Chat
|
|
4
|
+
*
|
|
5
|
+
* Implements various termination conditions for multi-agent conversations
|
|
6
|
+
* including keyword-based, round-based, timeout, and custom evaluators.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TerminationPresets = exports.TerminationManager = exports.CustomHandler = exports.ConsensusHandler = exports.FunctionHandler = exports.TimeoutHandler = exports.KeywordHandler = exports.MaxMessagesHandler = exports.MaxRoundsHandler = void 0;
|
|
10
|
+
exports.createTerminationHandler = createTerminationHandler;
|
|
11
|
+
/**
|
|
12
|
+
* Type guard to check if value is a number
|
|
13
|
+
*/
|
|
14
|
+
function isNumber(value) {
|
|
15
|
+
return typeof value === 'number';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Type guard to check if value is a string or string array
|
|
19
|
+
*/
|
|
20
|
+
function isStringOrStringArray(value) {
|
|
21
|
+
return typeof value === 'string' || Array.isArray(value);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Type guard to check if value is a ConsensusConfigType
|
|
25
|
+
*/
|
|
26
|
+
function isConsensusConfig(value) {
|
|
27
|
+
return (typeof value === 'object' &&
|
|
28
|
+
value !== null &&
|
|
29
|
+
'threshold' in value &&
|
|
30
|
+
'agreementKeywords' in value);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Factory function to create termination handlers
|
|
34
|
+
* @param condition - Termination condition configuration
|
|
35
|
+
* @returns Appropriate termination handler
|
|
36
|
+
*/
|
|
37
|
+
function createTerminationHandler(condition) {
|
|
38
|
+
switch (condition.type) {
|
|
39
|
+
case 'max_rounds':
|
|
40
|
+
if (!isNumber(condition.value)) {
|
|
41
|
+
throw new Error('max_rounds condition requires a number value');
|
|
42
|
+
}
|
|
43
|
+
return new MaxRoundsHandler(condition.value);
|
|
44
|
+
case 'max_messages':
|
|
45
|
+
if (!isNumber(condition.value)) {
|
|
46
|
+
throw new Error('max_messages condition requires a number value');
|
|
47
|
+
}
|
|
48
|
+
return new MaxMessagesHandler(condition.value);
|
|
49
|
+
case 'keyword':
|
|
50
|
+
if (!isStringOrStringArray(condition.value)) {
|
|
51
|
+
throw new Error('keyword condition requires a string or string[] value');
|
|
52
|
+
}
|
|
53
|
+
return new KeywordHandler(condition.value);
|
|
54
|
+
case 'timeout':
|
|
55
|
+
if (!isNumber(condition.value)) {
|
|
56
|
+
throw new Error('timeout condition requires a number value');
|
|
57
|
+
}
|
|
58
|
+
return new TimeoutHandler(condition.value);
|
|
59
|
+
case 'function':
|
|
60
|
+
if (!condition.evaluator) {
|
|
61
|
+
throw new Error('function condition requires an evaluator');
|
|
62
|
+
}
|
|
63
|
+
return new FunctionHandler(condition.evaluator);
|
|
64
|
+
case 'consensus':
|
|
65
|
+
if (!isConsensusConfig(condition.value)) {
|
|
66
|
+
throw new Error('consensus condition requires a ConsensusConfigType value');
|
|
67
|
+
}
|
|
68
|
+
return new ConsensusHandler(condition.value);
|
|
69
|
+
case 'custom':
|
|
70
|
+
return new CustomHandler(condition);
|
|
71
|
+
default: {
|
|
72
|
+
const exhaustiveCheck = condition.type;
|
|
73
|
+
throw new Error(`Unknown termination condition type: ${exhaustiveCheck}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Handler for maximum rounds termination
|
|
79
|
+
*/
|
|
80
|
+
class MaxRoundsHandler {
|
|
81
|
+
maxRounds;
|
|
82
|
+
/**
|
|
83
|
+
* Create a max rounds handler
|
|
84
|
+
* @param maxRounds - Maximum number of rounds allowed
|
|
85
|
+
*/
|
|
86
|
+
constructor(maxRounds) {
|
|
87
|
+
this.maxRounds = maxRounds;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Evaluate if max rounds has been reached
|
|
91
|
+
* @param messages - Conversation messages
|
|
92
|
+
* @param participants - Chat participants
|
|
93
|
+
* @param context - Current chat context
|
|
94
|
+
* @returns Termination result
|
|
95
|
+
*/
|
|
96
|
+
async evaluate(_messages, _participants, context) {
|
|
97
|
+
const shouldTerminate = context.currentRound >= this.maxRounds;
|
|
98
|
+
return {
|
|
99
|
+
shouldTerminate,
|
|
100
|
+
reason: shouldTerminate
|
|
101
|
+
? `Maximum rounds reached: ${context.currentRound}/${this.maxRounds}`
|
|
102
|
+
: undefined,
|
|
103
|
+
summary: shouldTerminate
|
|
104
|
+
? `Conversation ended after ${this.maxRounds} rounds.`
|
|
105
|
+
: undefined,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.MaxRoundsHandler = MaxRoundsHandler;
|
|
110
|
+
/**
|
|
111
|
+
* Handler for maximum messages termination
|
|
112
|
+
*/
|
|
113
|
+
class MaxMessagesHandler {
|
|
114
|
+
maxMessages;
|
|
115
|
+
/**
|
|
116
|
+
* Create a max messages handler
|
|
117
|
+
* @param maxMessages - Maximum number of messages allowed
|
|
118
|
+
*/
|
|
119
|
+
constructor(maxMessages) {
|
|
120
|
+
this.maxMessages = maxMessages;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Evaluate if max messages has been reached
|
|
124
|
+
* @param messages - Conversation messages
|
|
125
|
+
* @param participants - Chat participants
|
|
126
|
+
* @param context - Current chat context
|
|
127
|
+
* @returns Termination result
|
|
128
|
+
*/
|
|
129
|
+
async evaluate(messages, _participants, _context) {
|
|
130
|
+
const shouldTerminate = messages.length >= this.maxMessages;
|
|
131
|
+
return {
|
|
132
|
+
shouldTerminate,
|
|
133
|
+
reason: shouldTerminate
|
|
134
|
+
? `Maximum messages reached: ${messages.length}/${this.maxMessages}`
|
|
135
|
+
: undefined,
|
|
136
|
+
summary: shouldTerminate
|
|
137
|
+
? `Conversation ended after ${this.maxMessages} messages.`
|
|
138
|
+
: undefined,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.MaxMessagesHandler = MaxMessagesHandler;
|
|
143
|
+
/**
|
|
144
|
+
* Handler for keyword-based termination
|
|
145
|
+
*/
|
|
146
|
+
class KeywordHandler {
|
|
147
|
+
keywords;
|
|
148
|
+
caseSensitive;
|
|
149
|
+
requireAll;
|
|
150
|
+
/**
|
|
151
|
+
* Create a keyword handler
|
|
152
|
+
* @param keywords - Keywords to detect
|
|
153
|
+
* @param caseSensitive - Whether matching is case-sensitive
|
|
154
|
+
* @param requireAll - Whether all keywords must be present
|
|
155
|
+
*/
|
|
156
|
+
constructor(keywords, caseSensitive = false, requireAll = false) {
|
|
157
|
+
this.keywords = Array.isArray(keywords) ? keywords : [keywords];
|
|
158
|
+
this.caseSensitive = caseSensitive;
|
|
159
|
+
this.requireAll = requireAll;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Evaluate if termination keywords are found
|
|
163
|
+
* @param messages - Conversation messages
|
|
164
|
+
* @param participants - Chat participants
|
|
165
|
+
* @param context - Current chat context
|
|
166
|
+
* @returns Termination result
|
|
167
|
+
*/
|
|
168
|
+
async evaluate(messages, _participants, _context) {
|
|
169
|
+
const lastMessage = messages[messages.length - 1];
|
|
170
|
+
if (!lastMessage) {
|
|
171
|
+
return { shouldTerminate: false };
|
|
172
|
+
}
|
|
173
|
+
const content = this.caseSensitive
|
|
174
|
+
? lastMessage.content
|
|
175
|
+
: lastMessage.content.toLowerCase();
|
|
176
|
+
const matchedKeywords = [];
|
|
177
|
+
for (const keyword of this.keywords) {
|
|
178
|
+
const searchKeyword = this.caseSensitive
|
|
179
|
+
? keyword
|
|
180
|
+
: keyword.toLowerCase();
|
|
181
|
+
if (content.includes(searchKeyword)) {
|
|
182
|
+
matchedKeywords.push(keyword);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const shouldTerminate = this.requireAll
|
|
186
|
+
? matchedKeywords.length === this.keywords.length
|
|
187
|
+
: matchedKeywords.length > 0;
|
|
188
|
+
return {
|
|
189
|
+
shouldTerminate,
|
|
190
|
+
reason: shouldTerminate
|
|
191
|
+
? `Termination keyword(s) detected: ${matchedKeywords.join(', ')}`
|
|
192
|
+
: undefined,
|
|
193
|
+
summary: shouldTerminate
|
|
194
|
+
? `Conversation terminated by keyword: "${matchedKeywords[0]}"`
|
|
195
|
+
: undefined,
|
|
196
|
+
data: shouldTerminate ? { matchedKeywords } : undefined,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
exports.KeywordHandler = KeywordHandler;
|
|
201
|
+
/**
|
|
202
|
+
* Handler for timeout-based termination
|
|
203
|
+
*/
|
|
204
|
+
class TimeoutHandler {
|
|
205
|
+
timeoutMs;
|
|
206
|
+
/**
|
|
207
|
+
* Create a timeout handler
|
|
208
|
+
* @param timeoutMs - Timeout duration in milliseconds
|
|
209
|
+
*/
|
|
210
|
+
constructor(timeoutMs) {
|
|
211
|
+
this.timeoutMs = timeoutMs;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Evaluate if timeout has been reached
|
|
215
|
+
* @param messages - Conversation messages
|
|
216
|
+
* @param participants - Chat participants
|
|
217
|
+
* @param context - Current chat context
|
|
218
|
+
* @returns Termination result
|
|
219
|
+
*/
|
|
220
|
+
async evaluate(_messages, _participants, context) {
|
|
221
|
+
const elapsed = Date.now() - context.startTime.getTime();
|
|
222
|
+
const shouldTerminate = elapsed >= this.timeoutMs;
|
|
223
|
+
return {
|
|
224
|
+
shouldTerminate,
|
|
225
|
+
reason: shouldTerminate
|
|
226
|
+
? `Timeout reached: ${Math.round(elapsed / 1000)}s / ${Math.round(this.timeoutMs / 1000)}s`
|
|
227
|
+
: undefined,
|
|
228
|
+
summary: shouldTerminate
|
|
229
|
+
? `Conversation timed out after ${Math.round(elapsed / 1000)} seconds.`
|
|
230
|
+
: undefined,
|
|
231
|
+
data: shouldTerminate
|
|
232
|
+
? { elapsedMs: elapsed, timeoutMs: this.timeoutMs }
|
|
233
|
+
: undefined,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.TimeoutHandler = TimeoutHandler;
|
|
238
|
+
/**
|
|
239
|
+
* Handler for function-based termination
|
|
240
|
+
*/
|
|
241
|
+
class FunctionHandler {
|
|
242
|
+
evaluator;
|
|
243
|
+
/**
|
|
244
|
+
* Create a function handler
|
|
245
|
+
* @param evaluator - Custom evaluation function
|
|
246
|
+
*/
|
|
247
|
+
constructor(evaluator) {
|
|
248
|
+
this.evaluator = evaluator;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Evaluate using the custom function
|
|
252
|
+
* @param messages - Conversation messages
|
|
253
|
+
* @param participants - Chat participants
|
|
254
|
+
* @param context - Current chat context
|
|
255
|
+
* @returns Termination result
|
|
256
|
+
*/
|
|
257
|
+
async evaluate(messages, participants, context) {
|
|
258
|
+
try {
|
|
259
|
+
return await this.evaluator(messages, participants, context);
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
263
|
+
return {
|
|
264
|
+
shouldTerminate: false,
|
|
265
|
+
reason: `Function evaluator error: ${errorMessage}`,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.FunctionHandler = FunctionHandler;
|
|
271
|
+
/**
|
|
272
|
+
* Handler for consensus-based termination
|
|
273
|
+
*/
|
|
274
|
+
class ConsensusHandler {
|
|
275
|
+
config;
|
|
276
|
+
/**
|
|
277
|
+
* Create a consensus handler
|
|
278
|
+
* @param config - Consensus configuration
|
|
279
|
+
*/
|
|
280
|
+
constructor(config) {
|
|
281
|
+
this.config = {
|
|
282
|
+
threshold: config.threshold,
|
|
283
|
+
agreementKeywords: config.agreementKeywords || [
|
|
284
|
+
'agree',
|
|
285
|
+
'consensus',
|
|
286
|
+
'approved',
|
|
287
|
+
'done',
|
|
288
|
+
'complete',
|
|
289
|
+
'finished',
|
|
290
|
+
],
|
|
291
|
+
disagreementKeywords: config.disagreementKeywords || [
|
|
292
|
+
'disagree',
|
|
293
|
+
'no',
|
|
294
|
+
'reject',
|
|
295
|
+
'veto',
|
|
296
|
+
'continue',
|
|
297
|
+
],
|
|
298
|
+
minParticipants: config.minParticipants || 2,
|
|
299
|
+
windowSize: config.windowSize || 10,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Evaluate if consensus has been reached
|
|
304
|
+
* @param messages - Conversation messages
|
|
305
|
+
* @param participants - Chat participants
|
|
306
|
+
* @param context - Current chat context
|
|
307
|
+
* @returns Termination result
|
|
308
|
+
*/
|
|
309
|
+
async evaluate(messages, _participants, _context) {
|
|
310
|
+
const windowSize = this.config.windowSize || 10;
|
|
311
|
+
const recentMessages = messages.slice(-windowSize);
|
|
312
|
+
// Track votes per participant
|
|
313
|
+
const votes = new Map();
|
|
314
|
+
for (const message of recentMessages) {
|
|
315
|
+
const contentLower = message.content.toLowerCase();
|
|
316
|
+
// Check for agreement keywords
|
|
317
|
+
const hasAgreement = this.config.agreementKeywords.some(keyword => contentLower.includes(keyword.toLowerCase()));
|
|
318
|
+
// Check for disagreement keywords
|
|
319
|
+
const hasDisagreement = this.config.disagreementKeywords.some(keyword => contentLower.includes(keyword.toLowerCase()));
|
|
320
|
+
if (hasAgreement && !hasDisagreement) {
|
|
321
|
+
votes.set(message.name, 'agree');
|
|
322
|
+
}
|
|
323
|
+
else if (hasDisagreement) {
|
|
324
|
+
votes.set(message.name, 'disagree');
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const totalVoters = votes.size;
|
|
328
|
+
const agreements = Array.from(votes.values()).filter(v => v === 'agree').length;
|
|
329
|
+
const minParticipants = this.config.minParticipants || 2;
|
|
330
|
+
// Check if enough participants have voted
|
|
331
|
+
if (totalVoters < minParticipants) {
|
|
332
|
+
return {
|
|
333
|
+
shouldTerminate: false,
|
|
334
|
+
reason: `Not enough participants voted: ${totalVoters}/${minParticipants}`,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
const agreementRate = agreements / totalVoters;
|
|
338
|
+
const shouldTerminate = agreementRate >= this.config.threshold;
|
|
339
|
+
return {
|
|
340
|
+
shouldTerminate,
|
|
341
|
+
reason: shouldTerminate
|
|
342
|
+
? `Consensus reached: ${Math.round(agreementRate * 100)}% agreement (threshold: ${Math.round(this.config.threshold * 100)}%)`
|
|
343
|
+
: `No consensus: ${Math.round(agreementRate * 100)}% agreement (need: ${Math.round(this.config.threshold * 100)}%)`,
|
|
344
|
+
summary: shouldTerminate
|
|
345
|
+
? `Conversation ended with ${Math.round(agreementRate * 100)}% participant agreement.`
|
|
346
|
+
: undefined,
|
|
347
|
+
data: {
|
|
348
|
+
agreementRate,
|
|
349
|
+
totalVoters,
|
|
350
|
+
agreements,
|
|
351
|
+
threshold: this.config.threshold,
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
exports.ConsensusHandler = ConsensusHandler;
|
|
357
|
+
/**
|
|
358
|
+
* Handler for custom termination conditions
|
|
359
|
+
*/
|
|
360
|
+
class CustomHandler {
|
|
361
|
+
condition;
|
|
362
|
+
/**
|
|
363
|
+
* Create a custom handler
|
|
364
|
+
* @param condition - Custom termination condition
|
|
365
|
+
*/
|
|
366
|
+
constructor(condition) {
|
|
367
|
+
this.condition = condition;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Evaluate the custom condition
|
|
371
|
+
* @param messages - Conversation messages
|
|
372
|
+
* @param participants - Chat participants
|
|
373
|
+
* @param context - Current chat context
|
|
374
|
+
* @returns Termination result
|
|
375
|
+
*/
|
|
376
|
+
async evaluate(messages, participants, context) {
|
|
377
|
+
// If there's a custom evaluator, use it
|
|
378
|
+
if (this.condition.evaluator) {
|
|
379
|
+
return this.condition.evaluator(messages, participants, context);
|
|
380
|
+
}
|
|
381
|
+
// Otherwise, try to interpret the value
|
|
382
|
+
const value = this.condition.value;
|
|
383
|
+
if (typeof value === 'function') {
|
|
384
|
+
return value(messages, participants, context);
|
|
385
|
+
}
|
|
386
|
+
// Default: no termination
|
|
387
|
+
return {
|
|
388
|
+
shouldTerminate: false,
|
|
389
|
+
reason: 'Custom condition not properly configured',
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
exports.CustomHandler = CustomHandler;
|
|
394
|
+
/**
|
|
395
|
+
* Manager for multiple termination conditions
|
|
396
|
+
*/
|
|
397
|
+
class TerminationManager {
|
|
398
|
+
handlers = new Map();
|
|
399
|
+
conditions = [];
|
|
400
|
+
/**
|
|
401
|
+
* Create a termination manager
|
|
402
|
+
* @param conditions - Initial termination conditions
|
|
403
|
+
*/
|
|
404
|
+
constructor(conditions = []) {
|
|
405
|
+
for (const condition of conditions) {
|
|
406
|
+
this.addCondition(condition);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Add a termination condition
|
|
411
|
+
* @param condition - Condition to add
|
|
412
|
+
*/
|
|
413
|
+
addCondition(condition) {
|
|
414
|
+
const id = `${condition.type}-${this.conditions.length}`;
|
|
415
|
+
const handler = createTerminationHandler(condition);
|
|
416
|
+
this.handlers.set(id, handler);
|
|
417
|
+
this.conditions.push(condition);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Remove a termination condition by type
|
|
421
|
+
* @param type - Condition type to remove
|
|
422
|
+
*/
|
|
423
|
+
removeCondition(type) {
|
|
424
|
+
const indicesToRemove = [];
|
|
425
|
+
this.conditions.forEach((condition, index) => {
|
|
426
|
+
if (condition.type === type) {
|
|
427
|
+
indicesToRemove.push(index);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
// Remove in reverse order to maintain indices
|
|
431
|
+
for (let i = indicesToRemove.length - 1; i >= 0; i--) {
|
|
432
|
+
const index = indicesToRemove[i];
|
|
433
|
+
if (index !== undefined) {
|
|
434
|
+
const id = `${type}-${index}`;
|
|
435
|
+
this.handlers.delete(id);
|
|
436
|
+
this.conditions.splice(index, 1);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Clear all termination conditions
|
|
442
|
+
*/
|
|
443
|
+
clearConditions() {
|
|
444
|
+
this.handlers.clear();
|
|
445
|
+
this.conditions = [];
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Evaluate all termination conditions
|
|
449
|
+
* @param messages - Conversation messages
|
|
450
|
+
* @param participants - Chat participants
|
|
451
|
+
* @param context - Current chat context
|
|
452
|
+
* @returns Combined termination result
|
|
453
|
+
*/
|
|
454
|
+
async evaluate(messages, participants, context) {
|
|
455
|
+
const results = [];
|
|
456
|
+
for (const [id, handler] of this.handlers.entries()) {
|
|
457
|
+
const result = await handler.evaluate(messages, participants, context);
|
|
458
|
+
results.push({ ...result, type: id });
|
|
459
|
+
// Early exit if any condition triggers termination
|
|
460
|
+
if (result.shouldTerminate) {
|
|
461
|
+
return {
|
|
462
|
+
shouldTerminate: true,
|
|
463
|
+
reason: result.reason,
|
|
464
|
+
summary: result.summary,
|
|
465
|
+
data: {
|
|
466
|
+
triggeredBy: id,
|
|
467
|
+
allResults: results,
|
|
468
|
+
},
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return {
|
|
473
|
+
shouldTerminate: false,
|
|
474
|
+
data: { allResults: results },
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Get all configured conditions
|
|
479
|
+
* @returns Array of termination conditions
|
|
480
|
+
*/
|
|
481
|
+
getConditions() {
|
|
482
|
+
return [...this.conditions];
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Check if a specific condition type is configured
|
|
486
|
+
* @param type - Condition type to check
|
|
487
|
+
* @returns Whether the condition type exists
|
|
488
|
+
*/
|
|
489
|
+
hasCondition(type) {
|
|
490
|
+
return this.conditions.some(c => c.type === type);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
exports.TerminationManager = TerminationManager;
|
|
494
|
+
/**
|
|
495
|
+
* Common termination condition presets
|
|
496
|
+
*/
|
|
497
|
+
exports.TerminationPresets = {
|
|
498
|
+
/**
|
|
499
|
+
* Create a preset for task completion detection
|
|
500
|
+
*/
|
|
501
|
+
taskCompletion() {
|
|
502
|
+
return {
|
|
503
|
+
type: 'keyword',
|
|
504
|
+
value: ['TASK_COMPLETE', 'DONE', 'FINISHED', 'COMPLETED', 'END_TASK'],
|
|
505
|
+
description: 'Terminate when task completion keyword is detected',
|
|
506
|
+
};
|
|
507
|
+
},
|
|
508
|
+
/**
|
|
509
|
+
* Create a preset for approval workflows
|
|
510
|
+
*/
|
|
511
|
+
approval() {
|
|
512
|
+
const consensusValue = {
|
|
513
|
+
threshold: 0.75,
|
|
514
|
+
agreementKeywords: ['approve', 'approved', 'lgtm', 'ship it'],
|
|
515
|
+
disagreementKeywords: ['reject', 'denied', 'needs work'],
|
|
516
|
+
minParticipants: 2,
|
|
517
|
+
};
|
|
518
|
+
return {
|
|
519
|
+
type: 'consensus',
|
|
520
|
+
value: consensusValue,
|
|
521
|
+
description: 'Terminate when approval consensus is reached',
|
|
522
|
+
};
|
|
523
|
+
},
|
|
524
|
+
/**
|
|
525
|
+
* Create a preset for quick discussions
|
|
526
|
+
* @param rounds - Maximum rounds
|
|
527
|
+
*/
|
|
528
|
+
quickDiscussion(rounds = 5) {
|
|
529
|
+
return [
|
|
530
|
+
{
|
|
531
|
+
type: 'max_rounds',
|
|
532
|
+
value: rounds,
|
|
533
|
+
description: `Maximum ${rounds} rounds`,
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
type: 'keyword',
|
|
537
|
+
value: ['TERMINATE', 'END'],
|
|
538
|
+
description: 'Manual termination keywords',
|
|
539
|
+
},
|
|
540
|
+
];
|
|
541
|
+
},
|
|
542
|
+
/**
|
|
543
|
+
* Create a preset for long-running tasks
|
|
544
|
+
* @param timeoutMinutes - Timeout in minutes
|
|
545
|
+
*/
|
|
546
|
+
longRunning(timeoutMinutes = 30) {
|
|
547
|
+
return [
|
|
548
|
+
{
|
|
549
|
+
type: 'timeout',
|
|
550
|
+
value: timeoutMinutes * 60 * 1000,
|
|
551
|
+
description: `${timeoutMinutes} minute timeout`,
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
type: 'max_messages',
|
|
555
|
+
value: 100,
|
|
556
|
+
description: 'Maximum 100 messages',
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
type: 'keyword',
|
|
560
|
+
value: ['TERMINATE', 'ABORT', 'CANCEL'],
|
|
561
|
+
description: 'Emergency termination keywords',
|
|
562
|
+
},
|
|
563
|
+
];
|
|
564
|
+
},
|
|
565
|
+
};
|
|
566
|
+
//# sourceMappingURL=termination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"termination.js","sourceRoot":"","sources":["../src/termination.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAmEH,4DA6CC;AAhFD;;GAEG;AACH,SAAS,QAAQ,CAAC,KAAgC;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAC5B,KAAgC;IAEhC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CACxB,KAAgC;IAEhC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,WAAW,IAAI,KAAK;QACpB,mBAAmB,IAAI,KAAK,CAC7B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,SAA+B;IAE/B,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,YAAY;YACf,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;YAClE,CAAC;YACD,OAAO,IAAI,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/C,KAAK,cAAc;YACjB,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,IAAI,kBAAkB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjD,KAAK,SAAS;YACZ,IAAI,CAAC,q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