snow-flow 4.5.50 → 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,9 +1412,28 @@ ${executionList}
1412
1412
  }
1413
1413
  throw new Error(`Failed to configure mobile app: ${response.error}`);
1414
1414
  }
1415
- // VERIFICATION: Confirm mobile app was configured
1416
- const sys_id = response.data.result.sys_id;
1417
- const verification = await this.client.getRecord('sys_mobile_application_config', sys_id);
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
+ }
1418
1437
  if (!verification.success) {
1419
1438
  return {
1420
1439
  success: false,
@@ -1478,9 +1497,28 @@ ${executionList}
1478
1497
  if (!response.success) {
1479
1498
  throw new Error(`Failed to create mobile layout: ${response.error}`);
1480
1499
  }
1481
- // VERIFICATION: Confirm mobile layout was created
1482
- const sys_id = response.data.result.sys_id;
1483
- const verification = await this.client.getRecord('sys_mobile_layout', sys_id);
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
+ }
1484
1522
  if (!verification.success) {
1485
1523
  return {
1486
1524
  success: false,
@@ -1934,7 +1972,13 @@ ${configList}${layoutsText}${offlineText}
1934
1972
  }
1935
1973
  catch (error) {
1936
1974
  this.logger.error('Failed to discover UI Builder pages:', error);
1937
- 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
+ };
1938
1982
  }
1939
1983
  }
1940
1984
  /**
@@ -2145,7 +2189,13 @@ ${configList}${layoutsText}${offlineText}
2145
2189
  }
2146
2190
  catch (error) {
2147
2191
  this.logger.error('Failed to discover UI Builder components:', error);
2148
- 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
+ };
2149
2199
  }
2150
2200
  }
2151
2201
  /**
@@ -2207,6 +2257,17 @@ ${configList}${layoutsText}${offlineText}
2207
2257
  async createUIBDataBroker(args) {
2208
2258
  try {
2209
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
+ }
2210
2271
  const brokerData = {
2211
2272
  name: args.name,
2212
2273
  label: args.label,
@@ -2224,10 +2285,28 @@ ${configList}${layoutsText}${offlineText}
2224
2285
  };
2225
2286
  const response = await this.client.createRecord('sys_ux_data_broker', brokerData);
2226
2287
  if (!response.success) {
2227
- 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
+ };
2228
2309
  }
2229
- // VERIFICATION: Confirm data broker was created
2230
- const sys_id = response.data.result.sys_id;
2231
2310
  const verification = await this.client.getRecord('sys_ux_data_broker', sys_id);
2232
2311
  if (!verification.success) {
2233
2312
  return {
@@ -2533,8 +2612,20 @@ ${configList}${layoutsText}${offlineText}
2533
2612
  if (!response.success) {
2534
2613
  throw new Error(`Failed to create client script: ${response.error}`);
2535
2614
  }
2536
- // VERIFICATION: Confirm client script was created
2537
- const sys_id = response.data.result.sys_id;
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
+ }
2538
2629
  const verification = await this.client.getRecord('sys_ux_client_script', sys_id);
2539
2630
  if (!verification.success) {
2540
2631
  return {
@@ -2624,8 +2715,20 @@ ${configList}${layoutsText}${offlineText}
2624
2715
  if (!response.success) {
2625
2716
  throw new Error(`Failed to create event: ${response.error}`);
2626
2717
  }
2627
- // VERIFICATION: Confirm event was created
2628
- const sys_id = response.data.result.sys_id;
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
+ }
2629
2732
  const verification = await this.client.getRecord('sys_ux_event', sys_id);
2630
2733
  if (!verification.success) {
2631
2734
  return {
@@ -3749,7 +3852,12 @@ ${configList}${layoutsText}${offlineText}
3749
3852
  }
3750
3853
  catch (error) {
3751
3854
  this.logger.error('Failed to test workspace tools:', error);
3752
- 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
+ };
3753
3861
  }
3754
3862
  }
3755
3863
  /**
@@ -3823,7 +3931,12 @@ ${configList}${layoutsText}${offlineText}
3823
3931
  }
3824
3932
  catch (error) {
3825
3933
  this.logger.error('Failed to check plugin availability:', error);
3826
- 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
+ };
3827
3940
  }
3828
3941
  }
3829
3942
  /**
@@ -4018,26 +4131,29 @@ ${configList}${layoutsText}${offlineText}
4018
4131
  }
4019
4132
  }
4020
4133
  /**
4021
- * Get actionable suggestions based on error type
4134
+ * Get actionable suggestions based on error type with specific tool guidance
4022
4135
  */
4023
4136
  getErrorSuggestion(error) {
4024
4137
  const errorLower = error.toLowerCase();
4025
4138
  if (errorLower.includes('403') || errorLower.includes('forbidden')) {
4026
- 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.';
4027
4140
  }
4028
4141
  if (errorLower.includes('404') || errorLower.includes('not found')) {
4029
- 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.';
4030
4143
  }
4031
4144
  if (errorLower.includes('400') || errorLower.includes('bad request')) {
4032
- 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.';
4033
4146
  }
4034
4147
  if (errorLower.includes('401') || errorLower.includes('unauthorized')) {
4035
- 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.';
4036
4152
  }
4037
4153
  if (errorLower.includes('plugin') || errorLower.includes('license')) {
4038
- 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.';
4039
4155
  }
4040
- 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.';
4041
4157
  }
4042
4158
  /**
4043
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.50",
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",