@enhance-eng/enhance 0.1.168 → 0.1.171
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/dist/{cli-output-identity.lib-DMHqCPUz.mjs → cli-output-identity.lib-BsDqFLVA.mjs} +2402 -1840
- package/dist/main.mjs +718 -446
- package/dist/{mcp-invocation.adapter-YFCrLzlc.mjs → mcp-invocation.adapter-DGgt79VT.mjs} +53 -33
- package/dist/mcp-main.mjs +7 -7
- package/dist/{mcp-server.adapter-CUuoL6AI.mjs → mcp-server.adapter-CbObvH7Y.mjs} +110 -38
- package/dist/mcp.mjs +2 -2
- package/dist/remote-mcp-main.mjs +38 -16
- package/dist/{zod-messages.lib-T23QiUQO.mjs → zod-messages.lib-B8yowT7b.mjs} +3701 -3192
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
3
|
-
import { T as createAuthUseCase, c as createOauthLoopbackAdapter, f as createCapabilityInvocationAdapter, n as createMutationKeyAdapter, r as createHttpRemoteAdapter, u as withCapabilityNames, y as boundedResultPage } from "./zod-messages.lib-
|
|
4
|
-
import { a as mcpDispatchedResultSchema, c as
|
|
2
|
+
import { $ as canvasWriteReceiptSchema, $n as listCommentsOutputSchema, B as canvasPrototypeOutputSchema, Bt as encodeCanvasExchangeToken, F as canvasCapturePageInputSchema, Gn as commentCanvasContextSchema, H as operationStatusImageSchema, I as canvasCapturePageOutputSchema, It as parseCanvasReference, Jn as commentThreadSchema, K as canvasCaptureInputSchema, Kn as commentMessageSchema, Kt as canvasUpdateHtmlInputSchema, Lt as canvasExchangeDigest, Q as canvasPreparationOutputSchema, Qn as listCommentsInputSchema, R as canvasPrototypeInputSchema, St as canvasMakeEditableInputSchema, U as operationStatusInputSchema, Ut as canvasReadInputSchema, V as canvasConversionStatusSchema, W as operationStatusOutputSchema, Wn as commentAuthorSchema, Wt as canvasReadOutputSchema, Xn as elementAnchorSchema, Y as canvasArrangeInputSchema, Yn as domLocatorSchema, Z as canvasDuplicateInputSchema, Zn as getCommentOutputSchema, _n as CliError, _t as createdCanvasAnswerSchema, ar as screenTextCommentTargetSchema, bt as canvasInsertHtmlInputSchema, dn as pointOfUseText, dt as canvasRemoveInputSchema, er as replyCommentInputSchema, ft as canvasCreateToolInputSchema, g as toMcpFailurePayload, gt as canvasFindOutputSchema, ht as canvasFindInputSchema, ir as screenElementsCommentTargetSchema, nr as screenAreaCommentTargetSchema, nt as canvasAssetImportOutputSchema, o as CAPTURE_PAGE_CALLS, or as startCommentInputSchema, pt as canvasCreateToolOutputSchema, q as canvasCaptureOutputSchema, qn as commentResolverSchema, rr as screenElementCommentTargetSchema, sn as MCP_TOOL_BY_CAPABILITY, st as canvasRenderScopedToolInputSchema, tr as replyCommentOutputSchema, tt as canvasAssetImportInputSchema, w as PROTOTYPE_UPDATE_GUIDANCE, zt as decodeCanvasExchangeToken } from "./cli-output-identity.lib-BsDqFLVA.mjs";
|
|
3
|
+
import { T as createAuthUseCase, c as createOauthLoopbackAdapter, f as createCapabilityInvocationAdapter, n as createMutationKeyAdapter, r as createHttpRemoteAdapter, u as withCapabilityNames, y as boundedResultPage } from "./zod-messages.lib-B8yowT7b.mjs";
|
|
4
|
+
import { a as mcpDispatchedResultSchema, c as withClientTokenNamed, i as createMcpCanvasToolsAdapter, l as createMcpClientContextAdapter, n as createMcpWorkflowsAdapter, o as createMcpResultAdapter, r as createMcpClientInvocationAdapter, s as toolClientToken, u as createCapabilityCatalogAdapter } from "./mcp-server.adapter-CbObvH7Y.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
7
7
|
|
|
@@ -80,7 +80,7 @@ const READ_ANNOTATIONS = {
|
|
|
80
80
|
idempotentHint: true,
|
|
81
81
|
openWorldHint: false
|
|
82
82
|
};
|
|
83
|
-
const
|
|
83
|
+
const answered = async (schema, action) => {
|
|
84
84
|
try {
|
|
85
85
|
const result = schema.parse(await action());
|
|
86
86
|
return createMcpResultAdapter("Reconnect Enhance and retry the same intent.").structured(result);
|
|
@@ -88,6 +88,11 @@ const delivered$1 = async (schema, action) => {
|
|
|
88
88
|
return createMcpResultAdapter("Reconnect Enhance through this host’s connection flow, then repeat the request.").failure(error);
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
+
/** A write's answer, which names the retry token it used: the agent's, or one the tool made. */
|
|
92
|
+
const delivered$1 = async (schema, given, action) => {
|
|
93
|
+
const clientToken = toolClientToken(given);
|
|
94
|
+
return withClientTokenNamed(await answered(schema, async () => action(clientToken)), clientToken);
|
|
95
|
+
};
|
|
91
96
|
const registerRemoval = (server, invoke) => {
|
|
92
97
|
server.registerTool("canvas_remove", {
|
|
93
98
|
title: "Remove canvas objects",
|
|
@@ -99,7 +104,7 @@ const registerRemoval = (server, invoke) => {
|
|
|
99
104
|
readOnlyHint: false,
|
|
100
105
|
destructiveHint: true
|
|
101
106
|
}
|
|
102
|
-
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasWriteReceiptSchema, async () => invoke("canvas.remove", args,
|
|
107
|
+
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasWriteReceiptSchema, clientToken, async (token) => invoke("canvas.remove", args, token))));
|
|
103
108
|
};
|
|
104
109
|
const registerExchange = (server, invoke, isReadOnly) => {
|
|
105
110
|
server.registerTool("canvas_read", {
|
|
@@ -108,11 +113,11 @@ const registerExchange = (server, invoke, isReadOnly) => {
|
|
|
108
113
|
inputSchema: canvasReadInputSchema,
|
|
109
114
|
outputSchema: canvasReadOutputSchema,
|
|
110
115
|
annotations: READ_ANNOTATIONS
|
|
111
|
-
}, async (args, context) => clientContext$9.run(context, async () =>
|
|
116
|
+
}, async (args, context) => clientContext$9.run(context, async () => answered(canvasReadOutputSchema, async () => invoke("canvas.read", args))));
|
|
112
117
|
if (isReadOnly) return;
|
|
113
118
|
server.registerTool("canvas_update_html", {
|
|
114
119
|
title: "Update editable canvas content",
|
|
115
|
-
description:
|
|
120
|
+
description: `Submit the complete HTML from canvas_read with its original snapshotToken and canvasRef. Preserve retained IDs and opaque placeholders. Add populated new subtrees without identity markers and with explicit dimensions/styles. Retained elements allow only identity, name, opaque, locked and style attributes (svg also viewBox). Writing CSS that a native setting paints replaces that setting; writing a mask group's mask CSS removes the mask. Keep opaque and locked elements unchanged. New wrappers cannot contain retained IDs; use canvas_arrange. Reference: enhance://canvas/html/2. Declare deliberate omitted subtrees in removeNodeIds. A no-op creates no revision. The call normally answers with the committed result; one that outlasts the wait answers as pending and has not committed, so repeat it with identical arguments and clientToken. Retry an uncertain result with identical arguments and clientToken; a changed canvas requires a new read and deliberate replan. ${pointOfUseText("update")}`,
|
|
116
121
|
inputSchema: canvasUpdateHtmlInputSchema,
|
|
117
122
|
outputSchema: canvasPreparationOutputSchema,
|
|
118
123
|
annotations: {
|
|
@@ -120,31 +125,31 @@ const registerExchange = (server, invoke, isReadOnly) => {
|
|
|
120
125
|
readOnlyHint: false,
|
|
121
126
|
destructiveHint: true
|
|
122
127
|
}
|
|
123
|
-
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasPreparationOutputSchema, async () => invoke("canvas.updateHtml", args,
|
|
128
|
+
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasPreparationOutputSchema, clientToken, async (token) => invoke("canvas.updateHtml", args, token))));
|
|
124
129
|
};
|
|
125
130
|
const registerInsertion = (server, invoke) => {
|
|
126
131
|
server.registerTool("canvas_insert_html", {
|
|
127
132
|
title: "Insert editable HTML content",
|
|
128
|
-
description:
|
|
133
|
+
description: `Compile one populated HTML subtree into fresh editable nodes at an explicit parent. Preserve the full canvas/page/selection reference. The canonical compiler commits atomically at baseVersion; a concurrent edit rejects the insertion. The call normally answers with the committed version and root node; operation_status is for a compile that outlasts the wait, and for additional identity mappings. Reuse identical arguments and clientToken after an uncertain response. ${pointOfUseText("write")}`,
|
|
129
134
|
inputSchema: canvasInsertHtmlInputSchema,
|
|
130
135
|
outputSchema: canvasConversionStatusSchema,
|
|
131
136
|
annotations: {
|
|
132
137
|
...READ_ANNOTATIONS,
|
|
133
138
|
readOnlyHint: false
|
|
134
139
|
}
|
|
135
|
-
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasConversionStatusSchema, async () => invoke("canvas.insertHtml", args,
|
|
140
|
+
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasConversionStatusSchema, clientToken, async (token) => invoke("canvas.insertHtml", args, token))));
|
|
136
141
|
};
|
|
137
142
|
const registerConversion = (server, invoke) => {
|
|
138
143
|
server.registerTool("canvas_capture", {
|
|
139
144
|
title: "Capture a recording moment",
|
|
140
|
-
description: "Land an exact recording moment as an editable frame after inspecting its canvas_render preview. Supply that preview job, the canvas version that preview rendered (baseVersion) and the full page/selection reference. The page is stored, compiled into editable layers and saved as one frame below the root-level recording on the same page, in one change at baseVersion. When attachment is committed, frame.nodeId is the editable frame (edit its layers) and frame.version is the canvas version to use as your next baseVersion; canvas_make_editable is not needed. A concurrent canvas edit prevents the save: render a new preview and capture
|
|
145
|
+
description: "Land an exact recording moment as an editable frame after inspecting its canvas_render preview. Supply that preview job, the canvas version that preview rendered (baseVersion) and the full page/selection reference. The page is stored, compiled into editable layers and saved as one frame below the root-level recording on the same page, in one change at baseVersion. When attachment is committed, frame.nodeId is the editable frame (edit its layers) and frame.version is the canvas version to use as your next baseVersion; canvas_make_editable is not needed. A concurrent canvas edit prevents the save: render a new preview and capture again without the clientToken, so the tool makes a new one. When attachment is pending, repeat with identical arguments and the same clientToken, or follow its operation with operation_status; a new token could save a second frame. When attachment is not_confirmed with a failure, nothing was added: capture again without the clientToken. This supports recordings already on this canvas, not arbitrary URLs or prototype crawling.",
|
|
141
146
|
inputSchema: canvasCaptureInputSchema,
|
|
142
147
|
outputSchema: canvasCaptureOutputSchema,
|
|
143
148
|
annotations: {
|
|
144
149
|
...READ_ANNOTATIONS,
|
|
145
150
|
readOnlyHint: false
|
|
146
151
|
}
|
|
147
|
-
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasCaptureOutputSchema, async () => invoke("canvas.capture", args,
|
|
152
|
+
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasCaptureOutputSchema, clientToken, async (token) => invoke("canvas.capture", args, token))));
|
|
148
153
|
server.registerTool("canvas_capture_page", {
|
|
149
154
|
title: "Capture a page you opened",
|
|
150
155
|
description: `Put any page you can open on a canvas as an editable frame: a page on localhost, behind a sign-in, or anywhere else your browser can reach. Enhance never visits the address itself. ${CAPTURE_PAGE_CALLS_FOR_TOOLS} A picture of the page lands at once at that place, and becomes the editable frame in place, keeping its id. When step is placed, frame.nodeId is the editable frame, frame.version is your next baseVersion and frame.box tells you where to put the next capture. When step is converting, the picture is on the canvas: repeat with identical arguments and clientToken. If a page's Content Security Policy blocks the snippet, run it from Playwright in a context created with bypassCSP: true.`,
|
|
@@ -154,7 +159,7 @@ const registerConversion = (server, invoke) => {
|
|
|
154
159
|
...READ_ANNOTATIONS,
|
|
155
160
|
readOnlyHint: false
|
|
156
161
|
}
|
|
157
|
-
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasCapturePageOutputSchema, async () => invoke("canvas.capturePage", args,
|
|
162
|
+
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasCapturePageOutputSchema, clientToken, async (token) => invoke("canvas.capturePage", args, token))));
|
|
158
163
|
server.registerTool("canvas_make_editable", {
|
|
159
164
|
title: "Make a captured screen editable",
|
|
160
165
|
description: "Convert one supported, root-level captured screen into a new editable subtree beside its source. Preserve the complete page/selection reference. The original screen is retained. This does not reconstruct raster images, crawl prototypes or capture arbitrary websites. The call normally answers with the result and its bounded loss report; operation_status is for a conversion that outlasts the wait, and for remaining mappings. Render the original and result for comparison. Retry uncertainty with identical arguments and clientToken.",
|
|
@@ -164,7 +169,7 @@ const registerConversion = (server, invoke) => {
|
|
|
164
169
|
...READ_ANNOTATIONS,
|
|
165
170
|
readOnlyHint: false
|
|
166
171
|
}
|
|
167
|
-
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasConversionStatusSchema, async () => invoke("canvas.makeEditable", args,
|
|
172
|
+
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasConversionStatusSchema, clientToken, async (token) => invoke("canvas.makeEditable", args, token))));
|
|
168
173
|
};
|
|
169
174
|
const createMcpCanvasContentAdapter = (invoke, isReadOnly) => ({ register: (server) => {
|
|
170
175
|
server.registerResource("canvas-html-v2", CANVAS_HTML_REFERENCE_URI, {
|
|
@@ -212,7 +217,7 @@ const registerFind = (server, invoke) => {
|
|
|
212
217
|
const registerCreate = (server, invoke) => {
|
|
213
218
|
server.registerTool("canvas_create", {
|
|
214
219
|
title: "Create a canvas",
|
|
215
|
-
description:
|
|
220
|
+
description: `Create an invite-only canvas in an explicit existing personal or team destination from canvas_find. Use only when the person wants a new canvas. Reuse the same clientToken and arguments after an uncertain response. Returns the committed initial document revision. This creates no team, prototype or public share. ${pointOfUseText("create")}`,
|
|
216
221
|
inputSchema: canvasCreateToolInputSchema,
|
|
217
222
|
outputSchema: canvasCreateToolOutputSchema,
|
|
218
223
|
annotations: {
|
|
@@ -293,8 +298,9 @@ const createMcpCanvasPreparationAdapter = (invoke) => ({ register: (server) => {
|
|
|
293
298
|
openWorldHint: false
|
|
294
299
|
}
|
|
295
300
|
}, async (offered, context) => clientContext$7.run(context, async () => {
|
|
296
|
-
const { clientToken, ...args } = definition.inputSchema.parse(offered);
|
|
297
|
-
|
|
301
|
+
const { clientToken: given, ...args } = definition.inputSchema.parse(offered);
|
|
302
|
+
const clientToken = toolClientToken(given);
|
|
303
|
+
return withClientTokenNamed(await deliverPreparation(async () => invoke(definition.capability, args, clientToken)), clientToken);
|
|
298
304
|
}));
|
|
299
305
|
} });
|
|
300
306
|
|
|
@@ -304,7 +310,7 @@ const clientContext$6 = createMcpClientContextAdapter();
|
|
|
304
310
|
const createMcpCanvasRenderAdapter = (input) => ({ register: (server) => {
|
|
305
311
|
server.registerTool("canvas_render", {
|
|
306
312
|
title: "Inspect canvas pixels",
|
|
307
|
-
description:
|
|
313
|
+
description: `Render one explicit target or up to four named targets at the returned canvas revision. A batch shares 16,000,000 pixels equally unless per-target budgets are supplied; the total is checked before rendering. Each outcome identifies its target and actual image content index; partial completion is explicit. Preserve the complete page or selection URL. The call normally answers with the PNG. A render that outlasts the wait answers with a durable operation reference: collect its pixels with operation_status and includeImage true. Reuse identical arguments and clientToken after an uncertain outcome. Rendering creates a temporary job but no canvas edit. Inspect the delivered image before claiming visual verification. ${pointOfUseText("render")}`,
|
|
308
314
|
inputSchema: canvasRenderScopedToolInputSchema,
|
|
309
315
|
outputSchema: mcpDispatchedResultSchema,
|
|
310
316
|
...input.ui !== void 0 && { _meta: input.ui.toolMeta },
|
|
@@ -314,19 +320,20 @@ const createMcpCanvasRenderAdapter = (input) => ({ register: (server) => {
|
|
|
314
320
|
idempotentHint: true,
|
|
315
321
|
openWorldHint: false
|
|
316
322
|
}
|
|
317
|
-
}, async ({ clientToken, ...request }, context) => clientContext$6.run(context, async () => {
|
|
323
|
+
}, async ({ clientToken: given, ...request }, context) => clientContext$6.run(context, async () => {
|
|
318
324
|
const results = createMcpResultAdapter("Reconnect Enhance and retry this same render intent.");
|
|
325
|
+
const clientToken = toolClientToken(given);
|
|
319
326
|
try {
|
|
320
|
-
return {
|
|
327
|
+
return withClientTokenNamed({
|
|
321
328
|
...await results.success(server, await input.invocation.invoke({
|
|
322
329
|
capability: fromCapabilityReference(input.catalog, "canvas.render"),
|
|
323
330
|
arguments: request,
|
|
324
331
|
clientToken
|
|
325
332
|
}), "embedded"),
|
|
326
333
|
...input.ui !== void 0 && { _meta: input.ui.resultMeta }
|
|
327
|
-
};
|
|
334
|
+
}, clientToken);
|
|
328
335
|
} catch (error) {
|
|
329
|
-
return results.failure(error);
|
|
336
|
+
return withClientTokenNamed(results.failure(error), clientToken);
|
|
330
337
|
}
|
|
331
338
|
}));
|
|
332
339
|
} });
|
|
@@ -1162,12 +1169,13 @@ const createMcpPrototypePublishAdapter = (invoke) => ({ register: (server) => {
|
|
|
1162
1169
|
idempotentHint: true,
|
|
1163
1170
|
openWorldHint: true
|
|
1164
1171
|
}
|
|
1165
|
-
}, async ({ clientToken, ...args }, context) => clientContext$2.run(context, async () => {
|
|
1172
|
+
}, async ({ clientToken: given, ...args }, context) => clientContext$2.run(context, async () => {
|
|
1173
|
+
const clientToken = toolClientToken(given);
|
|
1166
1174
|
try {
|
|
1167
1175
|
const result = canvasPrototypeOutputSchema.parse(await invoke("prototype.publishCanvas", args, clientToken));
|
|
1168
|
-
return createMcpResultAdapter("Reconnect Enhance and retry the same intent.").structured(result);
|
|
1176
|
+
return withClientTokenNamed(createMcpResultAdapter("Reconnect Enhance and retry the same intent.").structured(result), clientToken);
|
|
1169
1177
|
} catch (error) {
|
|
1170
|
-
return createMcpResultAdapter("Retry the original publishing request and clientToken after reconnecting; do not infer that a lost response means no changes.").failure(error);
|
|
1178
|
+
return withClientTokenNamed(createMcpResultAdapter("Retry the original publishing request and clientToken after reconnecting; do not infer that a lost response means no changes.").failure(error), clientToken);
|
|
1171
1179
|
}
|
|
1172
1180
|
}));
|
|
1173
1181
|
} });
|
|
@@ -1178,7 +1186,7 @@ const clientContext$1 = createMcpClientContextAdapter();
|
|
|
1178
1186
|
const createMcpAssetImportAdapter = (invoke) => ({ register: (server) => {
|
|
1179
1187
|
server.registerTool("asset_import", {
|
|
1180
1188
|
title: "Import a canvas asset",
|
|
1181
|
-
description:
|
|
1189
|
+
description: `Import one explicitly selected local image or font. Verifies actual bytes and format. Returns a durable native resource and metadata without placing content or changing the canvas version. Use the resource in a subsequent explicit authoring action. Retry the same file and clientToken after uncertainty, or inspect the returned operation reference. ${pointOfUseText("import")}`,
|
|
1182
1190
|
inputSchema: canvasAssetImportInputSchema,
|
|
1183
1191
|
outputSchema: canvasAssetImportOutputSchema,
|
|
1184
1192
|
annotations: {
|
|
@@ -1188,22 +1196,24 @@ const createMcpAssetImportAdapter = (invoke) => ({ register: (server) => {
|
|
|
1188
1196
|
openWorldHint: false
|
|
1189
1197
|
}
|
|
1190
1198
|
}, async (offered, context) => clientContext$1.run(context, async () => {
|
|
1199
|
+
let clientToken = toolClientToken(void 0);
|
|
1191
1200
|
try {
|
|
1192
|
-
const { clientToken, ...input } = canvasAssetImportInputSchema.parse(offered);
|
|
1201
|
+
const { clientToken: given, ...input } = canvasAssetImportInputSchema.parse(offered);
|
|
1202
|
+
clientToken = toolClientToken(given);
|
|
1193
1203
|
const result = canvasAssetImportOutputSchema.parse(await invoke("canvas.importAsset", input, clientToken));
|
|
1194
|
-
return createMcpResultAdapter("Reconnect Enhance and retry the same intent.").structured(result);
|
|
1204
|
+
return withClientTokenNamed(createMcpResultAdapter("Reconnect Enhance and retry the same intent.").structured(result), clientToken);
|
|
1195
1205
|
} catch (error) {
|
|
1196
|
-
return createMcpResultAdapter("Retry the same selected file and clientToken.").failure(error);
|
|
1206
|
+
return withClientTokenNamed(createMcpResultAdapter("Retry the same selected file and clientToken.").failure(error), clientToken);
|
|
1197
1207
|
}
|
|
1198
1208
|
}));
|
|
1199
1209
|
} });
|
|
1200
1210
|
|
|
1201
1211
|
//#endregion
|
|
1202
1212
|
//#region src/infrastructure/mcp-canvas-profile.adapter.ts
|
|
1203
|
-
const profileInstructions = (input, workflows) => [workflows, input.authentication === "oauth" ? "Use the host’s OAuth connection flow to connect Enhance." : input.readOnly === true ? "Use connection_status to check account authentication. This profile cannot start sign-in or write; use the existing host connection flow if needed." : "Use connection_connect for browser sign-in, then connection_status to verify authentication."].filter(Boolean).join("
|
|
1213
|
+
const profileInstructions = (input, workflows) => [workflows, input.authentication === "oauth" ? "Use the host’s OAuth connection flow to connect Enhance." : input.readOnly === true ? "Use connection_status to check account authentication. This profile cannot start sign-in or write; use the existing host connection flow if needed." : "Use connection_connect for browser sign-in, then connection_status to verify authentication."].filter(Boolean).join("\n\n");
|
|
1204
1214
|
/** The small-edit tool the CLI and the desktop assistant have, and no second insert or render. */
|
|
1205
1215
|
const editToolsFor = (input, catalog, invocation) => createMcpCanvasToolsAdapter({
|
|
1206
|
-
tools: ["edit"],
|
|
1216
|
+
tools: ["edit", "finish"],
|
|
1207
1217
|
catalog,
|
|
1208
1218
|
invocation,
|
|
1209
1219
|
results: createMcpResultAdapter(input.authentication === "oauth" ? "Reconnect Enhance through this host’s connection flow, then repeat the request." : "Reconnect Enhance and retry the same intent."),
|
|
@@ -1268,6 +1278,13 @@ const createMcpCanvasProfileAdapter = (input) => {
|
|
|
1268
1278
|
|
|
1269
1279
|
//#endregion
|
|
1270
1280
|
//#region src/infrastructure/desktop-scoped-remote.adapter.ts
|
|
1281
|
+
/** The writes a desktop chat records and keeps inside its selection. */
|
|
1282
|
+
const WRITE_PROCEDURES = /* @__PURE__ */ new Set([
|
|
1283
|
+
"canvas.applyOperations",
|
|
1284
|
+
"canvas.render.importSource",
|
|
1285
|
+
"canvas.applyEdits"
|
|
1286
|
+
]);
|
|
1287
|
+
const isWriteProcedure = (procedure) => WRITE_PROCEDURES.has(procedure);
|
|
1271
1288
|
const argumentSchema = z.looseObject({ canvasId: z.uuid() });
|
|
1272
1289
|
const mutationSchema = argumentSchema.extend({ mutationId: z.uuid() });
|
|
1273
1290
|
const createDesktopScopedRemoteAdapter = (remote, scope, observer, mutationKey) => ({
|
|
@@ -1275,8 +1292,11 @@ const createDesktopScopedRemoteAdapter = (remote, scope, observer, mutationKey)
|
|
|
1275
1292
|
mutate: async (procedure, input) => {
|
|
1276
1293
|
const args = argumentSchema.parse(input);
|
|
1277
1294
|
if (args.canvasId !== scope.canvasId) throw new CliError("FORBIDDEN", "This write belongs to another canvas.", "Start a new chat there.");
|
|
1278
|
-
const isWriting = procedure
|
|
1279
|
-
const scoped = isWriting ? {
|
|
1295
|
+
const isWriting = isWriteProcedure(procedure);
|
|
1296
|
+
const scoped = isWriting ? procedure === "canvas.applyEdits" ? {
|
|
1297
|
+
...args,
|
|
1298
|
+
scopeNodeIds: scope.nodeIds
|
|
1299
|
+
} : {
|
|
1280
1300
|
...args,
|
|
1281
1301
|
...procedure === "canvas.render.importSource" && { mutationId: mutationKey?.current(procedure, args) },
|
|
1282
1302
|
writeScope: { rootIds: scope.nodeIds }
|
package/dist/mcp-main.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { s as toCapabilityDefinition } from "./cli-output-identity.lib-
|
|
3
|
-
import { a as readLocalMcpEnvironment, t as installZodMessages } from "./zod-messages.lib-
|
|
2
|
+
import { s as toCapabilityDefinition } from "./cli-output-identity.lib-BsDqFLVA.mjs";
|
|
3
|
+
import { a as readLocalMcpEnvironment, t as installZodMessages } from "./zod-messages.lib-B8yowT7b.mjs";
|
|
4
4
|
import { t as createFileCredentialAdapter } from "./file-credential.adapter-CShGZcd5.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-
|
|
5
|
+
import { l as createMcpClientContextAdapter, t as createMcpServerAdapter, u as createCapabilityCatalogAdapter } from "./mcp-server.adapter-CbObvH7Y.mjs";
|
|
6
|
+
import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-DGgt79VT.mjs";
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
@@ -171,19 +171,19 @@ const clientContext = createMcpClientContextAdapter();
|
|
|
171
171
|
const main = () => {
|
|
172
172
|
const config = readLocalMcpEnvironment();
|
|
173
173
|
const credentials = createFileCredentialAdapter(config.configDirectory, config.earlierConfigDirectory);
|
|
174
|
-
const invocation = createMcpInvocationAdapter(config.apiUrl, credentials, config.configDirectory, { version: "0.1.
|
|
174
|
+
const invocation = createMcpInvocationAdapter(config.apiUrl, credentials, config.configDirectory, { version: "0.1.171" });
|
|
175
175
|
const catalog = [...createCapabilityCatalogAdapter(), ...createMcpTransportCapabilityAdapter()];
|
|
176
176
|
const client = clientContext.createStdio();
|
|
177
177
|
serveStdio(() => config.profile === "canvas" ? createMcpCanvasProfileAdapter({
|
|
178
178
|
readOnly: config.isReadOnly,
|
|
179
179
|
...config.workflowsDirectory !== void 0 && { workflows: config.workflowsDirectory },
|
|
180
180
|
name: config.mcpServiceName,
|
|
181
|
-
version: "0.1.
|
|
181
|
+
version: "0.1.171",
|
|
182
182
|
invocation,
|
|
183
183
|
clientMetadata: client.metadata,
|
|
184
184
|
catalog
|
|
185
185
|
}) : createMcpServerAdapter({
|
|
186
|
-
version: "0.1.
|
|
186
|
+
version: "0.1.171",
|
|
187
187
|
name: config.mcpServiceName,
|
|
188
188
|
commandName: config.commandName,
|
|
189
189
|
invocation,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { Ct as canvasEditCapabilityInputSchema, Et as inputProblemFields, Ft as hasCanvasReferenceScope, It as parseCanvasReference, Nt as canvasReferenceRenderTarget, Tr as agentClientMetadata, Zt as readStoredCanvasScene, _n as CliError, d as toPresentedCapabilities, dn as pointOfUseText, fn as startUpListFor, g as toMcpFailurePayload, hi as canvasRenderTargetSchema, hn as SKILL_NAMES, i as createLazyCapabilityCatalogAdapter, it as canvasRenderBatchResultSchema, k as canvasWriteHtmlCapabilityInputSchema, l as GUIDE_TOPICS, lt as canvasRenderFileSchema, mn as SKILL_JOBS, n as withCommandName, on as onSurface, p as createMcpCapabilityDiscoveryAdapter, pi as canvasRenderSourceStateSchema, pn as DESIGN_RULES, qt as retryClientTokenSchema, r as toCanvasAuthoringResult, sn as MCP_TOOL_BY_CAPABILITY, t as withCommandInFailure, u as GUIDE_TOPIC_NAMES, zr as wholeCanvasDocumentOutputSchema } from "./cli-output-identity.lib-BsDqFLVA.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { readFile, rm } from "node:fs/promises";
|
|
@@ -80,6 +80,22 @@ const createMcpClientContextAdapter = () => ({
|
|
|
80
80
|
createStdio: createMcpStdioClientAdapter
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/infrastructure/mcp-client-token.lib.ts
|
|
85
|
+
/** A write's retry token: the one the agent gave, or a new random one the tool makes. */
|
|
86
|
+
const toolClientToken = (given) => given ?? randomUUID();
|
|
87
|
+
/**
|
|
88
|
+
* The answer with its retry token named, so an agent never makes one up: it repeats the call with
|
|
89
|
+
* this token only when the outcome was uncertain.
|
|
90
|
+
*/
|
|
91
|
+
const withClientTokenNamed = (answer, clientToken) => ({
|
|
92
|
+
...answer,
|
|
93
|
+
content: [...answer.content, {
|
|
94
|
+
type: "text",
|
|
95
|
+
text: `clientToken: ${clientToken}. Repeat this call with identical arguments and this clientToken only if its outcome was uncertain.`
|
|
96
|
+
}]
|
|
97
|
+
});
|
|
98
|
+
|
|
83
99
|
//#endregion
|
|
84
100
|
//#region src/infrastructure/mcp-render-attachment.adapter.ts
|
|
85
101
|
const createMcpRenderAttachmentAdapter = async (server, result, delivery) => {
|
|
@@ -478,10 +494,51 @@ const mcpMutationInputSchema = z.object({
|
|
|
478
494
|
clientToken: z.uuid().optional().describe("Stable UUID reused only when retrying this exact mutation input.")
|
|
479
495
|
});
|
|
480
496
|
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/infrastructure/mcp-canvas-finish.adapter.ts
|
|
499
|
+
const clientContext$3 = createMcpClientContextAdapter();
|
|
500
|
+
/** The procedure that ends an agent's activity, which the catalogue offers as a capability. */
|
|
501
|
+
const FINISH_CAPABILITY = "canvas.realtime.activity.end";
|
|
502
|
+
const finishSchema = z.strictObject({
|
|
503
|
+
canvas: z.string().min(1).describe("Canvas UUID or complete canvas URL."),
|
|
504
|
+
nodeIds: z.array(z.string().min(1)).max(100).default([]).describe("The screens you finished. Leave empty when you have finished on this canvas.")
|
|
505
|
+
});
|
|
506
|
+
/** `canvas_finish_working`: the agent says it has finished, so its mark leaves the canvas. */
|
|
507
|
+
const createMcpCanvasFinishAdapter = (input) => ({ register: (server) => {
|
|
508
|
+
const capability = input.catalog.find((candidate) => candidate.id === FINISH_CAPABILITY);
|
|
509
|
+
if (capability === void 0) return;
|
|
510
|
+
server.registerTool("canvas_finish_working", {
|
|
511
|
+
title: "Say you have finished",
|
|
512
|
+
description: `End your mark on the canvas, or take finished screens out of it. ${pointOfUseText("finish")} With nothing live, the call succeeds and says so; a mark nobody finishes leaves 45 seconds after the last call.`,
|
|
513
|
+
inputSchema: finishSchema,
|
|
514
|
+
outputSchema: mcpDispatchedResultSchema,
|
|
515
|
+
annotations: {
|
|
516
|
+
readOnlyHint: false,
|
|
517
|
+
destructiveHint: false,
|
|
518
|
+
idempotentHint: true,
|
|
519
|
+
openWorldHint: false
|
|
520
|
+
}
|
|
521
|
+
}, async ({ canvas, nodeIds }, context) => clientContext$3.run(context, async () => {
|
|
522
|
+
try {
|
|
523
|
+
const ended = await input.invocation.invoke({
|
|
524
|
+
capability,
|
|
525
|
+
arguments: {
|
|
526
|
+
canvasId: parseCanvasReference(canvas).canvasId,
|
|
527
|
+
nodeIds
|
|
528
|
+
},
|
|
529
|
+
clientToken: null
|
|
530
|
+
});
|
|
531
|
+
return await input.results.success(server, ended, input.delivery);
|
|
532
|
+
} catch (error) {
|
|
533
|
+
return input.results.failure(error);
|
|
534
|
+
}
|
|
535
|
+
}));
|
|
536
|
+
} });
|
|
537
|
+
|
|
481
538
|
//#endregion
|
|
482
539
|
//#region src/infrastructure/mcp-canvas-tools.adapter.ts
|
|
483
540
|
const clientContext$2 = createMcpClientContextAdapter();
|
|
484
|
-
const
|
|
541
|
+
const clientTokenSchema = retryClientTokenSchema;
|
|
485
542
|
const writeSchema = canvasWriteHtmlCapabilityInputSchema.pick({
|
|
486
543
|
baseVersion: true,
|
|
487
544
|
targetNodeId: true,
|
|
@@ -490,17 +547,24 @@ const writeSchema = canvasWriteHtmlCapabilityInputSchema.pick({
|
|
|
490
547
|
}).extend({
|
|
491
548
|
canvas: z.string().min(1).describe("Canvas UUID or complete canvas/page/selection URL. Preserve every supplied page and selection."),
|
|
492
549
|
mode: z.enum(["insert-children", "replace"]).default("insert-children"),
|
|
493
|
-
clientToken
|
|
550
|
+
clientToken: clientTokenSchema
|
|
494
551
|
});
|
|
495
|
-
const editSchema = canvasEditCapabilityInputSchema.extend({ clientToken });
|
|
552
|
+
const editSchema = canvasEditCapabilityInputSchema.extend({ clientToken: clientTokenSchema });
|
|
496
553
|
const renderSchema = z.object({
|
|
497
|
-
clientToken,
|
|
554
|
+
clientToken: clientTokenSchema,
|
|
498
555
|
canvas: z.string().min(1),
|
|
499
556
|
expectedVersion: z.number().int().positive().describe("Version returned by the latest successful read or write."),
|
|
500
557
|
target: canvasRenderTargetSchema.default({ kind: "content" }),
|
|
501
558
|
sourceState: canvasRenderSourceStateSchema.nullable().default(null),
|
|
502
|
-
scale: z.number().positive().default(1)
|
|
559
|
+
scale: z.number().positive().default(1).describe(DESIGN_RULES.scale)
|
|
503
560
|
});
|
|
561
|
+
/** A write or an edit: it changes the canvas, and a repeat makes a second change. */
|
|
562
|
+
const CHANGING_ANNOTATIONS = {
|
|
563
|
+
readOnlyHint: false,
|
|
564
|
+
destructiveHint: true,
|
|
565
|
+
idempotentHint: false,
|
|
566
|
+
openWorldHint: false
|
|
567
|
+
};
|
|
504
568
|
const invoke = async (input, id, args, token = null) => {
|
|
505
569
|
const capability = input.catalog.find((candidate) => candidate.id === id);
|
|
506
570
|
if (capability === void 0) throw new TypeError(`Missing canvas capability ${id}`);
|
|
@@ -525,26 +589,23 @@ const renderTarget = async (input, args) => {
|
|
|
525
589
|
target: canvasReferenceRenderTarget(reference, readStoredCanvasScene(held.document), args.target)
|
|
526
590
|
};
|
|
527
591
|
};
|
|
528
|
-
|
|
592
|
+
/** A write's answer, which names the retry token it used: the agent's, or one the tool made. */
|
|
593
|
+
const deliver = async (server, input, given, action) => {
|
|
594
|
+
const clientToken = toolClientToken(given);
|
|
529
595
|
try {
|
|
530
|
-
return await input.results.success(server, await action(), input.delivery);
|
|
596
|
+
return withClientTokenNamed(await input.results.success(server, await action(clientToken), input.delivery), clientToken);
|
|
531
597
|
} catch (error) {
|
|
532
|
-
return input.results.failure(error);
|
|
598
|
+
return withClientTokenNamed(input.results.failure(error), clientToken);
|
|
533
599
|
}
|
|
534
600
|
};
|
|
535
601
|
const registerWrite = (server, input) => {
|
|
536
602
|
if (input.catalog.some((capability) => capability.id === "canvas.writeHtml")) server.registerTool("canvas_write_html", {
|
|
537
603
|
title: "Design editable canvas content",
|
|
538
|
-
description: `Create a
|
|
604
|
+
description: `Create a screen, or add a visual group to one, from safe HTML/CSS. Returns the committed version and root node without an extra read or render. ${input.readTool === "canvas_read" ? "Read canonical IDs and the current version with canvas_read. Keep all writes inside the frozen selection." : "If starting state is unknown, call capability_query with {\"capability\":\"canvas.read\",\"input\":{\"canvasId\":\"<UUID from canvas URL>\"}}. When nodeCount is 0, use targetNodeId \"root\" and the returned version."} ${pointOfUseText("write")} Give important rows, cards and buttons explicit dimensions; avoid implicit stretch and inline badge backgrounds. Include real content, not an empty shell. Reuse a returned version for subsequent edits; read a targeted subtree only when its ids or structure are unknown. Use canvas_edit for small changes. The schema here is executable; no search or describe is required.`,
|
|
539
605
|
inputSchema: writeSchema,
|
|
540
606
|
outputSchema: mcpDispatchedResultSchema,
|
|
541
|
-
annotations:
|
|
542
|
-
|
|
543
|
-
destructiveHint: true,
|
|
544
|
-
idempotentHint: false,
|
|
545
|
-
openWorldHint: false
|
|
546
|
-
}
|
|
547
|
-
}, async ({ canvas, clientToken: token, ...args }, context) => clientContext$2.run(context, async () => deliver(server, input, async () => {
|
|
607
|
+
annotations: CHANGING_ANNOTATIONS
|
|
608
|
+
}, async ({ canvas, clientToken: token, ...args }, context) => clientContext$2.run(context, async () => deliver(server, input, token, async (clientToken) => {
|
|
548
609
|
const reference = parseCanvasReference(canvas);
|
|
549
610
|
return invoke(input, "canvas.writeHtml", {
|
|
550
611
|
...args,
|
|
@@ -556,27 +617,22 @@ const registerWrite = (server, input) => {
|
|
|
556
617
|
overwriteRender: false,
|
|
557
618
|
renderScale: 1,
|
|
558
619
|
renderTimeoutMs: 12e4
|
|
559
|
-
},
|
|
620
|
+
}, clientToken);
|
|
560
621
|
})));
|
|
561
622
|
};
|
|
562
623
|
const registerEdit = (server, input) => {
|
|
563
624
|
if (input.catalog.some((capability) => capability.id === "canvas.edit")) server.registerTool("canvas_edit", {
|
|
564
625
|
title: "Edit existing canvas content",
|
|
565
|
-
description:
|
|
626
|
+
description: `Apply text, styles, rename, duplicate or move edits together in one atomic mutation. Use ids from the input version and the latest successful read or write version; no intermediate read is required just to advance a version. Keep the complete selection URL. Read only the missing subtree when ids are unknown. Returns a compact committed receipt; render after the requested changes are complete. ${pointOfUseText("edit")}`,
|
|
566
627
|
inputSchema: editSchema,
|
|
567
628
|
outputSchema: mcpDispatchedResultSchema,
|
|
568
|
-
annotations:
|
|
569
|
-
|
|
570
|
-
destructiveHint: true,
|
|
571
|
-
idempotentHint: false,
|
|
572
|
-
openWorldHint: false
|
|
573
|
-
}
|
|
574
|
-
}, async ({ clientToken: token, ...args }, context) => clientContext$2.run(context, async () => deliver(server, input, async () => invoke(input, "canvas.edit", args, token ?? null))));
|
|
629
|
+
annotations: CHANGING_ANNOTATIONS
|
|
630
|
+
}, async ({ clientToken: token, ...args }, context) => clientContext$2.run(context, async () => deliver(server, input, token, async (clientToken) => invoke(input, "canvas.edit", args, clientToken))));
|
|
575
631
|
};
|
|
576
632
|
const registerRender = (server, input) => {
|
|
577
633
|
if (input.catalog.some((capability) => capability.id === "canvas.render")) server.registerTool("canvas_render", {
|
|
578
634
|
title: "Review canvas pixels",
|
|
579
|
-
description:
|
|
635
|
+
description: `Render the version returned by a successful read or write and inspect its native PNG. Target the affected screen/node; a blank canvas does not need a pre-render. For a selection link use one node inside the selection. ${pointOfUseText("render")}`,
|
|
580
636
|
inputSchema: renderSchema,
|
|
581
637
|
outputSchema: mcpDispatchedResultSchema,
|
|
582
638
|
annotations: {
|
|
@@ -585,7 +641,7 @@ const registerRender = (server, input) => {
|
|
|
585
641
|
idempotentHint: false,
|
|
586
642
|
openWorldHint: false
|
|
587
643
|
}
|
|
588
|
-
}, async (args, context) => clientContext$2.run(context, async () => deliver(server, input, async () => invoke(input, "canvas.render", {
|
|
644
|
+
}, async (args, context) => clientContext$2.run(context, async () => deliver(server, input, args.clientToken, async (clientToken) => invoke(input, "canvas.render", {
|
|
589
645
|
...await renderTarget(input, args),
|
|
590
646
|
expectedVersion: args.expectedVersion,
|
|
591
647
|
sourceState: args.sourceState,
|
|
@@ -593,17 +649,19 @@ const registerRender = (server, input) => {
|
|
|
593
649
|
outputPath: null,
|
|
594
650
|
overwrite: false,
|
|
595
651
|
timeoutMs: 12e4
|
|
596
|
-
},
|
|
652
|
+
}, clientToken))));
|
|
597
653
|
};
|
|
598
654
|
const createMcpCanvasToolsAdapter = (input) => ({ register: (server) => {
|
|
599
655
|
const selected = input.tools ?? [
|
|
600
656
|
"write",
|
|
601
657
|
"edit",
|
|
602
|
-
"render"
|
|
658
|
+
"render",
|
|
659
|
+
"finish"
|
|
603
660
|
];
|
|
604
661
|
if (selected.includes("write")) registerWrite(server, input);
|
|
605
662
|
if (selected.includes("edit")) registerEdit(server, input);
|
|
606
663
|
if (selected.includes("render")) registerRender(server, input);
|
|
664
|
+
if (selected.includes("finish")) createMcpCanvasFinishAdapter(input).register(server);
|
|
607
665
|
} });
|
|
608
666
|
|
|
609
667
|
//#endregion
|
|
@@ -618,14 +676,21 @@ const createMcpClientInvocationAdapter = (invocation, legacyClient) => ({ invoke
|
|
|
618
676
|
|
|
619
677
|
//#endregion
|
|
620
678
|
//#region src/infrastructure/mcp-workflows.adapter.ts
|
|
621
|
-
/** The guide offers exactly the skills of the one source, by their short names. */
|
|
679
|
+
/** The guide offers exactly the skills and the topics of the one source, by their short names. */
|
|
622
680
|
const workflowNameSchema = z.enum(SKILL_NAMES);
|
|
681
|
+
const guideNameSchema = z.enum([...SKILL_NAMES, ...GUIDE_TOPIC_NAMES]);
|
|
623
682
|
const workflowSchema = z.object({
|
|
624
683
|
name: workflowNameSchema,
|
|
625
684
|
description: z.string().min(1),
|
|
626
685
|
body: z.string().min(1)
|
|
627
686
|
});
|
|
628
|
-
const
|
|
687
|
+
const jobs = `Before ${SKILL_JOBS.slice(0, -1).join(", ")} or ${SKILL_JOBS.at(-1) ?? ""}, call workflow_guide with the matching workflow and follow its guidance.`;
|
|
688
|
+
const topics = `Topics: ${GUIDE_TOPIC_NAMES.map((name) => `${name} (${GUIDE_TOPICS[name].description})`).join("; ")}.`;
|
|
689
|
+
/** The start-up list names tools, which every MCP server words the same. */
|
|
690
|
+
const startUp = startUpListFor({
|
|
691
|
+
surface: "mcp",
|
|
692
|
+
nameOf: (capability) => MCP_TOOL_BY_CAPABILITY[capability]
|
|
693
|
+
});
|
|
629
694
|
/** A skill's file, or a failure that names the skill the folder lacks. */
|
|
630
695
|
const skillFileOf = (directory, name) => {
|
|
631
696
|
try {
|
|
@@ -648,13 +713,20 @@ const workflowIn = (directory, name) => {
|
|
|
648
713
|
};
|
|
649
714
|
/** The guide tool over a folder of skills, or over skills already written for tools. */
|
|
650
715
|
const createMcpWorkflowsAdapter = (skills, authenticationInstructions) => {
|
|
651
|
-
const workflows = typeof skills === "string" ? workflowNameSchema.options.map((name) => workflowIn(skills, name)) : skills.map(({ skill, description, body }) => ({
|
|
716
|
+
const workflows = [...typeof skills === "string" ? workflowNameSchema.options.map((name) => workflowIn(skills, name)) : skills.map(({ skill, description, body }) => ({
|
|
652
717
|
name: skill,
|
|
653
718
|
description,
|
|
654
719
|
body
|
|
655
|
-
}))
|
|
720
|
+
})), ...GUIDE_TOPIC_NAMES.map((name) => ({
|
|
721
|
+
name,
|
|
722
|
+
...GUIDE_TOPICS[name]
|
|
723
|
+
}))];
|
|
656
724
|
return {
|
|
657
|
-
instructions: [
|
|
725
|
+
instructions: [
|
|
726
|
+
startUp,
|
|
727
|
+
jobs,
|
|
728
|
+
authenticationInstructions
|
|
729
|
+
].filter(Boolean).join("\n\n"),
|
|
658
730
|
register: (server) => {
|
|
659
731
|
for (const workflow of workflows) server.registerPrompt(workflow.name, { description: workflow.description }, () => ({ messages: [{
|
|
660
732
|
role: "user",
|
|
@@ -665,8 +737,8 @@ const createMcpWorkflowsAdapter = (skills, authenticationInstructions) => {
|
|
|
665
737
|
}] }));
|
|
666
738
|
server.registerTool("workflow_guide", {
|
|
667
739
|
title: "Load an Enhance workflow",
|
|
668
|
-
description:
|
|
669
|
-
inputSchema: z.strictObject({ workflow:
|
|
740
|
+
description: `${jobs} ${topics}`,
|
|
741
|
+
inputSchema: z.strictObject({ workflow: guideNameSchema }),
|
|
670
742
|
annotations: {
|
|
671
743
|
readOnlyHint: true,
|
|
672
744
|
destructiveHint: false,
|
|
@@ -897,4 +969,4 @@ const createMcpServerAdapter = (input) => {
|
|
|
897
969
|
};
|
|
898
970
|
|
|
899
971
|
//#endregion
|
|
900
|
-
export { mcpDispatchedResultSchema as a,
|
|
972
|
+
export { mcpDispatchedResultSchema as a, withClientTokenNamed as c, createMcpCanvasToolsAdapter as i, createMcpClientContextAdapter as l, createMcpWorkflowsAdapter as n, createMcpResultAdapter as o, createMcpClientInvocationAdapter as r, toolClientToken as s, createMcpServerAdapter as t, createCapabilityCatalogAdapter as u };
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { f as toSharedCapabilities } from "./cli-output-identity.lib-BsDqFLVA.mjs";
|
|
3
3
|
import { t as toCapabilityInventory } from "./capability-inventory.mapper-DyYXyVBJ.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { t as createMcpServerAdapter, u as createCapabilityCatalogAdapter } from "./mcp-server.adapter-CbObvH7Y.mjs";
|
|
5
5
|
|
|
6
6
|
export { createCapabilityCatalogAdapter, createMcpServerAdapter as createEnhanceMcpServer, toCapabilityInventory, toSharedCapabilities };
|