nofax 0.2.33 → 0.2.34

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.33",
3
+ "version": "0.2.34",
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.33' },
77
+ { name: 'nofax', version: '0.2.34' },
78
78
  { instructions: SERVER_INSTRUCTIONS }
79
79
  );
80
80
 
package/src/mcp-tools.mjs CHANGED
@@ -108,7 +108,7 @@ function validateWaitSeconds(value) {
108
108
 
109
109
  function validateChoiceOptions(options) {
110
110
  if (!Array.isArray(options) || options.length < 1 || options.length > 3) throw new Error('NOFAX_CHOICE_LIMIT');
111
- return options.map((option) => {
111
+ const normalized = options.map((option) => {
112
112
  if (typeof option === 'string') {
113
113
  const value = option.trim();
114
114
  if (!value || value.length > 80) throw new Error('NOFAX_CHOICE_INVALID');
@@ -120,6 +120,10 @@ function validateChoiceOptions(options) {
120
120
  if (!value || !label || value.length > 80) throw new Error('NOFAX_CHOICE_INVALID');
121
121
  return { value, label: label.slice(0, 32) };
122
122
  });
123
+ if (new Set(normalized.map((option) => option.value)).size !== normalized.length) {
124
+ throw new Error('NOFAX_CHOICE_DUPLICATE');
125
+ }
126
+ return normalized;
123
127
  }
124
128
 
125
129
  export function createMcpToolHandlers(overrides = {}) {
package/src/protocol.mjs CHANGED
@@ -274,9 +274,10 @@ export function parseResponseMessage(message, { requestId, allowed, kind }) {
274
274
  if (!parsed || parsed.v !== 1 || parsed.requestId !== requestId || typeof parsed.decision !== 'string') {
275
275
  return null;
276
276
  }
277
- if (!allowed.includes(parsed.decision)) return null;
277
+ const decision = parsed.decision.trim();
278
+ if (!decision || !allowed.includes(decision)) return null;
278
279
 
279
- if (parsed.decision === 'refine') {
280
+ if (decision === 'refine') {
280
281
  if (kind === 'choice') return { decision: 'refine' };
281
282
  if (typeof parsed.text !== 'string') return null;
282
283
  const text = parsed.text.trim();
@@ -284,7 +285,7 @@ export function parseResponseMessage(message, { requestId, allowed, kind }) {
284
285
  return { decision: 'refine', text: text.slice(0, MAX_RESPONSE_TEXT) };
285
286
  }
286
287
 
287
- return { decision: parsed.decision };
288
+ return { decision };
288
289
  }
289
290
 
290
291
  export function parseDecisionMessage(message, { requestId, allowed, kind }) {
package/src/requests.mjs CHANGED
@@ -21,7 +21,7 @@ function validateRequest(input) {
21
21
  throw new Error('NOFAX_REQUEST_ALLOWED_INVALID');
22
22
  }
23
23
  const allowed = input.allowed.map((value) => value.trim());
24
- if (allowed.some((value) => !value || value.length > 80)) {
24
+ if (allowed.some((value) => !value || value.length > 80) || new Set(allowed).size !== allowed.length) {
25
25
  throw new Error('NOFAX_REQUEST_ALLOWED_INVALID');
26
26
  }
27
27
  if (!STATUSES.has(input.status)) throw new Error('NOFAX_REQUEST_STATUS_INVALID');