@enhance-eng/enhance 0.1.39 → 0.1.158

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { A as operationStatusOutputSchema, D as canvasConversionStatusSchema, F as canvasArrangeInputSchema, H as canvasCaptureOutputSchema, L as canvasDuplicateInputSchema, M as canvasAssetImportInputSchema, N as canvasAssetImportOutputSchema, Nr as createCanvasOutputSchema, O as operationStatusImageSchema, R as canvasPreparationOutputSchema, S as canvasExchangeDigest, T as encodeCanvasExchangeToken, V as canvasCaptureInputSchema, _n as screenElementsCommentTargetSchema, _t as canvasFindOutputSchema, an as commentMessageSchema, at as canvasRemoveInputSchema, cn as domLocatorSchema, ct as canvasReadOutputSchema, dn as listCommentsInputSchema, f as createCapabilityCatalogAdapter, fn as listCommentsOutputSchema, gn as screenElementCommentTargetSchema, gt as canvasFindInputSchema, hn as screenAreaCommentTargetSchema, in as commentCanvasContextSchema, jt as CliError, k as operationStatusInputSchema, kt as parseCanvasReference, ln as elementAnchorSchema, mn as replyCommentOutputSchema, mt as canvasCreateToolOutputSchema, o as toMcpFailurePayload, on as commentResolverSchema, pn as replyCommentInputSchema, pt as canvasCreateToolInputSchema, rn as commentAuthorSchema, sn as commentThreadSchema, st as canvasReadInputSchema, tt as canvasRenderScopedToolInputSchema, un as getCommentOutputSchema, ut as canvasUpdateHtmlInputSchema, vn as screenTextCommentTargetSchema, w as decodeCanvasExchangeToken, x as canvasPrototypeOutputSchema, xt as canvasMakeEditableInputSchema, y as canvasPrototypeInputSchema, yn as startCommentInputSchema, yt as canvasInsertHtmlInputSchema, z as canvasWriteReceiptSchema } from "./cli-output-identity.lib-DgHRuXTI.mjs";
3
- import { S as createAuthUseCase, h as fromCapabilityReference, m as boundedResultPage, n as createHttpRemoteAdapter, o as createOauthLoopbackAdapter, s as createCapabilityInvocationAdapter, t as createMutationKeyAdapter } from "./mutation-key.adapter-BWkNj5jp.mjs";
4
- import { a as createMcpResultAdapter, i as mcpDispatchedResultSchema, n as createMcpWorkflowsAdapter, o as createMcpClientContextAdapter, r as createMcpClientInvocationAdapter } from "./mcp-server.adapter-DOHJxL6l.mjs";
2
+ import { A as operationStatusImageSchema, B as canvasPreparationOutputSchema, C as canvasPrototypeOutputSchema, Ct as canvasMakeEditableInputSchema, D as encodeCanvasExchangeToken, E as decodeCanvasExchangeToken, F as canvasAssetImportOutputSchema, Fr as createCanvasOutputSchema, L as canvasArrangeInputSchema, M as operationStatusOutputSchema, Nt as CliError, P as canvasAssetImportInputSchema, U as canvasCaptureInputSchema, V as canvasWriteReceiptSchema, W as canvasCaptureOutputSchema, _n as screenAreaCommentTargetSchema, an as commentAuthorSchema, bn as screenTextCommentTargetSchema, cn as commentResolverSchema, dn as elementAnchorSchema, fn as getCommentOutputSchema, ft as canvasUpdateHtmlInputSchema, gn as replyCommentOutputSchema, gt as canvasCreateToolOutputSchema, hn as replyCommentInputSchema, ht as canvasCreateToolInputSchema, j as operationStatusInputSchema, jt as parseCanvasReference, k as canvasConversionStatusSchema, l as toMcpFailurePayload, ln as commentThreadSchema, lt as canvasReadInputSchema, mn as listCommentsOutputSchema, on as commentCanvasContextSchema, p as createCapabilityCatalogAdapter, pn as listCommentsInputSchema, rt as canvasRenderScopedToolInputSchema, sn as commentMessageSchema, st as canvasRemoveInputSchema, un as domLocatorSchema, ut as canvasReadOutputSchema, v as PROTOTYPE_UPDATE_GUIDANCE, vn as screenElementCommentTargetSchema, vt as canvasFindInputSchema, w as canvasExchangeDigest, x as canvasPrototypeInputSchema, xn as startCommentInputSchema, xt as canvasInsertHtmlInputSchema, yn as screenElementsCommentTargetSchema, yt as canvasFindOutputSchema, z as canvasDuplicateInputSchema } from "./cli-output-identity.lib-DBMayAFH.mjs";
3
+ import { S as createAuthUseCase, h as fromCapabilityReference, m as boundedResultPage, n as createHttpRemoteAdapter, o as createOauthLoopbackAdapter, s as createCapabilityInvocationAdapter, t as createMutationKeyAdapter } from "./mutation-key.adapter-DKwaV7lk.mjs";
4
+ import { a as createMcpResultAdapter, i as mcpDispatchedResultSchema, n as createMcpWorkflowsAdapter, o as createMcpClientContextAdapter, r as createMcpClientInvocationAdapter } from "./mcp-server.adapter-D1D-6M_L.mjs";
5
5
  import { z } from "zod";
6
6
  import { McpServer } from "@modelcontextprotocol/server";
7
7
 
@@ -1129,7 +1129,7 @@ const clientContext$2 = createMcpClientContextAdapter();
1129
1129
  const createMcpPrototypePublishAdapter = (invoke) => ({ register: (server) => {
1130
1130
  server.registerTool("prototype_publish", {
1131
1131
  title: "Publish a prototype to the canvas",
1132
- description: "Publish a selected, unpacked static build directory through the native artifact pipeline, or resume its deployment. Runnable builds may execute scripts and contact external services when opened. Preserve the complete canvas/page/selection link and baseVersion. Deployment readiness and canvas attachment are reported separately. Poll operation_status for ingestion; call this tool again to attach. Retry uncertainty with identical arguments and clientToken. After an unrelated canvas edit, reuse the ready deployment and clientToken with a deliberate revised baseVersion; do not re-upload. A changed destination or scope requires a new attachment intent. This does not build source code or verify the resulting UI.",
1132
+ description: `Publish a selected, unpacked static build directory through the native artifact pipeline, or resume its deployment. ${PROTOTYPE_UPDATE_GUIDANCE} Runnable builds may execute scripts and contact external services when opened. Preserve the complete canvas/page/selection link and baseVersion. Deployment readiness and canvas attachment are reported separately. Poll operation_status for ingestion; call this tool again to attach. Retry uncertainty with identical arguments and clientToken. After an unrelated canvas edit, reuse the ready deployment and clientToken with a deliberate revised baseVersion; do not re-upload. A changed destination or scope requires a new attachment intent. This does not build source code or verify the resulting UI.`,
1133
1133
  inputSchema: canvasPrototypeInputSchema,
1134
1134
  outputSchema: canvasPrototypeOutputSchema,
1135
1135
  annotations: {
package/dist/mcp-main.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { f as createCapabilityCatalogAdapter, h as toCapabilityDefinition } from "./cli-output-identity.lib-DgHRuXTI.mjs";
3
- import { i as readLocalMcpEnvironment } from "./mutation-key.adapter-BWkNj5jp.mjs";
2
+ import { g as toCapabilityDefinition, p as createCapabilityCatalogAdapter } from "./cli-output-identity.lib-DBMayAFH.mjs";
3
+ import { i as readLocalMcpEnvironment } from "./mutation-key.adapter-DKwaV7lk.mjs";
4
4
  import { t as createFileCredentialAdapter } from "./file-credential.adapter-C78gc9OK.mjs";
5
- import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-CjZnnMCd.mjs";
6
- import { o as createMcpClientContextAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-DOHJxL6l.mjs";
5
+ import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-HEKcQv-G.mjs";
6
+ import { o as createMcpClientContextAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-D1D-6M_L.mjs";
7
7
  import process from "node:process";
8
8
  import { z } from "zod";
9
9
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
@@ -170,19 +170,19 @@ const clientContext = createMcpClientContextAdapter();
170
170
  const main = () => {
171
171
  const config = readLocalMcpEnvironment();
172
172
  const credentials = createFileCredentialAdapter(config.configDirectory);
173
- const invocation = createMcpInvocationAdapter(config.apiUrl, credentials, config.configDirectory, { version: "0.1.39" });
173
+ const invocation = createMcpInvocationAdapter(config.apiUrl, credentials, config.configDirectory, { version: "0.1.158" });
174
174
  const catalog = [...createCapabilityCatalogAdapter(), ...createMcpTransportCapabilityAdapter()];
175
175
  const client = clientContext.createStdio();
176
176
  serveStdio(() => config.profile === "canvas" ? createMcpCanvasProfileAdapter({
177
177
  readOnly: config.isReadOnly,
178
178
  ...config.workflowsDirectory !== void 0 && { workflowsDirectory: config.workflowsDirectory },
179
179
  name: config.mcpServiceName,
180
- version: "0.1.39",
180
+ version: "0.1.158",
181
181
  invocation,
182
182
  clientMetadata: client.metadata,
183
183
  catalog
184
184
  }) : createMcpServerAdapter({
185
- version: "0.1.39",
185
+ version: "0.1.158",
186
186
  name: config.mcpServiceName,
187
187
  commandName: config.commandName,
188
188
  invocation,
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Et as canvasReferenceRenderTarget, Fn as agentClientMetadata, K as canvasWriteHtmlCapabilityInputSchema, Ot as hasCanvasReferenceScope, Q as canvasRenderBatchResultSchema, St as canvasEditCapabilityInputSchema, Xn as getCanvasDocumentOutputSchema, c as toPresentedCapabilities, f as createCapabilityCatalogAdapter, ir as canvasRenderTargetSchema, jt as CliError, kt as parseCanvasReference, n as withCommandName, nr as canvasRenderSourceStateSchema, o as toMcpFailurePayload, r as toCanvasAuthoringResult, rt as canvasRenderFileSchema, t as withCommandInFailure, u as createMcpCapabilityDiscoveryAdapter, ur as canvasReadableSceneDocumentSchema } from "./cli-output-identity.lib-DgHRuXTI.mjs";
2
+ import { $n as wholeCanvasDocumentOutputSchema, At as hasCanvasReferenceScope, J as canvasWriteHtmlCapabilityInputSchema, Ln as agentClientMetadata, Nt as CliError, Ot as canvasReferenceRenderTarget, at as canvasRenderFileSchema, et as canvasRenderBatchResultSchema, fr as canvasReadableSceneDocumentSchema, i as toPresentedCapabilities, ir as canvasRenderSourceStateSchema, jt as parseCanvasReference, l as toMcpFailurePayload, n as withCommandName, o as createMcpCapabilityDiscoveryAdapter, or as canvasRenderTargetSchema, p as createCapabilityCatalogAdapter, r as toCanvasAuthoringResult, t as withCommandInFailure, wt as canvasEditCapabilityInputSchema } from "./cli-output-identity.lib-DBMayAFH.mjs";
3
3
  import { z } from "zod";
4
4
  import { readFileSync } from "node:fs";
5
5
  import path from "node:path";
@@ -576,7 +576,7 @@ const renderTarget = async (input, args) => {
576
576
  canvasId: reference.canvasId,
577
577
  target: args.target
578
578
  };
579
- const held = getCanvasDocumentOutputSchema.parse(await invoke(input, "canvas.document.get", { canvasId: reference.canvasId }));
579
+ const held = wholeCanvasDocumentOutputSchema.parse(await invoke(input, "canvas.document.get", { canvasId: reference.canvasId }));
580
580
  if (held.version !== args.expectedVersion) throw new CliError("CONFLICT", "The canvas changed before rendering.", "Read the selected subtree and render its current version.");
581
581
  return {
582
582
  canvasId: reference.canvasId,
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { f as createCapabilityCatalogAdapter, l as toSharedCapabilities } from "./cli-output-identity.lib-DgHRuXTI.mjs";
2
+ import { a as toSharedCapabilities, p as createCapabilityCatalogAdapter } from "./cli-output-identity.lib-DBMayAFH.mjs";
3
3
  import { t as toCapabilityInventory } from "./capability-inventory.mapper-DyYXyVBJ.mjs";
4
- import { t as createMcpServerAdapter } from "./mcp-server.adapter-DOHJxL6l.mjs";
4
+ import { t as createMcpServerAdapter } from "./mcp-server.adapter-D1D-6M_L.mjs";
5
5
 
6
6
  export { createCapabilityCatalogAdapter, createMcpServerAdapter as createEnhanceMcpServer, toCapabilityInventory, toSharedCapabilities };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as canvasRenderPendingSchema, $n as canvasNodeStylePatchSchema, An as canvasReferencePageOf, Ar as canvasBlendModeSchema, At as PartialBatchError, B as canvasCaptureCapabilityInputSchema, Bn as IMAGE_KIND, Bt as PROTOTYPE_ARTIFACT_MANIFEST_PATH, C as canvasSnapshotToken, Cn as canvasTextPropsWithContent, Cr as canvasImageAssetIdentityFromPath, Dn as canvasPrototypePropsSchema, Dr as CANVAS_RICH_TEXT_STYLE_PROPERTIES, E as resolveCanvasSnapshot, En as canvasConversionMetadataSchema, Er as hasCanvasRichTextPaints, G as canvasRenderCapabilityInputSchema, Gn as applyCanvasOperationsOutputSchema, Gt as getPrototypePublishStatusOutputSchema, Hn as RECTANGLE_KIND, Ht as createPrototypeArtifactOutputSchema, I as canvasDuplicateCapabilityInputSchema, In as createCanvasPreparationOutputSchema, J as prototypePublishCapabilityInputSchema, Jn as textOf, Jt as submitPrototypeArtifactOutputSchema, K as canvasWriteHtmlCapabilityInputSchema, Kn as getCanvasMutationOutputSchema, Kt as prototypeArtifactManifestSchema, Ln as getCanvasPreparationOutputSchema, Mn as beginCanvasActivityOutputSchema, Mt as transcriptOutputSchema, N as canvasAssetImportOutputSchema, On as canvasRecordingPropsSchema, Or as canvasAdditionalStyleSchema, Ot as hasCanvasReferenceScope, P as canvasArrangeCapabilityInputSchema, Pn as AGENT_CLIENT_HEADER, Pr as listCanvasesOutputSchema, Qt as createAgentTokenOutputSchema, Rn as FRAME_KIND, Rt as getRecordingOutputSchema, S as canvasExchangeDigest, Sn as canvasTextChangeBetween, Sr as canvasFontAssetIdentityFromPath, St as canvasEditCapabilityInputSchema, T as encodeCanvasExchangeToken, Tn as canvasCaptureSchema, Tr as canvasRichTextValueOf, Tt as canvasReferenceNodeIds, U as canvasApplyCapabilityInputSchema, Un as TEXT_KIND, Ut as foldPrototypeArtifactPath, Vn as PAGE_KIND, Vt as attachPrototypeArtifactOutputSchema, W as canvasReadCapabilityInputSchema, Wn as applyCanvasOperationsInputSchema, Wt as getPrototypeArtifactCapabilitiesOutputSchema, X as transcriptReadCapabilityInputSchema, Xn as getCanvasDocumentOutputSchema, Y as recordingSnapshotCapabilityInputSchema, Yn as mapCanvasFontSources, Yt as getMeOutputSchema, Z as canvasRenderBatchRequestSchema, Zt as cliAuthConfigurationSchema, _r as canvasCssTokens, bn as applyCanvasTypographyPatch, br as reserveCanvasAssetInputSchema, bt as canvasMakeEditableCapabilityInputSchema, cr as downloadCanvasRenderOutputSchema, dr as canvasSceneDocumentSchema, dt as canvasTranscriptCursorSchema, en as listOrganisationsOutputSchema, er as createCanvasConversionOutputSchema, ft as canvasResourcesCursorSchema, gt as canvasFindInputSchema, ht as canvasFindCursorSchema, it as canvasRemoveCapabilityInputSchema, j as canvasAssetImportCapabilityInputSchema, jn as resolveCanvasReference, jr as canvasPaintSchema, jt as CliError, k as operationStatusInputSchema, kn as DEFAULT_CANVAS_REFERENCE_PAGE_ID, kr as CANVAS_BLEND_MODES, kt as parseCanvasReference, lr as getCanvasRenderOutputSchema, lt as canvasUpdateHtmlCapabilityInputSchema, mr as canvasAxisStyleProperties, nt as canvasRenderRequestSchema, or as createCanvasRenderOutputSchema, ot as canvasOutlineCursorSchema, pr as canvasAuthoredStyleDeclarations, q as commentAttentionCapabilityInputSchema, qn as canvasLayoutWithoutCssProperties, qt as prototypeArtifactPathSchema, rr as canvasRenderStateSchema, rt as canvasRenderFileSchema, s as toRemoteError, sr as createRecordingSnapshotOutputSchema, st as canvasReadInputSchema, tr as getCanvasConversionOutputSchema, ur as canvasReadableSceneDocumentSchema, ut as canvasUpdateHtmlInputSchema, v as canvasPrototypeCapabilityInputSchema, vr as canvasCssValue, vt as canvasInsertHtmlCapabilityInputSchema, w as decodeCanvasExchangeToken, wr as canvasRichTextOf, wt as assertCanvasReferenceNodes, xn as canvasCssTypographyOwners, xr as reserveCanvasAssetOutputSchema, yr as canvasAssetUploadOutputSchema, zn as GROUP_KIND } from "./cli-output-identity.lib-DgHRuXTI.mjs";
2
+ import { $ as canvasRenderBatchRequestSchema, $n as wholeCanvasDocumentOutputSchema, $t as cliAuthConfigurationSchema, An as canvasRecordingPropsSchema, Ar as canvasAdditionalStyleSchema, At as hasCanvasReferenceScope, Bn as FRAME_KIND, Bt as getRecordingOutputSchema, Cn as canvasCssTypographyOwners, Cr as reserveCanvasAssetOutputSchema, D as encodeCanvasExchangeToken, Dn as canvasCaptureSchema, Dr as canvasRichTextValueOf, Dt as canvasReferenceNodeIds, E as decodeCanvasExchangeToken, Er as canvasRichTextOf, Et as assertCanvasReferenceNodes, F as canvasAssetImportOutputSchema, G as canvasApplyCapabilityInputSchema, Gn as TEXT_KIND, Gt as foldPrototypeArtifactPath, H as canvasCaptureCapabilityInputSchema, Hn as IMAGE_KIND, Ht as PROTOTYPE_ARTIFACT_MANIFEST_PATH, I as canvasArrangeCapabilityInputSchema, In as AGENT_CLIENT_HEADER, Ir as listCanvasesOutputSchema, J as canvasWriteHtmlCapabilityInputSchema, Jn as getCanvasMutationOutputSchema, Jt as prototypeArtifactManifestSchema, K as canvasReadCapabilityInputSchema, Kn as applyCanvasOperationsInputSchema, Kt as getPrototypeArtifactCapabilitiesOutputSchema, Mn as canvasReferencePageOf, Mr as canvasBlendModeSchema, Mt as PartialBatchError, N as canvasAssetImportCapabilityInputSchema, Nn as resolveCanvasReference, Nr as canvasPaintSchema, Nt as CliError, O as resolveCanvasSnapshot, On as canvasConversionMetadataSchema, Or as hasCanvasRichTextPaints, Pn as beginCanvasActivityOutputSchema, Pt as transcriptOutputSchema, Q as transcriptReadCapabilityInputSchema, R as canvasDuplicateCapabilityInputSchema, Rn as createCanvasPreparationOutputSchema, Sn as applyCanvasTypographyPatch, Sr as reserveCanvasAssetInputSchema, St as canvasMakeEditableCapabilityInputSchema, T as canvasSnapshotToken, Tn as canvasTextPropsWithContent, Tr as canvasImageAssetIdentityFromPath, Un as PAGE_KIND, Ut as attachPrototypeArtifactOutputSchema, Vn as GROUP_KIND, Wn as RECTANGLE_KIND, Wt as createPrototypeArtifactOutputSchema, X as prototypePublishCapabilityInputSchema, Xn as textOf, Xt as submitPrototypeArtifactOutputSchema, Y as commentAttentionCapabilityInputSchema, Yn as canvasLayoutWithoutCssProperties, Yt as prototypeArtifactPathSchema, Z as recordingSnapshotCapabilityInputSchema, Zn as mapCanvasFontSources, Zt as getMeOutputSchema, _t as canvasFindCursorSchema, ar as canvasRenderStateSchema, at as canvasRenderFileSchema, b as canvasPrototypeCapabilityInputSchema, br as canvasCssValue, bt as canvasInsertHtmlCapabilityInputSchema, cr as createCanvasRenderOutputSchema, ct as canvasOutlineCursorSchema, d as toRemoteError, dr as getCanvasRenderOutputSchema, dt as canvasUpdateHtmlCapabilityInputSchema, en as createAgentTokenOutputSchema, fr as canvasReadableSceneDocumentSchema, ft as canvasUpdateHtmlInputSchema, gr as canvasAxisStyleProperties, hr as canvasAuthoredStyleDeclarations, it as canvasRenderRequestSchema, j as operationStatusInputSchema, jn as DEFAULT_CANVAS_REFERENCE_PAGE_ID, jr as CANVAS_BLEND_MODES, jt as parseCanvasReference, kn as canvasPrototypePropsSchema, kr as CANVAS_RICH_TEXT_STYLE_PROPERTIES, lr as createRecordingSnapshotOutputSchema, lt as canvasReadInputSchema, mt as canvasResourcesCursorSchema, nn as listOrganisationsOutputSchema, nr as createCanvasConversionOutputSchema, ot as canvasRemoveCapabilityInputSchema, pr as canvasSceneDocumentSchema, pt as canvasTranscriptCursorSchema, q as canvasRenderCapabilityInputSchema, qn as applyCanvasOperationsOutputSchema, qt as getPrototypePublishStatusOutputSchema, rr as getCanvasConversionOutputSchema, tr as canvasNodeStylePatchSchema, tt as canvasRenderPendingSchema, ur as downloadCanvasRenderOutputSchema, vt as canvasFindInputSchema, w as canvasExchangeDigest, wn as canvasTextChangeBetween, wr as canvasFontAssetIdentityFromPath, wt as canvasEditCapabilityInputSchema, xr as canvasAssetUploadOutputSchema, yr as canvasCssTokens, zn as getCanvasPreparationOutputSchema } from "./cli-output-identity.lib-DBMayAFH.mjs";
3
3
  import process from "node:process";
4
4
  import { z } from "zod";
5
5
  import { homedir, tmpdir } from "node:os";
@@ -1408,7 +1408,7 @@ const union = (boxes) => {
1408
1408
  const apply = async (remote, input) => {
1409
1409
  const response = await remote.mutate(APPLY_PROCEDURE, {
1410
1410
  ...input,
1411
- documentFormatVersion: 13
1411
+ documentFormatVersion: 14
1412
1412
  });
1413
1413
  const parsed = applyCanvasOperationsOutputSchema.safeParse(response);
1414
1414
  if (!parsed.success) throw new CliError("INTERNAL", "The API returned an invalid canvas apply response.", "Run `enhance doctor`; report the API and CLI versions if they differ.");
@@ -1435,7 +1435,7 @@ const createApplyCanvasComposite = (remote) => ({ execute: async (input, options
1435
1435
  //#endregion
1436
1436
  //#region src/application/canvas-scene-at-version.use-case.ts
1437
1437
  const sceneAtVersion = async (input, canvasId, expectedVersion) => {
1438
- const held = getCanvasDocumentOutputSchema.safeParse(await input.remote.query("canvas.document.get", { canvasId }));
1438
+ const held = wholeCanvasDocumentOutputSchema.safeParse(await input.remote.query("canvas.document.get", { canvasId }));
1439
1439
  if (!held.success) throw new CliError("INTERNAL", "The API returned an invalid canvas document.", "Run `enhance doctor` and report incompatible API and CLI versions.");
1440
1440
  if (held.data.version !== expectedVersion) throw new CliError("CONFLICT", `Canvas version ${String(held.data.version)} no longer matches --base-version ${String(expectedVersion)}.`, `An earlier identical request may already have committed. Do not repeat it with a new client token. Inspect the intended scope with 'enhance canvas tree --canvas <the original canvas or selection link>' and reconcile against version ${String(held.data.version)} before submitting a new edit.`);
1441
1441
  const scene = canvasReadableSceneDocumentSchema.safeParse(held.data.document);
@@ -2414,9 +2414,27 @@ var _SHA256 = class extends SHA2_32B {
2414
2414
  const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(), /* @__PURE__ */ oidNist(1));
2415
2415
 
2416
2416
  //#endregion
2417
- //#region ../../packages/canvas-document/src/node-relationships.lib.ts
2417
+ //#region ../../packages/canvas-document/src/canvas-work-tally.lib.ts
2418
+ const counts = /* @__PURE__ */ new Map();
2419
+ const apartCounts = /* @__PURE__ */ new Map();
2420
+ const apart = { depth: 0 };
2421
+ /**
2422
+ * Counts work an editor path did, by kind. The integration count gates read the tally to hold
2423
+ * per-edit work constant as boards grow; the product never reads it.
2424
+ */
2425
+ const tallyCanvasWork = (kind, amount = 1) => {
2426
+ const held = apart.depth > 0 ? apartCounts : counts;
2427
+ held.set(kind, (held.get(kind) ?? 0) + amount);
2428
+ };
2429
+
2430
+ //#endregion
2431
+ //#region ../../packages/canvas-document/src/carried-child-list.lib.ts
2418
2432
  const inSortOrder = (left, right) => left.sortKey === right.sortKey ? left.childId.localeCompare(right.childId) : left.sortKey < right.sortKey ? -1 : 1;
2433
+
2434
+ //#endregion
2435
+ //#region ../../packages/canvas-document/src/node-relationships.lib.ts
2419
2436
  const indexChildren = (relationships) => {
2437
+ tallyCanvasWork("child index builds");
2420
2438
  const seats = /* @__PURE__ */ new Map();
2421
2439
  for (const [childId, parentage] of Object.entries(relationships)) {
2422
2440
  const seated = {
@@ -2432,6 +2450,7 @@ const indexChildren = (relationships) => {
2432
2450
  return byParent;
2433
2451
  };
2434
2452
  const heldIndexes = /* @__PURE__ */ new WeakMap();
2453
+ const carriedIndexes = /* @__PURE__ */ new WeakMap();
2435
2454
  /**
2436
2455
  * @justified warning
2437
2456
  * Every parent's children, built once for a whole document.
@@ -2444,7 +2463,7 @@ const heldIndexes = /* @__PURE__ */ new WeakMap();
2444
2463
  const childIndexOf = (relationships) => {
2445
2464
  const held = heldIndexes.get(relationships);
2446
2465
  if (held !== void 0) return held;
2447
- const index = indexChildren(relationships);
2466
+ const index = carriedIndexes.get(relationships)?.() ?? indexChildren(relationships);
2448
2467
  if (Object.isFrozen(relationships)) heldIndexes.set(relationships, index);
2449
2468
  return index;
2450
2469
  };
@@ -2476,7 +2495,8 @@ const canvasImagePaintProperty = (paint) => `--canvas-image-paint-${bytesToHex(s
2476
2495
  const canvasTextPaintStackProperty = (paints) => `--canvas-text-paints-${bytesToHex(sha256(utf8ToBytes(JSON.stringify(paints.filter((paint) => paint.visible), (key, value) => key === "id" ? void 0 : value))))}`;
2477
2496
  const PERCENT$1 = 100;
2478
2497
  const stopCss = (stop, opacity = 1) => `${canvasColorCss(stop.color, opacity)} ${String(stop.position * PERCENT$1)}%`;
2479
- const canvasPaintImageUrl = (source) => `url("${encodeURI(source).replaceAll("\"", "%22")}")`;
2498
+ const canvasPaintImageAddress = (source) => encodeURI(source).replaceAll("\"", "%22");
2499
+ const canvasPaintImageUrl = (source) => `url("${canvasPaintImageAddress(source)}")`;
2480
2500
  const canvasPaintLayerCss = (paint) => {
2481
2501
  switch (paint.kind) {
2482
2502
  case "solid": {
@@ -2850,7 +2870,7 @@ const STROKE_OWNERS = /* @__PURE__ */ new Set([
2850
2870
  RECTANGLE_KIND
2851
2871
  ]);
2852
2872
  const isCanvasBlendedPaint = (paint) => paint.visible && (paint.blendMode ?? "normal") !== "normal";
2853
- const isPainted = (paint) => {
2873
+ const isCanvasPaintedFill = (paint) => {
2854
2874
  if (!paint.visible || paint.opacity <= 0) return false;
2855
2875
  if (paint.kind === "solid") return paint.color.alpha > 0;
2856
2876
  if (paint.kind === "image") return true;
@@ -2859,27 +2879,29 @@ const isPainted = (paint) => {
2859
2879
  const hasCapturedBox = (node) => {
2860
2880
  const source = node.props?.["source"];
2861
2881
  if (typeof source !== "object" || source === null) return false;
2882
+ if (typeof Reflect.get(source, "pseudo") === "string") return true;
2862
2883
  const layout = Reflect.get(source, "layout");
2863
2884
  return typeof Reflect.get(source, "path") === "string" && typeof layout === "object" && layout !== null && typeof Reflect.get(layout, "tag") === "string";
2864
2885
  };
2865
2886
  /**
2866
2887
  * As in Figma, a rectangle casts its shadows from what it paints, so one with no fill, border or
2867
- * outline that shows casts none. A frame, and a box captured from HTML, keep the box's shadow.
2888
+ * outline that shows casts none. A frame, and a box or pseudo-element captured from HTML, keep the
2889
+ * box's shadow.
2868
2890
  */
2869
2891
  const canvasCastsNoShadow = (node) => {
2870
2892
  if (node.component !== "rectangle" || node.geometry !== void 0 || hasCapturedBox(node)) return false;
2871
2893
  const { fills = [], border, outline } = node.appearance ?? {};
2872
2894
  const strokes = [border, outline].filter((stroke) => stroke?.visible === true);
2873
- return [...fills, ...strokes.flatMap((stroke) => stroke?.paints ?? [])].every((paint) => !isPainted(paint));
2895
+ return [...fills, ...strokes.flatMap((stroke) => stroke?.paints ?? [])].every((paint) => !isCanvasPaintedFill(paint));
2874
2896
  };
2875
2897
  /** A native image is an `img`, which holds no element; an image drawn from its fills is a box. */
2876
- const isBoxLayer = (node) => node.geometry === void 0 && BOX_LAYERS.has(node.component) && (node.component !== "image" || (typeof node.props?.["src"] !== "string" || node.props["src"] === "") && node.appearance?.fills !== void 0);
2898
+ const isCanvasBoxLayer = (node) => node.geometry === void 0 && BOX_LAYERS.has(node.component) && (node.component !== "image" || (typeof node.props?.["src"] !== "string" || node.props["src"] === "") && node.appearance?.fills !== void 0);
2877
2899
  const visibleStrokePaints = (stroke) => stroke?.visible === true ? stroke.paints.filter((paint) => paint.visible) : [];
2878
2900
  /** Plus darker and an image filter have no CSS background form; a blend reaches only so. */
2879
2901
  const fillNeedsElement = (paint) => isCanvasBlendedPaint(paint) || paint.kind === "image" && (paint.filters?.some((filter) => filter.visible) ?? false);
2880
2902
  /** The visible fills, when any of them needs its own element: then every fill is one, in order. */
2881
2903
  const fillElementsOf = (node) => {
2882
- if (!isBoxLayer(node)) return [];
2904
+ if (!isCanvasBoxLayer(node)) return [];
2883
2905
  const fills = (node.appearance?.fills ?? []).filter((paint) => paint.visible);
2884
2906
  return fills.some((paint) => fillNeedsElement(paint)) || fills.length > 0 && canvasProgressiveBlurOf(node) !== null ? fills : [];
2885
2907
  };
@@ -2932,7 +2954,7 @@ const outlineElementsOf = (node) => {
2932
2954
  /** The paint elements of a layer, in the order CSS paints a box, and whether it has any. */
2933
2955
  const canvasPaintElementPlanOf = (node) => {
2934
2956
  const fills = fillElementsOf(node);
2935
- const shadows = isBoxLayer(node) && !canvasCastsNoShadow(node) ? (node.appearance?.shadows ?? []).filter((shadow) => shadow.visible) : [];
2957
+ const shadows = isCanvasBoxLayer(node) && !canvasCastsNoShadow(node) ? (node.appearance?.shadows ?? []).filter((shadow) => shadow.visible) : [];
2936
2958
  const outer = shadows.filter((shadow) => shadow.kind === "outer" && isCanvasBlendedPaint(shadow));
2937
2959
  const inner = shadows.filter((shadow) => shadow.kind === "inner" && (fills.length > 0 || isCanvasBlendedPaint(shadow)));
2938
2960
  const underChildren = [
@@ -3626,12 +3648,12 @@ const hasSquareCorners = (node) => {
3626
3648
  return radius.topLeft === 0 && radius.topRight === 0 && radius.bottomRight === 0 && radius.bottomLeft === 0;
3627
3649
  };
3628
3650
  /** Text masks through background-clip, which shows only a layer's own fills. */
3629
- const isFillOnly = (node) => {
3651
+ const isCanvasFillOnly = (node) => {
3630
3652
  const appearance = canvasAppearanceOf(node);
3631
3653
  return canvasBorderOf(node).kind !== "native" && canvasOutlineOf(node).kind !== "native" && appearance.shadows.every((shadow) => !shadow.visible) && appearance.filters.every((filter) => !filter.visible) && appearance.backdropFilters.every((filter) => !filter.visible);
3632
3654
  };
3633
- /** Whether text can mask the layer: an image or unrounded rectangle whose paint is fills only. */
3634
- const canCanvasTextMask = (node) => node !== void 0 && (node.component === "image" || node.component === "rectangle" && hasSquareCorners(node)) && isFillOnly(node);
3655
+ /** Whether text can mask the layer: an image or plain rectangle whose paint is fills only. */
3656
+ const canCanvasTextMask = (node) => node !== void 0 && node.geometry === void 0 && (node.component === "image" || node.component === "rectangle" && hasSquareCorners(node)) && isCanvasFillOnly(node);
3635
3657
 
3636
3658
  //#endregion
3637
3659
  //#region ../../packages/canvas-document/src/canvas-text-mask.lib.ts
@@ -4444,7 +4466,7 @@ const createEditCanvasComposite = (remote) => ({ execute: async (input) => {
4444
4466
  const parsed = applyCanvasOperationsInputSchema.safeParse({
4445
4467
  canvasId: input.canvasId,
4446
4468
  mutationId: input.mutationId,
4447
- documentFormatVersion: 13,
4469
+ documentFormatVersion: 14,
4448
4470
  baseVersion: input.baseVersion,
4449
4471
  operations: plan.operations
4450
4472
  });
@@ -4781,7 +4803,7 @@ const createWriteHtmlCanvasComposite = (remote, render) => ({ execute: async (in
4781
4803
  //#region src/application/read-canvas-reference.use-case.ts
4782
4804
  const readCanvasReferenceScene = async (remote, input) => {
4783
4805
  const reference = parseCanvasReference(input.canvas);
4784
- const held = getCanvasDocumentOutputSchema.parse(await remote.query("canvas.document.get", { canvasId: reference.canvasId }));
4806
+ const held = wholeCanvasDocumentOutputSchema.parse(await remote.query("canvas.document.get", { canvasId: reference.canvasId }));
4785
4807
  const document = canvasReadableSceneDocumentSchema.parse(held.document);
4786
4808
  if (hasCanvasReferenceScope(reference)) canvasReferenceNodeIds(reference, document);
4787
4809
  if (input.nodeId !== void 0) assertCanvasReferenceNodes(reference, document, [input.nodeId]);
@@ -4870,7 +4892,7 @@ const assertIdentity = (asset, intent) => {
4870
4892
  const createImportCanvasAssetComposite = (remote, files) => ({ execute: async (input) => {
4871
4893
  const reference = parseCanvasReference(input.canvasRef);
4872
4894
  if (hasCanvasReferenceScope(reference)) {
4873
- const held = getCanvasDocumentOutputSchema.parse(await remote.query(ASSET_PROCEDURES[2], { canvasId: reference.canvasId }));
4895
+ const held = wholeCanvasDocumentOutputSchema.parse(await remote.query(ASSET_PROCEDURES[2], { canvasId: reference.canvasId }));
4874
4896
  canvasReferenceNodeIds(reference, canvasReadableSceneDocumentSchema.parse(held.document));
4875
4897
  }
4876
4898
  const { body, ...file } = await files.read();
@@ -5850,7 +5872,7 @@ const commitPreparation = async (remote, input, job, fingerprint) => {
5850
5872
  const request = applyCanvasOperationsInputSchema.parse({
5851
5873
  canvasId: job.canvasId,
5852
5874
  mutationId: input.clientToken,
5853
- documentFormatVersion: 13,
5875
+ documentFormatVersion: 14,
5854
5876
  baseVersion: input.baseVersion,
5855
5877
  operations: job.result.operations,
5856
5878
  requestContext: {
@@ -7214,7 +7236,7 @@ const editable = (input, snapshot) => {
7214
7236
  };
7215
7237
  const createReadCanvasComposite = (remote) => ({ execute: async (input) => {
7216
7238
  const reference = parseCanvasReference(input.canvasRef);
7217
- const held = getCanvasDocumentOutputSchema.parse(await remote.query(READ_CANVAS_PROCEDURES[0], { canvasId: reference.canvasId }));
7239
+ const held = wholeCanvasDocumentOutputSchema.parse(await remote.query(READ_CANVAS_PROCEDURES[0], { canvasId: reference.canvasId }));
7218
7240
  if (input.expectedVersion !== void 0 && input.expectedVersion !== held.version) return stale(held.version);
7219
7241
  const current = canvasSceneDocumentSchema.safeParse(held.document);
7220
7242
  const scene = current.success ? current.data : canvasReadableSceneDocumentSchema.parse(held.document);
@@ -7272,7 +7294,7 @@ const createRevisionedCanvasCommandComposite = (remote) => ({ execute: async (in
7272
7294
  };
7273
7295
  const request = applyCanvasOperationsInputSchema.safeParse({
7274
7296
  canvasId,
7275
- documentFormatVersion: 13,
7297
+ documentFormatVersion: 14,
7276
7298
  mutationId: input.clientToken,
7277
7299
  baseVersion: input.baseVersion,
7278
7300
  operations,
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { M as canvasAssetImportInputSchema, N as canvasAssetImportOutputSchema, Ut as foldPrototypeArtifactPath, Xt as MCP_AUTH_SCOPE, Yt as getMeOutputSchema, b as canvasPrototypeIntentSchema, f as createCapabilityCatalogAdapter, jt as CliError, qt as prototypeArtifactPathSchema, x as canvasPrototypeOutputSchema } from "./cli-output-identity.lib-DgHRuXTI.mjs";
3
- import { a as readRemoteMcpEnvironment, c as createPrototypeArtifactAdapter, l as createPublishCanvasPrototypeComposite, n as createHttpRemoteAdapter, t as createMutationKeyAdapter, u as createImportCanvasAssetComposite } from "./mutation-key.adapter-BWkNj5jp.mjs";
4
- import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-CjZnnMCd.mjs";
5
- import { a as createMcpResultAdapter, o as createMcpClientContextAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-DOHJxL6l.mjs";
2
+ import { C as canvasPrototypeOutputSchema, F as canvasAssetImportOutputSchema, Gt as foldPrototypeArtifactPath, Nt as CliError, P as canvasAssetImportInputSchema, Qt as MCP_AUTH_SCOPE, S as canvasPrototypeIntentSchema, Yt as prototypeArtifactPathSchema, Zt as getMeOutputSchema, p as createCapabilityCatalogAdapter, v as PROTOTYPE_UPDATE_GUIDANCE } from "./cli-output-identity.lib-DBMayAFH.mjs";
3
+ import { a as readRemoteMcpEnvironment, c as createPrototypeArtifactAdapter, l as createPublishCanvasPrototypeComposite, n as createHttpRemoteAdapter, t as createMutationKeyAdapter, u as createImportCanvasAssetComposite } from "./mutation-key.adapter-DKwaV7lk.mjs";
4
+ import { n as createMcpCanvasProfileAdapter, t as createMcpInvocationAdapter } from "./mcp-invocation.adapter-HEKcQv-G.mjs";
5
+ import { a as createMcpResultAdapter, o as createMcpClientContextAdapter, t as createMcpServerAdapter } from "./mcp-server.adapter-D1D-6M_L.mjs";
6
6
  import process from "node:process";
7
7
  import { z } from "zod";
8
8
  import os, { tmpdir } from "node:os";
@@ -515,7 +515,7 @@ const registerAsset = (server, input) => {
515
515
  const registerPrototype = (server, input) => {
516
516
  server.registerTool("prototype_publish", {
517
517
  title: "Publish a prototype to the canvas",
518
- description: "Publish an uploaded static build ZIP or resume an existing deployment. For source.kind=build supply file and build metadata; use a ZIP with the chosen HTML entry at its stated path. Runnable builds can execute scripts and contact external services when opened. Preserve the complete canvas reference and baseVersion. Reports ingestion separately from attachment. Retry identical build bytes and clientToken; a fresh download URL is allowed. After attachment conflict, reuse the ready deployment with a new token and deliberate revised baseVersion. Status reads never attach.",
518
+ description: `Publish an uploaded static build ZIP or resume an existing deployment. ${PROTOTYPE_UPDATE_GUIDANCE} For source.kind=build supply file and build metadata; use a ZIP with the chosen HTML entry at its stated path. Runnable builds can execute scripts and contact external services when opened. Preserve the complete canvas reference and baseVersion. Reports ingestion separately from attachment. Retry identical build bytes and clientToken; a fresh download URL is allowed. After attachment conflict, reuse the ready deployment with a new token and deliberate revised baseVersion. Status reads never attach.`,
519
519
  inputSchema: prototypeInputSchema,
520
520
  outputSchema: canvasPrototypeOutputSchema,
521
521
  annotations: {
@@ -729,7 +729,7 @@ const server = await createRemoteMcpHttpAdapter({
729
729
  fileOrigins: config.MCP_FILE_ORIGINS.split(",").map((value) => value.trim()).filter(Boolean),
730
730
  allowedHosts: config.MCP_ALLOWED_HOSTS.split(",").map((value) => value.trim()),
731
731
  allowedOrigins: config.MCP_ALLOWED_ORIGINS.split(",").map((value) => value.trim()),
732
- version: "0.1.39",
732
+ version: "0.1.158",
733
733
  ...config.MCP_UI_URL !== void 0 && { uiUrl: config.MCP_UI_URL },
734
734
  onerror: (error) => process.stderr.write(`${error.message}\n`)
735
735
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enhance-eng/enhance",
3
- "version": "0.1.39",
3
+ "version": "0.1.158",
4
4
  "private": false,
5
5
  "description": "Agent-first command-line interface for Enhance.",
6
6
  "keywords": [