nofax 0.2.13 → 0.2.14

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nofax",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "mcpName": "io.github.AKzar1el/nofax",
5
5
  "description": "Human-in-the-loop approvals and notifications for AI coding agents via CLI, MCP, and agent hooks.",
6
6
  "type": "module",
@@ -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.13' },
77
+ { name: 'nofax', version: '0.2.14' },
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
- return key
13
- .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
14
- .replace(/([a-z0-9])([A-Z])/g, '$1_$2')
15
- .replace(/[^A-Za-z0-9]+/g, '_');
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,18 @@ 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
175
+ && Object.prototype.hasOwnProperty.call(value, 'value')
176
+ && isSecretKey(entryName);
177
+
139
178
  const out = {};
140
179
  for (const [key, child] of Object.entries(value).slice(0, MAX_OBJECT_KEYS)) {
141
- out[key] = isSecretKey(key)
180
+ out[key] = isSecretKey(key) || (redactEntryValue && key === 'value')
142
181
  ? '[REDACTED]'
143
182
  : redactAndBound(child, { seen, depth: depth + 1 });
144
183
  }