@lov3kaizen/agentsea-crews 1.1.0 → 1.1.1

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/dist/index.js CHANGED
@@ -334,8 +334,37 @@ function createRole(config) {
334
334
  return new Role(config);
335
335
  }
336
336
 
337
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.js
338
+ var import_node_crypto = require("crypto");
339
+
340
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js
341
+ var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
342
+
343
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.js
344
+ var POOL_SIZE_MULTIPLIER = 128;
345
+ var pool;
346
+ var poolOffset;
347
+ function fillPool(bytes) {
348
+ if (!pool || pool.length < bytes) {
349
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
350
+ import_node_crypto.webcrypto.getRandomValues(pool);
351
+ poolOffset = 0;
352
+ } else if (poolOffset + bytes > pool.length) {
353
+ import_node_crypto.webcrypto.getRandomValues(pool);
354
+ poolOffset = 0;
355
+ }
356
+ poolOffset += bytes;
357
+ }
358
+ function nanoid(size = 21) {
359
+ fillPool(size |= 0);
360
+ let id = "";
361
+ for (let i = poolOffset - size; i < poolOffset; i++) {
362
+ id += urlAlphabet[pool[i] & 63];
363
+ }
364
+ return id;
365
+ }
366
+
337
367
  // src/core/Task.ts
338
- var import_nanoid = require("nanoid");
339
368
  var Task = class _Task {
340
369
  id;
341
370
  description;
@@ -355,7 +384,7 @@ var Task = class _Task {
355
384
  _result;
356
385
  _metadata;
357
386
  constructor(config) {
358
- this.id = config.id ?? (0, import_nanoid.nanoid)();
387
+ this.id = config.id ?? nanoid();
359
388
  this.description = config.description;
360
389
  this.expectedOutput = config.expectedOutput;
361
390
  this.priority = config.priority ?? "medium";
@@ -967,7 +996,6 @@ function createTaskQueue(config) {
967
996
 
968
997
  // src/core/ExecutionContext.ts
969
998
  var import_eventemitter3 = __toESM(require("eventemitter3"));
970
- var import_nanoid2 = require("nanoid");
971
999
  var ExecutionContext = class {
972
1000
  crewId;
973
1001
  crewName;
@@ -984,7 +1012,7 @@ var ExecutionContext = class {
984
1012
  startTime;
985
1013
  endTime;
986
1014
  constructor(config) {
987
- this.crewId = config.crewId ?? (0, import_nanoid2.nanoid)();
1015
+ this.crewId = config.crewId ?? nanoid();
988
1016
  this.crewName = config.crewName;
989
1017
  this.state = /* @__PURE__ */ new Map();
990
1018
  this.completedTasks = /* @__PURE__ */ new Map();
@@ -1230,7 +1258,7 @@ var ExecutionContext = class {
1230
1258
  */
1231
1259
  createCheckpoint() {
1232
1260
  return {
1233
- id: (0, import_nanoid2.nanoid)(),
1261
+ id: nanoid(),
1234
1262
  timestamp: /* @__PURE__ */ new Date(),
1235
1263
  crewId: this.crewId,
1236
1264
  crewName: this.crewName,
@@ -1319,12 +1347,6 @@ function createExecutionContext(config) {
1319
1347
  return new ExecutionContext(config);
1320
1348
  }
1321
1349
 
1322
- // src/core/Crew.ts
1323
- var import_nanoid4 = require("nanoid");
1324
-
1325
- // src/agents/CrewAgent.ts
1326
- var import_nanoid3 = require("nanoid");
1327
-
1328
1350
  // src/agents/AgentCapabilities.ts
1329
1351
  var PROFICIENCY_WEIGHTS2 = {
1330
1352
  novice: 0.25,
@@ -1609,7 +1631,7 @@ var CrewAgent = class _CrewAgent {
1609
1631
  totalTokensUsed = 0;
1610
1632
  constructor(options) {
1611
1633
  const { config, execute } = options;
1612
- this.id = (0, import_nanoid3.nanoid)();
1634
+ this.id = nanoid();
1613
1635
  this.name = config.name;
1614
1636
  this.role = new Role(config.role);
1615
1637
  this.capabilities = config.role.capabilities;
@@ -1806,7 +1828,7 @@ ${JSON.stringify(task.context, null, 2)}`);
1806
1828
  */
1807
1829
  createHelpRequest(taskId, request) {
1808
1830
  return {
1809
- requestId: (0, import_nanoid3.nanoid)(),
1831
+ requestId: nanoid(),
1810
1832
  fromAgent: this.name,
1811
1833
  taskId,
1812
1834
  request
@@ -4278,7 +4300,7 @@ var Crew = class {
4278
4300
  timeline = [];
4279
4301
  results = /* @__PURE__ */ new Map();
4280
4302
  constructor(config) {
4281
- this.id = (0, import_nanoid4.nanoid)();
4303
+ this.id = nanoid();
4282
4304
  this.name = config.name;
4283
4305
  this.description = config.description;
4284
4306
  this.config = config;
@@ -4427,27 +4449,40 @@ var Crew = class {
4427
4449
  await this.sleep(100);
4428
4450
  continue;
4429
4451
  }
4430
- for (const task of readyTasks) {
4431
- if (this.state !== "running") break;
4432
- const delegationResult = await this.delegateTask(task, options);
4433
- yield this.createEvent({
4434
- type: "task:assigned",
4435
- taskId: task.id,
4436
- agentName: delegationResult.selectedAgent,
4437
- reason: delegationResult.reason,
4438
- strategy: this.config.delegationStrategy
4439
- });
4440
- const taskResult = await this.executeTask(task, delegationResult);
4441
- yield this.createEvent({
4442
- type: "task:completed",
4443
- taskId: task.id,
4444
- result: taskResult,
4445
- agentName: delegationResult.selectedAgent,
4446
- durationMs: taskResult.latencyMs ?? 0
4447
- });
4448
- while (eventQueue.length > 0) {
4449
- yield eventQueue.shift();
4452
+ const concurrency = Math.max(
4453
+ 1,
4454
+ options.maxConcurrentTasks ?? this.config.maxConcurrentTasks ?? 1
4455
+ );
4456
+ if (concurrency === 1) {
4457
+ for (const task of readyTasks) {
4458
+ if (this.state !== "running") break;
4459
+ const delegationResult = await this.delegateTask(task, options);
4460
+ yield this.createEvent({
4461
+ type: "task:assigned",
4462
+ taskId: task.id,
4463
+ agentName: delegationResult.selectedAgent,
4464
+ reason: delegationResult.reason,
4465
+ strategy: this.config.delegationStrategy
4466
+ });
4467
+ const taskResult = await this.executeTask(task, delegationResult);
4468
+ yield this.createEvent({
4469
+ type: "task:completed",
4470
+ taskId: task.id,
4471
+ result: taskResult,
4472
+ agentName: delegationResult.selectedAgent,
4473
+ durationMs: taskResult.latencyMs ?? 0
4474
+ });
4475
+ while (eventQueue.length > 0) {
4476
+ yield eventQueue.shift();
4477
+ }
4450
4478
  }
4479
+ } else {
4480
+ yield* this.processReadyTasksConcurrently(
4481
+ readyTasks,
4482
+ options,
4483
+ eventQueue,
4484
+ concurrency
4485
+ );
4451
4486
  }
4452
4487
  while (this.state === "paused") {
4453
4488
  await this.sleep(100);
@@ -4490,6 +4525,78 @@ var Crew = class {
4490
4525
  });
4491
4526
  this.addTimelineEntry("crew_completed", this.name);
4492
4527
  }
4528
+ /**
4529
+ * Execute a batch of ready tasks concurrently with a bounded worker pool.
4530
+ *
4531
+ * Each task still emits its `task:assigned` and `task:completed` events in
4532
+ * order relative to itself, but events across tasks are interleaved as the
4533
+ * workers settle. At most `concurrency` tasks run at once. If any task throws
4534
+ * (after exhausting retries), no further tasks are started, in-flight tasks
4535
+ * are allowed to settle, and the first error is rethrown so the caller's
4536
+ * error handling (crew:error) behaves identically to the sequential path.
4537
+ */
4538
+ async *processReadyTasksConcurrently(readyTasks, options, eventQueue, concurrency) {
4539
+ let nextIndex = 0;
4540
+ let firstError;
4541
+ const buffer = [];
4542
+ const inFlight = /* @__PURE__ */ new Set();
4543
+ const launch = (task) => {
4544
+ const worker = (async () => {
4545
+ const delegationResult = await this.delegateTask(task, options);
4546
+ buffer.push(
4547
+ this.createEvent({
4548
+ type: "task:assigned",
4549
+ taskId: task.id,
4550
+ agentName: delegationResult.selectedAgent,
4551
+ reason: delegationResult.reason,
4552
+ strategy: this.config.delegationStrategy
4553
+ })
4554
+ );
4555
+ const taskResult = await this.executeTask(task, delegationResult);
4556
+ buffer.push(
4557
+ this.createEvent({
4558
+ type: "task:completed",
4559
+ taskId: task.id,
4560
+ result: taskResult,
4561
+ agentName: delegationResult.selectedAgent,
4562
+ durationMs: taskResult.latencyMs ?? 0
4563
+ })
4564
+ );
4565
+ })().catch((error) => {
4566
+ if (firstError === void 0) {
4567
+ firstError = error;
4568
+ }
4569
+ }).finally(() => {
4570
+ inFlight.delete(worker);
4571
+ });
4572
+ inFlight.add(worker);
4573
+ };
4574
+ const fill = () => {
4575
+ while (inFlight.size < concurrency && nextIndex < readyTasks.length && this.state === "running" && firstError === void 0) {
4576
+ launch(readyTasks[nextIndex++]);
4577
+ }
4578
+ };
4579
+ fill();
4580
+ while (inFlight.size > 0) {
4581
+ await Promise.race(inFlight);
4582
+ while (buffer.length > 0) {
4583
+ yield buffer.shift();
4584
+ }
4585
+ while (eventQueue.length > 0) {
4586
+ yield eventQueue.shift();
4587
+ }
4588
+ fill();
4589
+ }
4590
+ while (buffer.length > 0) {
4591
+ yield buffer.shift();
4592
+ }
4593
+ while (eventQueue.length > 0) {
4594
+ yield eventQueue.shift();
4595
+ }
4596
+ if (firstError !== void 0) {
4597
+ throw firstError;
4598
+ }
4599
+ }
4493
4600
  /**
4494
4601
  * Delegate a task to an agent
4495
4602
  */
@@ -4709,7 +4816,7 @@ ${r.output}`).join("\n\n---\n\n");
4709
4816
  */
4710
4817
  createCheckpoint() {
4711
4818
  return {
4712
- id: (0, import_nanoid4.nanoid)(),
4819
+ id: nanoid(),
4713
4820
  crewId: this.id,
4714
4821
  crewName: this.name,
4715
4822
  timestamp: /* @__PURE__ */ new Date(),
@@ -4805,7 +4912,6 @@ function createCrew(config) {
4805
4912
  }
4806
4913
 
4807
4914
  // src/workflows/WorkflowBuilder.ts
4808
- var import_nanoid5 = require("nanoid");
4809
4915
  var BranchBuilder = class {
4810
4916
  parent;
4811
4917
  condition;
@@ -4819,7 +4925,7 @@ var BranchBuilder = class {
4819
4925
  * Add steps for true branch
4820
4926
  */
4821
4927
  then(builder) {
4822
- const subBuilder = new WorkflowBuilder(`then-${(0, import_nanoid5.nanoid)(6)}`);
4928
+ const subBuilder = new WorkflowBuilder(`then-${nanoid(6)}`);
4823
4929
  builder(subBuilder);
4824
4930
  this.thenSteps = subBuilder.getSteps();
4825
4931
  return this;
@@ -4828,7 +4934,7 @@ var BranchBuilder = class {
4828
4934
  * Add steps for false branch
4829
4935
  */
4830
4936
  otherwise(builder) {
4831
- const subBuilder = new WorkflowBuilder(`else-${(0, import_nanoid5.nanoid)(6)}`);
4937
+ const subBuilder = new WorkflowBuilder(`else-${nanoid(6)}`);
4832
4938
  builder(subBuilder);
4833
4939
  this.elseSteps = subBuilder.getSteps();
4834
4940
  return this;
@@ -4838,7 +4944,7 @@ var BranchBuilder = class {
4838
4944
  */
4839
4945
  endBranch() {
4840
4946
  const conditionalConfig = {
4841
- name: `conditional-${(0, import_nanoid5.nanoid)(6)}`,
4947
+ name: `conditional-${nanoid(6)}`,
4842
4948
  condition: this.condition,
4843
4949
  thenSteps: this.thenSteps.map((s) => s.config),
4844
4950
  elseSteps: this.elseSteps.length > 0 ? this.elseSteps.map((s) => s.config) : void 0
@@ -4864,7 +4970,7 @@ var LoopBuilder = class {
4864
4970
  * Set loop body
4865
4971
  */
4866
4972
  do(builder) {
4867
- const subBuilder = new WorkflowBuilder(`loop-body-${(0, import_nanoid5.nanoid)(6)}`);
4973
+ const subBuilder = new WorkflowBuilder(`loop-body-${nanoid(6)}`);
4868
4974
  builder(subBuilder);
4869
4975
  this.bodySteps = subBuilder.getSteps();
4870
4976
  return this;
@@ -4881,7 +4987,7 @@ var LoopBuilder = class {
4881
4987
  */
4882
4988
  endLoop() {
4883
4989
  const loopConfig = {
4884
- name: `loop-${(0, import_nanoid5.nanoid)(6)}`,
4990
+ name: `loop-${nanoid(6)}`,
4885
4991
  condition: this.condition,
4886
4992
  maxIterations: this.maxIter,
4887
4993
  bodySteps: this.bodySteps.map((s) => s.config)
@@ -4929,7 +5035,7 @@ var WorkflowBuilder = class {
4929
5035
  */
4930
5036
  parallel(...steps) {
4931
5037
  const parallelConfig = {
4932
- name: `parallel-${(0, import_nanoid5.nanoid)(6)}`,
5038
+ name: `parallel-${nanoid(6)}`,
4933
5039
  steps: steps.map((s) => ({
4934
5040
  name: s.name,
4935
5041
  type: "task"
@@ -5080,7 +5186,7 @@ var WorkflowBuilder = class {
5080
5186
  */
5081
5187
  build() {
5082
5188
  return {
5083
- id: (0, import_nanoid5.nanoid)(),
5189
+ id: nanoid(),
5084
5190
  name: this.name,
5085
5191
  description: this.description,
5086
5192
  steps: this.steps.map((s) => s.config),
@@ -5129,7 +5235,6 @@ function workflow(name) {
5129
5235
  }
5130
5236
 
5131
5237
  // src/workflows/DAGExecutor.ts
5132
- var import_nanoid6 = require("nanoid");
5133
5238
  var DAGExecutor = class {
5134
5239
  dag;
5135
5240
  _handlers;
@@ -5560,7 +5665,7 @@ var DAGExecutor = class {
5560
5665
  }
5561
5666
  };
5562
5667
  function createDAGFromSteps(steps, _handlers) {
5563
- const nodeIds = steps.map(() => (0, import_nanoid6.nanoid)());
5668
+ const nodeIds = steps.map(() => nanoid());
5564
5669
  const nameToId = /* @__PURE__ */ new Map();
5565
5670
  for (let i = 0; i < steps.length; i++) {
5566
5671
  nameToId.set(steps[i].name, nodeIds[i]);
@@ -5580,7 +5685,7 @@ function createDAGFromSteps(steps, _handlers) {
5580
5685
  };
5581
5686
  });
5582
5687
  return {
5583
- id: (0, import_nanoid6.nanoid)(),
5688
+ id: nanoid(),
5584
5689
  nodes,
5585
5690
  edges: []
5586
5691
  };
@@ -5794,7 +5899,6 @@ function createParallelExecutor(options) {
5794
5899
  }
5795
5900
 
5796
5901
  // src/workflows/Checkpointing.ts
5797
- var import_nanoid7 = require("nanoid");
5798
5902
  var InMemoryCheckpointStorage = class {
5799
5903
  checkpoints = /* @__PURE__ */ new Map();
5800
5904
  save(checkpoint) {
@@ -5848,7 +5952,7 @@ var CheckpointManager = class {
5848
5952
  */
5849
5953
  async save(workflowId, state) {
5850
5954
  const checkpoint = {
5851
- id: (0, import_nanoid7.nanoid)(),
5955
+ id: nanoid(),
5852
5956
  workflowId,
5853
5957
  timestamp: /* @__PURE__ */ new Date(),
5854
5958
  stepIndex: state.currentStepIndex,
@@ -6373,7 +6477,6 @@ function createSharedMemory(config) {
6373
6477
  }
6374
6478
 
6375
6479
  // src/memory/ConversationHistory.ts
6376
- var import_nanoid8 = require("nanoid");
6377
6480
  var ConversationHistory = class {
6378
6481
  agentMessages = /* @__PURE__ */ new Map();
6379
6482
  threads = /* @__PURE__ */ new Map();
@@ -6395,7 +6498,7 @@ var ConversationHistory = class {
6395
6498
  addMessage(agentName, message) {
6396
6499
  const fullMessage = {
6397
6500
  ...message,
6398
- id: (0, import_nanoid8.nanoid)(),
6501
+ id: nanoid(),
6399
6502
  agentName,
6400
6503
  timestamp: /* @__PURE__ */ new Date(),
6401
6504
  threadId: this.currentThreadId
@@ -6542,7 +6645,7 @@ var ConversationHistory = class {
6542
6645
  */
6543
6646
  createThread(title, participants = []) {
6544
6647
  const thread = {
6545
- id: (0, import_nanoid8.nanoid)(),
6648
+ id: nanoid(),
6546
6649
  title,
6547
6650
  participants,
6548
6651
  messages: [],
@@ -6737,7 +6840,6 @@ function createConversationHistory(config) {
6737
6840
  }
6738
6841
 
6739
6842
  // src/memory/KnowledgeBase.ts
6740
- var import_nanoid9 = require("nanoid");
6741
6843
  var KnowledgeBase = class {
6742
6844
  items = /* @__PURE__ */ new Map();
6743
6845
  tagIndex = /* @__PURE__ */ new Map();
@@ -6776,7 +6878,7 @@ var KnowledgeBase = class {
6776
6878
  }
6777
6879
  const fullItem = {
6778
6880
  ...item,
6779
- id: (0, import_nanoid9.nanoid)(),
6881
+ id: nanoid(),
6780
6882
  created: /* @__PURE__ */ new Date(),
6781
6883
  updated: /* @__PURE__ */ new Date(),
6782
6884
  accessCount: 0
package/dist/index.mjs CHANGED
@@ -1,3 +1,9 @@
1
+ import {
2
+ CrewDashboard,
3
+ DebugMode,
4
+ createDashboard,
5
+ createDebugMode
6
+ } from "./chunk-4PF73ECN.mjs";
1
7
  import {
2
8
  CodeReviewTasks,
3
9
  CustomerSupportTasks,
@@ -11,13 +17,7 @@ import {
11
17
  createResearchCrewConfig,
12
18
  createWritingCrew,
13
19
  createWritingCrewConfig
14
- } from "./chunk-6JLVFEU6.mjs";
15
- import {
16
- CrewDashboard,
17
- DebugMode,
18
- createDashboard,
19
- createDebugMode
20
- } from "./chunk-4PF73ECN.mjs";
20
+ } from "./chunk-3NMVWRVW.mjs";
21
21
  import {
22
22
  AgentCapabilities,
23
23
  AgentRegistry,
@@ -54,8 +54,9 @@ import {
54
54
  createRoundRobinStrategy,
55
55
  createStrategy,
56
56
  createTask,
57
- createTaskQueue
58
- } from "./chunk-V6VK6BOL.mjs";
57
+ createTaskQueue,
58
+ nanoid
59
+ } from "./chunk-J5KQSOGT.mjs";
59
60
 
60
61
  // src/types/role.types.ts
61
62
  var PROFICIENCY_WEIGHTS = {
@@ -74,7 +75,6 @@ var PRIORITY_WEIGHTS = {
74
75
  };
75
76
 
76
77
  // src/workflows/WorkflowBuilder.ts
77
- import { nanoid } from "nanoid";
78
78
  var BranchBuilder = class {
79
79
  parent;
80
80
  condition;
@@ -398,7 +398,6 @@ function workflow(name) {
398
398
  }
399
399
 
400
400
  // src/workflows/DAGExecutor.ts
401
- import { nanoid as nanoid2 } from "nanoid";
402
401
  var DAGExecutor = class {
403
402
  dag;
404
403
  _handlers;
@@ -829,7 +828,7 @@ var DAGExecutor = class {
829
828
  }
830
829
  };
831
830
  function createDAGFromSteps(steps, _handlers) {
832
- const nodeIds = steps.map(() => nanoid2());
831
+ const nodeIds = steps.map(() => nanoid());
833
832
  const nameToId = /* @__PURE__ */ new Map();
834
833
  for (let i = 0; i < steps.length; i++) {
835
834
  nameToId.set(steps[i].name, nodeIds[i]);
@@ -849,7 +848,7 @@ function createDAGFromSteps(steps, _handlers) {
849
848
  };
850
849
  });
851
850
  return {
852
- id: nanoid2(),
851
+ id: nanoid(),
853
852
  nodes,
854
853
  edges: []
855
854
  };
@@ -1063,7 +1062,6 @@ function createParallelExecutor(options) {
1063
1062
  }
1064
1063
 
1065
1064
  // src/workflows/Checkpointing.ts
1066
- import { nanoid as nanoid3 } from "nanoid";
1067
1065
  var InMemoryCheckpointStorage = class {
1068
1066
  checkpoints = /* @__PURE__ */ new Map();
1069
1067
  save(checkpoint) {
@@ -1117,7 +1115,7 @@ var CheckpointManager = class {
1117
1115
  */
1118
1116
  async save(workflowId, state) {
1119
1117
  const checkpoint = {
1120
- id: nanoid3(),
1118
+ id: nanoid(),
1121
1119
  workflowId,
1122
1120
  timestamp: /* @__PURE__ */ new Date(),
1123
1121
  stepIndex: state.currentStepIndex,
@@ -1642,7 +1640,6 @@ function createSharedMemory(config) {
1642
1640
  }
1643
1641
 
1644
1642
  // src/memory/ConversationHistory.ts
1645
- import { nanoid as nanoid4 } from "nanoid";
1646
1643
  var ConversationHistory = class {
1647
1644
  agentMessages = /* @__PURE__ */ new Map();
1648
1645
  threads = /* @__PURE__ */ new Map();
@@ -1664,7 +1661,7 @@ var ConversationHistory = class {
1664
1661
  addMessage(agentName, message) {
1665
1662
  const fullMessage = {
1666
1663
  ...message,
1667
- id: nanoid4(),
1664
+ id: nanoid(),
1668
1665
  agentName,
1669
1666
  timestamp: /* @__PURE__ */ new Date(),
1670
1667
  threadId: this.currentThreadId
@@ -1811,7 +1808,7 @@ var ConversationHistory = class {
1811
1808
  */
1812
1809
  createThread(title, participants = []) {
1813
1810
  const thread = {
1814
- id: nanoid4(),
1811
+ id: nanoid(),
1815
1812
  title,
1816
1813
  participants,
1817
1814
  messages: [],
@@ -2006,7 +2003,6 @@ function createConversationHistory(config) {
2006
2003
  }
2007
2004
 
2008
2005
  // src/memory/KnowledgeBase.ts
2009
- import { nanoid as nanoid5 } from "nanoid";
2010
2006
  var KnowledgeBase = class {
2011
2007
  items = /* @__PURE__ */ new Map();
2012
2008
  tagIndex = /* @__PURE__ */ new Map();
@@ -2045,7 +2041,7 @@ var KnowledgeBase = class {
2045
2041
  }
2046
2042
  const fullItem = {
2047
2043
  ...item,
2048
- id: nanoid5(),
2044
+ id: nanoid(),
2049
2045
  created: /* @__PURE__ */ new Date(),
2050
2046
  updated: /* @__PURE__ */ new Date(),
2051
2047
  accessCount: 0
@@ -0,0 +1,98 @@
1
+ import { DynamicModule, Type, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
2
+ import { e as CrewConfig, D as DelegationStrategyType, a as Crew, f as CrewExecutionOptions, g as CrewResult, b as CrewEvent, R as RoleConfig, d as TaskConfig } from '../Crew-BnvVjN7A.mjs';
3
+ import { C as CrewDashboard, D as DebugMode } from '../DebugMode-CbYgA7Yw.mjs';
4
+ import 'eventemitter3';
5
+
6
+ interface CrewsModuleOptions {
7
+ crews?: CrewConfig[];
8
+ defaultStrategy?: DelegationStrategyType;
9
+ enableMonitoring?: boolean;
10
+ enableDebug?: boolean;
11
+ global?: boolean;
12
+ }
13
+ interface CrewsModuleAsyncOptions {
14
+ imports?: Type<unknown>[];
15
+ useFactory?: (...args: unknown[]) => Promise<CrewsModuleOptions> | CrewsModuleOptions;
16
+ inject?: unknown[];
17
+ global?: boolean;
18
+ }
19
+ declare const CREWS_MODULE_OPTIONS = "CREWS_MODULE_OPTIONS";
20
+ declare const CREWS_SERVICE = "CREWS_SERVICE";
21
+ declare class CrewsModule {
22
+ static forRoot(options?: CrewsModuleOptions): DynamicModule;
23
+ static forRootAsync(options: CrewsModuleAsyncOptions): DynamicModule;
24
+ static forFeature(crews: CrewConfig[]): DynamicModule;
25
+ private static createProviders;
26
+ private static createAsyncProviders;
27
+ }
28
+
29
+ interface ManagedCrew {
30
+ crew: Crew;
31
+ dashboard?: CrewDashboard;
32
+ debugMode?: DebugMode;
33
+ }
34
+ declare class CrewsService implements OnModuleInit, OnModuleDestroy {
35
+ private readonly crews;
36
+ private readonly options;
37
+ constructor(options?: CrewsModuleOptions);
38
+ onModuleInit(): Promise<void>;
39
+ onModuleDestroy(): Promise<void>;
40
+ registerCrew(config: CrewConfig): Promise<Crew>;
41
+ unregisterCrew(name: string): boolean;
42
+ getCrew(name: string): Crew | undefined;
43
+ getCrewNames(): string[];
44
+ hasCrew(name: string): boolean;
45
+ runCrew(name: string, options?: CrewExecutionOptions): Promise<CrewResult>;
46
+ runCrewStream(name: string, options?: CrewExecutionOptions): AsyncGenerator<CrewEvent>;
47
+ runCrewWithCallback(name: string, onEvent: (event: CrewEvent) => void, options?: CrewExecutionOptions): Promise<CrewResult>;
48
+ pauseCrew(name: string): void;
49
+ resumeCrew(name: string): void;
50
+ abortCrew(name: string): void;
51
+ getDashboard(name: string): CrewDashboard | undefined;
52
+ getDebugMode(name: string): DebugMode | undefined;
53
+ getCrewStatus(name: string): ReturnType<Crew['getStatus']> | undefined;
54
+ getCrewMetrics(name: string): ReturnType<Crew['getMetrics']> | undefined;
55
+ getAllStatus(): Map<string, ReturnType<Crew['getStatus']>>;
56
+ healthCheck(): Promise<{
57
+ healthy: boolean;
58
+ crews: Array<{
59
+ name: string;
60
+ status: string;
61
+ healthy: boolean;
62
+ }>;
63
+ }>;
64
+ }
65
+ declare function createCrewsService(options?: CrewsModuleOptions): CrewsService;
66
+
67
+ declare function CrewDef(config: Partial<CrewConfig>): ClassDecorator;
68
+ declare function RoleDef(config: RoleConfig): PropertyDecorator;
69
+ declare function TaskDef(config: Partial<TaskConfig>): MethodDecorator;
70
+ declare function OnCrewEvent(eventType: string): MethodDecorator;
71
+ declare function InjectCrew(name?: string): ParameterDecorator;
72
+ declare function getCrewMetadata(target: Function): Partial<CrewConfig> | undefined;
73
+ declare function getRoleMetadata(target: Function): Array<{
74
+ propertyKey: string | symbol;
75
+ config: RoleConfig;
76
+ }>;
77
+ declare function getTaskMetadata(target: Function): Array<{
78
+ methodKey: string | symbol;
79
+ config: Partial<TaskConfig>;
80
+ handler: Function;
81
+ }>;
82
+ declare function getEventHandlerMetadata(target: Function): Array<{
83
+ eventType: string;
84
+ methodKey: string | symbol;
85
+ handler: Function;
86
+ }>;
87
+ declare function getInjectCrewMetadata(target: Function): Array<{
88
+ index: number;
89
+ name?: string;
90
+ }>;
91
+ declare function RequireCapability(...capabilities: string[]): PropertyDecorator;
92
+ declare function Priority(priority: 'critical' | 'high' | 'medium' | 'low'): MethodDecorator;
93
+ declare function Timeout(ms: number): MethodDecorator;
94
+ declare function Retry(maxRetries: number): MethodDecorator;
95
+ declare function DependsOn(...taskNames: string[]): MethodDecorator;
96
+ declare function AssignTo(agentName: string): MethodDecorator;
97
+
98
+ export { AssignTo, CREWS_MODULE_OPTIONS, CREWS_SERVICE, CrewDef, CrewsModule, type CrewsModuleAsyncOptions, type CrewsModuleOptions, CrewsService, DependsOn, InjectCrew, type ManagedCrew, OnCrewEvent, Priority, RequireCapability, Retry, RoleDef, TaskDef, Timeout, createCrewsService, getCrewMetadata, getEventHandlerMetadata, getInjectCrewMetadata, getRoleMetadata, getTaskMetadata };