@velaro/mcp-server 2.0.149 → 2.0.150
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/chat-window-style.js +43 -0
- package/package.json +1 -1
- package/parity/moshky-guide.customer.js +11 -0
- package/server.js +10905 -10878
package/chat-window-style.js
CHANGED
|
@@ -51,3 +51,46 @@ export function buildEmailTranscriptUpdateFields(current, value) {
|
|
|
51
51
|
languageConfig: JSON.stringify(current.languageConfig ?? {}),
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
// Message-form buttons (MessengerStyleConfig.EnableEmojiButton / EmojiButtonPosition / EnableUploadButton).
|
|
56
|
+
// Defaults: emoji on, upload on, emoji position "left" (additive buttons in the left group, Send alone on the right).
|
|
57
|
+
export const BUTTON_POSITIONS = ['left', 'right'];
|
|
58
|
+
|
|
59
|
+
/** Returns true | false. Throws on anything else. */
|
|
60
|
+
export function normalizeOnOff(raw, name) {
|
|
61
|
+
if (typeof raw === 'boolean') return raw;
|
|
62
|
+
const v = String(raw ?? '').trim().toLowerCase();
|
|
63
|
+
if (['on', 'true', 'yes', '1'].includes(v)) return true;
|
|
64
|
+
if (['off', 'false', 'no', '0'].includes(v)) return false;
|
|
65
|
+
throw new Error(`${name} must be on or off.`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Returns 'left' | 'right'. Throws on anything else. */
|
|
69
|
+
export function normalizeButtonPosition(raw) {
|
|
70
|
+
const v = String(raw ?? '').trim().toLowerCase();
|
|
71
|
+
if (!BUTTON_POSITIONS.includes(v)) throw new Error('emojiButtonPosition must be "left" (with the attach button, default) or "right" (beside Send).');
|
|
72
|
+
return v;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Fields of the update form with only the given button options changed. Pass undefined to leave one alone. */
|
|
76
|
+
export function buildButtonOptionsUpdateFields(current, { emoji, emojiPosition, upload } = {}) {
|
|
77
|
+
if (!current || typeof current !== 'object') throw new Error('chat window not found');
|
|
78
|
+
if (emoji === undefined && emojiPosition === undefined && upload === undefined) throw new Error('Pass at least one of emoji, emojiPosition, upload.');
|
|
79
|
+
const styleConfig = { ...(current.styleConfig ?? {}) };
|
|
80
|
+
if (emoji !== undefined) styleConfig.enableEmojiButton = normalizeOnOff(emoji, 'enableEmojiButton');
|
|
81
|
+
if (emojiPosition !== undefined) styleConfig.emojiButtonPosition = normalizeButtonPosition(emojiPosition);
|
|
82
|
+
if (upload !== undefined) styleConfig.enableUploadButton = normalizeOnOff(upload, 'enableUploadButton');
|
|
83
|
+
return {
|
|
84
|
+
name: current.name ?? '',
|
|
85
|
+
styleConfig: JSON.stringify(styleConfig),
|
|
86
|
+
languageConfig: JSON.stringify(current.languageConfig ?? {}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Moshky's chat-window walkthrough: every question is ASKED, never silently defaulted.
|
|
91
|
+
export const CHAT_WINDOW_WALKTHROUGH = [
|
|
92
|
+
{ key: 'emoji', ask: 'Show the emoji button in the message box?', options: ['on', 'off'], default: 'on', setting: 'enableEmojiButton' },
|
|
93
|
+
{ key: 'emojiPosition', ask: 'Where should the emoji button sit: with the attach button on the left, or beside Send on the right?', options: ['left', 'right'], default: 'left', setting: 'emojiButtonPosition' },
|
|
94
|
+
{ key: 'upload', ask: 'Let visitors send files and photos (attach button)?', options: ['on', 'off'], default: 'on', setting: 'enableUploadButton' },
|
|
95
|
+
{ key: 'emailTranscript', ask: 'Let visitors email themselves a transcript?', options: ['on', 'off'], default: 'on', setting: 'enableEmailTranscriptButton' },
|
|
96
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velaro/mcp-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.150",
|
|
4
4
|
"description": "Velaro MCP server — connect Claude and other AI agents directly to your Velaro account: KB, workflows, bots, conversations, contacts, routing, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,6 +26,8 @@ async function askMoshky(ctx, messages, context) {
|
|
|
26
26
|
return String(reply);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
import { CHAT_WINDOW_WALKTHROUGH } from '../chat-window-style.js';
|
|
30
|
+
|
|
29
31
|
export const tools = [
|
|
30
32
|
{
|
|
31
33
|
name: 'velaro_guide',
|
|
@@ -46,9 +48,18 @@ export const tools = [
|
|
|
46
48
|
required: ['question'],
|
|
47
49
|
},
|
|
48
50
|
},
|
|
51
|
+
{
|
|
52
|
+
name: 'moshky_walkthrough',
|
|
53
|
+
description: 'Moshky guided walkthrough. topic "chat-window" returns the questions to ASK the user (emoji button, emoji position, send files/upload, email transcript) with defaults on. Ask every one; do not silently default. Then apply the answers with chat_window_set_buttons and chat_window_set_email_transcript, or use moshky_ask to have Moshky propose the change.',
|
|
54
|
+
inputSchema: { type: 'object', properties: { topic: { type: 'string', enum: ['chat-window'] } }, required: ['topic'] },
|
|
55
|
+
},
|
|
49
56
|
];
|
|
50
57
|
|
|
51
58
|
export const handlers = {
|
|
59
|
+
moshky_walkthrough: async (a) => {
|
|
60
|
+
if (a.topic !== 'chat-window') throw new Error('topic must be "chat-window"');
|
|
61
|
+
return JSON.stringify({ instructions: 'Ask the user each question, then apply with chat_window_set_buttons (emoji, emojiPosition, upload) and chat_window_set_email_transcript.', questions: CHAT_WINDOW_WALKTHROUGH }, null, 2);
|
|
62
|
+
},
|
|
52
63
|
velaro_guide: async (a, ctx) => {
|
|
53
64
|
if (!a.goal || !String(a.goal).trim()) throw new Error('goal is required');
|
|
54
65
|
const prompt = `An MCP client (an AI assistant) wants to: ${String(a.goal).trim()}. Reply with the recommended ordered setup steps from the Velaro skills library, naming the exact MCP tool for each step, and what to check first. Do not change anything.`;
|