nofax 0.2.21 → 0.2.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.
- package/package.json +1 -1
- package/src/adapters/gemini.mjs +6 -1
- package/src/cli.mjs +16 -1
- package/src/mcp-server.mjs +1 -1
- package/src/protocol.mjs +6 -8
package/package.json
CHANGED
package/src/adapters/gemini.mjs
CHANGED
|
@@ -29,7 +29,12 @@ export async function handleGeminiHook(input, {
|
|
|
29
29
|
} = {}) {
|
|
30
30
|
if (!input || typeof input.hook_event_name !== 'string') throw new Error('NOFAX_GEMINI_EVENT');
|
|
31
31
|
if (input.hook_event_name === 'Notification') {
|
|
32
|
-
|
|
32
|
+
try {
|
|
33
|
+
return await handleGeminiNotification(input, { config, sendNotificationImpl });
|
|
34
|
+
} catch (error) {
|
|
35
|
+
onError(error);
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
39
|
if (input.hook_event_name !== 'BeforeTool') throw new Error('NOFAX_GEMINI_EVENT');
|
|
35
40
|
if (typeof input.tool_name !== 'string' || !input.tool_name) throw new Error('NOFAX_GEMINI_TOOL');
|
package/src/cli.mjs
CHANGED
|
@@ -58,8 +58,18 @@ async function runHook(adapter, deps) {
|
|
|
58
58
|
} catch {
|
|
59
59
|
throw new Error('NOFAX_HOOK_INVALID_JSON');
|
|
60
60
|
}
|
|
61
|
-
const config = await deps.loadConfigImpl({ env: deps.env });
|
|
62
61
|
const onError = (error) => deps.stderr.write(`nofax: ${error.message}\n`);
|
|
62
|
+
let config;
|
|
63
|
+
try {
|
|
64
|
+
config = await deps.loadConfigImpl({ env: deps.env });
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (adapter === 'gemini' && input.hook_event_name === 'Notification') {
|
|
67
|
+
onError(error);
|
|
68
|
+
writeJson(deps.stdout, {});
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
63
73
|
let output;
|
|
64
74
|
if (adapter === 'claude') {
|
|
65
75
|
output = await handleClaudePermissionRequest(input, { config, requestApprovalImpl: deps.requestApprovalImpl, onError });
|
|
@@ -204,6 +214,11 @@ export async function runCli(args, overrides = {}) {
|
|
|
204
214
|
writeJson(deps.stdout, { decision: 'ask' });
|
|
205
215
|
return 0;
|
|
206
216
|
}
|
|
217
|
+
if (adapter === 'claude' || adapter === 'codex') {
|
|
218
|
+
deps.stderr.write(`nofax: ${error.message}\n`);
|
|
219
|
+
deps.stderr.write('nofax: no remote decision; continuing with native approval.\n');
|
|
220
|
+
return 0;
|
|
221
|
+
}
|
|
207
222
|
throw error;
|
|
208
223
|
}
|
|
209
224
|
}
|
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.23' },
|
|
78
78
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
79
79
|
);
|
|
80
80
|
|
package/src/protocol.mjs
CHANGED
|
@@ -181,18 +181,16 @@ export function redactAndBound(value, options = {}) {
|
|
|
181
181
|
));
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
const entryName =
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
: typeof value.header === 'string'
|
|
189
|
-
? value.header
|
|
190
|
-
: null;
|
|
184
|
+
const entryName = Object.entries(value).find(([key, child]) => (
|
|
185
|
+
typeof child === 'string'
|
|
186
|
+
&& (key.toLowerCase() === 'name' || key.toLowerCase() === 'key' || key.toLowerCase() === 'header')
|
|
187
|
+
))?.[1] ?? null;
|
|
191
188
|
const redactEntryValue = entryName !== null && isSecretKey(entryName);
|
|
192
189
|
|
|
193
190
|
const out = {};
|
|
194
191
|
for (const [key, child] of Object.entries(value).slice(0, MAX_OBJECT_KEYS)) {
|
|
195
|
-
|
|
192
|
+
const normalizedKey = key.toLowerCase();
|
|
193
|
+
out[key] = isSecretKey(key) || (redactEntryValue && (normalizedKey === 'value' || normalizedKey === 'values'))
|
|
196
194
|
? '[REDACTED]'
|
|
197
195
|
: redactAndBound(child, { seen, depth: depth + 1 });
|
|
198
196
|
}
|