@wix/mcp 1.0.21 → 1.0.23
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/build/bin-standalone.js +634 -976
- package/build/bin-standalone.js.map +4 -4
- package/build/cjs/index.cjs +8882 -1521
- package/build/cjs/index.cjs.map +4 -4
- package/build/dts/api-call/index.d.ts +1 -1
- package/build/dts/api-call/index.d.ts.map +1 -1
- package/build/dts/api-call/index.js +20 -12
- package/build/dts/api-call/index.js.map +1 -1
- package/build/dts/bin.d.ts +1 -1
- package/build/dts/bin.d.ts.map +1 -1
- package/build/dts/bin.js +8 -2
- package/build/dts/bin.js.map +1 -1
- package/build/dts/docs/create-site-guide-fixture.d.ts +8 -0
- package/build/dts/docs/create-site-guide-fixture.d.ts.map +1 -0
- package/build/dts/docs/create-site-guide-fixture.js +11 -0
- package/build/dts/docs/create-site-guide-fixture.js.map +1 -0
- package/build/dts/docs/create-site-guide.d.ts +3 -0
- package/build/dts/docs/create-site-guide.d.ts.map +1 -0
- package/build/dts/docs/create-site-guide.js +71 -0
- package/build/dts/docs/create-site-guide.js.map +1 -0
- package/build/dts/docs/docs.d.ts +19 -1
- package/build/dts/docs/docs.d.ts.map +1 -1
- package/build/dts/docs/docs.js +136 -107
- package/build/dts/docs/docs.js.map +1 -1
- package/build/dts/docs/get-to-know.d.ts +10 -1
- package/build/dts/docs/get-to-know.d.ts.map +1 -1
- package/build/dts/docs/get-to-know.js +11 -6
- package/build/dts/docs/get-to-know.js.map +1 -1
- package/build/dts/docs/velo-readme.d.ts.map +1 -1
- package/build/dts/docs/velo-readme.js +1 -1
- package/build/dts/docs/velo-readme.js.map +1 -1
- package/build/dts/index.d.ts +3 -1
- package/build/dts/index.d.ts.map +1 -1
- package/build/dts/index.js +2 -0
- package/build/dts/index.js.map +1 -1
- package/build/dts/pull-site-creation-job-tool/constants.d.ts +3 -0
- package/build/dts/pull-site-creation-job-tool/constants.d.ts.map +1 -0
- package/build/dts/pull-site-creation-job-tool/constants.js +3 -0
- package/build/dts/pull-site-creation-job-tool/constants.js.map +1 -0
- package/build/dts/pull-site-creation-job-tool/index.d.ts +21 -0
- package/build/dts/pull-site-creation-job-tool/index.d.ts.map +1 -0
- package/build/dts/pull-site-creation-job-tool/index.js +144 -0
- package/build/dts/pull-site-creation-job-tool/index.js.map +1 -0
- package/build/dts/site-builder-tool/constants.d.ts +7 -0
- package/build/dts/site-builder-tool/constants.d.ts.map +1 -0
- package/build/dts/site-builder-tool/constants.js +7 -0
- package/build/dts/site-builder-tool/constants.js.map +1 -0
- package/build/dts/site-builder-tool/index.d.ts +4 -0
- package/build/dts/site-builder-tool/index.d.ts.map +1 -0
- package/build/dts/site-builder-tool/index.js +160 -0
- package/build/dts/site-builder-tool/index.js.map +1 -0
- package/build/dts/support/index.d.ts +1 -1
- package/build/dts/support/index.d.ts.map +1 -1
- package/build/dts/support/index.js +8 -4
- package/build/dts/support/index.js.map +1 -1
- package/build/dts/widget-manifest.d.ts +6 -0
- package/build/dts/widget-manifest.d.ts.map +1 -0
- package/build/dts/widget-manifest.js +19 -0
- package/build/dts/widget-manifest.js.map +1 -0
- package/build/dts/wix-mcp-server.d.ts +16 -3
- package/build/dts/wix-mcp-server.d.ts.map +1 -1
- package/build/dts/wix-mcp-server.js +121 -106
- package/build/dts/wix-mcp-server.js.map +1 -1
- package/build/esm/index.js +8789 -926
- package/build/esm/index.js.map +4 -4
- package/package.json +28 -7
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { McpAuthenticationStrategy } from '../auth/index.js';
|
|
2
|
+
import { WixMcpServer } from '../wix-mcp-server.js';
|
|
3
|
+
export interface Job {
|
|
4
|
+
id?: string;
|
|
5
|
+
status: 'STARTED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
|
|
6
|
+
durationMs?: number;
|
|
7
|
+
userPrompt: string;
|
|
8
|
+
progress?: string;
|
|
9
|
+
data?: {
|
|
10
|
+
editorUrl?: string;
|
|
11
|
+
previewUrl?: string;
|
|
12
|
+
siteId?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface PullJobResponse {
|
|
16
|
+
success: boolean;
|
|
17
|
+
message?: string;
|
|
18
|
+
job: Job;
|
|
19
|
+
}
|
|
20
|
+
export declare function addPullSiteCreationJobTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy): void;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pull-site-creation-job-tool/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMpD,MAAM,WAAW,GAAG;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,GAAG,CAAC;CACV;AAID,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,yBAAyB,QAiIxC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { createHttpClient } from '@wix/http-client';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
import { PULL_SITE_CREATION_JOB_TOOL_NAME } from './constants.js';
|
|
4
|
+
import { logger } from '../infra/logger.js';
|
|
5
|
+
import { siteCreatedUsingWixMcpSrc39Evid1608 } from '@wix/bi-logger-wix-code-data/v2';
|
|
6
|
+
const httpClient = createHttpClient();
|
|
7
|
+
export function addPullSiteCreationJobTool(server, authStrategy) {
|
|
8
|
+
const { getAccountAuthHeaders, getSiteAuthHeaders } = authStrategy;
|
|
9
|
+
server.registerTool(PULL_SITE_CREATION_JOB_TOOL_NAME, {
|
|
10
|
+
title: 'Pull Site Creation Job',
|
|
11
|
+
description: 'Pull the status of a site creation job',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
jobId: z.string().describe('The job ID to pull')
|
|
14
|
+
},
|
|
15
|
+
annotations: {
|
|
16
|
+
readOnlyHint: true
|
|
17
|
+
},
|
|
18
|
+
_meta: {
|
|
19
|
+
'openai/toolInvocation/invoking': 'Fetching codegen job',
|
|
20
|
+
'openai/toolInvocation/invoked': 'Jobs retrieved',
|
|
21
|
+
'openai/visibility': 'private'
|
|
22
|
+
}
|
|
23
|
+
}, async (args, { biLogger, setToolBiParams }) => {
|
|
24
|
+
const { jobId } = args;
|
|
25
|
+
if (!jobId) {
|
|
26
|
+
logger.log(`[pullSiteCreationJob] Missing jobId, returning empty jobs`);
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: 'text', text: 'No job ID provided' }],
|
|
29
|
+
structuredContent: { job: null }
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
setToolBiParams({ jobId });
|
|
33
|
+
try {
|
|
34
|
+
const headers = await getAccountAuthHeaders();
|
|
35
|
+
const response = await httpClient.post('https://manage.wix.com/_api/harmony-site-builder/pull-job', { jobId }, { headers });
|
|
36
|
+
logger.log('[pullSiteCreationJob] Response:', response.data);
|
|
37
|
+
if (!response.data.success) {
|
|
38
|
+
return {
|
|
39
|
+
isError: true,
|
|
40
|
+
content: [{ type: 'text', text: 'Failed to pull job' }],
|
|
41
|
+
structuredContent: {
|
|
42
|
+
job: null,
|
|
43
|
+
error: 'Failed to pull job'
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const job = response.data.job;
|
|
48
|
+
const pullJobMessage = job.status === 'COMPLETED'
|
|
49
|
+
? `Job completed. previewUrl: ${job.data?.previewUrl} editorUrl: ${job.data?.editorUrl} siteId: ${job.data?.siteId}`
|
|
50
|
+
: 'Job in progress';
|
|
51
|
+
if (job.status === 'COMPLETED' && job.data?.siteId) {
|
|
52
|
+
try {
|
|
53
|
+
const siteHeaders = await getSiteAuthHeaders(job.data?.siteId);
|
|
54
|
+
let publishedSiteUrl;
|
|
55
|
+
publishedSiteUrl = await getPublishedSiteUrl({
|
|
56
|
+
siteLevelToken: siteHeaders.Authorization,
|
|
57
|
+
siteId: job.data?.siteId,
|
|
58
|
+
jobId
|
|
59
|
+
});
|
|
60
|
+
if (!publishedSiteUrl) {
|
|
61
|
+
// Avoid duplicate publishing and reporting, by checking if the site not already published
|
|
62
|
+
biLogger.report(siteCreatedUsingWixMcpSrc39Evid1608({
|
|
63
|
+
jobId,
|
|
64
|
+
msid: job.data?.siteId,
|
|
65
|
+
builderType: 'Harmony',
|
|
66
|
+
duration: job.durationMs,
|
|
67
|
+
sitePrompt: job.userPrompt
|
|
68
|
+
}));
|
|
69
|
+
publishedSiteUrl = await publishSite({
|
|
70
|
+
siteLevelToken: siteHeaders.Authorization,
|
|
71
|
+
siteId: job.data?.siteId,
|
|
72
|
+
jobId
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (publishedSiteUrl) {
|
|
76
|
+
job.data.previewUrl = publishedSiteUrl;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
logger.error(`[pullSiteCreationJob] Failed to publish site for job ${jobId}`, { jobId, error: error.message });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: 'text',
|
|
87
|
+
text: `Job pulled successfully.\n${pullJobMessage}`
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
structuredContent: { job: response.data.job }
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
95
|
+
logger.error(`[pullSiteCreationJob] Error pulling job for job ${jobId}`, { jobId, error: errorMessage });
|
|
96
|
+
return {
|
|
97
|
+
isError: true,
|
|
98
|
+
content: [{ type: 'text', text: 'Failed to pull job' }],
|
|
99
|
+
structuredContent: { job: null, error: errorMessage }
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async function publishSite({ siteLevelToken, siteId, jobId }) {
|
|
105
|
+
const response = await httpClient.post('https://www.wixapis.com/site-publisher/v1/site/publish', {}, {
|
|
106
|
+
headers: {
|
|
107
|
+
Authorization: `Bearer ${siteLevelToken}`,
|
|
108
|
+
'wix-site-id': siteId
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
if (response.status !== 200) {
|
|
112
|
+
logger.error(`[pullSiteCreationJob] Failed to publish site for job ${jobId}`, { jobId, error: response.statusText });
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const publishedSiteUrl = await getPublishedSiteUrl({
|
|
116
|
+
siteLevelToken,
|
|
117
|
+
siteId,
|
|
118
|
+
jobId
|
|
119
|
+
});
|
|
120
|
+
if (!publishedSiteUrl) {
|
|
121
|
+
logger.error(`[pullSiteCreationJob] Failed to get published site url for job ${jobId}`);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
return publishedSiteUrl;
|
|
125
|
+
}
|
|
126
|
+
async function getPublishedSiteUrl({ siteLevelToken, siteId, jobId }) {
|
|
127
|
+
try {
|
|
128
|
+
const response = await httpClient.get('https://www.wixapis.com/urls-server/v2/published-site-urls', {
|
|
129
|
+
headers: {
|
|
130
|
+
Authorization: `Bearer ${siteLevelToken}`,
|
|
131
|
+
'wix-site-id': siteId
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
if (response.data?.urls) {
|
|
135
|
+
const primaryUrl = response.data.urls.find((url) => !!url.primary);
|
|
136
|
+
return primaryUrl?.url ?? '';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
logger.error(`[pullSiteCreationJob] Failed to get published site urls for job ${jobId}`, { jobId, error: error.message });
|
|
141
|
+
}
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pull-site-creation-job-tool/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,mCAAmC,EAAE,MAAM,iCAAiC,CAAC;AAqBtF,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AAEtC,MAAM,UAAU,0BAA0B,CACxC,MAAoB,EACpB,YAAuC;IAEvC,MAAM,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC;IAEnE,MAAM,CAAC,YAAY,CACjB,gCAAgC,EAChC;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,wCAAwC;QACrD,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;SACjD;QACD,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;SACnB;QACD,KAAK,EAAE;YACL,gCAAgC,EAAE,sBAAsB;YACxD,+BAA+B,EAAE,gBAAgB;YACjD,mBAAmB,EAAE,SAAS;SAC/B;KACF,EACD,KAAK,EA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,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,CAAC,KAAK,CACV,kEAAkE,KAAK,EAAE,CAC1E,CAAC;QACF,OAAO;IACT,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,EACjC,cAAc,EACd,MAAM,EACN,KAAK,EAKN;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,GAAG,CAElC,4DAA4D,EAAE;YAC/D,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,cAAc,EAAE;gBACzC,aAAa,EAAE,MAAM;aACtB;SACF,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YACxB,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnE,OAAO,UAAU,EAAE,GAAG,IAAI,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,CAAC,KAAK,CACV,mEAAmE,KAAK,EAAE,EAC1E,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAChC,CAAC;IACJ,CAAC;IACD,OAAO;AACT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/site-builder-tool/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,2BAA2B;AAC3B,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,oBAAoB,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/site-builder-tool/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,2BAA2B;AAC3B,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpAuthenticationStrategy } from '../auth/index.js';
|
|
2
|
+
import { WixMcpServer } from '../wix-mcp-server.js';
|
|
3
|
+
export declare function addCreateSiteWidgetTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy): void;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/site-builder-tool/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAc,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAUpD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,yBAAyB,QAiJxC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createHttpClient } from '@wix/http-client';
|
|
3
|
+
import { getWidgetHtml } from '../widget-manifest.js';
|
|
4
|
+
const httpClient = createHttpClient();
|
|
5
|
+
const CREATE_SITE_WIDGET_URI = 'ui://widget/wix-site-builder.html';
|
|
6
|
+
const WIDGET_NAME = 'WixSiteBuilder';
|
|
7
|
+
export function addCreateSiteWidgetTool(server, authStrategy) {
|
|
8
|
+
const { getAccountAuthHeaders } = authStrategy;
|
|
9
|
+
const toolMeta = (widgetPayload) => {
|
|
10
|
+
return {
|
|
11
|
+
'openai/toolInvocation/invoking': 'Creating your website...',
|
|
12
|
+
'openai/toolInvocation/invoked': 'Website creation in progress...',
|
|
13
|
+
'openai/outputTemplate': CREATE_SITE_WIDGET_URI,
|
|
14
|
+
'openai/widgetAccessible': true,
|
|
15
|
+
'openai/resultCanProduceWidget': true,
|
|
16
|
+
'openai/widgetCSP': {
|
|
17
|
+
connect_domains: [
|
|
18
|
+
'https://*.wix.com',
|
|
19
|
+
'https://*.wixsite.com',
|
|
20
|
+
'https://static.parastorage.com',
|
|
21
|
+
'https://cdn.openai.com'
|
|
22
|
+
],
|
|
23
|
+
resource_domains: [
|
|
24
|
+
'https://*.wix.com',
|
|
25
|
+
'https://*.wixsite.com',
|
|
26
|
+
'https://static.parastorage.com',
|
|
27
|
+
'https://cdn.openai.com'
|
|
28
|
+
],
|
|
29
|
+
frame_domains: ['https://*.wix.com', 'https://*.wixsite.com'],
|
|
30
|
+
redirect_domains: ['https://*.wix.com', 'https://*.wixsite.com']
|
|
31
|
+
},
|
|
32
|
+
'openai/widgetDomain': 'wix',
|
|
33
|
+
'openai/widgetDescription': "Displays a live progress showing your website being built, including site generation status and a link to the editor. When it's ready, it will show a live preview of the website.",
|
|
34
|
+
...(widgetPayload ? { widgetPayload } : {})
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
// Add site builder widget resource
|
|
38
|
+
server.registerResource(`${WIDGET_NAME}_RESOURCE`, CREATE_SITE_WIDGET_URI, {}, async (uri) => {
|
|
39
|
+
return {
|
|
40
|
+
contents: [
|
|
41
|
+
{
|
|
42
|
+
uri: uri.href,
|
|
43
|
+
_meta: toolMeta(),
|
|
44
|
+
mimeType: 'text/html+skybridge',
|
|
45
|
+
text: getWidgetHtml({ widgetId: 'buildWixSite' })
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
// Add site builder tool that communicates with the widget
|
|
51
|
+
server.registerTool(WIDGET_NAME, {
|
|
52
|
+
title: 'Wix Site Builder',
|
|
53
|
+
description: `A tool that builds a site using Wix. Use this ONLY when the user explicitly asks to build/create/generate a site/website/application. The widget resource is available at ${CREATE_SITE_WIDGET_URI}`,
|
|
54
|
+
inputSchema: {
|
|
55
|
+
jobId: z
|
|
56
|
+
.string()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('The job ID of the site build. If not provided, a new job will be created.'),
|
|
59
|
+
sitePrompt: z
|
|
60
|
+
.string()
|
|
61
|
+
.describe('The prompt to build the site. If not provided, the user will be asked to provide a prompt.')
|
|
62
|
+
},
|
|
63
|
+
_meta: toolMeta(),
|
|
64
|
+
annotations: {
|
|
65
|
+
readOnlyHint: true,
|
|
66
|
+
destructiveHint: false,
|
|
67
|
+
openWorldHint: false
|
|
68
|
+
}
|
|
69
|
+
}, async (args, { setToolBiParams }) => {
|
|
70
|
+
console.log(`[${WIDGET_NAME}] 🚀 Start Building Your Site tool invoked!`);
|
|
71
|
+
console.log(`[${WIDGET_NAME}] Site prompt:`, args.sitePrompt);
|
|
72
|
+
console.log(`[${WIDGET_NAME}] JobId (if provided):`, args.jobId);
|
|
73
|
+
const accountHeaders = await getAccountAuthHeaders();
|
|
74
|
+
let jobId;
|
|
75
|
+
// Priority: 1. Explicit jobId from args, 2. Last saved jobId, 3. Create new job
|
|
76
|
+
if (args.jobId) {
|
|
77
|
+
console.log(`[${WIDGET_NAME}] Using provided jobId:`, args.jobId);
|
|
78
|
+
jobId = args.jobId;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Create new job
|
|
82
|
+
const { success, jobId: newJobId, message } = await buildHarmonySite({
|
|
83
|
+
userPrompt: args.sitePrompt,
|
|
84
|
+
accountHeaders
|
|
85
|
+
});
|
|
86
|
+
setToolBiParams({ jobId: newJobId });
|
|
87
|
+
if (!success || !newJobId) {
|
|
88
|
+
return {
|
|
89
|
+
isError: true,
|
|
90
|
+
content: [
|
|
91
|
+
{
|
|
92
|
+
type: 'text',
|
|
93
|
+
text: message
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
structuredContent: {
|
|
97
|
+
success: false,
|
|
98
|
+
status: message,
|
|
99
|
+
jobId: null
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
jobId = newJobId;
|
|
104
|
+
console.log(`[${WIDGET_NAME}] Created new job:`, jobId);
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
content: [
|
|
108
|
+
{
|
|
109
|
+
type: 'text',
|
|
110
|
+
text: 'Respond only with a confirmation that the website build has started and that progress is available in the widget. No other content is allowed. DO NOT mention jobId.'
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
structuredContent: {
|
|
114
|
+
success: true,
|
|
115
|
+
status: 'Respond only with a confirmation that the website build has started and that progress is available in the widget. No other content is allowed. DO NOT mention jobId.',
|
|
116
|
+
jobId // Return jobId so model can use it in future calls
|
|
117
|
+
},
|
|
118
|
+
_meta: toolMeta({ jobId })
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async function buildHarmonySite({ userPrompt, accountHeaders }) {
|
|
123
|
+
const buildSiteRequest = {
|
|
124
|
+
userPrompt,
|
|
125
|
+
flow: 'main-flow',
|
|
126
|
+
withBrowserOptimization: false,
|
|
127
|
+
withScreenshots: true
|
|
128
|
+
};
|
|
129
|
+
console.log('[buildHarmonySite] request', {
|
|
130
|
+
buildSiteRequest
|
|
131
|
+
});
|
|
132
|
+
try {
|
|
133
|
+
const response = await httpClient.post('https://manage.wix.com/_api/harmony-site-builder/generate-harmony-site', buildSiteRequest, { headers: accountHeaders });
|
|
134
|
+
console.log('[buildHarmonySite]: response:', response);
|
|
135
|
+
if (response.data.success) {
|
|
136
|
+
return {
|
|
137
|
+
success: true,
|
|
138
|
+
message: 'Successfully started building your website',
|
|
139
|
+
jobId: response.data.jobId
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return {
|
|
144
|
+
success: false,
|
|
145
|
+
message: response.data.message ||
|
|
146
|
+
'Failed to start building your website using Harmony',
|
|
147
|
+
jobId: ''
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
console.error('[buildHarmonySite]: error:', error);
|
|
153
|
+
return {
|
|
154
|
+
success: false,
|
|
155
|
+
message: `Failed to start building your website using Harmony: ${error}`,
|
|
156
|
+
jobId: ''
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/site-builder-tool/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AAEtC,MAAM,sBAAsB,GAAG,mCAAmC,CAAC;AACnE,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC,MAAM,UAAU,uBAAuB,CACrC,MAAoB,EACpB,YAAuC;IAEvC,MAAM,EAAE,qBAAqB,EAAE,GAAG,YAAY,CAAC;IAE/C,MAAM,QAAQ,GAAG,CAAC,aAAiC,EAAE,EAAE;QACrD,OAAO;YACL,gCAAgC,EAAE,0BAA0B;YAC5D,+BAA+B,EAAE,iCAAiC;YAClE,uBAAuB,EAAE,sBAAsB;YAC/C,yBAAyB,EAAE,IAAI;YAC/B,+BAA+B,EAAE,IAAI;YACrC,kBAAkB,EAAE;gBAClB,eAAe,EAAE;oBACf,mBAAmB;oBACnB,uBAAuB;oBACvB,gCAAgC;oBAChC,wBAAwB;iBACzB;gBACD,gBAAgB,EAAE;oBAChB,mBAAmB;oBACnB,uBAAuB;oBACvB,gCAAgC;oBAChC,wBAAwB;iBACzB;gBACD,aAAa,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;gBAC7D,gBAAgB,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;aACjE;YACD,qBAAqB,EAAE,KAAK;YAC5B,0BAA0B,EACxB,oLAAoL;YACtL,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa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AC9B,UAAU,EACV,cAAc,EAIf;IAKC,MAAM,gBAAgB,GAAG;QACvB,UAAU;QACV,IAAI,EAAE,WAAW;QACjB,uBAAuB,EAAE,KAAK;QAC9B,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE;QACxC,gBAAgB;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,IAAI,CAKpC,wEAAwE,EACxE,gBAAgB,EAChB,EAAE,OAAO,EAAE,cAAc,EAAE,CAC5B,CAAC;QAEF,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,QAAQ,CAAC,CAAC;QACvD,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,4CAA4C;gBACrD,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK;aAC3B,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EACL,QAAQ,CAAC,IAAI,CAAC,OAAO;oBACrB,qDAAqD;gBACvD,KAAK,EAAE,EAAE;aACV,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,wDAAwD,KAAK,EAAE;YACxE,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { WixMcpServer } from '../wix-mcp-server.js';
|
|
2
|
-
export declare function addSupportTool(server: WixMcpServer): void;
|
|
2
|
+
export declare function addSupportTool(server: WixMcpServer, disableTools?: string[], toolDescriptions?: Record<string, string>): void;
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/support/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/support/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,YAAY,GAAE,MAAM,EAAO,EAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QA4C1C"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export function addSupportTool(server) {
|
|
3
|
-
|
|
2
|
+
export function addSupportTool(server, disableTools = [], toolDescriptions) {
|
|
3
|
+
if (disableTools.includes('SupportAndFeedback')) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const defaultSupportDesc = [
|
|
4
7
|
'If the user would like to provide Wix with some feedback (good or bad), about the tools in Wix MCP,',
|
|
5
8
|
'for example they used the tools provided, and they reflected satisfaction or dissatisfaction with the tools.',
|
|
6
9
|
'Also, if you encounter too many errors tyring to call the Wix API, you can also suggest the user to provide feedback to Wix using this tool.',
|
|
7
10
|
'**IMPORTANT NOTE**',
|
|
8
11
|
'This tool is not sending the message, but formats it in order to another tool to actually send it'
|
|
9
|
-
].join('\n')
|
|
12
|
+
].join('\n');
|
|
13
|
+
server.tool('SupportAndFeedback', toolDescriptions?.['SupportAndFeedback'] ?? defaultSupportDesc, {
|
|
10
14
|
requestId: z
|
|
11
15
|
.string()
|
|
12
16
|
.optional()
|
|
13
17
|
.describe('request id if returned from the server in a failed API call to Wix'),
|
|
14
18
|
message: z.string().describe('The message to send to Wix')
|
|
15
|
-
}, async ({ requestId, message }) => {
|
|
19
|
+
}, { readOnlyHint: true, destructiveHint: false, openWorldHint: false }, async ({ requestId, message }) => {
|
|
16
20
|
return {
|
|
17
21
|
content: [
|
|
18
22
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/support/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/support/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,cAAc,CAC5B,MAAoB,EACpB,eAAyB,EAAE,EAC3B,gBAAyC;IAEzC,IAAI,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IACD,MAAM,kBAAkB,GAAG;QACzB,qGAAqG;QACrG,8GAA8G;QAC9G,8IAA8I;QAC9I,oBAAoB;QACpB,mGAAmG;KACpG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,gBAAgB,EAAE,CAAC,oBAAoB,CAAC,IAAI,kBAAkB,EAC9D;QACE,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,oEAAoE,CACrE;QACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;KAC3D,EACD,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,EACpE,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;QAC/B,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,GAAG,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;iBAClE;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EACF,4GAA4G;wBAC5G,4LAA4L;wBAC5L,yGAAyG;wBACzG,6LAA6L;iBAChM;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-manifest.d.ts","sourceRoot":"","sources":["../../src/widget-manifest.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAW7D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// For Cloudflare Workers, import HTML as text module
|
|
2
|
+
// Wrangler supports importing text files directly
|
|
3
|
+
import widgetHtmlContent from '../dist/widgets/index.html';
|
|
4
|
+
function ensureCachedHtml() {
|
|
5
|
+
if (!widgetHtmlContent) {
|
|
6
|
+
throw new Error('Widget HTML not found. Please build the widgets first with: yarn build:widgets');
|
|
7
|
+
}
|
|
8
|
+
return widgetHtmlContent;
|
|
9
|
+
}
|
|
10
|
+
export function getWidgetHtml(options) {
|
|
11
|
+
const baseHtml = ensureCachedHtml();
|
|
12
|
+
if (!options) {
|
|
13
|
+
return baseHtml;
|
|
14
|
+
}
|
|
15
|
+
const serialized = JSON.stringify(options);
|
|
16
|
+
const configScript = `<script>window.__WIX_WIDGET_CONFIG__ = ${serialized};</script>`;
|
|
17
|
+
return baseHtml.replace('</body>', `${configScript}</body>`);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=widget-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-manifest.js","sourceRoot":"","sources":["../../src/widget-manifest.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,kDAAkD;AAClD,OAAO,iBAAiB,MAAM,4BAA4B,CAAC;AAE3D,SAAS,gBAAgB;IACvB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;IACJ,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAOD,MAAM,UAAU,aAAa,CAAC,OAAuB;IACnD,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IAEpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,YAAY,GAAG,0CAA0C,UAAU,YAAY,CAAC;IAEtF,OAAO,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,YAAY,SAAS,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { z, ZodRawShape, ZodTypeAny } from 'zod';
|
|
1
|
+
import type { z, ZodRawShape, ZodType, ZodTypeAny } from 'zod';
|
|
2
2
|
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
3
|
-
import type { CallToolResult, Implementation } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import type { CallToolResult, Implementation, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
import type { BiLogger } from '@wix/wix-bi-logger-client';
|
|
5
5
|
import type { PanoramaClientForComponent } from '@wix/panorama-client-node';
|
|
6
6
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
@@ -11,6 +11,7 @@ interface ToolBiParams {
|
|
|
11
11
|
visitorId?: string;
|
|
12
12
|
siteId?: string;
|
|
13
13
|
requestId?: string;
|
|
14
|
+
jobId?: string;
|
|
14
15
|
}
|
|
15
16
|
type WixRequestHandlerExtra = RequestHandlerExtra<any, any> & {
|
|
16
17
|
logger: Logger;
|
|
@@ -19,7 +20,7 @@ type WixRequestHandlerExtra = RequestHandlerExtra<any, any> & {
|
|
|
19
20
|
httpClient: HttpClient;
|
|
20
21
|
setToolBiParams: (params: ToolBiParams) => void;
|
|
21
22
|
};
|
|
22
|
-
type WixToolCallback<Args extends undefined | ZodRawShape = undefined> = Args extends ZodRawShape ? (args: z.objectOutputType<Args, ZodTypeAny>, extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult> : (extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult>;
|
|
23
|
+
type WixToolCallback<Args extends undefined | ZodRawShape | ZodType<object> = undefined> = Args extends ZodRawShape ? (args: z.objectOutputType<Args, ZodTypeAny>, extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult> : Args extends ZodType<infer T> ? (args: T, extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult> : (extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult>;
|
|
23
24
|
export interface WixMcpServerContext {
|
|
24
25
|
siteId?: string;
|
|
25
26
|
sessionId?: string;
|
|
@@ -40,6 +41,18 @@ export declare class WixMcpServer extends McpServer {
|
|
|
40
41
|
tool(name: string, description: string, cb: WixToolCallback): RegisteredTool;
|
|
41
42
|
tool<Args extends ZodRawShape>(name: string, paramsSchema: Args, cb: WixToolCallback<Args>): void;
|
|
42
43
|
tool<Args extends ZodRawShape>(name: string, description: string, paramsSchema: Args, cb: WixToolCallback<Args>): void;
|
|
44
|
+
tool(name: string, description: string, annotations: ToolAnnotations, cb: WixToolCallback): RegisteredTool;
|
|
45
|
+
tool<Args extends ZodRawShape>(name: string, paramsSchema: Args, annotations: ToolAnnotations, cb: WixToolCallback<Args>): void;
|
|
46
|
+
tool<Args extends ZodRawShape>(name: string, description: string, paramsSchema: Args, annotations: ToolAnnotations, cb: WixToolCallback<Args>): void;
|
|
47
|
+
registerTool<InputArgs extends ZodRawShape | z.ZodType<object>, OutputArgs extends ZodRawShape | z.ZodType<object>>(name: string, config: {
|
|
48
|
+
title?: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
inputSchema?: InputArgs;
|
|
51
|
+
outputSchema?: OutputArgs;
|
|
52
|
+
annotations?: ToolAnnotations;
|
|
53
|
+
_meta?: Record<string, unknown>;
|
|
54
|
+
}, cb: WixToolCallback<InputArgs>): RegisteredTool;
|
|
55
|
+
private wrapToolCallback;
|
|
43
56
|
}
|
|
44
57
|
export {};
|
|
45
58
|
//# sourceMappingURL=wix-mcp-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wix-mcp-server.d.ts","sourceRoot":"","sources":["../../src/wix-mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"wix-mcp-server.d.ts","sourceRoot":"","sources":["../../src/wix-mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EACL,SAAS,EACT,cAAc,EAEf,MAAM,yCAAyC,CAAC;AAKjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,KAAK,MAAM,EA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