nofax 0.2.43 → 0.2.44
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/CHANGELOG.md +13 -0
- package/package.json +3 -3
- package/src/mcp-server.mjs +1 -1
- package/src/mcp-tools.mjs +5 -2
- package/src/ntfy.mjs +70 -21
package/CHANGELOG.md
CHANGED
|
@@ -42,6 +42,19 @@ Local Nofax `0.2.x` behavior is unchanged by these removals.
|
|
|
42
42
|
- The capability-path form is normalized to `/mcp` before MCP protocol handling.
|
|
43
43
|
- Remote read operations perform no external messaging/provider calls; only explicit `nofax_notify` invokes ntfy.
|
|
44
44
|
|
|
45
|
+
## 0.2.44 - 2026-10-24
|
|
46
|
+
|
|
47
|
+
### Security
|
|
48
|
+
|
|
49
|
+
- Updated the local MCP server and Zod runtime dependencies to patched, audited versions. The remote Worker MCP, Agents, and Zod dependency manifests were also updated; their production deployment is a separate operation.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Response polling now bounds fetch and response-body reads by each CLI/MCP caller's remaining deadline, so a stalled ntfy response stream cannot indefinitely extend a pending wait.
|
|
54
|
+
- Best-effort notification confirming an already-persisted human response now has a bounded transport deadline rather than potentially blocking the caller indefinitely.
|
|
55
|
+
|
|
56
|
+
Pending, timeout, disconnect, transport errors, and notification delivery never mean approval. Durable human-decision ownership, response-topic secrecy, and the intentionally narrower remote Worker authority remain unchanged.
|
|
57
|
+
|
|
45
58
|
## 0.2.43 - 2026-09-24
|
|
46
59
|
|
|
47
60
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nofax",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.44",
|
|
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",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"node": ">=20.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@modelcontextprotocol/server": "2.
|
|
34
|
-
"zod": "4.
|
|
33
|
+
"@modelcontextprotocol/server": "2.4.0",
|
|
34
|
+
"zod": "4.6.7"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [
|
|
37
37
|
"ai-agent",
|
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.44' },
|
|
78
78
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
79
79
|
);
|
|
80
80
|
|
package/src/mcp-tools.mjs
CHANGED
|
@@ -260,13 +260,16 @@ export function createMcpToolHandlers(overrides = {}) {
|
|
|
260
260
|
? { server: request.server, topic: request.topic }
|
|
261
261
|
: await config();
|
|
262
262
|
const deadline = deps.nowImpl() + seconds * 1000;
|
|
263
|
-
while (
|
|
263
|
+
while (true) {
|
|
264
|
+
const remainingBeforePoll = deadline - deps.nowImpl();
|
|
265
|
+
if (remainingBeforePoll <= 0) break;
|
|
264
266
|
const response = await deps.pollRemoteResponseImpl({
|
|
265
267
|
config: current,
|
|
266
268
|
responseTopic: request.responseTopic,
|
|
267
269
|
requestId: request.requestId,
|
|
268
270
|
allowed: request.allowed,
|
|
269
|
-
kind: request.kind
|
|
271
|
+
kind: request.kind,
|
|
272
|
+
timeoutMs: remainingBeforePoll
|
|
270
273
|
});
|
|
271
274
|
if (response !== null) {
|
|
272
275
|
const resolution = await deps.resolveRequestWithClaimImpl({
|
package/src/ntfy.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { createRequestId, createResponseTopic, parseResponseMessage } from './pr
|
|
|
3
3
|
const MAX_TITLE = 120;
|
|
4
4
|
const MAX_MESSAGE = 2200;
|
|
5
5
|
const DEFAULT_REFINE_SHORTCUT = 'Nofax Refine';
|
|
6
|
+
const POLL_TIMEOUT = Symbol('NOFAX_POLL_TIMEOUT');
|
|
6
7
|
// ntfy rejects validation and rate-limit responses before accepting the publish.
|
|
7
8
|
const NOT_APPLIED_PUBLISH_STATUSES = new Set([400, 429]);
|
|
8
9
|
|
|
@@ -71,7 +72,7 @@ function publishError(message, deliveryState) {
|
|
|
71
72
|
return error;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
export async function sendNotification({ config, title, message, actions, priority = 4, tags = ['bell'], fetchImpl = fetch }) {
|
|
75
|
+
export async function sendNotification({ config, title, message, actions, priority = 4, tags = ['bell'], signal, fetchImpl = fetch }) {
|
|
75
76
|
const payload = {
|
|
76
77
|
topic: config.topic,
|
|
77
78
|
title: boundText(title, MAX_TITLE, 'TITLE'),
|
|
@@ -86,7 +87,8 @@ export async function sendNotification({ config, title, message, actions, priori
|
|
|
86
87
|
response = await fetchImpl(`${config.server}/`, {
|
|
87
88
|
method: 'POST',
|
|
88
89
|
headers: { 'content-type': 'application/json' },
|
|
89
|
-
body: JSON.stringify(payload)
|
|
90
|
+
body: JSON.stringify(payload),
|
|
91
|
+
...(signal === undefined ? {} : { signal })
|
|
90
92
|
});
|
|
91
93
|
} catch (error) {
|
|
92
94
|
throw publishError(`NOFAX_NTFY_PUBLISH_NETWORK: ${error?.message ?? String(error)}`, 'ambiguous');
|
|
@@ -179,21 +181,49 @@ function parseNtfyPoll(text, requestId, allowed, kind) {
|
|
|
179
181
|
return null;
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
export async function pollRemoteResponse({ config, responseTopic, requestId, allowed, kind, fetchImpl = fetch }) {
|
|
183
|
-
let
|
|
184
|
+
export async function pollRemoteResponse({ config, responseTopic, requestId, allowed, kind, timeoutMs, fetchImpl = fetch }) {
|
|
185
|
+
let timeoutId;
|
|
186
|
+
const controller = timeoutMs === undefined ? null : new AbortController();
|
|
187
|
+
const timeout = controller === null
|
|
188
|
+
? null
|
|
189
|
+
: new Promise((resolve) => {
|
|
190
|
+
timeoutId = setTimeout(() => {
|
|
191
|
+
controller.abort();
|
|
192
|
+
resolve(POLL_TIMEOUT);
|
|
193
|
+
}, timeoutMs);
|
|
194
|
+
});
|
|
184
195
|
try {
|
|
185
|
-
response
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
196
|
+
let response;
|
|
197
|
+
try {
|
|
198
|
+
const request = fetchImpl(`${config.server}/${responseTopic}/json?poll=1&since=all`, {
|
|
199
|
+
method: 'GET',
|
|
200
|
+
headers: { accept: 'application/x-ndjson' },
|
|
201
|
+
...(controller === null ? {} : { signal: controller.signal })
|
|
202
|
+
});
|
|
203
|
+
response = timeout === null ? await request : await Promise.race([request, timeout]);
|
|
204
|
+
} catch (error) {
|
|
205
|
+
if (controller?.signal.aborted) return null;
|
|
206
|
+
throw new Error(`NOFAX_NTFY_POLL_NETWORK: ${error?.message ?? String(error)}`);
|
|
207
|
+
}
|
|
208
|
+
if (response === POLL_TIMEOUT) return null;
|
|
209
|
+
await ensureOk(response, 'NOFAX_NTFY_POLL');
|
|
210
|
+
|
|
211
|
+
let text;
|
|
212
|
+
try {
|
|
213
|
+
const body = response.text();
|
|
214
|
+
text = timeout === null ? await body : await Promise.race([body, timeout]);
|
|
215
|
+
} catch (error) {
|
|
216
|
+
if (controller?.signal.aborted) return null;
|
|
217
|
+
throw error;
|
|
218
|
+
}
|
|
219
|
+
if (text === POLL_TIMEOUT) return null;
|
|
220
|
+
return parseNtfyPoll(text, requestId, allowed, kind);
|
|
221
|
+
} finally {
|
|
222
|
+
if (timeoutId !== undefined) clearTimeout(timeoutId);
|
|
191
223
|
}
|
|
192
|
-
await ensureOk(response, 'NOFAX_NTFY_POLL');
|
|
193
|
-
return parseNtfyPoll(await response.text(), requestId, allowed, kind);
|
|
194
224
|
}
|
|
195
225
|
|
|
196
|
-
export async function sendResponseConfirmation({ config, response, kind, title = 'Nofax', fetchImpl = fetch }) {
|
|
226
|
+
export async function sendResponseConfirmation({ config, response, kind, title = 'Nofax', timeoutMs = 5000, fetchImpl = fetch }) {
|
|
197
227
|
let confirmationTitle = 'Response received';
|
|
198
228
|
let tag = 'white_check_mark';
|
|
199
229
|
if (kind === 'choice') confirmationTitle = 'Choice received';
|
|
@@ -205,8 +235,15 @@ export async function sendResponseConfirmation({ config, response, kind, title =
|
|
|
205
235
|
} else if (response.decision === 'refine') confirmationTitle = 'Refinement received';
|
|
206
236
|
else confirmationTitle = 'Choice received';
|
|
207
237
|
|
|
208
|
-
|
|
209
|
-
|
|
238
|
+
const controller = new AbortController();
|
|
239
|
+
let timeoutId;
|
|
240
|
+
const timeout = new Promise((resolve) => {
|
|
241
|
+
timeoutId = setTimeout(() => {
|
|
242
|
+
controller.abort();
|
|
243
|
+
resolve(false);
|
|
244
|
+
}, timeoutMs);
|
|
245
|
+
});
|
|
246
|
+
const delivery = sendNotification({
|
|
210
247
|
config,
|
|
211
248
|
title: `${confirmationTitle} - ${title}`,
|
|
212
249
|
message: kind !== 'choice' && response.decision === 'refine'
|
|
@@ -214,11 +251,13 @@ export async function sendResponseConfirmation({ config, response, kind, title =
|
|
|
214
251
|
: `Nofax recorded: ${response.decision}`,
|
|
215
252
|
priority: 2,
|
|
216
253
|
tags: [tag],
|
|
254
|
+
signal: controller.signal,
|
|
217
255
|
fetchImpl
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
256
|
+
}).then(() => true, () => false);
|
|
257
|
+
try {
|
|
258
|
+
return await Promise.race([delivery, timeout]);
|
|
259
|
+
} finally {
|
|
260
|
+
clearTimeout(timeoutId);
|
|
222
261
|
}
|
|
223
262
|
}
|
|
224
263
|
|
|
@@ -235,8 +274,18 @@ export async function waitRemoteResponse({
|
|
|
235
274
|
sleepImpl = sleep
|
|
236
275
|
}) {
|
|
237
276
|
const deadline = nowImpl() + timeoutMs;
|
|
238
|
-
while (
|
|
239
|
-
const
|
|
277
|
+
while (true) {
|
|
278
|
+
const remainingBeforePoll = deadline - nowImpl();
|
|
279
|
+
if (remainingBeforePoll <= 0) break;
|
|
280
|
+
const response = await pollRemoteResponse({
|
|
281
|
+
config,
|
|
282
|
+
responseTopic,
|
|
283
|
+
requestId,
|
|
284
|
+
allowed,
|
|
285
|
+
kind,
|
|
286
|
+
timeoutMs: remainingBeforePoll,
|
|
287
|
+
fetchImpl
|
|
288
|
+
});
|
|
240
289
|
if (response !== null) return response;
|
|
241
290
|
const remaining = deadline - nowImpl();
|
|
242
291
|
if (remaining <= 0) break;
|