nofax 0.2.30 → 0.2.31
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/mcp-server.mjs +1 -1
- package/src/ntfy.mjs +5 -1
- package/src/requests.mjs +3 -0
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.31' },
|
|
78
78
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
79
79
|
);
|
|
80
80
|
|
package/src/ntfy.mjs
CHANGED
|
@@ -78,7 +78,11 @@ export async function sendNotification({ config, title, message, actions, priori
|
|
|
78
78
|
function normalizeOptions(options) {
|
|
79
79
|
if (!Array.isArray(options) || options.length > 3) throw new Error('NOFAX_CHOICE_LIMIT');
|
|
80
80
|
const normalized = options.map((option) => {
|
|
81
|
-
if (typeof option === 'string')
|
|
81
|
+
if (typeof option === 'string') {
|
|
82
|
+
const value = option.trim();
|
|
83
|
+
if (!value || value.length > 80) throw new Error('NOFAX_CHOICE_INVALID');
|
|
84
|
+
return { value, label: value.slice(0, 32) };
|
|
85
|
+
}
|
|
82
86
|
if (!option || typeof option.value !== 'string' || typeof option.label !== 'string') throw new Error('NOFAX_CHOICE_INVALID');
|
|
83
87
|
const value = option.value.trim();
|
|
84
88
|
const label = option.label.trim();
|
package/src/requests.mjs
CHANGED
|
@@ -34,6 +34,9 @@ function validateRequest(input) {
|
|
|
34
34
|
if (input.status === 'resolved') {
|
|
35
35
|
if (typeof input.resolvedAt !== 'string' || Number.isNaN(Date.parse(input.resolvedAt))) throw new Error('NOFAX_REQUEST_RESOLVED_AT_INVALID');
|
|
36
36
|
if (typeof input.decision !== 'string' || !input.allowed.includes(input.decision)) throw new Error('NOFAX_REQUEST_DECISION_INVALID');
|
|
37
|
+
if (input.decision === 'refine' && input.kind !== 'choice' && (typeof input.text !== 'string' || !input.text.trim())) {
|
|
38
|
+
throw new Error('NOFAX_REQUEST_TEXT_INVALID');
|
|
39
|
+
}
|
|
37
40
|
base.resolvedAt = input.resolvedAt;
|
|
38
41
|
base.decision = input.decision;
|
|
39
42
|
if (input.text !== undefined) {
|