snow-flow 4.5.22 → 4.5.23

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.
@@ -1281,19 +1281,34 @@ ${executionList}
1281
1281
  suggestion: 'Install Agent Workspace plugin: System Applications → All Available Applications → Search for "Agent Workspace"'
1282
1282
  };
1283
1283
  }
1284
+ // Fix from user feedback: Add ALL required fields for workspace creation
1285
+ const workspaceUrl = this.generateWorkspaceUrl(args.name);
1284
1286
  const workspaceData = {
1285
1287
  name: args.name,
1286
1288
  description: args.description || '',
1289
+ active: true,
1290
+ // CRITICAL: Add missing required fields
1291
+ workspace_url: workspaceUrl,
1292
+ navigation_type: 'tab',
1293
+ search_enabled: true,
1294
+ notifications_enabled: true,
1295
+ user_preference_controls_enabled: true,
1296
+ // Add default colors for branding
1297
+ primary_color: '#1F8476',
1298
+ brand_color: '#2FC2B0',
1299
+ // These will be updated after search config creation
1300
+ global_search: '',
1301
+ global_search_data: '',
1302
+ // Optional fields with defaults
1287
1303
  tables: args.tables ? args.tables.join(',') : '',
1288
1304
  home_page: args.home_page || '',
1289
1305
  theme: args.theme || 'default',
1290
- roles: args.roles ? args.roles.join(',') : '',
1291
- active: true
1306
+ roles: args.roles ? args.roles.join(',') : ''
1292
1307
  };
1293
1308
  this.logger.trackAPICall('CREATE', 'sys_aw_master_config', 1);
1294
1309
  const response = await this.client.createRecord('sys_aw_master_config', workspaceData);
1295
1310
  if (!response.success) {
1296
- // Provide specific error guidance
1311
+ // Enhanced error handling with required fields info
1297
1312
  if (response.error?.includes('403') || response.error?.includes('Forbidden')) {
1298
1313
  return {
1299
1314
  success: false,
@@ -1304,12 +1319,52 @@ ${executionList}
1304
1319
  if (response.error?.includes('400') || response.error?.includes('Bad Request')) {
1305
1320
  return {
1306
1321
  success: false,
1307
- error: 'Invalid workspace configuration. Agent Workspace may not be properly configured in this instance.',
1308
- suggestion: 'Verify Agent Workspace is enabled and configured. Check System Properties > Agent Workspace settings.'
1322
+ error: 'Invalid workspace configuration. Missing required fields detected.',
1323
+ suggestion: 'Verify all required fields: workspace_url, navigation_type, search settings.',
1324
+ remediation: 'Check ServiceNow Agent Workspace documentation for required field specifications'
1309
1325
  };
1310
1326
  }
1311
1327
  throw new Error(`Failed to create workspace: ${response.error}`);
1312
1328
  }
1329
+ const workspaceId = response.data.sys_id;
1330
+ // Fix from user feedback: Create global search config and update workspace
1331
+ try {
1332
+ const searchConfig = await this.client.createRecord('sys_aw_global_search_config', {
1333
+ name: `${args.name} Search`,
1334
+ workspace: workspaceId,
1335
+ active: true
1336
+ });
1337
+ if (searchConfig.success && searchConfig.data.sys_id) {
1338
+ // Update workspace with search config references
1339
+ await this.client.updateRecord('sys_aw_master_config', workspaceId, {
1340
+ global_search: searchConfig.data.sys_id,
1341
+ global_search_data: searchConfig.data.sys_id
1342
+ });
1343
+ }
1344
+ }
1345
+ catch (searchError) {
1346
+ this.logger.warn('Could not create search config, workspace created without search:', searchError);
1347
+ }
1348
+ // Fix from user feedback: Create tabs for each table automatically
1349
+ if (args.tables && args.tables.length > 0) {
1350
+ for (let i = 0; i < args.tables.length; i++) {
1351
+ const table = args.tables[i];
1352
+ const tabLabel = table.replace(/_/g, ' ').replace(/\b\w/g, (l) => l.toUpperCase());
1353
+ try {
1354
+ await this.client.createRecord('sys_aw_tab', {
1355
+ workspace: workspaceId,
1356
+ table: table,
1357
+ label: tabLabel,
1358
+ name: `${table}_tab`,
1359
+ order: (i + 1) * 100,
1360
+ active: true
1361
+ });
1362
+ }
1363
+ catch (tabError) {
1364
+ this.logger.warn(`Could not create tab for table ${table}:`, tabError);
1365
+ }
1366
+ }
1367
+ }
1313
1368
  return {
1314
1369
  content: [{
1315
1370
  type: 'text',
@@ -2871,6 +2926,37 @@ ${configList}${layoutsText}${offlineText}
2871
2926
  throw error;
2872
2927
  }
2873
2928
  }
2929
+ /**
2930
+ * Generate valid workspace URL from name (fix from user feedback)
2931
+ */
2932
+ generateWorkspaceUrl(name) {
2933
+ return name
2934
+ .toLowerCase()
2935
+ .trim()
2936
+ .replace(/\s+/g, '-') // Spaces -> hyphens
2937
+ .replace(/[^a-z0-9-]/g, '') // Remove special characters
2938
+ .replace(/--+/g, '-') // Multiple hyphens -> single
2939
+ .replace(/^-|-$/g, '') // Trim leading/trailing hyphens
2940
+ .substring(0, 80); // Max 80 chars (ServiceNow field limit)
2941
+ }
2942
+ /**
2943
+ * Validate workspace configuration (fix from user feedback)
2944
+ */
2945
+ validateWorkspaceConfig(config) {
2946
+ const errors = [];
2947
+ // Check required fields
2948
+ if (!config.name)
2949
+ errors.push('name is required');
2950
+ if (!config.workspace_url)
2951
+ errors.push('workspace_url is required');
2952
+ if (!config.navigation_type)
2953
+ errors.push('navigation_type is required');
2954
+ // Validate workspace_url format
2955
+ if (config.workspace_url && !/^[a-z0-9-]+$/.test(config.workspace_url)) {
2956
+ errors.push('workspace_url must contain only lowercase letters, numbers and hyphens');
2957
+ }
2958
+ return errors;
2959
+ }
2874
2960
  async run() {
2875
2961
  const transport = new stdio_js_1.StdioServerTransport();
2876
2962
  await this.server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.5.22",
3
+ "version": "4.5.23",
4
4
  "description": "Conversational ServiceNow development platform using Claude Code. Multi-agent orchestration with 20+ MCP servers providing 200+ ServiceNow tools for comprehensive platform development.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",