snow-flow 3.0.9 → 3.0.13

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 (302) hide show
  1. package/claude-flow.bat +0 -0
  2. package/claude-flow.ps1 +0 -0
  3. package/dist/mcp/intelligent-reporting-mcp.d.ts +7 -0
  4. package/dist/mcp/intelligent-reporting-mcp.js +379 -0
  5. package/dist/mcp/servicenow-automation-mcp.js +0 -0
  6. package/dist/mcp/servicenow-deployment-mcp.js +0 -0
  7. package/dist/mcp/servicenow-integration-mcp.js +0 -0
  8. package/dist/mcp/servicenow-mcp-server.js +0 -0
  9. package/dist/mcp/servicenow-operations-mcp.js +0 -0
  10. package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
  11. package/dist/mcp/servicenow-progressive-indexer.js +0 -0
  12. package/dist/mcp/servicenow-reporting-analytics-mcp.js +280 -29
  13. package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
  14. package/dist/mcp/servicenow-update-set-mcp.js +0 -0
  15. package/dist/mcp/start-all-mcp-servers.js +0 -0
  16. package/dist/mcp/start-servicenow-mcp.js +0 -0
  17. package/dist/services/widget-deployment-service.d.ts +2 -1
  18. package/dist/services/widget-deployment-service.js +17 -16
  19. package/dist/utils/anti-mock-data-validator.d.ts +66 -0
  20. package/dist/utils/anti-mock-data-validator.js +316 -0
  21. package/dist/utils/servicenow-eventual-consistency.d.ts +120 -0
  22. package/dist/utils/servicenow-eventual-consistency.js +220 -0
  23. package/memory/agents/README.md +1 -1
  24. package/memory/claude-flow-data.json +1 -1
  25. package/memory/sessions/README.md +1 -1
  26. package/package.json +4 -3
  27. package/.mcp.json +0 -22
  28. package/claude-flow.config.json +0 -20
  29. package/dist/agents/app-creator.agent.d.ts +0 -55
  30. package/dist/agents/app-creator.agent.js +0 -1292
  31. package/dist/agents/base/base-snow-agent.d.ts +0 -75
  32. package/dist/agents/base/base-snow-agent.js +0 -169
  33. package/dist/agents/base-snow-agent.d.ts +0 -63
  34. package/dist/agents/base-snow-agent.js +0 -296
  35. package/dist/agents/coordinator.d.ts +0 -200
  36. package/dist/agents/coordinator.js +0 -777
  37. package/dist/agents/flow-builder-agent.d.ts +0 -18
  38. package/dist/agents/flow-builder-agent.js +0 -197
  39. package/dist/agents/queen-403-handler.d.ts +0 -47
  40. package/dist/agents/queen-403-handler.js +0 -175
  41. package/dist/agents/queen-agent-example.d.ts +0 -23
  42. package/dist/agents/queen-agent-example.js +0 -240
  43. package/dist/agents/queen-agent.test.d.ts +0 -6
  44. package/dist/agents/script-generator.agent.d.ts +0 -32
  45. package/dist/agents/script-generator.agent.js +0 -772
  46. package/dist/agents/script-writer-agent.d.ts +0 -22
  47. package/dist/agents/script-writer-agent.js +0 -695
  48. package/dist/agents/security-agent.d.ts +0 -23
  49. package/dist/agents/security-agent.js +0 -619
  50. package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
  51. package/dist/agents/specialists/automation-specialist.agent.js +0 -204
  52. package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
  53. package/dist/agents/specialists/data-specialist.agent.js +0 -484
  54. package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
  55. package/dist/agents/specialists/integration-specialist.agent.js +0 -725
  56. package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
  57. package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
  58. package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
  59. package/dist/agents/specialists/security-specialist.agent.js +0 -309
  60. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
  61. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
  62. package/dist/agents/teams/base-team.d.ts +0 -72
  63. package/dist/agents/teams/base-team.js +0 -253
  64. package/dist/agents/teams/team-types.d.ts +0 -265
  65. package/dist/agents/teams/team-types.js +0 -3
  66. package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
  67. package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
  68. package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
  69. package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
  70. package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
  71. package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
  72. package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
  73. package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
  74. package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
  75. package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
  76. package/dist/agents/test-agent.d.ts +0 -26
  77. package/dist/agents/test-agent.js +0 -734
  78. package/dist/agents/test-agents.d.ts +0 -7
  79. package/dist/agents/test-agents.js +0 -64
  80. package/dist/agents/ui-builder.agent.d.ts +0 -50
  81. package/dist/agents/ui-builder.agent.js +0 -1539
  82. package/dist/agents/widget-builder.agent.d.ts +0 -32
  83. package/dist/agents/widget-builder.agent.js +0 -439
  84. package/dist/agents/widget-creator-agent.d.ts +0 -18
  85. package/dist/agents/widget-creator-agent.js +0 -498
  86. package/dist/agents/workflow-designer.agent.d.ts +0 -31
  87. package/dist/agents/workflow-designer.agent.js +0 -583
  88. package/dist/api/error-handling.d.ts +0 -325
  89. package/dist/api/error-handling.js +0 -1488
  90. package/dist/api/flow-designer-api.d.ts +0 -167
  91. package/dist/api/flow-designer-api.js +0 -554
  92. package/dist/api/natural-language-mapper.d.ts +0 -124
  93. package/dist/api/natural-language-mapper.js +0 -501
  94. package/dist/api/performance-optimizer.d.ts +0 -240
  95. package/dist/api/performance-optimizer.js +0 -706
  96. package/dist/api/transaction-manager.d.ts +0 -189
  97. package/dist/api/transaction-manager.js +0 -576
  98. package/dist/assembly/team-assembler.d.ts +0 -140
  99. package/dist/assembly/team-assembler.js +0 -502
  100. package/dist/benchmark-performance.d.ts +0 -41
  101. package/dist/benchmark-performance.js +0 -230
  102. package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
  103. package/dist/cli/snow-flow-cli-integration.js +0 -396
  104. package/dist/coordination/coordination-engine.d.ts +0 -41
  105. package/dist/coordination/coordination-engine.js +0 -324
  106. package/dist/coordination/coordination.test.d.ts +0 -6
  107. package/dist/coordination/example.d.ts +0 -31
  108. package/dist/coordination/example.js +0 -394
  109. package/dist/coordination/execution-patterns.d.ts +0 -43
  110. package/dist/coordination/execution-patterns.js +0 -507
  111. package/dist/coordination/factory.d.ts +0 -94
  112. package/dist/coordination/factory.js +0 -433
  113. package/dist/coordination/index.d.ts +0 -71
  114. package/dist/coordination/index.js +0 -135
  115. package/dist/coordination/progress-monitor.d.ts +0 -71
  116. package/dist/coordination/progress-monitor.js +0 -505
  117. package/dist/coordination/quality-gates.d.ts +0 -124
  118. package/dist/coordination/quality-gates.js +0 -577
  119. package/dist/coordination/shared-memory.d.ts +0 -39
  120. package/dist/coordination/shared-memory.js +0 -289
  121. package/dist/coordination/task-dependencies.d.ts +0 -50
  122. package/dist/coordination/task-dependencies.js +0 -407
  123. package/dist/coordination/team-coordinator.d.ts +0 -59
  124. package/dist/coordination/team-coordinator.js +0 -550
  125. package/dist/coordination/types.d.ts +0 -152
  126. package/dist/coordination/types.js +0 -3
  127. package/dist/mcp/mcp-wrapper.d.ts +0 -8
  128. package/dist/mcp/mcp-wrapper.js +0 -77
  129. package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
  130. package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
  131. package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
  132. package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
  133. package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
  134. package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
  135. package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
  136. package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
  137. package/dist/mcp/singleton-check.js +0 -31
  138. package/dist/mcp/test-simple-mcp.d.ts +0 -6
  139. package/dist/mcp/test-simple-mcp.js +0 -63
  140. package/dist/memory/hierarchical-memory-system.d.ts +0 -90
  141. package/dist/memory/hierarchical-memory-system.js +0 -400
  142. package/dist/memory/index.d.ts +0 -9
  143. package/dist/memory/index.js +0 -20
  144. package/dist/memory/mcp-integration-example.d.ts +0 -6
  145. package/dist/memory/mcp-integration-example.js +0 -281
  146. package/dist/memory/memory-client.d.ts +0 -199
  147. package/dist/memory/memory-client.js +0 -364
  148. package/dist/memory/memory-manager.d.ts +0 -29
  149. package/dist/memory/memory-manager.js +0 -280
  150. package/dist/memory/memory-operations.d.ts +0 -179
  151. package/dist/memory/memory-operations.js +0 -691
  152. package/dist/memory/memory-system.d.ts +0 -153
  153. package/dist/memory/memory-system.js +0 -651
  154. package/dist/memory/memory-test.d.ts +0 -6
  155. package/dist/memory/memory-test.js +0 -161
  156. package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
  157. package/dist/memory/snow-flow-memory-patterns.js +0 -200
  158. package/dist/memory/snow-memory.d.ts +0 -54
  159. package/dist/memory/snow-memory.js +0 -301
  160. package/dist/memory/swarm-memory.d.ts +0 -135
  161. package/dist/memory/swarm-memory.js +0 -378
  162. package/dist/optimization/flow-performance-optimizer.js +0 -723
  163. package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
  164. package/dist/orchestration/discovery/service-discovery.js +0 -808
  165. package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
  166. package/dist/orchestration/distributed-orchestrator.js +0 -712
  167. package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
  168. package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
  169. package/dist/orchestration/flow-update-orchestrator.js +0 -648
  170. package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
  171. package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
  172. package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
  173. package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
  174. package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
  175. package/dist/orchestration/state/distributed-state-manager.js +0 -716
  176. package/dist/orchestrator/flow-composer.d.ts +0 -105
  177. package/dist/orchestrator/flow-composer.js +0 -404
  178. package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
  179. package/dist/orchestrator/flow-pattern-templates.js +0 -908
  180. package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
  181. package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
  182. package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
  183. package/dist/orchestrator/flow-validation-engine.js +0 -913
  184. package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
  185. package/dist/orchestrator/snow-orchestrator.js +0 -235
  186. package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
  187. package/dist/orchestrator/subflow-creation-handler.js +0 -791
  188. package/dist/patterns/adaptive-patterns.d.ts +0 -140
  189. package/dist/patterns/adaptive-patterns.js +0 -549
  190. package/dist/queen/advanced-integration-test.d.ts +0 -48
  191. package/dist/queen/advanced-integration-test.js +0 -473
  192. package/dist/queen/integration-example.d.ts +0 -82
  193. package/dist/queen/integration-example.js +0 -219
  194. package/dist/queen/integration-test.d.ts +0 -72
  195. package/dist/queen/integration-test.js +0 -563
  196. package/dist/queen/mock-mcp-client.d.ts +0 -71
  197. package/dist/queen/mock-mcp-client.js +0 -317
  198. package/dist/queen/run-integration-tests.d.ts +0 -9
  199. package/dist/queen/run-integration-tests.js +0 -27
  200. package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
  201. package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
  202. package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
  203. package/dist/sparc/coordinators/team-coordinator.js +0 -402
  204. package/dist/sparc/modes/team-modes.d.ts +0 -33
  205. package/dist/sparc/modes/team-modes.js +0 -399
  206. package/dist/sparc/teams/application-team.d.ts +0 -73
  207. package/dist/sparc/teams/application-team.js +0 -463
  208. package/dist/sparc/teams/flow-team.d.ts +0 -67
  209. package/dist/sparc/teams/flow-team.js +0 -373
  210. package/dist/sparc/teams/widget-team.d.ts +0 -61
  211. package/dist/sparc/teams/widget-team.js +0 -280
  212. package/dist/specialists/app-specialists.d.ts +0 -93
  213. package/dist/specialists/app-specialists.js +0 -1639
  214. package/dist/specialists/base-specialist.d.ts +0 -19
  215. package/dist/specialists/base-specialist.js +0 -54
  216. package/dist/specialists/flow-specialists.d.ts +0 -113
  217. package/dist/specialists/flow-specialists.js +0 -1787
  218. package/dist/specialists/individual-specialists.d.ts +0 -67
  219. package/dist/specialists/individual-specialists.js +0 -632
  220. package/dist/specialists/widget-specialists.d.ts +0 -70
  221. package/dist/specialists/widget-specialists.js +0 -1264
  222. package/dist/src/utils/agent-detector.js +0 -655
  223. package/dist/teams/adaptive-team.d.ts +0 -81
  224. package/dist/teams/adaptive-team.js +0 -1153
  225. package/dist/teams/application-team.d.ts +0 -30
  226. package/dist/teams/application-team.js +0 -547
  227. package/dist/teams/base-team.d.ts +0 -55
  228. package/dist/teams/base-team.js +0 -243
  229. package/dist/teams/flow-team.d.ts +0 -28
  230. package/dist/teams/flow-team.js +0 -525
  231. package/dist/teams/widget-team.d.ts +0 -26
  232. package/dist/teams/widget-team.js +0 -459
  233. package/dist/templates/flow-template-system.js +0 -625
  234. package/dist/test-fetch-incidents.d.ts +0 -2
  235. package/dist/test-fetch-incidents.js +0 -84
  236. package/dist/test-incident-access.d.ts +0 -2
  237. package/dist/test-incident-access.js +0 -72
  238. package/dist/test-iphone-flow.js +0 -189
  239. package/dist/test-limit-problem.d.ts +0 -2
  240. package/dist/test-limit-problem.js +0 -60
  241. package/dist/test-ml-batch-fix.d.ts +0 -2
  242. package/dist/test-ml-batch-fix.js +0 -104
  243. package/dist/test-ml-batch.d.ts +0 -2
  244. package/dist/test-ml-batch.js +0 -87
  245. package/dist/test-ml-query.d.ts +0 -2
  246. package/dist/test-ml-query.js +0 -100
  247. package/dist/test-ml-training-fix.d.ts +0 -12
  248. package/dist/test-ml-training-fix.js +0 -113
  249. package/dist/test-ml-training.d.ts +0 -2
  250. package/dist/test-ml-training.js +0 -32
  251. package/dist/test-operations-query.d.ts +0 -2
  252. package/dist/test-operations-query.js +0 -84
  253. package/dist/test-performance-query.d.ts +0 -2
  254. package/dist/test-performance-query.js +0 -52
  255. package/dist/test-singleton-protection.d.ts +0 -8
  256. package/dist/test-singleton-protection.js +0 -110
  257. package/dist/test-smart-limits.d.ts +0 -13
  258. package/dist/test-smart-limits.js +0 -100
  259. package/dist/test-snow-query-incidents.d.ts +0 -2
  260. package/dist/test-snow-query-incidents.js +0 -66
  261. package/dist/test-universal-query.d.ts +0 -2
  262. package/dist/test-universal-query.js +0 -106
  263. package/dist/testing/flow-testing-automation.js +0 -641
  264. package/dist/utils/complete-flow-xml-generator.js +0 -1285
  265. package/dist/utils/file-storage-fallback.d.ts +0 -62
  266. package/dist/utils/file-storage-fallback.js +0 -289
  267. package/dist/utils/flow-api-discovery.d.ts +0 -151
  268. package/dist/utils/flow-api-discovery.js +0 -439
  269. package/dist/utils/flow-examples.js +0 -720
  270. package/dist/utils/flow-structure-builder.js +0 -677
  271. package/dist/utils/flow-xml-generator.d.ts +0 -41
  272. package/dist/utils/flow-xml-generator.js +0 -258
  273. package/dist/utils/improved-flow-xml-generator.js +0 -820
  274. package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
  275. package/dist/utils/mcp-process-manager.backup.js +0 -220
  276. package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
  277. package/dist/utils/mcp-singleton-enforcer.js +0 -201
  278. package/dist/utils/mcp-timeout-fix.d.ts +0 -53
  279. package/dist/utils/mcp-timeout-fix.js +0 -221
  280. package/dist/utils/migrate-claude-flow.d.ts +0 -22
  281. package/dist/utils/migrate-claude-flow.js +0 -120
  282. package/dist/utils/scope-utils.d.ts +0 -72
  283. package/dist/utils/scope-utils.js +0 -386
  284. package/dist/utils/snow-oauth-old.d.ts +0 -65
  285. package/dist/utils/snow-oauth-old.js +0 -345
  286. package/dist/utils/xml-first-flow-generator.js +0 -513
  287. package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
  288. package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
  289. package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
  290. package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
  291. package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
  292. package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
  293. package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
  294. package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
  295. package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
  296. package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
  297. package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
  298. package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
  299. package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
  300. package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
  301. package/reports/swarm-auto-centralized-1752649029776.json +0 -13
  302. package/src/memory/README.md +0 -240
@@ -1,550 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TeamCoordinator = void 0;
4
- const widget_team_js_1 = require("../teams/widget-team.js");
5
- const flow_team_js_1 = require("../teams/flow-team.js");
6
- const application_team_js_1 = require("../teams/application-team.js");
7
- const adaptive_team_js_1 = require("../teams/adaptive-team.js");
8
- const individual_specialists_js_1 = require("../specialists/individual-specialists.js");
9
- class TeamCoordinator {
10
- constructor(options = {}) {
11
- this.taskHistory = new Map();
12
- this.performanceMetrics = new Map();
13
- this.options = {
14
- sharedMemory: true,
15
- validation: true,
16
- parallel: false,
17
- monitor: false,
18
- preferTeams: false,
19
- qualityLevel: 'standard',
20
- ...options
21
- };
22
- }
23
- async coordinate(task) {
24
- console.log(`\n🎯 Team Coordinator: Analyzing task coordination strategy`);
25
- console.log(`📝 Task: ${task}`);
26
- const startTime = Date.now();
27
- // Analyze the task to determine optimal approach
28
- const analysis = await this.analyzeTask(task);
29
- this.logAnalysis(analysis);
30
- // Store analysis for learning
31
- this.taskHistory.set(task, analysis);
32
- // Execute using the recommended approach
33
- let result;
34
- let executor;
35
- switch (analysis.recommendedApproach) {
36
- case 'individual':
37
- const specialist = this.selectIndividualSpecialist(task, analysis);
38
- executor = `Individual ${specialist.name}`;
39
- result = await this.executeWithIndividualSpecialist(specialist, task);
40
- break;
41
- case 'team':
42
- const team = this.selectSpecializedTeam(task, analysis);
43
- executor = team.constructor.name;
44
- result = await team.execute(task);
45
- break;
46
- case 'adaptive':
47
- const adaptiveTeam = new adaptive_team_js_1.AdaptiveTeam(this.options);
48
- executor = 'Adaptive Team';
49
- result = await adaptiveTeam.execute(task);
50
- break;
51
- default:
52
- throw new Error(`Unknown approach: ${analysis.recommendedApproach}`);
53
- }
54
- const executionTime = Date.now() - startTime;
55
- // Calculate quality metrics
56
- const qualityMetrics = await this.calculateExecutionQuality(result, analysis, executionTime);
57
- // Generate recommendations for future tasks
58
- const recommendations = this.generateRecommendations(analysis, result, qualityMetrics);
59
- // Store performance metrics
60
- this.updatePerformanceMetrics(analysis.recommendedApproach, executionTime, qualityMetrics);
61
- console.log(`\n✅ Coordination completed successfully`);
62
- console.log(` Approach: ${analysis.recommendedApproach}`);
63
- console.log(` Executor: ${executor}`);
64
- console.log(` Execution Time: ${executionTime}ms`);
65
- console.log(` Quality Score: ${qualityMetrics.overallScore}/100`);
66
- return {
67
- approach: analysis.recommendedApproach,
68
- executor,
69
- result,
70
- executionTime,
71
- qualityMetrics,
72
- recommendations
73
- };
74
- }
75
- async analyzeTask(task) {
76
- const domain = this.identifyDomain(task);
77
- const complexity = this.assessComplexity(task);
78
- const scope = this.assessScope(task);
79
- const timeEstimate = this.estimateTime(task, complexity, scope);
80
- // Determine recommended approach
81
- const approachAnalysis = this.determineOptimalApproach(task, complexity, scope, domain);
82
- return {
83
- domain,
84
- complexity,
85
- scope,
86
- timeEstimate,
87
- recommendedApproach: approachAnalysis.approach,
88
- confidence: approachAnalysis.confidence,
89
- reasoning: approachAnalysis.reasoning
90
- };
91
- }
92
- identifyDomain(task) {
93
- const lowerTask = task.toLowerCase();
94
- // Widget domain indicators
95
- if (lowerTask.includes('widget') ||
96
- (lowerTask.includes('ui') && !lowerTask.includes('flow')) ||
97
- lowerTask.includes('service portal') ||
98
- lowerTask.includes('dashboard widget')) {
99
- return 'widget';
100
- }
101
- // Flow domain indicators
102
- if (lowerTask.includes('flow') ||
103
- lowerTask.includes('workflow') ||
104
- lowerTask.includes('process') ||
105
- lowerTask.includes('automation') ||
106
- lowerTask.includes('approval')) {
107
- return 'flow';
108
- }
109
- // Application domain indicators
110
- if (lowerTask.includes('application') ||
111
- lowerTask.includes('app') ||
112
- lowerTask.includes('table') ||
113
- lowerTask.includes('database') ||
114
- lowerTask.includes('business rule') ||
115
- lowerTask.includes('script include')) {
116
- return 'application';
117
- }
118
- // Individual specialist domains
119
- if (lowerTask.includes('frontend') || lowerTask.includes('html') || lowerTask.includes('css')) {
120
- return 'frontend';
121
- }
122
- if (lowerTask.includes('backend') || lowerTask.includes('server script') || lowerTask.includes('api')) {
123
- return 'backend';
124
- }
125
- if (lowerTask.includes('security') || lowerTask.includes('access control') || lowerTask.includes('compliance')) {
126
- return 'security';
127
- }
128
- if (lowerTask.includes('data') || lowerTask.includes('query') || lowerTask.includes('analysis')) {
129
- return 'data';
130
- }
131
- if (lowerTask.includes('integration') || lowerTask.includes('sync') || lowerTask.includes('external')) {
132
- return 'integration';
133
- }
134
- return 'general';
135
- }
136
- assessComplexity(task) {
137
- const lowerTask = task.toLowerCase();
138
- let complexityScore = 0;
139
- // Simple indicators
140
- if (lowerTask.includes('simple') || lowerTask.includes('basic') || lowerTask.includes('quick')) {
141
- complexityScore -= 2;
142
- }
143
- // Complex indicators
144
- if (lowerTask.includes('complex') || lowerTask.includes('advanced') || lowerTask.includes('enterprise')) {
145
- complexityScore += 3;
146
- }
147
- // Multiple component indicators
148
- const components = ['ui', 'backend', 'database', 'integration', 'security', 'workflow'];
149
- const componentCount = components.filter(comp => lowerTask.includes(comp)).length;
150
- complexityScore += componentCount;
151
- // Integration complexity
152
- if (lowerTask.includes('integration') || lowerTask.includes('api') || lowerTask.includes('external')) {
153
- complexityScore += 2;
154
- }
155
- // Multiple systems/technologies
156
- const technologies = ['rest', 'soap', 'ldap', 'oauth', 'saml', 'json', 'xml'];
157
- const techCount = technologies.filter(tech => lowerTask.includes(tech)).length;
158
- complexityScore += techCount;
159
- // Task length as complexity indicator
160
- if (task.length > 200)
161
- complexityScore += 2;
162
- else if (task.length > 100)
163
- complexityScore += 1;
164
- if (complexityScore >= 5)
165
- return 'complex';
166
- if (complexityScore >= 2)
167
- return 'moderate';
168
- return 'simple';
169
- }
170
- assessScope(task) {
171
- const lowerTask = task.toLowerCase();
172
- let scopeScore = 0;
173
- // Focused indicators
174
- if (lowerTask.includes('specific') || lowerTask.includes('single') || lowerTask.includes('one')) {
175
- scopeScore -= 1;
176
- }
177
- // Broad indicators
178
- if (lowerTask.includes('complete') || lowerTask.includes('full') || lowerTask.includes('entire')) {
179
- scopeScore += 2;
180
- }
181
- if (lowerTask.includes('multiple') || lowerTask.includes('several') || lowerTask.includes('various')) {
182
- scopeScore += 2;
183
- }
184
- // Count action words (indicates broader scope)
185
- const actions = ['create', 'update', 'delete', 'manage', 'configure', 'implement', 'design'];
186
- const actionCount = actions.filter(action => lowerTask.includes(action)).length;
187
- scopeScore += actionCount - 1; // First action is expected, additional ones increase scope
188
- if (scopeScore >= 3)
189
- return 'broad';
190
- if (scopeScore >= 1)
191
- return 'medium';
192
- return 'focused';
193
- }
194
- estimateTime(task, complexity, scope) {
195
- const baseTime = {
196
- 'simple': { 'focused': 15, 'medium': 30, 'broad': 60 },
197
- 'moderate': { 'focused': 45, 'medium': 90, 'broad': 180 },
198
- 'complex': { 'focused': 90, 'medium': 180, 'broad': 360 }
199
- };
200
- let minutes = baseTime[complexity][scope];
201
- // Adjust for domain-specific factors
202
- const lowerTask = task.toLowerCase();
203
- if (lowerTask.includes('integration') || lowerTask.includes('migration')) {
204
- minutes *= 1.5;
205
- }
206
- if (lowerTask.includes('security') || lowerTask.includes('compliance')) {
207
- minutes *= 1.3;
208
- }
209
- if (lowerTask.includes('performance') || lowerTask.includes('optimization')) {
210
- minutes *= 1.2;
211
- }
212
- minutes = Math.round(minutes);
213
- if (minutes < 60) {
214
- return `${minutes} minutes`;
215
- }
216
- else {
217
- const hours = Math.floor(minutes / 60);
218
- const remainingMinutes = minutes % 60;
219
- return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
220
- }
221
- }
222
- determineOptimalApproach(task, complexity, scope, domain) {
223
- const reasoning = [];
224
- let confidence = 80; // Base confidence
225
- // Individual specialist approach
226
- if (this.shouldUseIndividualSpecialist(task, complexity, scope, domain)) {
227
- reasoning.push(`Task is focused on ${domain} specialty`);
228
- reasoning.push(`Complexity (${complexity}) and scope (${scope}) suitable for individual work`);
229
- if (complexity === 'simple' && scope === 'focused')
230
- confidence += 15;
231
- return {
232
- approach: 'individual',
233
- confidence: Math.min(confidence, 95),
234
- reasoning
235
- };
236
- }
237
- // Specialized team approach
238
- if (this.shouldUseSpecializedTeam(domain, complexity, scope)) {
239
- reasoning.push(`Task clearly fits ${domain} development pattern`);
240
- reasoning.push(`Complexity (${complexity}) benefits from specialized team collaboration`);
241
- if (['widget', 'flow', 'application'].includes(domain))
242
- confidence += 10;
243
- if (complexity === 'moderate' || complexity === 'complex')
244
- confidence += 5;
245
- return {
246
- approach: 'team',
247
- confidence: Math.min(confidence, 90),
248
- reasoning
249
- };
250
- }
251
- // Adaptive team approach (fallback for unclear/complex cases)
252
- reasoning.push(`Task doesn't clearly fit standard patterns`);
253
- reasoning.push(`Using adaptive team for optimal specialist selection`);
254
- if (domain === 'general')
255
- reasoning.push('Domain is unclear, adaptive analysis will determine needs');
256
- if (complexity === 'complex')
257
- reasoning.push('High complexity benefits from adaptive specialist assembly');
258
- return {
259
- approach: 'adaptive',
260
- confidence: Math.max(confidence - 10, 60),
261
- reasoning
262
- };
263
- }
264
- shouldUseIndividualSpecialist(task, complexity, scope, domain) {
265
- // Use individual specialist for simple, focused tasks in specific domains
266
- if (complexity === 'simple' && scope === 'focused' &&
267
- ['frontend', 'backend', 'security', 'data', 'integration'].includes(domain)) {
268
- return true;
269
- }
270
- // Use individual for quick tasks regardless of domain
271
- if (complexity === 'simple' && scope === 'focused' &&
272
- this.options.qualityLevel === 'quick') {
273
- return true;
274
- }
275
- // Force individual if configured to avoid teams
276
- if (!this.options.preferTeams && complexity === 'simple') {
277
- return true;
278
- }
279
- return false;
280
- }
281
- shouldUseSpecializedTeam(domain, complexity, scope) {
282
- // Use specialized teams for their core domains
283
- if (['widget', 'flow', 'application'].includes(domain)) {
284
- // For moderate/complex tasks or medium/broad scope
285
- if (complexity !== 'simple' || scope !== 'focused') {
286
- return true;
287
- }
288
- // For simple tasks if teams are preferred
289
- if (this.options.preferTeams) {
290
- return true;
291
- }
292
- }
293
- return false;
294
- }
295
- selectIndividualSpecialist(task, analysis) {
296
- const lowerTask = task.toLowerCase();
297
- // Map domain to specialist
298
- switch (analysis.domain) {
299
- case 'frontend':
300
- return {
301
- name: 'Frontend Specialist',
302
- instance: new individual_specialists_js_1.IndividualSpecialists.Frontend(this.options)
303
- };
304
- case 'backend':
305
- return {
306
- name: 'Backend Specialist',
307
- instance: new individual_specialists_js_1.IndividualSpecialists.Backend(this.options)
308
- };
309
- case 'security':
310
- return {
311
- name: 'Security Specialist',
312
- instance: new individual_specialists_js_1.IndividualSpecialists.Security(this.options)
313
- };
314
- case 'data':
315
- return {
316
- name: 'Data Specialist',
317
- instance: new individual_specialists_js_1.IndividualSpecialists.Data(this.options)
318
- };
319
- case 'integration':
320
- return {
321
- name: 'Integration Specialist',
322
- instance: new individual_specialists_js_1.IndividualSpecialists.Integration(this.options)
323
- };
324
- default:
325
- // For general tasks, pick the most relevant specialist
326
- if (lowerTask.includes('script') || lowerTask.includes('server')) {
327
- return {
328
- name: 'Backend Specialist',
329
- instance: new individual_specialists_js_1.IndividualSpecialists.Backend(this.options)
330
- };
331
- }
332
- else if (lowerTask.includes('ui') || lowerTask.includes('interface')) {
333
- return {
334
- name: 'Frontend Specialist',
335
- instance: new individual_specialists_js_1.IndividualSpecialists.Frontend(this.options)
336
- };
337
- }
338
- else {
339
- return {
340
- name: 'Data Specialist',
341
- instance: new individual_specialists_js_1.IndividualSpecialists.Data(this.options)
342
- };
343
- }
344
- }
345
- }
346
- selectSpecializedTeam(task, analysis) {
347
- switch (analysis.domain) {
348
- case 'widget':
349
- return new widget_team_js_1.WidgetTeam(this.options);
350
- case 'flow':
351
- return new flow_team_js_1.FlowTeam(this.options);
352
- case 'application':
353
- return new application_team_js_1.ApplicationTeam(this.options);
354
- default:
355
- // This shouldn't happen if shouldUseSpecializedTeam logic is correct
356
- throw new Error(`No specialized team available for domain: ${analysis.domain}`);
357
- }
358
- }
359
- async executeWithIndividualSpecialist(specialist, task) {
360
- console.log(`\n👤 Executing with ${specialist.name}...`);
361
- const result = await specialist.instance.execute(task);
362
- return {
363
- executorType: 'individual',
364
- specialist: specialist.name,
365
- result
366
- };
367
- }
368
- logAnalysis(analysis) {
369
- console.log(`\n📊 Task Analysis Results:`);
370
- console.log(` Domain: ${analysis.domain}`);
371
- console.log(` Complexity: ${analysis.complexity}`);
372
- console.log(` Scope: ${analysis.scope}`);
373
- console.log(` Time Estimate: ${analysis.timeEstimate}`);
374
- console.log(` Recommended Approach: ${analysis.recommendedApproach}`);
375
- console.log(` Confidence: ${analysis.confidence}%`);
376
- console.log(` Reasoning:`);
377
- analysis.reasoning.forEach(reason => {
378
- console.log(` • ${reason}`);
379
- });
380
- }
381
- async calculateExecutionQuality(result, analysis, executionTime) {
382
- const qualityFactors = {
383
- completeness: this.assessCompleteness(result),
384
- accuracy: this.assessAccuracy(result, analysis),
385
- efficiency: this.assessEfficiency(executionTime, analysis),
386
- maintainability: this.assessMaintainability(result),
387
- scalability: this.assessScalability(result)
388
- };
389
- const overallScore = Object.values(qualityFactors).reduce((sum, score) => sum + score, 0) / Object.keys(qualityFactors).length;
390
- return {
391
- overallScore: Math.round(overallScore),
392
- factors: qualityFactors,
393
- executionTime,
394
- approach: analysis.recommendedApproach
395
- };
396
- }
397
- assessCompleteness(result) {
398
- if (!result || !result.result)
399
- return 0;
400
- // Check if result has expected structure
401
- const hasDeliverables = result.result.deliverables || result.result.components || result.result.dataAnalysis;
402
- const hasSpecialist = result.result.specialist;
403
- if (hasDeliverables && hasSpecialist)
404
- return 90;
405
- if (hasDeliverables || hasSpecialist)
406
- return 70;
407
- return 50;
408
- }
409
- assessAccuracy(result, analysis) {
410
- // Simplified accuracy assessment based on result structure
411
- if (!result || !result.result)
412
- return 0;
413
- let accuracy = 80; // Base accuracy
414
- // Check if result matches expected domain
415
- if (result.result.specialist && analysis.domain !== 'general') {
416
- const specialistDomain = result.result.specialist.toLowerCase();
417
- if (specialistDomain.includes(analysis.domain) || analysis.domain.includes(specialistDomain.split(' ')[0])) {
418
- accuracy += 15;
419
- }
420
- }
421
- // Check for error indicators
422
- if (result.result.error || result.result.errors) {
423
- accuracy -= 20;
424
- }
425
- return Math.max(Math.min(accuracy, 100), 0);
426
- }
427
- assessEfficiency(executionTime, analysis) {
428
- // Convert time estimate to milliseconds for comparison
429
- const estimatedMs = this.parseTimeToMs(analysis.timeEstimate);
430
- const efficiency = Math.max(0, 100 - ((executionTime - estimatedMs) / estimatedMs) * 50);
431
- return Math.min(efficiency, 100);
432
- }
433
- parseTimeToMs(timeString) {
434
- const hours = timeString.includes('h') ? parseInt(timeString.split('h')[0]) * 3600000 : 0;
435
- const minutes = timeString.includes('minutes') ? parseInt(timeString.split(' ')[0]) * 60000 :
436
- timeString.includes('m') ? parseInt(timeString.match(/(\d+)m/)?.[1] || '0') * 60000 : 0;
437
- return Math.max(hours + minutes, 60000); // Minimum 1 minute
438
- }
439
- assessMaintainability(result) {
440
- // Simplified maintainability assessment
441
- if (!result || !result.result)
442
- return 50;
443
- let score = 70; // Base score
444
- // Check for documentation/structure
445
- if (result.result.requirements || result.result.analysis)
446
- score += 15;
447
- if (result.result.recommendations)
448
- score += 10;
449
- if (result.result.quickImplementation)
450
- score -= 5; // Quick implementations are less maintainable
451
- return Math.min(score, 100);
452
- }
453
- assessScalability(result) {
454
- // Simplified scalability assessment
455
- if (!result || !result.result)
456
- return 50;
457
- let score = 75; // Base score
458
- // Team results generally more scalable
459
- if (result.executorType !== 'individual')
460
- score += 15;
461
- if (result.result.qualityMetrics)
462
- score += 10;
463
- return Math.min(score, 100);
464
- }
465
- generateRecommendations(analysis, result, qualityMetrics) {
466
- const recommendations = [];
467
- // Performance recommendations
468
- if (qualityMetrics.factors.efficiency < 80) {
469
- recommendations.push('Consider optimizing execution approach for better performance');
470
- }
471
- // Quality recommendations
472
- if (qualityMetrics.overallScore < 85) {
473
- recommendations.push('Review task analysis accuracy for better specialist selection');
474
- }
475
- // Approach recommendations
476
- if (analysis.confidence < 80) {
477
- recommendations.push('Task pattern unclear - consider providing more specific requirements');
478
- }
479
- // Domain-specific recommendations
480
- if (analysis.domain === 'general') {
481
- recommendations.push('Consider specifying domain context for better specialist matching');
482
- }
483
- return recommendations;
484
- }
485
- updatePerformanceMetrics(approach, executionTime, qualityMetrics) {
486
- const current = this.performanceMetrics.get(approach) || {
487
- totalExecutions: 0,
488
- totalTime: 0,
489
- totalQuality: 0,
490
- averageTime: 0,
491
- averageQuality: 0
492
- };
493
- current.totalExecutions++;
494
- current.totalTime += executionTime;
495
- current.totalQuality += qualityMetrics.overallScore;
496
- current.averageTime = current.totalTime / current.totalExecutions;
497
- current.averageQuality = current.totalQuality / current.totalExecutions;
498
- this.performanceMetrics.set(approach, current);
499
- }
500
- // Public methods for accessing coordinator state and metrics
501
- getTaskHistory() {
502
- return this.taskHistory;
503
- }
504
- getPerformanceMetrics() {
505
- return this.performanceMetrics;
506
- }
507
- getCoordinatorInsights() {
508
- const approaches = Array.from(this.performanceMetrics.keys());
509
- const totalTasks = Array.from(this.taskHistory.values()).length;
510
- return {
511
- totalTasksCoordinated: totalTasks,
512
- approachesUsed: approaches,
513
- performanceByApproach: Object.fromEntries(this.performanceMetrics),
514
- mostUsedApproach: this.getMostUsedApproach(),
515
- averageConfidence: this.getAverageConfidence(),
516
- recommendations: this.getCoordinatorRecommendations()
517
- };
518
- }
519
- getMostUsedApproach() {
520
- let maxCount = 0;
521
- let mostUsed = 'none';
522
- this.performanceMetrics.forEach((metrics, approach) => {
523
- if (metrics.totalExecutions > maxCount) {
524
- maxCount = metrics.totalExecutions;
525
- mostUsed = approach;
526
- }
527
- });
528
- return mostUsed;
529
- }
530
- getAverageConfidence() {
531
- const analyses = Array.from(this.taskHistory.values());
532
- if (analyses.length === 0)
533
- return 0;
534
- const totalConfidence = analyses.reduce((sum, analysis) => sum + analysis.confidence, 0);
535
- return Math.round(totalConfidence / analyses.length);
536
- }
537
- getCoordinatorRecommendations() {
538
- const recommendations = [];
539
- const insights = this.getCoordinatorInsights();
540
- if (insights.averageConfidence < 75) {
541
- recommendations.push('Tasks often have unclear requirements - encourage more specific task descriptions');
542
- }
543
- if (insights.totalTasksCoordinated > 10) {
544
- recommendations.push('Consider implementing task pattern caching for frequently similar tasks');
545
- }
546
- return recommendations;
547
- }
548
- }
549
- exports.TeamCoordinator = TeamCoordinator;
550
- //# sourceMappingURL=team-coordinator.js.map