snow-flow 3.6.2 ā 3.6.4
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.
package/dist/cli.js
CHANGED
|
@@ -2584,6 +2584,14 @@ async function createMCPConfig(targetDir, force = false) {
|
|
|
2584
2584
|
"Bash(sudo *)"
|
|
2585
2585
|
]
|
|
2586
2586
|
},
|
|
2587
|
+
"autoCompactThreshold": 0.65,
|
|
2588
|
+
"compactMode": "aggressive",
|
|
2589
|
+
"contextPreservation": {
|
|
2590
|
+
"preserveMCPState": true,
|
|
2591
|
+
"preserveToolResults": true,
|
|
2592
|
+
"preserveRecentContext": 5000,
|
|
2593
|
+
"prioritizeServiceNowOperations": true
|
|
2594
|
+
},
|
|
2587
2595
|
"hooks": {
|
|
2588
2596
|
"PreCompact": [
|
|
2589
2597
|
{
|
|
@@ -2597,10 +2605,11 @@ async function createMCPConfig(targetDir, force = false) {
|
|
|
2597
2605
|
},
|
|
2598
2606
|
{
|
|
2599
2607
|
"matcher": "auto",
|
|
2608
|
+
"threshold": 0.65,
|
|
2600
2609
|
"hooks": [
|
|
2601
2610
|
{
|
|
2602
2611
|
"type": "command",
|
|
2603
|
-
"command": "/bin/bash -c 'echo \"
|
|
2612
|
+
"command": "/bin/bash -c 'echo \"ā” EARLY Auto-Compact triggered at 65% context usage\"; echo \"š Compacting BEFORE API calls fail\"; echo \"š Preserving critical Snow-Flow context:\"; echo \" ⢠Active MCP connections and tool state\"; echo \" ⢠Recent ServiceNow operations and results\"; echo \" ⢠Current artifact sync status\"; echo \" ⢠Authentication and session data\"; echo \"ā ļø This prevents mid-operation failures\"; echo \"ā
Safe compact at 65% threshold\"'"
|
|
2604
2613
|
}
|
|
2605
2614
|
]
|
|
2606
2615
|
}
|
|
@@ -2620,6 +2629,10 @@ async function createMCPConfig(targetDir, force = false) {
|
|
|
2620
2629
|
"CLAUDE_CODE_TIMEOUT": "0",
|
|
2621
2630
|
"CLAUDE_CODE_SESSION_TIMEOUT": "0",
|
|
2622
2631
|
"CLAUDE_CODE_EXECUTION_TIMEOUT": "0",
|
|
2632
|
+
"CLAUDE_CODE_EARLY_COMPACT": "true",
|
|
2633
|
+
"CLAUDE_CODE_COMPACT_THRESHOLD": "0.65",
|
|
2634
|
+
"CLAUDE_CODE_PRESERVE_MCP_STATE": "true",
|
|
2635
|
+
"CLAUDE_CODE_CONTEXT_WINDOW_BUFFER": "35",
|
|
2623
2636
|
"SNOW_FLOW_DEBUG": "false",
|
|
2624
2637
|
"SNOW_FLOW_LOG_LEVEL": "info",
|
|
2625
2638
|
"MCP_DEBUG": "false",
|
|
@@ -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 =
|
|
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
|
-
//
|
|
722
|
-
const response = await (0, mcp_timeout_config_js_1.withMCPTimeout)(this.client.searchRecords(table, `sys_id=${sys_id}`, 1),
|
|
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.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.6.4",
|
|
4
|
+
"description": "EARLY AUTO-COMPACT at 65% context usage prevents mid-API failures. v3.6.4 triggers compact BEFORE context window issues, not after. Aggressive compact mode with MCP state preservation. Prevents 'too many tokens' errors during ServiceNow operations. Includes infinite hanging fix, consolidated CLAUDE.md with 18 MCP servers, NO MOCK DATA policy, audit logging, and ES5 enforcement.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|