snow-flow 3.6.2 → 3.6.3

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.
@@ -262,8 +262,8 @@ class ServiceNowLocalDevelopmentMCP extends enhanced_base_mcp_server_js_1.Enhanc
262
262
  async pullArtifact(args) {
263
263
  const { sys_id, table } = args;
264
264
  const startTime = Date.now();
265
- // Add timeout for pull operations
266
- const PULL_TIMEOUT = 15000; // 15 seconds for pull operations
265
+ // Add timeout for pull operations (must be longer than pullArtifactBySysId's 30s timeout)
266
+ const PULL_TIMEOUT = 35000; // 35 seconds for pull operations (allows 30s for detection + 5s buffer)
267
267
  try {
268
268
  const pullPromise = (async () => {
269
269
  let artifact;
@@ -47,6 +47,15 @@ class MCPLogger {
47
47
  // Send progress every 5 seconds (reduced frequency)
48
48
  this.progressInterval = setInterval(() => {
49
49
  const duration = Math.round((Date.now() - this.startTime) / 1000);
50
+ // CRITICAL: Stop progress after 60 seconds to prevent infinite loops
51
+ if (duration > 60) {
52
+ console.error(`⚠️ [${this.name}] Operation exceeded maximum time (60s). Stopping progress indicator.`);
53
+ this.stopProgress();
54
+ // Force stop the operation by throwing timeout error
55
+ const timeoutError = new Error(`Operation timeout: exceeded 60 seconds`);
56
+ this.operationError('Operation timeout', timeoutError);
57
+ return;
58
+ }
50
59
  if (duration > 3) { // Only show progress after 3+ seconds
51
60
  this.progress(`Operation in progress... (${duration}s elapsed, ${this.tokenUsage.total} tokens used)`);
52
61
  }
@@ -708,6 +708,9 @@ snow-flow sync status ${widget.sys_id}
708
708
  async pullArtifactBySysId(sys_id) {
709
709
  console.log(`\n🔍 Auto-detecting artifact type for sys_id: ${sys_id}`);
710
710
  console.log(`📋 Checking ${Object.keys(artifact_registry_1.ARTIFACT_REGISTRY).length} supported tables...`);
711
+ // CRITICAL: Add MAXIMUM operation timeout to prevent infinite hanging
712
+ const MAX_OPERATION_TIME = 30000; // 30 seconds max for entire operation
713
+ const operationStart = Date.now();
711
714
  // SMART ORDER: Check most common tables first for better performance
712
715
  const allTables = Object.keys(artifact_registry_1.ARTIFACT_REGISTRY);
713
716
  const commonTables = ['sp_widget', 'sys_script_include', 'sys_script', 'sys_ui_page'];
@@ -716,10 +719,15 @@ snow-flow sync status ${widget.sys_id}
716
719
  const timeoutConfig = (0, mcp_timeout_config_js_1.getMCPTimeoutConfig)();
717
720
  const errors = [];
718
721
  for (const table of tables) {
722
+ // Check if we've exceeded maximum operation time
723
+ if (Date.now() - operationStart > MAX_OPERATION_TIME) {
724
+ console.log(`\n⏱️ Maximum operation time (30s) exceeded. Stopping search.`);
725
+ break;
726
+ }
719
727
  try {
720
728
  console.log(` 🔎 Checking table: ${table}...`);
721
- // Increased timeout for better reliability
722
- const response = await (0, mcp_timeout_config_js_1.withMCPTimeout)(this.client.searchRecords(table, `sys_id=${sys_id}`, 1), 8000, // 8 second timeout per table (was 3s)
729
+ // Reduced timeout per table for faster failure
730
+ const response = await (0, mcp_timeout_config_js_1.withMCPTimeout)(this.client.searchRecords(table, `sys_id=${sys_id}`, 1), 3000, // 3 second timeout per table (reduced from 8s)
723
731
  `Detect table for ${sys_id}`);
724
732
  if (response.result?.[0]) {
725
733
  console.log(` ✅ Found in table: ${table}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "3.6.2",
4
- "description": "ServiceNow framework with CONSOLIDATED CLAUDE.md (78% smaller, 100% complete). v3.6.2 features systematic documentation of ALL 18 MCP servers and 200+ tools. NO MOCK DATA policy enforced. Complete tool reference for snow_pull_artifact, snow_deploy, snow_execute_script_with_output, and all ServiceNow operations. Includes audit logging, token tracking, ES5 enforcement, and production-ready code requirements. Optimized for Claude Code with comprehensive MCP tool awareness.",
3
+ "version": "3.6.3",
4
+ "description": "EMERGENCY FIX: Prevents infinite hanging in servicenow-local-development. v3.6.3 adds maximum operation timeouts (30s for artifact detection, 60s for progress indicator) to prevent operations from running forever. Fixes pullArtifactBySysId with fail-fast mechanism. Consolidated CLAUDE.md with ALL 18 MCP servers and 200+ tools. NO MOCK DATA policy enforced. Includes audit logging, token tracking, and ES5 enforcement.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
7
7
  "bin": {