@wix/mcp 1.0.93 → 1.0.95
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/README.md +2 -2
- package/build/bin-standalone.js +1200 -455
- package/build/cjs/index.cjs +3237 -1264
- package/build/cjs/toolkit.cjs +2177 -469
- package/build/dts/api-call/headless-release.d.ts +56 -0
- package/build/dts/api-call/headless-release.js +135 -0
- package/build/dts/api-call/index.d.ts +9 -1
- package/build/dts/api-call/index.js +19 -10
- package/build/dts/api-call/site-files.d.ts +42 -0
- package/build/dts/api-call/site-files.js +290 -0
- package/build/dts/api-call/upload-headless-website-files.d.ts +118 -0
- package/build/dts/api-call/upload-headless-website-files.js +624 -0
- package/build/dts/api-call/upload-image-tool.d.ts +2 -0
- package/build/dts/api-call/upload-image-tool.js +8 -4
- package/build/dts/bin.d.ts +1 -1
- package/build/dts/bin.js +4 -5
- package/build/dts/code-mode/attachments.js +1 -1
- package/build/dts/code-mode/index.d.ts +6 -1
- package/build/dts/code-mode/index.js +47 -13
- package/build/dts/code-mode/truncate-response.js +5 -1
- package/build/dts/config/default-config.d.ts +35 -9
- package/build/dts/config/default-config.js +348 -207
- package/build/dts/config/file-params.d.ts +22 -0
- package/build/dts/config/file-params.js +24 -0
- package/build/dts/config/param-descriptions.d.ts +14 -2
- package/build/dts/config/param-descriptions.js +34 -15
- package/build/dts/constants.d.ts +1 -0
- package/build/dts/constants.js +1 -0
- package/build/dts/docs/docs.d.ts +16 -3
- package/build/dts/docs/docs.js +211 -39
- package/build/dts/docs/fetch-article.d.ts +21 -0
- package/build/dts/docs/fetch-article.js +70 -5
- package/build/dts/docs/get-to-know.d.ts +7 -2
- package/build/dts/docs/get-to-know.js +37 -15
- package/build/dts/docs/mintlify-docs.d.ts +121 -0
- package/build/dts/docs/mintlify-docs.js +391 -0
- package/build/dts/docs/semanticSearch.d.ts +2 -1
- package/build/dts/docs/semanticSearch.js +14 -7
- package/build/dts/docs/start-deploy-website.d.ts +7 -6
- package/build/dts/docs/start-deploy-website.js +13 -8
- package/build/dts/docs/start-headless-build.d.ts +17 -0
- package/build/dts/docs/start-headless-build.js +60 -0
- package/build/dts/graphql/index.js +3 -1
- package/build/dts/import-claude-design-tool/index.js +2 -2
- package/build/dts/index.d.ts +3 -2
- package/build/dts/index.js +3 -2
- package/build/dts/infra/redact-personal-data.d.ts +4 -0
- package/build/dts/infra/redact-personal-data.js +79 -0
- package/build/dts/site-widget-tools/constants.d.ts +49 -1
- package/build/dts/site-widget-tools/constants.js +64 -7
- package/build/dts/site-widget-tools/index.d.ts +1 -0
- package/build/dts/site-widget-tools/index.js +1 -0
- package/build/dts/site-widget-tools/pick-images-tool/index.d.ts +14 -0
- package/build/dts/site-widget-tools/pick-images-tool/index.js +138 -0
- package/build/dts/site-widget-tools/search-site-templates-tool/index.js +33 -9
- package/build/dts/site-widget-tools/site-builder-tool/index.js +22 -2
- package/build/dts/site-widget-tools/site-creation-tool/index.d.ts +7 -1
- package/build/dts/site-widget-tools/site-creation-tool/index.js +22 -51
- package/build/dts/site-widget-tools/suggested-domain-tool/index.js +6 -3
- package/build/dts/support/index.d.ts +4 -0
- package/build/dts/support/index.js +13 -7
- package/build/dts/toolkit-entry.d.cts +19 -12
- package/build/dts/toolkit-entry.d.ts +19 -12
- package/build/dts/toolkit.d.ts +2 -2
- package/build/dts/toolkit.js +23 -7
- package/build/dts/wix-mcp-server.d.ts +11 -0
- package/build/dts/wix-mcp-server.js +28 -6
- package/build/dts/wixel/constants.d.ts +8 -1
- package/build/dts/wixel/constants.js +8 -1
- package/build/dts/wixel/index.d.ts +1 -1
- package/build/dts/wixel/index.js +2 -2
- package/build/dts/wixel/wixel-a2a-client.d.ts +83 -0
- package/build/dts/wixel/wixel-a2a-client.js +166 -0
- package/build/dts/wixel/wixel-bi.d.ts +2 -1
- package/build/dts/wixel/wixel-bi.js +2 -1
- package/build/dts/wixel/{external-agent-api.d.ts → wixel-session-entries.d.ts} +11 -33
- package/build/dts/wixel/{external-agent-api.js → wixel-session-entries.js} +33 -54
- package/build/dts/wixel/wixel-session-tools.d.ts +21 -26
- package/build/dts/wixel/wixel-session-tools.js +494 -599
- package/build/esm/index.js +3335 -1376
- package/build/esm/toolkit.js +2273 -565
- package/package.json +4 -4
- package/build/dts/docs/create-site-guide.d.ts +0 -3
- package/build/dts/docs/create-site-guide.js +0 -109
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { createHttpClient } from '@wix/http-client';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// conversation through the genie chat service directly.
|
|
2
|
+
import { WIXEL_AGENT_SESSIONS_API_BASE_URL } from './constants.js';
|
|
3
|
+
// Reads of the Wixel agent's internal sessions API (wixel-agent-service):
|
|
4
|
+
// the durable entries log of a session and the sessions listing. A2A tasks
|
|
5
|
+
// report a turn's state and reply, but a parked ask_user question — the
|
|
6
|
+
// structured outline / style / choice payload the widgets render — lives only
|
|
7
|
+
// in the entries log. The session id comes from a task's metadata.
|
|
9
8
|
const CONDUCTOR_OVERRIDE_HEADERS = {
|
|
10
9
|
Cookie: 'petri_ovr=specs.wixel-slides.enableInWixel#true|specs.wixel-assistant.sidePanelEnabled#true|creditTransactionsPremiumIntegration#A'
|
|
11
10
|
};
|
|
12
|
-
function httpClientFor({ authHeaders, apiBaseURL =
|
|
11
|
+
function httpClientFor({ authHeaders, apiBaseURL = WIXEL_AGENT_SESSIONS_API_BASE_URL, conductorOverride }) {
|
|
13
12
|
return createHttpClient({
|
|
14
13
|
headers: {
|
|
15
14
|
...authHeaders,
|
|
@@ -18,31 +17,8 @@ function httpClientFor({ authHeaders, apiBaseURL = WIXEL_AGENT_EXTERNAL_API_BASE
|
|
|
18
17
|
baseURL: apiBaseURL
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const { data } = await httpClient.request(startSession({
|
|
24
|
-
sessionId,
|
|
25
|
-
metaSiteId,
|
|
26
|
-
callerName,
|
|
27
|
-
externalId,
|
|
28
|
-
workspace,
|
|
29
|
-
callbackUrl,
|
|
30
|
-
callbackToken
|
|
31
|
-
}));
|
|
32
|
-
return data;
|
|
33
|
-
}
|
|
34
|
-
export async function sendWixelSessionMessage({ handle, metaSiteId, text, transactionId, ...base }) {
|
|
35
|
-
const httpClient = httpClientFor(base);
|
|
36
|
-
const { data } = await httpClient.request(sendMessage({ handle, metaSiteId, text, transactionId }));
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
export async function listWixelSessionEvents({ handle, metaSiteId, since, historyMode, ...base }) {
|
|
40
|
-
const httpClient = httpClientFor(base);
|
|
41
|
-
const { data } = await httpClient.request(listEvents({ handle, metaSiteId, since, historyMode }));
|
|
42
|
-
return data;
|
|
43
|
-
}
|
|
44
|
-
// DEBUG: internal wixel-agent sessions API — exposes the full durable session
|
|
45
|
-
// entries (incl. parked ask_user questions the external inbox hides).
|
|
20
|
+
// The full durable session entries, including parked ask_user questions,
|
|
21
|
+
// which an A2A task does not carry.
|
|
46
22
|
export async function getWixelSessionEntries({ sessionId, ...base }) {
|
|
47
23
|
const httpClient = httpClientFor(base);
|
|
48
24
|
const { data } = await httpClient.get(`/_api/wixel-agent-server/sessions/${sessionId}/messages`);
|
|
@@ -50,16 +26,15 @@ export async function getWixelSessionEntries({ sessionId, ...base }) {
|
|
|
50
26
|
}
|
|
51
27
|
// The sessions listing is scoped to the authenticated caller, so membership
|
|
52
28
|
// in it is the ownership check for the internal per-session reads below —
|
|
53
|
-
// a
|
|
54
|
-
//
|
|
55
|
-
// handle === sessionId today; if they ever diverge this fails closed.
|
|
29
|
+
// a session id that isn't the caller's own session resolves to nothing
|
|
30
|
+
// instead of another tenant's data.
|
|
56
31
|
async function isSessionVisibleToCaller(sessionId, base) {
|
|
57
32
|
const httpClient = httpClientFor(base);
|
|
58
33
|
const { data } = await httpClient.get(`/_api/wixel-agent-server/sessions`);
|
|
59
34
|
return !!data?.sessions?.some((entry) => entry.id === sessionId);
|
|
60
35
|
}
|
|
61
|
-
// The wixel-agent session is bound to the Wixel project it works in;
|
|
62
|
-
//
|
|
36
|
+
// The wixel-agent session is bound to the Wixel project it works in; an A2A
|
|
37
|
+
// task doesn't expose it, but the sessions listing does.
|
|
63
38
|
export async function getWixelSessionProjectId({ sessionId, ...base }) {
|
|
64
39
|
const httpClient = httpClientFor(base);
|
|
65
40
|
const { data } = await httpClient.get(`/_api/wixel-agent-server/sessions`);
|
|
@@ -69,9 +44,9 @@ export async function getWixelSessionProjectId({ sessionId, ...base }) {
|
|
|
69
44
|
/**
|
|
70
45
|
* Classify the session's current state from the durable entries log with a
|
|
71
46
|
* single read: parked on an ask_user question, actively generating, or idle.
|
|
72
|
-
*
|
|
73
|
-
* running) or to turn to the user (parked question) —
|
|
74
|
-
* cannot distinguish the two.
|
|
47
|
+
* A task still WORKING uses this to tell callers whether to keep waiting
|
|
48
|
+
* (turn running) or to turn to the user (parked question) — the task state
|
|
49
|
+
* alone cannot distinguish the two.
|
|
75
50
|
*/
|
|
76
51
|
export async function getWixelSessionActivity({ sessionId, ...base }) {
|
|
77
52
|
if (!(await isSessionVisibleToCaller(sessionId, base))) {
|
|
@@ -128,8 +103,7 @@ export async function getWixelSessionActivity({ sessionId, ...base }) {
|
|
|
128
103
|
// The generation job's terminal result carries "conversationEnded": true —
|
|
129
104
|
// the deliverable was produced and the Wixel flow is complete. Any question
|
|
130
105
|
// still attached to that turn (e.g. the courtesy "pick a new style?") must
|
|
131
|
-
// not resurface as pending until the user speaks again.
|
|
132
|
-
// marker only exists on inbox events, not in the entries log.)
|
|
106
|
+
// not resurface as pending until the user speaks again.
|
|
133
107
|
function flowEndedSinceLastUserMessage(messages) {
|
|
134
108
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
135
109
|
const message = messages[i];
|
|
@@ -148,11 +122,11 @@ function flowEndedSinceLastUserMessage(messages) {
|
|
|
148
122
|
}
|
|
149
123
|
return false;
|
|
150
124
|
}
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
export async function getWixelPendingQuestion({ sessionId, requireParked = false, ...base }) {
|
|
125
|
+
// On API sessions ask_user is intercepted (client-facing tools are disabled)
|
|
126
|
+
// and the agent falls back to plain text — but the structured question is
|
|
127
|
+
// still durably persisted as a functionCall entry. Extract the most recent one
|
|
128
|
+
// so MCP clients can render it as a widget.
|
|
129
|
+
export async function getWixelPendingQuestion({ sessionId, requireParked = false, turnId, ...base }) {
|
|
156
130
|
if (!(await isSessionVisibleToCaller(sessionId, base)))
|
|
157
131
|
return null;
|
|
158
132
|
const data = (await getWixelSessionEntries({
|
|
@@ -162,14 +136,17 @@ export async function getWixelPendingQuestion({ sessionId, requireParked = false
|
|
|
162
136
|
const messages = data?.messages ?? [];
|
|
163
137
|
if (flowEndedSinceLastUserMessage(messages))
|
|
164
138
|
return null;
|
|
139
|
+
const ownTurn = turnId && messages.some((message) => message.turnId === turnId)
|
|
140
|
+
? turnId
|
|
141
|
+
: null;
|
|
165
142
|
// Two states carry a question worth surfacing:
|
|
166
143
|
// - Parked: ask_user is the newest entry — the policy hasn't answered it and
|
|
167
|
-
// the turn is suspended waiting for the user (
|
|
168
|
-
// requireParked accepts only this state;
|
|
169
|
-
// question answered elsewhere (e.g. the Wixel UI) isn't resurfaced
|
|
170
|
-
// the turn keeps generating.
|
|
144
|
+
// the turn is suspended waiting for the user (its task stays WORKING).
|
|
145
|
+
// requireParked accepts only this state; polls of a running task use it
|
|
146
|
+
// so a question answered elsewhere (e.g. the Wixel UI) isn't resurfaced
|
|
147
|
+
// while the turn keeps generating.
|
|
171
148
|
// - Fallback: the policy auto-responded to ask_user and the agent re-asked
|
|
172
|
-
// in plain text (the reply
|
|
149
|
+
// in plain text (the task's reply). The structured payload is still the
|
|
173
150
|
// better rendering, so the reply path returns it — until the user's own
|
|
174
151
|
// text answer supersedes it.
|
|
175
152
|
let sawNewerEntry = false;
|
|
@@ -190,6 +167,8 @@ export async function getWixelPendingQuestion({ sessionId, requireParked = false
|
|
|
190
167
|
[]);
|
|
191
168
|
if (!questions.length)
|
|
192
169
|
continue;
|
|
170
|
+
if (ownTurn && message.turnId !== ownTurn)
|
|
171
|
+
return null;
|
|
193
172
|
return {
|
|
194
173
|
toolCallId: call.id,
|
|
195
174
|
turnId: message.turnId,
|
|
@@ -203,4 +182,4 @@ export async function getWixelPendingQuestion({ sessionId, requireParked = false
|
|
|
203
182
|
}
|
|
204
183
|
return null;
|
|
205
184
|
}
|
|
206
|
-
//# sourceMappingURL=
|
|
185
|
+
//# sourceMappingURL=wixel-session-entries.js.map
|
|
@@ -31,43 +31,38 @@ export type WixelDeck = {
|
|
|
31
31
|
pageUrls: string[];
|
|
32
32
|
};
|
|
33
33
|
export declare function collectDecks(projectAssets: WixelAssetEntity[], deckIds: Set<string>): Map<string, WixelDeck>;
|
|
34
|
-
export declare function extractAssetIds(text: string): string[];
|
|
35
34
|
/**
|
|
36
|
-
* Live result cards, per Wixel
|
|
37
|
-
* for (and when), the asset ids / media URLs those cards display, and
|
|
38
|
-
* last
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* the
|
|
42
|
-
*
|
|
35
|
+
* Live result cards, per Wixel conversation (contextId): the tasks a card was
|
|
36
|
+
* rendered for (and when), the asset ids / media URLs those cards display, and
|
|
37
|
+
* the last task send_wixel_message returned in the conversation — the card's
|
|
38
|
+
* own answers go through that tool too, so it is the task the card follows.
|
|
39
|
+
* The model does not reliably obey "do not poll" once a live card is up, so
|
|
40
|
+
* the tools enforce it: get_wixel_task refuses while a card follows the
|
|
41
|
+
* conversation's latest task, get_wixel_asset_result refuses to render the
|
|
42
|
+
* same result a second time, and get_wixel_pending_question stays quiet for a
|
|
43
|
+
* question the card already shows.
|
|
43
44
|
*
|
|
44
|
-
* One registry per server instance
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* don't apply until the next send.
|
|
45
|
+
* One registry per server instance, so MCP sessions never see each other's
|
|
46
|
+
* records. In-memory: a Durable Object wake-up starts empty, and the
|
|
47
|
+
* intercepts simply don't apply until the next send.
|
|
48
48
|
*/
|
|
49
49
|
type LiveCardRecord = {
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
50
|
+
/** Task id → when its live card was rendered. */
|
|
51
|
+
tasks: Map<string, number>;
|
|
52
|
+
/** Tasks whose card reached done/failed — the agent may poll again. */
|
|
53
|
+
finishedTasks: Set<string>;
|
|
54
54
|
shownAssets: Set<string>;
|
|
55
|
-
|
|
55
|
+
lastSentTask: string | null;
|
|
56
56
|
};
|
|
57
57
|
export type LiveCardRegistry = ReturnType<typeof createLiveCardRegistry>;
|
|
58
58
|
export declare function createLiveCardRegistry(): {
|
|
59
|
-
get: (
|
|
60
|
-
|
|
61
|
-
isActive: (
|
|
62
|
-
authHeaders: Record<string, string>;
|
|
63
|
-
conductorOverride?: string;
|
|
64
|
-
metaSiteId: string;
|
|
65
|
-
}) => Promise<boolean>;
|
|
59
|
+
get: (contextId: string) => LiveCardRecord | undefined;
|
|
60
|
+
forContext: (contextId: string) => LiveCardRecord;
|
|
61
|
+
isActive: (contextId: string, isTerminal: (taskId: string) => Promise<boolean>) => Promise<boolean>;
|
|
66
62
|
};
|
|
67
63
|
export declare function addGetWixelPendingQuestionTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
|
|
68
|
-
export declare function addStartWixelSessionTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
|
|
69
64
|
export declare function addSendWixelMessageTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
|
|
70
|
-
export declare function
|
|
65
|
+
export declare function addGetWixelTaskTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
|
|
71
66
|
export declare function addGetWixelStylePresetsTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
|
|
72
67
|
export type WixelTurnStatus = 'generating' | 'question' | 'done' | 'failed';
|
|
73
68
|
export declare function addGetWixelTurnResultTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: WixelSessionToolOptions): void;
|