@supportbridge/sdk 0.8.1
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/CHANGELOG.md +73 -0
- package/LICENSE +13 -0
- package/README.md +326 -0
- package/SECURITY.md +26 -0
- package/dist/agent.d.ts +9 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +73 -0
- package/dist/agent.js.map +1 -0
- package/dist/client.d.ts +68 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +254 -0
- package/dist/client.js.map +1 -0
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +9 -0
- package/dist/context.js.map +1 -0
- package/dist/control-plane.d.ts +37 -0
- package/dist/control-plane.d.ts.map +1 -0
- package/dist/control-plane.js +43 -0
- package/dist/control-plane.js.map +1 -0
- package/dist/doctor.d.ts +17 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +49 -0
- package/dist/doctor.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +42 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +215 -0
- package/dist/install.js.map +1 -0
- package/dist/mcp-app.d.ts +50 -0
- package/dist/mcp-app.d.ts.map +1 -0
- package/dist/mcp-app.js +44 -0
- package/dist/mcp-app.js.map +1 -0
- package/dist/mcp.d.ts +44 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +117 -0
- package/dist/mcp.js.map +1 -0
- package/dist/offer-app.d.ts +41 -0
- package/dist/offer-app.d.ts.map +1 -0
- package/dist/offer-app.js +21 -0
- package/dist/offer-app.js.map +1 -0
- package/dist/policy-app.d.ts +41 -0
- package/dist/policy-app.d.ts.map +1 -0
- package/dist/policy-app.js +49 -0
- package/dist/policy-app.js.map +1 -0
- package/dist/policy-store.d.ts +79 -0
- package/dist/policy-store.d.ts.map +1 -0
- package/dist/policy-store.js +137 -0
- package/dist/policy-store.js.map +1 -0
- package/dist/policy.d.ts +226 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +420 -0
- package/dist/policy.js.map +1 -0
- package/dist/sanitize.d.ts +9 -0
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/sanitize.js +83 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/state.d.ts +31 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +29 -0
- package/dist/state.js.map +1 -0
- package/dist/transport.d.ts +57 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +132 -0
- package/dist/transport.js.map +1 -0
- package/dist/triggers.d.ts +19 -0
- package/dist/triggers.d.ts.map +1 -0
- package/dist/triggers.js +132 -0
- package/dist/triggers.js.map +1 -0
- package/dist/types.d.ts +221 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/docs/policy-engine.md +47 -0
- package/docs/telemetry-contract.md +29 -0
- package/package.json +53 -0
package/dist/install.js
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { registerAppResource, registerAppTool } from "@modelcontextprotocol/ext-apps/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SupportBridgeClient } from "./client.js";
|
|
4
|
+
import { SupportBridgeControlPlane } from "./control-plane.js";
|
|
5
|
+
import { createSupportChatApp, workingConversation } from "./mcp-app.js";
|
|
6
|
+
import { createPolicyBuilderApp } from "./policy-app.js";
|
|
7
|
+
import { instrumentMcpTool, supportDecisionTools } from "./mcp.js";
|
|
8
|
+
export class SupportBridge {
|
|
9
|
+
static install(server, options) {
|
|
10
|
+
return installSupportBridge(server, options);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function installSupportBridge(server, options) {
|
|
14
|
+
const baseUrl = (options.baseUrl ?? "https://supportbridge-control-plane.onrender.com").replace(/\/$/, "");
|
|
15
|
+
const client = new SupportBridgeClient({
|
|
16
|
+
source: options.source,
|
|
17
|
+
endpoint: `${baseUrl}/v1/events`,
|
|
18
|
+
apiKey: options.apiKey,
|
|
19
|
+
...(options.environment ? { environment: options.environment } : {}),
|
|
20
|
+
...(options.serviceVersion ? { serviceVersion: options.serviceVersion } : {}),
|
|
21
|
+
...(options.privacy ? { privacy: options.privacy } : {}),
|
|
22
|
+
...options.client
|
|
23
|
+
});
|
|
24
|
+
const controlPlane = new SupportBridgeControlPlane(client, {
|
|
25
|
+
baseUrl,
|
|
26
|
+
apiKey: options.apiKey,
|
|
27
|
+
...(options.policyRefreshIntervalMs ? { refreshIntervalMs: options.policyRefreshIntervalMs } : {}),
|
|
28
|
+
...(options.fetch ? { fetch: options.fetch } : {})
|
|
29
|
+
});
|
|
30
|
+
const app = createSupportChatApp(controlPlane, options.app);
|
|
31
|
+
const policyApp = createPolicyBuilderApp(options.policyApp?.resourceUri ? { resourceUri: options.policyApp.resourceUri } : {});
|
|
32
|
+
const decisions = supportDecisionTools(client, options.identify, { controlPlane, appMeta: app.toolMeta });
|
|
33
|
+
registerAppTool(server, "talk_to_support", {
|
|
34
|
+
title: "Talk to human support",
|
|
35
|
+
description: "Open a live human-support request. Call only after the user agrees to contact support. Returns a session ID used by the support messaging tools.",
|
|
36
|
+
inputSchema: z.object({
|
|
37
|
+
issue_summary: z.string().min(1).max(2_000),
|
|
38
|
+
customer: z.string().max(300).optional(),
|
|
39
|
+
error_code: z.string().max(300).optional(),
|
|
40
|
+
priority: z.enum(["normal", "urgent"]).optional()
|
|
41
|
+
}),
|
|
42
|
+
_meta: app.toolMeta
|
|
43
|
+
}, async (arguments_, context) => {
|
|
44
|
+
const identity = await options.identify(context);
|
|
45
|
+
if (!identity)
|
|
46
|
+
return { isError: true, content: [{ type: "text", text: "An authenticated user is required to open support." }] };
|
|
47
|
+
const brief = client.buildSupportBrief(identity, arguments_.issue_summary);
|
|
48
|
+
const ticket = await controlPlane.createTicket({
|
|
49
|
+
identity,
|
|
50
|
+
issue: arguments_.issue_summary ?? brief.issue,
|
|
51
|
+
...(arguments_.customer ?? brief.customer ? { customer: arguments_.customer ?? brief.customer } : {}),
|
|
52
|
+
...(arguments_.error_code ?? brief.errorCode ? { errorCode: arguments_.error_code ?? brief.errorCode } : {}),
|
|
53
|
+
...(arguments_.priority ? { priority: arguments_.priority } : {})
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
content: [{ type: "text", text: `Support chat ${ticket.id} opened.` }],
|
|
57
|
+
structuredContent: workingConversation({ ticket, messages: [] }, ticket.id),
|
|
58
|
+
_meta: app.toolMeta
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
registerAppTool(server, "request_assistance", {
|
|
62
|
+
title: "Request available representative",
|
|
63
|
+
description: "Accept an available sales, success, or support representative's assistance offer and open the live conversation. Call only after the user agrees.",
|
|
64
|
+
inputSchema: z.object({
|
|
65
|
+
trigger_id: z.string().min(1),
|
|
66
|
+
issue_summary: z.string().min(1).max(2_000),
|
|
67
|
+
customer: z.string().max(300).optional(),
|
|
68
|
+
priority: z.enum(["normal", "urgent"]).optional()
|
|
69
|
+
}),
|
|
70
|
+
_meta: app.toolMeta
|
|
71
|
+
}, async (arguments_, context) => {
|
|
72
|
+
const identity = await options.identify(context);
|
|
73
|
+
if (!identity)
|
|
74
|
+
return { isError: true, content: [{ type: "text", text: "An authenticated user is required to request assistance." }] };
|
|
75
|
+
await client.decideSupport(arguments_.trigger_id, identity, "accepted");
|
|
76
|
+
const ticket = await controlPlane.createTicket({ identity, issue: arguments_.issue_summary, triggerId: arguments_.trigger_id, requestType: "assistance", ...(arguments_.customer ? { customer: arguments_.customer } : {}), ...(arguments_.priority ? { priority: arguments_.priority } : {}) });
|
|
77
|
+
return { content: [{ type: "text", text: `Live assistance ${ticket.id} opened.` }], structuredContent: workingConversation({ ticket, messages: [] }, ticket.id), _meta: app.toolMeta };
|
|
78
|
+
});
|
|
79
|
+
registerAppTool(server, "open_support_chat", {
|
|
80
|
+
title: "Open existing support chat",
|
|
81
|
+
description: "Reopen the embedded live-chat window for an existing support session. This does not create a new ticket.",
|
|
82
|
+
inputSchema: z.object({ session_id: z.string().min(1) }),
|
|
83
|
+
_meta: app.toolMeta
|
|
84
|
+
}, async ({ session_id }) => ({
|
|
85
|
+
content: [{ type: "text", text: `Support chat ${session_id} opened.` }],
|
|
86
|
+
structuredContent: workingConversation(await controlPlane.getChat(session_id), session_id),
|
|
87
|
+
_meta: app.toolMeta
|
|
88
|
+
}));
|
|
89
|
+
registerAppTool(server, "accept_support_offer", {
|
|
90
|
+
title: "Open support chat",
|
|
91
|
+
description: "Accept a pending human-support offer and open the live support conversation. Call only after the user agrees.",
|
|
92
|
+
inputSchema: z.object({
|
|
93
|
+
trigger_id: z.string().min(1),
|
|
94
|
+
issue_summary: z.string().max(2_000).optional(),
|
|
95
|
+
customer: z.string().max(300).optional(),
|
|
96
|
+
error_code: z.string().max(300).optional(),
|
|
97
|
+
priority: z.enum(["normal", "urgent"]).optional()
|
|
98
|
+
}),
|
|
99
|
+
_meta: app.toolMeta
|
|
100
|
+
}, decisions.accept_support_offer);
|
|
101
|
+
registerAppTool(server, "dismiss_support_offer", {
|
|
102
|
+
title: "Decline support",
|
|
103
|
+
description: "Decline a pending human-support offer, allowing the original request to be retried.",
|
|
104
|
+
inputSchema: z.object({ trigger_id: z.string().min(1), reason: z.string().max(1_000).optional() }),
|
|
105
|
+
_meta: { ui: { visibility: ["model"] } }
|
|
106
|
+
}, decisions.dismiss_support_offer);
|
|
107
|
+
const appOnlyMeta = { ui: { resourceUri: app.resourceUri, visibility: ["app"] } };
|
|
108
|
+
registerAppTool(server, "get_support_chat", {
|
|
109
|
+
title: "Refresh support chat",
|
|
110
|
+
inputSchema: z.object({ ticket_id: z.string().min(1) }),
|
|
111
|
+
_meta: appOnlyMeta
|
|
112
|
+
}, app.tools.get_support_chat);
|
|
113
|
+
registerAppTool(server, "send_support_message", {
|
|
114
|
+
title: "Send support message",
|
|
115
|
+
inputSchema: z.object({
|
|
116
|
+
ticket_id: z.string().min(1), text: z.string().min(1).max(4_000), sender_name: z.string().max(200).optional()
|
|
117
|
+
}),
|
|
118
|
+
_meta: appOnlyMeta
|
|
119
|
+
}, app.tools.send_support_message);
|
|
120
|
+
const workingToolMeta = { ui: { visibility: ["model", "app"] } };
|
|
121
|
+
registerAppTool(server, "support_get_messages", {
|
|
122
|
+
title: "Check support messages",
|
|
123
|
+
description: "Check a support session for replies and return the complete transcript and status.",
|
|
124
|
+
inputSchema: z.object({ session_id: z.string().min(1) }),
|
|
125
|
+
_meta: workingToolMeta
|
|
126
|
+
}, app.tools.support_get_messages);
|
|
127
|
+
registerAppTool(server, "support_send_message", {
|
|
128
|
+
title: "Message support",
|
|
129
|
+
description: "Send a message from the MCP user to the human representative.",
|
|
130
|
+
inputSchema: z.object({ session_id: z.string().min(1), message: z.string().min(1).max(4_000) }),
|
|
131
|
+
_meta: workingToolMeta
|
|
132
|
+
}, app.tools.support_send_message);
|
|
133
|
+
registerAppTool(server, "support_end_session", {
|
|
134
|
+
title: "End support chat",
|
|
135
|
+
description: "End the user's human-support session.",
|
|
136
|
+
inputSchema: z.object({ session_id: z.string().min(1) }),
|
|
137
|
+
_meta: workingToolMeta
|
|
138
|
+
}, app.tools.support_end_session);
|
|
139
|
+
registerAppTool(server, "support_reopen_session", {
|
|
140
|
+
title: "Reopen support chat",
|
|
141
|
+
description: "Reopen a resolved human-support session.",
|
|
142
|
+
inputSchema: z.object({ session_id: z.string().min(1) }),
|
|
143
|
+
_meta: workingToolMeta
|
|
144
|
+
}, app.tools.support_reopen_session);
|
|
145
|
+
registerAppResource(server, "SupportBridge chat", app.resourceUri, {
|
|
146
|
+
mimeType: app.mimeType,
|
|
147
|
+
_meta: app.resourceMeta
|
|
148
|
+
}, async () => app.resourceContents());
|
|
149
|
+
if (options.policyApp?.enabled !== false) {
|
|
150
|
+
registerAppTool(server, "open_policy_builder", {
|
|
151
|
+
title: "Open policy builder",
|
|
152
|
+
description: "Open the interactive SupportBridge policy builder. Generated policies are drafts only and require explicit review and approval.",
|
|
153
|
+
inputSchema: z.object({ prompt: z.string().max(4_000).optional() }),
|
|
154
|
+
_meta: policyApp.toolMeta
|
|
155
|
+
}, async ({ prompt }, context) => {
|
|
156
|
+
const identity = await options.identify(context);
|
|
157
|
+
if (!identity?.workspaceId)
|
|
158
|
+
return { isError: true, content: [{ type: "text", text: "An authenticated workspace administrator is required." }] };
|
|
159
|
+
const generated = await policyApp.tools.generate_policy_draft({ prompt: prompt ?? "Create a new policy", workspace_id: identity.workspaceId, environment_id: options.environment, actor_id: identity.userId });
|
|
160
|
+
return { ...generated, _meta: policyApp.toolMeta };
|
|
161
|
+
});
|
|
162
|
+
const policyAppOnlyMeta = { ui: { resourceUri: policyApp.resourceUri, visibility: ["app"] } };
|
|
163
|
+
registerAppTool(server, "generate_policy_draft", {
|
|
164
|
+
title: "Generate policy draft",
|
|
165
|
+
inputSchema: z.object({ prompt: z.string().min(1).max(4_000), workspace_id: z.string().min(1), environment_id: z.string().optional(), actor_id: z.string().min(1) }),
|
|
166
|
+
_meta: policyAppOnlyMeta
|
|
167
|
+
}, policyApp.tools.generate_policy_draft);
|
|
168
|
+
registerAppTool(server, "validate_policy_draft", {
|
|
169
|
+
title: "Validate policy draft",
|
|
170
|
+
inputSchema: z.object({ policy: z.unknown() }),
|
|
171
|
+
_meta: policyAppOnlyMeta
|
|
172
|
+
}, async ({ policy }) => policyApp.tools.validate_policy_draft({ policy: policy }));
|
|
173
|
+
registerAppTool(server, "simulate_policy_draft", {
|
|
174
|
+
title: "Simulate policy draft",
|
|
175
|
+
inputSchema: z.object({ policy: z.unknown(), facts: z.record(z.unknown()), event_type: z.string().optional() }),
|
|
176
|
+
_meta: policyAppOnlyMeta
|
|
177
|
+
}, async ({ policy, ...arguments_ }) => policyApp.tools.simulate_policy_draft({ policy: policy, ...arguments_ }));
|
|
178
|
+
registerAppResource(server, "SupportBridge policy builder", policyApp.resourceUri, {
|
|
179
|
+
mimeType: policyApp.mimeType,
|
|
180
|
+
_meta: policyApp.resourceMeta
|
|
181
|
+
}, async () => policyApp.resourceContents());
|
|
182
|
+
}
|
|
183
|
+
controlPlane.startPolicySync();
|
|
184
|
+
client.recordDiagnostic("installation_verified", "SupportBridge MCP integration installed", {
|
|
185
|
+
telemetry: true,
|
|
186
|
+
policies: true,
|
|
187
|
+
mcpApp: true,
|
|
188
|
+
chat: true,
|
|
189
|
+
policyEngine: true,
|
|
190
|
+
policyBuilderApp: options.policyApp?.enabled !== false,
|
|
191
|
+
sdkVersion: "0.8.1",
|
|
192
|
+
resourceUri: app.resourceUri
|
|
193
|
+
});
|
|
194
|
+
const shutdown = () => void installation.close();
|
|
195
|
+
const installation = {
|
|
196
|
+
client,
|
|
197
|
+
controlPlane,
|
|
198
|
+
resourceUri: app.resourceUri,
|
|
199
|
+
...(options.policyApp?.enabled !== false ? { policyResourceUri: policyApp.resourceUri } : {}),
|
|
200
|
+
instrumentTool: (toolName, handler, localOptions = {}) => instrumentMcpTool(client, toolName, handler, {
|
|
201
|
+
...localOptions,
|
|
202
|
+
identify: (_arguments, context) => options.identify(context)
|
|
203
|
+
}),
|
|
204
|
+
close: async () => {
|
|
205
|
+
process.off("SIGTERM", shutdown);
|
|
206
|
+
process.off("SIGINT", shutdown);
|
|
207
|
+
controlPlane.stopPolicySync();
|
|
208
|
+
await client.close();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
process.once("SIGTERM", shutdown);
|
|
212
|
+
process.once("SIGINT", shutdown);
|
|
213
|
+
return installation;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBA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I,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAChC,YAAY,CAAC,cAAc,EAAE,CAAC;YAC9B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;KACF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACjC,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { SupportBridgeControlPlane } from "./control-plane.js";
|
|
2
|
+
import type { McpToolResult } from "./mcp.js";
|
|
3
|
+
export declare const SUPPORT_CHAT_RESOURCE_URI = "ui://supportbridge/chat-v0.8.1.html";
|
|
4
|
+
export declare const SUPPORT_CHAT_MIME_TYPE = "text/html;profile=mcp-app";
|
|
5
|
+
export interface SupportChatAppOptions {
|
|
6
|
+
resourceUri?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
pollIntervalMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SupportChatApp {
|
|
11
|
+
resourceUri: string;
|
|
12
|
+
mimeType: typeof SUPPORT_CHAT_MIME_TYPE;
|
|
13
|
+
toolMeta: Record<string, unknown>;
|
|
14
|
+
resourceMeta: Record<string, unknown>;
|
|
15
|
+
resourceContents(): {
|
|
16
|
+
contents: Array<{
|
|
17
|
+
uri: string;
|
|
18
|
+
mimeType: string;
|
|
19
|
+
text: string;
|
|
20
|
+
_meta: Record<string, unknown>;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
tools: {
|
|
24
|
+
get_support_chat(arguments_: {
|
|
25
|
+
ticket_id: string;
|
|
26
|
+
}): Promise<McpToolResult>;
|
|
27
|
+
send_support_message(arguments_: {
|
|
28
|
+
ticket_id: string;
|
|
29
|
+
text: string;
|
|
30
|
+
sender_name?: string | undefined;
|
|
31
|
+
}): Promise<McpToolResult>;
|
|
32
|
+
support_get_messages(arguments_: {
|
|
33
|
+
session_id: string;
|
|
34
|
+
}): Promise<McpToolResult>;
|
|
35
|
+
support_send_message(arguments_: {
|
|
36
|
+
session_id: string;
|
|
37
|
+
message: string;
|
|
38
|
+
}): Promise<McpToolResult>;
|
|
39
|
+
support_end_session(arguments_: {
|
|
40
|
+
session_id: string;
|
|
41
|
+
}): Promise<McpToolResult>;
|
|
42
|
+
support_reopen_session(arguments_: {
|
|
43
|
+
session_id: string;
|
|
44
|
+
}): Promise<McpToolResult>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** Implements the protocol contract used by the known-working SupportBridge connector. */
|
|
48
|
+
export declare function createSupportChatApp(controlPlane: SupportBridgeControlPlane, options?: SupportChatAppOptions): SupportChatApp;
|
|
49
|
+
export declare function workingConversation(value: unknown, fallbackId?: string): Record<string, unknown>;
|
|
50
|
+
//# sourceMappingURL=mcp-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-app.d.ts","sourceRoot":"","sources":["../src/mcp-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,eAAO,MAAM,yBAAyB,wCAAwC,CAAC;AAC/E,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAElE,MAAM,WAAW,qBAAqB;IAAG,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAAE;AACzG,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,sBAAsB,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC,MAAM,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,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMhG"}
|
package/dist/mcp-app.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const SUPPORT_CHAT_RESOURCE_URI = "ui://supportbridge/chat-v0.8.1.html";
|
|
2
|
+
export const SUPPORT_CHAT_MIME_TYPE = "text/html;profile=mcp-app";
|
|
3
|
+
/** Implements the protocol contract used by the known-working SupportBridge connector. */
|
|
4
|
+
export function createSupportChatApp(controlPlane, options = {}) {
|
|
5
|
+
const resourceUri = options.resourceUri ?? SUPPORT_CHAT_RESOURCE_URI;
|
|
6
|
+
const title = options.title ?? "Talk to Support";
|
|
7
|
+
const pollIntervalMs = Math.max(1_000, options.pollIntervalMs ?? 2_000);
|
|
8
|
+
const toolMeta = { ui: { resourceUri, visibility: ["model", "app"] }, "ui/resourceUri": resourceUri };
|
|
9
|
+
const getConversation = async (ticketId) => workingConversation(await controlPlane.getChat(ticketId), ticketId);
|
|
10
|
+
return {
|
|
11
|
+
resourceUri,
|
|
12
|
+
mimeType: SUPPORT_CHAT_MIME_TYPE,
|
|
13
|
+
toolMeta,
|
|
14
|
+
resourceMeta: { ui: { preferredFrameSize: { width: 680, height: 540 } } },
|
|
15
|
+
resourceContents: () => ({ contents: [{ uri: resourceUri, mimeType: SUPPORT_CHAT_MIME_TYPE, text: supportChatHtml(title, pollIntervalMs), _meta: { ui: { preferredFrameSize: { width: 680, height: 540 } } } }] }),
|
|
16
|
+
tools: {
|
|
17
|
+
get_support_chat: async ({ ticket_id }) => result("Support conversation refreshed.", await getConversation(ticket_id)),
|
|
18
|
+
send_support_message: async ({ ticket_id, text, sender_name }) => { await controlPlane.sendUserMessage(ticket_id, text, sender_name); return result("Message sent to support.", await getConversation(ticket_id)); },
|
|
19
|
+
support_get_messages: async ({ session_id }) => result("Support conversation refreshed.", await getConversation(session_id)),
|
|
20
|
+
support_send_message: async ({ session_id, message }) => { await controlPlane.sendUserMessage(session_id, message); return result("Message sent to support.", await getConversation(session_id)); },
|
|
21
|
+
support_end_session: async ({ session_id }) => result("Support conversation ended.", workingConversation(await controlPlane.endChat(session_id), session_id)),
|
|
22
|
+
support_reopen_session: async ({ session_id }) => result("Support conversation reopened.", workingConversation(await controlPlane.reopenChat(session_id), session_id))
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function workingConversation(value, fallbackId) {
|
|
27
|
+
const body = record(value), sourceSession = record(body.session ?? body.ticket);
|
|
28
|
+
const sessionId = string(sourceSession.id) || string(body.session_id) || string(body.ticketId) || fallbackId || "";
|
|
29
|
+
const session = { ...sourceSession, id: sessionId, status: string(sourceSession.status) || string(body.status) || "queued", ...(sourceSession.assignedTo && !sourceSession.agent_name ? { agent_name: sourceSession.assignedTo } : {}) };
|
|
30
|
+
const messages = Array.isArray(body.messages) ? body.messages.map(item => { const message = record(item); return { ...message, created_at: message.created_at ?? message.createdAt ?? new Date().toISOString(), sender_name: message.sender_name ?? message.senderName }; }) : [];
|
|
31
|
+
return { session_id: sessionId, status: session.status, session, messages };
|
|
32
|
+
}
|
|
33
|
+
function result(text, structuredContent) { return { content: [{ type: "text", text }], structuredContent }; }
|
|
34
|
+
function record(value) { return value && typeof value === "object" && !Array.isArray(value) ? value : {}; }
|
|
35
|
+
function string(value) { return typeof value === "string" ? value : ""; }
|
|
36
|
+
function supportChatHtml(title, pollIntervalMs) {
|
|
37
|
+
const config = JSON.stringify({ title, pollIntervalMs }).replace(/</g, "\\u003c");
|
|
38
|
+
return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><style>
|
|
39
|
+
:root{font:14px Inter,ui-sans-serif,system-ui,-apple-system,sans-serif;color:#17211b;color-scheme:light;--brand:#176b49;--brand-soft:#dff3e8;--line:#dde5df;--muted:#68766d;--surface:#fff;--chat:#f6f8f6}*{box-sizing:border-box}body{margin:0;background:transparent}.app{position:relative;border:1px solid var(--line);border-radius:18px;overflow:hidden;background:var(--surface);min-height:480px;box-shadow:0 8px 28px rgba(31,54,41,.08);transition:min-height .2s ease}.head{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line);min-height:72px}.avatar{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:var(--brand);color:#fff;font-weight:800;box-shadow:inset 0 0 0 2px rgba(255,255,255,.35)}.identity{min-width:0;flex:1}.brand{font-weight:800;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.presence{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:12px;margin-top:3px}.dot{width:7px;height:7px;border-radius:50%;background:#2aa66a}.dot.waiting{background:#e4a832}.dot.closed{background:#9aa49d}.head-actions{display:flex;align-items:center;gap:5px}.icon-button,.send-button{border:0;cursor:pointer;display:grid;place-items:center}.icon-button{width:34px;height:34px;border-radius:9px;background:transparent;color:#536158;font-size:17px}.icon-button:hover{background:#eef2ef}.details{position:relative}.details summary{list-style:none}.details summary::-webkit-details-marker{display:none}.details-card{position:absolute;right:0;top:40px;z-index:4;width:230px;padding:12px;border:1px solid var(--line);border-radius:12px;background:#fff;box-shadow:0 10px 30px rgba(20,40,28,.15);font-size:12px;color:var(--muted)}.details-card code{display:block;margin-top:4px;color:#34443a;overflow-wrap:anywhere}.chat-wrap{position:relative}.chat{height:334px;overflow:auto;padding:16px;background:var(--chat);scroll-behavior:smooth}.empty{text-align:center;color:var(--muted);padding:90px 20px}.row{display:flex;gap:8px;align-items:flex-end;margin:11px 0}.row.user{justify-content:flex-end}.row.support{justify-content:flex-start}.message-avatar{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;flex:0 0 auto;background:#d9e8de;color:#26573e;font-size:11px;font-weight:800}.message-wrap{max-width:74%}.sender{font-size:11px;font-weight:700;color:#657269;margin:0 0 4px 3px}.bubble{padding:10px 12px;border-radius:15px 15px 15px 5px;background:#fff;border:1px solid #e2e8e3;box-shadow:0 1px 2px rgba(26,46,34,.04);white-space:pre-wrap;overflow-wrap:anywhere}.user .bubble{border:0;border-radius:15px 15px 5px 15px;background:var(--brand);color:#fff}.meta{display:flex;gap:5px;align-items:center;margin-top:4px;padding:0 3px;color:#849087;font-size:10px}.user .meta{justify-content:flex-end}.system-row{text-align:center;margin:14px 0}.system-pill{display:inline-flex;align-items:center;gap:5px;max-width:90%;padding:5px 9px;border-radius:999px;background:#e9eeea;color:#6b786f;font-size:11px}.unread{position:absolute;left:50%;bottom:12px;transform:translateX(-50%);border:1px solid #cfe0d4;border-radius:999px;padding:7px 11px;background:#fff;color:var(--brand);font-weight:750;box-shadow:0 4px 14px rgba(24,57,38,.13);cursor:pointer}.composer-area{border-top:1px solid var(--line);background:#fff}.composer{display:flex;align-items:flex-end;gap:8px;padding:11px 12px 7px}.composer textarea{flex:1;min-width:0;max-height:110px;resize:none;padding:11px 13px;border:1px solid #cbd6ce;border-radius:13px;background:#fff;color:#17211b;font:inherit;line-height:20px;outline:none}.composer textarea:focus{border-color:#4a9970;box-shadow:0 0 0 3px rgba(36,126,78,.1)}.send-button{width:42px;height:42px;flex:0 0 auto;border-radius:12px;background:var(--brand);color:#fff;font-size:19px}.send-button:disabled{opacity:.42;cursor:default}.composer-foot{display:flex;align-items:center;justify-content:space-between;min-height:29px;padding:0 13px 8px;color:#879188;font-size:11px}.close-button,.reopen-button{border:0;background:transparent;color:#657169;font:inherit;font-weight:700;cursor:pointer}.reopen-panel{display:none;padding:15px;text-align:center;border-top:1px solid var(--line);background:#fff}.reopen-panel p{margin:0 0 9px;color:var(--muted);font-size:12px}.reopen-button{padding:9px 14px;border-radius:10px;background:#e5f2e9;color:var(--brand)}.app.closed .composer-area{display:none}.app.closed .reopen-panel{display:block}.app.compact{min-height:0}.app.compact .chat-wrap,.app.compact .composer-area,.app.compact .reopen-panel,.app.compact .details{display:none}.app.compact .head{border-bottom:0}.compact-summary{display:none;color:var(--muted);font-size:12px}.app.compact .compact-summary{display:block}.app.compact .presence{display:none}@media(max-width:480px){.chat{height:310px}.message-wrap{max-width:84%}.head{padding:12px}.details-card{right:-36px}}
|
|
40
|
+
</style></head><body><main class="app" id="app"><header class="head"><div class="avatar" id="avatar">S</div><div class="identity"><div class="brand" id="title"></div><div class="presence"><span class="dot waiting" id="dot"></span><span id="status">Connecting to support…</span></div><div class="compact-summary" id="compactSummary">Support chat active</div></div><div class="head-actions"><details class="details"><summary class="icon-button" aria-label="Conversation details">•••</summary><div class="details-card">Conversation ID<code id="session">Creating session…</code></div></details><button class="icon-button" id="collapse" aria-label="Collapse support chat" title="Collapse">⌃</button></div></header><div class="chat-wrap"><section class="chat" id="chat"><div class="empty">Connecting you with human support…</div></section><button class="unread" id="unread" hidden>↓ New messages</button></div><footer class="composer-area"><div class="composer"><textarea id="message" rows="1" placeholder="Message support…" aria-label="Message support"></textarea><button class="send-button" id="send" aria-label="Send message" title="Send">➤</button></div><div class="composer-foot"><span id="delivery">Enter to send · Shift+Enter for a new line</span><button class="close-button" id="end">Close chat</button></div></footer><section class="reopen-panel"><p>This conversation is closed.</p><button class="reopen-button" id="reopen">Reopen conversation</button></section></main><script>
|
|
41
|
+
(()=>{const CONFIG=${config};let nextId=1,sessionId="",polling=false,lastCount=0,unreadCount=0,latestSession=null;const pending=new Map(),q=s=>document.querySelector(s),app=q("#app"),status=q("#status"),dot=q("#dot"),chat=q("#chat"),input=q("#message"),send=q("#send"),end=q("#end"),reopen=q("#reopen"),delivery=q("#delivery"),unread=q("#unread"),collapse=q("#collapse"),summary=q("#compactSummary");q("#title").textContent=CONFIG.title;const post=message=>window.parent.postMessage(message,"*");const request=(method,params)=>new Promise((resolve,reject)=>{const id=nextId++;pending.set(id,{resolve,reject});post({jsonrpc:"2.0",id,method,params});window.setTimeout(()=>{if(pending.delete(id))reject(new Error(method+" timed out"))},30000)});const notify=(method,params)=>post({jsonrpc:"2.0",method,...(params?{params}:{})});const callTool=(name,args)=>request("tools/call",{name,arguments:args});const sendSize=()=>notify("ui/notifications/size-changed",{width:Math.ceil(document.documentElement.getBoundingClientRect().width),height:Math.ceil(document.documentElement.getBoundingClientRect().height)});const esc=value=>String(value??"").replace(/[&<>\"']/g,c=>({"&":"&","<":"<",">":">",'\"':""","'":"'"}[c]));const time=value=>{const date=new Date(value);return Number.isNaN(date.getTime())?"":date.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})};const friendlyAgent=value=>{const name=String(value??"").trim();return !name||name.startsWith("slack:")||name.toUpperCase().startsWith("SLACK:")?"Support team":name};const systemText=value=>{const text=String(value??"");if(/claimed this conversation/i.test(text))return text.replace(/ claimed this conversation.*$/i," joined the conversation");if(/resolved this conversation/i.test(text))return "Conversation closed";if(/reopened this conversation/i.test(text))return "Conversation reopened";if(/support request created/i.test(text))return "Support request created";return text};const atBottom=()=>chat.scrollHeight-chat.scrollTop-chat.clientHeight<48;function messageHtml(message,agent){const sender=message.sender==="user"?"user":message.sender==="system"?"system":"support";if(sender==="system")return '<div class="system-row"><span class="system-pill">'+esc(systemText(message.text))+'</span></div>';const name=sender==="support"?friendlyAgent(message.sender_name||agent):"You";const avatar=name.charAt(0).toUpperCase()||"S";return '<div class="row '+sender+'">'+(sender==="support"?'<div class="message-avatar">'+esc(avatar)+'</div>':"")+'<div class="message-wrap">'+(sender==="support"?'<div class="sender">'+esc(name)+'</div>':"")+'<div class="bubble">'+esc(message.text)+'</div><div class="meta"><span>'+esc(time(message.created_at))+'</span></div></div></div>'}function render(session,messages){latestSession=session;const wasBottom=atBottom(),newMessages=Math.max(0,messages.length-lastCount),supportMessage=[...messages].reverse().find(message=>message.sender==="support"),agent=friendlyAgent(supportMessage?.sender_name||session.agent_name);q("#avatar").textContent=agent.charAt(0).toUpperCase()||"S";const closed=session.status==="resolved",waiting=session.status==="queued";status.textContent=closed?"Conversation closed":waiting?"Waiting for a support specialist":agent+" · Online";dot.className="dot "+(closed?"closed":waiting?"waiting":"");app.classList.toggle("closed",closed);summary.textContent=closed?"Conversation closed":unreadCount?unreadCount+" new "+(unreadCount===1?"reply":"replies"):"Support chat active";chat.innerHTML=messages.length?messages.map(message=>messageHtml(message,agent)).join(""):'<div class="empty">Your support conversation is ready.</div>';if(wasBottom||lastCount===0){chat.scrollTop=chat.scrollHeight;unreadCount=0;unread.hidden=true}else if(newMessages){unreadCount+=newMessages;unread.textContent="↓ "+unreadCount+" new "+(unreadCount===1?"message":"messages");unread.hidden=false}lastCount=messages.length;input.disabled=send.disabled=closed;sendSize()}async function refresh(){if(!sessionId)return;try{const result=await callTool("support_get_messages",{session_id:sessionId}),data=result.structuredContent;if(data?.session&&Array.isArray(data.messages))render(data.session,data.messages)}catch(_){status.textContent="Reconnecting…";dot.className="dot waiting"}}function receiveToolResult(params){const data=params?.structuredContent;if(!data?.session_id)return;sessionId=data.session_id;q("#session").textContent=sessionId;if(data.session&&Array.isArray(data.messages))render(data.session,data.messages);if(!polling){polling=true;void refresh();window.setInterval(()=>void refresh(),CONFIG.pollIntervalMs)}}window.addEventListener("message",event=>{if(event.source!==window.parent)return;const message=event.data;if(!message||message.jsonrpc!=="2.0")return;if(message.id!==undefined&&(message.result!==undefined||message.error)){const waiter=pending.get(message.id);if(!waiter)return;pending.delete(message.id);message.error?waiter.reject(new Error(message.error.message)):waiter.resolve(message.result)}else if(message.method==="ui/notifications/tool-result")receiveToolResult(message.params);else if(message.method==="ping"&&message.id!==undefined)post({jsonrpc:"2.0",id:message.id,result:{}});else if(message.method==="ui/resource-teardown"&&message.id!==undefined)post({jsonrpc:"2.0",id:message.id,result:{}})});async function sendMessage(){const message=input.value.trim();if(!message||!sessionId)return;input.value="";input.style.height="auto";send.disabled=true;delivery.textContent="Sending…";try{await callTool("support_send_message",{session_id:sessionId,message});delivery.textContent="Sent";await refresh();window.setTimeout(()=>{if(delivery.textContent==="Sent")delivery.textContent="Enter to send · Shift+Enter for a new line"},1800)}catch(_){input.value=message;delivery.textContent="Message failed · Press send to retry"}finally{send.disabled=latestSession?.status==="resolved"}}send.addEventListener("click",()=>void sendMessage());input.addEventListener("input",()=>{input.style.height="auto";input.style.height=Math.min(input.scrollHeight,110)+"px"});input.addEventListener("keydown",event=>{if(event.key==="Enter"&&!event.shiftKey){event.preventDefault();void sendMessage()}});end.addEventListener("click",async()=>{if(!sessionId)return;end.disabled=true;delivery.textContent="Closing conversation…";try{const result=await callTool("support_end_session",{session_id:sessionId}),data=result.structuredContent;if(data?.session)render(data.session,data.messages||[])}finally{end.disabled=false}});reopen.addEventListener("click",async()=>{if(!sessionId)return;reopen.disabled=true;try{const result=await callTool("support_reopen_session",{session_id:sessionId}),data=result.structuredContent;if(data?.session)render(data.session,data.messages||[])}finally{reopen.disabled=false}});unread.addEventListener("click",()=>{chat.scrollTop=chat.scrollHeight;unreadCount=0;unread.hidden=true;summary.textContent="Support chat active"});chat.addEventListener("scroll",()=>{if(atBottom()){unreadCount=0;unread.hidden=true;summary.textContent=latestSession?.status==="resolved"?"Conversation closed":"Support chat active"}});collapse.addEventListener("click",()=>{const compact=app.classList.toggle("compact");collapse.textContent=compact?"⌄":"⌃";collapse.setAttribute("aria-label",compact?"Open support chat":"Collapse support chat");sendSize()});request("ui/initialize",{appInfo:{name:"SupportBridge Chat",version:"0.5.0"},appCapabilities:{availableDisplayModes:["inline"]},protocolVersion:"2026-01-26"}).then(()=>{notify("ui/notifications/initialized");sendSize();new ResizeObserver(sendSize).observe(document.documentElement);status.textContent="Connecting to support…"}).catch(()=>{status.textContent="This host could not initialize the support app"})})();
|
|
42
|
+
</script></body></html>`;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=mcp-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-app.js","sourceRoot":"","sources":["../src/mcp-app.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,yBAAyB,GAAG,qCAAqC,CAAC;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAmBlE,0FAA0F;AAC1F,MAAM,UAAU,oBAAoB,CAAC,YAAuC,EAAE,UAAiC,EAAE;IAC/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,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAgC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxK,SAAS,MAAM,CAAC,KAAc,IAAY,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1F,SAAS,eAAe,CAAC,KAAa,EAAE,cAAsB;IAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClF,OAAO;;;qBAGY,MAAM;wBACH,CAAC;AACzB,CAAC"}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SupportBridgeClient, type InstrumentToolOptions } from "./client.js";
|
|
2
|
+
import type { SupportBridgeControlPlane, CreateSupportTicketInput } from "./control-plane.js";
|
|
3
|
+
import type { SupportIdentity } from "./types.js";
|
|
4
|
+
export interface McpToolResult {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
content: Array<{
|
|
7
|
+
type: "text";
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
structuredContent?: Record<string, unknown>;
|
|
11
|
+
isError?: boolean;
|
|
12
|
+
_meta?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export type McpToolHandler<TArguments> = (arguments_: TArguments, context?: unknown) => Promise<McpToolResult> | McpToolResult;
|
|
15
|
+
export interface McpInstrumentationOptions<TArguments> extends InstrumentToolOptions<McpToolResult> {
|
|
16
|
+
identify: (arguments_: TArguments, context?: unknown) => Promise<SupportIdentity | undefined> | SupportIdentity | undefined;
|
|
17
|
+
requestId?: (context?: unknown) => string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface SupportDecisionToolOptions {
|
|
20
|
+
controlPlane?: SupportBridgeControlPlane;
|
|
21
|
+
ticket?: (arguments_: {
|
|
22
|
+
trigger_id: string;
|
|
23
|
+
issue_summary?: string | undefined;
|
|
24
|
+
customer?: string | undefined;
|
|
25
|
+
error_code?: string | undefined;
|
|
26
|
+
priority?: "normal" | "urgent" | undefined;
|
|
27
|
+
}, identity: SupportIdentity, context?: unknown) => Omit<CreateSupportTicketInput, "identity" | "triggerId">;
|
|
28
|
+
appMeta?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export declare function instrumentMcpTool<TArguments>(client: SupportBridgeClient, toolName: string, handler: McpToolHandler<TArguments>, options: McpInstrumentationOptions<TArguments>): McpToolHandler<TArguments>;
|
|
31
|
+
export declare function supportDecisionTools(client: SupportBridgeClient, identify: (context?: unknown) => Promise<SupportIdentity | undefined> | SupportIdentity | undefined, options?: SupportDecisionToolOptions): {
|
|
32
|
+
dismiss_support_offer: (arguments_: {
|
|
33
|
+
trigger_id: string;
|
|
34
|
+
reason?: string | undefined;
|
|
35
|
+
}, context?: unknown) => Promise<McpToolResult>;
|
|
36
|
+
accept_support_offer: (arguments_: {
|
|
37
|
+
trigger_id: string;
|
|
38
|
+
issue_summary?: string | undefined;
|
|
39
|
+
customer?: string | undefined;
|
|
40
|
+
error_code?: string | undefined;
|
|
41
|
+
priority?: "normal" | "urgent" | undefined;
|
|
42
|
+
}, context?: unknown) => Promise<McpToolResult>;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA0B,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACtG,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,KAAK,EAA0B,eAAe,EAAgC,MAAM,YAAY,CAAC;AAExG,M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AC,wBAAwB,EAAE,UAAU,GAAG,WAAW,CAAC,CAAC;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAC1C,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,EACnC,OAAO,EAAE,yBAAyB,CAAC,UAAU,CAAC,GAC7C,cAAc,CAAC,UAAU,CAAC,CAqB5B;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,GAAG,eAAe,GAAG,SAAS,EACnG,OAAO,GAAE,0BAA+B;wCAGI;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,YAAY,OAAO,KAAG,OAAO,CAAC,aAAa,CAAC;uCAQhG;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;KAAE,YAAY,OAAO,KAAG,OAAO,CAAC,aAAa,CAAC;EA6B9P"}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { SupportBridgeToolError } from "./client.js";
|
|
2
|
+
export function instrumentMcpTool(client, toolName, handler, options) {
|
|
3
|
+
return async (arguments_, context) => {
|
|
4
|
+
const identity = await options.identify(arguments_, context);
|
|
5
|
+
const requestId = options.requestId?.(context);
|
|
6
|
+
const invocation = {
|
|
7
|
+
toolName, arguments: arguments_, ...(identity ? { identity } : {}),
|
|
8
|
+
...(requestId ? { requestId } : {})
|
|
9
|
+
};
|
|
10
|
+
try {
|
|
11
|
+
const result = await client.instrumentTool(invocation, () => handler(arguments_, context), options);
|
|
12
|
+
return toMcpResult(result);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (!(error instanceof SupportBridgeToolError))
|
|
16
|
+
throw error;
|
|
17
|
+
const details = { error: error.message, ...(error.supportOffer ? supportOfferData(error.supportOffer) : {}) };
|
|
18
|
+
return {
|
|
19
|
+
isError: true,
|
|
20
|
+
content: [{ type: "text", text: error.supportOffer ? blockingNotice(error.supportOffer) : error.message }],
|
|
21
|
+
structuredContent: details
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function supportDecisionTools(client, identify, options = {}) {
|
|
27
|
+
return {
|
|
28
|
+
dismiss_support_offer: async (arguments_, context) => {
|
|
29
|
+
const identity = await identify(context);
|
|
30
|
+
await client.decideSupport(arguments_.trigger_id, identity, "dismissed");
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: "Support offer dismissed. Retry the original request." }],
|
|
33
|
+
structuredContent: { dismissed: true, trigger_id: arguments_.trigger_id, retry_original_request: true }
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
accept_support_offer: async (arguments_, context) => {
|
|
37
|
+
const identity = await identify(context);
|
|
38
|
+
await client.decideSupport(arguments_.trigger_id, identity, "accepted");
|
|
39
|
+
if (options.controlPlane && identity) {
|
|
40
|
+
const brief = client.buildSupportBrief(identity, arguments_.issue_summary);
|
|
41
|
+
const configured = options.ticket?.(arguments_, identity, context) ?? {
|
|
42
|
+
issue: arguments_.issue_summary ?? brief.issue,
|
|
43
|
+
...(arguments_.customer ?? brief.customer ? { customer: arguments_.customer ?? brief.customer } : {}),
|
|
44
|
+
...(arguments_.error_code ?? brief.errorCode ? { errorCode: arguments_.error_code ?? brief.errorCode } : {}),
|
|
45
|
+
...(arguments_.priority ? { priority: arguments_.priority } : {})
|
|
46
|
+
};
|
|
47
|
+
const ticket = await options.controlPlane.createTicket({
|
|
48
|
+
...configured,
|
|
49
|
+
identity,
|
|
50
|
+
triggerId: arguments_.trigger_id
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
content: [{ type: "text", text: `Support chat ${ticket.id} opened.` }],
|
|
54
|
+
structuredContent: { accepted: true, trigger_id: arguments_.trigger_id, session_id: ticket.id, status: ticket.status, session: { ...ticket, id: ticket.id }, messages: [] },
|
|
55
|
+
...(options.appMeta ? { _meta: options.appMeta } : {})
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
content: [{ type: "text", text: "Support offer accepted. Open the vendor support experience." }],
|
|
60
|
+
structuredContent: { accepted: true, trigger_id: arguments_.trigger_id },
|
|
61
|
+
...(options.appMeta ? { _meta: options.appMeta } : {})
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function toMcpResult(result) {
|
|
67
|
+
if (result.kind === "support_offer") {
|
|
68
|
+
return {
|
|
69
|
+
isError: true,
|
|
70
|
+
content: [{ type: "text", text: blockingNotice(result.offer) }],
|
|
71
|
+
structuredContent: supportOfferData(result.offer)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (!result.offer)
|
|
75
|
+
return result.value;
|
|
76
|
+
const offerData = supportOfferData(result.offer);
|
|
77
|
+
const visibleOffer = result.offer.requiresAcknowledgement
|
|
78
|
+
? [{ type: "text", text: acknowledgementNotice(result.offer) }]
|
|
79
|
+
: [];
|
|
80
|
+
return {
|
|
81
|
+
...result.value,
|
|
82
|
+
content: [...result.value.content, ...visibleOffer],
|
|
83
|
+
structuredContent: { ...(result.value.structuredContent ?? {}), ...offerData }
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function supportOfferData(offer) {
|
|
87
|
+
return {
|
|
88
|
+
support_available: true,
|
|
89
|
+
support_offer_blocking: offer.blocking,
|
|
90
|
+
support_offer_status: "pending",
|
|
91
|
+
support_offer_requires_acknowledgement: offer.requiresAcknowledgement,
|
|
92
|
+
support_trigger_id: offer.triggerId,
|
|
93
|
+
support_reason: offer.reason,
|
|
94
|
+
suggested_message: offer.message,
|
|
95
|
+
requires_user_permission: true,
|
|
96
|
+
accept_tool: offer.motion === "assistance" ? "request_assistance" : "accept_support_offer",
|
|
97
|
+
...(offer.motion ? { support_motion: offer.motion } : {}),
|
|
98
|
+
...(offer.assignedRep ? { available_representative: offer.assignedRep } : {}),
|
|
99
|
+
decline_tool: "dismiss_support_offer",
|
|
100
|
+
retry_original_request_after_response: offer.retryOriginalRequestAfterDecision
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function acknowledgementNotice(offer) {
|
|
104
|
+
const representative = offer.assignedRep?.name ? `${offer.assignedRep.name} is currently available` : "Human assistance is currently available";
|
|
105
|
+
const acceptTool = offer.motion === "assistance" ? "request_assistance" : "accept_support_offer";
|
|
106
|
+
return [
|
|
107
|
+
"LIVE ASSISTANCE AVAILABLE — USER RESPONSE REQUESTED",
|
|
108
|
+
"The requested tool result is included above.",
|
|
109
|
+
`${representative}. ${offer.reason}`,
|
|
110
|
+
"Clearly offer the user the choice to connect or decline. Do not contact anyone without the user's explicit consent.",
|
|
111
|
+
`If accepted, call ${acceptTool} with trigger_id '${offer.triggerId}'. If declined, call dismiss_support_offer with the same trigger_id.`
|
|
112
|
+
].join("\n\n");
|
|
113
|
+
}
|
|
114
|
+
function blockingNotice(offer) {
|
|
115
|
+
return `REQUEST PAUSED — USER RESPONSE REQUIRED: ${offer.message} If the user declines, call dismiss_support_offer with trigger_id '${offer.triggerId}', then retry the original request.`;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"m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AAqH;QACrH,qBAAqB,UAAU,qBAAqB,KAAK,CAAC,SAAS,sEAAsE;KAC1I,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,cAAc,CAAC,KAAmB;IACzC,OAAO,4CAA4C,KAAK,CAAC,OAAO,sEAAsE,KAAK,CAAC,SAAS,qCAAqC,CAAC;AAC7L,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const SUPPORT_OFFER_RESOURCE_URI = "ui://supportbridge/offer-v1.0.1.html";
|
|
2
|
+
export declare const SUPPORT_OFFER_MIME_TYPE = "text/html;profile=mcp-app";
|
|
3
|
+
export interface SupportOfferAppOptions {
|
|
4
|
+
resourceUri?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function createSupportOfferApp(options?: SupportOfferAppOptions): {
|
|
8
|
+
resourceUri: string;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
toolMeta: {
|
|
11
|
+
ui: {
|
|
12
|
+
resourceUri: string;
|
|
13
|
+
visibility: string[];
|
|
14
|
+
};
|
|
15
|
+
"ui/resourceUri": string;
|
|
16
|
+
};
|
|
17
|
+
resourceMeta: {
|
|
18
|
+
ui: {
|
|
19
|
+
preferredFrameSize: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
resourceContents: () => {
|
|
26
|
+
contents: {
|
|
27
|
+
uri: string;
|
|
28
|
+
mimeType: string;
|
|
29
|
+
text: string;
|
|
30
|
+
_meta: {
|
|
31
|
+
ui: {
|
|
32
|
+
preferredFrameSize: {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=offer-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offer-app.d.ts","sourceRoot":"","sources":["../src/offer-app.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,yCAAyC,CAAC;AACjF,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AAEnE,MAAM,WAAW,sBAAsB;IAAG,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CAAE;AAEjF,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASzE"}
|