@enhance-eng/enhance 0.1.166 → 0.1.168
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-DTdmAFNC.mjs → cli-output-identity.lib-DMHqCPUz.mjs} +303 -28
- package/dist/main.mjs +167 -113
- package/dist/{mcp-invocation.adapter-C8vXAND1.mjs → mcp-invocation.adapter-YFCrLzlc.mjs} +20 -15
- package/dist/mcp-main.mjs +9 -9
- package/dist/{mcp-server.adapter-BgNggWKN.mjs → mcp-server.adapter-CUuoL6AI.mjs} +83 -72
- package/dist/mcp.mjs +2 -2
- package/dist/remote-mcp-main.mjs +15 -5
- package/dist/{zod-messages.lib-CH-SDeX_.mjs → zod-messages.lib-T23QiUQO.mjs} +43 -12
- package/package.json +1 -1
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-DMHqCPUz.mjs";
|
|
3
|
+
import { a as readLocalMcpEnvironment, t as installZodMessages } from "./zod-messages.lib-T23QiUQO.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 { c as createCapabilityCatalogAdapter, s as createMcpClientContextAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-CUuoL6AI.mjs";
|
|
6
|
+
import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-YFCrLzlc.mjs";
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
@@ -171,26 +171,26 @@ 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.168" });
|
|
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
|
-
...config.workflowsDirectory !== void 0 && {
|
|
179
|
+
...config.workflowsDirectory !== void 0 && { workflows: config.workflowsDirectory },
|
|
180
180
|
name: config.mcpServiceName,
|
|
181
|
-
version: "0.1.
|
|
181
|
+
version: "0.1.168",
|
|
182
182
|
invocation,
|
|
183
183
|
clientMetadata: client.metadata,
|
|
184
184
|
catalog
|
|
185
185
|
}) : createMcpServerAdapter({
|
|
186
|
-
version: "0.1.
|
|
186
|
+
version: "0.1.168",
|
|
187
187
|
name: config.mcpServiceName,
|
|
188
188
|
commandName: config.commandName,
|
|
189
189
|
invocation,
|
|
190
190
|
clientMetadata: client.metadata,
|
|
191
191
|
catalog,
|
|
192
192
|
exposures: ["shared", "mcp-transport"],
|
|
193
|
-
...config.workflowsDirectory !== void 0 && {
|
|
193
|
+
...config.workflowsDirectory !== void 0 && { workflows: config.workflowsDirectory }
|
|
194
194
|
}), {
|
|
195
195
|
legacy: "serve",
|
|
196
196
|
transport: client.transport,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { Br as canvasRenderTargetSchema, D as canvasWriteHtmlCapabilityInputSchema, Gt as hasCanvasReferenceScope, Kt as parseCanvasReference, Nr as wholeCanvasDocumentOutputSchema, Rr as canvasRenderSourceStateSchema, Ut as canvasReferenceRenderTarget, an as SKILL_NAMES, cn as CliError, d as createMcpCapabilityDiscoveryAdapter, gr as agentClientMetadata, i as createLazyCapabilityCatalogAdapter, in as SKILL_JOBS, l as toPresentedCapabilities, m as toMcpFailurePayload, n as withCommandName, nn as onSurface, nt as canvasRenderBatchResultSchema, qt as readStoredCanvasScene, r as toCanvasAuthoringResult, st as canvasRenderFileSchema, t as withCommandInFailure, wt as inputProblemFields, xt as canvasEditCapabilityInputSchema } from "./cli-output-identity.lib-DMHqCPUz.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
5
|
import { readFile, rm } from "node:fs/promises";
|
|
5
6
|
import path from "node:path";
|
|
6
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { createHash, randomUUID } from "node:crypto";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
@@ -478,73 +478,9 @@ const mcpMutationInputSchema = z.object({
|
|
|
478
478
|
clientToken: z.uuid().optional().describe("Stable UUID reused only when retrying this exact mutation input.")
|
|
479
479
|
});
|
|
480
480
|
|
|
481
|
-
//#endregion
|
|
482
|
-
//#region src/infrastructure/mcp-client-invocation.adapter.ts
|
|
483
|
-
const clientContext$2 = createMcpClientContextAdapter();
|
|
484
|
-
const createMcpClientInvocationAdapter = (invocation, legacyClient) => ({ invoke: async (request) => {
|
|
485
|
-
return invocation.invoke({
|
|
486
|
-
...request,
|
|
487
|
-
clientMetadata: clientContext$2.current() ?? legacyClient?.() ?? agentClientMetadata({ path: "local_mcp" })
|
|
488
|
-
});
|
|
489
|
-
} });
|
|
490
|
-
|
|
491
|
-
//#endregion
|
|
492
|
-
//#region src/infrastructure/mcp-workflows.adapter.ts
|
|
493
|
-
const workflowNameSchema = z.enum([
|
|
494
|
-
"apply-canvas-design",
|
|
495
|
-
"design-on-canvas",
|
|
496
|
-
"publish-prototype",
|
|
497
|
-
"respond-to-feedback"
|
|
498
|
-
]);
|
|
499
|
-
const workflowSchema = z.object({
|
|
500
|
-
name: workflowNameSchema,
|
|
501
|
-
description: z.string().min(1),
|
|
502
|
-
body: z.string().min(1)
|
|
503
|
-
});
|
|
504
|
-
const instructions = "Before designing on a canvas, responding to feedback, publishing a prototype or applying a canvas design, call workflow_guide with the matching workflow and follow its guidance.";
|
|
505
|
-
const createMcpWorkflowsAdapter = (directory, authenticationInstructions) => {
|
|
506
|
-
const workflows = workflowNameSchema.options.map((name) => {
|
|
507
|
-
const source = readFileSync(path.join(directory, name, "SKILL.md"), "utf8");
|
|
508
|
-
const match = /^---\r?\nname: ([^\r\n]+)\r?\ndescription: ([^\r\n]+)\r?\n---\r?\n([\s\S]+)$/u.exec(source);
|
|
509
|
-
const workflow = workflowSchema.parse({
|
|
510
|
-
name: match?.[1],
|
|
511
|
-
description: match?.[2],
|
|
512
|
-
body: match?.[3]
|
|
513
|
-
});
|
|
514
|
-
if (workflow.name !== name) throw new Error(`Workflow name does not match its folder: ${name}`);
|
|
515
|
-
return workflow;
|
|
516
|
-
});
|
|
517
|
-
return {
|
|
518
|
-
instructions: [instructions, authenticationInstructions].filter(Boolean).join(" "),
|
|
519
|
-
register: (server) => {
|
|
520
|
-
for (const workflow of workflows) server.registerPrompt(workflow.name, { description: workflow.description }, () => ({ messages: [{
|
|
521
|
-
role: "user",
|
|
522
|
-
content: {
|
|
523
|
-
type: "text",
|
|
524
|
-
text: workflow.body
|
|
525
|
-
}
|
|
526
|
-
}] }));
|
|
527
|
-
server.registerTool("workflow_guide", {
|
|
528
|
-
title: "Load an Enhance workflow",
|
|
529
|
-
description: instructions,
|
|
530
|
-
inputSchema: z.strictObject({ workflow: workflowNameSchema }),
|
|
531
|
-
annotations: {
|
|
532
|
-
readOnlyHint: true,
|
|
533
|
-
destructiveHint: false,
|
|
534
|
-
idempotentHint: true,
|
|
535
|
-
openWorldHint: false
|
|
536
|
-
}
|
|
537
|
-
}, ({ workflow: name }) => ({ content: workflows.filter((workflow) => workflow.name === name).map((workflow) => ({
|
|
538
|
-
type: "text",
|
|
539
|
-
text: workflow.body
|
|
540
|
-
})) }));
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
};
|
|
544
|
-
|
|
545
481
|
//#endregion
|
|
546
482
|
//#region src/infrastructure/mcp-canvas-tools.adapter.ts
|
|
547
|
-
const clientContext$
|
|
483
|
+
const clientContext$2 = createMcpClientContextAdapter();
|
|
548
484
|
const clientToken = z.uuid().optional().describe("Reuse only when retrying this exact mutation.");
|
|
549
485
|
const writeSchema = canvasWriteHtmlCapabilityInputSchema.pick({
|
|
550
486
|
baseVersion: true,
|
|
@@ -608,7 +544,7 @@ const registerWrite = (server, input) => {
|
|
|
608
544
|
idempotentHint: false,
|
|
609
545
|
openWorldHint: false
|
|
610
546
|
}
|
|
611
|
-
}, async ({ canvas, clientToken: token, ...args }, context) => clientContext$
|
|
547
|
+
}, async ({ canvas, clientToken: token, ...args }, context) => clientContext$2.run(context, async () => deliver(server, input, async () => {
|
|
612
548
|
const reference = parseCanvasReference(canvas);
|
|
613
549
|
return invoke(input, "canvas.writeHtml", {
|
|
614
550
|
...args,
|
|
@@ -635,7 +571,7 @@ const registerEdit = (server, input) => {
|
|
|
635
571
|
idempotentHint: false,
|
|
636
572
|
openWorldHint: false
|
|
637
573
|
}
|
|
638
|
-
}, async ({ clientToken: token, ...args }, context) => clientContext$
|
|
574
|
+
}, async ({ clientToken: token, ...args }, context) => clientContext$2.run(context, async () => deliver(server, input, async () => invoke(input, "canvas.edit", args, token ?? null))));
|
|
639
575
|
};
|
|
640
576
|
const registerRender = (server, input) => {
|
|
641
577
|
if (input.catalog.some((capability) => capability.id === "canvas.render")) server.registerTool("canvas_render", {
|
|
@@ -649,7 +585,7 @@ const registerRender = (server, input) => {
|
|
|
649
585
|
idempotentHint: false,
|
|
650
586
|
openWorldHint: false
|
|
651
587
|
}
|
|
652
|
-
}, async (args, context) => clientContext$
|
|
588
|
+
}, async (args, context) => clientContext$2.run(context, async () => deliver(server, input, async () => invoke(input, "canvas.render", {
|
|
653
589
|
...await renderTarget(input, args),
|
|
654
590
|
expectedVersion: args.expectedVersion,
|
|
655
591
|
sourceState: args.sourceState,
|
|
@@ -670,6 +606,81 @@ const createMcpCanvasToolsAdapter = (input) => ({ register: (server) => {
|
|
|
670
606
|
if (selected.includes("render")) registerRender(server, input);
|
|
671
607
|
} });
|
|
672
608
|
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/infrastructure/mcp-client-invocation.adapter.ts
|
|
611
|
+
const clientContext$1 = createMcpClientContextAdapter();
|
|
612
|
+
const createMcpClientInvocationAdapter = (invocation, legacyClient) => ({ invoke: async (request) => {
|
|
613
|
+
return invocation.invoke({
|
|
614
|
+
...request,
|
|
615
|
+
clientMetadata: clientContext$1.current() ?? legacyClient?.() ?? agentClientMetadata({ path: "local_mcp" })
|
|
616
|
+
});
|
|
617
|
+
} });
|
|
618
|
+
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/infrastructure/mcp-workflows.adapter.ts
|
|
621
|
+
/** The guide offers exactly the skills of the one source, by their short names. */
|
|
622
|
+
const workflowNameSchema = z.enum(SKILL_NAMES);
|
|
623
|
+
const workflowSchema = z.object({
|
|
624
|
+
name: workflowNameSchema,
|
|
625
|
+
description: z.string().min(1),
|
|
626
|
+
body: z.string().min(1)
|
|
627
|
+
});
|
|
628
|
+
const instructions = `Before ${SKILL_JOBS.slice(0, -1).join(", ")} or ${SKILL_JOBS.at(-1) ?? ""}, call workflow_guide with the matching workflow and follow its guidance.`;
|
|
629
|
+
/** A skill's file, or a failure that names the skill the folder lacks. */
|
|
630
|
+
const skillFileOf = (directory, name) => {
|
|
631
|
+
try {
|
|
632
|
+
return readFileSync(path.join(directory, name, "SKILL.md"), "utf8");
|
|
633
|
+
} catch (error) {
|
|
634
|
+
throw new Error(`The workflows folder holds no ${name} skill: ${directory}`, { cause: error });
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
/** One skill as a folder holds it, or a failure that names what is wrong with its file. */
|
|
638
|
+
const workflowIn = (directory, name) => {
|
|
639
|
+
const source = skillFileOf(directory, name);
|
|
640
|
+
const match = /^---\r?\nname: ([^\r\n]+)\r?\ndescription: ([^\r\n]+)\r?\n---\r?\n([\s\S]+)$/u.exec(source);
|
|
641
|
+
const workflow = workflowSchema.parse({
|
|
642
|
+
name: match?.[1],
|
|
643
|
+
description: match?.[2],
|
|
644
|
+
body: match?.[3]
|
|
645
|
+
});
|
|
646
|
+
if (workflow.name !== name) throw new Error(`Workflow name does not match its folder: ${name}`);
|
|
647
|
+
return workflow;
|
|
648
|
+
};
|
|
649
|
+
/** The guide tool over a folder of skills, or over skills already written for tools. */
|
|
650
|
+
const createMcpWorkflowsAdapter = (skills, authenticationInstructions) => {
|
|
651
|
+
const workflows = typeof skills === "string" ? workflowNameSchema.options.map((name) => workflowIn(skills, name)) : skills.map(({ skill, description, body }) => ({
|
|
652
|
+
name: skill,
|
|
653
|
+
description,
|
|
654
|
+
body
|
|
655
|
+
}));
|
|
656
|
+
return {
|
|
657
|
+
instructions: [instructions, authenticationInstructions].filter(Boolean).join(" "),
|
|
658
|
+
register: (server) => {
|
|
659
|
+
for (const workflow of workflows) server.registerPrompt(workflow.name, { description: workflow.description }, () => ({ messages: [{
|
|
660
|
+
role: "user",
|
|
661
|
+
content: {
|
|
662
|
+
type: "text",
|
|
663
|
+
text: workflow.body
|
|
664
|
+
}
|
|
665
|
+
}] }));
|
|
666
|
+
server.registerTool("workflow_guide", {
|
|
667
|
+
title: "Load an Enhance workflow",
|
|
668
|
+
description: instructions,
|
|
669
|
+
inputSchema: z.strictObject({ workflow: workflowNameSchema }),
|
|
670
|
+
annotations: {
|
|
671
|
+
readOnlyHint: true,
|
|
672
|
+
destructiveHint: false,
|
|
673
|
+
idempotentHint: true,
|
|
674
|
+
openWorldHint: false
|
|
675
|
+
}
|
|
676
|
+
}, ({ workflow: name }) => ({ content: workflows.filter((workflow) => workflow.name === name).map((workflow) => ({
|
|
677
|
+
type: "text",
|
|
678
|
+
text: workflow.body
|
|
679
|
+
})) }));
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
|
|
673
684
|
//#endregion
|
|
674
685
|
//#region src/infrastructure/capability-catalogue-text.mapper.ts
|
|
675
686
|
const MAX_LINE_CHARACTERS = 180;
|
|
@@ -852,7 +863,7 @@ const registerMutation = (server, catalog, invocation, execution) => {
|
|
|
852
863
|
};
|
|
853
864
|
const createMcpServerAdapter = (input) => {
|
|
854
865
|
const authenticationInstructions = input.exposures?.includes("mcp-transport") === true ? AUTHENTICATION_INSTRUCTIONS : void 0;
|
|
855
|
-
const workflows = input.
|
|
866
|
+
const workflows = input.workflows === void 0 ? void 0 : createMcpWorkflowsAdapter(input.workflows, authenticationInstructions);
|
|
856
867
|
const instructions = workflows?.instructions ?? authenticationInstructions;
|
|
857
868
|
const server = new McpServer({
|
|
858
869
|
name: input.name ?? "enhance-mcp",
|
|
@@ -886,4 +897,4 @@ const createMcpServerAdapter = (input) => {
|
|
|
886
897
|
};
|
|
887
898
|
|
|
888
899
|
//#endregion
|
|
889
|
-
export {
|
|
900
|
+
export { mcpDispatchedResultSchema as a, createCapabilityCatalogAdapter as c, createMcpCanvasToolsAdapter as i, createMcpWorkflowsAdapter as n, createMcpResultAdapter as o, createMcpClientInvocationAdapter as r, createMcpClientContextAdapter as s, createMcpServerAdapter as t };
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { u as toSharedCapabilities } from "./cli-output-identity.lib-
|
|
2
|
+
import { u as toSharedCapabilities } from "./cli-output-identity.lib-DMHqCPUz.mjs";
|
|
3
3
|
import { t as toCapabilityInventory } from "./capability-inventory.mapper-DyYXyVBJ.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { c as createCapabilityCatalogAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-CUuoL6AI.mjs";
|
|
5
5
|
|
|
6
6
|
export { createCapabilityCatalogAdapter, createMcpServerAdapter as createEnhanceMcpServer, toCapabilityInventory, toSharedCapabilities };
|
package/dist/remote-mcp-main.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as canvasAssetImportInputSchema, L as canvasPrototypeIntentSchema,
|
|
3
|
-
import { h as createImportCanvasAssetComposite, m as createPublishCanvasPrototypeComposite, n as createMutationKeyAdapter, o as readRemoteMcpEnvironment, p as createPrototypeArtifactAdapter, r as createHttpRemoteAdapter, t as installZodMessages } from "./zod-messages.lib-
|
|
4
|
-
import {
|
|
5
|
-
import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-
|
|
2
|
+
import { $ as canvasAssetImportInputSchema, Dn as getMeOutputSchema, L as canvasPrototypeIntentSchema, On as MCP_AUTH_SCOPE, R as canvasPrototypeOutputSchema, S as PROTOTYPE_UPDATE_GUIDANCE, Tn as prototypeArtifactPathSchema, cn as CliError, di as signedDownloadSchema, et as canvasAssetImportOutputSchema, on as skillTextsFor, rn as MCP_TOOL_BY_CAPABILITY, xn as foldPrototypeArtifactPath } from "./cli-output-identity.lib-DMHqCPUz.mjs";
|
|
3
|
+
import { h as createImportCanvasAssetComposite, m as createPublishCanvasPrototypeComposite, n as createMutationKeyAdapter, o as readRemoteMcpEnvironment, p as createPrototypeArtifactAdapter, r as createHttpRemoteAdapter, t as installZodMessages } from "./zod-messages.lib-T23QiUQO.mjs";
|
|
4
|
+
import { c as createCapabilityCatalogAdapter, o as createMcpResultAdapter, s as createMcpClientContextAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-CUuoL6AI.mjs";
|
|
5
|
+
import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-YFCrLzlc.mjs";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { mkdir, mkdtemp, readFile, rm } from "node:fs/promises";
|
|
@@ -598,6 +598,14 @@ const createMcpHostedFilesAdapter = (input) => ({ register: (server) => {
|
|
|
598
598
|
//#endregion
|
|
599
599
|
//#region src/infrastructure/mcp-http-profile.adapter.ts
|
|
600
600
|
const clientContext = createMcpClientContextAdapter();
|
|
601
|
+
/**
|
|
602
|
+
* What `workflow_guide` answers with on a hosted connection: the skills of the one source, worded
|
|
603
|
+
* for tools, where the plugin's own server reads the folder its build wrote from that source.
|
|
604
|
+
*/
|
|
605
|
+
const workflows = skillTextsFor({
|
|
606
|
+
surface: "mcp",
|
|
607
|
+
nameOf: (capability) => MCP_TOOL_BY_CAPABILITY[capability]
|
|
608
|
+
});
|
|
601
609
|
/** The tools that import a file, fetching only from the origins `files` allows. */
|
|
602
610
|
const hostedFilesFor = (files, apiUrl, credentials) => createMcpHostedFilesAdapter({
|
|
603
611
|
files,
|
|
@@ -624,6 +632,7 @@ const createMcpHttpProfileAdapter = (config, catalog, credentialFor, profile) =>
|
|
|
624
632
|
}));
|
|
625
633
|
return profile.kind === "canvas" ? createMcpCanvasProfileAdapter({
|
|
626
634
|
version: config.version,
|
|
635
|
+
workflows,
|
|
627
636
|
...hosted,
|
|
628
637
|
delivery: "embedded",
|
|
629
638
|
authentication: "oauth",
|
|
@@ -632,6 +641,7 @@ const createMcpHttpProfileAdapter = (config, catalog, credentialFor, profile) =>
|
|
|
632
641
|
readOnly: profile.readOnly
|
|
633
642
|
}) : createMcpServerAdapter({
|
|
634
643
|
version: config.version,
|
|
644
|
+
workflows,
|
|
635
645
|
...hosted,
|
|
636
646
|
delivery: "embedded"
|
|
637
647
|
});
|
|
@@ -818,7 +828,7 @@ const server = await createRemoteMcpHttpAdapter({
|
|
|
818
828
|
...config.MCP_STAGED_UPLOAD_ORIGIN !== void 0 && { stagedUploadOrigin: config.MCP_STAGED_UPLOAD_ORIGIN },
|
|
819
829
|
allowedHosts: config.MCP_ALLOWED_HOSTS.split(",").map((value) => value.trim()),
|
|
820
830
|
allowedOrigins: config.MCP_ALLOWED_ORIGINS.split(",").map((value) => value.trim()),
|
|
821
|
-
version: "0.1.
|
|
831
|
+
version: "0.1.168",
|
|
822
832
|
...config.MCP_UI_URL !== void 0 && { uiUrl: config.MCP_UI_URL },
|
|
823
833
|
onerror: (error) => process.stderr.write(`${error.message}\n`)
|
|
824
834
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $n as
|
|
2
|
+
import { $n as applyCanvasTypographyPatch, $r as canvasAxisStyleProperties, $t as inSurfaceWords, A as recordingSnapshotCapabilityInputSchema, An as createAgentTokenOutputSchema, Ar as textOf, At as canvasSnapshotToken, Bt as canvasResourcesCursorSchema, Cn as getPrototypePublishStatusOutputSchema, Cr as RECTANGLE_KIND, D as canvasWriteHtmlCapabilityInputSchema, Dn as getMeOutputSchema, Dr as applyCanvasOperationsOutputSchema, E as canvasRenderCapabilityInputSchema, En as submitPrototypeArtifactOutputSchema, Er as applyCanvasOperationsInputSchema, F as canvasPrototypeCapabilityInputSchema, Fr as canvasNodeStylePatchSchema, Ft as canvasReadInputSchema, Gr as getCanvasRenderOutputSchema, Gt as hasCanvasReferenceScope, Hr as createCanvasRenderOutputSchema, Ht as canvasReferenceNodeIds, Ir as createCanvasConversionOutputSchema, J as canvasDuplicateCapabilityInputSchema, Jt as callOf, K as canvasArrangeCapabilityInputSchema, Kr as canvasReadableSceneDocumentSchema, Kt as parseCanvasReference, Lr as getCanvasConversionOutputSchema, Lt as canvasUpdateHtmlCapabilityInputSchema, M as canvasCapturePageCapabilityInputSchema, Mn as listOrganisationsOutputSchema, Mt as encodeCanvasExchangeToken, Nr as wholeCanvasDocumentOutputSchema, Nt as resolveCanvasSnapshot, O as commentAttentionCapabilityInputSchema, Or as getCanvasMutationOutputSchema, Pt as canvasOutlineCursorSchema, Q as canvasAssetImportCapabilityInputSchema, Qn as createCapturePassOutputSchema, Qr as canvasAuthoredStyleDeclarations, Qt as diagnosisStep, Rt as canvasUpdateHtmlInputSchema, Sn as getPrototypeArtifactCapabilitiesOutputSchema, Sr as PAGE_KIND, T as canvasReadCapabilityInputSchema, Tn as prototypeArtifactPathSchema, Tr as TEXT_KIND, Tt as inputProblemSummary, U as canvasCaptureCapabilityInputSchema, Ur as createRecordingSnapshotOutputSchema, V as operationStatusInputSchema, Vt as assertCanvasReferenceNodes, Wr as downloadCanvasRenderOutputSchema, Xr as canvasRecordedBoxNoteFor, Xt as commandName, Yr as canvasBoxSourceOf, Yt as cliPathOf, Zt as currentNodeIdStep, _i as CANVAS_BLEND_MODES, _r as createCanvasPreparationOutputSchema, _t as canvasInsertHtmlCapabilityInputSchema, ai as canvasCssValue, ar as canvasCaptureSchema, bn as createPrototypeArtifactOutputSchema, br as GROUP_KIND, ci as reserveCanvasAssetOutputSchema, cn as CliError, cr as canvasRecordingPropsSchema, ct as canvasRemoveCapabilityInputSchema, dr as canvasReferencePageOf, ei as canvasCssPixelValue, en as inputName, er as canvasCssTypographyOwners, et as canvasAssetImportOutputSchema, fi as canvasRichTextOf, fr as resolveCanvasReference, ft as canvasFindCursorSchema, g as toRemoteError, gi as canvasAdditionalStyleSchema, gn as getRecordingOutputSchema, gt as listedCanvasesAnswerSchema, hi as CANVAS_RICH_TEXT_STYLE_PROPERTIES, hr as AGENT_CLIENT_HEADER, ii as canvasCssTokens, ir as CAPTURE_LANDING_CONVERTING, j as transcriptReadCapabilityInputSchema, jr as mapCanvasFontSources, jt as decodeCanvasExchangeToken, k as prototypePublishCapabilityInputSchema, kn as cliAuthConfigurationSchema, kr as canvasLayoutWithoutCssProperties, kt as canvasExchangeDigest, li as canvasFontAssetIdentityFromPath, ln as isFormatRefusalError, lr as captureLandingSchema, mi as hasCanvasRichTextPaints, ni as canvasLayoutPositionOf, nr as canvasTextPropsWithContent, oi as canvasAssetUploadOutputSchema, or as canvasConversionMetadataSchema, ot as canvasRenderRequestSchema, pi as canvasRichTextValueOf, pr as beginCanvasActivityOutputSchema, pt as canvasFindInputSchema, qr as canvasSceneDocumentSchema, qt as readStoredCanvasScene, rt as canvasRenderPendingSchema, si as reserveCanvasAssetInputSchema, sn as PartialBatchError, sr as canvasPrototypePropsSchema, st as canvasRenderFileSchema, tn as layerListName, tr as canvasTextChangeBetween, tt as canvasRenderBatchRequestSchema, ui as canvasImageAssetIdentityFromPath, un as transcriptOutputSchema, ur as DEFAULT_CANVAS_REFERENCE_PAGE_ID, vi as canvasBlendModeSchema, vn as PROTOTYPE_ARTIFACT_MANIFEST_PATH, vr as getCanvasPreparationOutputSchema, w as canvasApplyCapabilityInputSchema, wn as prototypeArtifactManifestSchema, wr as SCREEN_KIND, wt as inputProblemFields, xn as foldPrototypeArtifactPath, xr as IMAGE_KIND, xt as canvasEditCapabilityInputSchema, yi as canvasPaintSchema, yn as attachPrototypeArtifactOutputSchema, yr as FRAME_KIND, yt as canvasMakeEditableCapabilityInputSchema, zr as canvasRenderStateSchema, zt as canvasTranscriptCursorSchema } from "./cli-output-identity.lib-DMHqCPUz.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { access, mkdtemp, open, readFile, realpath, rm, stat } from "node:fs/promises";
|
|
@@ -16,8 +16,8 @@ import { performance as performance$1 } from "node:perf_hooks";
|
|
|
16
16
|
import { Transform } from "node:stream";
|
|
17
17
|
import { pipeline } from "node:stream/promises";
|
|
18
18
|
import { ZipFile } from "yazl";
|
|
19
|
-
import { createTRPCUntypedClient, httpLink } from "@trpc/client";
|
|
20
19
|
import { spawn } from "node:child_process";
|
|
20
|
+
import { createTRPCUntypedClient, httpLink } from "@trpc/client";
|
|
21
21
|
import { createServer } from "node:http";
|
|
22
22
|
|
|
23
23
|
//#region ../../packages/canvas-format/src/canvas-sort-key.lib.ts
|
|
@@ -5164,6 +5164,15 @@ const makeCanvasEditable = async (remote, offered) => {
|
|
|
5164
5164
|
const READ_IMPORT_PROCEDURE = "canvas.render.getImport";
|
|
5165
5165
|
const MAX_ACTIVITY_NODE_IDS = 100;
|
|
5166
5166
|
const MAX_RECEIPT_ENTRIES = 40;
|
|
5167
|
+
/** Problems that mean part of the HTML is not on the canvas, not only drawn less faithfully. */
|
|
5168
|
+
const LOST_CONTENT_CODES = /* @__PURE__ */ new Set([
|
|
5169
|
+
"asset-unavailable",
|
|
5170
|
+
"content-omitted",
|
|
5171
|
+
"cross-origin-frame",
|
|
5172
|
+
"nodes-truncated",
|
|
5173
|
+
"unsupported-surface"
|
|
5174
|
+
]);
|
|
5175
|
+
const LEFT_OUT_STEP = "Some of the HTML was not written as asked. Tell the person what was left out before you continue.";
|
|
5167
5176
|
const failedReview = (error, input, version) => {
|
|
5168
5177
|
return {
|
|
5169
5178
|
state: "failed",
|
|
@@ -5220,6 +5229,21 @@ const createdNodes = async (remote, imported) => {
|
|
|
5220
5229
|
};
|
|
5221
5230
|
});
|
|
5222
5231
|
};
|
|
5232
|
+
const conversionReport = (imported) => {
|
|
5233
|
+
const { issues } = imported.result.report;
|
|
5234
|
+
return {
|
|
5235
|
+
issueCount: issues.length,
|
|
5236
|
+
partial: issues.some((issue) => LOST_CONTENT_CODES.has(issue.code)),
|
|
5237
|
+
issues: issues.slice(0, MAX_RECEIPT_ENTRIES).map((issue) => {
|
|
5238
|
+
const nodeId = issue.temporaryId === void 0 ? void 0 : imported.result.idMap[issue.temporaryId];
|
|
5239
|
+
return {
|
|
5240
|
+
code: issue.code,
|
|
5241
|
+
message: issue.message,
|
|
5242
|
+
...nodeId !== void 0 && { nodeId }
|
|
5243
|
+
};
|
|
5244
|
+
})
|
|
5245
|
+
};
|
|
5246
|
+
};
|
|
5223
5247
|
const committedResponse = (input, imported) => ({
|
|
5224
5248
|
canvasId: input.canvasId,
|
|
5225
5249
|
mutationCommitted: true,
|
|
@@ -5237,7 +5261,9 @@ const committedResponse = (input, imported) => ({
|
|
|
5237
5261
|
changed: 0,
|
|
5238
5262
|
removed: imported.result.removedNodeIds.length
|
|
5239
5263
|
},
|
|
5240
|
-
affectedBounds: imported.result.affectedBounds
|
|
5264
|
+
affectedBounds: imported.result.affectedBounds,
|
|
5265
|
+
report: conversionReport(imported),
|
|
5266
|
+
...imported.result.report.issues.length > 0 && { next: [LEFT_OUT_STEP] }
|
|
5241
5267
|
});
|
|
5242
5268
|
const pendingResponse = (job) => ({
|
|
5243
5269
|
state: "pending",
|
|
@@ -5297,18 +5323,23 @@ const createWriteHtmlCanvasComposite = (remote, render) => ({ execute: async (in
|
|
|
5297
5323
|
bounds: imported.result.affectedBounds
|
|
5298
5324
|
});
|
|
5299
5325
|
const review = await renderReview(render, input, imported);
|
|
5300
|
-
|
|
5326
|
+
const committed = committedResponse(input, imported);
|
|
5327
|
+
const next = [...committed.next ?? [], "Inspect the review PNG before continuing."];
|
|
5301
5328
|
try {
|
|
5302
|
-
|
|
5329
|
+
return {
|
|
5330
|
+
...committed,
|
|
5331
|
+
createdNodes: await createdNodes(remote, imported),
|
|
5332
|
+
review,
|
|
5333
|
+
next
|
|
5334
|
+
};
|
|
5303
5335
|
} catch {
|
|
5304
|
-
|
|
5336
|
+
return {
|
|
5337
|
+
...committed,
|
|
5338
|
+
review,
|
|
5339
|
+
next,
|
|
5340
|
+
warnings: ["The names of the created layers could not be read."]
|
|
5341
|
+
};
|
|
5305
5342
|
}
|
|
5306
|
-
return {
|
|
5307
|
-
...committedResponse(input, imported),
|
|
5308
|
-
createdNodes: nodes,
|
|
5309
|
-
review,
|
|
5310
|
-
next: ["Inspect the review PNG before continuing."]
|
|
5311
|
-
};
|
|
5312
5343
|
} finally {
|
|
5313
5344
|
await activity?.finish();
|
|
5314
5345
|
}
|