snow-flow 3.4.22 → 3.4.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.
|
@@ -852,7 +852,7 @@ class ServiceNowOperationsMCP {
|
|
|
852
852
|
return result;
|
|
853
853
|
}
|
|
854
854
|
catch (error) {
|
|
855
|
-
this.logger.
|
|
855
|
+
this.logger.operationError(name, error);
|
|
856
856
|
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to execute ${name}: ${error}`);
|
|
857
857
|
}
|
|
858
858
|
});
|
|
@@ -38,6 +38,10 @@ export declare class MCPLogger {
|
|
|
38
38
|
* Log error message
|
|
39
39
|
*/
|
|
40
40
|
error(message: string, error?: any): void;
|
|
41
|
+
/**
|
|
42
|
+
* Log operation error - ensures progress indicator is stopped
|
|
43
|
+
*/
|
|
44
|
+
operationError(operation: string, error: any): void;
|
|
41
45
|
/**
|
|
42
46
|
* Log debug message
|
|
43
47
|
*/
|
|
@@ -14,8 +14,7 @@ class MCPLogger {
|
|
|
14
14
|
this.lastProgressTime = Date.now();
|
|
15
15
|
this.progressInterval = null;
|
|
16
16
|
this.name = name;
|
|
17
|
-
//
|
|
18
|
-
this.startProgressIndicator();
|
|
17
|
+
// Don't start progress indicator automatically - only start when needed
|
|
19
18
|
}
|
|
20
19
|
/**
|
|
21
20
|
* Log to stderr with proper formatting
|
|
@@ -45,13 +44,13 @@ class MCPLogger {
|
|
|
45
44
|
* Start progress indicator for long-running operations
|
|
46
45
|
*/
|
|
47
46
|
startProgressIndicator() {
|
|
48
|
-
// Send progress every
|
|
47
|
+
// Send progress every 5 seconds (reduced frequency)
|
|
49
48
|
this.progressInterval = setInterval(() => {
|
|
50
49
|
const duration = Math.round((Date.now() - this.startTime) / 1000);
|
|
51
|
-
if (duration >
|
|
50
|
+
if (duration > 3) { // Only show progress after 3+ seconds
|
|
52
51
|
this.progress(`Operation in progress... (${duration}s elapsed, ${this.tokenUsage.total} tokens used)`);
|
|
53
52
|
}
|
|
54
|
-
},
|
|
53
|
+
}, 5000);
|
|
55
54
|
}
|
|
56
55
|
/**
|
|
57
56
|
* Stop progress indicator
|
|
@@ -85,6 +84,15 @@ class MCPLogger {
|
|
|
85
84
|
} : error;
|
|
86
85
|
this.log('ERROR', message, errorData);
|
|
87
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Log operation error - ensures progress indicator is stopped
|
|
89
|
+
*/
|
|
90
|
+
operationError(operation, error) {
|
|
91
|
+
const duration = Math.round((Date.now() - this.startTime) / 1000);
|
|
92
|
+
// Always stop progress indicator when operation fails
|
|
93
|
+
this.stopProgress();
|
|
94
|
+
this.error(`❌ Failed: ${operation} (${duration}s)`, error);
|
|
95
|
+
}
|
|
88
96
|
/**
|
|
89
97
|
* Log debug message
|
|
90
98
|
*/
|
|
@@ -133,27 +141,24 @@ class MCPLogger {
|
|
|
133
141
|
this.startTime = Date.now();
|
|
134
142
|
this.resetTokens(); // Actually reset tokens when starting new operation!
|
|
135
143
|
this.info(`🚀 Starting: ${operation}`, params);
|
|
144
|
+
// Start progress indicator after 3 seconds (only for long operations)
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
if (!this.progressInterval) {
|
|
147
|
+
this.startProgressIndicator();
|
|
148
|
+
}
|
|
149
|
+
}, 3000);
|
|
136
150
|
}
|
|
137
151
|
/**
|
|
138
152
|
* Log operation complete
|
|
139
153
|
*/
|
|
140
154
|
operationComplete(operation, result) {
|
|
141
155
|
const duration = Math.round((Date.now() - this.startTime) / 1000);
|
|
156
|
+
// Always stop progress indicator first
|
|
142
157
|
this.stopProgress();
|
|
143
158
|
this.info(`✅ Completed: ${operation} (${duration}s, ${this.tokenUsage.total} tokens)`, result);
|
|
144
|
-
//
|
|
145
|
-
if (this.tokenUsage.total > 0) {
|
|
146
|
-
console.error(`
|
|
147
|
-
═══════════════════════════════════════════════════════════
|
|
148
|
-
📊 ${this.name} - Operation Complete
|
|
149
|
-
─────────────────────────────────────────────────────────
|
|
150
|
-
⏱️ Duration: ${duration} seconds
|
|
151
|
-
🔢 Tokens Used: ${this.tokenUsage.total}
|
|
152
|
-
├─ Input: ${this.tokenUsage.input}
|
|
153
|
-
└─ Output: ${this.tokenUsage.output}
|
|
154
|
-
🎯 Operation: ${operation}
|
|
155
|
-
═══════════════════════════════════════════════════════════
|
|
156
|
-
`);
|
|
159
|
+
// Only show token report for operations with actual token usage
|
|
160
|
+
if (this.tokenUsage.total > 0 && duration > 1) {
|
|
161
|
+
console.error(`📊 [${this.name}] ${operation} completed: ${duration}s, ${this.tokenUsage.total} tokens`);
|
|
157
162
|
}
|
|
158
163
|
}
|
|
159
164
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.23",
|
|
4
4
|
"description": "ServiceNow development framework with MCP server integration. Executes background scripts using ES5 JavaScript only (ServiceNow Rhino engine requirement). Provides 17 MCP servers for complete ServiceNow operations including widget deployment with coherence validation, table operations, script execution, machine learning, advanced features, and comprehensive platform management.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|