@lov3kaizen/agentsea-crews 1.1.0 → 1.2.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 +30 -0
- package/dist/Crew-BnvVjN7A.d.mts +1060 -0
- package/dist/Crew-BnvVjN7A.d.ts +1060 -0
- package/dist/DebugMode-CbYgA7Yw.d.mts +190 -0
- package/dist/DebugMode-o5e9gmQ7.d.ts +190 -0
- package/dist/{chunk-6JLVFEU6.mjs → chunk-3NMVWRVW.mjs} +1 -1
- package/dist/{chunk-V6VK6BOL.mjs → chunk-J5KQSOGT.mjs} +142 -30
- package/dist/index.d.mts +975 -0
- package/dist/index.d.ts +975 -0
- package/dist/index.js +155 -53
- package/dist/index.mjs +16 -20
- package/dist/nestjs/index.d.mts +98 -0
- package/dist/nestjs/index.d.ts +98 -0
- package/dist/nestjs/index.js +142 -35
- package/dist/nestjs/index.mjs +1 -1
- package/dist/templates/index.d.mts +78 -0
- package/dist/templates/index.d.ts +78 -0
- package/dist/templates/index.js +142 -35
- package/dist/templates/index.mjs +2 -2
- package/package.json +6 -6
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
type ProficiencyLevel = 'novice' | 'intermediate' | 'expert' | 'master';
|
|
2
|
+
interface Capability {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
proficiency: ProficiencyLevel;
|
|
6
|
+
tools?: string[];
|
|
7
|
+
keywords?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface RoleConfig {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
capabilities: Capability[];
|
|
13
|
+
systemPrompt: string;
|
|
14
|
+
goals?: string[];
|
|
15
|
+
constraints?: string[];
|
|
16
|
+
backstory?: string;
|
|
17
|
+
canDelegate?: boolean;
|
|
18
|
+
canReceiveDelegation?: boolean;
|
|
19
|
+
maxConcurrentTasks?: number;
|
|
20
|
+
}
|
|
21
|
+
interface CapabilityMatch {
|
|
22
|
+
matched: Capability[];
|
|
23
|
+
missing: Capability[];
|
|
24
|
+
score: number;
|
|
25
|
+
canExecute: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface RankedAgent {
|
|
28
|
+
agentName: string;
|
|
29
|
+
score: number;
|
|
30
|
+
matchedCapabilities: Capability[];
|
|
31
|
+
missingCapabilities: Capability[];
|
|
32
|
+
}
|
|
33
|
+
declare const PROFICIENCY_WEIGHTS: Record<ProficiencyLevel, number>;
|
|
34
|
+
|
|
35
|
+
type TaskPriority = 'critical' | 'high' | 'medium' | 'low';
|
|
36
|
+
type TaskStatus = 'pending' | 'assigned' | 'in_progress' | 'completed' | 'failed' | 'blocked' | 'cancelled';
|
|
37
|
+
interface TaskConfig {
|
|
38
|
+
id?: string;
|
|
39
|
+
description: string;
|
|
40
|
+
expectedOutput: string;
|
|
41
|
+
priority?: TaskPriority;
|
|
42
|
+
dependencies?: string[];
|
|
43
|
+
deadline?: Date;
|
|
44
|
+
context?: Record<string, unknown>;
|
|
45
|
+
assignTo?: string;
|
|
46
|
+
requiredCapabilities?: string[];
|
|
47
|
+
estimatedTokens?: number;
|
|
48
|
+
maxRetries?: number;
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
tags?: string[];
|
|
51
|
+
}
|
|
52
|
+
interface TaskResult {
|
|
53
|
+
output: string;
|
|
54
|
+
structuredOutput?: unknown;
|
|
55
|
+
quality?: number;
|
|
56
|
+
completedAt: Date;
|
|
57
|
+
iterations: number;
|
|
58
|
+
tokensUsed: number;
|
|
59
|
+
latencyMs?: number;
|
|
60
|
+
cost?: number;
|
|
61
|
+
completedBy: string;
|
|
62
|
+
error?: string;
|
|
63
|
+
metadata?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
interface TaskMetadata {
|
|
66
|
+
createdAt: Date;
|
|
67
|
+
updatedAt: Date;
|
|
68
|
+
attempts: number;
|
|
69
|
+
assignedAt?: Date;
|
|
70
|
+
startedAt?: Date;
|
|
71
|
+
estimatedDuration?: number;
|
|
72
|
+
actualDuration?: number;
|
|
73
|
+
statusHistory?: Array<{
|
|
74
|
+
status: TaskStatus;
|
|
75
|
+
timestamp: Date;
|
|
76
|
+
reason?: string;
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
79
|
+
interface TaskState {
|
|
80
|
+
config: TaskConfig;
|
|
81
|
+
status: TaskStatus;
|
|
82
|
+
assignedAgent?: string;
|
|
83
|
+
result?: TaskResult;
|
|
84
|
+
metadata: TaskMetadata;
|
|
85
|
+
}
|
|
86
|
+
declare const PRIORITY_WEIGHTS: Record<TaskPriority, number>;
|
|
87
|
+
|
|
88
|
+
type StepMode = 'sequential' | 'parallel' | 'conditional' | 'loop';
|
|
89
|
+
type StepHandler = (context: WorkflowContext) => Promise<StepResult>;
|
|
90
|
+
type ConditionFn = (context: WorkflowContext) => boolean | Promise<boolean>;
|
|
91
|
+
interface WorkflowStepConfig {
|
|
92
|
+
name: string;
|
|
93
|
+
type?: 'step' | 'conditional' | 'loop' | 'parallel' | 'task' | 'crew' | 'checkpoint';
|
|
94
|
+
description?: string;
|
|
95
|
+
agent?: string;
|
|
96
|
+
agentName?: string;
|
|
97
|
+
task?: TaskConfig;
|
|
98
|
+
taskConfig?: TaskConfig;
|
|
99
|
+
handler?: StepHandler;
|
|
100
|
+
dependsOn?: string[];
|
|
101
|
+
timeoutMs?: number;
|
|
102
|
+
retry?: RetryConfig;
|
|
103
|
+
checkpoint?: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface RetryConfig {
|
|
106
|
+
maxAttempts: number;
|
|
107
|
+
delayMs?: number;
|
|
108
|
+
backoffMultiplier?: number;
|
|
109
|
+
maxDelayMs?: number;
|
|
110
|
+
retryOn?: string[];
|
|
111
|
+
}
|
|
112
|
+
interface ParallelStepConfig {
|
|
113
|
+
name?: string;
|
|
114
|
+
type?: string;
|
|
115
|
+
steps: WorkflowStepConfig[];
|
|
116
|
+
waitFor: 'all' | 'any' | 'first-success';
|
|
117
|
+
maxConcurrent?: number;
|
|
118
|
+
}
|
|
119
|
+
interface ConditionalStepConfig {
|
|
120
|
+
name?: string;
|
|
121
|
+
type?: string;
|
|
122
|
+
condition: ConditionFn;
|
|
123
|
+
ifTrue?: WorkflowStepConfig;
|
|
124
|
+
ifFalse?: WorkflowStepConfig;
|
|
125
|
+
thenSteps?: WorkflowStepConfig[];
|
|
126
|
+
elseSteps?: WorkflowStepConfig[];
|
|
127
|
+
}
|
|
128
|
+
interface LoopStepConfig {
|
|
129
|
+
name?: string;
|
|
130
|
+
type?: string;
|
|
131
|
+
condition: ConditionFn;
|
|
132
|
+
body?: WorkflowStepConfig;
|
|
133
|
+
bodySteps?: WorkflowStepConfig[];
|
|
134
|
+
maxIterations?: number;
|
|
135
|
+
}
|
|
136
|
+
interface StepResult {
|
|
137
|
+
stepName: string;
|
|
138
|
+
success: boolean;
|
|
139
|
+
output?: unknown;
|
|
140
|
+
error?: string;
|
|
141
|
+
durationMs: number;
|
|
142
|
+
tokensUsed?: number;
|
|
143
|
+
executedBy?: string;
|
|
144
|
+
metadata?: Record<string, unknown>;
|
|
145
|
+
}
|
|
146
|
+
interface WorkflowContext {
|
|
147
|
+
workflowId?: string;
|
|
148
|
+
currentStep?: string;
|
|
149
|
+
stepName?: string;
|
|
150
|
+
results?: Map<string, StepResult>;
|
|
151
|
+
stepResults?: Map<string, StepResult>;
|
|
152
|
+
state?: Map<string, unknown>;
|
|
153
|
+
variables: Record<string, unknown> | Map<string, unknown>;
|
|
154
|
+
input?: string;
|
|
155
|
+
crew?: unknown;
|
|
156
|
+
signal?: AbortSignal;
|
|
157
|
+
setVariable?: (key: string, value: unknown) => void;
|
|
158
|
+
getVariable?: (key: string) => unknown;
|
|
159
|
+
emit?: (event: Record<string, unknown>) => void;
|
|
160
|
+
isAborted?: () => boolean;
|
|
161
|
+
}
|
|
162
|
+
interface WorkflowDefinition {
|
|
163
|
+
id?: string;
|
|
164
|
+
name: string;
|
|
165
|
+
description?: string;
|
|
166
|
+
version?: string;
|
|
167
|
+
steps: WorkflowStep[] | WorkflowStepConfig[];
|
|
168
|
+
entryPoint?: string;
|
|
169
|
+
timeoutMs?: number;
|
|
170
|
+
checkpointing?: CheckpointConfig;
|
|
171
|
+
handlers?: Map<string, StepHandler>;
|
|
172
|
+
}
|
|
173
|
+
interface WorkflowStep {
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
type: StepMode;
|
|
177
|
+
config: WorkflowStepConfig | ParallelStepConfig | ConditionalStepConfig | LoopStepConfig;
|
|
178
|
+
dependencies: string[];
|
|
179
|
+
nextSteps: string[];
|
|
180
|
+
}
|
|
181
|
+
interface CheckpointConfig {
|
|
182
|
+
enabled: boolean;
|
|
183
|
+
afterEveryStep?: boolean;
|
|
184
|
+
atSteps?: string[];
|
|
185
|
+
storage?: 'memory' | 'file' | 'redis';
|
|
186
|
+
ttlMs?: number;
|
|
187
|
+
interval?: number | 'after-step';
|
|
188
|
+
}
|
|
189
|
+
interface WorkflowCheckpoint {
|
|
190
|
+
id: string;
|
|
191
|
+
workflowId: string;
|
|
192
|
+
workflowName?: string;
|
|
193
|
+
timestamp: Date;
|
|
194
|
+
lastCompletedStep?: string;
|
|
195
|
+
stepIndex?: number;
|
|
196
|
+
stepResults: Map<string, StepResult> | Record<string, StepResult>;
|
|
197
|
+
state?: Map<string, unknown>;
|
|
198
|
+
variables: Record<string, unknown>;
|
|
199
|
+
input?: string;
|
|
200
|
+
metadata?: Record<string, unknown>;
|
|
201
|
+
}
|
|
202
|
+
interface DAGNode {
|
|
203
|
+
id: string;
|
|
204
|
+
name?: string;
|
|
205
|
+
step?: WorkflowStep;
|
|
206
|
+
stepConfig?: WorkflowStepConfig;
|
|
207
|
+
dependencies?: string[];
|
|
208
|
+
incomingEdges?: string[];
|
|
209
|
+
outgoingEdges?: string[];
|
|
210
|
+
state?: 'pending' | 'ready' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
211
|
+
result?: StepResult;
|
|
212
|
+
}
|
|
213
|
+
interface DAG {
|
|
214
|
+
id?: string;
|
|
215
|
+
nodes: DAGNode[];
|
|
216
|
+
entryNode?: string;
|
|
217
|
+
exitNodes?: string[];
|
|
218
|
+
isValid?: boolean;
|
|
219
|
+
edges?: Array<{
|
|
220
|
+
from: string;
|
|
221
|
+
to: string;
|
|
222
|
+
}>;
|
|
223
|
+
}
|
|
224
|
+
interface DAGResult {
|
|
225
|
+
success: boolean;
|
|
226
|
+
stepResults?: Map<string, StepResult>;
|
|
227
|
+
results?: Map<string, StepResult>;
|
|
228
|
+
events?: DAGEvent[];
|
|
229
|
+
output?: unknown;
|
|
230
|
+
executionOrder?: string[];
|
|
231
|
+
totalDurationMs?: number;
|
|
232
|
+
executionTimeMs?: number;
|
|
233
|
+
errors?: Array<{
|
|
234
|
+
stepId: string;
|
|
235
|
+
error: string;
|
|
236
|
+
}>;
|
|
237
|
+
failedNodes?: string[];
|
|
238
|
+
}
|
|
239
|
+
interface DAGEvent {
|
|
240
|
+
type: 'step:started' | 'step:completed' | 'step:failed' | 'step:skipped' | 'dag:completed' | 'dag:start' | 'dag:aborted' | 'dag:error' | 'dag:complete' | 'node:start' | 'node:complete' | 'node:error' | 'node:retry' | 'node:skipped';
|
|
241
|
+
dagId?: string;
|
|
242
|
+
stepId?: string;
|
|
243
|
+
nodeId?: string;
|
|
244
|
+
nodeName?: string;
|
|
245
|
+
timestamp: Date;
|
|
246
|
+
result?: StepResult;
|
|
247
|
+
error?: string;
|
|
248
|
+
attempt?: number;
|
|
249
|
+
reason?: string;
|
|
250
|
+
success?: boolean;
|
|
251
|
+
}
|
|
252
|
+
interface ValidationResult {
|
|
253
|
+
valid: boolean;
|
|
254
|
+
errors: string[];
|
|
255
|
+
warnings: string[];
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
type CrewEvent = CrewStartedEvent | CrewCompletedEvent | CrewErrorEvent | CrewPausedEvent | CrewResumedEvent | CrewAbortedEvent | TaskQueuedEvent | TaskAssignedEvent | TaskStartedEvent | TaskProgressEvent | TaskCompletedEvent | TaskFailedEvent | TaskRetriedEvent | AgentThinkingEvent | AgentToolUseEvent | AgentToolResultEvent | AgentResponseEvent | AgentErrorEvent | DelegationDecisionEvent | DelegationFailedEvent | DelegationRejectedEvent | CollaborationMessageEvent | HelpRequestedEvent | HelpProvidedEvent | HelpRequestEvent | HelpResponseEvent | KnowledgeSharedEvent | KnowledgeContributedEvent | ConflictDetectedEvent | ConflictResolvedEvent | ConflictEscalatedEvent | ConsensusRequestedEvent | ConsensusReachedEvent | ConsensusVoteEvent | AuctionStartedEvent | WorkflowStepStartedEvent | WorkflowStepCompletedEvent | WorkflowCheckpointEvent | MetricsUpdateEvent | DebugBreakpointEvent;
|
|
259
|
+
interface BaseEvent {
|
|
260
|
+
type: string;
|
|
261
|
+
timestamp: Date;
|
|
262
|
+
crewName: string;
|
|
263
|
+
}
|
|
264
|
+
interface CrewStartedEvent extends BaseEvent {
|
|
265
|
+
type: 'crew:started';
|
|
266
|
+
taskCount: number;
|
|
267
|
+
agentCount: number;
|
|
268
|
+
strategy: DelegationStrategyType;
|
|
269
|
+
}
|
|
270
|
+
interface CrewCompletedEvent extends BaseEvent {
|
|
271
|
+
type: 'crew:completed';
|
|
272
|
+
success: boolean;
|
|
273
|
+
results: TaskResult[];
|
|
274
|
+
metrics: CrewMetrics;
|
|
275
|
+
finalOutput?: string;
|
|
276
|
+
}
|
|
277
|
+
interface CrewErrorEvent extends BaseEvent {
|
|
278
|
+
type: 'crew:error';
|
|
279
|
+
error: string;
|
|
280
|
+
fatal: boolean;
|
|
281
|
+
taskId?: string;
|
|
282
|
+
agentName?: string;
|
|
283
|
+
}
|
|
284
|
+
interface CrewPausedEvent extends BaseEvent {
|
|
285
|
+
type: 'crew:paused';
|
|
286
|
+
reason?: string;
|
|
287
|
+
pendingTasks: number;
|
|
288
|
+
}
|
|
289
|
+
interface CrewResumedEvent extends BaseEvent {
|
|
290
|
+
type: 'crew:resumed';
|
|
291
|
+
fromCheckpoint?: string;
|
|
292
|
+
}
|
|
293
|
+
interface CrewAbortedEvent extends BaseEvent {
|
|
294
|
+
type: 'crew:aborted';
|
|
295
|
+
reason: string;
|
|
296
|
+
completedTasks: number;
|
|
297
|
+
pendingTasks: number;
|
|
298
|
+
}
|
|
299
|
+
interface TaskQueuedEvent extends BaseEvent {
|
|
300
|
+
type: 'task:queued';
|
|
301
|
+
taskId: string;
|
|
302
|
+
description: string;
|
|
303
|
+
priority: string;
|
|
304
|
+
dependencies: string[];
|
|
305
|
+
}
|
|
306
|
+
interface TaskAssignedEvent extends BaseEvent {
|
|
307
|
+
type: 'task:assigned';
|
|
308
|
+
taskId: string;
|
|
309
|
+
agentName: string;
|
|
310
|
+
reason: string;
|
|
311
|
+
strategy: DelegationStrategyType;
|
|
312
|
+
}
|
|
313
|
+
interface TaskStartedEvent extends BaseEvent {
|
|
314
|
+
type: 'task:started';
|
|
315
|
+
taskId: string;
|
|
316
|
+
agentName: string;
|
|
317
|
+
}
|
|
318
|
+
interface TaskProgressEvent extends BaseEvent {
|
|
319
|
+
type: 'task:progress';
|
|
320
|
+
taskId: string;
|
|
321
|
+
agentName: string;
|
|
322
|
+
progress: number;
|
|
323
|
+
message?: string;
|
|
324
|
+
}
|
|
325
|
+
interface TaskCompletedEvent extends BaseEvent {
|
|
326
|
+
type: 'task:completed';
|
|
327
|
+
taskId: string;
|
|
328
|
+
agentName: string;
|
|
329
|
+
result: TaskResult;
|
|
330
|
+
durationMs: number;
|
|
331
|
+
}
|
|
332
|
+
interface TaskFailedEvent extends BaseEvent {
|
|
333
|
+
type: 'task:failed';
|
|
334
|
+
taskId: string;
|
|
335
|
+
agentName: string;
|
|
336
|
+
error: string;
|
|
337
|
+
willRetry: boolean;
|
|
338
|
+
attempt: number;
|
|
339
|
+
}
|
|
340
|
+
interface TaskRetriedEvent extends BaseEvent {
|
|
341
|
+
type: 'task:retried';
|
|
342
|
+
taskId: string;
|
|
343
|
+
agentName: string;
|
|
344
|
+
attempt: number;
|
|
345
|
+
maxAttempts: number;
|
|
346
|
+
reason: string;
|
|
347
|
+
}
|
|
348
|
+
interface AgentThinkingEvent extends BaseEvent {
|
|
349
|
+
type: 'agent:thinking';
|
|
350
|
+
agentName: string;
|
|
351
|
+
taskId: string;
|
|
352
|
+
thought: string;
|
|
353
|
+
iteration: number;
|
|
354
|
+
}
|
|
355
|
+
interface AgentToolUseEvent extends BaseEvent {
|
|
356
|
+
type: 'agent:tool_use';
|
|
357
|
+
agentName: string;
|
|
358
|
+
taskId: string;
|
|
359
|
+
toolName: string;
|
|
360
|
+
toolInput: unknown;
|
|
361
|
+
}
|
|
362
|
+
interface AgentToolResultEvent extends BaseEvent {
|
|
363
|
+
type: 'agent:tool_result';
|
|
364
|
+
agentName: string;
|
|
365
|
+
taskId: string;
|
|
366
|
+
toolName: string;
|
|
367
|
+
result: unknown;
|
|
368
|
+
durationMs: number;
|
|
369
|
+
}
|
|
370
|
+
interface AgentResponseEvent extends BaseEvent {
|
|
371
|
+
type: 'agent:response';
|
|
372
|
+
agentName: string;
|
|
373
|
+
taskId: string;
|
|
374
|
+
response: string;
|
|
375
|
+
tokensUsed: number;
|
|
376
|
+
}
|
|
377
|
+
interface AgentErrorEvent extends BaseEvent {
|
|
378
|
+
type: 'agent:error';
|
|
379
|
+
agentName: string;
|
|
380
|
+
taskId?: string;
|
|
381
|
+
error: string;
|
|
382
|
+
recoverable: boolean;
|
|
383
|
+
}
|
|
384
|
+
interface DelegationDecisionEvent extends BaseEvent {
|
|
385
|
+
type: 'delegation:decision';
|
|
386
|
+
taskId: string;
|
|
387
|
+
fromAgent?: string;
|
|
388
|
+
toAgent: string;
|
|
389
|
+
strategy: DelegationStrategyType;
|
|
390
|
+
reason: string;
|
|
391
|
+
confidence: number;
|
|
392
|
+
alternatives?: string[];
|
|
393
|
+
}
|
|
394
|
+
interface DelegationFailedEvent extends BaseEvent {
|
|
395
|
+
type: 'delegation:failed';
|
|
396
|
+
taskId: string;
|
|
397
|
+
reason: string;
|
|
398
|
+
attemptedAgents: string[];
|
|
399
|
+
}
|
|
400
|
+
interface DelegationRejectedEvent extends BaseEvent {
|
|
401
|
+
type: 'delegation:rejected';
|
|
402
|
+
taskId: string;
|
|
403
|
+
agentName: string;
|
|
404
|
+
reason: string;
|
|
405
|
+
}
|
|
406
|
+
interface CollaborationMessageEvent extends BaseEvent {
|
|
407
|
+
type: 'collaboration:message';
|
|
408
|
+
fromAgent: string;
|
|
409
|
+
toAgent: string;
|
|
410
|
+
message: string;
|
|
411
|
+
messageType: 'request' | 'response' | 'info' | 'question';
|
|
412
|
+
taskId?: string;
|
|
413
|
+
}
|
|
414
|
+
interface HelpRequestedEvent extends BaseEvent {
|
|
415
|
+
type: 'collaboration:help_requested';
|
|
416
|
+
fromAgent: string;
|
|
417
|
+
taskId: string;
|
|
418
|
+
request: string;
|
|
419
|
+
targetAgents?: string[];
|
|
420
|
+
}
|
|
421
|
+
interface HelpProvidedEvent extends BaseEvent {
|
|
422
|
+
type: 'collaboration:help_provided';
|
|
423
|
+
fromAgent: string;
|
|
424
|
+
toAgent: string;
|
|
425
|
+
taskId: string;
|
|
426
|
+
response: string;
|
|
427
|
+
helpful: boolean;
|
|
428
|
+
}
|
|
429
|
+
interface KnowledgeSharedEvent extends BaseEvent {
|
|
430
|
+
type: 'collaboration:knowledge_shared';
|
|
431
|
+
fromAgent: string;
|
|
432
|
+
topic: string;
|
|
433
|
+
content: string;
|
|
434
|
+
confidence: number;
|
|
435
|
+
}
|
|
436
|
+
interface ConflictDetectedEvent extends BaseEvent {
|
|
437
|
+
type: 'conflict:detected';
|
|
438
|
+
conflictId: string;
|
|
439
|
+
conflictType: 'disagreement' | 'contradiction' | 'resource' | 'priority';
|
|
440
|
+
agents: string[];
|
|
441
|
+
taskId?: string;
|
|
442
|
+
description: string;
|
|
443
|
+
severity: 'low' | 'medium' | 'high';
|
|
444
|
+
}
|
|
445
|
+
interface ConflictResolvedEvent extends BaseEvent {
|
|
446
|
+
type: 'conflict:resolved';
|
|
447
|
+
conflictId: string;
|
|
448
|
+
resolution: string;
|
|
449
|
+
resolvedBy: 'voting' | 'manager' | 'merge' | 'escalation';
|
|
450
|
+
accepted: boolean;
|
|
451
|
+
}
|
|
452
|
+
interface ConflictEscalatedEvent extends BaseEvent {
|
|
453
|
+
type: 'conflict:escalated';
|
|
454
|
+
conflictId: string;
|
|
455
|
+
reason: string;
|
|
456
|
+
escalatedTo: string;
|
|
457
|
+
}
|
|
458
|
+
interface HelpRequestEvent extends BaseEvent {
|
|
459
|
+
type: 'collaboration:help_request';
|
|
460
|
+
from: string;
|
|
461
|
+
taskId: string;
|
|
462
|
+
request: string;
|
|
463
|
+
targetAgents?: string[];
|
|
464
|
+
}
|
|
465
|
+
interface HelpResponseEvent extends BaseEvent {
|
|
466
|
+
type: 'collaboration:help_response';
|
|
467
|
+
from: string;
|
|
468
|
+
to: string;
|
|
469
|
+
taskId: string;
|
|
470
|
+
response: string;
|
|
471
|
+
helpful: boolean;
|
|
472
|
+
}
|
|
473
|
+
interface KnowledgeContributedEvent extends BaseEvent {
|
|
474
|
+
type: 'collaboration:knowledge_contributed';
|
|
475
|
+
contributor: string;
|
|
476
|
+
topic: string;
|
|
477
|
+
content: string;
|
|
478
|
+
}
|
|
479
|
+
interface ConsensusRequestedEvent extends BaseEvent {
|
|
480
|
+
type: 'consensus:requested';
|
|
481
|
+
taskId: string;
|
|
482
|
+
topic: string;
|
|
483
|
+
options: string[];
|
|
484
|
+
requiredVotes: number;
|
|
485
|
+
}
|
|
486
|
+
interface ConsensusReachedEvent extends BaseEvent {
|
|
487
|
+
type: 'consensus:reached';
|
|
488
|
+
taskId: string;
|
|
489
|
+
decision: string;
|
|
490
|
+
votes: Record<string, string>;
|
|
491
|
+
unanimous: boolean;
|
|
492
|
+
}
|
|
493
|
+
interface ConsensusVoteEvent extends BaseEvent {
|
|
494
|
+
type: 'consensus:vote';
|
|
495
|
+
taskId: string;
|
|
496
|
+
voter: string;
|
|
497
|
+
vote: string;
|
|
498
|
+
reason?: string;
|
|
499
|
+
}
|
|
500
|
+
interface AuctionStartedEvent extends BaseEvent {
|
|
501
|
+
type: 'auction:started';
|
|
502
|
+
taskId: string;
|
|
503
|
+
description: string;
|
|
504
|
+
participants: string[];
|
|
505
|
+
}
|
|
506
|
+
interface WorkflowStepStartedEvent extends BaseEvent {
|
|
507
|
+
type: 'workflow:step_started';
|
|
508
|
+
workflowId: string;
|
|
509
|
+
stepName: string;
|
|
510
|
+
agentName?: string;
|
|
511
|
+
}
|
|
512
|
+
interface WorkflowStepCompletedEvent extends BaseEvent {
|
|
513
|
+
type: 'workflow:step_completed';
|
|
514
|
+
workflowId: string;
|
|
515
|
+
stepName: string;
|
|
516
|
+
result: StepResult;
|
|
517
|
+
nextSteps: string[];
|
|
518
|
+
}
|
|
519
|
+
interface WorkflowCheckpointEvent extends BaseEvent {
|
|
520
|
+
type: 'workflow:checkpoint';
|
|
521
|
+
workflowId: string;
|
|
522
|
+
checkpointId: string;
|
|
523
|
+
stepName: string;
|
|
524
|
+
canResume: boolean;
|
|
525
|
+
}
|
|
526
|
+
interface MetricsUpdateEvent extends BaseEvent {
|
|
527
|
+
type: 'metrics:update';
|
|
528
|
+
metrics: Partial<CrewMetrics>;
|
|
529
|
+
interval: 'tick' | 'task' | 'minute';
|
|
530
|
+
}
|
|
531
|
+
interface DebugBreakpointEvent extends BaseEvent {
|
|
532
|
+
type: 'debug:breakpoint';
|
|
533
|
+
breakpointType: 'step' | 'task' | 'agent' | 'error';
|
|
534
|
+
agentName?: string;
|
|
535
|
+
taskId?: string;
|
|
536
|
+
stepName?: string;
|
|
537
|
+
state: Record<string, unknown>;
|
|
538
|
+
}
|
|
539
|
+
type CrewEventHandler<T extends CrewEvent = CrewEvent> = (event: T) => void | Promise<void>;
|
|
540
|
+
interface EventSubscription {
|
|
541
|
+
unsubscribe: () => void;
|
|
542
|
+
}
|
|
543
|
+
interface EventFilterOptions {
|
|
544
|
+
types?: string[];
|
|
545
|
+
agents?: string[];
|
|
546
|
+
tasks?: string[];
|
|
547
|
+
minSeverity?: 'low' | 'medium' | 'high';
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
type DelegationStrategyType = 'round-robin' | 'best-match' | 'auction' | 'hierarchical' | 'consensus';
|
|
551
|
+
type CrewStatus = 'idle' | 'running' | 'paused' | 'completed' | 'failed' | 'aborted';
|
|
552
|
+
interface CrewStatusDetails {
|
|
553
|
+
state: CrewStatus;
|
|
554
|
+
currentIteration: number;
|
|
555
|
+
maxIterations: number;
|
|
556
|
+
startTime?: Date;
|
|
557
|
+
endTime?: Date;
|
|
558
|
+
tasksPending: number;
|
|
559
|
+
tasksInProgress: number;
|
|
560
|
+
tasksCompleted: number;
|
|
561
|
+
tasksFailed: number;
|
|
562
|
+
agentsBusy: number;
|
|
563
|
+
agentsAvailable: number;
|
|
564
|
+
}
|
|
565
|
+
interface CrewAgentConfig {
|
|
566
|
+
name: string;
|
|
567
|
+
role: RoleConfig;
|
|
568
|
+
model: string;
|
|
569
|
+
provider: string;
|
|
570
|
+
tools?: string[];
|
|
571
|
+
temperature?: number;
|
|
572
|
+
maxTokens?: number;
|
|
573
|
+
maxIterations?: number;
|
|
574
|
+
parallelCapable?: boolean;
|
|
575
|
+
}
|
|
576
|
+
interface ManagerConfig {
|
|
577
|
+
role: RoleConfig;
|
|
578
|
+
model: string;
|
|
579
|
+
provider: string;
|
|
580
|
+
allowDelegation?: boolean;
|
|
581
|
+
reviewsOutput?: boolean;
|
|
582
|
+
maxDelegations?: number;
|
|
583
|
+
}
|
|
584
|
+
interface CrewMemoryConfig {
|
|
585
|
+
shared?: boolean;
|
|
586
|
+
type: 'buffer' | 'summary' | 'vector' | 'hybrid';
|
|
587
|
+
maxMessages?: number;
|
|
588
|
+
persistent?: boolean;
|
|
589
|
+
enableKnowledgeBase?: boolean;
|
|
590
|
+
}
|
|
591
|
+
interface CrewConfig {
|
|
592
|
+
name: string;
|
|
593
|
+
description?: string;
|
|
594
|
+
agents: CrewAgentConfig[];
|
|
595
|
+
manager?: ManagerConfig;
|
|
596
|
+
delegationStrategy: DelegationStrategyType;
|
|
597
|
+
memory?: CrewMemoryConfig;
|
|
598
|
+
verbose?: boolean;
|
|
599
|
+
maxIterations?: number;
|
|
600
|
+
shareKnowledge?: boolean;
|
|
601
|
+
enableCollaboration?: boolean;
|
|
602
|
+
enableConflictResolution?: boolean;
|
|
603
|
+
timeoutMs?: number;
|
|
604
|
+
maxConcurrentTasks?: number;
|
|
605
|
+
globalContext?: Record<string, unknown>;
|
|
606
|
+
mock?: boolean;
|
|
607
|
+
execute?: (input: string, systemPrompt: string) => Promise<{
|
|
608
|
+
output: string;
|
|
609
|
+
tokensUsed: number;
|
|
610
|
+
latencyMs: number;
|
|
611
|
+
iterations: number;
|
|
612
|
+
toolCalls?: Array<{
|
|
613
|
+
tool: string;
|
|
614
|
+
input: unknown;
|
|
615
|
+
result: unknown;
|
|
616
|
+
}>;
|
|
617
|
+
}>;
|
|
618
|
+
provider?: CoreLLMProvider;
|
|
619
|
+
}
|
|
620
|
+
interface CoreLLMProvider {
|
|
621
|
+
generateResponse(messages: Array<{
|
|
622
|
+
role: string;
|
|
623
|
+
content: string;
|
|
624
|
+
}>, config: {
|
|
625
|
+
model: string;
|
|
626
|
+
systemPrompt?: string;
|
|
627
|
+
temperature?: number;
|
|
628
|
+
maxTokens?: number;
|
|
629
|
+
}): Promise<{
|
|
630
|
+
content: string;
|
|
631
|
+
usage: {
|
|
632
|
+
inputTokens: number;
|
|
633
|
+
outputTokens: number;
|
|
634
|
+
};
|
|
635
|
+
}>;
|
|
636
|
+
}
|
|
637
|
+
interface CrewResult {
|
|
638
|
+
success: boolean;
|
|
639
|
+
taskResults: TaskResult[];
|
|
640
|
+
finalOutput?: string;
|
|
641
|
+
metrics: CrewMetrics;
|
|
642
|
+
errors?: Array<{
|
|
643
|
+
taskId?: string;
|
|
644
|
+
agentName?: string;
|
|
645
|
+
error: string;
|
|
646
|
+
timestamp: Date;
|
|
647
|
+
}>;
|
|
648
|
+
timeline?: TimelineEntry[];
|
|
649
|
+
events?: CrewEvent[];
|
|
650
|
+
}
|
|
651
|
+
interface CrewMetrics {
|
|
652
|
+
totalTasks: number;
|
|
653
|
+
completedTasks: number;
|
|
654
|
+
failedTasks: number;
|
|
655
|
+
totalTokens: number;
|
|
656
|
+
totalExecutionTimeMs: number;
|
|
657
|
+
averageTaskTimeMs: number;
|
|
658
|
+
totalIterations: number;
|
|
659
|
+
totalCost?: number;
|
|
660
|
+
agentMetrics: Record<string, AgentMetrics>;
|
|
661
|
+
delegationStats?: {
|
|
662
|
+
totalDelegations: number;
|
|
663
|
+
byStrategy: Record<DelegationStrategyType, number>;
|
|
664
|
+
averageConfidence: number;
|
|
665
|
+
};
|
|
666
|
+
startedAt?: Date;
|
|
667
|
+
completedAt?: Date;
|
|
668
|
+
}
|
|
669
|
+
interface AgentMetrics {
|
|
670
|
+
tasksAssigned: number;
|
|
671
|
+
tasksCompleted: number;
|
|
672
|
+
tasksFailed: number;
|
|
673
|
+
tokensUsed: number;
|
|
674
|
+
averageLatencyMs: number;
|
|
675
|
+
}
|
|
676
|
+
interface DelegationStats {
|
|
677
|
+
totalDelegations: number;
|
|
678
|
+
successfulDelegations: number;
|
|
679
|
+
reDelegations: number;
|
|
680
|
+
avgDecisionTimeMs: number;
|
|
681
|
+
byStrategy: Record<DelegationStrategyType, number>;
|
|
682
|
+
}
|
|
683
|
+
interface TimelineEntry {
|
|
684
|
+
timestamp: Date;
|
|
685
|
+
type?: string;
|
|
686
|
+
event?: string;
|
|
687
|
+
agentName?: string;
|
|
688
|
+
entityId?: string;
|
|
689
|
+
taskId?: string;
|
|
690
|
+
description?: string;
|
|
691
|
+
data?: Record<string, unknown>;
|
|
692
|
+
}
|
|
693
|
+
interface CrewCheckpoint {
|
|
694
|
+
id: string;
|
|
695
|
+
crewId?: string;
|
|
696
|
+
crewName?: string;
|
|
697
|
+
timestamp: Date;
|
|
698
|
+
status?: CrewStatus;
|
|
699
|
+
state?: CrewStatus;
|
|
700
|
+
context?: Record<string, unknown>;
|
|
701
|
+
taskStates?: TaskState[];
|
|
702
|
+
taskQueue?: TaskConfig[];
|
|
703
|
+
results?: Record<string, TaskResult>;
|
|
704
|
+
timeline?: TimelineEntry[];
|
|
705
|
+
iteration?: number;
|
|
706
|
+
agentStates?: Record<string, unknown>;
|
|
707
|
+
sharedMemory?: Record<string, unknown>;
|
|
708
|
+
contextState?: Record<string, unknown>;
|
|
709
|
+
metrics?: Partial<CrewMetrics>;
|
|
710
|
+
}
|
|
711
|
+
interface CrewProgress {
|
|
712
|
+
percentComplete?: number;
|
|
713
|
+
percentage?: number;
|
|
714
|
+
phase?: 'initializing' | 'delegating' | 'executing' | 'reviewing' | 'completing';
|
|
715
|
+
tasksCompleted: number;
|
|
716
|
+
totalTasks: number;
|
|
717
|
+
activeAgents?: string[];
|
|
718
|
+
currentTask?: string;
|
|
719
|
+
estimatedRemainingMs?: number;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
declare class Role {
|
|
723
|
+
readonly name: string;
|
|
724
|
+
readonly description: string;
|
|
725
|
+
readonly capabilities: Capability[];
|
|
726
|
+
readonly systemPrompt: string;
|
|
727
|
+
readonly goals: string[];
|
|
728
|
+
readonly constraints: string[];
|
|
729
|
+
readonly backstory: string;
|
|
730
|
+
readonly canDelegate: boolean;
|
|
731
|
+
readonly canReceiveDelegation: boolean;
|
|
732
|
+
readonly maxConcurrentTasks: number;
|
|
733
|
+
private capabilityMap;
|
|
734
|
+
constructor(config: RoleConfig);
|
|
735
|
+
generateSystemPrompt(): string;
|
|
736
|
+
hasCapability(name: string): boolean;
|
|
737
|
+
getCapability(name: string): Capability | undefined;
|
|
738
|
+
getProficiency(name: string): ProficiencyLevel | undefined;
|
|
739
|
+
getProficiencyScore(name: string): number;
|
|
740
|
+
getRequiredTools(): string[];
|
|
741
|
+
getKeywords(): string[];
|
|
742
|
+
matchCapabilities(required: Capability[]): CapabilityMatch;
|
|
743
|
+
calculateRelevanceScore(taskDescription: string): number;
|
|
744
|
+
toJSON(): RoleConfig;
|
|
745
|
+
static fromJSON(json: RoleConfig): Role;
|
|
746
|
+
static simple(name: string, description: string, systemPrompt: string, capabilities?: string[]): Role;
|
|
747
|
+
}
|
|
748
|
+
declare function createRole(config: RoleConfig): Role;
|
|
749
|
+
|
|
750
|
+
declare class Task {
|
|
751
|
+
readonly id: string;
|
|
752
|
+
readonly description: string;
|
|
753
|
+
readonly expectedOutput: string;
|
|
754
|
+
readonly priority: TaskPriority;
|
|
755
|
+
readonly dependencies: string[];
|
|
756
|
+
readonly deadline?: Date;
|
|
757
|
+
readonly context: Record<string, unknown>;
|
|
758
|
+
readonly assignTo?: string;
|
|
759
|
+
readonly requiredCapabilities: string[];
|
|
760
|
+
readonly estimatedTokens?: number;
|
|
761
|
+
readonly maxRetries: number;
|
|
762
|
+
readonly timeoutMs?: number;
|
|
763
|
+
readonly tags: string[];
|
|
764
|
+
private _status;
|
|
765
|
+
private _assignedAgent?;
|
|
766
|
+
private _result?;
|
|
767
|
+
private _metadata;
|
|
768
|
+
constructor(config: TaskConfig);
|
|
769
|
+
get status(): TaskStatus;
|
|
770
|
+
get assignedAgent(): string | undefined;
|
|
771
|
+
get result(): TaskResult | undefined;
|
|
772
|
+
get metadata(): TaskMetadata;
|
|
773
|
+
get isCompleted(): boolean;
|
|
774
|
+
get isFailed(): boolean;
|
|
775
|
+
get isPending(): boolean;
|
|
776
|
+
get isBlocked(): boolean;
|
|
777
|
+
get isInProgress(): boolean;
|
|
778
|
+
get isAssigned(): boolean;
|
|
779
|
+
get attempts(): number;
|
|
780
|
+
assign(agentName: string): void;
|
|
781
|
+
start(): void;
|
|
782
|
+
complete(result: Omit<TaskResult, 'completedAt' | 'completedBy'>): void;
|
|
783
|
+
fail(error: string): void;
|
|
784
|
+
block(reason?: string): void;
|
|
785
|
+
unblock(): void;
|
|
786
|
+
cancel(reason?: string): void;
|
|
787
|
+
reset(): void;
|
|
788
|
+
canStart(completedTaskIds?: Set<string>): boolean;
|
|
789
|
+
dependenciesSatisfied(completedTaskIds: Set<string>): boolean;
|
|
790
|
+
canRetry(): boolean;
|
|
791
|
+
isPastDeadline(): boolean;
|
|
792
|
+
getTimeRemaining(): number | null;
|
|
793
|
+
getPriorityWeight(): number;
|
|
794
|
+
compareTo(other: Task): number;
|
|
795
|
+
private updateStatus;
|
|
796
|
+
getState(): TaskState;
|
|
797
|
+
toConfig(): TaskConfig;
|
|
798
|
+
toJSON(): TaskState;
|
|
799
|
+
static fromState(state: TaskState): Task;
|
|
800
|
+
}
|
|
801
|
+
declare function createTask(config: TaskConfig): Task;
|
|
802
|
+
|
|
803
|
+
interface ExecutionContextConfig {
|
|
804
|
+
crewName: string;
|
|
805
|
+
crewId?: string;
|
|
806
|
+
globalContext?: Record<string, unknown>;
|
|
807
|
+
bufferEvents?: boolean;
|
|
808
|
+
maxBufferSize?: number;
|
|
809
|
+
}
|
|
810
|
+
interface ContextCheckpoint {
|
|
811
|
+
id: string;
|
|
812
|
+
timestamp: Date;
|
|
813
|
+
crewId: string;
|
|
814
|
+
crewName: string;
|
|
815
|
+
state: Map<string, unknown>;
|
|
816
|
+
completedTasks: Map<string, TaskResult>;
|
|
817
|
+
agentStates: Map<string, unknown>;
|
|
818
|
+
variables: Record<string, unknown>;
|
|
819
|
+
}
|
|
820
|
+
declare class ExecutionContext {
|
|
821
|
+
readonly crewId: string;
|
|
822
|
+
readonly crewName: string;
|
|
823
|
+
private state;
|
|
824
|
+
private completedTasks;
|
|
825
|
+
private agentStates;
|
|
826
|
+
private variables;
|
|
827
|
+
private eventEmitter;
|
|
828
|
+
private eventBuffer;
|
|
829
|
+
private bufferEvents;
|
|
830
|
+
private maxBufferSize;
|
|
831
|
+
private abortController;
|
|
832
|
+
private status;
|
|
833
|
+
private startTime?;
|
|
834
|
+
private endTime?;
|
|
835
|
+
constructor(config: ExecutionContextConfig);
|
|
836
|
+
set(key: string, value: unknown): void;
|
|
837
|
+
get<T>(key: string): T | undefined;
|
|
838
|
+
has(key: string): boolean;
|
|
839
|
+
delete(key: string): boolean;
|
|
840
|
+
keys(): string[];
|
|
841
|
+
entries(): Array<[string, unknown]>;
|
|
842
|
+
clearState(): void;
|
|
843
|
+
setVariable(name: string, value: unknown): void;
|
|
844
|
+
getVariable<T>(name: string): T | undefined;
|
|
845
|
+
getVariables(): Record<string, unknown>;
|
|
846
|
+
markTaskCompleted(taskId: string, result: TaskResult): void;
|
|
847
|
+
isTaskCompleted(taskId: string): boolean;
|
|
848
|
+
getTaskResult(taskId: string): TaskResult | undefined;
|
|
849
|
+
getCompletedTasks(): Map<string, TaskResult>;
|
|
850
|
+
getCompletedTaskIds(): Set<string>;
|
|
851
|
+
getCompletedTaskCount(): number;
|
|
852
|
+
setAgentState(agentName: string, state: unknown): void;
|
|
853
|
+
getAgentState<T>(agentName: string): T | undefined;
|
|
854
|
+
getAgentStates(): Map<string, unknown>;
|
|
855
|
+
emit(event: {
|
|
856
|
+
type: string;
|
|
857
|
+
} & Record<string, unknown>): void;
|
|
858
|
+
on<T extends CrewEvent>(type: T['type'] | '*', handler: CrewEventHandler<T>): EventSubscription;
|
|
859
|
+
once<T extends CrewEvent>(type: T['type'], handler: CrewEventHandler<T>): EventSubscription;
|
|
860
|
+
off(type: string): void;
|
|
861
|
+
getEventBuffer(): CrewEvent[];
|
|
862
|
+
clearEventBuffer(): void;
|
|
863
|
+
get signal(): AbortSignal;
|
|
864
|
+
get isAborted(): boolean;
|
|
865
|
+
abort(reason?: string): void;
|
|
866
|
+
getStatus(): CrewStatus;
|
|
867
|
+
setStatus(status: CrewStatus): void;
|
|
868
|
+
getDuration(): number | undefined;
|
|
869
|
+
createCheckpoint(): ContextCheckpoint;
|
|
870
|
+
restoreCheckpoint(checkpoint: ContextCheckpoint): void;
|
|
871
|
+
exportState(): Record<string, unknown>;
|
|
872
|
+
importState(data: Record<string, unknown>): void;
|
|
873
|
+
reset(): void;
|
|
874
|
+
}
|
|
875
|
+
declare function createExecutionContext(config: ExecutionContextConfig): ExecutionContext;
|
|
876
|
+
|
|
877
|
+
interface CapableAgent {
|
|
878
|
+
name: string;
|
|
879
|
+
capabilities: Capability[];
|
|
880
|
+
isBusy?: boolean;
|
|
881
|
+
executeTask?: (task: TaskConfig) => Promise<TaskResult>;
|
|
882
|
+
getStats?: () => {
|
|
883
|
+
name: string;
|
|
884
|
+
role?: string;
|
|
885
|
+
tasksCompleted: number;
|
|
886
|
+
tasksFailed: number;
|
|
887
|
+
totalTokensUsed: number;
|
|
888
|
+
successRate?: number;
|
|
889
|
+
isBusy?: boolean;
|
|
890
|
+
currentTask?: string;
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
declare class AgentCapabilities {
|
|
894
|
+
static match(required: Capability[], available: Capability[]): CapabilityMatch;
|
|
895
|
+
static score(capability: Capability, task: TaskConfig): number;
|
|
896
|
+
static calculateAgentScore(agent: CapableAgent, task: TaskConfig): number;
|
|
897
|
+
static rank(agents: CapableAgent[], task: TaskConfig): RankedAgent[];
|
|
898
|
+
static findBestMatch(agents: CapableAgent[], task: TaskConfig): RankedAgent | undefined;
|
|
899
|
+
static findCapableAgents(agents: CapableAgent[], task: TaskConfig): RankedAgent[];
|
|
900
|
+
static canAnyHandle(agents: CapableAgent[], task: TaskConfig): boolean;
|
|
901
|
+
static calculateOverlap(agent1: CapableAgent, agent2: CapableAgent): number;
|
|
902
|
+
static getAllCapabilities(agents: CapableAgent[]): Capability[];
|
|
903
|
+
static getUniqueCapabilities(agents: CapableAgent[]): Map<string, Capability[]>;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
interface TaskBid {
|
|
907
|
+
agentName: string;
|
|
908
|
+
taskId: string;
|
|
909
|
+
confidence: number;
|
|
910
|
+
estimatedTime?: number;
|
|
911
|
+
estimatedCost?: number;
|
|
912
|
+
reasoning: string;
|
|
913
|
+
capabilities: string[];
|
|
914
|
+
}
|
|
915
|
+
interface HelpRequest {
|
|
916
|
+
requestId: string;
|
|
917
|
+
fromAgent: string;
|
|
918
|
+
taskId: string;
|
|
919
|
+
request: string;
|
|
920
|
+
context?: Record<string, unknown>;
|
|
921
|
+
}
|
|
922
|
+
interface HelpResponse {
|
|
923
|
+
requestId: string;
|
|
924
|
+
fromAgent: string;
|
|
925
|
+
response: string;
|
|
926
|
+
helpful: boolean;
|
|
927
|
+
}
|
|
928
|
+
interface AgentExecutionResult {
|
|
929
|
+
output: string;
|
|
930
|
+
tokensUsed: number;
|
|
931
|
+
latencyMs: number;
|
|
932
|
+
iterations: number;
|
|
933
|
+
toolCalls?: Array<{
|
|
934
|
+
tool: string;
|
|
935
|
+
input: unknown;
|
|
936
|
+
result: unknown;
|
|
937
|
+
}>;
|
|
938
|
+
}
|
|
939
|
+
interface CrewAgentOptions {
|
|
940
|
+
config: CrewAgentConfig;
|
|
941
|
+
execute?: (input: string, systemPrompt: string) => Promise<AgentExecutionResult>;
|
|
942
|
+
mock?: boolean;
|
|
943
|
+
provider?: CoreLLMProvider;
|
|
944
|
+
}
|
|
945
|
+
declare class CrewAgent implements CapableAgent {
|
|
946
|
+
readonly id: string;
|
|
947
|
+
readonly name: string;
|
|
948
|
+
readonly role: Role;
|
|
949
|
+
readonly capabilities: Capability[];
|
|
950
|
+
readonly model: string;
|
|
951
|
+
readonly provider: string;
|
|
952
|
+
readonly tools: string[];
|
|
953
|
+
readonly temperature: number;
|
|
954
|
+
readonly maxTokens?: number;
|
|
955
|
+
readonly maxIterations: number;
|
|
956
|
+
readonly parallelCapable: boolean;
|
|
957
|
+
private executeFunc?;
|
|
958
|
+
private currentTaskId?;
|
|
959
|
+
private tasksCompleted;
|
|
960
|
+
private tasksFailed;
|
|
961
|
+
private totalTokensUsed;
|
|
962
|
+
constructor(options: CrewAgentOptions);
|
|
963
|
+
execute(input: string): Promise<AgentExecutionResult>;
|
|
964
|
+
executeTask(task: TaskConfig): Promise<TaskResult>;
|
|
965
|
+
private formatTaskInput;
|
|
966
|
+
hasCapability(name: string): boolean;
|
|
967
|
+
getProficiencyScore(name: string): number;
|
|
968
|
+
matchesCapabilities(required: Capability[]): CapabilityMatch;
|
|
969
|
+
calculateTaskScore(task: TaskConfig): number;
|
|
970
|
+
bidOnTask(task: TaskConfig): Promise<TaskBid>;
|
|
971
|
+
private estimateTaskCost;
|
|
972
|
+
private hasRequiredCapabilities;
|
|
973
|
+
private estimateTaskTime;
|
|
974
|
+
private generateBidReasoning;
|
|
975
|
+
createHelpRequest(taskId: string, request: string): HelpRequest;
|
|
976
|
+
respondToHelpRequest(request: HelpRequest): Promise<HelpResponse>;
|
|
977
|
+
provideHelp(task: TaskConfig, question: string, _context: ExecutionContext): Promise<{
|
|
978
|
+
helpful: boolean;
|
|
979
|
+
response: string;
|
|
980
|
+
suggestions?: string[];
|
|
981
|
+
}>;
|
|
982
|
+
private extractSuggestions;
|
|
983
|
+
get isBusy(): boolean;
|
|
984
|
+
getCurrentTask(): string | undefined;
|
|
985
|
+
getStats(): CrewAgentStats;
|
|
986
|
+
toConfig(): CrewAgentConfig;
|
|
987
|
+
static fromConfig(config: CrewAgentConfig): CrewAgent;
|
|
988
|
+
}
|
|
989
|
+
interface CrewAgentStats {
|
|
990
|
+
name: string;
|
|
991
|
+
role: string;
|
|
992
|
+
tasksCompleted: number;
|
|
993
|
+
tasksFailed: number;
|
|
994
|
+
totalTokensUsed: number;
|
|
995
|
+
successRate: number;
|
|
996
|
+
isBusy: boolean;
|
|
997
|
+
currentTask?: string;
|
|
998
|
+
}
|
|
999
|
+
declare function createCrewAgent(options: CrewAgentOptions): CrewAgent;
|
|
1000
|
+
|
|
1001
|
+
interface CrewExecutionOptions {
|
|
1002
|
+
input?: string;
|
|
1003
|
+
context?: Record<string, unknown>;
|
|
1004
|
+
delegationStrategy?: DelegationStrategyType;
|
|
1005
|
+
timeoutMs?: number;
|
|
1006
|
+
maxConcurrentTasks?: number;
|
|
1007
|
+
verbose?: boolean;
|
|
1008
|
+
}
|
|
1009
|
+
declare class Crew {
|
|
1010
|
+
readonly id: string;
|
|
1011
|
+
readonly name: string;
|
|
1012
|
+
readonly description?: string;
|
|
1013
|
+
private readonly config;
|
|
1014
|
+
private readonly agents;
|
|
1015
|
+
private readonly taskQueue;
|
|
1016
|
+
private readonly delegation;
|
|
1017
|
+
private readonly collaboration;
|
|
1018
|
+
private readonly conflictResolver;
|
|
1019
|
+
private context;
|
|
1020
|
+
private state;
|
|
1021
|
+
private startTime?;
|
|
1022
|
+
private endTime?;
|
|
1023
|
+
private currentIteration;
|
|
1024
|
+
private readonly maxIterations;
|
|
1025
|
+
private readonly timeline;
|
|
1026
|
+
private readonly results;
|
|
1027
|
+
constructor(config: CrewConfig);
|
|
1028
|
+
private initializeAgents;
|
|
1029
|
+
addAgent(agent: CrewAgent): void;
|
|
1030
|
+
removeAgent(name: string): void;
|
|
1031
|
+
getAgent(name: string): CrewAgent | undefined;
|
|
1032
|
+
getAgents(): CrewAgent[];
|
|
1033
|
+
addTask(taskConfig: TaskConfig): Task;
|
|
1034
|
+
addTasks(tasks: TaskConfig[]): Task[];
|
|
1035
|
+
getTask(taskId: string): Task | undefined;
|
|
1036
|
+
getTasks(): Task[];
|
|
1037
|
+
kickoff(options?: CrewExecutionOptions): Promise<CrewResult>;
|
|
1038
|
+
kickoffStream(options?: CrewExecutionOptions): AsyncGenerator<CrewEvent>;
|
|
1039
|
+
private processReadyTasksConcurrently;
|
|
1040
|
+
private delegateTask;
|
|
1041
|
+
private executeTask;
|
|
1042
|
+
private buildFinalOutput;
|
|
1043
|
+
pause(): void;
|
|
1044
|
+
resume(): void;
|
|
1045
|
+
abort(): void;
|
|
1046
|
+
getStatus(): CrewStatusDetails;
|
|
1047
|
+
getMetrics(): CrewMetrics;
|
|
1048
|
+
getProgress(): CrewProgress;
|
|
1049
|
+
getTimeline(): TimelineEntry[];
|
|
1050
|
+
createCheckpoint(): CrewCheckpoint;
|
|
1051
|
+
restoreCheckpoint(checkpoint: CrewCheckpoint): void;
|
|
1052
|
+
private addTimelineEntry;
|
|
1053
|
+
private sleep;
|
|
1054
|
+
private createEvent;
|
|
1055
|
+
reset(): void;
|
|
1056
|
+
getConfig(): CrewConfig;
|
|
1057
|
+
}
|
|
1058
|
+
declare function createCrew(config: CrewConfig): Crew;
|
|
1059
|
+
|
|
1060
|
+
export { type ConsensusVoteEvent as $, type AgentExecutionResult as A, type AgentMetrics as B, type CrewStatusDetails as C, type DelegationStrategyType as D, ExecutionContext as E, type AgentResponseEvent as F, type AgentThinkingEvent as G, type AgentToolResultEvent as H, type AgentToolUseEvent as I, type AuctionStartedEvent as J, type BaseEvent as K, type LoopStepConfig as L, type Capability as M, type CapabilityMatch as N, type CheckpointConfig as O, type ParallelStepConfig as P, type CollaborationMessageEvent as Q, type RoleConfig as R, type StepResult as S, type TimelineEntry as T, type ConflictDetectedEvent as U, type ValidationResult as V, type WorkflowContext as W, type ConflictEscalatedEvent as X, type ConflictResolvedEvent as Y, type ConsensusReachedEvent as Z, type ConsensusRequestedEvent as _, Crew as a, type ContextCheckpoint as a0, type CrewAbortedEvent as a1, type CrewAgentOptions as a2, type CrewAgentStats as a3, type CrewCheckpoint as a4, type CrewCompletedEvent as a5, type CrewErrorEvent as a6, type CrewEventHandler as a7, type CrewMemoryConfig as a8, type CrewPausedEvent as a9, type RetryConfig as aA, Role as aB, type StepMode as aC, type TaskAssignedEvent as aD, type TaskCompletedEvent as aE, type TaskFailedEvent as aF, type TaskMetadata as aG, type TaskProgressEvent as aH, type TaskQueuedEvent as aI, type TaskRetriedEvent as aJ, type TaskStartedEvent as aK, type TaskState as aL, type WorkflowCheckpointEvent as aM, type WorkflowStep as aN, type WorkflowStepCompletedEvent as aO, type WorkflowStepStartedEvent as aP, createCrew as aQ, createCrewAgent as aR, createExecutionContext as aS, createRole as aT, createTask as aU, type CrewProgress as aa, type CrewResumedEvent as ab, type CrewStartedEvent as ac, type CrewStatus as ad, type DAGNode as ae, type DebugBreakpointEvent as af, type DelegationDecisionEvent as ag, type DelegationFailedEvent as ah, type DelegationRejectedEvent as ai, type DelegationStats as aj, type EventFilterOptions as ak, type EventSubscription as al, type ExecutionContextConfig as am, type HelpProvidedEvent as an, type HelpRequest as ao, type HelpRequestEvent as ap, type HelpRequestedEvent as aq, type HelpResponse as ar, type HelpResponseEvent as as, type KnowledgeContributedEvent as at, type KnowledgeSharedEvent as au, type ManagerConfig as av, type MetricsUpdateEvent as aw, PRIORITY_WEIGHTS as ax, PROFICIENCY_WEIGHTS as ay, type ProficiencyLevel as az, type CrewEvent as b, type CrewMetrics as c, type TaskConfig as d, type CrewConfig as e, type CrewExecutionOptions as f, type CrewResult as g, Task as h, type TaskStatus as i, type TaskPriority as j, type CrewAgentConfig as k, type CoreLLMProvider as l, type CapableAgent as m, type RankedAgent as n, CrewAgent as o, type TaskBid as p, type WorkflowStepConfig as q, type ConditionalStepConfig as r, type WorkflowDefinition as s, type DAG as t, type DAGResult as u, type DAGEvent as v, type TaskResult as w, type WorkflowCheckpoint as x, AgentCapabilities as y, type AgentErrorEvent as z };
|