nofax 0.2.44 → 0.2.45
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 +9 -0
- package/README.md +40 -0
- package/package.json +1 -1
- package/src/mcp-server.mjs +1 -1
- package/src/ntfy.mjs +45 -5
package/CHANGELOG.md
CHANGED
|
@@ -42,6 +42,15 @@ 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.45 - 2026-10-25
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- Initial approval, choice, and refinement notification publication now has a bounded transport deadline when ntfy does not settle.
|
|
50
|
+
- Standalone CLI, MCP, and advisory hook notifications now abort stalled ntfy publication after 15 seconds and report ambiguous delivery rather than hanging indefinitely.
|
|
51
|
+
|
|
52
|
+
Pending requests, transport timeouts, uncertain notification delivery, and disconnects never constitute human approval. No automatic publication retry or remote Worker authority expansion is introduced.
|
|
53
|
+
|
|
45
54
|
## 0.2.44 - 2026-10-24
|
|
46
55
|
|
|
47
56
|
### Security
|
package/README.md
CHANGED
|
@@ -97,6 +97,46 @@ Start the local stdio MCP server:
|
|
|
97
97
|
nofax mcp
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
### Connect an MCP client
|
|
101
|
+
|
|
102
|
+
Claude Code can launch the published local MCP server directly:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
claude mcp add nofax -- npx -y nofax mcp
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Codex CLI can register the same stdio server:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
codex mcp add nofax -- npx -y nofax mcp
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Gemini CLI can register it in user settings:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
gemini mcp add --scope user --transport stdio nofax npx -- -y nofax mcp
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Gemini CLI may mark configured servers **Disabled** when the current workspace is untrusted. Review and trust only workspaces you control through Gemini's normal trust flow; do not use `--trust` to bypass MCP tool-call confirmations. Registering an MCP server does not automatically install the separate permission hooks documented below.
|
|
121
|
+
|
|
122
|
+
VS Code can register Nofax in its user-profile MCP configuration. Open the Command Palette, choose `MCP: Open User Configuration`, and add this entry to `mcp.json`:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"servers": {
|
|
127
|
+
"nofax": {
|
|
128
|
+
"type": "stdio",
|
|
129
|
+
"command": "npx",
|
|
130
|
+
"args": ["-y", "nofax", "mcp"]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Merge the `nofax` entry with any existing servers rather than replacing them. Review VS Code's normal server-trust prompt before starting it; MCP registration does not install separate permission hooks.
|
|
137
|
+
|
|
138
|
+
For other stdio MCP clients, set the command to `npx` with arguments `["-y", "nofax", "mcp"]`. The final `mcp` argument is required: running `npx -y nofax` without it prints the CLI usage and exits instead of starting a server. Complete the Quick start configuration before using notification or approval tools.
|
|
139
|
+
|
|
100
140
|
Local MCP exposes:
|
|
101
141
|
|
|
102
142
|
- `nofax_notify`
|
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.45' },
|
|
78
78
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
79
79
|
);
|
|
80
80
|
|
package/src/ntfy.mjs
CHANGED
|
@@ -4,6 +4,8 @@ const MAX_TITLE = 120;
|
|
|
4
4
|
const MAX_MESSAGE = 2200;
|
|
5
5
|
const DEFAULT_REFINE_SHORTCUT = 'Nofax Refine';
|
|
6
6
|
const POLL_TIMEOUT = Symbol('NOFAX_POLL_TIMEOUT');
|
|
7
|
+
const PUBLISH_TIMEOUT = Symbol('NOFAX_PUBLISH_TIMEOUT');
|
|
8
|
+
const DEFAULT_PUBLISH_TIMEOUT_MS = 15_000;
|
|
7
9
|
// ntfy rejects validation and rate-limit responses before accepting the publish.
|
|
8
10
|
const NOT_APPLIED_PUBLISH_STATUSES = new Set([400, 429]);
|
|
9
11
|
|
|
@@ -72,7 +74,7 @@ function publishError(message, deliveryState) {
|
|
|
72
74
|
return error;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
export async function sendNotification({ config, title, message, actions, priority = 4, tags = ['bell'], signal, fetchImpl = fetch }) {
|
|
77
|
+
export async function sendNotification({ config, title, message, actions, priority = 4, tags = ['bell'], signal, fetchImpl = fetch, timeoutMs = DEFAULT_PUBLISH_TIMEOUT_MS }) {
|
|
76
78
|
const payload = {
|
|
77
79
|
topic: config.topic,
|
|
78
80
|
title: boundText(title, MAX_TITLE, 'TITLE'),
|
|
@@ -82,17 +84,35 @@ export async function sendNotification({ config, title, message, actions, priori
|
|
|
82
84
|
};
|
|
83
85
|
if (actions?.length) payload.actions = actions;
|
|
84
86
|
|
|
87
|
+
// Caller-managed approval publication and confirmation already have a deadline.
|
|
88
|
+
// A direct notification needs its own bounded transport when no signal is supplied.
|
|
89
|
+
const ownsTimeout = signal === undefined;
|
|
90
|
+
if (ownsTimeout && (!Number.isFinite(timeoutMs) || timeoutMs <= 0)) {
|
|
91
|
+
throw new Error('NOFAX_PUBLISH_TIMEOUT_INVALID');
|
|
92
|
+
}
|
|
93
|
+
const controller = ownsTimeout ? new AbortController() : null;
|
|
94
|
+
let timeoutId;
|
|
95
|
+
const timeout = controller === null ? null : new Promise((resolve) => {
|
|
96
|
+
timeoutId = setTimeout(() => {
|
|
97
|
+
resolve(PUBLISH_TIMEOUT);
|
|
98
|
+
controller.abort();
|
|
99
|
+
}, timeoutMs);
|
|
100
|
+
});
|
|
85
101
|
let response;
|
|
86
102
|
try {
|
|
87
|
-
|
|
103
|
+
const request = fetchImpl(`${config.server}/`, {
|
|
88
104
|
method: 'POST',
|
|
89
105
|
headers: { 'content-type': 'application/json' },
|
|
90
106
|
body: JSON.stringify(payload),
|
|
91
|
-
|
|
107
|
+
signal: controller === null ? signal : controller.signal
|
|
92
108
|
});
|
|
109
|
+
response = timeout === null ? await request : await Promise.race([request, timeout]);
|
|
93
110
|
} catch (error) {
|
|
94
111
|
throw publishError(`NOFAX_NTFY_PUBLISH_NETWORK: ${error?.message ?? String(error)}`, 'ambiguous');
|
|
112
|
+
} finally {
|
|
113
|
+
if (timeoutId !== undefined) clearTimeout(timeoutId);
|
|
95
114
|
}
|
|
115
|
+
if (response === PUBLISH_TIMEOUT) throw publishError('NOFAX_NTFY_PUBLISH_TIMEOUT', 'ambiguous');
|
|
96
116
|
if (!response?.ok) {
|
|
97
117
|
const status = response?.status ?? 'NETWORK';
|
|
98
118
|
const deliveryState = NOT_APPLIED_PUBLISH_STATUSES.has(status) ? 'not_applied' : 'ambiguous';
|
|
@@ -127,6 +147,7 @@ export async function createRemoteRequest({
|
|
|
127
147
|
includeRefine = false,
|
|
128
148
|
shortcutName = config.refineShortcutName ?? DEFAULT_REFINE_SHORTCUT,
|
|
129
149
|
beforePublish = async () => {},
|
|
150
|
+
publishTimeoutMs = DEFAULT_PUBLISH_TIMEOUT_MS,
|
|
130
151
|
fetchImpl = fetch
|
|
131
152
|
}) {
|
|
132
153
|
const normalized = normalizeOptions(options);
|
|
@@ -161,7 +182,25 @@ export async function createRemoteRequest({
|
|
|
161
182
|
|
|
162
183
|
const remote = { requestId, responseTopic, allowed };
|
|
163
184
|
await beforePublish(remote);
|
|
164
|
-
|
|
185
|
+
if (!Number.isFinite(publishTimeoutMs) || publishTimeoutMs <= 0) throw new Error('NOFAX_PUBLISH_TIMEOUT_INVALID');
|
|
186
|
+
const controller = new AbortController();
|
|
187
|
+
let timeoutId;
|
|
188
|
+
const timeout = new Promise((resolve) => {
|
|
189
|
+
timeoutId = setTimeout(() => {
|
|
190
|
+
resolve(PUBLISH_TIMEOUT);
|
|
191
|
+
controller.abort();
|
|
192
|
+
}, publishTimeoutMs);
|
|
193
|
+
});
|
|
194
|
+
try {
|
|
195
|
+
const delivered = await Promise.race([
|
|
196
|
+
sendNotification({ config, title, message, actions, signal: controller.signal, fetchImpl }),
|
|
197
|
+
timeout
|
|
198
|
+
]);
|
|
199
|
+
// A timed-out POST may have reached ntfy. Never discard persisted pending state.
|
|
200
|
+
if (delivered === PUBLISH_TIMEOUT) throw publishError('NOFAX_NTFY_PUBLISH_TIMEOUT', 'ambiguous');
|
|
201
|
+
} finally {
|
|
202
|
+
clearTimeout(timeoutId);
|
|
203
|
+
}
|
|
165
204
|
return remote;
|
|
166
205
|
}
|
|
167
206
|
|
|
@@ -302,12 +341,13 @@ async function requestDecision({
|
|
|
302
341
|
kind,
|
|
303
342
|
includeRefine = false,
|
|
304
343
|
fetchImpl = fetch,
|
|
344
|
+
publishTimeoutMs = DEFAULT_PUBLISH_TIMEOUT_MS,
|
|
305
345
|
timeoutMs = config.timeoutSeconds * 1000,
|
|
306
346
|
pollIntervalMs = 1000,
|
|
307
347
|
nowImpl = Date.now,
|
|
308
348
|
sleepImpl = sleep
|
|
309
349
|
}) {
|
|
310
|
-
const remote = await createRemoteRequest({ config, title, message, options, includeRefine, fetchImpl });
|
|
350
|
+
const remote = await createRemoteRequest({ config, title, message, options, includeRefine, publishTimeoutMs, fetchImpl });
|
|
311
351
|
const response = await waitRemoteResponse({
|
|
312
352
|
config,
|
|
313
353
|
...remote,
|