snow-flow 3.0.9 → 3.0.10

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.
Files changed (294) hide show
  1. package/claude-flow.bat +0 -0
  2. package/claude-flow.ps1 +0 -0
  3. package/dist/mcp/servicenow-automation-mcp.js +0 -0
  4. package/dist/mcp/servicenow-deployment-mcp.js +0 -0
  5. package/dist/mcp/servicenow-integration-mcp.js +0 -0
  6. package/dist/mcp/servicenow-mcp-server.js +0 -0
  7. package/dist/mcp/servicenow-operations-mcp.js +0 -0
  8. package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
  9. package/dist/mcp/servicenow-progressive-indexer.js +0 -0
  10. package/dist/mcp/servicenow-reporting-analytics-mcp.js +133 -19
  11. package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
  12. package/dist/mcp/servicenow-update-set-mcp.js +0 -0
  13. package/dist/mcp/start-all-mcp-servers.js +0 -0
  14. package/dist/mcp/start-servicenow-mcp.js +0 -0
  15. package/memory/agents/README.md +1 -1
  16. package/memory/claude-flow-data.json +1 -1
  17. package/memory/sessions/README.md +1 -1
  18. package/package.json +2 -2
  19. package/.mcp.json +0 -22
  20. package/claude-flow.config.json +0 -20
  21. package/dist/agents/app-creator.agent.d.ts +0 -55
  22. package/dist/agents/app-creator.agent.js +0 -1292
  23. package/dist/agents/base/base-snow-agent.d.ts +0 -75
  24. package/dist/agents/base/base-snow-agent.js +0 -169
  25. package/dist/agents/base-snow-agent.d.ts +0 -63
  26. package/dist/agents/base-snow-agent.js +0 -296
  27. package/dist/agents/coordinator.d.ts +0 -200
  28. package/dist/agents/coordinator.js +0 -777
  29. package/dist/agents/flow-builder-agent.d.ts +0 -18
  30. package/dist/agents/flow-builder-agent.js +0 -197
  31. package/dist/agents/queen-403-handler.d.ts +0 -47
  32. package/dist/agents/queen-403-handler.js +0 -175
  33. package/dist/agents/queen-agent-example.d.ts +0 -23
  34. package/dist/agents/queen-agent-example.js +0 -240
  35. package/dist/agents/queen-agent.test.d.ts +0 -6
  36. package/dist/agents/script-generator.agent.d.ts +0 -32
  37. package/dist/agents/script-generator.agent.js +0 -772
  38. package/dist/agents/script-writer-agent.d.ts +0 -22
  39. package/dist/agents/script-writer-agent.js +0 -695
  40. package/dist/agents/security-agent.d.ts +0 -23
  41. package/dist/agents/security-agent.js +0 -619
  42. package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
  43. package/dist/agents/specialists/automation-specialist.agent.js +0 -204
  44. package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
  45. package/dist/agents/specialists/data-specialist.agent.js +0 -484
  46. package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
  47. package/dist/agents/specialists/integration-specialist.agent.js +0 -725
  48. package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
  49. package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
  50. package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
  51. package/dist/agents/specialists/security-specialist.agent.js +0 -309
  52. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
  53. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
  54. package/dist/agents/teams/base-team.d.ts +0 -72
  55. package/dist/agents/teams/base-team.js +0 -253
  56. package/dist/agents/teams/team-types.d.ts +0 -265
  57. package/dist/agents/teams/team-types.js +0 -3
  58. package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
  59. package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
  60. package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
  61. package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
  62. package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
  63. package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
  64. package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
  65. package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
  66. package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
  67. package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
  68. package/dist/agents/test-agent.d.ts +0 -26
  69. package/dist/agents/test-agent.js +0 -734
  70. package/dist/agents/test-agents.d.ts +0 -7
  71. package/dist/agents/test-agents.js +0 -64
  72. package/dist/agents/ui-builder.agent.d.ts +0 -50
  73. package/dist/agents/ui-builder.agent.js +0 -1539
  74. package/dist/agents/widget-builder.agent.d.ts +0 -32
  75. package/dist/agents/widget-builder.agent.js +0 -439
  76. package/dist/agents/widget-creator-agent.d.ts +0 -18
  77. package/dist/agents/widget-creator-agent.js +0 -498
  78. package/dist/agents/workflow-designer.agent.d.ts +0 -31
  79. package/dist/agents/workflow-designer.agent.js +0 -583
  80. package/dist/api/error-handling.d.ts +0 -325
  81. package/dist/api/error-handling.js +0 -1488
  82. package/dist/api/flow-designer-api.d.ts +0 -167
  83. package/dist/api/flow-designer-api.js +0 -554
  84. package/dist/api/natural-language-mapper.d.ts +0 -124
  85. package/dist/api/natural-language-mapper.js +0 -501
  86. package/dist/api/performance-optimizer.d.ts +0 -240
  87. package/dist/api/performance-optimizer.js +0 -706
  88. package/dist/api/transaction-manager.d.ts +0 -189
  89. package/dist/api/transaction-manager.js +0 -576
  90. package/dist/assembly/team-assembler.d.ts +0 -140
  91. package/dist/assembly/team-assembler.js +0 -502
  92. package/dist/benchmark-performance.d.ts +0 -41
  93. package/dist/benchmark-performance.js +0 -230
  94. package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
  95. package/dist/cli/snow-flow-cli-integration.js +0 -396
  96. package/dist/coordination/coordination-engine.d.ts +0 -41
  97. package/dist/coordination/coordination-engine.js +0 -324
  98. package/dist/coordination/coordination.test.d.ts +0 -6
  99. package/dist/coordination/example.d.ts +0 -31
  100. package/dist/coordination/example.js +0 -394
  101. package/dist/coordination/execution-patterns.d.ts +0 -43
  102. package/dist/coordination/execution-patterns.js +0 -507
  103. package/dist/coordination/factory.d.ts +0 -94
  104. package/dist/coordination/factory.js +0 -433
  105. package/dist/coordination/index.d.ts +0 -71
  106. package/dist/coordination/index.js +0 -135
  107. package/dist/coordination/progress-monitor.d.ts +0 -71
  108. package/dist/coordination/progress-monitor.js +0 -505
  109. package/dist/coordination/quality-gates.d.ts +0 -124
  110. package/dist/coordination/quality-gates.js +0 -577
  111. package/dist/coordination/shared-memory.d.ts +0 -39
  112. package/dist/coordination/shared-memory.js +0 -289
  113. package/dist/coordination/task-dependencies.d.ts +0 -50
  114. package/dist/coordination/task-dependencies.js +0 -407
  115. package/dist/coordination/team-coordinator.d.ts +0 -59
  116. package/dist/coordination/team-coordinator.js +0 -550
  117. package/dist/coordination/types.d.ts +0 -152
  118. package/dist/coordination/types.js +0 -3
  119. package/dist/mcp/mcp-wrapper.d.ts +0 -8
  120. package/dist/mcp/mcp-wrapper.js +0 -77
  121. package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
  122. package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
  123. package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
  124. package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
  125. package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
  126. package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
  127. package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
  128. package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
  129. package/dist/mcp/singleton-check.js +0 -31
  130. package/dist/mcp/test-simple-mcp.d.ts +0 -6
  131. package/dist/mcp/test-simple-mcp.js +0 -63
  132. package/dist/memory/hierarchical-memory-system.d.ts +0 -90
  133. package/dist/memory/hierarchical-memory-system.js +0 -400
  134. package/dist/memory/index.d.ts +0 -9
  135. package/dist/memory/index.js +0 -20
  136. package/dist/memory/mcp-integration-example.d.ts +0 -6
  137. package/dist/memory/mcp-integration-example.js +0 -281
  138. package/dist/memory/memory-client.d.ts +0 -199
  139. package/dist/memory/memory-client.js +0 -364
  140. package/dist/memory/memory-manager.d.ts +0 -29
  141. package/dist/memory/memory-manager.js +0 -280
  142. package/dist/memory/memory-operations.d.ts +0 -179
  143. package/dist/memory/memory-operations.js +0 -691
  144. package/dist/memory/memory-system.d.ts +0 -153
  145. package/dist/memory/memory-system.js +0 -651
  146. package/dist/memory/memory-test.d.ts +0 -6
  147. package/dist/memory/memory-test.js +0 -161
  148. package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
  149. package/dist/memory/snow-flow-memory-patterns.js +0 -200
  150. package/dist/memory/snow-memory.d.ts +0 -54
  151. package/dist/memory/snow-memory.js +0 -301
  152. package/dist/memory/swarm-memory.d.ts +0 -135
  153. package/dist/memory/swarm-memory.js +0 -378
  154. package/dist/optimization/flow-performance-optimizer.js +0 -723
  155. package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
  156. package/dist/orchestration/discovery/service-discovery.js +0 -808
  157. package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
  158. package/dist/orchestration/distributed-orchestrator.js +0 -712
  159. package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
  160. package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
  161. package/dist/orchestration/flow-update-orchestrator.js +0 -648
  162. package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
  163. package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
  164. package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
  165. package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
  166. package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
  167. package/dist/orchestration/state/distributed-state-manager.js +0 -716
  168. package/dist/orchestrator/flow-composer.d.ts +0 -105
  169. package/dist/orchestrator/flow-composer.js +0 -404
  170. package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
  171. package/dist/orchestrator/flow-pattern-templates.js +0 -908
  172. package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
  173. package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
  174. package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
  175. package/dist/orchestrator/flow-validation-engine.js +0 -913
  176. package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
  177. package/dist/orchestrator/snow-orchestrator.js +0 -235
  178. package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
  179. package/dist/orchestrator/subflow-creation-handler.js +0 -791
  180. package/dist/patterns/adaptive-patterns.d.ts +0 -140
  181. package/dist/patterns/adaptive-patterns.js +0 -549
  182. package/dist/queen/advanced-integration-test.d.ts +0 -48
  183. package/dist/queen/advanced-integration-test.js +0 -473
  184. package/dist/queen/integration-example.d.ts +0 -82
  185. package/dist/queen/integration-example.js +0 -219
  186. package/dist/queen/integration-test.d.ts +0 -72
  187. package/dist/queen/integration-test.js +0 -563
  188. package/dist/queen/mock-mcp-client.d.ts +0 -71
  189. package/dist/queen/mock-mcp-client.js +0 -317
  190. package/dist/queen/run-integration-tests.d.ts +0 -9
  191. package/dist/queen/run-integration-tests.js +0 -27
  192. package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
  193. package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
  194. package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
  195. package/dist/sparc/coordinators/team-coordinator.js +0 -402
  196. package/dist/sparc/modes/team-modes.d.ts +0 -33
  197. package/dist/sparc/modes/team-modes.js +0 -399
  198. package/dist/sparc/teams/application-team.d.ts +0 -73
  199. package/dist/sparc/teams/application-team.js +0 -463
  200. package/dist/sparc/teams/flow-team.d.ts +0 -67
  201. package/dist/sparc/teams/flow-team.js +0 -373
  202. package/dist/sparc/teams/widget-team.d.ts +0 -61
  203. package/dist/sparc/teams/widget-team.js +0 -280
  204. package/dist/specialists/app-specialists.d.ts +0 -93
  205. package/dist/specialists/app-specialists.js +0 -1639
  206. package/dist/specialists/base-specialist.d.ts +0 -19
  207. package/dist/specialists/base-specialist.js +0 -54
  208. package/dist/specialists/flow-specialists.d.ts +0 -113
  209. package/dist/specialists/flow-specialists.js +0 -1787
  210. package/dist/specialists/individual-specialists.d.ts +0 -67
  211. package/dist/specialists/individual-specialists.js +0 -632
  212. package/dist/specialists/widget-specialists.d.ts +0 -70
  213. package/dist/specialists/widget-specialists.js +0 -1264
  214. package/dist/src/utils/agent-detector.js +0 -655
  215. package/dist/teams/adaptive-team.d.ts +0 -81
  216. package/dist/teams/adaptive-team.js +0 -1153
  217. package/dist/teams/application-team.d.ts +0 -30
  218. package/dist/teams/application-team.js +0 -547
  219. package/dist/teams/base-team.d.ts +0 -55
  220. package/dist/teams/base-team.js +0 -243
  221. package/dist/teams/flow-team.d.ts +0 -28
  222. package/dist/teams/flow-team.js +0 -525
  223. package/dist/teams/widget-team.d.ts +0 -26
  224. package/dist/teams/widget-team.js +0 -459
  225. package/dist/templates/flow-template-system.js +0 -625
  226. package/dist/test-fetch-incidents.d.ts +0 -2
  227. package/dist/test-fetch-incidents.js +0 -84
  228. package/dist/test-incident-access.d.ts +0 -2
  229. package/dist/test-incident-access.js +0 -72
  230. package/dist/test-iphone-flow.js +0 -189
  231. package/dist/test-limit-problem.d.ts +0 -2
  232. package/dist/test-limit-problem.js +0 -60
  233. package/dist/test-ml-batch-fix.d.ts +0 -2
  234. package/dist/test-ml-batch-fix.js +0 -104
  235. package/dist/test-ml-batch.d.ts +0 -2
  236. package/dist/test-ml-batch.js +0 -87
  237. package/dist/test-ml-query.d.ts +0 -2
  238. package/dist/test-ml-query.js +0 -100
  239. package/dist/test-ml-training-fix.d.ts +0 -12
  240. package/dist/test-ml-training-fix.js +0 -113
  241. package/dist/test-ml-training.d.ts +0 -2
  242. package/dist/test-ml-training.js +0 -32
  243. package/dist/test-operations-query.d.ts +0 -2
  244. package/dist/test-operations-query.js +0 -84
  245. package/dist/test-performance-query.d.ts +0 -2
  246. package/dist/test-performance-query.js +0 -52
  247. package/dist/test-singleton-protection.d.ts +0 -8
  248. package/dist/test-singleton-protection.js +0 -110
  249. package/dist/test-smart-limits.d.ts +0 -13
  250. package/dist/test-smart-limits.js +0 -100
  251. package/dist/test-snow-query-incidents.d.ts +0 -2
  252. package/dist/test-snow-query-incidents.js +0 -66
  253. package/dist/test-universal-query.d.ts +0 -2
  254. package/dist/test-universal-query.js +0 -106
  255. package/dist/testing/flow-testing-automation.js +0 -641
  256. package/dist/utils/complete-flow-xml-generator.js +0 -1285
  257. package/dist/utils/file-storage-fallback.d.ts +0 -62
  258. package/dist/utils/file-storage-fallback.js +0 -289
  259. package/dist/utils/flow-api-discovery.d.ts +0 -151
  260. package/dist/utils/flow-api-discovery.js +0 -439
  261. package/dist/utils/flow-examples.js +0 -720
  262. package/dist/utils/flow-structure-builder.js +0 -677
  263. package/dist/utils/flow-xml-generator.d.ts +0 -41
  264. package/dist/utils/flow-xml-generator.js +0 -258
  265. package/dist/utils/improved-flow-xml-generator.js +0 -820
  266. package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
  267. package/dist/utils/mcp-process-manager.backup.js +0 -220
  268. package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
  269. package/dist/utils/mcp-singleton-enforcer.js +0 -201
  270. package/dist/utils/mcp-timeout-fix.d.ts +0 -53
  271. package/dist/utils/mcp-timeout-fix.js +0 -221
  272. package/dist/utils/migrate-claude-flow.d.ts +0 -22
  273. package/dist/utils/migrate-claude-flow.js +0 -120
  274. package/dist/utils/scope-utils.d.ts +0 -72
  275. package/dist/utils/scope-utils.js +0 -386
  276. package/dist/utils/snow-oauth-old.d.ts +0 -65
  277. package/dist/utils/snow-oauth-old.js +0 -345
  278. package/dist/utils/xml-first-flow-generator.js +0 -513
  279. package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
  280. package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
  281. package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
  282. package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
  283. package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
  284. package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
  285. package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
  286. package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
  287. package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
  288. package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
  289. package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
  290. package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
  291. package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
  292. package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
  293. package/reports/swarm-auto-centralized-1752649029776.json +0 -13
  294. package/src/memory/README.md +0 -240
@@ -1,407 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TaskDependencyGraph = void 0;
4
- const eventemitter3_1 = require("eventemitter3");
5
- const logger_1 = require("../utils/logger");
6
- class TaskDependencyGraph extends eventemitter3_1.EventEmitter {
7
- constructor(sharedMemory, config) {
8
- super();
9
- this.nodes = new Map();
10
- this.edges = new Map();
11
- this.reverseEdges = new Map();
12
- this.sharedMemory = sharedMemory;
13
- this.config = config;
14
- logger_1.logger.info('📊 Task Dependency Graph initialized');
15
- }
16
- addTask(taskId, agent, requirements, dependencies = []) {
17
- try {
18
- // Create task node
19
- const node = {
20
- id: taskId,
21
- agent,
22
- requirements,
23
- status: 'pending',
24
- result: null,
25
- retryCount: 0
26
- };
27
- this.nodes.set(taskId, node);
28
- this.edges.set(taskId, new Set(dependencies));
29
- // Build reverse dependency graph for efficient querying
30
- for (const dep of dependencies) {
31
- if (!this.reverseEdges.has(dep)) {
32
- this.reverseEdges.set(dep, new Set());
33
- }
34
- this.reverseEdges.get(dep).add(taskId);
35
- }
36
- logger_1.logger.debug('📝 Added task to dependency graph', {
37
- taskId,
38
- agentId: agent?.id,
39
- dependencies: dependencies.length
40
- });
41
- this.emit('task:added', { taskId, dependencies });
42
- }
43
- catch (error) {
44
- logger_1.logger.error('❌ Failed to add task to dependency graph', { taskId, error: error.message });
45
- throw error;
46
- }
47
- }
48
- async getReadyTasks() {
49
- const ready = [];
50
- for (const [taskId, node] of this.nodes) {
51
- if (node.status === 'pending' && await this.areDependenciesComplete(taskId)) {
52
- ready.push(node);
53
- }
54
- }
55
- return ready;
56
- }
57
- async areDependenciesComplete(taskId) {
58
- const dependencies = this.edges.get(taskId) || new Set();
59
- for (const depId of dependencies) {
60
- const depNode = this.nodes.get(depId);
61
- if (!depNode || depNode.status !== 'completed') {
62
- return false;
63
- }
64
- }
65
- return true;
66
- }
67
- async executeTask(taskId) {
68
- const node = this.nodes.get(taskId);
69
- if (!node) {
70
- throw new Error(`Task not found: ${taskId}`);
71
- }
72
- // Check if already executing or completed
73
- if (node.status === 'in_progress' || node.status === 'completed') {
74
- return node.result;
75
- }
76
- try {
77
- logger_1.logger.info('🚀 Executing task', { taskId, agentId: node.agent?.id });
78
- node.status = 'in_progress';
79
- node.startTime = new Date();
80
- this.emit('task:started', { taskId, agentId: node.agent?.id });
81
- // Store task status in shared memory
82
- await this.sharedMemory.store(`task_status_${taskId}`, {
83
- status: 'in_progress',
84
- startTime: node.startTime,
85
- agentId: node.agent?.id
86
- });
87
- // Get dependency results
88
- const dependencyResults = await this.getDependencyResults(taskId);
89
- // Execute the task through the agent
90
- const result = await this.executeTaskWithRetry(node, dependencyResults);
91
- // Update node
92
- node.status = 'completed';
93
- node.result = result;
94
- node.endTime = new Date();
95
- // Store result in shared memory
96
- await this.sharedMemory.store(`task_result_${taskId}`, result);
97
- await this.sharedMemory.store(`task_status_${taskId}`, {
98
- status: 'completed',
99
- endTime: node.endTime,
100
- duration: node.endTime.getTime() - node.startTime.getTime()
101
- });
102
- logger_1.logger.info('✅ Task completed successfully', {
103
- taskId,
104
- duration: node.endTime.getTime() - node.startTime.getTime()
105
- });
106
- this.emit('task:completed', { taskId, result });
107
- return result;
108
- }
109
- catch (error) {
110
- node.status = 'failed';
111
- node.error = error;
112
- node.endTime = new Date();
113
- // Store error in shared memory
114
- await this.sharedMemory.store(`task_error_${taskId}`, {
115
- error: error.message,
116
- timestamp: node.endTime
117
- });
118
- logger_1.logger.error('❌ Task execution failed', {
119
- taskId,
120
- error: error.message,
121
- retryCount: node.retryCount
122
- });
123
- this.emit('task:failed', { taskId, error });
124
- // Handle error recovery
125
- if (this.config.enableRetries && node.retryCount < this.config.maxRetries) {
126
- await this.scheduleRetry(taskId);
127
- }
128
- else {
129
- await this.handleTaskFailure(taskId, error);
130
- }
131
- throw error;
132
- }
133
- }
134
- async executeTaskWithRetry(node, dependencyResults) {
135
- const maxRetries = this.config.enableRetries ? this.config.maxRetries : 0;
136
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
137
- try {
138
- if (attempt > 0) {
139
- logger_1.logger.info('🔄 Retrying task execution', {
140
- taskId: node.id,
141
- attempt: attempt + 1,
142
- maxRetries: maxRetries + 1
143
- });
144
- }
145
- // Execute task through agent
146
- const result = await this.executeAgentTask(node, dependencyResults);
147
- return result;
148
- }
149
- catch (error) {
150
- node.retryCount = attempt + 1;
151
- if (attempt < maxRetries) {
152
- // Wait before retry with exponential backoff
153
- const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
154
- await new Promise(resolve => setTimeout(resolve, delay));
155
- }
156
- else {
157
- throw error;
158
- }
159
- }
160
- }
161
- }
162
- async executeAgentTask(node, dependencyResults) {
163
- // This would be the interface to the actual agent execution
164
- // For now, we'll simulate agent task execution
165
- if (!node.agent) {
166
- throw new Error(`No agent assigned to task: ${node.id}`);
167
- }
168
- // Prepare task context
169
- const taskContext = {
170
- taskId: node.id,
171
- requirements: node.requirements,
172
- dependencies: dependencyResults,
173
- sharedMemory: this.sharedMemory
174
- };
175
- // Simulate task execution (in real implementation, this would call the agent)
176
- // TODO: Replace with actual agent task execution interface
177
- return await this.simulateAgentExecution(node, taskContext);
178
- }
179
- async simulateAgentExecution(node, context) {
180
- // Simulation of agent task execution
181
- // In real implementation, this would interface with the actual agent system
182
- const delay = Math.random() * 2000 + 1000; // 1-3 seconds
183
- await new Promise(resolve => setTimeout(resolve, delay));
184
- return {
185
- taskId: node.id,
186
- agentId: node.agent?.id,
187
- outputs: node.requirements.outputs,
188
- executionTime: delay,
189
- timestamp: new Date()
190
- };
191
- }
192
- async scheduleRetry(taskId) {
193
- const node = this.nodes.get(taskId);
194
- if (!node)
195
- return;
196
- node.status = 'pending';
197
- logger_1.logger.info('⏰ Scheduled task retry', { taskId, retryCount: node.retryCount });
198
- this.emit('task:retry_scheduled', { taskId, retryCount: node.retryCount });
199
- }
200
- async handleTaskFailure(taskId, error) {
201
- logger_1.logger.error('💥 Task failed permanently', { taskId, error: error.message });
202
- switch (this.config.errorRecoveryStrategy) {
203
- case 'abort':
204
- this.emit('graph:abort_requested', { failedTask: taskId, error });
205
- break;
206
- case 'continue':
207
- // Mark dependent tasks as skipped
208
- await this.markDependentTasksAsSkipped(taskId);
209
- break;
210
- case 'retry':
211
- // Already handled in executeTaskWithRetry
212
- break;
213
- }
214
- }
215
- async markDependentTasksAsSkipped(failedTaskId) {
216
- const dependents = this.reverseEdges.get(failedTaskId) || new Set();
217
- for (const dependentId of dependents) {
218
- const dependentNode = this.nodes.get(dependentId);
219
- if (dependentNode && dependentNode.status === 'pending') {
220
- dependentNode.status = 'cancelled';
221
- logger_1.logger.warn('⏭️ Skipped dependent task due to failure', {
222
- taskId: dependentId,
223
- failedDependency: failedTaskId
224
- });
225
- // Recursively skip dependents
226
- await this.markDependentTasksAsSkipped(dependentId);
227
- }
228
- }
229
- }
230
- async getDependencyResults(taskId) {
231
- const dependencies = this.edges.get(taskId) || new Set();
232
- const results = {};
233
- for (const depId of dependencies) {
234
- const depNode = this.nodes.get(depId);
235
- if (depNode && depNode.status === 'completed') {
236
- results[depId] = depNode.result;
237
- }
238
- }
239
- return results;
240
- }
241
- async topologicalSort() {
242
- const levels = [];
243
- const visited = new Set();
244
- const inDegree = new Map();
245
- // Calculate in-degrees
246
- for (const [taskId] of this.nodes) {
247
- inDegree.set(taskId, (this.edges.get(taskId) || new Set()).size);
248
- }
249
- while (visited.size < this.nodes.size) {
250
- const currentLevel = [];
251
- // Find tasks with no dependencies
252
- for (const [taskId] of this.nodes) {
253
- if (!visited.has(taskId) && inDegree.get(taskId) === 0) {
254
- currentLevel.push(taskId);
255
- }
256
- }
257
- if (currentLevel.length === 0) {
258
- const remaining = Array.from(this.nodes.keys()).filter(id => !visited.has(id));
259
- throw new Error(`Circular dependency detected among tasks: ${remaining.join(', ')}`);
260
- }
261
- levels.push(currentLevel);
262
- // Update in-degrees and mark as visited
263
- for (const taskId of currentLevel) {
264
- visited.add(taskId);
265
- const dependents = this.reverseEdges.get(taskId) || new Set();
266
- for (const dependent of dependents) {
267
- const currentInDegree = inDegree.get(dependent) || 0;
268
- inDegree.set(dependent, currentInDegree - 1);
269
- }
270
- }
271
- }
272
- return levels;
273
- }
274
- async validateGraph() {
275
- try {
276
- // Check for circular dependencies
277
- await this.topologicalSort();
278
- // Check that all dependencies exist
279
- for (const [taskId, dependencies] of this.edges) {
280
- for (const depId of dependencies) {
281
- if (!this.nodes.has(depId)) {
282
- throw new Error(`Task ${taskId} depends on non-existent task: ${depId}`);
283
- }
284
- }
285
- }
286
- logger_1.logger.info('✅ Task dependency graph validation passed');
287
- }
288
- catch (error) {
289
- logger_1.logger.error('❌ Task dependency graph validation failed', { error: error.message });
290
- throw error;
291
- }
292
- }
293
- async generateExecutionPlan() {
294
- const levels = await this.topologicalSort();
295
- const phases = [];
296
- for (let i = 0; i < levels.length; i++) {
297
- const level = levels[i];
298
- phases.push({
299
- id: `phase_${i}`,
300
- type: level.length > 1 ? 'parallel' : 'sequential',
301
- tasks: level,
302
- estimatedDuration: this.estimatePhaseDuration(level),
303
- dependencies: i > 0 ? [`phase_${i - 1}`] : []
304
- });
305
- }
306
- const criticalPath = this.findCriticalPath();
307
- const parallelizationOpportunities = this.findParallelizationOpportunities(levels);
308
- return {
309
- phases,
310
- totalEstimatedTime: phases.reduce((sum, phase) => sum + phase.estimatedDuration, 0),
311
- criticalPath,
312
- parallelizationOpportunities
313
- };
314
- }
315
- estimatePhaseDuration(tasks) {
316
- // Simple estimation - in practice this would be more sophisticated
317
- return Math.max(...tasks.map(taskId => {
318
- const node = this.nodes.get(taskId);
319
- return node?.requirements.constraints?.find(c => c.type === 'time')?.value || 60000; // Default 1 minute
320
- }));
321
- }
322
- findCriticalPath() {
323
- // Simplified critical path calculation
324
- // In practice, this would use more sophisticated algorithms
325
- const levels = this.getTopologicalLevels();
326
- return levels.flat();
327
- }
328
- getTopologicalLevels() {
329
- try {
330
- return this.topologicalSort();
331
- }
332
- catch {
333
- return [];
334
- }
335
- }
336
- findParallelizationOpportunities(levels) {
337
- const opportunities = [];
338
- for (const level of levels) {
339
- if (level.length > 1) {
340
- opportunities.push({
341
- tasks: level,
342
- estimatedSavings: (level.length - 1) * this.estimatePhaseDuration(level),
343
- riskLevel: level.length > 3 ? 'high' : level.length > 1 ? 'medium' : 'low'
344
- });
345
- }
346
- }
347
- return opportunities;
348
- }
349
- // Query methods
350
- getTotalTasks() {
351
- return this.nodes.size;
352
- }
353
- getCompletedTasks() {
354
- return Array.from(this.nodes.values()).filter(node => node.status === 'completed');
355
- }
356
- getFailedTasks() {
357
- return Array.from(this.nodes.values()).filter(node => node.status === 'failed');
358
- }
359
- getInProgressTasks() {
360
- return Array.from(this.nodes.values()).filter(node => node.status === 'in_progress');
361
- }
362
- getPendingTasks() {
363
- return Array.from(this.nodes.values()).filter(node => node.status === 'pending');
364
- }
365
- getTask(taskId) {
366
- return this.nodes.get(taskId);
367
- }
368
- getMaxParallelism() {
369
- try {
370
- const levels = this.getTopologicalLevels();
371
- return Math.max(...levels.map(level => level.length));
372
- }
373
- catch {
374
- return 1;
375
- }
376
- }
377
- getComplexityScore() {
378
- const totalTasks = this.getTotalTasks();
379
- const totalDependencies = Array.from(this.edges.values())
380
- .reduce((sum, deps) => sum + deps.size, 0);
381
- // Complexity score between 0 and 1
382
- return totalTasks > 0 ? Math.min(totalDependencies / (totalTasks * totalTasks), 1) : 0;
383
- }
384
- async getExecutionStats() {
385
- const total = this.getTotalTasks();
386
- const completed = this.getCompletedTasks();
387
- const failed = this.getFailedTasks();
388
- const inProgress = this.getInProgressTasks();
389
- return {
390
- totalTasks: total,
391
- completedTasks: completed.length,
392
- failedTasks: failed.length,
393
- inProgressTasks: inProgress.length,
394
- averageExecutionTime: completed.length > 0
395
- ? completed.reduce((sum, task) => {
396
- const duration = task.endTime && task.startTime
397
- ? task.endTime.getTime() - task.startTime.getTime()
398
- : 0;
399
- return sum + duration;
400
- }, 0) / completed.length
401
- : 0,
402
- totalRetries: Array.from(this.nodes.values()).reduce((sum, node) => sum + node.retryCount, 0)
403
- };
404
- }
405
- }
406
- exports.TaskDependencyGraph = TaskDependencyGraph;
407
- //# sourceMappingURL=task-dependencies.js.map
@@ -1,59 +0,0 @@
1
- import { TeamOptions } from '../teams/base-team.js';
2
- export interface CoordinationOptions extends TeamOptions {
3
- preferTeams?: boolean;
4
- maxComplexity?: 'simple' | 'moderate' | 'complex';
5
- timeConstraint?: string;
6
- qualityLevel?: 'quick' | 'standard' | 'comprehensive';
7
- }
8
- export interface TaskAnalysis {
9
- domain: string;
10
- complexity: 'simple' | 'moderate' | 'complex';
11
- scope: 'focused' | 'medium' | 'broad';
12
- timeEstimate: string;
13
- recommendedApproach: 'individual' | 'team' | 'adaptive';
14
- confidence: number;
15
- reasoning: string[];
16
- }
17
- export interface ExecutionResult {
18
- approach: string;
19
- executor: string;
20
- result: any;
21
- executionTime: number;
22
- qualityMetrics: any;
23
- recommendations: string[];
24
- }
25
- export declare class TeamCoordinator {
26
- private options;
27
- private taskHistory;
28
- private performanceMetrics;
29
- constructor(options?: CoordinationOptions);
30
- coordinate(task: string): Promise<ExecutionResult>;
31
- private analyzeTask;
32
- private identifyDomain;
33
- private assessComplexity;
34
- private assessScope;
35
- private estimateTime;
36
- private determineOptimalApproach;
37
- private shouldUseIndividualSpecialist;
38
- private shouldUseSpecializedTeam;
39
- private selectIndividualSpecialist;
40
- private selectSpecializedTeam;
41
- private executeWithIndividualSpecialist;
42
- private logAnalysis;
43
- private calculateExecutionQuality;
44
- private assessCompleteness;
45
- private assessAccuracy;
46
- private assessEfficiency;
47
- private parseTimeToMs;
48
- private assessMaintainability;
49
- private assessScalability;
50
- private generateRecommendations;
51
- private updatePerformanceMetrics;
52
- getTaskHistory(): Map<string, TaskAnalysis>;
53
- getPerformanceMetrics(): Map<string, any>;
54
- getCoordinatorInsights(): any;
55
- private getMostUsedApproach;
56
- private getAverageConfidence;
57
- private getCoordinatorRecommendations;
58
- }
59
- //# sourceMappingURL=team-coordinator.d.ts.map