@velaro/mcp-server 2.0.65 → 2.0.67
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 +27 -0
- package/package.json +2 -1
- package/server.js +42 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Per-chat-window multi-tab mode (velaro-messaging MessengerStyleConfig.MultiTabMode).
|
|
2
|
+
// null/absent = follow the site/platform default. ChatWindow/Update is a full replace
|
|
3
|
+
// (multipart name + styleConfig + languageConfig), so we read first and merge.
|
|
4
|
+
export const MULTI_TAB_MODES = ['active-only', 'all-live'];
|
|
5
|
+
|
|
6
|
+
/** Returns 'active-only' | 'all-live' | null (follow default). Throws on anything else. */
|
|
7
|
+
export function normalizeMultiTabMode(raw) {
|
|
8
|
+
if (raw === null || raw === undefined) return null;
|
|
9
|
+
const v = String(raw).trim().toLowerCase();
|
|
10
|
+
if (v === '' || v === 'default' || v === 'follow-default' || v === 'null') return null;
|
|
11
|
+
if (!MULTI_TAB_MODES.includes(v)) {
|
|
12
|
+
throw new Error('multiTabMode must be "active-only", "all-live" or "default" (follows the site/platform default).');
|
|
13
|
+
}
|
|
14
|
+
return v;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Fields of the update form for a chat window with only multiTabMode changed. */
|
|
18
|
+
export function buildMultiTabUpdateFields(current, mode) {
|
|
19
|
+
if (!current || typeof current !== 'object') throw new Error('chat window not found');
|
|
20
|
+
const styleConfig = { ...(current.styleConfig ?? {}) };
|
|
21
|
+
if (mode === null) delete styleConfig.multiTabMode; else styleConfig.multiTabMode = mode;
|
|
22
|
+
return {
|
|
23
|
+
name: current.name ?? '',
|
|
24
|
+
styleConfig: JSON.stringify(styleConfig),
|
|
25
|
+
languageConfig: JSON.stringify(current.languageConfig ?? {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velaro/mcp-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.67",
|
|
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": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"parity/loader.js",
|
|
50
50
|
"parity/*.customer.js",
|
|
51
51
|
"workflow-schedule.js",
|
|
52
|
+
"chat-window-style.js",
|
|
52
53
|
"toolsets.js",
|
|
53
54
|
"report-explain.json",
|
|
54
55
|
"server.json",
|
package/server.js
CHANGED
|
@@ -53,6 +53,7 @@ import { withAnnotations } from './tool-annotations.js';
|
|
|
53
53
|
import { loadParity, runParity } from './parity/loader.js';
|
|
54
54
|
import { parseToolsets, filterTools, toolsetBlockedMessage } from './toolsets.js';
|
|
55
55
|
import { resolveMessagingApi } from './messaging-base.js';
|
|
56
|
+
import { normalizeMultiTabMode, buildMultiTabUpdateFields } from './chat-window-style.js';
|
|
56
57
|
import { buildResolvePath, buildTimelinePath, buildOverrideBody, buildValidateBody, buildBannerPath, buildOverrideListPath, tolerant, VALIDATE_PATH, OVERRIDE_PATH } from './workflow-schedule.js';
|
|
57
58
|
import { applyEmailSubmissionsTo } from './survey-email.js';
|
|
58
59
|
|
|
@@ -2754,6 +2755,27 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
|
|
|
2754
2755
|
required: ['id'],
|
|
2755
2756
|
},
|
|
2756
2757
|
},
|
|
2758
|
+
{
|
|
2759
|
+
name: 'chat_window_get_style',
|
|
2760
|
+
description: 'Read one chat window style (styleConfig) and its multiTabMode: "active-only" (only the visible browser tab keeps the live chat connection), "all-live" (every tab stays live), or null (follows the site/platform default).',
|
|
2761
|
+
inputSchema: {
|
|
2762
|
+
type: 'object',
|
|
2763
|
+
properties: { id: { type: 'number', description: 'Chat window ID (see chat_window_list)' } },
|
|
2764
|
+
required: ['id'],
|
|
2765
|
+
},
|
|
2766
|
+
},
|
|
2767
|
+
{
|
|
2768
|
+
name: 'chat_window_set_multi_tab_mode',
|
|
2769
|
+
description: 'Set how this chat window behaves across several open browser tabs: "active-only" (only the visible tab stays live), "all-live" (every tab stays live) or "default" (follow the site/platform default). Reads the window first and saves it with only this field changed.',
|
|
2770
|
+
inputSchema: {
|
|
2771
|
+
type: 'object',
|
|
2772
|
+
properties: {
|
|
2773
|
+
id: { type: 'number', description: 'Chat window ID (see chat_window_list)' },
|
|
2774
|
+
multiTabMode: { type: 'string', enum: ['active-only', 'all-live', 'default'], description: '"default" clears the override' },
|
|
2775
|
+
},
|
|
2776
|
+
required: ['id', 'multiTabMode'],
|
|
2777
|
+
},
|
|
2778
|
+
},
|
|
2757
2779
|
// ── Visitor Monitor (session-scoped: SiteId comes from the caller's JWT, never an arg) ──
|
|
2758
2780
|
{
|
|
2759
2781
|
name: 'visitor_monitor_active',
|
|
@@ -7596,6 +7618,26 @@ reply: ${r?.reply}`;
|
|
|
7596
7618
|
return JSON.stringify(await messagingPut(`/ChatWindow/${args.id}/launcher-copy`, body), null, 2);
|
|
7597
7619
|
}
|
|
7598
7620
|
|
|
7621
|
+
case 'chat_window_get_style': {
|
|
7622
|
+
if (!args.id) throw new Error('id is required');
|
|
7623
|
+
const w = await messagingGet(`/ChatWindow/get/${args.id}`);
|
|
7624
|
+
return JSON.stringify({ id: w.id, name: w.name, multiTabMode: w.styleConfig?.multiTabMode ?? null, styleConfig: w.styleConfig ?? {} }, null, 2);
|
|
7625
|
+
}
|
|
7626
|
+
|
|
7627
|
+
case 'chat_window_set_multi_tab_mode': {
|
|
7628
|
+
if (!args.id) throw new Error('id is required');
|
|
7629
|
+
const mode = normalizeMultiTabMode(args.multiTabMode);
|
|
7630
|
+
const current = await messagingGet(`/ChatWindow/get/${args.id}`);
|
|
7631
|
+
const form = new FormData();
|
|
7632
|
+
for (const [k, v] of Object.entries(buildMultiTabUpdateFields(current, mode))) form.append(k, v);
|
|
7633
|
+
const res = await fetch(`${MESSAGING_API}/ChatWindow/Update/${args.id}`, {
|
|
7634
|
+
method: 'POST', headers: { Authorization: authHeader() }, body: form, signal: AbortSignal.timeout(30000),
|
|
7635
|
+
});
|
|
7636
|
+
if (!res.ok) throw new Error(`/ChatWindow/Update/${args.id} -> ${res.status}: ${(await res.text().catch(() => '')).slice(0, 300)}`);
|
|
7637
|
+
const updated = await res.json();
|
|
7638
|
+
return JSON.stringify({ id: updated.id, multiTabMode: updated.styleConfig?.multiTabMode ?? null }, null, 2);
|
|
7639
|
+
}
|
|
7640
|
+
|
|
7599
7641
|
case 'widget_container_get': {
|
|
7600
7642
|
const c = await api('GET', `/PageWidgetContainers/${args.id}`);
|
|
7601
7643
|
return JSON.stringify(c, null, 2);
|