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,1190 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WidgetPlatformAgent = void 0;
4
- /**
5
- * Widget Platform Agent - ServiceNow Platform Integration Specialist
6
- * Handles ServiceNow-specific integrations, platform APIs, and deployment coordination
7
- */
8
- const base_team_1 = require("../base-team");
9
- class WidgetPlatformAgent extends base_team_1.BaseSnowAgent {
10
- constructor(config) {
11
- const capabilities = [
12
- {
13
- name: 'servicenow_platform_integration',
14
- description: 'Deep ServiceNow platform knowledge and integration',
15
- proficiency: 0.95,
16
- tools: ['servicenow_apis', 'platform_dependencies', 'update_sets']
17
- },
18
- {
19
- name: 'widget_deployment',
20
- description: 'Deploy and configure widgets in ServiceNow',
21
- proficiency: 0.9,
22
- tools: ['service_portal', 'widget_dependencies', 'page_configuration']
23
- },
24
- {
25
- name: 'platform_optimization',
26
- description: 'Optimize for ServiceNow platform performance',
27
- proficiency: 0.88,
28
- tools: ['performance_tuning', 'caching_strategies', 'api_optimization']
29
- },
30
- {
31
- name: 'security_compliance',
32
- description: 'Ensure ServiceNow security and compliance standards',
33
- proficiency: 0.85,
34
- tools: ['acl_management', 'security_policies', 'compliance_validation']
35
- },
36
- {
37
- name: 'dependency_management',
38
- description: 'Manage platform dependencies and integrations',
39
- proficiency: 0.83,
40
- tools: ['dependency_resolution', 'api_discovery', 'integration_testing']
41
- }
42
- ];
43
- const specialization = {
44
- primary: ['servicenow_platform', 'widget_deployment', 'platform_integration'],
45
- secondary: ['performance_optimization', 'security', 'dependency_management'],
46
- tools: ['ServiceNow APIs', 'Service Portal', 'Update Sets', 'Platform Performance Tools'],
47
- experience: 0.88
48
- };
49
- super('widget-platform-001', 'Widget Platform Specialist', 'platform_specialist', capabilities, specialization, config);
50
- }
51
- /**
52
- * Analyze platform requirements and integration needs
53
- */
54
- async analyzeRequirements(requirements) {
55
- try {
56
- this.setStatus('busy');
57
- console.log('Platform Agent: Analyzing platform requirements...');
58
- const analysis = {
59
- platformIntegration: this.analyzePlatformIntegration(requirements),
60
- deploymentStrategy: this.analyzeDeploymentNeeds(requirements),
61
- securityRequirements: this.analyzeSecurityNeeds(requirements),
62
- performanceOptimization: this.analyzePerformanceNeeds(requirements),
63
- dependencyMapping: this.analyzeDependencies(requirements)
64
- };
65
- console.log('Platform Agent: Platform analysis complete');
66
- return analysis;
67
- }
68
- catch (error) {
69
- console.error('Platform Agent: Error analyzing requirements:', error);
70
- throw error;
71
- }
72
- finally {
73
- this.setStatus('available');
74
- }
75
- }
76
- /**
77
- * Execute platform integration and deployment tasks
78
- */
79
- async execute(requirements) {
80
- try {
81
- this.setStatus('busy');
82
- console.log('Platform Agent: Starting platform integration...');
83
- // Setup platform dependencies
84
- const platformSetup = await this.setupPlatformDependencies(requirements);
85
- // Configure ServiceNow integrations
86
- const integrationConfig = await this.configureServiceNowIntegrations(requirements);
87
- // Setup security and permissions
88
- const securityConfig = await this.setupSecurityConfiguration(requirements);
89
- // Create deployment configuration
90
- const deploymentConfig = await this.createDeploymentConfiguration(requirements);
91
- // Optimize for platform performance
92
- const performanceConfig = await this.createPerformanceConfiguration(requirements);
93
- // Validate platform compatibility
94
- const validation = await this.validatePlatformCompatibility({
95
- platformSetup,
96
- integrationConfig,
97
- securityConfig,
98
- requirements
99
- });
100
- console.log('Platform Agent: Platform integration completed');
101
- return {
102
- success: true,
103
- artifact: {
104
- platformSetup,
105
- integrationConfig,
106
- securityConfig,
107
- deploymentConfig,
108
- performanceConfig,
109
- validation
110
- },
111
- metadata: {
112
- duration: 0,
113
- performance: {
114
- integration_efficiency: this.assessIntegrationEfficiency(integrationConfig),
115
- deployment_readiness: this.assessDeploymentReadiness(deploymentConfig),
116
- security_compliance: this.assessSecurityCompliance(securityConfig)
117
- },
118
- quality: {
119
- platform_compatibility: validation.compatibility,
120
- dependency_resolution: validation.dependencies,
121
- performance_optimization: validation.performance
122
- }
123
- }
124
- };
125
- }
126
- catch (error) {
127
- console.error('Platform Agent: Error in platform integration:', error);
128
- return this.handleError(error);
129
- }
130
- finally {
131
- this.setStatus('available');
132
- }
133
- }
134
- /**
135
- * Setup platform dependencies and requirements
136
- */
137
- async setupPlatformDependencies(requirements) {
138
- console.log('Platform Agent: Setting up platform dependencies...');
139
- const dependencies = {
140
- servicePortal: await this.setupServicePortalDependencies(requirements),
141
- apis: await this.setupAPIAccess(requirements),
142
- libraries: await this.setupLibraryDependencies(requirements),
143
- tables: await this.setupTableAccess(requirements),
144
- roles: await this.setupRoleRequirements(requirements)
145
- };
146
- return dependencies;
147
- }
148
- /**
149
- * Configure ServiceNow platform integrations
150
- */
151
- async configureServiceNowIntegrations(requirements) {
152
- console.log('Platform Agent: Configuring ServiceNow integrations...');
153
- const integrations = {
154
- tableAPI: this.createTableAPIIntegration(requirements),
155
- restAPI: this.createRESTAPIIntegration(requirements),
156
- glideAjax: this.createGlideAjaxIntegration(requirements),
157
- webServices: this.createWebServiceIntegrations(requirements),
158
- eventHandling: this.createEventHandlingIntegration(requirements)
159
- };
160
- return integrations;
161
- }
162
- /**
163
- * Setup security configuration and permissions
164
- */
165
- async setupSecurityConfiguration(requirements) {
166
- console.log('Platform Agent: Setting up security configuration...');
167
- const security = {
168
- accessControls: this.createAccessControls(requirements),
169
- roleConfiguration: this.createRoleConfiguration(requirements),
170
- dataValidation: this.createDataValidation(requirements),
171
- auditConfiguration: this.createAuditConfiguration(requirements),
172
- complianceSettings: this.createComplianceSettings(requirements)
173
- };
174
- return security;
175
- }
176
- /**
177
- * Create deployment configuration for ServiceNow
178
- */
179
- async createDeploymentConfiguration(requirements) {
180
- console.log('Platform Agent: Creating deployment configuration...');
181
- const deployment = {
182
- updateSetConfig: this.createUpdateSetConfiguration(requirements),
183
- widgetConfiguration: this.createWidgetConfiguration(requirements),
184
- pageConfiguration: this.createPageConfiguration(requirements),
185
- menuConfiguration: this.createMenuConfiguration(requirements),
186
- testingConfiguration: this.createTestingConfiguration(requirements)
187
- };
188
- return deployment;
189
- }
190
- /**
191
- * Create performance optimization configuration
192
- */
193
- async createPerformanceConfiguration(requirements) {
194
- console.log('Platform Agent: Creating performance configuration...');
195
- const performance = {
196
- cachingStrategy: this.createCachingStrategy(requirements),
197
- queryOptimization: this.createQueryOptimization(requirements),
198
- loadBalancing: this.createLoadBalancingStrategy(requirements),
199
- assetOptimization: this.createAssetOptimization(requirements),
200
- monitoring: this.createPerformanceMonitoring(requirements)
201
- };
202
- return performance;
203
- }
204
- // Platform dependency setup methods
205
- async setupServicePortalDependencies(requirements) {
206
- return {
207
- portalConfiguration: {
208
- theme: 'Stock Theme',
209
- branding: 'ServiceNow Default',
210
- customization: requirements.customization || 'minimal'
211
- },
212
- widgetDependencies: [
213
- 'sp-angular-provider',
214
- 'sp-server-utilities',
215
- 'sp-client-utilities'
216
- ],
217
- pageTemplates: this.identifyRequiredPageTemplates(requirements),
218
- cssFrameworks: ['Bootstrap 4', 'ServiceNow UI Framework'],
219
- jsLibraries: this.identifyRequiredJSLibraries(requirements)
220
- };
221
- }
222
- async setupAPIAccess(requirements) {
223
- return {
224
- tableAPI: {
225
- tables: this.identifyRequiredTables(requirements),
226
- operations: ['read', 'write', 'create', 'delete'],
227
- authentication: 'session_based'
228
- },
229
- restAPI: {
230
- endpoints: this.identifyRequiredEndpoints(requirements),
231
- authentication: 'oauth2_or_basic',
232
- rateLimit: 'platform_default'
233
- },
234
- glideAPI: {
235
- classes: ['GlideRecord', 'GlideSystem', 'GlideUser', 'GlideDateTime'],
236
- serverSide: true,
237
- clientSide: false
238
- }
239
- };
240
- }
241
- async setupLibraryDependencies(requirements) {
242
- const libraries = [];
243
- // Chart library if needed
244
- if (requirements.integration?.apis?.includes('chart') ||
245
- requirements.type === 'chart') {
246
- libraries.push({
247
- name: 'Chart.js',
248
- version: '3.x',
249
- cdn: 'https://cdn.jsdelivr.net/npm/chart.js',
250
- local: '/scripts/lib/chart.js'
251
- });
252
- }
253
- // Date library if needed
254
- if (requirements.data?.fields?.some((f) => f.includes('date'))) {
255
- libraries.push({
256
- name: 'Moment.js',
257
- version: '2.x',
258
- cdn: 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js',
259
- local: '/scripts/lib/moment.js'
260
- });
261
- }
262
- // Export library if needed
263
- if (requirements.functionality?.export) {
264
- libraries.push({
265
- name: 'SheetJS',
266
- version: '0.18.x',
267
- cdn: 'https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js',
268
- local: '/scripts/lib/xlsx.js'
269
- });
270
- }
271
- return libraries;
272
- }
273
- async setupTableAccess(requirements) {
274
- const tables = this.identifyRequiredTables(requirements);
275
- return tables.map(table => ({
276
- name: table,
277
- access: {
278
- read: true,
279
- write: requirements.functionality?.interactive || false,
280
- create: false,
281
- delete: false
282
- },
283
- fields: this.getTableFields(table, requirements),
284
- security: {
285
- acl_required: true,
286
- role_based: true,
287
- field_level: false
288
- }
289
- }));
290
- }
291
- async setupRoleRequirements(requirements) {
292
- const baseRoles = ['service_portal_user'];
293
- // Add specific roles based on functionality
294
- if (requirements.functionality?.interactive) {
295
- baseRoles.push('service_portal_contributor');
296
- }
297
- if (requirements.data?.source === 'incident') {
298
- baseRoles.push('incident_reader');
299
- }
300
- if (requirements.functionality?.export) {
301
- baseRoles.push('report_viewer');
302
- }
303
- return {
304
- required: baseRoles,
305
- optional: ['admin', 'service_portal_admin'],
306
- custom: this.identifyCustomRoles(requirements)
307
- };
308
- }
309
- // ServiceNow integration methods
310
- createTableAPIIntegration(requirements) {
311
- return {
312
- implementation: `
313
- // Table API Integration
314
- var TableAPIIntegration = {
315
- query: function(table, query, fields, limit) {
316
- try {
317
- var gr = new GlideRecord(table);
318
-
319
- if (query) {
320
- gr.addEncodedQuery(query);
321
- }
322
-
323
- if (limit) {
324
- gr.setLimit(limit);
325
- }
326
-
327
- gr.query();
328
-
329
- var results = [];
330
- while (gr.next()) {
331
- var item = {
332
- sys_id: gr.getUniqueValue(),
333
- display_value: gr.getDisplayValue()
334
- };
335
-
336
- if (fields && fields.length > 0) {
337
- fields.forEach(function(field) {
338
- item[field] = gr.getDisplayValue(field);
339
- item[field + '_value'] = gr.getValue(field);
340
- });
341
- }
342
-
343
- results.push(item);
344
- }
345
-
346
- return {
347
- success: true,
348
- data: results,
349
- total: results.length
350
- };
351
-
352
- } catch (error) {
353
- return {
354
- success: false,
355
- error: error.message
356
- };
357
- }
358
- },
359
-
360
- update: function(table, sysId, data) {
361
- try {
362
- var gr = new GlideRecord(table);
363
- if (gr.get(sysId)) {
364
- for (var field in data) {
365
- if (gr.isValidField(field)) {
366
- gr.setValue(field, data[field]);
367
- }
368
- }
369
-
370
- var updated = gr.update();
371
-
372
- return {
373
- success: !!updated,
374
- sys_id: sysId
375
- };
376
- }
377
-
378
- return {
379
- success: false,
380
- error: 'Record not found'
381
- };
382
-
383
- } catch (error) {
384
- return {
385
- success: false,
386
- error: error.message
387
- };
388
- }
389
- }
390
- };`,
391
- usage: 'Server-side data operations',
392
- security: 'ACL protected',
393
- caching: 'Application level'
394
- };
395
- }
396
- createRESTAPIIntegration(requirements) {
397
- return {
398
- implementation: `
399
- // REST API Integration
400
- var RESTAPIIntegration = {
401
- call: function(endpoint, method, data, headers) {
402
- try {
403
- var request = new sn_ws.RESTMessageV2();
404
- request.setEndpoint(endpoint);
405
- request.setHttpMethod(method || 'GET');
406
-
407
- // Add headers
408
- if (headers) {
409
- for (var header in headers) {
410
- request.setRequestHeader(header, headers[header]);
411
- }
412
- }
413
-
414
- // Add authentication
415
- this.addAuthentication(request);
416
-
417
- // Add request body for POST/PUT
418
- if (data && (method === 'POST' || method === 'PUT')) {
419
- request.setRequestBody(JSON.stringify(data));
420
- request.setRequestHeader('Content-Type', 'application/json');
421
- }
422
-
423
- var response = request.execute();
424
- var responseBody = response.getBody();
425
- var statusCode = response.getStatusCode();
426
-
427
- return {
428
- success: statusCode >= 200 && statusCode < 300,
429
- data: responseBody ? JSON.parse(responseBody) : null,
430
- statusCode: statusCode,
431
- headers: this.parseResponseHeaders(response)
432
- };
433
-
434
- } catch (error) {
435
- return {
436
- success: false,
437
- error: error.message,
438
- statusCode: 0
439
- };
440
- }
441
- },
442
-
443
- addAuthentication: function(request) {
444
- // Add OAuth or Basic authentication based on configuration
445
- var authType = gs.getProperty('widget.api.auth.type', 'none');
446
-
447
- switch (authType) {
448
- case 'bearer':
449
- var token = gs.getProperty('widget.api.auth.token');
450
- if (token) {
451
- request.setRequestHeader('Authorization', 'Bearer ' + token);
452
- }
453
- break;
454
- case 'basic':
455
- var username = gs.getProperty('widget.api.auth.username');
456
- var password = gs.getProperty('widget.api.auth.password');
457
- if (username && password) {
458
- request.setBasicAuth(username, password);
459
- }
460
- break;
461
- }
462
- },
463
-
464
- parseResponseHeaders: function(response) {
465
- var headers = {};
466
- var headerNames = response.getHeaderNames();
467
-
468
- for (var i = 0; i < headerNames.size(); i++) {
469
- var name = headerNames.get(i);
470
- headers[name] = response.getHeader(name);
471
- }
472
-
473
- return headers;
474
- }
475
- };`,
476
- endpoints: this.identifyRequiredEndpoints(requirements),
477
- authentication: 'Configurable (OAuth2, Basic, API Key)',
478
- errorHandling: 'Comprehensive with retry logic'
479
- };
480
- }
481
- createGlideAjaxIntegration(requirements) {
482
- return {
483
- implementation: `
484
- // GlideAjax Integration for client-server communication
485
- var WidgetGlideAjax = Class.create();
486
- WidgetGlideAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
487
-
488
- processWidgetAction: function() {
489
- var action = this.getParameter('action');
490
- var data = JSON.parse(this.getParameter('data') || '{}');
491
-
492
- try {
493
- switch (action) {
494
- case 'validate_data':
495
- return this.validateData(data);
496
- case 'process_action':
497
- return this.processAction(data);
498
- case 'get_metadata':
499
- return this.getMetadata(data);
500
- default:
501
- return this.error('Unknown action: ' + action);
502
- }
503
- } catch (error) {
504
- gs.error('Widget GlideAjax error: ' + error.message);
505
- return this.error(error.message);
506
- }
507
- },
508
-
509
- validateData: function(data) {
510
- // Implement data validation logic
511
- var validationRules = this.getValidationRules();
512
- var errors = [];
513
-
514
- for (var field in validationRules) {
515
- var rule = validationRules[field];
516
- var value = data[field];
517
-
518
- if (rule.required && (!value || value === '')) {
519
- errors.push(field + ' is required');
520
- }
521
-
522
- if (value && rule.type && !this.validateType(value, rule.type)) {
523
- errors.push(field + ' must be of type ' + rule.type);
524
- }
525
- }
526
-
527
- return this.success({
528
- valid: errors.length === 0,
529
- errors: errors
530
- });
531
- },
532
-
533
- processAction: function(data) {
534
- // Implement action processing
535
- var result = TableAPIIntegration.update(data.table, data.sys_id, data.values);
536
-
537
- if (result.success) {
538
- return this.success(result);
539
- } else {
540
- return this.error(result.error);
541
- }
542
- },
543
-
544
- getMetadata: function(data) {
545
- // Return widget metadata
546
- return this.success({
547
- version: '1.0.0',
548
- lastUpdated: new GlideDateTime().getDisplayValue(),
549
- capabilities: ['read', 'write', 'validate']
550
- });
551
- },
552
-
553
- validateType: function(value, type) {
554
- switch (type) {
555
- case 'email':
556
- return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value);
557
- case 'number':
558
- return !isNaN(parseFloat(value));
559
- case 'date':
560
- return new GlideDateTime(value).isValid();
561
- default:
562
- return true;
563
- }
564
- },
565
-
566
- getValidationRules: function() {
567
- // Return validation rules based on configuration
568
- return {
569
- email: { required: false, type: 'email' },
570
- priority: { required: true, type: 'number' },
571
- due_date: { required: false, type: 'date' }
572
- };
573
- },
574
-
575
- success: function(data) {
576
- return JSON.stringify({
577
- success: true,
578
- data: data
579
- });
580
- },
581
-
582
- error: function(message) {
583
- return JSON.stringify({
584
- success: false,
585
- error: message
586
- });
587
- },
588
-
589
- type: 'WidgetGlideAjax'
590
- });`,
591
- clientUsage: `
592
- // Client-side usage
593
- function callServerSide(action, data, callback) {
594
- var ga = new GlideAjax('WidgetGlideAjax');
595
- ga.addParam('sysparm_name', 'processWidgetAction');
596
- ga.addParam('action', action);
597
- ga.addParam('data', JSON.stringify(data));
598
-
599
- ga.getXML(function(response) {
600
- try {
601
- var result = JSON.parse(response.responseText);
602
- callback(result);
603
- } catch (error) {
604
- callback({
605
- success: false,
606
- error: 'Failed to parse server response'
607
- });
608
- }
609
- });
610
- }`,
611
- security: 'Session-based authentication',
612
- performance: 'Asynchronous with error handling'
613
- };
614
- }
615
- createWebServiceIntegrations(requirements) {
616
- return {
617
- soap: {
618
- implementation: 'SOAPMessage for legacy system integration',
619
- authentication: 'WS-Security or basic authentication',
620
- errorHandling: 'SOAP fault processing'
621
- },
622
- rest: {
623
- implementation: 'RESTMessageV2 for modern API integration',
624
- authentication: 'OAuth2, Bearer token, or API key',
625
- errorHandling: 'HTTP status code and response parsing'
626
- },
627
- webhooks: {
628
- implementation: 'Outbound webhook notifications',
629
- retry: 'Exponential backoff retry mechanism',
630
- security: 'HMAC signature verification'
631
- }
632
- };
633
- }
634
- createEventHandlingIntegration(requirements) {
635
- return {
636
- businessRules: {
637
- triggers: ['insert', 'update', 'delete'],
638
- events: ['widget.data.changed', 'widget.user.action'],
639
- async: true
640
- },
641
- notifications: {
642
- email: 'Email notification on specific events',
643
- push: 'Push notification to mobile devices',
644
- webhook: 'Webhook notification to external systems'
645
- },
646
- workflow: {
647
- triggers: 'Workflow trigger on data changes',
648
- approval: 'Approval workflow integration',
649
- automation: 'Automated task creation'
650
- }
651
- };
652
- }
653
- // Security configuration methods
654
- createAccessControls(requirements) {
655
- const tables = this.identifyRequiredTables(requirements);
656
- return tables.map(table => ({
657
- table: table,
658
- operation: 'read',
659
- roles: ['service_portal_user'],
660
- condition: 'gs.hasRole("service_portal_user")',
661
- script: `
662
- // ACL Script for ${table} read access
663
- function checkAccess() {
664
- // Check if user has basic portal access
665
- if (!gs.hasRole('service_portal_user')) {
666
- return false;
667
- }
668
-
669
- // Check if user can read this specific table
670
- var gr = new GlideRecord('${table}');
671
- return gr.canRead();
672
- }
673
-
674
- // Execute access check
675
- answer = checkAccess();`
676
- }));
677
- }
678
- createRoleConfiguration(requirements) {
679
- return {
680
- baseRoles: [
681
- {
682
- name: 'widget_user',
683
- description: 'Basic widget access',
684
- contains: ['service_portal_user']
685
- }
686
- ],
687
- conditionalRoles: this.generateConditionalRoles(requirements),
688
- delegation: {
689
- enabled: false,
690
- roles: [],
691
- conditions: []
692
- }
693
- };
694
- }
695
- createDataValidation(requirements) {
696
- return {
697
- inputValidation: {
698
- client: 'Real-time validation with JavaScript',
699
- server: 'Server-side validation with GlideRecord',
700
- sanitization: 'XSS and injection prevention'
701
- },
702
- businessRules: {
703
- validation: 'Custom validation business rules',
704
- formatting: 'Data formatting and normalization',
705
- enrichment: 'Data enrichment from related records'
706
- },
707
- errorHandling: {
708
- validation: 'Clear validation error messages',
709
- logging: 'Error logging for debugging',
710
- recovery: 'Data recovery mechanisms'
711
- }
712
- };
713
- }
714
- createAuditConfiguration(requirements) {
715
- return {
716
- tableAudit: {
717
- enabled: true,
718
- tables: this.identifyRequiredTables(requirements),
719
- fields: 'All fields with PII flagged'
720
- },
721
- userActions: {
722
- login: 'Track user login and logout',
723
- dataAccess: 'Track data access and modifications',
724
- exports: 'Track data export activities'
725
- },
726
- retention: {
727
- period: '90 days',
728
- archival: 'Automatic archival to cold storage',
729
- deletion: 'Secure deletion after retention period'
730
- }
731
- };
732
- }
733
- createComplianceSettings(requirements) {
734
- return {
735
- gdpr: {
736
- enabled: true,
737
- dataMapping: 'Map personal data fields',
738
- consent: 'Track user consent for data processing',
739
- rightToDelete: 'Support for data deletion requests'
740
- },
741
- sox: {
742
- enabled: false,
743
- controls: 'Financial data access controls',
744
- segregation: 'Separation of duties enforcement'
745
- },
746
- hipaa: {
747
- enabled: false,
748
- encryption: 'PHI data encryption',
749
- accessLogging: 'Detailed access logging for PHI'
750
- }
751
- };
752
- }
753
- // Deployment configuration methods
754
- createUpdateSetConfiguration(requirements) {
755
- return {
756
- name: `Widget_${requirements.name || 'Custom'}_${new Date().getTime()}`,
757
- description: `Update set for ${requirements.name || 'Custom'} widget deployment`,
758
- state: 'in_progress',
759
- application: requirements.application || 'Global',
760
- artifacts: [
761
- 'Service Portal Widget',
762
- 'Widget Dependencies',
763
- 'CSS Includes',
764
- 'Script Includes',
765
- 'UI Scripts'
766
- ],
767
- deployment: {
768
- automatic: true,
769
- validation: 'Full validation before deployment',
770
- rollback: 'Automatic rollback on failure'
771
- }
772
- };
773
- }
774
- createWidgetConfiguration(requirements) {
775
- return {
776
- portal: 'Service Portal',
777
- category: requirements.category || 'Custom',
778
- public: true,
779
- roles: this.identifyRequiredRoles(requirements),
780
- dependencies: this.identifyWidgetDependencies(requirements),
781
- options: {
782
- configurable: true,
783
- schema: 'Auto-generated from requirements',
784
- validation: 'Client and server-side validation'
785
- }
786
- };
787
- }
788
- createPageConfiguration(requirements) {
789
- return {
790
- template: 'Standard Service Portal Template',
791
- layout: 'Responsive grid layout',
792
- widgets: [
793
- {
794
- position: 'main',
795
- widget: requirements.name || 'custom_widget',
796
- configuration: requirements.options || {}
797
- }
798
- ],
799
- css: 'Include widget-specific CSS',
800
- js: 'Include widget-specific JavaScript'
801
- };
802
- }
803
- createMenuConfiguration(requirements) {
804
- return {
805
- module: {
806
- name: `${requirements.name || 'Custom'} Widget`,
807
- table: 'sp_widget',
808
- roles: ['service_portal_admin'],
809
- order: 100
810
- },
811
- navigation: {
812
- portal: 'Service Portal navigation',
813
- category: 'Widgets',
814
- visibility: 'Role-based'
815
- }
816
- };
817
- }
818
- createTestingConfiguration(requirements) {
819
- return {
820
- unitTests: {
821
- server: 'Server-side script testing',
822
- client: 'Client-side script testing',
823
- integration: 'API integration testing'
824
- },
825
- e2eTests: {
826
- userFlows: 'End-to-end user flow testing',
827
- accessibility: 'Accessibility compliance testing',
828
- performance: 'Load and performance testing'
829
- },
830
- automation: {
831
- ci: 'Continuous integration testing',
832
- regression: 'Automated regression testing',
833
- deployment: 'Deployment validation testing'
834
- }
835
- };
836
- }
837
- // Performance configuration methods
838
- createCachingStrategy(requirements) {
839
- return {
840
- serverSide: {
841
- type: 'Application cache',
842
- ttl: 300, // 5 minutes
843
- keys: ['user_data', 'table_data', 'metadata'],
844
- invalidation: 'Event-based and TTL-based'
845
- },
846
- clientSide: {
847
- type: 'Browser cache',
848
- storage: 'sessionStorage for session data, localStorage for preferences',
849
- compression: 'Gzip compression for large datasets'
850
- },
851
- cdn: {
852
- enabled: true,
853
- assets: ['CSS', 'JavaScript', 'Images'],
854
- location: 'ServiceNow CDN'
855
- }
856
- };
857
- }
858
- createQueryOptimization(requirements) {
859
- return {
860
- indexing: {
861
- strategy: 'Create indexes on frequently queried fields',
862
- fields: this.identifyIndexFields(requirements),
863
- monitoring: 'Query performance monitoring'
864
- },
865
- pagination: {
866
- enabled: true,
867
- pageSize: 25,
868
- strategy: 'Cursor-based pagination for large datasets'
869
- },
870
- lazy: {
871
- loading: 'Lazy load non-critical data',
872
- images: 'Lazy load images and heavy content',
873
- apis: 'Lazy load external API data'
874
- }
875
- };
876
- }
877
- createLoadBalancingStrategy(requirements) {
878
- return {
879
- distribution: 'ServiceNow managed load balancing',
880
- session: 'Sticky sessions for stateful operations',
881
- failover: 'Automatic failover to healthy instances',
882
- monitoring: 'Real-time load monitoring'
883
- };
884
- }
885
- createAssetOptimization(requirements) {
886
- return {
887
- css: {
888
- minification: 'Minify CSS for production',
889
- concatenation: 'Combine CSS files',
890
- purging: 'Remove unused CSS classes'
891
- },
892
- javascript: {
893
- minification: 'Minify JavaScript for production',
894
- compression: 'Gzip compression',
895
- bundling: 'Bundle related scripts'
896
- },
897
- images: {
898
- optimization: 'Optimize image sizes and formats',
899
- responsive: 'Serve appropriate image sizes',
900
- lazy: 'Lazy load images below the fold'
901
- }
902
- };
903
- }
904
- createPerformanceMonitoring(requirements) {
905
- return {
906
- metrics: [
907
- 'Page load time',
908
- 'Time to first byte',
909
- 'First contentful paint',
910
- 'Largest contentful paint',
911
- 'Cumulative layout shift'
912
- ],
913
- alerts: {
914
- thresholds: 'Performance threshold alerts',
915
- escalation: 'Automatic escalation for critical issues',
916
- reporting: 'Regular performance reports'
917
- },
918
- optimization: {
919
- continuous: 'Continuous performance optimization',
920
- profiling: 'Regular performance profiling',
921
- tuning: 'Automatic performance tuning'
922
- }
923
- };
924
- }
925
- // Validation methods
926
- async validatePlatformCompatibility(config) {
927
- console.log('Platform Agent: Validating platform compatibility...');
928
- return {
929
- compatibility: this.validateCompatibility(config),
930
- dependencies: this.validateDependencies(config),
931
- performance: this.validatePerformance(config),
932
- security: this.validateSecurity(config)
933
- };
934
- }
935
- validateCompatibility(config) {
936
- // Check ServiceNow version compatibility
937
- const hasServicePortal = !!config.platformSetup.servicePortal;
938
- const hasAPIAccess = !!config.platformSetup.apis;
939
- const hasSecurityConfig = !!config.securityConfig;
940
- let score = 0.5;
941
- if (hasServicePortal)
942
- score += 0.2;
943
- if (hasAPIAccess)
944
- score += 0.2;
945
- if (hasSecurityConfig)
946
- score += 0.1;
947
- return Math.min(score, 1.0);
948
- }
949
- validateDependencies(config) {
950
- // Check if all dependencies are properly configured
951
- const hasLibraries = config.platformSetup.libraries?.length > 0;
952
- const hasTableAccess = config.platformSetup.tables?.length > 0;
953
- const hasRoles = config.platformSetup.roles?.required?.length > 0;
954
- let score = 0.4;
955
- if (hasLibraries)
956
- score += 0.2;
957
- if (hasTableAccess)
958
- score += 0.25;
959
- if (hasRoles)
960
- score += 0.15;
961
- return Math.min(score, 1.0);
962
- }
963
- validatePerformance(config) {
964
- // Check performance configuration completeness
965
- const hasCaching = !!config.performanceConfig?.cachingStrategy;
966
- const hasOptimization = !!config.performanceConfig?.queryOptimization;
967
- const hasMonitoring = !!config.performanceConfig?.monitoring;
968
- let score = 0.4;
969
- if (hasCaching)
970
- score += 0.25;
971
- if (hasOptimization)
972
- score += 0.2;
973
- if (hasMonitoring)
974
- score += 0.15;
975
- return Math.min(score, 1.0);
976
- }
977
- validateSecurity(config) {
978
- // Check security configuration completeness
979
- const hasAccessControls = !!config.securityConfig?.accessControls;
980
- const hasValidation = !!config.securityConfig?.dataValidation;
981
- const hasAudit = !!config.securityConfig?.auditConfiguration;
982
- let score = 0.3;
983
- if (hasAccessControls)
984
- score += 0.3;
985
- if (hasValidation)
986
- score += 0.25;
987
- if (hasAudit)
988
- score += 0.15;
989
- return Math.min(score, 1.0);
990
- }
991
- // Assessment methods
992
- assessIntegrationEfficiency(integrationConfig) {
993
- // Assess the efficiency of integrations
994
- const configString = JSON.stringify(integrationConfig);
995
- const hasErrorHandling = configString.includes('error');
996
- const hasAuthentication = configString.includes('auth');
997
- const hasCaching = configString.includes('cache');
998
- let score = 0.4;
999
- if (hasErrorHandling)
1000
- score += 0.25;
1001
- if (hasAuthentication)
1002
- score += 0.2;
1003
- if (hasCaching)
1004
- score += 0.15;
1005
- return Math.min(score, 1.0);
1006
- }
1007
- assessDeploymentReadiness(deploymentConfig) {
1008
- // Assess deployment configuration completeness
1009
- const hasUpdateSet = !!deploymentConfig?.updateSetConfig;
1010
- const hasWidgetConfig = !!deploymentConfig?.widgetConfiguration;
1011
- const hasTesting = !!deploymentConfig?.testingConfiguration;
1012
- let score = 0.3;
1013
- if (hasUpdateSet)
1014
- score += 0.3;
1015
- if (hasWidgetConfig)
1016
- score += 0.25;
1017
- if (hasTesting)
1018
- score += 0.15;
1019
- return Math.min(score, 1.0);
1020
- }
1021
- assessSecurityCompliance(securityConfig) {
1022
- // Assess security compliance level
1023
- const hasCompliance = !!securityConfig?.complianceSettings;
1024
- const hasAudit = !!securityConfig?.auditConfiguration;
1025
- const hasValidation = !!securityConfig?.dataValidation;
1026
- let score = 0.4;
1027
- if (hasCompliance)
1028
- score += 0.25;
1029
- if (hasAudit)
1030
- score += 0.2;
1031
- if (hasValidation)
1032
- score += 0.15;
1033
- return Math.min(score, 1.0);
1034
- }
1035
- // Analysis helper methods
1036
- analyzePlatformIntegration(requirements) {
1037
- return {
1038
- complexity: requirements.integrations?.length > 2 ? 'high' : 'medium',
1039
- apis: requirements.integrations || [],
1040
- tables: this.identifyRequiredTables(requirements)
1041
- };
1042
- }
1043
- analyzeDeploymentNeeds(requirements) {
1044
- return {
1045
- strategy: 'update_set',
1046
- scope: requirements.scope || 'global',
1047
- testing: 'comprehensive'
1048
- };
1049
- }
1050
- analyzeSecurityNeeds(requirements) {
1051
- return {
1052
- level: 'standard',
1053
- compliance: requirements.compliance || [],
1054
- audit: true
1055
- };
1056
- }
1057
- analyzePerformanceNeeds(requirements) {
1058
- return {
1059
- caching: requirements.data?.fields?.length > 10,
1060
- optimization: requirements.data?.fields?.length > 20,
1061
- monitoring: true
1062
- };
1063
- }
1064
- analyzeDependencies(requirements) {
1065
- return {
1066
- external: this.identifyExternalDependencies(requirements),
1067
- internal: this.identifyInternalDependencies(requirements),
1068
- optional: this.identifyOptionalDependencies(requirements)
1069
- };
1070
- }
1071
- // Helper methods for identification
1072
- identifyRequiredTables(requirements) {
1073
- const tables = [];
1074
- if (requirements.data?.source) {
1075
- tables.push(requirements.data.source);
1076
- }
1077
- if (requirements.integrations?.includes('incident')) {
1078
- tables.push('incident');
1079
- }
1080
- if (requirements.integrations?.includes('task')) {
1081
- tables.push('task');
1082
- }
1083
- return [...new Set(tables)];
1084
- }
1085
- identifyRequiredEndpoints(requirements) {
1086
- const endpoints = [];
1087
- if (requirements.data?.source) {
1088
- endpoints.push(`/api/now/table/${requirements.data.source}`);
1089
- }
1090
- if (requirements.integrations?.includes('external_api')) {
1091
- endpoints.push('/api/external/data');
1092
- }
1093
- return endpoints;
1094
- }
1095
- identifyRequiredPageTemplates(requirements) {
1096
- return ['Standard Service Portal Template'];
1097
- }
1098
- identifyRequiredJSLibraries(requirements) {
1099
- const libraries = ['AngularJS', 'jQuery'];
1100
- if (requirements.type === 'chart') {
1101
- libraries.push('Chart.js');
1102
- }
1103
- if (requirements.functionality?.export) {
1104
- libraries.push('SheetJS');
1105
- }
1106
- return libraries;
1107
- }
1108
- getTableFields(table, requirements) {
1109
- // Return common fields based on table type
1110
- const commonFields = ['sys_id', 'sys_created_on', 'sys_updated_on'];
1111
- if (table === 'incident') {
1112
- return [...commonFields, 'number', 'priority', 'state', 'short_description', 'assigned_to'];
1113
- }
1114
- if (table === 'task') {
1115
- return [...commonFields, 'number', 'priority', 'state', 'short_description', 'assigned_to'];
1116
- }
1117
- return commonFields;
1118
- }
1119
- identifyCustomRoles(requirements) {
1120
- const roles = [];
1121
- if (requirements.functionality?.administrative) {
1122
- roles.push('widget_admin');
1123
- }
1124
- if (requirements.functionality?.reporting) {
1125
- roles.push('widget_reporter');
1126
- }
1127
- return roles;
1128
- }
1129
- generateConditionalRoles(requirements) {
1130
- return [
1131
- {
1132
- condition: 'User is assigned to specific group',
1133
- roles: ['widget_power_user'],
1134
- script: 'gs.getUser().isMemberOf("widget_users")'
1135
- }
1136
- ];
1137
- }
1138
- identifyRequiredRoles(requirements) {
1139
- const roles = ['service_portal_user'];
1140
- if (requirements.functionality?.interactive) {
1141
- roles.push('service_portal_contributor');
1142
- }
1143
- return roles;
1144
- }
1145
- identifyWidgetDependencies(requirements) {
1146
- const dependencies = [];
1147
- if (requirements.type === 'chart') {
1148
- dependencies.push('chart_widget_base');
1149
- }
1150
- if (requirements.functionality?.export) {
1151
- dependencies.push('export_utility');
1152
- }
1153
- return dependencies;
1154
- }
1155
- identifyIndexFields(requirements) {
1156
- const fields = [];
1157
- if (requirements.data?.source === 'incident') {
1158
- fields.push('priority', 'state', 'assigned_to');
1159
- }
1160
- if (requirements.data?.filters) {
1161
- fields.push(...Object.keys(requirements.data.filters));
1162
- }
1163
- return [...new Set(fields)];
1164
- }
1165
- identifyExternalDependencies(requirements) {
1166
- const deps = [];
1167
- if (requirements.type === 'chart') {
1168
- deps.push('Chart.js');
1169
- }
1170
- if (requirements.integrations?.includes('external_api')) {
1171
- deps.push('External API Service');
1172
- }
1173
- return deps;
1174
- }
1175
- identifyInternalDependencies(requirements) {
1176
- return ['Service Portal Framework', 'AngularJS', 'ServiceNow APIs'];
1177
- }
1178
- identifyOptionalDependencies(requirements) {
1179
- const deps = [];
1180
- if (requirements.functionality?.export) {
1181
- deps.push('Export Service');
1182
- }
1183
- if (requirements.functionality?.realtime) {
1184
- deps.push('WebSocket Service');
1185
- }
1186
- return deps;
1187
- }
1188
- }
1189
- exports.WidgetPlatformAgent = WidgetPlatformAgent;
1190
- //# sourceMappingURL=widget-platform.agent.js.map