nofax 0.2.13 → 0.2.15
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/package.json +1 -1
- package/src/mcp-server.mjs +1 -1
- package/src/protocol.mjs +42 -5
package/package.json
CHANGED
package/src/mcp-server.mjs
CHANGED
|
@@ -74,7 +74,7 @@ const LIST_PENDING_OUTPUT_SCHEMA = z.object({
|
|
|
74
74
|
|
|
75
75
|
export function buildMcpServer({ handlers = createMcpToolHandlers() } = {}) {
|
|
76
76
|
const server = new McpServer(
|
|
77
|
-
{ name: 'nofax', version: '0.2.
|
|
77
|
+
{ name: 'nofax', version: '0.2.15' },
|
|
78
78
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
79
79
|
);
|
|
80
80
|
|
package/src/protocol.mjs
CHANGED
|
@@ -9,10 +9,40 @@ const MAX_SUMMARY = 2200;
|
|
|
9
9
|
const MAX_RESPONSE_TEXT = 2000;
|
|
10
10
|
|
|
11
11
|
function normalizeSecretKeyName(key) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let normalized = '';
|
|
13
|
+
|
|
14
|
+
for (let index = 0; index < key.length; index += 1) {
|
|
15
|
+
const char = key[index];
|
|
16
|
+
const code = char.charCodeAt(0);
|
|
17
|
+
const isUpper = code >= 65 && code <= 90;
|
|
18
|
+
const isLower = code >= 97 && code <= 122;
|
|
19
|
+
const isDigit = code >= 48 && code <= 57;
|
|
20
|
+
|
|
21
|
+
if (!isUpper && !isLower && !isDigit) {
|
|
22
|
+
if (normalized && !normalized.endsWith('_')) normalized += '_';
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const previousCode = index > 0 ? key.charCodeAt(index - 1) : -1;
|
|
27
|
+
const nextCode = index + 1 < key.length ? key.charCodeAt(index + 1) : -1;
|
|
28
|
+
const previousIsUpper = previousCode >= 65 && previousCode <= 90;
|
|
29
|
+
const previousIsLower = previousCode >= 97 && previousCode <= 122;
|
|
30
|
+
const previousIsDigit = previousCode >= 48 && previousCode <= 57;
|
|
31
|
+
const nextIsLower = nextCode >= 97 && nextCode <= 122;
|
|
32
|
+
|
|
33
|
+
if (
|
|
34
|
+
isUpper
|
|
35
|
+
&& normalized
|
|
36
|
+
&& !normalized.endsWith('_')
|
|
37
|
+
&& (previousIsLower || previousIsDigit || (previousIsUpper && nextIsLower))
|
|
38
|
+
) {
|
|
39
|
+
normalized += '_';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
normalized += char;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return normalized;
|
|
16
46
|
}
|
|
17
47
|
|
|
18
48
|
function isSecretKey(key) {
|
|
@@ -136,9 +166,16 @@ export function redactAndBound(value, options = {}) {
|
|
|
136
166
|
return value.slice(0, MAX_ARRAY).map((item) => redactAndBound(item, { seen, depth: depth + 1 }));
|
|
137
167
|
}
|
|
138
168
|
|
|
169
|
+
const entryName = typeof value.name === 'string'
|
|
170
|
+
? value.name
|
|
171
|
+
: typeof value.key === 'string'
|
|
172
|
+
? value.key
|
|
173
|
+
: null;
|
|
174
|
+
const redactEntryValue = entryName !== null && isSecretKey(entryName);
|
|
175
|
+
|
|
139
176
|
const out = {};
|
|
140
177
|
for (const [key, child] of Object.entries(value).slice(0, MAX_OBJECT_KEYS)) {
|
|
141
|
-
out[key] = isSecretKey(key)
|
|
178
|
+
out[key] = isSecretKey(key) || (redactEntryValue && (key === 'value' || key === 'values'))
|
|
142
179
|
? '[REDACTED]'
|
|
143
180
|
: redactAndBound(child, { seen, depth: depth + 1 });
|
|
144
181
|
}
|