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,1787 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SecuritySpecialist = exports.IntegrationSpecialist = exports.DataSpecialist = exports.TriggerSpecialist = exports.ProcessSpecialist = void 0;
4
- const base_specialist_js_1 = require("./base-specialist.js");
5
- class ProcessSpecialist extends base_specialist_js_1.BaseSpecialist {
6
- constructor(options = {}) {
7
- super('Process Designer', 'Process Designer', ['Business Logic', 'Workflow Design', 'Process Optimization', 'Flow Architecture'], options);
8
- }
9
- async execute(task, context) {
10
- await this.logProgress(`Analyzing process requirements for: ${task}`);
11
- const analysis = await this.analyzeTask(task);
12
- const processRequirements = {
13
- flowType: this.identifyFlowType(task),
14
- businessLogic: this.analyzeBusinessLogic(task),
15
- processSteps: this.identifyProcessSteps(task),
16
- decisionPoints: this.identifyDecisionPoints(task),
17
- approvals: this.analyzeApprovalRequirements(task),
18
- automation: this.analyzeAutomationOpportunities(task)
19
- };
20
- await this.logProgress('Designing process flow architecture');
21
- const flowArchitecture = await this.designFlowArchitecture(processRequirements);
22
- await this.logProgress('Creating process flow definition');
23
- const flowDefinition = await this.createFlowDefinition(processRequirements);
24
- return {
25
- ...analysis,
26
- specialist: 'Process Designer',
27
- deliverables: {
28
- flowArchitecture,
29
- flowDefinition,
30
- requirements: processRequirements
31
- }
32
- };
33
- }
34
- identifyFlowType(task) {
35
- const lowerTask = task.toLowerCase();
36
- if (lowerTask.includes('approval')) {
37
- return 'approval_workflow';
38
- }
39
- else if (lowerTask.includes('fulfillment') || lowerTask.includes('provision')) {
40
- return 'fulfillment_workflow';
41
- }
42
- else if (lowerTask.includes('notification') || lowerTask.includes('alert')) {
43
- return 'notification_workflow';
44
- }
45
- else if (lowerTask.includes('integration') || lowerTask.includes('sync')) {
46
- return 'integration_workflow';
47
- }
48
- else if (lowerTask.includes('escalation')) {
49
- return 'escalation_workflow';
50
- }
51
- return 'utility_workflow';
52
- }
53
- analyzeBusinessLogic(task) {
54
- const lowerTask = task.toLowerCase();
55
- const businessRules = [];
56
- if (lowerTask.includes('priority')) {
57
- businessRules.push({
58
- name: 'Priority Based Routing',
59
- condition: 'priority_level',
60
- action: 'route_based_on_priority'
61
- });
62
- }
63
- if (lowerTask.includes('approval')) {
64
- businessRules.push({
65
- name: 'Approval Logic',
66
- condition: 'approval_criteria',
67
- action: 'send_for_approval'
68
- });
69
- }
70
- if (lowerTask.includes('sla') || lowerTask.includes('deadline')) {
71
- businessRules.push({
72
- name: 'SLA Management',
73
- condition: 'time_constraints',
74
- action: 'track_sla_compliance'
75
- });
76
- }
77
- return {
78
- rules: businessRules,
79
- complexity: businessRules.length > 3 ? 'complex' : businessRules.length > 1 ? 'moderate' : 'simple'
80
- };
81
- }
82
- identifyProcessSteps(task) {
83
- const steps = [];
84
- const lowerTask = task.toLowerCase();
85
- // Common starting step
86
- steps.push({
87
- id: 'start',
88
- name: 'Process Start',
89
- type: 'start',
90
- description: 'Initialize the workflow process'
91
- });
92
- if (lowerTask.includes('validation') || lowerTask.includes('validate')) {
93
- steps.push({
94
- id: 'validation',
95
- name: 'Input Validation',
96
- type: 'script',
97
- description: 'Validate input data and requirements'
98
- });
99
- }
100
- if (lowerTask.includes('approval')) {
101
- steps.push({
102
- id: 'approval_request',
103
- name: 'Send for Approval',
104
- type: 'approval',
105
- description: 'Request approval from designated approvers'
106
- });
107
- }
108
- if (lowerTask.includes('notification') || lowerTask.includes('email')) {
109
- steps.push({
110
- id: 'notification',
111
- name: 'Send Notification',
112
- type: 'notification',
113
- description: 'Send notification to relevant parties'
114
- });
115
- }
116
- if (lowerTask.includes('create') || lowerTask.includes('provision')) {
117
- steps.push({
118
- id: 'provisioning',
119
- name: 'Resource Provisioning',
120
- type: 'script',
121
- description: 'Create or provision requested resources'
122
- });
123
- }
124
- if (lowerTask.includes('integration') || lowerTask.includes('api')) {
125
- steps.push({
126
- id: 'integration',
127
- name: 'External Integration',
128
- type: 'rest',
129
- description: 'Integrate with external systems'
130
- });
131
- }
132
- // Common ending step
133
- steps.push({
134
- id: 'end',
135
- name: 'Process Complete',
136
- type: 'end',
137
- description: 'Mark process as completed'
138
- });
139
- return steps;
140
- }
141
- identifyDecisionPoints(task) {
142
- const decisions = [];
143
- const lowerTask = task.toLowerCase();
144
- if (lowerTask.includes('approval')) {
145
- decisions.push({
146
- id: 'approval_decision',
147
- name: 'Approval Decision',
148
- condition: 'approval_status',
149
- branches: [
150
- { condition: 'approved', action: 'continue_process' },
151
- { condition: 'rejected', action: 'reject_request' },
152
- { condition: 'pending', action: 'wait_for_approval' }
153
- ]
154
- });
155
- }
156
- if (lowerTask.includes('priority') || lowerTask.includes('urgency')) {
157
- decisions.push({
158
- id: 'priority_routing',
159
- name: 'Priority Based Routing',
160
- condition: 'priority_level',
161
- branches: [
162
- { condition: 'high', action: 'expedite_process' },
163
- { condition: 'medium', action: 'standard_process' },
164
- { condition: 'low', action: 'delayed_process' }
165
- ]
166
- });
167
- }
168
- if (lowerTask.includes('error') || lowerTask.includes('exception')) {
169
- decisions.push({
170
- id: 'error_handling',
171
- name: 'Error Handling',
172
- condition: 'error_status',
173
- branches: [
174
- { condition: 'retry', action: 'retry_operation' },
175
- { condition: 'escalate', action: 'escalate_to_admin' },
176
- { condition: 'abort', action: 'terminate_process' }
177
- ]
178
- });
179
- }
180
- return decisions;
181
- }
182
- analyzeApprovalRequirements(task) {
183
- const lowerTask = task.toLowerCase();
184
- if (!lowerTask.includes('approval')) {
185
- return { required: false };
186
- }
187
- return {
188
- required: true,
189
- type: lowerTask.includes('multi') ? 'multi_stage' : 'single_stage',
190
- approvers: this.identifyApprovers(task),
191
- criteria: this.identifyApprovalCriteria(task),
192
- escalation: lowerTask.includes('escalation') || lowerTask.includes('deadline')
193
- };
194
- }
195
- identifyApprovers(task) {
196
- const approvers = [];
197
- const lowerTask = task.toLowerCase();
198
- if (lowerTask.includes('manager')) {
199
- approvers.push('manager');
200
- }
201
- if (lowerTask.includes('director')) {
202
- approvers.push('director');
203
- }
204
- if (lowerTask.includes('admin')) {
205
- approvers.push('system_administrator');
206
- }
207
- if (lowerTask.includes('security')) {
208
- approvers.push('security_team');
209
- }
210
- return approvers.length > 0 ? approvers : ['default_approver'];
211
- }
212
- identifyApprovalCriteria(task) {
213
- const lowerTask = task.toLowerCase();
214
- return {
215
- automaticApproval: lowerTask.includes('automatic'),
216
- amountThreshold: lowerTask.includes('amount') || lowerTask.includes('cost'),
217
- riskAssessment: lowerTask.includes('risk') || lowerTask.includes('security'),
218
- timeConstraints: lowerTask.includes('urgent') || lowerTask.includes('deadline')
219
- };
220
- }
221
- analyzeAutomationOpportunities(task) {
222
- const opportunities = [];
223
- const lowerTask = task.toLowerCase();
224
- if (lowerTask.includes('email') || lowerTask.includes('notification')) {
225
- opportunities.push('automated_notifications');
226
- }
227
- if (lowerTask.includes('create') || lowerTask.includes('provision')) {
228
- opportunities.push('automated_provisioning');
229
- }
230
- if (lowerTask.includes('update') || lowerTask.includes('modify')) {
231
- opportunities.push('automated_updates');
232
- }
233
- if (lowerTask.includes('validation') || lowerTask.includes('check')) {
234
- opportunities.push('automated_validation');
235
- }
236
- return {
237
- level: opportunities.length > 2 ? 'high' : opportunities.length > 0 ? 'medium' : 'low',
238
- opportunities
239
- };
240
- }
241
- async designFlowArchitecture(requirements) {
242
- return {
243
- flowType: requirements.flowType,
244
- architecture: {
245
- pattern: this.selectArchitecturePattern(requirements),
246
- components: this.identifyRequiredComponents(requirements),
247
- integrations: this.identifyIntegrationPoints(requirements)
248
- },
249
- scalability: this.assessScalabilityNeeds(requirements),
250
- performance: this.assessPerformanceRequirements(requirements)
251
- };
252
- }
253
- selectArchitecturePattern(requirements) {
254
- if (requirements.businessLogic.complexity === 'complex') {
255
- return 'layered_architecture';
256
- }
257
- else if (requirements.approvals.required && requirements.approvals.type === 'multi_stage') {
258
- return 'pipeline_architecture';
259
- }
260
- else if (requirements.automation.level === 'high') {
261
- return 'event_driven_architecture';
262
- }
263
- return 'linear_architecture';
264
- }
265
- identifyRequiredComponents(requirements) {
266
- const components = ['flow_logic'];
267
- if (requirements.approvals.required) {
268
- components.push('approval_engine');
269
- }
270
- if (requirements.automation.opportunities.includes('automated_notifications')) {
271
- components.push('notification_service');
272
- }
273
- if (requirements.automation.opportunities.includes('automated_provisioning')) {
274
- components.push('provisioning_engine');
275
- }
276
- return components;
277
- }
278
- identifyIntegrationPoints(requirements) {
279
- const integrations = [];
280
- if (requirements.approvals.required) {
281
- integrations.push('approval_system');
282
- }
283
- if (requirements.automation.opportunities.includes('automated_notifications')) {
284
- integrations.push('email_system');
285
- }
286
- return integrations;
287
- }
288
- assessScalabilityNeeds(requirements) {
289
- return {
290
- expectedVolume: requirements.businessLogic.complexity === 'complex' ? 'high' : 'medium',
291
- concurrency: requirements.automation.level === 'high' ? 'high' : 'medium',
292
- growthProjection: 'moderate'
293
- };
294
- }
295
- assessPerformanceRequirements(requirements) {
296
- return {
297
- responseTime: requirements.flowType.includes('approval') ? 'fast' : 'standard',
298
- throughput: requirements.automation.level === 'high' ? 'high' : 'medium',
299
- reliability: 'high'
300
- };
301
- }
302
- async createFlowDefinition(requirements) {
303
- const flowDefinition = {
304
- flow: {
305
- name: this.generateFlowName(requirements),
306
- description: this.generateFlowDescription(requirements),
307
- trigger: this.createTriggerDefinition(requirements),
308
- steps: this.createStepDefinitions(requirements),
309
- variables: this.createVariableDefinitions(requirements)
310
- }
311
- };
312
- return flowDefinition;
313
- }
314
- generateFlowName(requirements) {
315
- const typeMap = {
316
- 'approval_workflow': 'Approval Process',
317
- 'fulfillment_workflow': 'Fulfillment Process',
318
- 'notification_workflow': 'Notification Process',
319
- 'integration_workflow': 'Integration Process',
320
- 'escalation_workflow': 'Escalation Process',
321
- 'utility_workflow': 'Utility Process'
322
- };
323
- return typeMap[requirements.flowType] || 'Custom Process';
324
- }
325
- generateFlowDescription(requirements) {
326
- return `Automated ${requirements.flowType.replace('_', ' ')} with ${requirements.businessLogic.complexity} business logic`;
327
- }
328
- createTriggerDefinition(requirements) {
329
- if (requirements.flowType === 'approval_workflow') {
330
- return {
331
- type: 'record_created',
332
- table: 'sc_request',
333
- condition: 'state=1'
334
- };
335
- }
336
- else if (requirements.flowType === 'notification_workflow') {
337
- return {
338
- type: 'record_updated',
339
- table: 'incident',
340
- condition: 'priority=1'
341
- };
342
- }
343
- return {
344
- type: 'manual',
345
- condition: ''
346
- };
347
- }
348
- createStepDefinitions(requirements) {
349
- return requirements.processSteps.map((step, index) => ({
350
- sequence: index + 1,
351
- name: step.name,
352
- type: step.type,
353
- description: step.description,
354
- properties: this.createStepProperties(step, requirements)
355
- }));
356
- }
357
- createStepProperties(step, requirements) {
358
- const properties = {};
359
- if (step.type === 'approval') {
360
- properties.approvers = requirements.approvals.approvers;
361
- properties.approval_criteria = requirements.approvals.criteria;
362
- }
363
- else if (step.type === 'notification') {
364
- properties.recipients = ['${trigger.requested_for}', '${trigger.opened_by}'];
365
- properties.message_template = 'Default notification message';
366
- }
367
- else if (step.type === 'script') {
368
- properties.script_type = 'inline';
369
- properties.script_content = '// Auto-generated script placeholder';
370
- }
371
- return properties;
372
- }
373
- createVariableDefinitions(requirements) {
374
- const variables = [
375
- {
376
- name: 'process_status',
377
- type: 'string',
378
- default_value: 'pending'
379
- },
380
- {
381
- name: 'created_timestamp',
382
- type: 'datetime',
383
- default_value: 'now'
384
- }
385
- ];
386
- if (requirements.approvals.required) {
387
- variables.push({
388
- name: 'approval_status',
389
- type: 'string',
390
- default_value: 'pending'
391
- });
392
- }
393
- return variables;
394
- }
395
- }
396
- exports.ProcessSpecialist = ProcessSpecialist;
397
- class TriggerSpecialist extends base_specialist_js_1.BaseSpecialist {
398
- constructor(options = {}) {
399
- super('Trigger Specialist', 'Trigger Specialist', ['Event Handling', 'Conditions', 'Automation', 'Real-time Processing'], options);
400
- }
401
- async execute(task, context) {
402
- await this.logProgress(`Analyzing trigger requirements for: ${task}`);
403
- const analysis = await this.analyzeTask(task);
404
- const triggerRequirements = {
405
- eventTypes: this.identifyEventTypes(task),
406
- conditions: this.analyzeTriggerConditions(task),
407
- timing: this.analyzeTriggerTiming(task),
408
- filters: this.identifyTriggerFilters(task),
409
- performance: this.analyzeTriggerPerformance(task)
410
- };
411
- await this.logProgress('Designing trigger mechanisms');
412
- const triggerDesign = await this.createTriggerDesign(triggerRequirements);
413
- await this.logProgress('Creating trigger configurations');
414
- const triggerConfig = await this.createTriggerConfiguration(triggerRequirements);
415
- return {
416
- ...analysis,
417
- specialist: 'Trigger Specialist',
418
- deliverables: {
419
- triggerDesign,
420
- triggerConfig,
421
- requirements: triggerRequirements
422
- }
423
- };
424
- }
425
- identifyEventTypes(task) {
426
- const events = [];
427
- const lowerTask = task.toLowerCase();
428
- if (lowerTask.includes('create') || lowerTask.includes('new')) {
429
- events.push('record_created');
430
- }
431
- if (lowerTask.includes('update') || lowerTask.includes('change') || lowerTask.includes('modify')) {
432
- events.push('record_updated');
433
- }
434
- if (lowerTask.includes('delete') || lowerTask.includes('remove')) {
435
- events.push('record_deleted');
436
- }
437
- if (lowerTask.includes('schedule') || lowerTask.includes('time') || lowerTask.includes('daily')) {
438
- events.push('scheduled');
439
- }
440
- if (lowerTask.includes('manual') || lowerTask.includes('button') || lowerTask.includes('click')) {
441
- events.push('manual');
442
- }
443
- if (lowerTask.includes('api') || lowerTask.includes('webhook')) {
444
- events.push('webhook');
445
- }
446
- return events.length > 0 ? events : ['manual'];
447
- }
448
- analyzeTriggerConditions(task) {
449
- const conditions = [];
450
- const lowerTask = task.toLowerCase();
451
- if (lowerTask.includes('priority')) {
452
- conditions.push({
453
- field: 'priority',
454
- operator: 'equals',
455
- value: '1'
456
- });
457
- }
458
- if (lowerTask.includes('state')) {
459
- conditions.push({
460
- field: 'state',
461
- operator: 'equals',
462
- value: 'new'
463
- });
464
- }
465
- if (lowerTask.includes('category')) {
466
- conditions.push({
467
- field: 'category',
468
- operator: 'equals',
469
- value: 'hardware'
470
- });
471
- }
472
- if (lowerTask.includes('user') || lowerTask.includes('assigned')) {
473
- conditions.push({
474
- field: 'assigned_to',
475
- operator: 'is_not_empty',
476
- value: ''
477
- });
478
- }
479
- return {
480
- logic: conditions.length > 1 ? 'AND' : 'SINGLE',
481
- conditions: conditions
482
- };
483
- }
484
- analyzeTriggerTiming(task) {
485
- const lowerTask = task.toLowerCase();
486
- if (lowerTask.includes('immediate') || lowerTask.includes('instant')) {
487
- return {
488
- timing: 'immediate',
489
- delay: 0
490
- };
491
- }
492
- else if (lowerTask.includes('delay') || lowerTask.includes('wait')) {
493
- return {
494
- timing: 'delayed',
495
- delay: 300 // 5 minutes default
496
- };
497
- }
498
- else if (lowerTask.includes('schedule')) {
499
- return {
500
- timing: 'scheduled',
501
- schedule: 'daily'
502
- };
503
- }
504
- return {
505
- timing: 'immediate',
506
- delay: 0
507
- };
508
- }
509
- identifyTriggerFilters(task) {
510
- const filters = [];
511
- const lowerTask = task.toLowerCase();
512
- if (lowerTask.includes('active')) {
513
- filters.push({
514
- name: 'active_records_only',
515
- condition: 'active=true'
516
- });
517
- }
518
- if (lowerTask.includes('business hours')) {
519
- filters.push({
520
- name: 'business_hours_only',
521
- condition: 'business_hours=true'
522
- });
523
- }
524
- if (lowerTask.includes('exclude test')) {
525
- filters.push({
526
- name: 'exclude_test_data',
527
- condition: 'name_not_contains=test'
528
- });
529
- }
530
- return filters;
531
- }
532
- analyzeTriggerPerformance(task) {
533
- const lowerTask = task.toLowerCase();
534
- return {
535
- batchProcessing: lowerTask.includes('bulk') || lowerTask.includes('batch'),
536
- rateLimiting: lowerTask.includes('rate') || lowerTask.includes('throttle'),
537
- errorHandling: true,
538
- monitoring: true,
539
- optimization: lowerTask.includes('performance') || lowerTask.includes('optimize')
540
- };
541
- }
542
- async createTriggerDesign(requirements) {
543
- return {
544
- architecture: {
545
- pattern: this.selectTriggerPattern(requirements),
546
- components: this.identifyTriggerComponents(requirements),
547
- errorHandling: this.designErrorHandling(requirements)
548
- },
549
- scalability: this.designScalability(requirements),
550
- monitoring: this.designMonitoring(requirements)
551
- };
552
- }
553
- selectTriggerPattern(requirements) {
554
- if (requirements.eventTypes.includes('scheduled')) {
555
- return 'scheduled_trigger';
556
- }
557
- else if (requirements.eventTypes.length > 1) {
558
- return 'multi_event_trigger';
559
- }
560
- else if (requirements.performance.batchProcessing) {
561
- return 'batch_trigger';
562
- }
563
- return 'simple_trigger';
564
- }
565
- identifyTriggerComponents(requirements) {
566
- const components = ['event_listener'];
567
- if (requirements.conditions.conditions.length > 0) {
568
- components.push('condition_evaluator');
569
- }
570
- if (requirements.filters.length > 0) {
571
- components.push('filter_processor');
572
- }
573
- if (requirements.performance.rateLimiting) {
574
- components.push('rate_limiter');
575
- }
576
- if (requirements.performance.batchProcessing) {
577
- components.push('batch_processor');
578
- }
579
- return components;
580
- }
581
- designErrorHandling(requirements) {
582
- return {
583
- retryPolicy: {
584
- enabled: true,
585
- maxRetries: 3,
586
- backoffStrategy: 'exponential'
587
- },
588
- failureHandling: {
589
- logErrors: true,
590
- alertAdmins: true,
591
- gracefulDegradation: true
592
- },
593
- deadLetterQueue: requirements.performance.batchProcessing
594
- };
595
- }
596
- designScalability(requirements) {
597
- return {
598
- horizontalScaling: requirements.performance.batchProcessing,
599
- loadBalancing: requirements.eventTypes.length > 1,
600
- caching: requirements.performance.optimization
601
- };
602
- }
603
- designMonitoring(requirements) {
604
- return {
605
- metrics: ['trigger_count', 'execution_time', 'error_rate'],
606
- alerting: ['high_error_rate', 'performance_degradation'],
607
- logging: ['trigger_events', 'condition_evaluation', 'error_details']
608
- };
609
- }
610
- async createTriggerConfiguration(requirements) {
611
- return {
612
- triggerDefinition: {
613
- name: this.generateTriggerName(requirements),
614
- description: this.generateTriggerDescription(requirements),
615
- active: true,
616
- events: requirements.eventTypes,
617
- conditions: requirements.conditions,
618
- filters: requirements.filters,
619
- timing: requirements.timing,
620
- errorHandling: {
621
- retryCount: 3,
622
- errorNotification: true
623
- }
624
- },
625
- performanceConfig: {
626
- batchSize: requirements.performance.batchProcessing ? 100 : 1,
627
- rateLimitPerMinute: requirements.performance.rateLimiting ? 60 : null,
628
- timeoutSeconds: 300
629
- }
630
- };
631
- }
632
- generateTriggerName(requirements) {
633
- const eventType = requirements.eventTypes[0] || 'manual';
634
- return `${eventType}_trigger_${Date.now()}`;
635
- }
636
- generateTriggerDescription(requirements) {
637
- const events = requirements.eventTypes.join(', ');
638
- return `Trigger for ${events} events with ${requirements.conditions.conditions.length} conditions`;
639
- }
640
- }
641
- exports.TriggerSpecialist = TriggerSpecialist;
642
- class DataSpecialist extends base_specialist_js_1.BaseSpecialist {
643
- constructor(options = {}) {
644
- super('Data Specialist', 'Data Specialist', ['Data Modeling', 'Variable Management', 'Data Transformation', 'Data Validation'], options);
645
- }
646
- async execute(task, context) {
647
- await this.logProgress(`Analyzing data requirements for: ${task}`);
648
- const analysis = await this.analyzeTask(task);
649
- const dataRequirements = {
650
- dataModel: this.analyzeDataModel(task),
651
- variables: this.identifyVariables(task),
652
- transformations: this.identifyTransformations(task),
653
- validation: this.analyzeValidationNeeds(task),
654
- storage: this.analyzeStorageRequirements(task)
655
- };
656
- await this.logProgress('Designing data architecture');
657
- const dataArchitecture = await this.createDataArchitecture(dataRequirements);
658
- await this.logProgress('Creating data management strategy');
659
- const dataStrategy = await this.createDataStrategy(dataRequirements);
660
- return {
661
- ...analysis,
662
- specialist: 'Data Specialist',
663
- deliverables: {
664
- dataArchitecture,
665
- dataStrategy,
666
- requirements: dataRequirements
667
- }
668
- };
669
- }
670
- analyzeDataModel(task) {
671
- const lowerTask = task.toLowerCase();
672
- const entities = [];
673
- if (lowerTask.includes('user') || lowerTask.includes('requester')) {
674
- entities.push({
675
- name: 'User',
676
- table: 'sys_user',
677
- fields: ['name', 'email', 'department', 'manager']
678
- });
679
- }
680
- if (lowerTask.includes('request') || lowerTask.includes('ticket')) {
681
- entities.push({
682
- name: 'Request',
683
- table: 'sc_request',
684
- fields: ['number', 'short_description', 'state', 'priority']
685
- });
686
- }
687
- if (lowerTask.includes('approval')) {
688
- entities.push({
689
- name: 'Approval',
690
- table: 'sysapproval_approver',
691
- fields: ['state', 'approver', 'comments', 'sys_created_on']
692
- });
693
- }
694
- return {
695
- entities,
696
- relationships: this.identifyRelationships(entities),
697
- complexity: entities.length > 2 ? 'complex' : entities.length > 1 ? 'moderate' : 'simple'
698
- };
699
- }
700
- identifyRelationships(entities) {
701
- const relationships = [];
702
- const userEntity = entities.find(e => e.name === 'User');
703
- const requestEntity = entities.find(e => e.name === 'Request');
704
- const approvalEntity = entities.find(e => e.name === 'Approval');
705
- if (userEntity && requestEntity) {
706
- relationships.push({
707
- from: 'Request',
708
- to: 'User',
709
- type: 'many_to_one',
710
- field: 'requested_for'
711
- });
712
- }
713
- if (requestEntity && approvalEntity) {
714
- relationships.push({
715
- from: 'Approval',
716
- to: 'Request',
717
- type: 'many_to_one',
718
- field: 'sysapproval'
719
- });
720
- }
721
- return relationships;
722
- }
723
- identifyVariables(task) {
724
- const variables = [];
725
- const lowerTask = task.toLowerCase();
726
- // Common flow variables
727
- variables.push({
728
- name: 'trigger',
729
- type: 'record',
730
- description: 'Triggering record data',
731
- scope: 'flow'
732
- });
733
- if (lowerTask.includes('approval')) {
734
- variables.push({
735
- name: 'approval_status',
736
- type: 'string',
737
- description: 'Current approval status',
738
- scope: 'flow',
739
- defaultValue: 'pending'
740
- });
741
- variables.push({
742
- name: 'approver',
743
- type: 'reference',
744
- description: 'Assigned approver',
745
- scope: 'flow',
746
- referenceTo: 'sys_user'
747
- });
748
- }
749
- if (lowerTask.includes('notification') || lowerTask.includes('email')) {
750
- variables.push({
751
- name: 'email_recipients',
752
- type: 'string',
753
- description: 'Email recipient list',
754
- scope: 'step'
755
- });
756
- variables.push({
757
- name: 'email_subject',
758
- type: 'string',
759
- description: 'Email subject line',
760
- scope: 'step'
761
- });
762
- }
763
- if (lowerTask.includes('deadline') || lowerTask.includes('sla')) {
764
- variables.push({
765
- name: 'due_date',
766
- type: 'datetime',
767
- description: 'Process due date',
768
- scope: 'flow'
769
- });
770
- }
771
- return variables;
772
- }
773
- identifyTransformations(task) {
774
- const transformations = [];
775
- const lowerTask = task.toLowerCase();
776
- if (lowerTask.includes('format') || lowerTask.includes('convert')) {
777
- transformations.push({
778
- name: 'Data Formatting',
779
- type: 'format',
780
- description: 'Format data for display or processing',
781
- inputType: 'string',
782
- outputType: 'string'
783
- });
784
- }
785
- if (lowerTask.includes('calculate') || lowerTask.includes('compute')) {
786
- transformations.push({
787
- name: 'Value Calculation',
788
- type: 'calculation',
789
- description: 'Perform calculations on numeric data',
790
- inputType: 'number',
791
- outputType: 'number'
792
- });
793
- }
794
- if (lowerTask.includes('lookup') || lowerTask.includes('reference')) {
795
- transformations.push({
796
- name: 'Reference Lookup',
797
- type: 'lookup',
798
- description: 'Look up related record information',
799
- inputType: 'reference',
800
- outputType: 'record'
801
- });
802
- }
803
- if (lowerTask.includes('aggregate') || lowerTask.includes('count') || lowerTask.includes('sum')) {
804
- transformations.push({
805
- name: 'Data Aggregation',
806
- type: 'aggregation',
807
- description: 'Aggregate data from multiple records',
808
- inputType: 'recordset',
809
- outputType: 'number'
810
- });
811
- }
812
- return transformations;
813
- }
814
- analyzeValidationNeeds(task) {
815
- const validations = [];
816
- const lowerTask = task.toLowerCase();
817
- validations.push({
818
- name: 'Required Fields',
819
- type: 'required',
820
- description: 'Ensure required fields are not empty',
821
- severity: 'error'
822
- });
823
- if (lowerTask.includes('email')) {
824
- validations.push({
825
- name: 'Email Format',
826
- type: 'format',
827
- description: 'Validate email address format',
828
- pattern: '^[\\w\\.-]+@[\\w\\.-]+\\.[a-zA-Z]{2,}$',
829
- severity: 'error'
830
- });
831
- }
832
- if (lowerTask.includes('phone') || lowerTask.includes('number')) {
833
- validations.push({
834
- name: 'Phone Format',
835
- type: 'format',
836
- description: 'Validate phone number format',
837
- pattern: '^[\\d\\s\\-\\+\\(\\)]+$',
838
- severity: 'warning'
839
- });
840
- }
841
- if (lowerTask.includes('date')) {
842
- validations.push({
843
- name: 'Date Range',
844
- type: 'range',
845
- description: 'Validate date is within acceptable range',
846
- severity: 'error'
847
- });
848
- }
849
- return {
850
- rules: validations,
851
- strategy: 'fail_fast',
852
- errorHandling: 'log_and_continue'
853
- };
854
- }
855
- analyzeStorageRequirements(task) {
856
- const lowerTask = task.toLowerCase();
857
- return {
858
- persistence: lowerTask.includes('save') || lowerTask.includes('store'),
859
- temporary: lowerTask.includes('cache') || lowerTask.includes('session'),
860
- archival: lowerTask.includes('history') || lowerTask.includes('audit'),
861
- encryption: lowerTask.includes('sensitive') || lowerTask.includes('secure'),
862
- backup: true,
863
- retention: this.determineRetentionPolicy(task)
864
- };
865
- }
866
- determineRetentionPolicy(task) {
867
- const lowerTask = task.toLowerCase();
868
- if (lowerTask.includes('audit') || lowerTask.includes('compliance')) {
869
- return { period: '7_years', reason: 'regulatory_compliance' };
870
- }
871
- else if (lowerTask.includes('history')) {
872
- return { period: '2_years', reason: 'historical_analysis' };
873
- }
874
- else if (lowerTask.includes('temporary') || lowerTask.includes('cache')) {
875
- return { period: '30_days', reason: 'temporary_storage' };
876
- }
877
- return { period: '1_year', reason: 'standard_retention' };
878
- }
879
- async createDataArchitecture(requirements) {
880
- return {
881
- model: requirements.dataModel,
882
- variables: requirements.variables,
883
- transformations: requirements.transformations,
884
- validation: requirements.validation,
885
- storage: requirements.storage,
886
- performance: {
887
- indexing: this.designIndexingStrategy(requirements),
888
- caching: this.designCachingStrategy(requirements),
889
- optimization: this.designOptimizationStrategy(requirements)
890
- }
891
- };
892
- }
893
- designIndexingStrategy(requirements) {
894
- const indexes = [];
895
- requirements.dataModel.entities.forEach(entity => {
896
- if (entity.fields.includes('sys_created_on')) {
897
- indexes.push({
898
- table: entity.table,
899
- fields: ['sys_created_on'],
900
- type: 'btree'
901
- });
902
- }
903
- if (entity.fields.includes('state')) {
904
- indexes.push({
905
- table: entity.table,
906
- fields: ['state'],
907
- type: 'hash'
908
- });
909
- }
910
- });
911
- return { recommended: indexes };
912
- }
913
- designCachingStrategy(requirements) {
914
- return {
915
- enabled: requirements.storage.temporary,
916
- ttl: requirements.storage.temporary ? 1800 : null, // 30 minutes
917
- strategy: 'lru',
918
- levels: ['memory', 'disk']
919
- };
920
- }
921
- designOptimizationStrategy(requirements) {
922
- return {
923
- batchProcessing: requirements.dataModel.complexity === 'complex',
924
- lazyLoading: true,
925
- compressionEnabled: requirements.storage.archival,
926
- queryOptimization: true
927
- };
928
- }
929
- async createDataStrategy(requirements) {
930
- return {
931
- governance: {
932
- dataOwnership: 'defined',
933
- accessControls: 'rbac',
934
- auditTrail: requirements.storage.archival
935
- },
936
- integration: {
937
- apiStandards: 'rest',
938
- dataFormats: ['json', 'xml'],
939
- synchronization: 'real_time'
940
- },
941
- quality: {
942
- validation: requirements.validation,
943
- cleansing: 'automated',
944
- monitoring: 'continuous'
945
- },
946
- lifecycle: {
947
- creation: 'automated',
948
- updates: 'event_driven',
949
- archival: requirements.storage.retention,
950
- deletion: 'policy_based'
951
- }
952
- };
953
- }
954
- }
955
- exports.DataSpecialist = DataSpecialist;
956
- class IntegrationSpecialist extends base_specialist_js_1.BaseSpecialist {
957
- constructor(options = {}) {
958
- super('Integration Expert', 'Integration Specialist', ['API Integration', 'External Systems', 'Data Synchronization', 'Middleware'], options);
959
- }
960
- async execute(task, context) {
961
- await this.logProgress(`Analyzing integration requirements for: ${task}`);
962
- const analysis = await this.analyzeTask(task);
963
- const integrationRequirements = {
964
- systems: this.identifyExternalSystems(task),
965
- apis: this.analyzeApiRequirements(task),
966
- protocols: this.identifyProtocols(task),
967
- dataMapping: this.analyzeDataMapping(task),
968
- security: this.analyzeSecurityRequirements(task),
969
- errorHandling: this.analyzeErrorHandling(task)
970
- };
971
- await this.logProgress('Designing integration architecture');
972
- const integrationArchitecture = await this.createIntegrationArchitecture(integrationRequirements);
973
- await this.logProgress('Creating integration implementation plan');
974
- const implementationPlan = await this.createImplementationPlan(integrationRequirements);
975
- return {
976
- ...analysis,
977
- specialist: 'Integration Specialist',
978
- deliverables: {
979
- integrationArchitecture,
980
- implementationPlan,
981
- requirements: integrationRequirements
982
- }
983
- };
984
- }
985
- identifyExternalSystems(task) {
986
- const systems = [];
987
- const lowerTask = task.toLowerCase();
988
- if (lowerTask.includes('email') || lowerTask.includes('smtp')) {
989
- systems.push({
990
- name: 'Email System',
991
- type: 'communication',
992
- protocol: 'smtp',
993
- authentication: 'basic'
994
- });
995
- }
996
- if (lowerTask.includes('ldap') || lowerTask.includes('active directory')) {
997
- systems.push({
998
- name: 'LDAP/Active Directory',
999
- type: 'identity',
1000
- protocol: 'ldap',
1001
- authentication: 'kerberos'
1002
- });
1003
- }
1004
- if (lowerTask.includes('database') || lowerTask.includes('sql')) {
1005
- systems.push({
1006
- name: 'External Database',
1007
- type: 'data',
1008
- protocol: 'jdbc',
1009
- authentication: 'database'
1010
- });
1011
- }
1012
- if (lowerTask.includes('api') || lowerTask.includes('rest') || lowerTask.includes('webhook')) {
1013
- systems.push({
1014
- name: 'External API',
1015
- type: 'service',
1016
- protocol: 'https',
1017
- authentication: 'oauth2'
1018
- });
1019
- }
1020
- return systems;
1021
- }
1022
- analyzeApiRequirements(task) {
1023
- const lowerTask = task.toLowerCase();
1024
- return {
1025
- type: lowerTask.includes('soap') ? 'soap' : 'rest',
1026
- version: 'v1',
1027
- authentication: this.determineAuthMethod(task),
1028
- rateLimiting: lowerTask.includes('rate') || lowerTask.includes('limit'),
1029
- versioning: 'header',
1030
- documentation: 'openapi',
1031
- testing: 'automated'
1032
- };
1033
- }
1034
- determineAuthMethod(task) {
1035
- const lowerTask = task.toLowerCase();
1036
- if (lowerTask.includes('oauth')) {
1037
- return 'oauth2';
1038
- }
1039
- else if (lowerTask.includes('token')) {
1040
- return 'bearer_token';
1041
- }
1042
- else if (lowerTask.includes('basic')) {
1043
- return 'basic_auth';
1044
- }
1045
- else if (lowerTask.includes('api key')) {
1046
- return 'api_key';
1047
- }
1048
- return 'basic_auth';
1049
- }
1050
- identifyProtocols(task) {
1051
- const protocols = [];
1052
- const lowerTask = task.toLowerCase();
1053
- if (lowerTask.includes('http') || lowerTask.includes('rest') || lowerTask.includes('api')) {
1054
- protocols.push('https');
1055
- }
1056
- if (lowerTask.includes('soap')) {
1057
- protocols.push('soap');
1058
- }
1059
- if (lowerTask.includes('ftp') || lowerTask.includes('file')) {
1060
- protocols.push('sftp');
1061
- }
1062
- if (lowerTask.includes('email') || lowerTask.includes('smtp')) {
1063
- protocols.push('smtp');
1064
- }
1065
- if (lowerTask.includes('ldap')) {
1066
- protocols.push('ldaps');
1067
- }
1068
- return protocols.length > 0 ? protocols : ['https'];
1069
- }
1070
- analyzeDataMapping(task) {
1071
- const mappings = [];
1072
- const lowerTask = task.toLowerCase();
1073
- if (lowerTask.includes('user') || lowerTask.includes('person')) {
1074
- mappings.push({
1075
- source: 'external_user',
1076
- target: 'sys_user',
1077
- fields: [
1078
- { source: 'username', target: 'user_name', transformation: 'lowercase' },
1079
- { source: 'email', target: 'email', transformation: 'none' },
1080
- { source: 'fullName', target: 'name', transformation: 'none' }
1081
- ]
1082
- });
1083
- }
1084
- if (lowerTask.includes('ticket') || lowerTask.includes('incident')) {
1085
- mappings.push({
1086
- source: 'external_ticket',
1087
- target: 'incident',
1088
- fields: [
1089
- { source: 'title', target: 'short_description', transformation: 'truncate' },
1090
- { source: 'description', target: 'description', transformation: 'none' },
1091
- { source: 'severity', target: 'priority', transformation: 'map_values' }
1092
- ]
1093
- });
1094
- }
1095
- return {
1096
- mappings,
1097
- transformations: this.identifyDataTransformations(mappings),
1098
- validation: this.identifyMappingValidation(mappings)
1099
- };
1100
- }
1101
- identifyDataTransformations(mappings) {
1102
- const transformations = [];
1103
- mappings.forEach(mapping => {
1104
- mapping.fields.forEach(field => {
1105
- if (field.transformation !== 'none') {
1106
- transformations.push({
1107
- type: field.transformation,
1108
- field: field.target,
1109
- description: `Apply ${field.transformation} to ${field.source}`
1110
- });
1111
- }
1112
- });
1113
- });
1114
- return transformations;
1115
- }
1116
- identifyMappingValidation(mappings) {
1117
- const validations = [];
1118
- mappings.forEach(mapping => {
1119
- validations.push({
1120
- entity: mapping.target,
1121
- rules: [
1122
- 'required_fields_present',
1123
- 'data_types_match',
1124
- 'referential_integrity'
1125
- ]
1126
- });
1127
- });
1128
- return validations;
1129
- }
1130
- analyzeSecurityRequirements(task) {
1131
- const lowerTask = task.toLowerCase();
1132
- return {
1133
- encryption: {
1134
- inTransit: true,
1135
- atRest: lowerTask.includes('sensitive') || lowerTask.includes('secure'),
1136
- algorithm: 'aes256'
1137
- },
1138
- authentication: {
1139
- method: this.determineAuthMethod(task),
1140
- tokenExpiry: '1h',
1141
- refreshToken: true
1142
- },
1143
- authorization: {
1144
- rbac: true,
1145
- scopes: this.identifyRequiredScopes(task),
1146
- auditLogging: true
1147
- },
1148
- compliance: {
1149
- gdpr: lowerTask.includes('gdpr') || lowerTask.includes('privacy'),
1150
- sox: lowerTask.includes('sox') || lowerTask.includes('financial'),
1151
- hipaa: lowerTask.includes('hipaa') || lowerTask.includes('medical')
1152
- }
1153
- };
1154
- }
1155
- identifyRequiredScopes(task) {
1156
- const scopes = ['read'];
1157
- const lowerTask = task.toLowerCase();
1158
- if (lowerTask.includes('create') || lowerTask.includes('add')) {
1159
- scopes.push('write');
1160
- }
1161
- if (lowerTask.includes('update') || lowerTask.includes('modify')) {
1162
- scopes.push('update');
1163
- }
1164
- if (lowerTask.includes('delete') || lowerTask.includes('remove')) {
1165
- scopes.push('delete');
1166
- }
1167
- if (lowerTask.includes('admin')) {
1168
- scopes.push('admin');
1169
- }
1170
- return scopes;
1171
- }
1172
- analyzeErrorHandling(task) {
1173
- return {
1174
- retryPolicy: {
1175
- enabled: true,
1176
- maxRetries: 3,
1177
- backoffStrategy: 'exponential',
1178
- retryableErrors: ['timeout', 'rate_limit', 'temporary_failure']
1179
- },
1180
- fallbackStrategy: {
1181
- enabled: true,
1182
- fallbackActions: ['cache_response', 'default_values', 'manual_intervention']
1183
- },
1184
- monitoring: {
1185
- healthChecks: true,
1186
- alerting: true,
1187
- metricsCollection: true
1188
- },
1189
- gracefulDegradation: {
1190
- enabled: true,
1191
- partialFailureHandling: true
1192
- }
1193
- };
1194
- }
1195
- async createIntegrationArchitecture(requirements) {
1196
- return {
1197
- pattern: this.selectIntegrationPattern(requirements),
1198
- components: this.identifyArchitecturalComponents(requirements),
1199
- dataFlow: this.designDataFlow(requirements),
1200
- security: this.designSecurityArchitecture(requirements),
1201
- scalability: this.designScalability(requirements)
1202
- };
1203
- }
1204
- selectIntegrationPattern(requirements) {
1205
- if (requirements.systems.length > 2) {
1206
- return 'hub_and_spoke';
1207
- }
1208
- else if (requirements.systems.some(s => s.type === 'service')) {
1209
- return 'api_gateway';
1210
- }
1211
- else if (requirements.apis.type === 'soap') {
1212
- return 'enterprise_service_bus';
1213
- }
1214
- return 'point_to_point';
1215
- }
1216
- identifyArchitecturalComponents(requirements) {
1217
- const components = ['integration_engine'];
1218
- if (requirements.apis.authentication === 'oauth2') {
1219
- components.push('oauth_client');
1220
- }
1221
- if (requirements.dataMapping.mappings.length > 0) {
1222
- components.push('data_transformer');
1223
- }
1224
- if (requirements.errorHandling.retryPolicy.enabled) {
1225
- components.push('retry_handler');
1226
- }
1227
- if (requirements.security.encryption.inTransit) {
1228
- components.push('encryption_manager');
1229
- }
1230
- return components;
1231
- }
1232
- designDataFlow(requirements) {
1233
- return {
1234
- direction: 'bidirectional',
1235
- frequency: 'real_time',
1236
- batchSize: requirements.systems.length > 1 ? 100 : 1,
1237
- transformation: requirements.dataMapping.mappings.length > 0,
1238
- validation: true,
1239
- errorHandling: requirements.errorHandling
1240
- };
1241
- }
1242
- designSecurityArchitecture(requirements) {
1243
- return {
1244
- layers: ['transport', 'application', 'data'],
1245
- encryption: requirements.security.encryption,
1246
- authentication: requirements.security.authentication,
1247
- authorization: requirements.security.authorization,
1248
- compliance: requirements.security.compliance
1249
- };
1250
- }
1251
- designScalability(requirements) {
1252
- return {
1253
- horizontal: requirements.systems.length > 2,
1254
- loadBalancing: true,
1255
- caching: true,
1256
- circuitBreaker: true,
1257
- rateLimiting: requirements.apis.rateLimiting
1258
- };
1259
- }
1260
- async createImplementationPlan(requirements) {
1261
- return {
1262
- phases: this.createImplementationPhases(requirements),
1263
- timeline: this.estimateTimeline(requirements),
1264
- resources: this.identifyRequiredResources(requirements),
1265
- risks: this.identifyImplementationRisks(requirements),
1266
- testing: this.createTestingStrategy(requirements)
1267
- };
1268
- }
1269
- createImplementationPhases(requirements) {
1270
- const phases = [
1271
- {
1272
- name: 'Setup and Configuration',
1273
- tasks: ['Configure authentication', 'Set up connection pools', 'Initialize security'],
1274
- duration: '1-2 days'
1275
- },
1276
- {
1277
- name: 'Core Integration',
1278
- tasks: ['Implement API calls', 'Set up data mapping', 'Configure error handling'],
1279
- duration: '3-5 days'
1280
- },
1281
- {
1282
- name: 'Testing and Validation',
1283
- tasks: ['Unit testing', 'Integration testing', 'Performance testing'],
1284
- duration: '2-3 days'
1285
- },
1286
- {
1287
- name: 'Deployment and Monitoring',
1288
- tasks: ['Production deployment', 'Monitoring setup', 'Documentation'],
1289
- duration: '1-2 days'
1290
- }
1291
- ];
1292
- return phases;
1293
- }
1294
- estimateTimeline(requirements) {
1295
- const complexity = requirements.systems.length;
1296
- const baseWeeks = Math.max(1, complexity);
1297
- return `${baseWeeks} week${baseWeeks > 1 ? 's' : ''}`;
1298
- }
1299
- identifyRequiredResources(requirements) {
1300
- const resources = ['Integration Developer', 'System Administrator'];
1301
- if (requirements.security.compliance.gdpr || requirements.security.compliance.sox) {
1302
- resources.push('Security Specialist');
1303
- }
1304
- if (requirements.systems.some(s => s.type === 'data')) {
1305
- resources.push('Database Administrator');
1306
- }
1307
- return resources;
1308
- }
1309
- identifyImplementationRisks(requirements) {
1310
- const risks = [
1311
- {
1312
- risk: 'External system availability',
1313
- impact: 'high',
1314
- probability: 'medium',
1315
- mitigation: 'Implement circuit breaker pattern'
1316
- },
1317
- {
1318
- risk: 'Data mapping complexity',
1319
- impact: 'medium',
1320
- probability: 'high',
1321
- mitigation: 'Thorough testing and validation'
1322
- }
1323
- ];
1324
- if (requirements.security.compliance.gdpr) {
1325
- risks.push({
1326
- risk: 'GDPR compliance violation',
1327
- impact: 'high',
1328
- probability: 'low',
1329
- mitigation: 'Data protection impact assessment'
1330
- });
1331
- }
1332
- return risks;
1333
- }
1334
- createTestingStrategy(requirements) {
1335
- return {
1336
- unit: {
1337
- framework: 'jasmine',
1338
- coverage: 90,
1339
- focus: 'data transformation and validation'
1340
- },
1341
- integration: {
1342
- environment: 'staging',
1343
- dataSet: 'synthetic',
1344
- scenarios: ['happy path', 'error conditions', 'edge cases']
1345
- },
1346
- performance: {
1347
- loadTesting: requirements.systems.length > 1,
1348
- stressTesting: true,
1349
- enduranceTesting: false
1350
- },
1351
- security: {
1352
- penetrationTesting: requirements.security.compliance.gdpr,
1353
- vulnerabilityScanning: true,
1354
- complianceValidation: Object.values(requirements.security.compliance).some(Boolean)
1355
- }
1356
- };
1357
- }
1358
- }
1359
- exports.IntegrationSpecialist = IntegrationSpecialist;
1360
- class SecuritySpecialist extends base_specialist_js_1.BaseSpecialist {
1361
- constructor(options = {}) {
1362
- super('Security Reviewer', 'Security Specialist', ['Security Analysis', 'Access Control', 'Compliance', 'Vulnerability Assessment'], options);
1363
- }
1364
- async execute(task, context) {
1365
- await this.logProgress(`Analyzing security requirements for: ${task}`);
1366
- const analysis = await this.analyzeTask(task);
1367
- const securityRequirements = {
1368
- authentication: this.analyzeAuthenticationNeeds(task),
1369
- authorization: this.analyzeAuthorizationNeeds(task),
1370
- dataProtection: this.analyzeDataProtectionNeeds(task),
1371
- auditCompliance: this.analyzeComplianceNeeds(task),
1372
- vulnerabilities: this.identifyVulnerabilities(task),
1373
- monitoring: this.analyzeMonitoringNeeds(task)
1374
- };
1375
- await this.logProgress('Designing security controls');
1376
- const securityControls = await this.createSecurityControls(securityRequirements);
1377
- await this.logProgress('Creating security implementation plan');
1378
- const securityPlan = await this.createSecurityPlan(securityRequirements);
1379
- return {
1380
- ...analysis,
1381
- specialist: 'Security Specialist',
1382
- deliverables: {
1383
- securityControls,
1384
- securityPlan,
1385
- requirements: securityRequirements
1386
- }
1387
- };
1388
- }
1389
- analyzeAuthenticationNeeds(task) {
1390
- const lowerTask = task.toLowerCase();
1391
- return {
1392
- required: true,
1393
- methods: this.identifyAuthMethods(task),
1394
- strength: lowerTask.includes('sensitive') || lowerTask.includes('critical') ? 'strong' : 'standard',
1395
- mfa: lowerTask.includes('mfa') || lowerTask.includes('two factor'),
1396
- sessionManagement: true,
1397
- passwordPolicy: this.createPasswordPolicy(task)
1398
- };
1399
- }
1400
- identifyAuthMethods(task) {
1401
- const methods = ['local'];
1402
- const lowerTask = task.toLowerCase();
1403
- if (lowerTask.includes('sso') || lowerTask.includes('saml')) {
1404
- methods.push('sso');
1405
- }
1406
- if (lowerTask.includes('ldap')) {
1407
- methods.push('ldap');
1408
- }
1409
- if (lowerTask.includes('oauth')) {
1410
- methods.push('oauth2');
1411
- }
1412
- return methods;
1413
- }
1414
- createPasswordPolicy(task) {
1415
- const lowerTask = task.toLowerCase();
1416
- const isHighSecurity = lowerTask.includes('sensitive') || lowerTask.includes('critical');
1417
- return {
1418
- minimumLength: isHighSecurity ? 12 : 8,
1419
- complexity: isHighSecurity ? 'high' : 'medium',
1420
- expiration: isHighSecurity ? 90 : 180,
1421
- history: isHighSecurity ? 12 : 6,
1422
- lockoutPolicy: {
1423
- attempts: 5,
1424
- duration: 15,
1425
- progressive: true
1426
- }
1427
- };
1428
- }
1429
- analyzeAuthorizationNeeds(task) {
1430
- const lowerTask = task.toLowerCase();
1431
- return {
1432
- model: 'rbac',
1433
- roles: this.identifyRequiredRoles(task),
1434
- permissions: this.identifyRequiredPermissions(task),
1435
- inheritance: true,
1436
- delegation: lowerTask.includes('delegate') || lowerTask.includes('proxy'),
1437
- auditTrail: true
1438
- };
1439
- }
1440
- identifyRequiredRoles(task) {
1441
- const roles = ['user'];
1442
- const lowerTask = task.toLowerCase();
1443
- if (lowerTask.includes('admin')) {
1444
- roles.push('admin');
1445
- }
1446
- if (lowerTask.includes('manager') || lowerTask.includes('supervisor')) {
1447
- roles.push('manager');
1448
- }
1449
- if (lowerTask.includes('approval')) {
1450
- roles.push('approver');
1451
- }
1452
- if (lowerTask.includes('security')) {
1453
- roles.push('security_officer');
1454
- }
1455
- return roles;
1456
- }
1457
- identifyRequiredPermissions(task) {
1458
- const permissions = [];
1459
- const lowerTask = task.toLowerCase();
1460
- if (lowerTask.includes('read') || lowerTask.includes('view')) {
1461
- permissions.push({
1462
- action: 'read',
1463
- resource: 'flow_data',
1464
- conditions: []
1465
- });
1466
- }
1467
- if (lowerTask.includes('create') || lowerTask.includes('add')) {
1468
- permissions.push({
1469
- action: 'create',
1470
- resource: 'flow_instances',
1471
- conditions: ['own_department']
1472
- });
1473
- }
1474
- if (lowerTask.includes('update') || lowerTask.includes('modify')) {
1475
- permissions.push({
1476
- action: 'update',
1477
- resource: 'flow_instances',
1478
- conditions: ['own_records', 'assigned_to_user']
1479
- });
1480
- }
1481
- if (lowerTask.includes('delete')) {
1482
- permissions.push({
1483
- action: 'delete',
1484
- resource: 'flow_instances',
1485
- conditions: ['admin_role']
1486
- });
1487
- }
1488
- return permissions;
1489
- }
1490
- analyzeDataProtectionNeeds(task) {
1491
- const lowerTask = task.toLowerCase();
1492
- return {
1493
- classification: this.classifyDataSensitivity(task),
1494
- encryption: {
1495
- inTransit: true,
1496
- atRest: lowerTask.includes('sensitive') || lowerTask.includes('confidential'),
1497
- keyManagement: 'automatic'
1498
- },
1499
- masking: lowerTask.includes('pii') || lowerTask.includes('personal'),
1500
- retention: this.defineRetentionPolicy(task),
1501
- disposal: 'secure_deletion'
1502
- };
1503
- }
1504
- classifyDataSensitivity(task) {
1505
- const lowerTask = task.toLowerCase();
1506
- if (lowerTask.includes('confidential') || lowerTask.includes('secret')) {
1507
- return 'confidential';
1508
- }
1509
- else if (lowerTask.includes('sensitive') || lowerTask.includes('pii')) {
1510
- return 'sensitive';
1511
- }
1512
- else if (lowerTask.includes('internal')) {
1513
- return 'internal';
1514
- }
1515
- return 'public';
1516
- }
1517
- defineRetentionPolicy(task) {
1518
- const lowerTask = task.toLowerCase();
1519
- if (lowerTask.includes('audit') || lowerTask.includes('compliance')) {
1520
- return { period: '7_years', reason: 'regulatory' };
1521
- }
1522
- else if (lowerTask.includes('financial')) {
1523
- return { period: '7_years', reason: 'financial_records' };
1524
- }
1525
- else if (lowerTask.includes('hr') || lowerTask.includes('employee')) {
1526
- return { period: '7_years', reason: 'employment_records' };
1527
- }
1528
- return { period: '3_years', reason: 'business_records' };
1529
- }
1530
- analyzeComplianceNeeds(task) {
1531
- const lowerTask = task.toLowerCase();
1532
- const frameworks = [];
1533
- if (lowerTask.includes('gdpr') || lowerTask.includes('privacy')) {
1534
- frameworks.push('gdpr');
1535
- }
1536
- if (lowerTask.includes('sox') || lowerTask.includes('financial')) {
1537
- frameworks.push('sox');
1538
- }
1539
- if (lowerTask.includes('hipaa') || lowerTask.includes('medical')) {
1540
- frameworks.push('hipaa');
1541
- }
1542
- if (lowerTask.includes('pci') || lowerTask.includes('payment')) {
1543
- frameworks.push('pci_dss');
1544
- }
1545
- return {
1546
- frameworks,
1547
- auditRequirements: this.defineAuditRequirements(frameworks),
1548
- reportingRequirements: this.defineReportingRequirements(frameworks),
1549
- controls: this.defineComplianceControls(frameworks)
1550
- };
1551
- }
1552
- defineAuditRequirements(frameworks) {
1553
- return {
1554
- frequency: frameworks.includes('sox') ? 'quarterly' : 'annually',
1555
- scope: 'comprehensive',
1556
- documentation: 'required',
1557
- evidenceCollection: 'automated',
1558
- reporting: 'executive_summary'
1559
- };
1560
- }
1561
- defineReportingRequirements(frameworks) {
1562
- const requirements = {
1563
- frequency: 'monthly',
1564
- format: 'dashboard',
1565
- recipients: ['security_team', 'compliance_officer'],
1566
- metrics: ['access_attempts', 'policy_violations', 'security_incidents']
1567
- };
1568
- if (frameworks.includes('gdpr')) {
1569
- requirements.metrics.push('data_subject_requests', 'breach_notifications');
1570
- }
1571
- return requirements;
1572
- }
1573
- defineComplianceControls(frameworks) {
1574
- const controls = [
1575
- {
1576
- id: 'AC-1',
1577
- name: 'Access Control Policy',
1578
- description: 'Implement and maintain access control policies',
1579
- framework: 'general'
1580
- }
1581
- ];
1582
- if (frameworks.includes('gdpr')) {
1583
- controls.push({
1584
- id: 'GDPR-1',
1585
- name: 'Data Subject Rights',
1586
- description: 'Implement processes for data subject requests',
1587
- framework: 'gdpr'
1588
- });
1589
- }
1590
- if (frameworks.includes('sox')) {
1591
- controls.push({
1592
- id: 'SOX-1',
1593
- name: 'Financial Data Controls',
1594
- description: 'Controls for financial data integrity',
1595
- framework: 'sox'
1596
- });
1597
- }
1598
- return controls;
1599
- }
1600
- identifyVulnerabilities(task) {
1601
- const vulnerabilities = [
1602
- {
1603
- category: 'injection',
1604
- risk: 'medium',
1605
- description: 'SQL injection vulnerabilities in data processing',
1606
- mitigation: 'parameterized_queries'
1607
- },
1608
- {
1609
- category: 'authentication',
1610
- risk: 'high',
1611
- description: 'Weak authentication mechanisms',
1612
- mitigation: 'strong_authentication'
1613
- },
1614
- {
1615
- category: 'authorization',
1616
- risk: 'medium',
1617
- description: 'Insufficient access controls',
1618
- mitigation: 'rbac_implementation'
1619
- }
1620
- ];
1621
- const lowerTask = task.toLowerCase();
1622
- if (lowerTask.includes('api') || lowerTask.includes('integration')) {
1623
- vulnerabilities.push({
1624
- category: 'api_security',
1625
- risk: 'high',
1626
- description: 'Insecure API endpoints',
1627
- mitigation: 'api_security_controls'
1628
- });
1629
- }
1630
- return vulnerabilities;
1631
- }
1632
- analyzeMonitoringNeeds(task) {
1633
- return {
1634
- realTime: true,
1635
- events: [
1636
- 'authentication_failures',
1637
- 'authorization_violations',
1638
- 'data_access_anomalies',
1639
- 'privilege_escalations'
1640
- ],
1641
- alerting: {
1642
- immediate: ['security_breaches', 'critical_violations'],
1643
- periodic: ['policy_violations', 'access_reviews']
1644
- },
1645
- logging: {
1646
- level: 'comprehensive',
1647
- retention: '1_year',
1648
- integrity: 'tamper_proof'
1649
- },
1650
- reporting: {
1651
- frequency: 'daily',
1652
- format: 'dashboard',
1653
- distribution: ['security_team', 'administrators']
1654
- }
1655
- };
1656
- }
1657
- async createSecurityControls(requirements) {
1658
- return {
1659
- preventive: this.createPreventiveControls(requirements),
1660
- detective: this.createDetectiveControls(requirements),
1661
- corrective: this.createCorrectiveControls(requirements),
1662
- compensating: this.createCompensatingControls(requirements)
1663
- };
1664
- }
1665
- createPreventiveControls(requirements) {
1666
- const controls = [
1667
- {
1668
- name: 'Authentication Controls',
1669
- type: 'preventive',
1670
- implementation: requirements.authentication,
1671
- priority: 'high'
1672
- },
1673
- {
1674
- name: 'Authorization Controls',
1675
- type: 'preventive',
1676
- implementation: requirements.authorization,
1677
- priority: 'high'
1678
- },
1679
- {
1680
- name: 'Data Encryption',
1681
- type: 'preventive',
1682
- implementation: requirements.dataProtection.encryption,
1683
- priority: 'medium'
1684
- }
1685
- ];
1686
- return controls;
1687
- }
1688
- createDetectiveControls(requirements) {
1689
- return [
1690
- {
1691
- name: 'Security Monitoring',
1692
- type: 'detective',
1693
- implementation: requirements.monitoring,
1694
- priority: 'high'
1695
- },
1696
- {
1697
- name: 'Audit Logging',
1698
- type: 'detective',
1699
- implementation: requirements.auditCompliance.auditRequirements,
1700
- priority: 'medium'
1701
- }
1702
- ];
1703
- }
1704
- createCorrectiveControls(requirements) {
1705
- return [
1706
- {
1707
- name: 'Incident Response',
1708
- type: 'corrective',
1709
- implementation: {
1710
- automated: true,
1711
- escalation: 'progressive',
1712
- containment: 'immediate'
1713
- },
1714
- priority: 'high'
1715
- },
1716
- {
1717
- name: 'Access Revocation',
1718
- type: 'corrective',
1719
- implementation: {
1720
- automatic: true,
1721
- conditions: ['policy_violation', 'suspicious_activity']
1722
- },
1723
- priority: 'medium'
1724
- }
1725
- ];
1726
- }
1727
- createCompensatingControls(requirements) {
1728
- return [
1729
- {
1730
- name: 'Manual Review Process',
1731
- type: 'compensating',
1732
- implementation: {
1733
- frequency: 'weekly',
1734
- scope: 'high_risk_transactions'
1735
- },
1736
- priority: 'low'
1737
- }
1738
- ];
1739
- }
1740
- async createSecurityPlan(requirements) {
1741
- return {
1742
- implementation: {
1743
- phases: this.createSecurityPhases(),
1744
- timeline: '2-4 weeks',
1745
- resources: ['Security Engineer', 'System Administrator'],
1746
- budget: 'moderate'
1747
- },
1748
- testing: {
1749
- penetrationTesting: requirements.dataProtection.classification === 'confidential',
1750
- vulnerabilityScanning: true,
1751
- complianceValidation: requirements.auditCompliance.frameworks.length > 0
1752
- },
1753
- maintenance: {
1754
- reviews: 'quarterly',
1755
- updates: 'as_needed',
1756
- training: 'annual'
1757
- },
1758
- compliance: requirements.auditCompliance
1759
- };
1760
- }
1761
- createSecurityPhases() {
1762
- return [
1763
- {
1764
- name: 'Security Assessment',
1765
- duration: '3-5 days',
1766
- activities: ['Risk assessment', 'Vulnerability analysis', 'Control gap analysis']
1767
- },
1768
- {
1769
- name: 'Control Implementation',
1770
- duration: '1-2 weeks',
1771
- activities: ['Deploy security controls', 'Configure monitoring', 'Set up alerting']
1772
- },
1773
- {
1774
- name: 'Testing and Validation',
1775
- duration: '3-5 days',
1776
- activities: ['Security testing', 'Compliance validation', 'Performance impact assessment']
1777
- },
1778
- {
1779
- name: 'Documentation and Training',
1780
- duration: '2-3 days',
1781
- activities: ['Document procedures', 'Create user guides', 'Conduct training sessions']
1782
- }
1783
- ];
1784
- }
1785
- }
1786
- exports.SecuritySpecialist = SecuritySpecialist;
1787
- //# sourceMappingURL=flow-specialists.js.map