snow-flow 3.4.21 ā 3.4.22
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.
|
@@ -68,7 +68,7 @@ export declare class MCPLogger {
|
|
|
68
68
|
getTokenUsage(): TokenUsage;
|
|
69
69
|
/**
|
|
70
70
|
* Add token usage to MCP response
|
|
71
|
-
* Helper method to append token usage to tool response
|
|
71
|
+
* Helper method to append token usage to tool response via _meta field
|
|
72
72
|
*/
|
|
73
73
|
addTokenUsageToResponse(result: any): any;
|
|
74
74
|
/**
|
|
@@ -164,15 +164,26 @@ class MCPLogger {
|
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
166
|
* Add token usage to MCP response
|
|
167
|
-
* Helper method to append token usage to tool response
|
|
167
|
+
* Helper method to append token usage to tool response via _meta field
|
|
168
168
|
*/
|
|
169
169
|
addTokenUsageToResponse(result) {
|
|
170
170
|
const tokenUsage = this.getTokenUsage();
|
|
171
|
-
if (
|
|
172
|
-
//
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
if (tokenUsage.total > 0) {
|
|
172
|
+
// Add token usage to _meta field for Claude Code UI
|
|
173
|
+
if (!result._meta) {
|
|
174
|
+
result._meta = {};
|
|
175
|
+
}
|
|
176
|
+
result._meta.tokenUsage = {
|
|
177
|
+
input: tokenUsage.input,
|
|
178
|
+
output: tokenUsage.output,
|
|
179
|
+
total: tokenUsage.total
|
|
180
|
+
};
|
|
181
|
+
// Also keep text display for compatibility
|
|
182
|
+
if (result && result.content && Array.isArray(result.content)) {
|
|
183
|
+
const lastContent = result.content[result.content.length - 1];
|
|
184
|
+
if (lastContent && lastContent.type === 'text') {
|
|
185
|
+
lastContent.text += `\n\nš Token Usage: ${tokenUsage.total} (Input: ${tokenUsage.input}, Output: ${tokenUsage.output})`;
|
|
186
|
+
}
|
|
176
187
|
}
|
|
177
188
|
}
|
|
178
189
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.22",
|
|
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",
|