nofax 0.2.38 → 0.2.40
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 +18 -0
- package/package.json +1 -1
- package/src/cli.mjs +16 -5
- package/src/mcp-server.mjs +1 -1
- package/src/ntfy.mjs +2 -0
- package/src/protocol.mjs +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -42,6 +42,24 @@ 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.40 - 2026-09-24
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- CLI commands now reject recognized flags that the selected command does not support before loading configuration or performing any notification/approval side effect, preventing ignored routing or timing flags from making a malformed invocation look valid.
|
|
50
|
+
- Commands that do not accept positional input now reject unexpected trailing arguments before configuration loading, transport, MCP startup, or hook approval work, while message-bearing commands keep their documented positional behavior.
|
|
51
|
+
|
|
52
|
+
Pending, timeout, disconnect, setup/config failure, transport failure, and notification delivery still never mean approval. Explicit Allow/Deny behavior, response-topic secrecy, first-terminal-wins semantics, notification authority, and the narrower remote Worker boundary are unchanged.
|
|
53
|
+
|
|
54
|
+
## 0.2.39 - 2026-09-24
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
|
|
58
|
+
- Choice requests that expose the dedicated refinement shortcut now reject an ordinary option whose normalized decision value is `refine`, preventing two actions from resolving to the same reserved refinement decision before persistence or notification transport.
|
|
59
|
+
- The same refinement shortcut now rejects an ordinary option whose human-visible action label is `Refine`, preventing indistinguishable phone actions from mapping to different semantics.
|
|
60
|
+
- Bounded approval summaries now append an explicit truncation marker when array items or object fields are omitted, including collision-safe object marking, so compact human context cannot silently appear complete after content was dropped.
|
|
61
|
+
|
|
62
|
+
Pending, timeout, disconnect, setup/config failure, transport failure, and notification delivery still never mean approval. Secret redaction, explicit Allow/Deny behavior, response-topic secrecy, first-terminal-wins semantics, notification authority, and the narrower remote Worker boundary are unchanged.
|
|
45
63
|
## 0.2.38 - 2026-09-24
|
|
46
64
|
|
|
47
65
|
### Changed
|
package/package.json
CHANGED
package/src/cli.mjs
CHANGED
|
@@ -17,16 +17,18 @@ async function readPackageVersion() {
|
|
|
17
17
|
return metadata.version;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function parseArgs(args) {
|
|
20
|
+
function parseArgs(args, allowedFlags = []) {
|
|
21
21
|
const flags = {};
|
|
22
22
|
const positionals = [];
|
|
23
23
|
for (let index = 0; index < args.length; index += 1) {
|
|
24
24
|
const value = args[index];
|
|
25
25
|
if (value === '--force') {
|
|
26
|
+
if (!allowedFlags.includes(value)) throw new Error(`NOFAX_UNKNOWN_FLAG:${value}`);
|
|
26
27
|
flags.force = true;
|
|
27
28
|
continue;
|
|
28
29
|
}
|
|
29
30
|
if (['--title', '--server', '--topic', '--timeout'].includes(value)) {
|
|
31
|
+
if (!allowedFlags.includes(value)) throw new Error(`NOFAX_UNKNOWN_FLAG:${value}`);
|
|
30
32
|
const next = args[index + 1];
|
|
31
33
|
if (next === undefined) throw new Error(`NOFAX_FLAG_VALUE:${value}`);
|
|
32
34
|
flags[value.slice(2)] = next;
|
|
@@ -39,6 +41,10 @@ function parseArgs(args) {
|
|
|
39
41
|
return { flags, positionals };
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
function rejectUnexpectedArgs(positionals) {
|
|
45
|
+
if (positionals.length > 0) throw new Error(`NOFAX_UNEXPECTED_ARGUMENT:${positionals[0]}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
async function readStdin(stdinText) {
|
|
43
49
|
if (stdinText !== undefined) return stdinText;
|
|
44
50
|
let text = '';
|
|
@@ -124,7 +130,8 @@ export async function runCli(args, overrides = {}) {
|
|
|
124
130
|
|
|
125
131
|
const command = args[0];
|
|
126
132
|
if (command === 'init') {
|
|
127
|
-
const { flags } = parseArgs(args.slice(1));
|
|
133
|
+
const { flags, positionals } = parseArgs(args.slice(1), ['--server', '--topic', '--timeout', '--force']);
|
|
134
|
+
rejectUnexpectedArgs(positionals);
|
|
128
135
|
const timeoutSeconds = flags.timeout === undefined ? undefined : Number(flags.timeout);
|
|
129
136
|
const config = await deps.initConfigImpl({
|
|
130
137
|
env: deps.env,
|
|
@@ -140,12 +147,14 @@ export async function runCli(args, overrides = {}) {
|
|
|
140
147
|
}
|
|
141
148
|
|
|
142
149
|
if (command === 'config') {
|
|
150
|
+
rejectUnexpectedArgs(args.slice(1));
|
|
143
151
|
const config = await deps.loadConfigImpl({ env: deps.env });
|
|
144
152
|
deps.stdout.write(`${JSON.stringify(config, null, 2)}\n`);
|
|
145
153
|
return 0;
|
|
146
154
|
}
|
|
147
155
|
|
|
148
156
|
if (command === 'test') {
|
|
157
|
+
rejectUnexpectedArgs(args.slice(1));
|
|
149
158
|
const config = await deps.loadConfigImpl({ env: deps.env });
|
|
150
159
|
await deps.sendNotificationImpl({
|
|
151
160
|
config,
|
|
@@ -157,7 +166,7 @@ export async function runCli(args, overrides = {}) {
|
|
|
157
166
|
}
|
|
158
167
|
|
|
159
168
|
if (command === 'notify') {
|
|
160
|
-
const { flags, positionals } = parseArgs(args.slice(1));
|
|
169
|
+
const { flags, positionals } = parseArgs(args.slice(1), ['--title']);
|
|
161
170
|
if (positionals.length === 0) throw new Error('NOFAX_MESSAGE_REQUIRED');
|
|
162
171
|
const config = await deps.loadConfigImpl({ env: deps.env });
|
|
163
172
|
await deps.sendNotificationImpl({
|
|
@@ -170,7 +179,7 @@ export async function runCli(args, overrides = {}) {
|
|
|
170
179
|
}
|
|
171
180
|
|
|
172
181
|
if (command === 'approve') {
|
|
173
|
-
const { flags, positionals } = parseArgs(args.slice(1));
|
|
182
|
+
const { flags, positionals } = parseArgs(args.slice(1), ['--title']);
|
|
174
183
|
if (positionals.length === 0) throw new Error('NOFAX_MESSAGE_REQUIRED');
|
|
175
184
|
const config = await deps.loadConfigImpl({ env: deps.env });
|
|
176
185
|
const result = await deps.requestApprovalImpl({
|
|
@@ -183,7 +192,7 @@ export async function runCli(args, overrides = {}) {
|
|
|
183
192
|
}
|
|
184
193
|
|
|
185
194
|
if (command === 'refine') {
|
|
186
|
-
const { flags, positionals } = parseArgs(args.slice(1));
|
|
195
|
+
const { flags, positionals } = parseArgs(args.slice(1), ['--title']);
|
|
187
196
|
if (positionals.length === 0) throw new Error('NOFAX_MESSAGE_REQUIRED');
|
|
188
197
|
const config = await deps.loadConfigImpl({ env: deps.env });
|
|
189
198
|
const result = await deps.requestRefinementImpl({
|
|
@@ -199,6 +208,7 @@ export async function runCli(args, overrides = {}) {
|
|
|
199
208
|
}
|
|
200
209
|
|
|
201
210
|
if (command === 'mcp') {
|
|
211
|
+
rejectUnexpectedArgs(args.slice(1));
|
|
202
212
|
await deps.runMcpServerImpl();
|
|
203
213
|
return 0;
|
|
204
214
|
}
|
|
@@ -206,6 +216,7 @@ export async function runCli(args, overrides = {}) {
|
|
|
206
216
|
if (command === 'hook') {
|
|
207
217
|
const adapter = args[1];
|
|
208
218
|
if (!adapter) throw new Error('NOFAX_HOOK_REQUIRED');
|
|
219
|
+
rejectUnexpectedArgs(args.slice(2));
|
|
209
220
|
try {
|
|
210
221
|
return await runHook(adapter, deps);
|
|
211
222
|
} catch (error) {
|
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.40' },
|
|
78
78
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
79
79
|
);
|
|
80
80
|
|
package/src/ntfy.mjs
CHANGED
|
@@ -112,6 +112,8 @@ export async function createRemoteRequest({
|
|
|
112
112
|
fetchImpl = fetch
|
|
113
113
|
}) {
|
|
114
114
|
const normalized = normalizeOptions(options);
|
|
115
|
+
if (includeRefine && normalized.some((option) => option.value === 'refine')) throw new Error('NOFAX_CHOICE_DUPLICATE');
|
|
116
|
+
if (includeRefine && normalized.some((option) => option.label === 'Refine')) throw new Error('NOFAX_CHOICE_DUPLICATE');
|
|
115
117
|
const totalActions = normalized.length + (includeRefine ? 1 : 0);
|
|
116
118
|
if (totalActions < 1 || totalActions > 3) throw new Error('NOFAX_CHOICE_LIMIT');
|
|
117
119
|
|
package/src/protocol.mjs
CHANGED
|
@@ -229,7 +229,7 @@ export function redactAndBound(value, options = {}) {
|
|
|
229
229
|
}
|
|
230
230
|
const bounded = value.slice(0, MAX_ARRAY);
|
|
231
231
|
const pairedLength = bounded.length - (bounded.length % 2);
|
|
232
|
-
|
|
232
|
+
const out = bounded.map((item, index) => (
|
|
233
233
|
index < pairedLength
|
|
234
234
|
&& index % 2 === 1
|
|
235
235
|
&& typeof bounded[index - 1] === 'string'
|
|
@@ -237,21 +237,29 @@ export function redactAndBound(value, options = {}) {
|
|
|
237
237
|
? '[REDACTED]'
|
|
238
238
|
: redactAndBound(item, { seen, depth: depth + 1 })
|
|
239
239
|
));
|
|
240
|
+
if (value.length > MAX_ARRAY) out.push(TRUNCATION_MARKER);
|
|
241
|
+
return out;
|
|
240
242
|
}
|
|
241
243
|
|
|
242
|
-
const
|
|
244
|
+
const entries = Object.entries(value);
|
|
245
|
+
const entryName = entries.find(([key, child]) => (
|
|
243
246
|
typeof child === 'string'
|
|
244
247
|
&& (key.toLowerCase() === 'name' || key.toLowerCase() === 'key' || key.toLowerCase() === 'header')
|
|
245
248
|
))?.[1] ?? null;
|
|
246
249
|
const redactEntryValue = entryName !== null && isSecretKey(entryName);
|
|
247
250
|
|
|
248
251
|
const out = {};
|
|
249
|
-
for (const [key, child] of
|
|
252
|
+
for (const [key, child] of entries.slice(0, MAX_OBJECT_KEYS)) {
|
|
250
253
|
const normalizedKey = key.toLowerCase();
|
|
251
254
|
out[key] = isSecretKey(key) || (redactEntryValue && (normalizedKey === 'value' || normalizedKey === 'values'))
|
|
252
255
|
? '[REDACTED]'
|
|
253
256
|
: redactAndBound(child, { seen, depth: depth + 1 });
|
|
254
257
|
}
|
|
258
|
+
if (entries.length > MAX_OBJECT_KEYS) {
|
|
259
|
+
let markerKey = TRUNCATION_MARKER;
|
|
260
|
+
while (Object.hasOwn(out, markerKey)) markerKey += '*';
|
|
261
|
+
out[markerKey] = true;
|
|
262
|
+
}
|
|
255
263
|
return out;
|
|
256
264
|
}
|
|
257
265
|
|