snow-flow 3.0.19 → 3.0.20

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.
@@ -487,6 +487,8 @@ class ServiceNowDeploymentMCP {
487
487
  const refreshResult = await this.deploymentAuthManager.forceTokenRefresh();
488
488
  if (!refreshResult.success) {
489
489
  return {
490
+ success: false,
491
+ error: authResult.error || 'Unable to authenticate',
490
492
  content: [
491
493
  {
492
494
  type: 'text',
@@ -554,6 +556,9 @@ class ServiceNowDeploymentMCP {
554
556
  `https://${credentials.instance}/sp_config?id=widget_editor&sys_id=${existenceCheck.artifact.sys_id}` :
555
557
  'ServiceNow instance URL not available';
556
558
  return {
559
+ success: true,
560
+ sys_id: existenceCheck.artifact.sys_id,
561
+ name: args.name,
557
562
  content: [
558
563
  {
559
564
  type: 'text',
@@ -579,7 +584,14 @@ Your widget is deployed and ready for testing in Service Portal.`
579
584
  }
580
585
  // Validate widget structure
581
586
  if (!args.template || !args.name || !args.title) {
582
- throw new Error('Widget must have name, title, and template');
587
+ return {
588
+ success: false,
589
+ error: 'Widget must have name, title, and template',
590
+ content: [{
591
+ type: 'text',
592
+ text: '❌ Widget validation failed: Widget must have name, title, and template'
593
+ }]
594
+ };
583
595
  }
584
596
  // IMPROVED: Softer Service Portal permissions check with graceful fallback
585
597
  let hasServicePortalAccess = false;
@@ -860,6 +872,8 @@ Your widget is deployed and ready for testing in Service Portal.`
860
872
  `;
861
873
  }
862
874
  return {
875
+ success: false,
876
+ error: directError?.message || tableError?.message || 'Deployment failed',
863
877
  content: [
864
878
  {
865
879
  type: 'text',
@@ -998,7 +1012,11 @@ Use \`snow_deployment_debug\` for more information about this session.`,
998
1012
  const inconsistencyWarning = inconsistencies.length > 0
999
1013
  ? `\n\n⚠️ Sys_ID Inconsistencies Detected:\n${inconsistencies.map(inc => `- ${inc.issue}`).join('\n')}`
1000
1014
  : '';
1015
+ // Return both MCP response format AND success properties for attemptDirectDeployment
1001
1016
  return {
1017
+ success: true,
1018
+ sys_id: result.data.sys_id,
1019
+ name: args.name,
1002
1020
  content: [
1003
1021
  {
1004
1022
  type: 'text',
@@ -1056,7 +1074,14 @@ Use \`snow_deployment_debug\` for more information about this session.`,
1056
1074
  • Check dependencies with check_dependencies: true
1057
1075
 
1058
1076
  📚 Documentation: See CLAUDE.md for Widget Deployment Guidelines`;
1059
- throw new Error(enhancedError);
1077
+ return {
1078
+ success: false,
1079
+ error: result.error || 'Unknown deployment error',
1080
+ content: [{
1081
+ type: 'text',
1082
+ text: enhancedError
1083
+ }]
1084
+ };
1060
1085
  }
1061
1086
  }
1062
1087
  catch (error) {
@@ -1082,6 +1107,9 @@ Use \`snow_deployment_debug\` for more information about this session.`,
1082
1107
  `https://${credentials.instance}/sp_config?id=widget_editor&sys_id=${createdWidget.sys_id}` :
1083
1108
  'ServiceNow instance URL not available';
1084
1109
  return {
1110
+ success: true,
1111
+ sys_id: createdWidget.sys_id,
1112
+ name: args.name,
1085
1113
  content: [{
1086
1114
  type: 'text',
1087
1115
  text: `✅ Widget deployed successfully! (Error Recovery)
@@ -1130,7 +1158,14 @@ ${is403Error ? '\n⚠️ **Possible False Negative**: Widget may have been crea
1130
1158
  • Use snow_widget_test() for validation
1131
1159
 
1132
1160
  📚 **Important**: If you see "403" or "Forbidden" errors, the widget may still have been created successfully. Check ServiceNow directly.`;
1133
- throw new Error(enhancedError);
1161
+ return {
1162
+ success: false,
1163
+ error: error instanceof Error ? error.message : String(error),
1164
+ content: [{
1165
+ type: 'text',
1166
+ text: enhancedError
1167
+ }]
1168
+ };
1134
1169
  }
1135
1170
  }
1136
1171
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "3.0.19",
3
+ "version": "3.0.20",
4
4
  "description": "Snow-Flow v3.0.18: DIRECT API VERIFICATION! 🚀 Replaced unreliable searchRecords with direct API calls (snow_query_table style) for widget verification. All null/403 error recovery now uses GET /api/now/table/sp_widget with precise queries. NO MORE FALSE NEGATIVES - verification works consistently every time!",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",