@enhance-eng/enhance 0.1.161 → 0.1.166
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-BfvrkZX5.mjs → cli-output-identity.lib-DTdmAFNC.mjs} +4199 -2567
- package/dist/enhance-mcp.cjs +4 -0
- package/dist/enhance.cjs +4 -0
- package/dist/file-credential.adapter-CShGZcd5.mjs +63 -0
- package/dist/launch.cjs +36 -0
- package/dist/main.mjs +1623 -271
- package/dist/{mcp-invocation.adapter-DtgErzi9.mjs → mcp-invocation.adapter-C8vXAND1.mjs} +25 -5
- package/dist/mcp-main.mjs +10 -9
- package/dist/{mcp-server.adapter-DJeyBKo7.mjs → mcp-server.adapter-BgNggWKN.mjs} +14 -8
- package/dist/mcp.mjs +2 -2
- package/dist/older-node.mjs +7320 -0
- package/dist/remote-mcp-main.mjs +117 -28
- package/dist/rolldown-runtime-b6G8-vqI.mjs +6 -0
- package/dist/{mutation-key.adapter-TMLqYILu.mjs → zod-messages.lib-CH-SDeX_.mjs} +1655 -465
- package/package.json +6 -4
- package/dist/file-credential.adapter-C78gc9OK.mjs +0 -51
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as createMcpResultAdapter, i as mcpDispatchedResultSchema, n as createMcpWorkflowsAdapter, o as createMcpClientContextAdapter, r as createMcpClientInvocationAdapter } from "./mcp-server.adapter-
|
|
2
|
+
import { $ as canvasAssetImportInputSchema, B as operationStatusImageSchema, Bn as listCommentsInputSchema, Fn as commentResolverSchema, Ft as canvasReadInputSchema, G as canvasCaptureOutputSchema, Gn as screenElementCommentTargetSchema, H as operationStatusOutputSchema, Hn as replyCommentInputSchema, I as canvasPrototypeInputSchema, In as commentThreadSchema, It as canvasReadOutputSchema, Jn as startCommentInputSchema, Kn as screenElementsCommentTargetSchema, Kt as parseCanvasReference, Ln as domLocatorSchema, Mn as commentAuthorSchema, Mt as encodeCanvasExchangeToken, N as canvasCapturePageInputSchema, Nn as commentCanvasContextSchema, P as canvasCapturePageOutputSchema, Pn as commentMessageSchema, R as canvasPrototypeOutputSchema, Rn as elementAnchorSchema, Rt as canvasUpdateHtmlInputSchema, S as PROTOTYPE_UPDATE_GUIDANCE, Un as replyCommentOutputSchema, V as operationStatusInputSchema, Vn as listCommentsOutputSchema, W as canvasCaptureInputSchema, Wn as screenAreaCommentTargetSchema, X as canvasPreparationOutputSchema, Y as canvasDuplicateInputSchema, Z as canvasWriteReceiptSchema, an as CliError, at as canvasRenderScopedToolInputSchema, bt as canvasMakeEditableInputSchema, dt as canvasCreateToolOutputSchema, et as canvasAssetImportOutputSchema, ht as createdCanvasAnswerSchema, jt as decodeCanvasExchangeToken, kt as canvasExchangeDigest, lt as canvasRemoveInputSchema, m as toMcpFailurePayload, mt as canvasFindOutputSchema, o as CAPTURE_PAGE_CALLS, pt as canvasFindInputSchema, q as canvasArrangeInputSchema, qn as screenTextCommentTargetSchema, rn as MCP_TOOL_BY_CAPABILITY, ut as canvasCreateToolInputSchema, vt as canvasInsertHtmlInputSchema, z as canvasConversionStatusSchema, zn as getCommentOutputSchema } from "./cli-output-identity.lib-DTdmAFNC.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-CH-SDeX_.mjs";
|
|
4
|
+
import { a as createMcpResultAdapter, i as mcpDispatchedResultSchema, n as createMcpWorkflowsAdapter, o as createMcpClientContextAdapter, r as createMcpClientInvocationAdapter, s as createCapabilityCatalogAdapter } from "./mcp-server.adapter-BgNggWKN.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
7
7
|
|
|
8
|
+
//#region src/infrastructure/capability-reference.mapper.ts
|
|
9
|
+
const fromCapabilityReference = (catalog, id) => {
|
|
10
|
+
const capability = catalog.find((candidate) => candidate.id === id);
|
|
11
|
+
if (capability === void 0) throw new TypeError(`${id} is missing from the capability catalogue`);
|
|
12
|
+
return capability;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
8
16
|
//#region src/application/canvas-html-reference.consts.ts
|
|
9
17
|
const CANVAS_HTML_EXAMPLES = {
|
|
10
18
|
retained: "<div data-enhance-id=\"frame\" data-enhance-name=\"Settings\" style=\"width:360px\"><span data-enhance-id=\"title\" data-enhance-name=\"Title\" style=\"font-size:24px\">Account settings</span><div data-enhance-id=\"reference\" data-enhance-name=\"Reference\" data-enhance-opaque=\"true\"></div></div>",
|
|
@@ -65,6 +73,7 @@ Submit the complete intended edit. There is no node, source-length or operation-
|
|
|
65
73
|
//#endregion
|
|
66
74
|
//#region src/infrastructure/mcp-canvas-content.adapter.ts
|
|
67
75
|
const clientContext$9 = createMcpClientContextAdapter();
|
|
76
|
+
const CAPTURE_PAGE_CALLS_FOR_TOOLS = CAPTURE_PAGE_CALLS.map((call, index) => `${String(index + 1)}) ${withCapabilityNames(call, (id) => MCP_TOOL_BY_CAPABILITY[id] ?? id)}`).join(" ");
|
|
68
77
|
const READ_ANNOTATIONS = {
|
|
69
78
|
readOnlyHint: true,
|
|
70
79
|
destructiveHint: false,
|
|
@@ -136,6 +145,16 @@ const registerConversion = (server, invoke) => {
|
|
|
136
145
|
readOnlyHint: false
|
|
137
146
|
}
|
|
138
147
|
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasCaptureOutputSchema, async () => invoke("canvas.capture", args, clientToken))));
|
|
148
|
+
server.registerTool("canvas_capture_page", {
|
|
149
|
+
title: "Capture a page you opened",
|
|
150
|
+
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.`,
|
|
151
|
+
inputSchema: canvasCapturePageInputSchema,
|
|
152
|
+
outputSchema: canvasCapturePageOutputSchema,
|
|
153
|
+
annotations: {
|
|
154
|
+
...READ_ANNOTATIONS,
|
|
155
|
+
readOnlyHint: false
|
|
156
|
+
}
|
|
157
|
+
}, async ({ clientToken, ...args }, context) => clientContext$9.run(context, async () => delivered$1(canvasCapturePageOutputSchema, async () => invoke("canvas.capturePage", args, clientToken))));
|
|
139
158
|
server.registerTool("canvas_make_editable", {
|
|
140
159
|
title: "Make a captured screen editable",
|
|
141
160
|
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. Read the bounded loss report, follow operation_status for pending work or remaining mappings, then render the original and result for comparison. Retry uncertainty with identical arguments and clientToken.",
|
|
@@ -202,7 +221,7 @@ const registerCreate = (server, invoke) => {
|
|
|
202
221
|
}
|
|
203
222
|
}, async ({ destination, title, clientToken }, context) => clientContext$8.run(context, async () => {
|
|
204
223
|
try {
|
|
205
|
-
const created =
|
|
224
|
+
const created = createdCanvasAnswerSchema.parse(await invoke("canvas.create", {
|
|
206
225
|
title,
|
|
207
226
|
organisationId: destination.kind === "personal" ? null : destination.organisationId,
|
|
208
227
|
sourceUrl: null
|
|
@@ -216,7 +235,8 @@ const registerCreate = (server, invoke) => {
|
|
|
216
235
|
organisationId: created.organisationId
|
|
217
236
|
},
|
|
218
237
|
accessState: created.accessState,
|
|
219
|
-
openPath: `/c/${created.id}
|
|
238
|
+
openPath: `/c/${created.id}`,
|
|
239
|
+
url: created.url ?? null
|
|
220
240
|
});
|
|
221
241
|
return createMcpResultAdapter("Reconnect Enhance and retry the same intent.").structured(result);
|
|
222
242
|
} catch (error) {
|
package/dist/mcp-main.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as createFileCredentialAdapter } from "./file-credential.adapter-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { s as toCapabilityDefinition } from "./cli-output-identity.lib-DTdmAFNC.mjs";
|
|
3
|
+
import { a as readLocalMcpEnvironment, t as installZodMessages } from "./zod-messages.lib-CH-SDeX_.mjs";
|
|
4
|
+
import { t as createFileCredentialAdapter } from "./file-credential.adapter-CShGZcd5.mjs";
|
|
5
|
+
import { o as createMcpClientContextAdapter, s as createCapabilityCatalogAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-BgNggWKN.mjs";
|
|
6
|
+
import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-C8vXAND1.mjs";
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
@@ -166,23 +166,24 @@ const createMcpTransportCapabilityAdapter = () => capabilities;
|
|
|
166
166
|
|
|
167
167
|
//#endregion
|
|
168
168
|
//#region src/mcp-main.ts
|
|
169
|
+
installZodMessages();
|
|
169
170
|
const clientContext = createMcpClientContextAdapter();
|
|
170
171
|
const main = () => {
|
|
171
172
|
const config = readLocalMcpEnvironment();
|
|
172
|
-
const credentials = createFileCredentialAdapter(config.configDirectory);
|
|
173
|
-
const invocation = createMcpInvocationAdapter(config.apiUrl, credentials, config.configDirectory, { version: "0.1.
|
|
173
|
+
const credentials = createFileCredentialAdapter(config.configDirectory, config.earlierConfigDirectory);
|
|
174
|
+
const invocation = createMcpInvocationAdapter(config.apiUrl, credentials, config.configDirectory, { version: "0.1.166" });
|
|
174
175
|
const catalog = [...createCapabilityCatalogAdapter(), ...createMcpTransportCapabilityAdapter()];
|
|
175
176
|
const client = clientContext.createStdio();
|
|
176
177
|
serveStdio(() => config.profile === "canvas" ? createMcpCanvasProfileAdapter({
|
|
177
178
|
readOnly: config.isReadOnly,
|
|
178
179
|
...config.workflowsDirectory !== void 0 && { workflowsDirectory: config.workflowsDirectory },
|
|
179
180
|
name: config.mcpServiceName,
|
|
180
|
-
version: "0.1.
|
|
181
|
+
version: "0.1.166",
|
|
181
182
|
invocation,
|
|
182
183
|
clientMetadata: client.metadata,
|
|
183
184
|
catalog
|
|
184
185
|
}) : createMcpServerAdapter({
|
|
185
|
-
version: "0.1.
|
|
186
|
+
version: "0.1.166",
|
|
186
187
|
name: config.mcpServiceName,
|
|
187
188
|
commandName: config.commandName,
|
|
188
189
|
invocation,
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { Ar as wholeCanvasDocumentOutputSchema, D as canvasWriteHtmlCapabilityInputSchema, Fr as canvasRenderSourceStateSchema, Gt as hasCanvasReferenceScope, Kt as parseCanvasReference, Lr as canvasRenderTargetSchema, Ut as canvasReferenceRenderTarget, an as CliError, d as createMcpCapabilityDiscoveryAdapter, i as createLazyCapabilityCatalogAdapter, l as toPresentedCapabilities, m as toMcpFailurePayload, n as withCommandName, nn as onSurface, nt as canvasRenderBatchResultSchema, pr as agentClientMetadata, qt as readStoredCanvasScene, r as toCanvasAuthoringResult, st as canvasRenderFileSchema, t as withCommandInFailure, wt as inputProblemFields, xt as canvasEditCapabilityInputSchema } from "./cli-output-identity.lib-DTdmAFNC.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
4
|
+
import { readFile, rm } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
7
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
|
-
import {
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
8
9
|
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
9
10
|
import { CLIENT_INFO_META_KEY, McpServer } from "@modelcontextprotocol/server";
|
|
10
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
11
11
|
|
|
12
|
+
//#region src/infrastructure/capability-catalog.adapter.ts
|
|
13
|
+
/** The description of every command, for a caller that lists or serves them all. */
|
|
14
|
+
const createCapabilityCatalogAdapter = () => createLazyCapabilityCatalogAdapter().all();
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
12
17
|
//#region src/infrastructure/mcp-client-context.adapter.ts
|
|
13
18
|
const requests = new AsyncLocalStorage();
|
|
14
19
|
const initializeSchema = z.object({
|
|
@@ -33,7 +38,7 @@ const withMcpClientContext = (context, action) => {
|
|
|
33
38
|
version: client.version
|
|
34
39
|
}
|
|
35
40
|
});
|
|
36
|
-
return requests.run(metadata, action);
|
|
41
|
+
return requests.run(metadata, () => onSurface("mcp", action));
|
|
37
42
|
};
|
|
38
43
|
const createMcpStdioClientAdapter = (offered) => {
|
|
39
44
|
const native = offered ?? new StdioServerTransport();
|
|
@@ -94,6 +99,7 @@ const createMcpRenderAttachmentAdapter = async (server, result, delivery) => {
|
|
|
94
99
|
}] }));
|
|
95
100
|
return {
|
|
96
101
|
metadata: canvasRenderFileSchema.omit({
|
|
102
|
+
picture: true,
|
|
97
103
|
path: true,
|
|
98
104
|
sensitive: true,
|
|
99
105
|
cleanup: true,
|
|
@@ -242,7 +248,7 @@ const artifactResult = (server, serialized, delivery) => {
|
|
|
242
248
|
structuredContent
|
|
243
249
|
};
|
|
244
250
|
};
|
|
245
|
-
const validationError = (error) => new CliError("BAD_REQUEST", "Input validation error.", "Correct the rejected fields using this tool’s schema, then retry. Describe the exact capability only if its contract is unknown.",
|
|
251
|
+
const validationError = (error) => new CliError("BAD_REQUEST", "Input validation error.", "Correct the rejected fields using this tool’s schema, then retry. Describe the exact capability only if its contract is unknown.", inputProblemFields(error));
|
|
246
252
|
const prepareCanvasResult = async (server, presented, delivery) => {
|
|
247
253
|
const batch = await createMcpRenderBatchResultAdapter(server, presented, delivery);
|
|
248
254
|
if (batch !== null) return batch;
|
|
@@ -580,7 +586,7 @@ const renderTarget = async (input, args) => {
|
|
|
580
586
|
if (held.version !== args.expectedVersion) throw new CliError("CONFLICT", "The canvas changed before rendering.", "Read the selected subtree and render its current version.");
|
|
581
587
|
return {
|
|
582
588
|
canvasId: reference.canvasId,
|
|
583
|
-
target: canvasReferenceRenderTarget(reference,
|
|
589
|
+
target: canvasReferenceRenderTarget(reference, readStoredCanvasScene(held.document), args.target)
|
|
584
590
|
};
|
|
585
591
|
};
|
|
586
592
|
const deliver = async (server, input, action) => {
|
|
@@ -880,4 +886,4 @@ const createMcpServerAdapter = (input) => {
|
|
|
880
886
|
};
|
|
881
887
|
|
|
882
888
|
//#endregion
|
|
883
|
-
export { createMcpResultAdapter as a, mcpDispatchedResultSchema as i, createMcpWorkflowsAdapter as n, createMcpClientContextAdapter as o, createMcpClientInvocationAdapter as r, createMcpServerAdapter as t };
|
|
889
|
+
export { createMcpResultAdapter as a, mcpDispatchedResultSchema as i, createMcpWorkflowsAdapter as n, createMcpClientContextAdapter as o, createMcpClientInvocationAdapter as r, createCapabilityCatalogAdapter as s, createMcpServerAdapter as t };
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { u as toSharedCapabilities } from "./cli-output-identity.lib-DTdmAFNC.mjs";
|
|
3
3
|
import { t as toCapabilityInventory } from "./capability-inventory.mapper-DyYXyVBJ.mjs";
|
|
4
|
-
import { t as createMcpServerAdapter } from "./mcp-server.adapter-
|
|
4
|
+
import { s as createCapabilityCatalogAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-BgNggWKN.mjs";
|
|
5
5
|
|
|
6
6
|
export { createCapabilityCatalogAdapter, createMcpServerAdapter as createEnhanceMcpServer, toCapabilityInventory, toSharedCapabilities };
|