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,1014 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WidgetFrontendAgent = void 0;
4
- /**
5
- * Widget Frontend Agent - Frontend Development Specialist
6
- * Handles HTML templates, CSS styling, and client-side JavaScript for widgets
7
- */
8
- const base_team_1 = require("../base-team");
9
- class WidgetFrontendAgent extends base_team_1.BaseSnowAgent {
10
- constructor(config) {
11
- const capabilities = [
12
- {
13
- name: 'html_template_creation',
14
- description: 'Create responsive HTML templates for widgets',
15
- proficiency: 0.95,
16
- tools: ['html5', 'angular', 'responsive_design']
17
- },
18
- {
19
- name: 'css_styling',
20
- description: 'Create CSS styles and themes for widgets',
21
- proficiency: 0.9,
22
- tools: ['css3', 'scss', 'bootstrap', 'servicenow_themes']
23
- },
24
- {
25
- name: 'client_javascript',
26
- description: 'Develop client-side JavaScript functionality',
27
- proficiency: 0.88,
28
- tools: ['javascript', 'angular', 'servicenow_client_api']
29
- },
30
- {
31
- name: 'responsive_design',
32
- description: 'Ensure responsive design across devices',
33
- proficiency: 0.85,
34
- tools: ['media_queries', 'flexbox', 'grid']
35
- },
36
- {
37
- name: 'accessibility',
38
- description: 'Implement accessibility best practices',
39
- proficiency: 0.8,
40
- tools: ['wcag', 'aria', 'keyboard_navigation']
41
- }
42
- ];
43
- const specialization = {
44
- primary: ['html_templates', 'css_styling', 'client_scripting'],
45
- secondary: ['ui_components', 'responsive_design', 'accessibility'],
46
- tools: ['HTML5', 'CSS3', 'JavaScript', 'AngularJS', 'ServiceNow Client API'],
47
- experience: 0.88
48
- };
49
- super('widget-frontend-001', 'Widget Frontend Specialist', 'frontend_developer', capabilities, specialization, config);
50
- }
51
- /**
52
- * Analyze frontend requirements and prepare implementation plan
53
- */
54
- async analyzeRequirements(requirements) {
55
- try {
56
- this.setStatus('busy');
57
- console.log('Frontend Agent: Analyzing frontend requirements...');
58
- const analysis = {
59
- templateStructure: this.analyzeTemplateNeeds(requirements),
60
- stylingApproach: this.analyzeStylingNeeds(requirements),
61
- scriptingNeeds: this.analyzeScriptingNeeds(requirements),
62
- responsiveStrategy: this.analyzeResponsiveNeeds(requirements),
63
- accessibilityRequirements: this.analyzeAccessibilityNeeds(requirements)
64
- };
65
- console.log('Frontend Agent: Analysis complete');
66
- return analysis;
67
- }
68
- catch (error) {
69
- console.error('Frontend Agent: Error analyzing requirements:', error);
70
- throw error;
71
- }
72
- finally {
73
- this.setStatus('available');
74
- }
75
- }
76
- /**
77
- * Execute frontend development tasks
78
- */
79
- async execute(requirements) {
80
- try {
81
- this.setStatus('busy');
82
- console.log('Frontend Agent: Starting frontend development...');
83
- // Create HTML template
84
- const template = await this.createTemplate(requirements);
85
- // Create CSS styling
86
- const css = await this.createStyling(requirements);
87
- // Create client-side script
88
- const clientScript = await this.createClientScript(requirements);
89
- // Create option schema for widget configuration
90
- const optionSchema = await this.createOptionSchema(requirements);
91
- // Validate responsiveness and accessibility
92
- const validation = await this.validateImplementation({
93
- template,
94
- css,
95
- clientScript,
96
- requirements
97
- });
98
- console.log('Frontend Agent: Frontend development completed');
99
- return {
100
- success: true,
101
- artifact: {
102
- template,
103
- css,
104
- clientScript,
105
- optionSchema,
106
- validation
107
- },
108
- metadata: {
109
- duration: 0,
110
- performance: {
111
- template_complexity: this.assessTemplateComplexity(template),
112
- css_efficiency: this.assessCSSEfficiency(css),
113
- script_optimization: this.assessScriptOptimization(clientScript)
114
- },
115
- quality: {
116
- responsiveness_score: validation.responsiveness,
117
- accessibility_score: validation.accessibility,
118
- code_quality: validation.codeQuality
119
- }
120
- }
121
- };
122
- }
123
- catch (error) {
124
- console.error('Frontend Agent: Error in frontend development:', error);
125
- return this.handleError(error);
126
- }
127
- finally {
128
- this.setStatus('available');
129
- }
130
- }
131
- /**
132
- * Create responsive HTML template
133
- */
134
- async createTemplate(requirements) {
135
- console.log('Frontend Agent: Creating HTML template...');
136
- const { template: templateReq, design } = requirements;
137
- // Base template structure
138
- let template = `<div class="widget-container" ng-controller="WidgetController">`;
139
- // Add loading state
140
- template += `
141
- <div ng-if="data.loading" class="loading-container">
142
- <i class="fa fa-spinner fa-spin"></i>
143
- <span>Loading...</span>
144
- </div>`;
145
- // Main content based on layout
146
- switch (templateReq.layout) {
147
- case 'grid':
148
- template += this.createGridTemplate(templateReq, design);
149
- break;
150
- case 'table':
151
- template += this.createTableTemplate(templateReq, design);
152
- break;
153
- case 'centered':
154
- template += this.createCenteredTemplate(templateReq, design);
155
- break;
156
- case 'vertical':
157
- template += this.createVerticalTemplate(templateReq, design);
158
- break;
159
- default:
160
- template += this.createFlexibleTemplate(templateReq, design);
161
- }
162
- // Add error handling
163
- template += `
164
- <div ng-if="data.error" class="error-container alert alert-danger">
165
- <i class="fa fa-exclamation-triangle"></i>
166
- <span>{{data.error.message}}</span>
167
- </div>`;
168
- // Close main container
169
- template += `</div>`;
170
- // Add responsive meta and accessibility attributes
171
- template = this.enhanceTemplateAccessibility(template);
172
- return template;
173
- }
174
- /**
175
- * Create CSS styling
176
- */
177
- async createStyling(requirements) {
178
- console.log('Frontend Agent: Creating CSS styling...');
179
- const { styling, template: templateReq, design } = requirements;
180
- let css = `/* Widget Styles */
181
- .widget-container {
182
- width: 100%;
183
- height: 100%;
184
- font-family: 'Source Sans Pro', Arial, sans-serif;
185
- color: var(--text-primary, #333);
186
- background: var(--background-primary, #fff);
187
- border-radius: 4px;
188
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
189
- padding: 16px;
190
- box-sizing: border-box;
191
- }
192
-
193
- /* Loading States */
194
- .loading-container {
195
- display: flex;
196
- align-items: center;
197
- justify-content: center;
198
- gap: 8px;
199
- padding: 40px;
200
- color: var(--text-secondary, #666);
201
- }
202
-
203
- .loading-container .fa-spinner {
204
- animation: spin 1s linear infinite;
205
- }
206
-
207
- @keyframes spin {
208
- from { transform: rotate(0deg); }
209
- to { transform: rotate(360deg); }
210
- }
211
-
212
- /* Error States */
213
- .error-container {
214
- margin: 16px 0;
215
- padding: 12px;
216
- border-radius: 4px;
217
- display: flex;
218
- align-items: center;
219
- gap: 8px;
220
- }`;
221
- // Add layout-specific styles
222
- css += this.createLayoutStyles(templateReq.layout);
223
- // Add responsive styles
224
- if (templateReq.responsive) {
225
- css += this.createResponsiveStyles();
226
- }
227
- // Add accessibility styles
228
- css += this.createAccessibilityStyles();
229
- // Add theme-specific styles
230
- css += this.createThemeStyles(styling.theme);
231
- // Add custom CSS if provided
232
- if (styling.customCSS) {
233
- css += `\n/* Custom Styles */\n${styling.customCSS}`;
234
- }
235
- return css;
236
- }
237
- /**
238
- * Create client-side JavaScript
239
- */
240
- async createClientScript(requirements) {
241
- console.log('Frontend Agent: Creating client script...');
242
- const { clientScript: scriptReq } = requirements;
243
- let script = `function WidgetController($scope, $rootScope, spUtil, $timeout) {
244
- var c = this;
245
-
246
- // Initialize widget
247
- c.init = function() {
248
- $scope.data.loading = true;
249
- $scope.data.error = null;
250
-
251
- // Load initial data
252
- c.loadData();
253
-
254
- // Setup event listeners
255
- c.setupEventListeners();
256
- };
257
-
258
- // Load widget data
259
- c.loadData = function() {
260
- c.server.get().then(function(response) {
261
- $scope.data.loading = false;
262
-
263
- if (response.error) {
264
- $scope.data.error = response.error;
265
- return;
266
- }
267
-
268
- // Process server data
269
- c.processData(response);
270
-
271
- }).catch(function(error) {
272
- $scope.data.loading = false;
273
- $scope.data.error = {
274
- message: 'Failed to load data: ' + (error.message || 'Unknown error')
275
- };
276
- });
277
- };
278
-
279
- // Process server response
280
- c.processData = function(response) {
281
- $scope.data.items = response.items || [];
282
- $scope.data.total = response.total || 0;
283
- $scope.data.lastUpdated = new Date();
284
-
285
- // Trigger data processing events
286
- $rootScope.$broadcast('widget.dataLoaded', {
287
- widget: 'widget_name',
288
- data: $scope.data
289
- });
290
- };`;
291
- // Add event handling
292
- if (scriptReq.events.includes('onClick')) {
293
- script += `
294
-
295
- // Handle click events
296
- c.handleClick = function(item, event) {
297
- event.preventDefault();
298
-
299
- // Emit click event
300
- $rootScope.$broadcast('widget.itemClicked', {
301
- item: item,
302
- widget: 'widget_name'
303
- });
304
-
305
- // Custom click logic
306
- if (item.action) {
307
- c.executeAction(item.action, item);
308
- }
309
- };`;
310
- }
311
- if (scriptReq.events.includes('onChange')) {
312
- script += `
313
-
314
- // Handle change events
315
- c.handleChange = function(field, value, item) {
316
- // Validate input
317
- if (!c.validateInput(field, value)) {
318
- return;
319
- }
320
-
321
- // Update data
322
- item[field] = value;
323
-
324
- // Save changes
325
- c.saveChanges(item);
326
- };`;
327
- }
328
- if (scriptReq.events.includes('onUpdate')) {
329
- script += `
330
-
331
- // Handle real-time updates
332
- c.setupRealTimeUpdates = function() {
333
- // Setup periodic refresh
334
- var refreshInterval = setInterval(function() {
335
- if (!$scope.data.loading) {
336
- c.loadData();
337
- }
338
- }, 30000); // 30 seconds
339
-
340
- // Cleanup on scope destroy
341
- $scope.$on('$destroy', function() {
342
- clearInterval(refreshInterval);
343
- });
344
- };`;
345
- }
346
- // Add utility functions
347
- script += `
348
-
349
- // Setup event listeners
350
- c.setupEventListeners = function() {
351
- // Listen for external events
352
- $scope.$on('widget.refresh', function() {
353
- c.loadData();
354
- });
355
-
356
- $scope.$on('widget.configure', function(event, config) {
357
- $scope.options = angular.extend($scope.options, config);
358
- c.loadData();
359
- });
360
- };
361
-
362
- // Validate input
363
- c.validateInput = function(field, value) {
364
- // Basic validation
365
- if (!value && $scope.options.required && $scope.options.required.includes(field)) {
366
- spUtil.addErrorMessage('Field ' + field + ' is required');
367
- return false;
368
- }
369
-
370
- return true;
371
- };
372
-
373
- // Execute actions
374
- c.executeAction = function(action, item) {
375
- switch(action) {
376
- case 'view':
377
- spUtil.getURL('form', item.table, item.sys_id).then(function(url) {
378
- window.open(url, '_blank');
379
- });
380
- break;
381
- case 'edit':
382
- spUtil.getURL('form', item.table, item.sys_id + '&view=edit').then(function(url) {
383
- window.location.href = url;
384
- });
385
- break;
386
- default:
387
- console.log('Unknown action:', action);
388
- }
389
- };
390
-
391
- // Save changes
392
- c.saveChanges = function(item) {
393
- $scope.data.saving = true;
394
-
395
- c.server.update({
396
- action: 'save_item',
397
- item: item
398
- }).then(function(response) {
399
- $scope.data.saving = false;
400
-
401
- if (response.success) {
402
- spUtil.addInfoMessage('Changes saved successfully');
403
- } else {
404
- spUtil.addErrorMessage('Failed to save changes: ' + response.error);
405
- }
406
- });
407
- };
408
-
409
- // Initialize widget on load
410
- c.init();
411
- }`;
412
- return script;
413
- }
414
- /**
415
- * Create option schema for widget configuration
416
- */
417
- async createOptionSchema(requirements) {
418
- console.log('Frontend Agent: Creating option schema...');
419
- const schema = [
420
- {
421
- name: "title",
422
- label: "Widget Title",
423
- type: "string",
424
- default_value: "My Widget"
425
- },
426
- {
427
- name: "max_items",
428
- label: "Maximum Items",
429
- type: "integer",
430
- default_value: 10
431
- },
432
- {
433
- name: "refresh_interval",
434
- label: "Refresh Interval (seconds)",
435
- type: "integer",
436
- default_value: 30
437
- },
438
- {
439
- name: "show_icons",
440
- label: "Show Icons",
441
- type: "boolean",
442
- default_value: true
443
- }
444
- ];
445
- // Add responsive options
446
- if (requirements.template.responsive) {
447
- schema.push({
448
- name: "mobile_columns",
449
- label: "Mobile Columns",
450
- type: "integer",
451
- default_value: 1
452
- });
453
- }
454
- // Add accessibility options
455
- if (requirements.styling.accessibility) {
456
- schema.push({
457
- name: "high_contrast",
458
- label: "High Contrast Mode",
459
- type: "boolean",
460
- default_value: false
461
- });
462
- }
463
- return schema;
464
- }
465
- // Template creation methods
466
- createGridTemplate(templateReq, design) {
467
- return `
468
- <div class="grid-container" ng-if="!data.loading && !data.error">
469
- <div class="grid-header" ng-if="options.title">
470
- <h3>{{options.title}}</h3>
471
- </div>
472
- <div class="grid-content">
473
- <div class="grid-item" ng-repeat="item in data.items | limitTo:options.max_items"
474
- ng-click="c.handleClick(item, $event)"
475
- role="button" tabindex="0"
476
- aria-label="{{item.display_value || item.name}}">
477
- <div class="item-content">
478
- <i class="fa {{item.icon}}" ng-if="options.show_icons && item.icon"></i>
479
- <span class="item-title">{{item.display_value || item.name}}</span>
480
- <span class="item-description">{{item.description}}</span>
481
- </div>
482
- </div>
483
- </div>
484
- </div>`;
485
- }
486
- createTableTemplate(templateReq, design) {
487
- return `
488
- <div class="table-container" ng-if="!data.loading && !data.error">
489
- <div class="table-header" ng-if="options.title">
490
- <h3>{{options.title}}</h3>
491
- </div>
492
- <div class="table-content">
493
- <table class="table table-striped">
494
- <thead>
495
- <tr>
496
- <th ng-repeat="field in data.fields">{{field.label}}</th>
497
- <th>Actions</th>
498
- </tr>
499
- </thead>
500
- <tbody>
501
- <tr ng-repeat="item in data.items | limitTo:options.max_items">
502
- <td ng-repeat="field in data.fields">
503
- {{item[field.name]}}
504
- </td>
505
- <td>
506
- <button class="btn btn-sm btn-primary" ng-click="c.handleClick(item, $event)">
507
- View
508
- </button>
509
- </td>
510
- </tr>
511
- </tbody>
512
- </table>
513
- </div>
514
- </div>`;
515
- }
516
- createCenteredTemplate(templateReq, design) {
517
- return `
518
- <div class="centered-container" ng-if="!data.loading && !data.error">
519
- <div class="centered-content">
520
- <div class="chart-container" ng-if="data.chartData">
521
- <canvas id="widget-chart" width="400" height="200"></canvas>
522
- </div>
523
- <div class="stats-container">
524
- <div class="stat-item" ng-repeat="stat in data.stats">
525
- <span class="stat-label">{{stat.label}}</span>
526
- <span class="stat-value">{{stat.value}}</span>
527
- </div>
528
- </div>
529
- </div>
530
- </div>`;
531
- }
532
- createVerticalTemplate(templateReq, design) {
533
- return `
534
- <div class="vertical-container" ng-if="!data.loading && !data.error">
535
- <div class="form-section" ng-repeat="section in data.sections">
536
- <h4>{{section.title}}</h4>
537
- <div class="form-fields">
538
- <div class="field-group" ng-repeat="field in section.fields">
539
- <label>{{field.label}}</label>
540
- <input type="{{field.type}}"
541
- ng-model="field.value"
542
- ng-change="c.handleChange(field.name, field.value, section)"
543
- class="form-control">
544
- </div>
545
- </div>
546
- </div>
547
- </div>`;
548
- }
549
- createFlexibleTemplate(templateReq, design) {
550
- return `
551
- <div class="flexible-container" ng-if="!data.loading && !data.error">
552
- <div class="content-area">
553
- <div ng-repeat="item in data.items | limitTo:options.max_items"
554
- class="flexible-item"
555
- ng-click="c.handleClick(item, $event)">
556
- <div class="item-header">
557
- <span class="item-title">{{item.title || item.name}}</span>
558
- <span class="item-meta">{{item.updated_on | date}}</span>
559
- </div>
560
- <div class="item-body">
561
- <p>{{item.description || item.short_description}}</p>
562
- </div>
563
- </div>
564
- </div>
565
- </div>`;
566
- }
567
- // Styling methods
568
- createLayoutStyles(layout) {
569
- const layouts = {
570
- grid: `
571
- /* Grid Layout */
572
- .grid-container {
573
- display: flex;
574
- flex-direction: column;
575
- height: 100%;
576
- }
577
-
578
- .grid-content {
579
- display: grid;
580
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
581
- gap: 16px;
582
- padding: 16px 0;
583
- }
584
-
585
- .grid-item {
586
- background: var(--background-secondary, #f8f9fa);
587
- border-radius: 4px;
588
- padding: 16px;
589
- cursor: pointer;
590
- transition: all 0.2s ease;
591
- border: 1px solid transparent;
592
- }
593
-
594
- .grid-item:hover {
595
- background: var(--background-hover, #e9ecef);
596
- transform: translateY(-2px);
597
- box-shadow: 0 4px 8px rgba(0,0,0,0.1);
598
- }
599
-
600
- .grid-item:focus {
601
- outline: 2px solid var(--primary-color, #007bff);
602
- outline-offset: 2px;
603
- }`,
604
- table: `
605
- /* Table Layout */
606
- .table-container {
607
- display: flex;
608
- flex-direction: column;
609
- height: 100%;
610
- }
611
-
612
- .table-content {
613
- flex: 1;
614
- overflow: auto;
615
- }
616
-
617
- .table {
618
- width: 100%;
619
- border-collapse: collapse;
620
- }
621
-
622
- .table th {
623
- background: var(--background-secondary, #f8f9fa);
624
- padding: 12px;
625
- text-align: left;
626
- font-weight: 600;
627
- border-bottom: 2px solid var(--border-color, #dee2e6);
628
- }
629
-
630
- .table td {
631
- padding: 12px;
632
- border-bottom: 1px solid var(--border-color, #dee2e6);
633
- }
634
-
635
- .table-striped tbody tr:nth-child(odd) {
636
- background: var(--background-alternate, #f8f9fa);
637
- }`,
638
- centered: `
639
- /* Centered Layout */
640
- .centered-container {
641
- display: flex;
642
- align-items: center;
643
- justify-content: center;
644
- height: 100%;
645
- }
646
-
647
- .centered-content {
648
- text-align: center;
649
- max-width: 600px;
650
- }
651
-
652
- .chart-container {
653
- margin-bottom: 24px;
654
- }
655
-
656
- .stats-container {
657
- display: flex;
658
- justify-content: space-around;
659
- gap: 24px;
660
- }
661
-
662
- .stat-item {
663
- display: flex;
664
- flex-direction: column;
665
- align-items: center;
666
- }
667
-
668
- .stat-label {
669
- font-size: 14px;
670
- color: var(--text-secondary, #666);
671
- margin-bottom: 4px;
672
- }
673
-
674
- .stat-value {
675
- font-size: 24px;
676
- font-weight: 600;
677
- color: var(--primary-color, #007bff);
678
- }`,
679
- vertical: `
680
- /* Vertical Layout */
681
- .vertical-container {
682
- display: flex;
683
- flex-direction: column;
684
- gap: 24px;
685
- }
686
-
687
- .form-section h4 {
688
- margin: 0 0 16px 0;
689
- color: var(--text-primary, #333);
690
- border-bottom: 1px solid var(--border-color, #dee2e6);
691
- padding-bottom: 8px;
692
- }
693
-
694
- .form-fields {
695
- display: flex;
696
- flex-direction: column;
697
- gap: 16px;
698
- }
699
-
700
- .field-group {
701
- display: flex;
702
- flex-direction: column;
703
- gap: 4px;
704
- }
705
-
706
- .field-group label {
707
- font-weight: 500;
708
- color: var(--text-secondary, #666);
709
- }
710
-
711
- .form-control {
712
- padding: 8px 12px;
713
- border: 1px solid var(--border-color, #dee2e6);
714
- border-radius: 4px;
715
- transition: border-color 0.2s ease;
716
- }
717
-
718
- .form-control:focus {
719
- outline: none;
720
- border-color: var(--primary-color, #007bff);
721
- box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
722
- }`,
723
- flexible: `
724
- /* Flexible Layout */
725
- .flexible-container {
726
- display: flex;
727
- flex-direction: column;
728
- gap: 16px;
729
- }
730
-
731
- .flexible-item {
732
- background: var(--background-secondary, #f8f9fa);
733
- border-radius: 4px;
734
- padding: 16px;
735
- cursor: pointer;
736
- transition: all 0.2s ease;
737
- border-left: 4px solid transparent;
738
- }
739
-
740
- .flexible-item:hover {
741
- background: var(--background-hover, #e9ecef);
742
- border-left-color: var(--primary-color, #007bff);
743
- }
744
-
745
- .item-header {
746
- display: flex;
747
- justify-content: space-between;
748
- align-items: center;
749
- margin-bottom: 8px;
750
- }
751
-
752
- .item-title {
753
- font-weight: 500;
754
- color: var(--text-primary, #333);
755
- }
756
-
757
- .item-meta {
758
- font-size: 12px;
759
- color: var(--text-secondary, #666);
760
- }
761
-
762
- .item-body p {
763
- margin: 0;
764
- color: var(--text-secondary, #666);
765
- line-height: 1.4;
766
- }`
767
- };
768
- return layouts[layout] || layouts.flexible;
769
- }
770
- createResponsiveStyles() {
771
- return `
772
- /* Responsive Styles */
773
- @media (max-width: 768px) {
774
- .grid-content {
775
- grid-template-columns: repeat(var(--mobile-columns, 1), 1fr);
776
- }
777
-
778
- .table-content {
779
- overflow-x: auto;
780
- }
781
-
782
- .stats-container {
783
- flex-direction: column;
784
- gap: 16px;
785
- }
786
-
787
- .item-header {
788
- flex-direction: column;
789
- align-items: flex-start;
790
- gap: 4px;
791
- }
792
- }
793
-
794
- @media (max-width: 480px) {
795
- .widget-container {
796
- padding: 12px;
797
- }
798
-
799
- .grid-content {
800
- gap: 12px;
801
- }
802
-
803
- .grid-item {
804
- padding: 12px;
805
- }
806
- }`;
807
- }
808
- createAccessibilityStyles() {
809
- return `
810
- /* Accessibility Styles */
811
- .widget-container:focus-within {
812
- outline: 2px solid var(--focus-color, #007bff);
813
- outline-offset: 2px;
814
- }
815
-
816
- /* High contrast mode */
817
- @media (prefers-contrast: high) {
818
- .widget-container {
819
- border: 2px solid currentColor;
820
- }
821
-
822
- .grid-item,
823
- .flexible-item {
824
- border: 1px solid currentColor;
825
- }
826
- }
827
-
828
- /* Reduced motion */
829
- @media (prefers-reduced-motion: reduce) {
830
- .grid-item,
831
- .flexible-item,
832
- .form-control {
833
- transition: none;
834
- }
835
-
836
- .loading-container .fa-spinner {
837
- animation: none;
838
- }
839
- }
840
-
841
- /* Focus management */
842
- .sr-only {
843
- position: absolute;
844
- width: 1px;
845
- height: 1px;
846
- padding: 0;
847
- margin: -1px;
848
- overflow: hidden;
849
- clip: rect(0, 0, 0, 0);
850
- white-space: nowrap;
851
- border: 0;
852
- }
853
-
854
- /* Keyboard navigation */
855
- [role="button"]:focus,
856
- button:focus,
857
- .form-control:focus {
858
- outline: 2px solid var(--focus-color, #007bff);
859
- outline-offset: 2px;
860
- }`;
861
- }
862
- createThemeStyles(theme) {
863
- const themes = {
864
- light: `
865
- /* Light Theme */
866
- :root {
867
- --background-primary: #ffffff;
868
- --background-secondary: #f8f9fa;
869
- --background-hover: #e9ecef;
870
- --background-alternate: #f8f9fa;
871
- --text-primary: #333333;
872
- --text-secondary: #666666;
873
- --border-color: #dee2e6;
874
- --primary-color: #007bff;
875
- --focus-color: #007bff;
876
- }`,
877
- dark: `
878
- /* Dark Theme */
879
- :root {
880
- --background-primary: #1a1a1a;
881
- --background-secondary: #2d2d2d;
882
- --background-hover: #404040;
883
- --background-alternate: #2d2d2d;
884
- --text-primary: #ffffff;
885
- --text-secondary: #cccccc;
886
- --border-color: #555555;
887
- --primary-color: #0d6efd;
888
- --focus-color: #0d6efd;
889
- }`,
890
- servicenow: `
891
- /* ServiceNow Theme */
892
- :root {
893
- --background-primary: #ffffff;
894
- --background-secondary: #f4f6f8;
895
- --background-hover: #e8ebef;
896
- --background-alternate: #f9fafb;
897
- --text-primary: #293e40;
898
- --text-secondary: #6c7b7f;
899
- --border-color: #dae1e7;
900
- --primary-color: #0f62fe;
901
- --focus-color: #0f62fe;
902
- }`
903
- };
904
- return themes[theme] || themes.light;
905
- }
906
- enhanceTemplateAccessibility(template) {
907
- // Add ARIA labels and roles where needed
908
- template = template.replace(/ng-repeat="([^"]+)"/g, 'ng-repeat="$1" role="listitem" tabindex="0"');
909
- // Add semantic HTML where possible
910
- template = template.replace(/<div class="grid-container"/g, '<section class="grid-container" role="region" aria-label="Widget content"');
911
- return template;
912
- }
913
- // Analysis methods
914
- analyzeTemplateNeeds(requirements) {
915
- return {
916
- complexity: requirements.template.components.length > 5 ? 'high' : 'medium',
917
- components: requirements.template.components,
918
- responsive: requirements.template.responsive
919
- };
920
- }
921
- analyzeStylingNeeds(requirements) {
922
- return {
923
- theme: requirements.styling.theme,
924
- customizations: !!requirements.styling.customCSS,
925
- accessibility: requirements.styling.accessibility
926
- };
927
- }
928
- analyzeScriptingNeeds(requirements) {
929
- return {
930
- complexity: requirements.clientScript.events.length > 3 ? 'high' : 'medium',
931
- events: requirements.clientScript.events,
932
- apiCalls: requirements.clientScript.apiCalls
933
- };
934
- }
935
- analyzeResponsiveNeeds(requirements) {
936
- return {
937
- required: requirements.template.responsive,
938
- breakpoints: ['mobile', 'tablet', 'desktop']
939
- };
940
- }
941
- analyzeAccessibilityNeeds(requirements) {
942
- return {
943
- required: requirements.styling.accessibility,
944
- standards: ['WCAG 2.1 AA'],
945
- features: ['keyboard_navigation', 'screen_reader', 'high_contrast']
946
- };
947
- }
948
- // Validation methods
949
- async validateImplementation(implementation) {
950
- return {
951
- responsiveness: this.validateResponsiveness(implementation),
952
- accessibility: this.validateAccessibility(implementation),
953
- codeQuality: this.validateCodeQuality(implementation)
954
- };
955
- }
956
- validateResponsiveness(implementation) {
957
- // Simple validation - in real implementation, this would be more sophisticated
958
- const hasMediaQueries = implementation.css.includes('@media');
959
- const hasFlexbox = implementation.css.includes('flex');
960
- const hasGrid = implementation.css.includes('grid');
961
- let score = 0.5;
962
- if (hasMediaQueries)
963
- score += 0.3;
964
- if (hasFlexbox || hasGrid)
965
- score += 0.2;
966
- return Math.min(score, 1.0);
967
- }
968
- validateAccessibility(implementation) {
969
- const hasAriaLabels = implementation.template.includes('aria-label');
970
- const hasSemanticHTML = implementation.template.includes('role=');
971
- const hasFocusStyles = implementation.css.includes(':focus');
972
- let score = 0.3;
973
- if (hasAriaLabels)
974
- score += 0.3;
975
- if (hasSemanticHTML)
976
- score += 0.2;
977
- if (hasFocusStyles)
978
- score += 0.2;
979
- return Math.min(score, 1.0);
980
- }
981
- validateCodeQuality(implementation) {
982
- // Basic code quality checks
983
- const hasErrorHandling = implementation.clientScript.includes('catch');
984
- const hasValidation = implementation.clientScript.includes('validateInput');
985
- const hasComments = implementation.clientScript.includes('//');
986
- let score = 0.4;
987
- if (hasErrorHandling)
988
- score += 0.2;
989
- if (hasValidation)
990
- score += 0.2;
991
- if (hasComments)
992
- score += 0.2;
993
- return Math.min(score, 1.0);
994
- }
995
- // Assessment methods
996
- assessTemplateComplexity(template) {
997
- const components = (template.match(/ng-/g) || []).length;
998
- return Math.min(components / 20, 1.0);
999
- }
1000
- assessCSSEfficiency(css) {
1001
- const rules = (css.match(/\{[^}]+\}/g) || []).length;
1002
- const mediaQueries = (css.match(/@media/g) || []).length;
1003
- // Efficiency based on rule count and media query usage
1004
- return Math.max(0.5, 1.0 - (rules / 100) + (mediaQueries * 0.1));
1005
- }
1006
- assessScriptOptimization(script) {
1007
- const functions = (script.match(/function|=>/g) || []).length;
1008
- const eventListeners = (script.match(/\$on\(/g) || []).length;
1009
- // Optimization based on function count and event management
1010
- return Math.max(0.5, 1.0 - (functions / 20) + (eventListeners * 0.05));
1011
- }
1012
- }
1013
- exports.WidgetFrontendAgent = WidgetFrontendAgent;
1014
- //# sourceMappingURL=widget-frontend.agent.js.map