snow-flow 1.1.61 → 1.1.63

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 (153) hide show
  1. package/dist/agents/base/base-snow-agent.d.ts +75 -0
  2. package/dist/agents/base/base-snow-agent.d.ts.map +1 -0
  3. package/dist/agents/base/base-snow-agent.js +169 -0
  4. package/dist/agents/base/base-snow-agent.js.map +1 -0
  5. package/dist/agents/specialists/automation-specialist.agent.d.ts +44 -0
  6. package/dist/agents/specialists/automation-specialist.agent.d.ts.map +1 -0
  7. package/dist/agents/specialists/automation-specialist.agent.js +204 -0
  8. package/dist/agents/specialists/automation-specialist.agent.js.map +1 -0
  9. package/dist/agents/specialists/data-specialist.agent.d.ts +165 -0
  10. package/dist/agents/specialists/data-specialist.agent.d.ts.map +1 -0
  11. package/dist/agents/specialists/data-specialist.agent.js +484 -0
  12. package/dist/agents/specialists/data-specialist.agent.js.map +1 -0
  13. package/dist/agents/specialists/integration-specialist.agent.d.ts +227 -0
  14. package/dist/agents/specialists/integration-specialist.agent.d.ts.map +1 -0
  15. package/dist/agents/specialists/integration-specialist.agent.js +725 -0
  16. package/dist/agents/specialists/integration-specialist.agent.js.map +1 -0
  17. package/dist/agents/specialists/reporting-specialist.agent.d.ts +54 -0
  18. package/dist/agents/specialists/reporting-specialist.agent.d.ts.map +1 -0
  19. package/dist/agents/specialists/reporting-specialist.agent.js +193 -0
  20. package/dist/agents/specialists/reporting-specialist.agent.js.map +1 -0
  21. package/dist/agents/specialists/security-specialist.agent.d.ts +85 -0
  22. package/dist/agents/specialists/security-specialist.agent.d.ts.map +1 -0
  23. package/dist/agents/specialists/security-specialist.agent.js +309 -0
  24. package/dist/agents/specialists/security-specialist.agent.js.map +1 -0
  25. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +111 -0
  26. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts.map +1 -0
  27. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +383 -0
  28. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js.map +1 -0
  29. package/dist/agents/teams/base-team.d.ts +72 -0
  30. package/dist/agents/teams/base-team.d.ts.map +1 -0
  31. package/dist/agents/teams/base-team.js +253 -0
  32. package/dist/agents/teams/base-team.js.map +1 -0
  33. package/dist/agents/teams/team-types.d.ts +265 -0
  34. package/dist/agents/teams/team-types.d.ts.map +1 -0
  35. package/dist/agents/teams/team-types.js +3 -0
  36. package/dist/agents/teams/team-types.js.map +1 -0
  37. package/dist/agents/teams/widget/widget-architect.agent.d.ts +61 -0
  38. package/dist/agents/teams/widget/widget-architect.agent.d.ts.map +1 -0
  39. package/dist/agents/teams/widget/widget-architect.agent.js +436 -0
  40. package/dist/agents/teams/widget/widget-architect.agent.js.map +1 -0
  41. package/dist/agents/teams/widget/widget-backend.agent.d.ts +74 -0
  42. package/dist/agents/teams/widget/widget-backend.agent.d.ts.map +1 -0
  43. package/dist/agents/teams/widget/widget-backend.agent.js +1531 -0
  44. package/dist/agents/teams/widget/widget-backend.agent.js.map +1 -0
  45. package/dist/agents/teams/widget/widget-frontend.agent.d.ts +67 -0
  46. package/dist/agents/teams/widget/widget-frontend.agent.d.ts.map +1 -0
  47. package/dist/agents/teams/widget/widget-frontend.agent.js +1014 -0
  48. package/dist/agents/teams/widget/widget-frontend.agent.js.map +1 -0
  49. package/dist/agents/teams/widget/widget-platform.agent.d.ts +90 -0
  50. package/dist/agents/teams/widget/widget-platform.agent.d.ts.map +1 -0
  51. package/dist/agents/teams/widget/widget-platform.agent.js +1190 -0
  52. package/dist/agents/teams/widget/widget-platform.agent.js.map +1 -0
  53. package/dist/agents/teams/widget/widget-uiux.agent.d.ts +107 -0
  54. package/dist/agents/teams/widget/widget-uiux.agent.d.ts.map +1 -0
  55. package/dist/agents/teams/widget/widget-uiux.agent.js +1033 -0
  56. package/dist/agents/teams/widget/widget-uiux.agent.js.map +1 -0
  57. package/dist/assembly/team-assembler.d.ts +140 -0
  58. package/dist/assembly/team-assembler.d.ts.map +1 -0
  59. package/dist/assembly/team-assembler.js +502 -0
  60. package/dist/assembly/team-assembler.js.map +1 -0
  61. package/dist/cli.js +165 -12
  62. package/dist/cli.js.map +1 -1
  63. package/dist/intelligence/task-analyzer.d.ts +119 -0
  64. package/dist/intelligence/task-analyzer.d.ts.map +1 -0
  65. package/dist/intelligence/task-analyzer.js +494 -0
  66. package/dist/intelligence/task-analyzer.js.map +1 -0
  67. package/dist/patterns/adaptive-patterns.d.ts +140 -0
  68. package/dist/patterns/adaptive-patterns.d.ts.map +1 -0
  69. package/dist/patterns/adaptive-patterns.js +549 -0
  70. package/dist/patterns/adaptive-patterns.js.map +1 -0
  71. package/dist/sparc/coordinators/adaptive-coordinator.d.ts +54 -0
  72. package/dist/sparc/coordinators/adaptive-coordinator.d.ts.map +1 -0
  73. package/dist/sparc/coordinators/adaptive-coordinator.js +367 -0
  74. package/dist/sparc/coordinators/adaptive-coordinator.js.map +1 -0
  75. package/dist/sparc/coordinators/team-coordinator.d.ts +66 -0
  76. package/dist/sparc/coordinators/team-coordinator.d.ts.map +1 -0
  77. package/dist/sparc/coordinators/team-coordinator.js +402 -0
  78. package/dist/sparc/coordinators/team-coordinator.js.map +1 -0
  79. package/dist/sparc/modes/team-modes.d.ts +33 -0
  80. package/dist/sparc/modes/team-modes.d.ts.map +1 -0
  81. package/dist/sparc/modes/team-modes.js +399 -0
  82. package/dist/sparc/modes/team-modes.js.map +1 -0
  83. package/dist/sparc/sparc-help.d.ts +8 -0
  84. package/dist/sparc/sparc-help.d.ts.map +1 -0
  85. package/dist/sparc/sparc-help.js +299 -0
  86. package/dist/sparc/sparc-help.js.map +1 -0
  87. package/dist/sparc/team-sparc.d.ts +33 -0
  88. package/dist/sparc/team-sparc.d.ts.map +1 -0
  89. package/dist/sparc/team-sparc.js +217 -0
  90. package/dist/sparc/team-sparc.js.map +1 -0
  91. package/dist/sparc/teams/application-team.d.ts +73 -0
  92. package/dist/sparc/teams/application-team.d.ts.map +1 -0
  93. package/dist/sparc/teams/application-team.js +463 -0
  94. package/dist/sparc/teams/application-team.js.map +1 -0
  95. package/dist/sparc/teams/flow-team.d.ts +67 -0
  96. package/dist/sparc/teams/flow-team.d.ts.map +1 -0
  97. package/dist/sparc/teams/flow-team.js +373 -0
  98. package/dist/sparc/teams/flow-team.js.map +1 -0
  99. package/dist/sparc/teams/widget-team.d.ts +61 -0
  100. package/dist/sparc/teams/widget-team.d.ts.map +1 -0
  101. package/dist/sparc/teams/widget-team.js +280 -0
  102. package/dist/sparc/teams/widget-team.js.map +1 -0
  103. package/dist/specialists/app-specialists.d.ts +93 -0
  104. package/dist/specialists/app-specialists.d.ts.map +1 -0
  105. package/dist/specialists/app-specialists.js +1639 -0
  106. package/dist/specialists/app-specialists.js.map +1 -0
  107. package/dist/specialists/base-specialist.d.ts +19 -0
  108. package/dist/specialists/base-specialist.d.ts.map +1 -0
  109. package/dist/specialists/base-specialist.js +54 -0
  110. package/dist/specialists/base-specialist.js.map +1 -0
  111. package/dist/specialists/flow-specialists.d.ts +113 -0
  112. package/dist/specialists/flow-specialists.d.ts.map +1 -0
  113. package/dist/specialists/flow-specialists.js +1787 -0
  114. package/dist/specialists/flow-specialists.js.map +1 -0
  115. package/dist/specialists/individual-specialists.d.ts +67 -0
  116. package/dist/specialists/individual-specialists.d.ts.map +1 -0
  117. package/dist/specialists/individual-specialists.js +632 -0
  118. package/dist/specialists/individual-specialists.js.map +1 -0
  119. package/dist/specialists/widget-specialists.d.ts +70 -0
  120. package/dist/specialists/widget-specialists.d.ts.map +1 -0
  121. package/dist/specialists/widget-specialists.js +1264 -0
  122. package/dist/specialists/widget-specialists.js.map +1 -0
  123. package/dist/teams/adaptive-team.d.ts +81 -0
  124. package/dist/teams/adaptive-team.d.ts.map +1 -0
  125. package/dist/teams/adaptive-team.js +1153 -0
  126. package/dist/teams/adaptive-team.js.map +1 -0
  127. package/dist/teams/application-team.d.ts +30 -0
  128. package/dist/teams/application-team.d.ts.map +1 -0
  129. package/dist/teams/application-team.js +547 -0
  130. package/dist/teams/application-team.js.map +1 -0
  131. package/dist/teams/base-team.d.ts +55 -0
  132. package/dist/teams/base-team.d.ts.map +1 -0
  133. package/dist/teams/base-team.js +243 -0
  134. package/dist/teams/base-team.js.map +1 -0
  135. package/dist/teams/flow-team.d.ts +28 -0
  136. package/dist/teams/flow-team.d.ts.map +1 -0
  137. package/dist/teams/flow-team.js +525 -0
  138. package/dist/teams/flow-team.js.map +1 -0
  139. package/dist/teams/widget-team.d.ts +26 -0
  140. package/dist/teams/widget-team.d.ts.map +1 -0
  141. package/dist/teams/widget-team.js +459 -0
  142. package/dist/teams/widget-team.js.map +1 -0
  143. package/dist/types/index.d.ts +2 -0
  144. package/dist/types/index.d.ts.map +1 -1
  145. package/dist/types/index.js +17 -0
  146. package/dist/types/index.js.map +1 -1
  147. package/dist/utils/agent-detector.js +1 -1
  148. package/dist/utils/agent-detector.js.map +1 -1
  149. package/dist/version.d.ts +6 -1
  150. package/dist/version.d.ts.map +1 -1
  151. package/dist/version.js +44 -9
  152. package/dist/version.js.map +1 -1
  153. package/package.json +1 -1
@@ -0,0 +1,725 @@
1
+ "use strict";
2
+ /**
3
+ * Integration Specialist Agent - Handles system integrations, APIs, and data synchronization
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IntegrationSpecialistAgent = void 0;
7
+ const base_snow_agent_js_1 = require("../base/base-snow-agent.js");
8
+ class IntegrationSpecialistAgent extends base_snow_agent_js_1.BaseSnowAgent {
9
+ constructor() {
10
+ const capabilities = {
11
+ primarySkills: [
12
+ 'api_integration',
13
+ 'data_synchronization',
14
+ 'system_connectivity',
15
+ 'authentication_setup',
16
+ 'error_handling',
17
+ 'monitoring_setup'
18
+ ],
19
+ secondarySkills: [
20
+ 'performance_optimization',
21
+ 'security_configuration',
22
+ 'testing_automation',
23
+ 'documentation',
24
+ 'troubleshooting'
25
+ ],
26
+ complexity: 'high',
27
+ autonomy: 'semi-autonomous'
28
+ };
29
+ super('integration-specialist', 'IntegrationSpecialist', capabilities);
30
+ }
31
+ /**
32
+ * Execute integration-related tasks
33
+ */
34
+ async execute(task, input) {
35
+ await this.startTask(task);
36
+ try {
37
+ const taskType = task.metadata?.type || 'integration_analysis';
38
+ let result;
39
+ switch (taskType) {
40
+ case 'integration_analysis':
41
+ result = await this.analyzeIntegrationNeeds(task.description, input);
42
+ break;
43
+ case 'integration_design':
44
+ result = await this.createIntegration(input?.requirements || {});
45
+ break;
46
+ case 'api_setup':
47
+ result = await this.setupAPIIntegration(input?.config || {});
48
+ break;
49
+ case 'data_sync':
50
+ result = await this.setupDataSynchronization(input?.mapping || {});
51
+ break;
52
+ case 'monitoring_setup':
53
+ result = await this.setupMonitoring(input?.requirements || {});
54
+ break;
55
+ case 'testing_setup':
56
+ result = await this.setupIntegrationTesting(input?.config || {});
57
+ break;
58
+ default:
59
+ result = await this.analyzeIntegrationNeeds(task.description, input);
60
+ }
61
+ await this.completeTask(result);
62
+ return result;
63
+ }
64
+ catch (error) {
65
+ await this.handleError(error);
66
+ throw error;
67
+ }
68
+ }
69
+ /**
70
+ * Analyze integration needs from description
71
+ */
72
+ async analyzeIntegrationNeeds(description, context) {
73
+ this.logger.info('Analyzing integration needs', { description });
74
+ try {
75
+ const normalizedDesc = description.toLowerCase();
76
+ // Identify source and target systems
77
+ const sourceSystem = this.identifySourceSystem(normalizedDesc);
78
+ const targetSystem = this.identifyTargetSystem(normalizedDesc);
79
+ // Determine synchronization type
80
+ const synchronizationType = this.determineSyncType(normalizedDesc);
81
+ // Plan data mapping
82
+ const dataMapping = await this.planDataMapping(normalizedDesc, context);
83
+ // Configure authentication
84
+ const authentication = this.configureAuthentication(normalizedDesc);
85
+ // Setup error handling
86
+ const errorHandling = this.setupErrorHandling(normalizedDesc);
87
+ // Configure monitoring
88
+ const monitoring = this.configureMonitoring(normalizedDesc);
89
+ const requirements = {
90
+ sourceSystem,
91
+ targetSystem,
92
+ dataMapping,
93
+ synchronizationType,
94
+ authentication,
95
+ errorHandling,
96
+ monitoring
97
+ };
98
+ this.logger.info('Integration needs analysis completed', {
99
+ sourceType: sourceSystem.type,
100
+ targetType: targetSystem.type,
101
+ syncType: synchronizationType,
102
+ mappingCount: dataMapping.length
103
+ });
104
+ return requirements;
105
+ }
106
+ catch (error) {
107
+ this.logger.error('Integration needs analysis failed', error);
108
+ throw error;
109
+ }
110
+ }
111
+ /**
112
+ * Create comprehensive integration solution
113
+ */
114
+ async createIntegration(requirements) {
115
+ this.logger.info('Creating integration solution', { requirements });
116
+ try {
117
+ // Generate unique integration ID
118
+ const integrationId = `integration_${Date.now()}`;
119
+ // Create integration components
120
+ const components = await this.createIntegrationComponents(requirements);
121
+ // Setup deployment configuration
122
+ const deployment = this.createDeploymentConfig(requirements);
123
+ // Setup testing configuration
124
+ const testing = this.createTestingConfig(requirements);
125
+ // Setup documentation
126
+ const documentation = this.createDocumentationConfig(requirements);
127
+ const integration = {
128
+ id: integrationId,
129
+ name: `${requirements.sourceSystem.name} to ${requirements.targetSystem.name} Integration`,
130
+ description: `Integration between ${requirements.sourceSystem.name} and ${requirements.targetSystem.name}`,
131
+ requirements,
132
+ components,
133
+ deployment,
134
+ testing,
135
+ documentation
136
+ };
137
+ // Validate integration design
138
+ await this.validateIntegrationDesign(integration);
139
+ this.logger.info('Integration solution created successfully', {
140
+ integrationId,
141
+ componentCount: components.length
142
+ });
143
+ return integration;
144
+ }
145
+ catch (error) {
146
+ this.logger.error('Integration creation failed', error);
147
+ throw error;
148
+ }
149
+ }
150
+ /**
151
+ * Setup API integration
152
+ */
153
+ async setupAPIIntegration(config) {
154
+ this.logger.info('Setting up API integration', { config });
155
+ const apiComponents = {
156
+ restMessage: {
157
+ name: `${config.name}_rest_message`,
158
+ endpoint: config.endpoint || 'https://api.example.com',
159
+ authentication: config.authentication || { type: 'api-key' },
160
+ methods: [
161
+ {
162
+ name: 'GET',
163
+ httpMethod: 'GET',
164
+ endpoint: '/data',
165
+ headers: { 'Content-Type': 'application/json' }
166
+ },
167
+ {
168
+ name: 'POST',
169
+ httpMethod: 'POST',
170
+ endpoint: '/data',
171
+ headers: { 'Content-Type': 'application/json' }
172
+ }
173
+ ]
174
+ },
175
+ transformMap: {
176
+ name: `${config.name}_transform_map`,
177
+ sourceTable: 'import_set_table',
178
+ targetTable: config.targetTable || 'custom_table',
179
+ fieldMappings: config.fieldMappings || []
180
+ },
181
+ scheduledJob: {
182
+ name: `${config.name}_sync_job`,
183
+ schedule: config.schedule || 'daily',
184
+ script: this.generateSyncScript(config)
185
+ }
186
+ };
187
+ return {
188
+ success: true,
189
+ components: apiComponents,
190
+ recommendations: [
191
+ 'Test API connectivity before full deployment',
192
+ 'Setup monitoring for API health',
193
+ 'Implement proper error handling and retries'
194
+ ]
195
+ };
196
+ }
197
+ /**
198
+ * Setup data synchronization
199
+ */
200
+ async setupDataSynchronization(mapping) {
201
+ this.logger.info('Setting up data synchronization', { mapping });
202
+ const syncConfig = {
203
+ schedule: mapping.schedule || 'hourly',
204
+ direction: mapping.direction || 'bidirectional',
205
+ conflictResolution: mapping.conflictResolution || 'last_write_wins',
206
+ batchSize: mapping.batchSize || 100,
207
+ incrementalSync: mapping.incrementalSync !== false,
208
+ validation: {
209
+ enabled: true,
210
+ rules: [
211
+ 'required_fields_check',
212
+ 'data_type_validation',
213
+ 'business_rule_validation'
214
+ ]
215
+ },
216
+ monitoring: {
217
+ successMetrics: true,
218
+ errorTracking: true,
219
+ performanceMonitoring: true
220
+ }
221
+ };
222
+ return {
223
+ success: true,
224
+ configuration: syncConfig,
225
+ estimatedSetupTime: '2-4 hours',
226
+ requirements: [
227
+ 'Source system API access',
228
+ 'Target system write permissions',
229
+ 'Monitoring dashboard setup'
230
+ ]
231
+ };
232
+ }
233
+ /**
234
+ * Setup monitoring for integration
235
+ */
236
+ async setupMonitoring(requirements) {
237
+ this.logger.info('Setting up integration monitoring', { requirements });
238
+ const monitoringSetup = {
239
+ healthChecks: [
240
+ {
241
+ name: 'API Connectivity',
242
+ endpoint: '/health',
243
+ interval: 300, // 5 minutes
244
+ timeout: 30000, // 30 seconds
245
+ alerts: ['email', 'slack']
246
+ },
247
+ {
248
+ name: 'Data Sync Status',
249
+ check: 'last_sync_timestamp',
250
+ threshold: 3600000, // 1 hour
251
+ alerts: ['email']
252
+ }
253
+ ],
254
+ metrics: [
255
+ 'request_count',
256
+ 'response_time',
257
+ 'error_rate',
258
+ 'sync_success_rate',
259
+ 'data_throughput'
260
+ ],
261
+ dashboards: [
262
+ {
263
+ name: 'Integration Overview',
264
+ widgets: ['status', 'metrics', 'recent_errors']
265
+ },
266
+ {
267
+ name: 'Performance Dashboard',
268
+ widgets: ['response_times', 'throughput', 'error_trends']
269
+ }
270
+ ],
271
+ alerting: {
272
+ thresholds: {
273
+ error_rate: { warning: 0.05, critical: 0.1 },
274
+ response_time: { warning: 5000, critical: 10000 },
275
+ sync_delay: { warning: 3600, critical: 7200 }
276
+ },
277
+ channels: requirements.alertChannels || ['email']
278
+ }
279
+ };
280
+ return {
281
+ success: true,
282
+ monitoring: monitoringSetup,
283
+ implementation: {
284
+ effort: 'medium',
285
+ duration: '1-2 days',
286
+ dependencies: ['monitoring tools', 'alert channels']
287
+ }
288
+ };
289
+ }
290
+ /**
291
+ * Setup integration testing
292
+ */
293
+ async setupIntegrationTesting(config) {
294
+ this.logger.info('Setting up integration testing', { config });
295
+ const testingFramework = {
296
+ unitTests: [
297
+ {
298
+ name: 'Data Transformation Test',
299
+ description: 'Verify data mapping and transformation',
300
+ testData: 'sample_input.json',
301
+ assertions: ['field_mapping', 'data_types', 'validation_rules']
302
+ },
303
+ {
304
+ name: 'Authentication Test',
305
+ description: 'Verify authentication mechanisms',
306
+ testData: 'auth_credentials.json',
307
+ assertions: ['token_generation', 'token_validation', 'refresh_flow']
308
+ }
309
+ ],
310
+ integrationTests: [
311
+ {
312
+ name: 'End-to-End Sync Test',
313
+ description: 'Full integration workflow test',
314
+ scenario: 'create_update_sync_verify',
315
+ dataSet: 'integration_test_data.json'
316
+ },
317
+ {
318
+ name: 'Error Handling Test',
319
+ description: 'Test error scenarios and recovery',
320
+ scenarios: ['network_timeout', 'auth_failure', 'data_validation_error']
321
+ }
322
+ ],
323
+ performanceTests: [
324
+ {
325
+ name: 'Load Test',
326
+ load: 100, // requests per second
327
+ duration: 300, // 5 minutes
328
+ expectedResponseTime: 2000 // 2 seconds
329
+ },
330
+ {
331
+ name: 'Stress Test',
332
+ load: 500,
333
+ duration: 600,
334
+ expectedResponseTime: 5000
335
+ }
336
+ ],
337
+ mockServices: {
338
+ enabled: true,
339
+ scenarios: [
340
+ 'success_responses',
341
+ 'error_responses',
342
+ 'timeout_scenarios',
343
+ 'partial_failures'
344
+ ]
345
+ }
346
+ };
347
+ return {
348
+ success: true,
349
+ testing: testingFramework,
350
+ automation: {
351
+ cicdIntegration: true,
352
+ continuousTesting: true,
353
+ reportGeneration: true
354
+ }
355
+ };
356
+ }
357
+ /**
358
+ * Identify source system from description
359
+ */
360
+ identifySourceSystem(description) {
361
+ // Common system patterns
362
+ if (description.includes('salesforce') || description.includes('sfdc')) {
363
+ return {
364
+ name: 'Salesforce',
365
+ type: 'REST',
366
+ baseUrl: 'https://instance.salesforce.com',
367
+ protocol: 'HTTPS',
368
+ port: 443
369
+ };
370
+ }
371
+ if (description.includes('sap') || description.includes('erp')) {
372
+ return {
373
+ name: 'SAP',
374
+ type: 'SOAP',
375
+ protocol: 'HTTPS',
376
+ port: 443
377
+ };
378
+ }
379
+ if (description.includes('database') || description.includes('sql')) {
380
+ return {
381
+ name: 'Database',
382
+ type: 'Database',
383
+ port: 1433
384
+ };
385
+ }
386
+ // Default REST API
387
+ return {
388
+ name: 'External System',
389
+ type: 'REST',
390
+ protocol: 'HTTPS',
391
+ port: 443
392
+ };
393
+ }
394
+ /**
395
+ * Identify target system (usually ServiceNow)
396
+ */
397
+ identifyTargetSystem(description) {
398
+ return {
399
+ name: 'ServiceNow',
400
+ type: 'REST',
401
+ baseUrl: `https://${process.env.SNOW_INSTANCE || 'instance'}.service-now.com`,
402
+ protocol: 'HTTPS',
403
+ port: 443
404
+ };
405
+ }
406
+ /**
407
+ * Determine synchronization type
408
+ */
409
+ determineSyncType(description) {
410
+ if (description.includes('real-time') || description.includes('immediate')) {
411
+ return 'real-time';
412
+ }
413
+ if (description.includes('batch') || description.includes('scheduled')) {
414
+ return 'batch';
415
+ }
416
+ if (description.includes('on-demand') || description.includes('manual')) {
417
+ return 'on-demand';
418
+ }
419
+ // Default to batch for most integrations
420
+ return 'batch';
421
+ }
422
+ /**
423
+ * Plan data mapping between systems
424
+ */
425
+ async planDataMapping(description, context) {
426
+ const mappings = [];
427
+ // Common field mappings
428
+ const commonMappings = [
429
+ {
430
+ sourceField: 'id',
431
+ targetField: 'external_id',
432
+ required: true
433
+ },
434
+ {
435
+ sourceField: 'name',
436
+ targetField: 'short_description',
437
+ required: true
438
+ },
439
+ {
440
+ sourceField: 'description',
441
+ targetField: 'description',
442
+ required: false
443
+ },
444
+ {
445
+ sourceField: 'status',
446
+ targetField: 'state',
447
+ transformation: {
448
+ type: 'lookup',
449
+ expression: 'status_mapping_table',
450
+ parameters: { table: 'status_mapping' }
451
+ },
452
+ required: true
453
+ },
454
+ {
455
+ sourceField: 'created_date',
456
+ targetField: 'sys_created_on',
457
+ transformation: {
458
+ type: 'format',
459
+ expression: 'ISO8601_to_ServiceNow_datetime',
460
+ parameters: { format: 'yyyy-MM-dd HH:mm:ss' }
461
+ },
462
+ required: false
463
+ }
464
+ ];
465
+ mappings.push(...commonMappings);
466
+ // Add custom mappings based on context
467
+ if (context?.customFields) {
468
+ Object.entries(context.customFields).forEach(([source, target]) => {
469
+ mappings.push({
470
+ sourceField: source,
471
+ targetField: target,
472
+ required: false
473
+ });
474
+ });
475
+ }
476
+ return mappings;
477
+ }
478
+ /**
479
+ * Configure authentication for integration
480
+ */
481
+ configureAuthentication(description) {
482
+ if (description.includes('oauth') || description.includes('token')) {
483
+ return {
484
+ type: 'oauth',
485
+ tokenEndpoint: '/oauth/token',
486
+ refreshToken: true
487
+ };
488
+ }
489
+ if (description.includes('api key') || description.includes('api-key')) {
490
+ return {
491
+ type: 'api-key'
492
+ };
493
+ }
494
+ if (description.includes('certificate') || description.includes('cert')) {
495
+ return {
496
+ type: 'certificate'
497
+ };
498
+ }
499
+ // Default to basic auth
500
+ return {
501
+ type: 'basic'
502
+ };
503
+ }
504
+ /**
505
+ * Setup error handling configuration
506
+ */
507
+ setupErrorHandling(description) {
508
+ return {
509
+ retryAttempts: 3,
510
+ retryDelay: 5000, // 5 seconds
511
+ failureActions: [
512
+ {
513
+ condition: 'network_timeout',
514
+ action: 'retry',
515
+ parameters: { maxRetries: 3, backoffDelay: 2000 }
516
+ },
517
+ {
518
+ condition: 'authentication_failure',
519
+ action: 'notify',
520
+ parameters: { severity: 'high', channels: ['email'] }
521
+ },
522
+ {
523
+ condition: 'data_validation_error',
524
+ action: 'skip',
525
+ parameters: { logError: true, continueProcessing: true }
526
+ }
527
+ ],
528
+ alerting: {
529
+ channels: ['email'],
530
+ recipients: ['admin@company.com'],
531
+ severity: 'medium'
532
+ }
533
+ };
534
+ }
535
+ /**
536
+ * Configure monitoring setup
537
+ */
538
+ configureMonitoring(description) {
539
+ return {
540
+ metrics: [
541
+ 'request_count',
542
+ 'response_time',
543
+ 'error_rate',
544
+ 'data_throughput',
545
+ 'sync_lag'
546
+ ],
547
+ healthChecks: [
548
+ {
549
+ name: 'API Health',
550
+ endpoint: '/health',
551
+ interval: 300000, // 5 minutes
552
+ timeout: 30000 // 30 seconds
553
+ }
554
+ ],
555
+ logging: {
556
+ level: 'info',
557
+ retention: 30, // 30 days
558
+ structured: true
559
+ },
560
+ dashboard: true
561
+ };
562
+ }
563
+ /**
564
+ * Create integration components
565
+ */
566
+ async createIntegrationComponents(requirements) {
567
+ const components = [];
568
+ // REST Message component
569
+ if (requirements.sourceSystem.type === 'REST') {
570
+ components.push({
571
+ type: 'rest_message',
572
+ name: `${requirements.sourceSystem.name}_rest_message`,
573
+ configuration: {
574
+ endpoint: requirements.sourceSystem.baseUrl,
575
+ authentication: requirements.authentication,
576
+ timeout: requirements.sourceSystem.timeout || 30000
577
+ },
578
+ dependencies: []
579
+ });
580
+ }
581
+ // Transform Map component
582
+ components.push({
583
+ type: 'transform_map',
584
+ name: `${requirements.sourceSystem.name}_transform_map`,
585
+ configuration: {
586
+ sourceTable: 'import_set_table',
587
+ targetTable: 'target_table',
588
+ fieldMappings: requirements.dataMapping
589
+ },
590
+ dependencies: ['import_set']
591
+ });
592
+ // Import Set component
593
+ components.push({
594
+ type: 'import_set',
595
+ name: `${requirements.sourceSystem.name}_import_set`,
596
+ configuration: {
597
+ label: `${requirements.sourceSystem.name} Import Set`,
598
+ fields: requirements.dataMapping.map(mapping => mapping.sourceField)
599
+ },
600
+ dependencies: []
601
+ });
602
+ // Scheduled Job for batch sync
603
+ if (requirements.synchronizationType === 'batch') {
604
+ components.push({
605
+ type: 'scheduled_job',
606
+ name: `${requirements.sourceSystem.name}_sync_job`,
607
+ configuration: {
608
+ schedule: 'daily',
609
+ script: this.generateSyncScript(requirements)
610
+ },
611
+ dependencies: ['rest_message', 'transform_map']
612
+ });
613
+ }
614
+ return components;
615
+ }
616
+ /**
617
+ * Create deployment configuration
618
+ */
619
+ createDeploymentConfig(requirements) {
620
+ return {
621
+ environment: 'development',
622
+ rollbackPlan: 'Disable scheduled jobs and revert component changes',
623
+ notifications: ['integration-team@company.com']
624
+ };
625
+ }
626
+ /**
627
+ * Create testing configuration
628
+ */
629
+ createTestingConfig(requirements) {
630
+ return {
631
+ unitTests: [
632
+ {
633
+ name: 'Data Mapping Test',
634
+ description: 'Test data transformation logic',
635
+ input: { sample: 'data' },
636
+ expectedOutput: { transformed: 'data' },
637
+ assertions: ['field_presence', 'data_types']
638
+ }
639
+ ],
640
+ integrationTests: [
641
+ {
642
+ name: 'End-to-End Test',
643
+ description: 'Full integration flow test',
644
+ input: { test: 'scenario' },
645
+ expectedOutput: { success: true },
646
+ assertions: ['data_sync', 'error_handling']
647
+ }
648
+ ],
649
+ performanceTests: [
650
+ {
651
+ name: 'Load Test',
652
+ load: 10,
653
+ duration: 60,
654
+ expectedResponseTime: 5000
655
+ }
656
+ ],
657
+ mockData: [
658
+ {
659
+ endpoint: '/test-data',
660
+ responses: [
661
+ {
662
+ condition: 'success',
663
+ response: { data: 'sample' },
664
+ status: 200
665
+ }
666
+ ]
667
+ }
668
+ ]
669
+ };
670
+ }
671
+ /**
672
+ * Create documentation configuration
673
+ */
674
+ createDocumentationConfig(requirements) {
675
+ return {
676
+ apiDocumentation: true,
677
+ userGuide: true,
678
+ troubleshooting: true,
679
+ examples: true
680
+ };
681
+ }
682
+ /**
683
+ * Validate integration design
684
+ */
685
+ async validateIntegrationDesign(integration) {
686
+ // Validate component dependencies
687
+ integration.components.forEach(component => {
688
+ component.dependencies.forEach(dep => {
689
+ const dependencyExists = integration.components.some(c => c.name.includes(dep));
690
+ if (!dependencyExists) {
691
+ this.logger.warn(`Component ${component.name} depends on ${dep} which is not found`);
692
+ }
693
+ });
694
+ });
695
+ // Validate authentication configuration
696
+ if (!integration.requirements.authentication.type) {
697
+ throw new Error('Authentication type is required');
698
+ }
699
+ // Validate data mappings
700
+ if (integration.requirements.dataMapping.length === 0) {
701
+ this.logger.warn('No data mappings defined - manual mapping may be required');
702
+ }
703
+ }
704
+ /**
705
+ * Generate synchronization script
706
+ */
707
+ generateSyncScript(config) {
708
+ return `
709
+ // Generated sync script for ${config.name || 'integration'}
710
+ var syncManager = new SyncManager();
711
+ try {
712
+ var data = syncManager.fetchData('${config.endpoint || 'external_api'}');
713
+ var transformedData = syncManager.transformData(data);
714
+ var result = syncManager.loadData(transformedData);
715
+ gs.info('Sync completed successfully: ' + result.recordsProcessed + ' records');
716
+ } catch (error) {
717
+ gs.error('Sync failed: ' + error.message);
718
+ // Send notification to admin
719
+ gs.eventQueue('sync.failed', null, error.message);
720
+ }
721
+ `.trim();
722
+ }
723
+ }
724
+ exports.IntegrationSpecialistAgent = IntegrationSpecialistAgent;
725
+ //# sourceMappingURL=integration-specialist.agent.js.map