nofax 0.2.30 → 0.2.32
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/mcp-tools.mjs +4 -4
- package/src/ntfy.mjs +5 -1
- package/src/requests.mjs +4 -1
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.32' },
|
|
78
78
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
79
79
|
);
|
|
80
80
|
|
package/src/mcp-tools.mjs
CHANGED
|
@@ -111,14 +111,14 @@ function validateChoiceOptions(options) {
|
|
|
111
111
|
return options.map((option) => {
|
|
112
112
|
if (typeof option === 'string') {
|
|
113
113
|
const value = option.trim();
|
|
114
|
-
if (!value) throw new Error('NOFAX_CHOICE_INVALID');
|
|
115
|
-
return { value
|
|
114
|
+
if (!value || value.length > 80) throw new Error('NOFAX_CHOICE_INVALID');
|
|
115
|
+
return { value, label: value.slice(0, 32) };
|
|
116
116
|
}
|
|
117
117
|
if (!option || typeof option.value !== 'string' || typeof option.label !== 'string') throw new Error('NOFAX_CHOICE_INVALID');
|
|
118
118
|
const value = option.value.trim();
|
|
119
119
|
const label = option.label.trim();
|
|
120
|
-
if (!value || !label) throw new Error('NOFAX_CHOICE_INVALID');
|
|
121
|
-
return { value
|
|
120
|
+
if (!value || !label || value.length > 80) throw new Error('NOFAX_CHOICE_INVALID');
|
|
121
|
+
return { value, label: label.slice(0, 32) };
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
|
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
|
@@ -17,7 +17,7 @@ function validateRequest(input) {
|
|
|
17
17
|
const requestId = validateRequestId(input.requestId);
|
|
18
18
|
if (!KINDS.has(input.kind)) throw new Error('NOFAX_REQUEST_KIND_INVALID');
|
|
19
19
|
if (typeof input.responseTopic !== 'string' || !RESPONSE_TOPIC.test(input.responseTopic)) throw new Error('NOFAX_RESPONSE_TOPIC_INVALID');
|
|
20
|
-
if (!Array.isArray(input.allowed) || input.allowed.length < 1 || input.allowed.length > 3 || input.allowed.some((value) => typeof value !== 'string' || !value || value.length > 80)) {
|
|
20
|
+
if (!Array.isArray(input.allowed) || input.allowed.length < 1 || input.allowed.length > 3 || input.allowed.some((value) => typeof value !== 'string' || !value.trim() || value.length > 80)) {
|
|
21
21
|
throw new Error('NOFAX_REQUEST_ALLOWED_INVALID');
|
|
22
22
|
}
|
|
23
23
|
if (!STATUSES.has(input.status)) throw new Error('NOFAX_REQUEST_STATUS_INVALID');
|
|
@@ -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) {
|