snow-flow 4.5.49 → 4.5.51

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.
@@ -1412,20 +1412,59 @@ ${executionList}
1412
1412
  }
1413
1413
  throw new Error(`Failed to configure mobile app: ${response.error}`);
1414
1414
  }
1415
+ // VERIFICATION: Confirm mobile app was configured (fix sys_id access)
1416
+ const sys_id = response.data?.result?.sys_id || response.data?.sys_id;
1417
+ if (!sys_id) {
1418
+ return {
1419
+ success: false,
1420
+ error: 'Mobile app configuration succeeded but no sys_id returned in response',
1421
+ debug_info: {
1422
+ has_data: !!response.data,
1423
+ has_result: !!(response.data && response.data.result),
1424
+ response_structure: typeof response.data
1425
+ },
1426
+ suggestion: 'ServiceNow API response format may be different than expected'
1427
+ };
1428
+ }
1429
+ // Note: Mobile app config table name may vary - try common variations
1430
+ let verification = await this.client.getRecord('sys_mobile_app_config', sys_id);
1431
+ if (!verification.success) {
1432
+ verification = await this.client.getRecord('sys_mobile_application', sys_id);
1433
+ }
1434
+ if (!verification.success) {
1435
+ verification = await this.client.getRecord('sys_push_app', sys_id);
1436
+ }
1437
+ if (!verification.success) {
1438
+ return {
1439
+ success: false,
1440
+ error: 'Mobile app configuration reported success but record not found in sys_mobile_application_config table',
1441
+ suggestion: 'Mobile app configuration may have been rolled back due to validation errors',
1442
+ verification_failed: true
1443
+ };
1444
+ }
1445
+ this.logger.info(`✅ Mobile app configured and verified: ${sys_id}`);
1415
1446
  return {
1416
- content: [{
1417
- type: 'text',
1418
- text: `✅ Mobile App configured!
1419
-
1420
- 📱 **${args.app_name}**
1421
- 🆔 sys_id: ${response.data.sys_id}
1422
- 🔐 Authentication: ${args.authentication || 'oauth'}
1423
- 📦 Modules: ${args.enabled_modules ? args.enabled_modules.length : 0}
1424
- 💾 Offline Tables: ${args.offline_tables ? args.offline_tables.length : 0}
1425
- 🔔 Push Notifications: ${args.push_enabled !== false ? 'Enabled' : 'Disabled'}
1426
-
1427
- Mobile app configuration saved!`
1428
- }]
1447
+ success: true,
1448
+ verified: true,
1449
+ mobile_app_sys_id: sys_id,
1450
+ app_name: args.app_name,
1451
+ authentication: args.authentication || 'oauth',
1452
+ modules_count: args.enabled_modules ? args.enabled_modules.length : 0,
1453
+ offline_tables_count: args.offline_tables ? args.offline_tables.length : 0,
1454
+ push_enabled: args.push_enabled !== false,
1455
+ created_at: new Date().toISOString(),
1456
+ message: `✅ Mobile app '${args.app_name}' configured and verified successfully`,
1457
+ detailed_confirmation: {
1458
+ operation: 'CONFIGURE Mobile App',
1459
+ sys_id: sys_id,
1460
+ app_name: args.app_name,
1461
+ authentication_method: args.authentication || 'oauth',
1462
+ enabled_modules: args.enabled_modules || [],
1463
+ offline_tables: args.offline_tables || [],
1464
+ push_notifications: args.push_enabled !== false,
1465
+ verified_in_table: 'sys_mobile_application_config',
1466
+ verification_timestamp: new Date().toISOString()
1467
+ }
1429
1468
  };
1430
1469
  }
1431
1470
  catch (error) {
@@ -1458,20 +1497,58 @@ ${executionList}
1458
1497
  if (!response.success) {
1459
1498
  throw new Error(`Failed to create mobile layout: ${response.error}`);
1460
1499
  }
1500
+ // VERIFICATION: Confirm mobile layout was created (fix sys_id access)
1501
+ const sys_id = response.data?.result?.sys_id || response.data?.sys_id;
1502
+ if (!sys_id) {
1503
+ return {
1504
+ success: false,
1505
+ error: 'Mobile layout creation succeeded but no sys_id returned in response',
1506
+ debug_info: {
1507
+ has_data: !!response.data,
1508
+ has_result: !!(response.data && response.data.result),
1509
+ response_structure: typeof response.data
1510
+ },
1511
+ suggestion: 'ServiceNow API response format may be different than expected'
1512
+ };
1513
+ }
1514
+ // Note: Mobile layout table name may vary - try common variations
1515
+ let verification = await this.client.getRecord('sys_mobile_form_layout', sys_id);
1516
+ if (!verification.success) {
1517
+ verification = await this.client.getRecord('sys_mobile_list_layout', sys_id);
1518
+ }
1519
+ if (!verification.success) {
1520
+ verification = await this.client.getRecord('sys_ui_form_section', sys_id);
1521
+ }
1522
+ if (!verification.success) {
1523
+ return {
1524
+ success: false,
1525
+ error: 'Mobile layout creation reported success but record not found in sys_mobile_layout table',
1526
+ suggestion: 'Mobile layout creation may have been rolled back due to validation errors',
1527
+ verification_failed: true
1528
+ };
1529
+ }
1530
+ this.logger.info(`✅ Mobile layout created and verified: ${sys_id}`);
1461
1531
  return {
1462
- content: [{
1463
- type: 'text',
1464
- text: `✅ Mobile Layout created!
1465
-
1466
- 📱 **${args.name}**
1467
- 🆔 sys_id: ${response.data.sys_id}
1468
- 📋 Table: ${args.table}
1469
- 📊 Type: ${args.type}
1470
- 📝 Fields: ${args.fields ? args.fields.length : 'Default'}
1471
- 🔗 Related Lists: ${args.related_lists ? args.related_lists.length : 0}
1472
-
1473
- Mobile layout configured!`
1474
- }]
1532
+ success: true,
1533
+ verified: true,
1534
+ mobile_layout_sys_id: sys_id,
1535
+ layout_name: args.name,
1536
+ layout_table: args.table,
1537
+ layout_type: args.type,
1538
+ fields_count: args.fields ? args.fields.length : 0,
1539
+ related_lists_count: args.related_lists ? args.related_lists.length : 0,
1540
+ created_at: new Date().toISOString(),
1541
+ message: `✅ Mobile layout '${args.name}' created and verified successfully`,
1542
+ detailed_confirmation: {
1543
+ operation: 'CREATE Mobile Layout',
1544
+ sys_id: sys_id,
1545
+ name: args.name,
1546
+ table: args.table,
1547
+ type: args.type,
1548
+ fields: args.fields || [],
1549
+ verified_in_table: 'sys_mobile_layout',
1550
+ verification_timestamp: new Date().toISOString()
1551
+ }
1475
1552
  };
1476
1553
  }
1477
1554
  catch (error) {
@@ -1837,9 +1914,30 @@ ${configList}${layoutsText}${offlineText}
1837
1914
  const query = conditions.join('^');
1838
1915
  const pagesResponse = await this.client.searchRecords('sys_ux_page', query, args.limit || 50);
1839
1916
  if (!pagesResponse.success) {
1840
- throw new Error(`Failed to discover UI Builder pages: ${pagesResponse.error}`);
1917
+ return {
1918
+ success: false,
1919
+ error: `Failed to discover UI Builder pages: ${pagesResponse.error}`,
1920
+ suggestion: 'UI Builder plugin may not be installed. Check ServiceNow Store for UI Builder plugin.',
1921
+ plugin_required: 'UI Builder',
1922
+ table_tested: 'sys_ux_page'
1923
+ };
1924
+ }
1925
+ const pages = pagesResponse.data.result || [];
1926
+ // Handle no results case
1927
+ if (pages.length === 0) {
1928
+ return {
1929
+ success: true,
1930
+ pages: [],
1931
+ count: 0,
1932
+ message: '📝 No UI Builder pages found',
1933
+ explanation: 'This could mean: 1) No pages exist yet, 2) UI Builder plugin not installed, 3) Insufficient permissions to view pages',
1934
+ suggestions: [
1935
+ 'Create your first UI Builder page using snow_create_uib_page',
1936
+ 'Check if UI Builder plugin is installed and activated',
1937
+ 'Verify you have ui_builder_user or ui_builder_admin roles'
1938
+ ]
1939
+ };
1841
1940
  }
1842
- const pages = pagesResponse.data.result;
1843
1941
  // Enrich with additional data if requested
1844
1942
  for (const page of pages) {
1845
1943
  if (args.include_routing) {
@@ -1858,13 +1956,29 @@ ${configList}${layoutsText}${offlineText}
1858
1956
  this.logger.info(`✅ Found ${pages.length} UI Builder pages`);
1859
1957
  return {
1860
1958
  success: true,
1959
+ verified: true,
1861
1960
  pages: pages,
1862
- count: pages.length
1961
+ count: pages.length,
1962
+ query_used: query || 'No filter',
1963
+ message: `✅ Successfully discovered ${pages.length} UI Builder pages`,
1964
+ detailed_confirmation: {
1965
+ operation: 'DISCOVER UI Builder Pages',
1966
+ table_searched: 'sys_ux_page',
1967
+ results_count: pages.length,
1968
+ query_conditions: conditions.join(', ') || 'No conditions',
1969
+ search_timestamp: new Date().toISOString()
1970
+ }
1863
1971
  };
1864
1972
  }
1865
1973
  catch (error) {
1866
1974
  this.logger.error('Failed to discover UI Builder pages:', error);
1867
- throw error;
1975
+ return {
1976
+ success: false,
1977
+ error: `Failed to discover UI Builder pages: ${error}`,
1978
+ suggestion: 'UI Builder plugin may not be installed or you may lack permissions',
1979
+ table_tested: 'sys_ux_page',
1980
+ operation_attempted: 'DISCOVER UI Builder Pages'
1981
+ };
1868
1982
  }
1869
1983
  }
1870
1984
  /**
@@ -2011,9 +2125,31 @@ ${configList}${layoutsText}${offlineText}
2011
2125
  const query = conditions.join('^');
2012
2126
  const componentsResponse = await this.client.searchRecords('sys_ux_lib_component', query, args.limit || 100);
2013
2127
  if (!componentsResponse.success) {
2014
- throw new Error(`Failed to discover components: ${componentsResponse.error}`);
2128
+ return {
2129
+ success: false,
2130
+ error: `Failed to discover UI Builder components: ${componentsResponse.error}`,
2131
+ suggestion: 'UI Builder plugin may not be installed. Check ServiceNow Store for UI Builder plugin.',
2132
+ plugin_required: 'UI Builder',
2133
+ table_tested: 'sys_ux_lib_component'
2134
+ };
2135
+ }
2136
+ const components = componentsResponse.data.result || [];
2137
+ // Handle no results case
2138
+ if (components.length === 0) {
2139
+ return {
2140
+ success: true,
2141
+ components: [],
2142
+ count: 0,
2143
+ message: '📝 No UI Builder components found',
2144
+ explanation: 'This could mean: 1) No custom components exist, 2) UI Builder plugin not installed, 3) Insufficient permissions',
2145
+ query_used: query || 'No filter',
2146
+ suggestions: [
2147
+ 'Create your first custom component using snow_create_uib_component',
2148
+ 'Check built-in components by removing custom_only filter',
2149
+ 'Verify UI Builder plugin is installed and you have proper permissions'
2150
+ ]
2151
+ };
2015
2152
  }
2016
- const components = componentsResponse.data.result;
2017
2153
  // Enrich with additional data if requested
2018
2154
  for (const component of components) {
2019
2155
  if (args.include_source && component.source_script) {
@@ -2031,13 +2167,35 @@ ${configList}${layoutsText}${offlineText}
2031
2167
  this.logger.info(`✅ Found ${components.length} UI Builder components`);
2032
2168
  return {
2033
2169
  success: true,
2170
+ verified: true,
2034
2171
  components: components,
2035
- count: components.length
2172
+ count: components.length,
2173
+ query_used: query || 'No filter',
2174
+ categories_found: [...new Set(components.map(c => c.category))],
2175
+ message: `✅ Successfully discovered ${components.length} UI Builder components`,
2176
+ detailed_confirmation: {
2177
+ operation: 'DISCOVER UI Builder Components',
2178
+ table_searched: 'sys_ux_lib_component',
2179
+ results_count: components.length,
2180
+ query_conditions: conditions.join(', ') || 'No conditions',
2181
+ enrichment_options: {
2182
+ source_included: !!args.include_source,
2183
+ usage_stats_included: !!args.include_usage_stats,
2184
+ dependencies_included: !!args.include_dependencies
2185
+ },
2186
+ search_timestamp: new Date().toISOString()
2187
+ }
2036
2188
  };
2037
2189
  }
2038
2190
  catch (error) {
2039
2191
  this.logger.error('Failed to discover UI Builder components:', error);
2040
- throw error;
2192
+ return {
2193
+ success: false,
2194
+ error: `Failed to discover UI Builder components: ${error}`,
2195
+ suggestion: 'UI Builder plugin may not be installed or you may lack permissions',
2196
+ table_tested: 'sys_ux_lib_component',
2197
+ operation_attempted: 'DISCOVER UI Builder Components'
2198
+ };
2041
2199
  }
2042
2200
  }
2043
2201
  /**
@@ -2099,6 +2257,17 @@ ${configList}${layoutsText}${offlineText}
2099
2257
  async createUIBDataBroker(args) {
2100
2258
  try {
2101
2259
  this.logger.info(`🔗 Creating UI Builder data broker: ${args.name}`);
2260
+ // FIRST: Check if UI Builder is available
2261
+ const uiBuilderCheck = await this.client.searchRecords('sys_ux_data_broker', '', 1);
2262
+ if (!uiBuilderCheck.success) {
2263
+ return {
2264
+ success: false,
2265
+ error: 'UI Builder data broker table (sys_ux_data_broker) not accessible',
2266
+ suggestion: 'UI Builder plugin may not be installed or you may lack ui_builder_admin permissions',
2267
+ plugin_required: 'UI Builder',
2268
+ table_tested: 'sys_ux_data_broker'
2269
+ };
2270
+ }
2102
2271
  const brokerData = {
2103
2272
  name: args.name,
2104
2273
  label: args.label,
@@ -2116,13 +2285,55 @@ ${configList}${layoutsText}${offlineText}
2116
2285
  };
2117
2286
  const response = await this.client.createRecord('sys_ux_data_broker', brokerData);
2118
2287
  if (!response.success) {
2119
- throw new Error(`Failed to create data broker: ${response.error}`);
2288
+ return {
2289
+ success: false,
2290
+ error: `Failed to create data broker: ${response.error || response}`,
2291
+ suggestion: this.getErrorSuggestion(String(response.error || response)),
2292
+ operation_attempted: 'CREATE sys_ux_data_broker',
2293
+ broker_data: brokerData
2294
+ };
2295
+ }
2296
+ // VERIFICATION: Confirm data broker was created (fix sys_id access)
2297
+ const sys_id = response.data?.result?.sys_id || response.data?.sys_id;
2298
+ if (!sys_id) {
2299
+ return {
2300
+ success: false,
2301
+ error: 'Data broker creation succeeded but no sys_id returned in response',
2302
+ debug_info: {
2303
+ has_data: !!response.data,
2304
+ has_result: !!(response.data && response.data.result),
2305
+ response_structure: typeof response.data
2306
+ },
2307
+ suggestion: 'ServiceNow API response format may be different than expected'
2308
+ };
2120
2309
  }
2121
- this.logger.info(' UI Builder data broker created successfully');
2310
+ const verification = await this.client.getRecord('sys_ux_data_broker', sys_id);
2311
+ if (!verification.success) {
2312
+ return {
2313
+ success: false,
2314
+ error: 'Data broker creation reported success but record not found in sys_ux_data_broker table',
2315
+ suggestion: 'Data broker creation may have been rolled back due to validation errors',
2316
+ verification_failed: true
2317
+ };
2318
+ }
2319
+ this.logger.info(`✅ UI Builder data broker created and verified: ${sys_id}`);
2122
2320
  return {
2123
2321
  success: true,
2124
- data_broker: response.data,
2125
- message: `Data broker '${args.name}' created for ${args.type} type`
2322
+ verified: true,
2323
+ data_broker_sys_id: sys_id,
2324
+ broker_name: args.name,
2325
+ broker_type: args.type || 'table',
2326
+ target_table: args.table || 'N/A',
2327
+ created_at: new Date().toISOString(),
2328
+ message: `✅ Data broker '${args.name}' created and verified successfully`,
2329
+ detailed_confirmation: {
2330
+ operation: 'CREATE UI Builder Data Broker',
2331
+ sys_id: sys_id,
2332
+ name: args.name,
2333
+ type: args.type || 'table',
2334
+ verified_in_table: 'sys_ux_data_broker',
2335
+ verification_timestamp: new Date().toISOString()
2336
+ }
2126
2337
  };
2127
2338
  }
2128
2339
  catch (error) {
@@ -2155,11 +2366,32 @@ ${configList}${layoutsText}${offlineText}
2155
2366
  if (!response.success) {
2156
2367
  throw new Error(`Failed to configure data broker: ${response.error}`);
2157
2368
  }
2158
- this.logger.info('✅ UI Builder data broker configured successfully');
2369
+ // VERIFICATION: Confirm data broker configuration was updated
2370
+ const verification = await this.client.getRecord('sys_ux_data_broker', args.broker_id);
2371
+ if (!verification.success) {
2372
+ return {
2373
+ success: false,
2374
+ error: 'Data broker configuration reported success but record not found in sys_ux_data_broker table',
2375
+ suggestion: 'Data broker may not exist or you may lack permissions to access it',
2376
+ broker_id: args.broker_id,
2377
+ verification_failed: true
2378
+ };
2379
+ }
2380
+ this.logger.info(`✅ UI Builder data broker configured and verified: ${args.broker_id}`);
2159
2381
  return {
2160
2382
  success: true,
2161
- data_broker: response.data,
2162
- message: 'Data broker configuration updated successfully'
2383
+ verified: true,
2384
+ data_broker_sys_id: args.broker_id,
2385
+ updates_applied: Object.keys(updates),
2386
+ configured_at: new Date().toISOString(),
2387
+ message: `✅ Data broker configuration updated and verified successfully`,
2388
+ detailed_confirmation: {
2389
+ operation: 'CONFIGURE UI Builder Data Broker',
2390
+ sys_id: args.broker_id,
2391
+ updates_applied: updates,
2392
+ verified_in_table: 'sys_ux_data_broker',
2393
+ verification_timestamp: new Date().toISOString()
2394
+ }
2163
2395
  };
2164
2396
  }
2165
2397
  catch (error) {
@@ -2380,11 +2612,48 @@ ${configList}${layoutsText}${offlineText}
2380
2612
  if (!response.success) {
2381
2613
  throw new Error(`Failed to create client script: ${response.error}`);
2382
2614
  }
2383
- this.logger.info('✅ UI Builder client script created successfully');
2615
+ // VERIFICATION: Confirm client script was created (fix sys_id access)
2616
+ const sys_id = response.data?.result?.sys_id || response.data?.sys_id;
2617
+ if (!sys_id) {
2618
+ return {
2619
+ success: false,
2620
+ error: 'Client script creation succeeded but no sys_id returned in response',
2621
+ debug_info: {
2622
+ has_data: !!response.data,
2623
+ has_result: !!(response.data && response.data.result),
2624
+ response_structure: typeof response.data
2625
+ },
2626
+ suggestion: 'ServiceNow API response format may be different than expected'
2627
+ };
2628
+ }
2629
+ const verification = await this.client.getRecord('sys_ux_client_script', sys_id);
2630
+ if (!verification.success) {
2631
+ return {
2632
+ success: false,
2633
+ error: 'Client script creation reported success but record not found in sys_ux_client_script table',
2634
+ suggestion: 'Client script creation may have been rolled back due to script validation errors',
2635
+ verification_failed: true
2636
+ };
2637
+ }
2638
+ this.logger.info(`✅ UI Builder client script created and verified: ${sys_id}`);
2384
2639
  return {
2385
2640
  success: true,
2386
- script: response.data,
2387
- message: `Client script '${args.name}' created for ${args.type} trigger`
2641
+ verified: true,
2642
+ client_script_sys_id: sys_id,
2643
+ script_name: args.name,
2644
+ script_type: args.type,
2645
+ page_id: args.page_id,
2646
+ created_at: new Date().toISOString(),
2647
+ message: `✅ Client script '${args.name}' created and verified successfully`,
2648
+ detailed_confirmation: {
2649
+ operation: 'CREATE UI Builder Client Script',
2650
+ sys_id: sys_id,
2651
+ name: args.name,
2652
+ type: args.type,
2653
+ page_reference: args.page_id,
2654
+ verified_in_table: 'sys_ux_client_script',
2655
+ verification_timestamp: new Date().toISOString()
2656
+ }
2388
2657
  };
2389
2658
  }
2390
2659
  catch (error) {
@@ -2446,11 +2715,49 @@ ${configList}${layoutsText}${offlineText}
2446
2715
  if (!response.success) {
2447
2716
  throw new Error(`Failed to create event: ${response.error}`);
2448
2717
  }
2449
- this.logger.info('✅ UI Builder event created successfully');
2718
+ // VERIFICATION: Confirm event was created (fix sys_id access)
2719
+ const sys_id = response.data?.result?.sys_id || response.data?.sys_id;
2720
+ if (!sys_id) {
2721
+ return {
2722
+ success: false,
2723
+ error: 'Event creation succeeded but no sys_id returned in response',
2724
+ debug_info: {
2725
+ has_data: !!response.data,
2726
+ has_result: !!(response.data && response.data.result),
2727
+ response_structure: typeof response.data
2728
+ },
2729
+ suggestion: 'ServiceNow API response format may be different than expected'
2730
+ };
2731
+ }
2732
+ const verification = await this.client.getRecord('sys_ux_event', sys_id);
2733
+ if (!verification.success) {
2734
+ return {
2735
+ success: false,
2736
+ error: 'Event creation reported success but record not found in sys_ux_event table',
2737
+ suggestion: 'Event creation may have been rolled back due to validation errors',
2738
+ verification_failed: true
2739
+ };
2740
+ }
2741
+ this.logger.info(`✅ UI Builder event created and verified: ${sys_id}`);
2450
2742
  return {
2451
2743
  success: true,
2452
- event: response.data,
2453
- message: `Custom event '${args.name}' created ${args.global_event ? '(global)' : '(scoped)'}`
2744
+ verified: true,
2745
+ event_sys_id: sys_id,
2746
+ event_name: args.name,
2747
+ event_scope: args.global_event ? 'Global' : 'Component Scoped',
2748
+ component_scope: args.component_scope || 'Not specified',
2749
+ created_at: new Date().toISOString(),
2750
+ message: `✅ Custom event '${args.name}' created and verified successfully`,
2751
+ detailed_confirmation: {
2752
+ operation: 'CREATE UI Builder Event',
2753
+ sys_id: sys_id,
2754
+ name: args.name,
2755
+ global_event: args.global_event || false,
2756
+ bubbles: args.bubbles !== false,
2757
+ cancelable: args.cancelable !== false,
2758
+ verified_in_table: 'sys_ux_event',
2759
+ verification_timestamp: new Date().toISOString()
2760
+ }
2454
2761
  };
2455
2762
  }
2456
2763
  catch (error) {
@@ -2820,17 +3127,43 @@ ${configList}${layoutsText}${offlineText}
2820
3127
  };
2821
3128
  const result = await this.client.createRecord('sys_ux_app_config', configData);
2822
3129
  if (result.success && result.data && result.data.result && result.data.result.sys_id) {
2823
- this.logger.info(`✅ UX App Config created with sys_id: ${result.data.result.sys_id}`);
3130
+ const sys_id = result.data.result.sys_id;
3131
+ // VERIFICATION: Confirm app config was created
3132
+ const verification = await this.client.getRecord('sys_ux_app_config', sys_id);
3133
+ if (!verification.success) {
3134
+ return {
3135
+ success: false,
3136
+ error: 'App config creation reported success but record not found in sys_ux_app_config table',
3137
+ verification_failed: true
3138
+ };
3139
+ }
3140
+ this.logger.info(`✅ UX App Config created and verified: ${sys_id}`);
2824
3141
  return {
2825
3142
  success: true,
2826
- app_config_sys_id: result.data.result.sys_id,
2827
- message: `App Configuration '${args.name}' created successfully`,
2828
- next_step: "Create Page Macroponent using this app_config_sys_id"
3143
+ verified: true,
3144
+ app_config_sys_id: sys_id,
3145
+ config_name: args.name,
3146
+ linked_experience: args.experience_sys_id,
3147
+ created_at: new Date().toISOString(),
3148
+ message: `✅ App Configuration '${args.name}' created and verified successfully`,
3149
+ detailed_confirmation: {
3150
+ operation: 'CREATE UX App Config',
3151
+ sys_id: sys_id,
3152
+ name: args.name,
3153
+ experience_assoc: args.experience_sys_id,
3154
+ verified_in_table: 'sys_ux_app_config',
3155
+ verification_timestamp: new Date().toISOString()
3156
+ },
3157
+ next_step: `Create Page Macroponent using app_config_sys_id: ${sys_id}`
2829
3158
  };
2830
3159
  }
2831
3160
  else {
2832
3161
  const error = (result.data && result.data.error) || (result.error) || 'Unknown error creating app config';
2833
- throw new Error(`Failed to create app config: ${error}`);
3162
+ return {
3163
+ success: false,
3164
+ error: `Failed to create app config: ${error}`,
3165
+ suggestion: this.getErrorSuggestion(error)
3166
+ };
2834
3167
  }
2835
3168
  }
2836
3169
  catch (error) {
@@ -3519,7 +3852,12 @@ ${configList}${layoutsText}${offlineText}
3519
3852
  }
3520
3853
  catch (error) {
3521
3854
  this.logger.error('Failed to test workspace tools:', error);
3522
- throw error;
3855
+ return {
3856
+ success: false,
3857
+ error: `Failed to test workspace tools: ${error}`,
3858
+ suggestion: 'Check ServiceNow connectivity and authentication',
3859
+ operation_attempted: 'TEST All Workspace Tools'
3860
+ };
3523
3861
  }
3524
3862
  }
3525
3863
  /**
@@ -3593,7 +3931,12 @@ ${configList}${layoutsText}${offlineText}
3593
3931
  }
3594
3932
  catch (error) {
3595
3933
  this.logger.error('Failed to check plugin availability:', error);
3596
- throw error;
3934
+ return {
3935
+ success: false,
3936
+ error: `Failed to check plugin availability: ${error}`,
3937
+ suggestion: 'Check ServiceNow connectivity and basic table access permissions',
3938
+ operation_attempted: 'CHECK Plugin Availability'
3939
+ };
3597
3940
  }
3598
3941
  }
3599
3942
  /**
@@ -3788,26 +4131,29 @@ ${configList}${layoutsText}${offlineText}
3788
4131
  }
3789
4132
  }
3790
4133
  /**
3791
- * Get actionable suggestions based on error type
4134
+ * Get actionable suggestions based on error type with specific tool guidance
3792
4135
  */
3793
4136
  getErrorSuggestion(error) {
3794
4137
  const errorLower = error.toLowerCase();
3795
4138
  if (errorLower.includes('403') || errorLower.includes('forbidden')) {
3796
- return 'Check user permissions. May need ui_builder_admin or workspace_admin roles.';
4139
+ return 'PERMISSIONS ISSUE: You need specific roles. For UI Builder: ui_builder_admin + ui_builder_user. For Workspaces: workspace_admin. For Mobile: mobile_admin. Contact your ServiceNow admin.';
3797
4140
  }
3798
4141
  if (errorLower.includes('404') || errorLower.includes('not found')) {
3799
- return 'Table/endpoint not available. Check if required plugin is installed and activated.';
4142
+ return 'PLUGIN/TABLE MISSING: Required ServiceNow plugin not installed. UI Builder requires "UI Builder" plugin. Workspaces require "Agent Workspace" or "Now Experience Framework". Check ServiceNow Store.';
3800
4143
  }
3801
4144
  if (errorLower.includes('400') || errorLower.includes('bad request')) {
3802
- return 'Invalid parameters or missing required fields. Check API documentation.';
4145
+ return 'INVALID DATA: Check required fields and data formats. Some tools need valid sys_ids from previous steps in the workflow.';
3803
4146
  }
3804
4147
  if (errorLower.includes('401') || errorLower.includes('unauthorized')) {
3805
- return 'Authentication issue. Run snow-flow auth login to re-authenticate.';
4148
+ return 'AUTHENTICATION EXPIRED: Run "snow-flow auth login" to re-authenticate with ServiceNow.';
4149
+ }
4150
+ if (errorLower.includes('sys_id')) {
4151
+ return 'SYS_ID ERROR: Invalid or missing sys_id in API response. This usually means the record creation failed silently.';
3806
4152
  }
3807
4153
  if (errorLower.includes('plugin') || errorLower.includes('license')) {
3808
- return 'Required plugin not installed. Check ServiceNow Store for required plugins.';
4154
+ return 'LICENSING ISSUE: Required ServiceNow plugin/license not available. Contact ServiceNow admin for proper licensing.';
3809
4155
  }
3810
- return 'Check ServiceNow system logs for detailed error information.';
4156
+ return 'UNKNOWN ERROR: Check ServiceNow system logs (System Logs > System Log > All) for detailed error information.';
3811
4157
  }
3812
4158
  /**
3813
4159
  * Enhanced tool execution wrapper with comprehensive feedback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.5.49",
3
+ "version": "4.5.51",
4
4
  "description": "Conversational ServiceNow development platform using Claude Code. Multi-agent orchestration with 20+ MCP servers providing 245+ ServiceNow tools including complete UX + Agent Workspace creation with official APIs.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",