@enhance-eng/enhance 0.1.38 → 0.1.40

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.
@@ -7,8 +7,8 @@ import { TRPCError, initTRPC } from "@trpc/server";
7
7
  import { middlewareMarker } from "@trpc/server/unstable-core-do-not-import";
8
8
  import { setTimeout } from "node:timers/promises";
9
9
  import assert from "node:assert/strict";
10
- import { Buffer as Buffer$1 } from "node:buffer";
11
10
  import { TRPCClientError } from "@trpc/client";
11
+ import { Buffer as Buffer$1 } from "node:buffer";
12
12
 
13
13
  //#region \0rolldown/runtime.js
14
14
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
@@ -29,7 +29,8 @@ const LEGACY_CANVAS_FORMATS = {
29
29
  v9: 9,
30
30
  v10: 10,
31
31
  v11: 11,
32
- v12: 12
32
+ v12: 12,
33
+ v13: 13
33
34
  };
34
35
  const LEGACY_CANVAS_ADAPTATIONS = {
35
36
  [LEGACY_CANVAS_FORMATS.v1]: "layout",
@@ -43,9 +44,20 @@ const LEGACY_CANVAS_ADAPTATIONS = {
43
44
  [LEGACY_CANVAS_FORMATS.v9]: "geometry",
44
45
  [LEGACY_CANVAS_FORMATS.v10]: "geometry",
45
46
  [LEGACY_CANVAS_FORMATS.v11]: "css",
46
- [LEGACY_CANVAS_FORMATS.v12]: "text-shadow-blend"
47
+ [LEGACY_CANVAS_FORMATS.v12]: "text-shadow-blend",
48
+ [LEGACY_CANVAS_FORMATS.v13]: "format-number"
47
49
  };
48
50
 
51
+ //#endregion
52
+ //#region ../../packages/canvas-format/src/canvas-edit-support.lib.ts
53
+ /** Why the API refused an operation, as a fixed value. Never the words of the refusal. */
54
+ const CANVAS_REFUSAL_CODES = [
55
+ "appearance-unsupported-component",
56
+ "styles-unsupported-component",
57
+ "text-shadow-blend-unsupported",
58
+ "recording-aspect-not-preserved"
59
+ ];
60
+
49
61
  //#endregion
50
62
  //#region ../../packages/canvas-format/src/canvas-css-adaptation.lib.ts
51
63
  const isRecord$3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -63,7 +75,7 @@ const maskModeOf = (node) => {
63
75
  const mask = node["compositing"]["mask"];
64
76
  return typeof mask === "string" ? MASK_MODES[mask] : void 0;
65
77
  };
66
- const unblended$1 = (paint) => isRecord$3(paint) ? without(paint, "blendMode", "blendSource") : paint;
78
+ const unblended = (paint) => isRecord$3(paint) ? without(paint, "blendMode", "blendSource") : paint;
67
79
  /** An older border's alignment is a retired mode that never painted; absent means inside. */
68
80
  const borderPaints = (stroke) => isRecord$3(stroke) && "paint" in stroke ? {
69
81
  ...without(stroke, "paint", "alignment"),
@@ -87,7 +99,7 @@ const textStroke = (stroke) => {
87
99
  if (!isRecord$3(stroke)) return stroke;
88
100
  const next = {
89
101
  ...stroke,
90
- paint: unblended$1(stroke["paint"])
102
+ paint: unblended(stroke["paint"])
91
103
  };
92
104
  return stroke["alignment"] === "inside" ? {
93
105
  ...next,
@@ -98,7 +110,7 @@ const richTextSpan = (child) => {
98
110
  if (!isRecord$3(child) || child["kind"] !== "span") return child;
99
111
  const next = without(child, "decorationBlendMode");
100
112
  const fills = listOf(child["fills"]);
101
- if (fills !== void 0) next["fills"] = fills.map((paint) => unblended$1(paint));
113
+ if (fills !== void 0) next["fills"] = fills.map((paint) => unblended(paint));
102
114
  if (isRecord$3(child["stroke"])) next["stroke"] = textStroke(child["stroke"]);
103
115
  const children = listOf(child["children"]);
104
116
  if (children !== void 0) next["children"] = children.map((span) => richTextSpan(span));
@@ -111,7 +123,7 @@ const textFills = (appearance, next) => {
111
123
  const [only] = fills;
112
124
  const paintBlend = isRecord$3(only) ? only["blendMode"] : void 0;
113
125
  if (typeof paintBlend === "string" && fills.length === 1 && (appearance["blendMode"] ?? "normal") === "normal") next["blendMode"] = paintBlend;
114
- next["fills"] = fills.map((paint) => unblended$1(paint));
126
+ next["fills"] = fills.map((paint) => unblended(paint));
115
127
  };
116
128
  const adaptAppearance = (appearance, isText) => {
117
129
  const next = { ...appearance };
@@ -259,16 +271,24 @@ const adaptCanvasCss = (document) => {
259
271
  //#endregion
260
272
  //#region ../../packages/canvas-format/src/canvas-text-shadow-adaptation.lib.ts
261
273
  const isRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
262
- const unblended = (shadow) => isRecord$2(shadow) ? Object.fromEntries(Object.entries(shadow).filter(([key]) => key !== "blendMode" && key !== "blendSource")) : shadow;
274
+ const isList = (value) => Array.isArray(value);
275
+ /** A text shadow is drawn as part of the text, so it holds no blend and no source for one. */
276
+ const withoutCanvasShadowBlend = (shadow) => {
277
+ if (!isRecord$2(shadow)) return shadow;
278
+ const copy = { ...shadow };
279
+ Reflect.deleteProperty(copy, "blendMode");
280
+ Reflect.deleteProperty(copy, "blendSource");
281
+ return copy;
282
+ };
263
283
  const adaptNode = (node) => {
264
284
  if (!isRecord$2(node) || node["component"] !== "text" || !isRecord$2(node["appearance"])) return node;
265
285
  const shadows = node["appearance"]["shadows"];
266
- if (!Array.isArray(shadows)) return node;
286
+ if (!isList(shadows)) return node;
267
287
  return {
268
288
  ...node,
269
289
  appearance: {
270
290
  ...node["appearance"],
271
- shadows: shadows.map((shadow) => unblended(shadow))
291
+ shadows: shadows.map((shadow) => withoutCanvasShadowBlend(shadow))
272
292
  }
273
293
  };
274
294
  };
@@ -287,10 +307,11 @@ const withoutTextShadowBlends = (document) => {
287
307
 
288
308
  //#endregion
289
309
  //#region ../../packages/canvas-format/src/canvas-format.lib.ts
290
- const READABLE_FORMATS = /* @__PURE__ */ new Set([...Object.values(LEGACY_CANVAS_FORMATS), 13]);
310
+ const READABLE_FORMATS = /* @__PURE__ */ new Set([...Object.values(LEGACY_CANVAS_FORMATS), 14]);
291
311
  const isReadableCanvasFormat = (version) => READABLE_FORMATS.has(version);
292
312
  /** Formats whose adaptation rewrites the stored document in place, keeping its geometry. */
293
313
  const ADAPTED_IN_PLACE = /* @__PURE__ */ new Set([
314
+ "format-number",
294
315
  "text-shadow-blend",
295
316
  "css",
296
317
  "geometry"
@@ -310,20 +331,20 @@ const legacyLayout = (layout) => {
310
331
  const adaptLegacyFormat = (document) => {
311
332
  const version = document["version"];
312
333
  if (!isReadableCanvasFormat(version)) return null;
313
- if (version === 13 || !isRecord$1(document["nodes"])) return document;
334
+ if (version === 14 || !isRecord$1(document["nodes"])) return document;
314
335
  const adaptation = Object.entries(LEGACY_CANVAS_ADAPTATIONS).find(([format]) => Number(format) === version)?.[1];
315
336
  if (ADAPTED_IN_PLACE.has(adaptation)) return {
316
337
  ...document,
317
- version: 13
338
+ version: 14
318
339
  };
319
340
  if (Object.values(document["nodes"]).some((node) => isRecord$1(node) && node["geometry"] !== void 0)) return null;
320
341
  if (adaptation === "typography") return {
321
342
  ...document,
322
- version: 13
343
+ version: 14
323
344
  };
324
345
  return {
325
346
  ...document,
326
- version: 13,
347
+ version: 14,
327
348
  nodes: Object.fromEntries(Object.entries(document["nodes"]).map(([id, node]) => [id, isRecord$1(node) && node["layout"] !== void 0 ? {
328
349
  ...node,
329
350
  layout: legacyLayout(node["layout"])
@@ -332,12 +353,14 @@ const adaptLegacyFormat = (document) => {
332
353
  };
333
354
  /**
334
355
  * Adapt known formats in memory, retaining malformed content for each boundary's validator. Format
335
- * 12 already has the CSS model, so it takes only the text shadow step that every older format takes
336
- * after the CSS adaptation.
356
+ * 13 differs from the current format only in that its layers cannot hold a box baseline source, so
357
+ * it takes only the new format number. Format 12 already has the CSS model, so it takes only the
358
+ * text shadow step that every older format takes after the CSS adaptation.
337
359
  */
338
360
  const adaptCanvasDocumentFormat = (document) => {
339
361
  const adapted = adaptLegacyFormat(document);
340
362
  if (adapted === null || adapted === document) return adapted;
363
+ if (document["version"] === LEGACY_CANVAS_FORMATS.v13) return adapted;
341
364
  return withoutTextShadowBlends(document["version"] === LEGACY_CANVAS_FORMATS.v12 ? adapted : adaptCanvasCss(adapted));
342
365
  };
343
366
 
@@ -463,7 +486,8 @@ const viewerCapabilitySchema = z.object({
463
486
  })).default([]),
464
487
  grantableAccessLevels: z.array(grantableAccessLevelSchema).default([]),
465
488
  share: z.boolean(),
466
- manage: z.boolean()
489
+ manage: z.boolean(),
490
+ readHistory: z.boolean().default(false)
467
491
  });
468
492
  const canvasSchema = z.object({
469
493
  id: z.uuid(),
@@ -539,6 +563,25 @@ const duplicateCanvasInputSchema = z.object({
539
563
  title: z.string().trim().min(1).optional()
540
564
  });
541
565
  const duplicateCanvasOutputSchema = z.object({ canvas: canvasSchema });
566
+ /**
567
+ * A new canvas made from work the person holds, such as unsaved changes or a recovery file. The
568
+ * copy's id is chosen by the caller and is its idempotency token: a repeat by the same person
569
+ * returns the canvas that already has it. `sourceCanvasId` names the original; it lends its
570
+ * mounted prototypes and walkthroughs only to the owner of a live original.
571
+ */
572
+ const copyCanvasFromWorkInputSchema = z.object({
573
+ canvasId: z.uuid(),
574
+ sourceCanvasId: z.uuid().optional(),
575
+ organisationId: z.union([z.uuid(), z.literal("personal")]),
576
+ title: z.string().trim().min(1),
577
+ document: z.record(z.string(), z.unknown()),
578
+ screenIds: z.array(z.uuid())
579
+ });
580
+ /** The document is the one the API wrote, with fonts and walkthroughs mapped to the copy. */
581
+ const copyCanvasFromWorkOutputSchema = z.object({
582
+ canvas: canvasSchema,
583
+ document: z.record(z.string(), z.unknown())
584
+ });
542
585
  const permanentlyDeleteCanvasInputSchema = z.object({
543
586
  canvasId: z.uuid(),
544
587
  confirmation: z.string().min(1)
@@ -763,14 +806,22 @@ const canvasPaintCoreSchema = z.discriminatedUnion("kind", [
763
806
  path: ["transform"]
764
807
  })
765
808
  ]);
766
- const canvasPaintSchema = z.intersection(canvasPaintCoreSchema, z.object({ alternatives: z.partialRecord(z.enum([
767
- "solid",
768
- "linear-gradient",
769
- "radial-gradient",
770
- "angular-gradient",
771
- "diamond-gradient",
772
- "image"
773
- ]), canvasPaintCoreSchema).optional() }));
809
+ const canvasPaintSchema = z.intersection(canvasPaintCoreSchema, z.object({
810
+ alternatives: z.partialRecord(z.enum([
811
+ "solid",
812
+ "linear-gradient",
813
+ "radial-gradient",
814
+ "angular-gradient",
815
+ "diamond-gradient",
816
+ "image"
817
+ ]), canvasPaintCoreSchema).optional(),
818
+ recentGradient: z.enum([
819
+ "linear-gradient",
820
+ "radial-gradient",
821
+ "angular-gradient",
822
+ "diamond-gradient"
823
+ ]).optional()
824
+ }));
774
825
  const canvasColorDefinitionSchema = z.object({
775
826
  id: itemId$1,
776
827
  name: z.string().trim().min(1),
@@ -869,6 +920,17 @@ const canvasFlexLayoutSchema = z.object({
869
920
  gridAutoRepeat: canvasGridAutoRepeatSchema.optional(),
870
921
  padding: canvasFlexPaddingSchema
871
922
  }).strict();
923
+ /**
924
+ * What conversion recorded about the source box of an inline-level frame that the frame itself
925
+ * cannot hold: whether it was a button, whether its only clipping overflow was `clip`, and, when
926
+ * conversion took all its content out of its line, how far that line sat above its border-box
927
+ * bottom. The editor works the box baseline rule out from these facts on every draw.
928
+ */
929
+ const canvasBaselineSourceSchema = z.object({
930
+ button: z.literal(true).optional(),
931
+ overflowClip: z.literal(true).optional(),
932
+ lineAboveBorderBottom: canvasNumberSchema.optional()
933
+ }).strict();
872
934
  const canvasNodeLayoutSchema = z.object({
873
935
  rotation: canvasNumberSchema.optional(),
874
936
  flipHorizontal: z.boolean().optional(),
@@ -908,6 +970,7 @@ const canvasNodeLayoutSchema = z.object({
908
970
  order: canvasNumberSchema.int().optional(),
909
971
  margin: canvasFlexMarginSchema.partial().optional(),
910
972
  clipContent: z.boolean().optional(),
973
+ baselineSource: canvasBaselineSourceSchema.optional(),
911
974
  container: canvasFlexLayoutSchema.partial().extend({ padding: canvasFlexPaddingSchema.partial().optional() }).optional()
912
975
  }).strict();
913
976
 
@@ -954,6 +1017,8 @@ const canvasBorderSchema = z.object({
954
1017
  paints: z.array(canvasPaintSchema),
955
1018
  dashPattern: canvasDashPatternSchema.optional(),
956
1019
  dashCap: canvasDashCapSchema.optional(),
1020
+ /** Captured CSS dashes, which the browser draws: the editor's own dashes have other lengths. */
1021
+ dashOrigin: z.literal("css").optional(),
957
1022
  /** Absent paints inside the layer box, as CSS borders do. */
958
1023
  alignment: z.enum([
959
1024
  "inside",
@@ -1337,6 +1402,7 @@ const CANVAS_RICH_TEXT_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
1337
1402
  "marginRight",
1338
1403
  "marginTop",
1339
1404
  "opacity",
1405
+ "overflowWrap",
1340
1406
  "paddingBottom",
1341
1407
  "paddingLeft",
1342
1408
  "paddingRight",
@@ -1347,11 +1413,16 @@ const CANVAS_RICH_TEXT_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
1347
1413
  "textDecorationSkipInk",
1348
1414
  "textDecorationStyle",
1349
1415
  "textDecorationThickness",
1416
+ "textRendering",
1350
1417
  "textShadow",
1351
1418
  "textTransform",
1352
1419
  "textUnderlineOffset",
1353
1420
  "verticalAlign",
1354
1421
  "whiteSpace",
1422
+ "wordBreak",
1423
+ "wordSpacing",
1424
+ "WebkitFontSmoothing",
1425
+ "WebkitTextFillColor",
1355
1426
  "WebkitTextStrokeColor",
1356
1427
  "WebkitTextStrokeWidth",
1357
1428
  "--canvas-text-stroke-alignment"
@@ -1626,6 +1697,11 @@ const CANVAS_IMAGE_CONTENT_TYPES = [
1626
1697
  "image/png",
1627
1698
  "image/webp"
1628
1699
  ];
1700
+ /**
1701
+ * An image the canvas image store may hold. Files people upload keep to the closed list above; an
1702
+ * image a layer held inline is stored under whatever `image/*` type it has.
1703
+ */
1704
+ const canvasStoredImageContentTypeSchema = z.string().regex(/^image\/[a-z0-9.+-]+$/u);
1629
1705
  const reserveCanvasImageInputSchema = z.object({
1630
1706
  canvasId: z.uuid(),
1631
1707
  contentType: z.enum(CANVAS_IMAGE_CONTENT_TYPES),
@@ -1654,7 +1730,8 @@ const CANVAS_FONT_CONTENT_TYPES = [
1654
1730
  "font/ttf",
1655
1731
  "font/otf",
1656
1732
  "font/woff",
1657
- "font/woff2"
1733
+ "font/woff2",
1734
+ "font/collection"
1658
1735
  ];
1659
1736
  const canvasFontAssetIdentitySchema = z.object({
1660
1737
  canvasId: z.uuid(),
@@ -1686,10 +1763,8 @@ const canvasFontAssetIdentityFromPath = (path) => {
1686
1763
  //#endregion
1687
1764
  //#region ../../packages/contract/src/canvas/canvas-asset-upload.schema.ts
1688
1765
  const MAX_FONT_WEIGHT = 1e3;
1689
- const CONTENT_TYPES = {
1690
- image: CANVAS_IMAGE_CONTENT_TYPES,
1691
- font: CANVAS_FONT_CONTENT_TYPES
1692
- };
1766
+ const FONT_CONTENT_TYPES = new Set(CANVAS_FONT_CONTENT_TYPES);
1767
+ const isStoredContentType = (kind, contentType) => kind === "image" ? canvasStoredImageContentTypeSchema.safeParse(contentType).success : FONT_CONTENT_TYPES.has(contentType);
1693
1768
  const canvasAssetUploadIdentitySchema = z.strictObject({
1694
1769
  canvasId: z.uuid(),
1695
1770
  clientToken: z.uuid()
@@ -1732,7 +1807,7 @@ const canvasAssetUploadOutputSchema = z.strictObject({
1732
1807
  path: z.string().startsWith("/v1/canvas-assets/"),
1733
1808
  state: z.enum(["awaiting_upload", "ready"]),
1734
1809
  metadata: canvasAssetMetadataSchema.nullable()
1735
- }).refine((asset) => asset.state === "ready" === (asset.metadata !== null), "Readiness must match verified metadata.").refine((asset) => asset.metadata === null || asset.metadata.kind === asset.kind, "Metadata must describe the reserved asset kind.").refine((asset) => CONTENT_TYPES[asset.kind].includes(asset.contentType), "Content type must match the asset kind.").refine((asset) => asset.path === (asset.kind === "image" ? canvasImageAssetPath(asset.canvasId, asset.assetId) : canvasFontAssetPath(asset.canvasId, asset.sha256)), "The resource path must match its native identity.");
1810
+ }).refine((asset) => asset.state === "ready" === (asset.metadata !== null), "Readiness must match verified metadata.").refine((asset) => asset.metadata === null || asset.metadata.kind === asset.kind, "Metadata must describe the reserved asset kind.").refine((asset) => isStoredContentType(asset.kind, asset.contentType), "Content type must match the asset kind.").refine((asset) => asset.path === (asset.kind === "image" ? canvasImageAssetPath(asset.canvasId, asset.assetId) : canvasFontAssetPath(asset.canvasId, asset.sha256)), "The resource path must match its native identity.");
1736
1811
  const reserveCanvasAssetOutputSchema = canvasAssetUploadOutputSchema.safeExtend({ upload: signedUploadSchema.nullable() }).refine((asset) => asset.state === "awaiting_upload" === (asset.upload !== null), "Only pending uploads receive upload access.");
1737
1812
 
1738
1813
  //#endregion
@@ -1958,8 +2033,7 @@ const cssValue = (value, shouldPreserveCase) => {
1958
2033
  const source = String(value).replace(/\s*!important\s*$/iu, "").trim();
1959
2034
  return shouldPreserveCase || source.includes("(") ? source : source.toLowerCase();
1960
2035
  };
1961
- /** Read supported authored longhands without measuring or rewriting unresolved CSS expressions. */
1962
- const canvasAuthoredLayoutValueOf = (node, property) => {
2036
+ const authoredLayoutValue = (node, property) => {
1963
2037
  let result = null;
1964
2038
  let isImportant = false;
1965
2039
  const declarations = Object.entries(canvasAuthoredStyleDeclarations(node));
@@ -1975,6 +2049,24 @@ const canvasAuthoredLayoutValueOf = (node, property) => {
1975
2049
  }
1976
2050
  return result ?? void 0;
1977
2051
  };
2052
+ /**
2053
+ * Edits replace a node's style objects rather than changing them, so their identity keys the values
2054
+ * already read. Rendering a large document reads each property of each node many times.
2055
+ */
2056
+ const readAuthoredValues = /* @__PURE__ */ new WeakMap();
2057
+ /** Read supported authored longhands without measuring or rewriting unresolved CSS expressions. */
2058
+ const canvasAuthoredLayoutValueOf = (node, property) => {
2059
+ const known = readAuthoredValues.get(node.styles);
2060
+ const read = known !== void 0 && known.additionalStyles === node.additionalStyles ? known : {
2061
+ additionalStyles: node.additionalStyles,
2062
+ values: /* @__PURE__ */ new Map()
2063
+ };
2064
+ if (read !== known) readAuthoredValues.set(node.styles, read);
2065
+ if (read.values.has(property)) return read.values.get(property);
2066
+ const value = authoredLayoutValue(node, property);
2067
+ read.values.set(property, value);
2068
+ return value;
2069
+ };
1978
2070
  /** Named controls override only their own longhand, even beside an important shorthand. */
1979
2071
  const canvasLayoutPriorityDeclarations = (node, declarations) => {
1980
2072
  const important = new Set(Object.entries(canvasAuthoredStyleDeclarations(node)).filter(([, value]) => hasCanvasCssPriority(value)).flatMap(([property]) => canvasCssPropertyScope(property)));
@@ -2042,7 +2134,7 @@ const coordinate = z.number();
2042
2134
  const dimension$1 = coordinate.nonnegative();
2043
2135
  const MAX_ID_LENGTH = 200;
2044
2136
  const MIN_POLYGON_POINTS = 3;
2045
- const identity = z.string().min(1).max(MAX_ID_LENGTH);
2137
+ const identity$1 = z.string().min(1).max(MAX_ID_LENGTH);
2046
2138
  const path = z.string().regex(/^[MmLlHhVvCcSsQqTtAaZzEe\d\s.,+-]*$/u);
2047
2139
  const canvasGeometryBoundsSchema = z.strictObject({
2048
2140
  x: coordinate,
@@ -2075,7 +2167,7 @@ const canvasBooleanOperationSchema = z.enum([
2075
2167
  const canvasBooleanGeometrySchema = z.strictObject({
2076
2168
  kind: z.literal("boolean"),
2077
2169
  operation: canvasBooleanOperationSchema,
2078
- operandIds: z.array(identity).min(1).refine((ids) => new Set(ids).size === ids.length),
2170
+ operandIds: z.array(identity$1).min(1).refine((ids) => new Set(ids).size === ids.length),
2079
2171
  result: z.strictObject({
2080
2172
  path,
2081
2173
  fillRule: z.literal("nonzero"),
@@ -2089,7 +2181,7 @@ const canvasGeometrySchema = z.discriminatedUnion("kind", [
2089
2181
  canvasPolygonGeometrySchema,
2090
2182
  z.strictObject({
2091
2183
  kind: z.literal("mask"),
2092
- maskId: identity,
2184
+ maskId: identity$1,
2093
2185
  /** Absent paints as alpha. An outline mask clips to the source's shape only. */
2094
2186
  mode: z.enum([
2095
2187
  "alpha",
@@ -2103,10 +2195,11 @@ const canvasGeometrySchema = z.discriminatedUnion("kind", [
2103
2195
  //#endregion
2104
2196
  //#region ../../packages/contract/src/canvas/canvas-scene.schema.ts
2105
2197
  const CANVAS_COMPOSITING_RETIRED = "Update Enhance: compositing is no longer supported. Use the isolation style or a mask group.";
2106
- const canvasDocumentFormatSchema = z.literal(13, { error: "This editor uses an unsupported document format. Update the editor before changing this canvas." });
2198
+ const canvasDocumentFormatSchema = z.literal(14, { error: "This editor uses an unsupported document format. Update the editor before changing this canvas." });
2107
2199
  const canvasPreservedFontAppearanceSchema = z.object({
2108
2200
  signature: z.string().regex(/^[a-f0-9]{16}$/u),
2109
- image: z.string().startsWith("data:image/jpeg;base64,"),
2201
+ /** The captured picture of the page's text, inline as written or as its canvas image store path. */
2202
+ image: z.string().refine((image) => image.startsWith("data:image/jpeg;base64,") || canvasImageAssetIdentityFromPath(image) !== null),
2110
2203
  families: z.array(z.string().min(1)).min(1)
2111
2204
  });
2112
2205
  const canvasSceneBoxSchema = z.object({
@@ -2153,7 +2246,7 @@ const canvasSceneNodeSchema = z.looseObject({
2153
2246
  box: canvasSceneBoxSchema.optional()
2154
2247
  });
2155
2248
  const canvasSceneDocumentSchema = z.object({
2156
- version: z.literal(13),
2249
+ version: z.literal(14),
2157
2250
  nodes: z.record(z.string(), canvasSceneNodeSchema),
2158
2251
  relationships: z.record(z.string(), z.object({
2159
2252
  parentId: z.string().min(1),
@@ -2170,7 +2263,7 @@ const canvasReadableSceneDocumentSchema = z.preprocess((value) => {
2170
2263
  return adaptCanvasDocumentFormat(blob);
2171
2264
  }, canvasSceneDocumentSchema);
2172
2265
  const emptyCanvasSceneDocument = () => ({
2173
- version: 13,
2266
+ version: 14,
2174
2267
  nodes: { root: {
2175
2268
  id: "root",
2176
2269
  label: "Canvas",
@@ -2335,7 +2428,8 @@ const RENDER_WARNING_CODES = [
2335
2428
  "FONT_FALLBACK",
2336
2429
  "LOCAL_FONT_FALLBACK",
2337
2430
  "SOURCE_FALLBACK",
2338
- "SCALE_REDUCED"
2431
+ "SCALE_REDUCED",
2432
+ "LAYOUT_FALLBACK"
2339
2433
  ];
2340
2434
 
2341
2435
  //#endregion
@@ -2499,6 +2593,9 @@ const createCanvasRenderOutputSchema = z.object({
2499
2593
  alreadyExists: z.boolean()
2500
2594
  });
2501
2595
  const getCanvasRenderInputSchema = z.object({ jobId: z.uuid() });
2596
+ /** The longest an export read waits on the server for the job to settle. */
2597
+ const CANVAS_EXPORT_LONGEST_WAIT_MS = 1e4;
2598
+ const getCanvasExportInputSchema = getCanvasRenderInputSchema.extend({ waitMs: z.number().int().min(0).max(CANVAS_EXPORT_LONGEST_WAIT_MS).optional() });
2502
2599
  const getCanvasRenderOutputSchema = z.object({ job: canvasRenderJobSchema });
2503
2600
  const cancelCanvasRenderInputSchema = z.object({ jobId: z.uuid() });
2504
2601
  const cancelCanvasRenderOutputSchema = z.object({ job: canvasRenderJobSchema });
@@ -3113,7 +3210,6 @@ const insertConvertedSubtreeOperationSchema = z.object({
3113
3210
  relationships: z.record(z.string().min(1), convertedSubtreeRelationshipSchema)
3114
3211
  });
3115
3212
  const nodeIdSchema$3 = z.string().min(1);
3116
- const sortKeySchema = z.string().min(1);
3117
3213
  const writableBoxSchema$1 = canvasSceneBoxSchema.extend({
3118
3214
  width: z.number().positive(),
3119
3215
  height: z.number().positive()
@@ -3122,10 +3218,7 @@ const placementSchema = z.object({
3122
3218
  parentId: nodeIdSchema$3,
3123
3219
  afterId: nodeIdSchema$3.optional()
3124
3220
  });
3125
- const parentageSchema = z.object({
3126
- parentId: nodeIdSchema$3,
3127
- sortKey: sortKeySchema
3128
- });
3221
+ const parentageSchema = convertedSubtreeRelationshipSchema;
3129
3222
  const canvasSetStylesOperationSchema = z.object({
3130
3223
  op: z.literal("setStyles"),
3131
3224
  nodeId: nodeIdSchema$3,
@@ -3144,6 +3237,11 @@ const currentCanvasOperationSchema = z.discriminatedUnion("op", [
3144
3237
  documentVersion: z.number().int().nonnegative(),
3145
3238
  versionEntryId: z.uuid().optional()
3146
3239
  }).optional(),
3240
+ /**
3241
+ * The canvas a pasted screen layer was copied from, which the API checks the screen against
3242
+ * when the writer does not own it and this canvas never showed it.
3243
+ */
3244
+ screenSource: z.object({ canvasId: z.uuid() }).optional(),
3147
3245
  /** A page copy's base name; the API gives the copy the first free name from it. */
3148
3246
  pageCopyBase: z.string().refine((base) => base.trim() !== "").optional()
3149
3247
  }),
@@ -3293,6 +3391,8 @@ const currentCanvasOperationSchema = z.discriminatedUnion("op", [
3293
3391
  })
3294
3392
  ]);
3295
3393
  /** An older client's compositing write is refused with the CSS that replaces it. */
3394
+ /** Each operation's name, for records that may state which kind failed and nothing else. */
3395
+ const CANVAS_OPERATION_NAMES = currentCanvasOperationSchema.options.map((option) => option.shape.op.value);
3296
3396
  const canvasOperationSchema = z.preprocess((value, context) => {
3297
3397
  if (typeof value !== "object" || value === null || Reflect.get(value, "op") !== "setCompositing") return value;
3298
3398
  context.issues.push({
@@ -3359,10 +3459,17 @@ const getCanvasDocumentOutputSchema = z.object({
3359
3459
  * has not seen the restore, and the log never reaches back past it.
3360
3460
  */
3361
3461
  restoreFenceVersion: z.number().int().positive().optional(),
3362
- document: canvasDocumentBlobSchema,
3462
+ /**
3463
+ * Absent only on a catch-up: a read with `afterVersion` whose batches reach the current revision
3464
+ * without a whole-document save or a restore between them. A read without `afterVersion`, or one
3465
+ * across a gap, always carries the document.
3466
+ */
3467
+ document: canvasDocumentBlobSchema.optional(),
3363
3468
  /** The manifest, resolved and signed. This is what makes a cold open one round trip. */
3364
3469
  screens: z.array(documentScreenSchema)
3365
3470
  });
3471
+ /** The answer to a document read without `afterVersion`, which always carries the document. */
3472
+ const wholeCanvasDocumentOutputSchema = getCanvasDocumentOutputSchema.extend({ document: canvasDocumentBlobSchema });
3366
3473
  const saveCanvasDocumentInputSchema = z.object({
3367
3474
  canvasId: z.uuid(),
3368
3475
  baseVersion: z.number().int().min(1),
@@ -4116,7 +4223,9 @@ const canvasPreparationPlanSchema = z.strictObject({
4116
4223
  });
4117
4224
  const canvasPreparationWorkPlanSchema = canvasPreparationPlanSchema.extend({ compilations: z.array(z.strictObject({
4118
4225
  id: nodeId$5,
4119
- draft: canvasSubtreeDraftSchema
4226
+ draft: canvasSubtreeDraftSchema,
4227
+ /** Where a screen compile fell back on the try that returned it, as an export says it. */
4228
+ warnings: z.array(canvasRenderWarningSchema).optional()
4120
4229
  })).optional() });
4121
4230
  const preparationRouteStateSchema = z.discriminatedUnion("state", [
4122
4231
  z.object({
@@ -4132,7 +4241,10 @@ const preparationRouteStateSchema = z.discriminatedUnion("state", [
4132
4241
  z.object({
4133
4242
  state: z.literal("failed"),
4134
4243
  jobId: z.uuid(),
4135
- message: z.string().min(1)
4244
+ message: z.string().min(1),
4245
+ /** A screen compile names an outage or a deadline, which its worker tries again. */
4246
+ reason: z.enum(["SOURCE_FAILED", "PREPARATION_FAILED"]).optional(),
4247
+ retryable: z.boolean().optional()
4136
4248
  })
4137
4249
  ]);
4138
4250
  const job = z.object({
@@ -4709,6 +4821,13 @@ const exposeCanvasRenderOutputSchema = z.discriminatedUnion("purpose", [
4709
4821
  purpose: z.literal("preparation"),
4710
4822
  preparation: canvasRenderPreparationSchema,
4711
4823
  screens: z.array(documentScreenSchema).optional(),
4824
+ /** The tries this job has used, less those a storage outage ended, and how many it has. */
4825
+ attempts: z.strictObject({
4826
+ counted: z.number().int().nonnegative(),
4827
+ limit: z.number().int().positive()
4828
+ }).optional(),
4829
+ /** When this try's lease ends; a screen compile prepares its layout until then. */
4830
+ deadlineAt: z.iso.datetime().optional(),
4712
4831
  sourceState: z.undefined().optional(),
4713
4832
  scale: z.literal(1),
4714
4833
  format: z.literal("json")
@@ -4875,6 +4994,8 @@ const renderRouteStateBaseSchema = z.object({
4875
4994
  const renderRouteCaptureSchema = z.object({
4876
4995
  selector: z.string().min(1).max(MAX_RENDER_CAPTURE_SELECTOR_LENGTH),
4877
4996
  contentSelector: z.string().min(1).max(MAX_RENDER_CAPTURE_SELECTOR_LENGTH).optional(),
4997
+ /** An export's layer draws something, so a picture with no pixel in it went wrong. */
4998
+ expectsPaint: z.boolean().optional(),
4878
4999
  bounds: canvasWorldBoundsSchema,
4879
5000
  width: z.number().int().positive(),
4880
5001
  height: z.number().int().positive(),
@@ -5436,19 +5557,20 @@ const lastRunWith = (nodes, text) => {
5436
5557
  };
5437
5558
  /**
5438
5559
  * The one-character runs whose formatting typed text takes. Typing at a link's edge stays
5439
- * outside the link; empty text and an empty last paragraph have no character, so the last run
5440
- * stands in.
5560
+ * outside the link, unless the typing continues a replacement of that link; empty text and an
5561
+ * empty last paragraph have no character, so the last run stands in.
5441
5562
  */
5442
- const canvasTextTypedFormatting = (runs, range) => {
5563
+ const canvasTextTypedFormatting = (runs, range, shouldContinueLink = false) => {
5443
5564
  const index = typedCharacterOf(canvasRichTextValueOf(runs), range);
5444
5565
  const character = sliceRuns(runs, index, index + 1);
5445
5566
  const formatting = character.length > 0 ? character : lastRunWith(runs, " ");
5446
- return range.start === range.end && canvasRichTextLinkOf(sliceRuns(runs, range.start - 1, range.start)) !== canvasRichTextLinkOf(sliceRuns(runs, range.start, range.start + 1)) ? formattedRuns(formatting, {
5567
+ const linkBefore = canvasRichTextLinkOf(sliceRuns(runs, range.start - 1, range.start));
5568
+ return range.start === range.end && linkBefore !== canvasRichTextLinkOf(sliceRuns(runs, range.start, range.start + 1)) && (!shouldContinueLink || linkBefore === null) ? formattedRuns(formatting, {
5447
5569
  type: "link",
5448
5570
  href: null
5449
5571
  }) : formatting;
5450
5572
  };
5451
- const insertedRuns = (nodes, range, text, shouldKeepEmpty = false) => text === "" && !shouldKeepEmpty ? [] : withText(canvasTextTypedFormatting(nodes, range), text);
5573
+ const insertedRuns = (nodes, range, text, { shouldKeepEmpty = false, shouldContinueLink = false } = {}) => text === "" && !shouldKeepEmpty ? [] : withText(canvasTextTypedFormatting(nodes, range, shouldContinueLink), text);
5452
5574
  const canvasTextReplacementRange = (before, text, range) => {
5453
5575
  const replacementEnd = text.length - before.length + (range?.end ?? 0);
5454
5576
  if (range !== void 0 && isValidTextRange(before, range) && isValidTextRange(text, {
@@ -5553,7 +5675,7 @@ const paragraphProps = (node, range, command) => {
5553
5675
  Reflect.deleteProperty(props, "links");
5554
5676
  return props;
5555
5677
  };
5556
- const replacementRuns = (runs, range, command) => {
5678
+ const replacementRuns = (runs, range, command, shouldContinueLink) => {
5557
5679
  if (command.richText !== void 0) {
5558
5680
  const rich = canvasRichTextOf({ props: {
5559
5681
  text: command.text,
@@ -5562,7 +5684,10 @@ const replacementRuns = (runs, range, command) => {
5562
5684
  if (rich.length > 0) return rich;
5563
5685
  }
5564
5686
  const shouldKeepEmpty = range.start === 0 && range.end === canvasRichTextValueOf(runs).length;
5565
- let next = insertedRuns(runs, range, command.text, shouldKeepEmpty);
5687
+ let next = insertedRuns(runs, range, command.text, {
5688
+ shouldKeepEmpty,
5689
+ shouldContinueLink
5690
+ });
5566
5691
  if (command.text === "") return next;
5567
5692
  if (Object.keys(command.styles ?? {}).length > 0 || Object.keys(textRunFormattingOf(command)).length > 0) next = formattedRuns(next, {
5568
5693
  type: "format",
@@ -5580,14 +5705,14 @@ const replacementRuns = (runs, range, command) => {
5580
5705
  return next;
5581
5706
  };
5582
5707
  /** Commands write the existing text/run pair atomically and retain unrelated source metadata. */
5583
- const canvasTextPropsWithCommand = (node, range, command) => {
5708
+ const canvasTextPropsWithCommand = (node, range, command, shouldContinueLink) => {
5584
5709
  const text = textOf(node) ?? "";
5585
5710
  if (!(command.type === "paint" ? isValidTextCharacterRange(text, range) : isValidTextRange(text, range))) return node.props ?? {};
5586
5711
  if (command.type === "paragraph" || command.type === "list-indent") return paragraphProps(node, range, command);
5587
5712
  if (command.type !== "replace" && range.start === range.end && (text !== "" || command.type !== "text-style" && command.type !== "format")) return node.props ?? {};
5588
5713
  if (command.type === "link" && command.href !== null && !isCanvasRichTextHref(command.href)) return node.props ?? {};
5589
5714
  const runs = canvasTextRunsOf(node);
5590
- const middle = command.type === "replace" ? replacementRuns(runs, range, command) : formattedRuns(text === "" ? runs : sliceRuns(runs, range.start, range.end), command);
5715
+ const middle = command.type === "replace" ? replacementRuns(runs, range, command, shouldContinueLink) : formattedRuns(text === "" ? runs : sliceRuns(runs, range.start, range.end), command);
5591
5716
  const next = canvasTextParagraphRunsAfterEdit(runs, joinRuns([
5592
5717
  ...sliceRuns(runs, 0, range.start),
5593
5718
  ...middle,
@@ -5609,14 +5734,14 @@ const canvasTextPropsWithCommand = (node, range, command) => {
5609
5734
  const canvasTextPropsWithContent = (node, text, styles, formatting) => {
5610
5735
  const before = textOf(node) ?? "";
5611
5736
  if (before === text) return node.props ?? {};
5612
- const { range, ...marks } = formatting ?? {};
5737
+ const { range, shouldContinueLink, ...marks } = formatting ?? {};
5613
5738
  const replacement = canvasTextReplacementRange(before, text, range);
5614
5739
  return canvasTextPropsWithCommand(node, replacement, {
5615
5740
  type: "replace",
5616
5741
  styles,
5617
5742
  ...marks,
5618
5743
  text: text.slice(replacement.start, text.length - before.length + replacement.end)
5619
- });
5744
+ }, shouldContinueLink);
5620
5745
  };
5621
5746
 
5622
5747
  //#endregion
@@ -5977,6 +6102,20 @@ const duplicateCanvasVersionOutputSchema = z.object({
5977
6102
  version: z.literal(1)
5978
6103
  });
5979
6104
 
6105
+ //#endregion
6106
+ //#region ../../packages/contract/src/canvas/canvas-walkthrough-copy.schema.ts
6107
+ /** Walkthroughs on `sourceCanvasId` that a paste into `canvasId` carries. */
6108
+ const copyCanvasWalkthroughsInputSchema = z.object({
6109
+ canvasId: z.uuid(),
6110
+ sourceCanvasId: z.uuid(),
6111
+ recordingIds: z.array(z.uuid()).min(1)
6112
+ });
6113
+ /** One pair for each walkthrough the API copied; one it could not copy has no pair. */
6114
+ const copyCanvasWalkthroughsOutputSchema = z.object({ copies: z.array(z.object({
6115
+ sourceRecordingId: z.uuid(),
6116
+ recordingId: z.uuid()
6117
+ })) });
6118
+
5980
6119
  //#endregion
5981
6120
  //#region ../../packages/contract/src/canvas/font-catalog.schema.ts
5982
6121
  const MAX_WEIGHT = 1e3;
@@ -6165,6 +6304,7 @@ const setReviewStateOutputSchema = z.object({ reviewState: setReviewStateInputSc
6165
6304
  /** The longest journey, step, variant or label a capture may carry. */
6166
6305
  const CAPTURE_KEY_LENGTH = 160;
6167
6306
  const CAPTURE_METADATA_LENGTH = 200;
6307
+ /** The longest capture issue message a capture or a receipt carries. */
6168
6308
  const CAPTURE_ISSUE_LENGTH = 500;
6169
6309
  const CAPTURE_FAILURE_LENGTH = 1e3;
6170
6310
  const CAPTURE_UPLOAD_BATCH_SIZE = 400;
@@ -6247,7 +6387,7 @@ const captureArtifactSchema = z.strictObject({
6247
6387
  }),
6248
6388
  issues: z.array(z.strictObject({
6249
6389
  code: key,
6250
- message: z.string().min(1).max(CAPTURE_ISSUE_LENGTH)
6390
+ message: z.string().min(1).max(500)
6251
6391
  }))
6252
6392
  }).superRefine((artifact, ctx) => {
6253
6393
  if (artifact.preview.width / artifact.preview.pixelRatio !== artifact.viewport.width || artifact.preview.height / artifact.preview.pixelRatio !== artifact.viewport.height) ctx.addIssue({
@@ -6290,10 +6430,8 @@ const captureRunDescriptorSchema = z.strictObject({
6290
6430
  formatVersion: z.literal(1),
6291
6431
  review: captureReviewMetadataSchema.optional()
6292
6432
  });
6293
- const captureAttemptSchema = z.strictObject({
6433
+ const attemptFields = {
6294
6434
  participant: key,
6295
- testId: key,
6296
- project: key,
6297
6435
  retry: z.number().int().nonnegative(),
6298
6436
  status: z.enum([
6299
6437
  "passed",
@@ -6308,6 +6446,27 @@ const captureAttemptSchema = z.strictObject({
6308
6446
  line: z.number().int()
6309
6447
  }).optional(),
6310
6448
  captures: z.array(captureArtifactSchema)
6449
+ };
6450
+ /**
6451
+ * A Playwright test's attempt, or a script's, which has no test. A Playwright attempt leaves out
6452
+ * `runner`, as every SDK before scripts had their own wrote it, so its manifest digest is unchanged.
6453
+ */
6454
+ const playwrightCaptureAttemptSchema = z.strictObject({
6455
+ runner: z.literal("playwright").optional(),
6456
+ testId: key,
6457
+ project: key,
6458
+ ...attemptFields
6459
+ });
6460
+ const scriptCaptureAttemptSchema = z.strictObject({
6461
+ runner: z.literal("script"),
6462
+ ...attemptFields
6463
+ });
6464
+ const captureAttemptSchema = z.union([playwrightCaptureAttemptSchema, scriptCaptureAttemptSchema]);
6465
+ /** A capture the SDK or the selection left out; `message` is one of `CAPTURE_LEFT_OUT_REASONS`. */
6466
+ const captureLeftOutSchema = z.strictObject({
6467
+ key: captureKeySchema.optional(),
6468
+ testId: key.optional(),
6469
+ message: z.string().min(1).max(500)
6311
6470
  });
6312
6471
  const captureManifestSchema = z.strictObject({
6313
6472
  format: z.literal("enhance-capture-run"),
@@ -6322,7 +6481,8 @@ const captureManifestSchema = z.strictObject({
6322
6481
  ])
6323
6482
  })).min(1),
6324
6483
  attempts: z.array(captureAttemptSchema),
6325
- ordering: z.enum(["partial", "complete"])
6484
+ ordering: z.enum(["partial", "complete"]),
6485
+ leftOut: z.array(captureLeftOutSchema).optional()
6326
6486
  });
6327
6487
  const captureReceiptSchema = z.strictObject({
6328
6488
  runId: z.uuid(),
@@ -6337,7 +6497,7 @@ const captureReceiptSchema = z.strictObject({
6337
6497
  })),
6338
6498
  issues: z.array(z.strictObject({
6339
6499
  code: key,
6340
- message: z.string().max(CAPTURE_ISSUE_LENGTH)
6500
+ message: z.string().max(500)
6341
6501
  }))
6342
6502
  });
6343
6503
  const beginCaptureRunInputSchema = z.strictObject({
@@ -6394,6 +6554,38 @@ const reserveCaptureBlobsOutputSchema = z.strictObject({ uploads: z.array(z.stri
6394
6554
  }).nullable()
6395
6555
  })).max(CAPTURE_UPLOAD_BATCH_SIZE) });
6396
6556
 
6557
+ //#endregion
6558
+ //#region ../../packages/contract/src/recording/frozen-screen.schema.ts
6559
+ const MAX_ISSUE_CODE_LENGTH = 160;
6560
+ const MAX_ISSUE_MESSAGE_LENGTH = 500;
6561
+ const MAX_ISSUE_KINDS = 32;
6562
+ const frozenScreenIssuesSchema = z$1.array(z$1.object({
6563
+ code: z$1.string().check(z$1.minLength(1), z$1.maxLength(MAX_ISSUE_CODE_LENGTH)),
6564
+ message: z$1.string().check(z$1.minLength(1), z$1.maxLength(MAX_ISSUE_MESSAGE_LENGTH))
6565
+ })).check(z$1.maxLength(MAX_ISSUE_KINDS));
6566
+ /** Missing issues are historical or unreported; an empty array explicitly reports no omissions. */
6567
+ const frozenScreenCaptureSchema = z$1.object({
6568
+ issues: z$1.optional(frozenScreenIssuesSchema),
6569
+ prototype: z$1.optional(z$1.object({
6570
+ prototypeId: z$1.uuid(),
6571
+ deploymentId: z$1.uuid()
6572
+ }))
6573
+ });
6574
+
6575
+ //#endregion
6576
+ //#region ../../packages/contract/src/capture/capture-issue.lib.ts
6577
+ /** Why a capture was left out, in words about the capture; a check's own text goes to a log. */
6578
+ const CAPTURE_LEFT_OUT_REASONS = {
6579
+ unreadable: "its saved capture could not be read",
6580
+ notACapture: "it is not an Enhance capture",
6581
+ pictureMismatch: "its picture does not match the size of its page",
6582
+ nothingArrived: "none of its files arrived",
6583
+ notSaved: "it could not be saved on this machine",
6584
+ noPicture: "it could not be compiled and has no picture",
6585
+ anotherSource: "it was captured for another source",
6586
+ outsideShards: "its test ran outside this run's shards"
6587
+ };
6588
+
6397
6589
  //#endregion
6398
6590
  //#region ../../packages/contract/src/capture/capture-name.lib.ts
6399
6591
  const CODE_LENGTH = 8;
@@ -7305,7 +7497,7 @@ const ROOT_FIXTURE_NODE_ID = "root";
7305
7497
  const SORT_KEY_DIGITS = 4;
7306
7498
  const sortKeyAt = (seat) => `a${String(seat).padStart(SORT_KEY_DIGITS, "0")}`;
7307
7499
  const emptyFixtureDocument = () => ({
7308
- version: 13,
7500
+ version: 14,
7309
7501
  nodes: { [ROOT_FIXTURE_NODE_ID]: {
7310
7502
  id: ROOT_FIXTURE_NODE_ID,
7311
7503
  label: "Canvas",
@@ -7928,24 +8120,6 @@ const requestPrototypeRuntimeTicketOutputSchema = z.object({
7928
8120
  expiresAt: z.iso.datetime()
7929
8121
  });
7930
8122
 
7931
- //#endregion
7932
- //#region ../../packages/contract/src/recording/frozen-screen.schema.ts
7933
- const MAX_ISSUE_CODE_LENGTH = 160;
7934
- const MAX_ISSUE_MESSAGE_LENGTH = 500;
7935
- const MAX_ISSUE_KINDS = 32;
7936
- const frozenScreenIssuesSchema = z$1.array(z$1.object({
7937
- code: z$1.string().check(z$1.minLength(1), z$1.maxLength(MAX_ISSUE_CODE_LENGTH)),
7938
- message: z$1.string().check(z$1.minLength(1), z$1.maxLength(MAX_ISSUE_MESSAGE_LENGTH))
7939
- })).check(z$1.maxLength(MAX_ISSUE_KINDS));
7940
- /** Missing issues are historical or unreported; an empty array explicitly reports no omissions. */
7941
- const frozenScreenCaptureSchema = z$1.object({
7942
- issues: z$1.optional(frozenScreenIssuesSchema),
7943
- prototype: z$1.optional(z$1.object({
7944
- prototypeId: z$1.uuid(),
7945
- deploymentId: z$1.uuid()
7946
- }))
7947
- });
7948
-
7949
8123
  //#endregion
7950
8124
  //#region ../../packages/contract/src/prototype/prototype-bridge.schema.ts
7951
8125
  const PROTOTYPE_BRIDGE_PROTOCOL = 1;
@@ -7984,7 +8158,9 @@ const prototypeBridgeCaptureRequestSchema = z$1.object({
7984
8158
  type: z$1.literal("enhance.prototype.capture"),
7985
8159
  requestId: z$1.uuid(),
7986
8160
  connectionId: z$1.optional(z$1.uuid()),
7987
- documentId: z$1.optional(z$1.uuid())
8161
+ documentId: z$1.optional(z$1.uuid()),
8162
+ /** Absent for Capture; `menu-svg` asks for a menu picture, which adds no layer. */
8163
+ format: z$1.optional(z$1.literal("menu-svg"))
7988
8164
  });
7989
8165
  const prototypeBridgeConnectRequestSchema = z$1.object({
7990
8166
  protocol: z$1.literal(1),
@@ -8059,7 +8235,19 @@ const capturedPrototypeScreenSchema = z$1.object({
8059
8235
  width: z$1.number().check(z$1.positive()),
8060
8236
  height: z$1.number().check(z$1.positive())
8061
8237
  }),
8062
- title: z$1.string()
8238
+ title: z$1.string(),
8239
+ /**
8240
+ * The files the screen names, fetched inside the prototype's frame, which can read them. Their
8241
+ * bytes are transferred with the message, and the host keeps them as files of the screen.
8242
+ */
8243
+ files: z$1.optional(z$1.object({
8244
+ named: z$1.array(z$1.string()),
8245
+ fetched: z$1.array(z$1.object({
8246
+ url: z$1.string(),
8247
+ contentType: z$1.string(),
8248
+ bytes: z$1.custom((value) => Object.prototype.toString.call(value) === "[object ArrayBuffer]")
8249
+ }))
8250
+ }))
8063
8251
  });
8064
8252
  const prototypeBridgeCaptureResponseBaseSchema = z$1.object({
8065
8253
  protocol: z$1.literal(1),
@@ -8068,15 +8256,22 @@ const prototypeBridgeCaptureResponseBaseSchema = z$1.object({
8068
8256
  connectionId: z$1.optional(z$1.uuid()),
8069
8257
  documentId: z$1.optional(z$1.uuid())
8070
8258
  });
8071
- const prototypeBridgeCaptureResponseSchema = z$1.discriminatedUnion("outcome", [z$1.extend(prototypeBridgeCaptureResponseBaseSchema, {
8072
- outcome: z$1.literal("captured"),
8073
- screen: capturedPrototypeScreenSchema,
8074
- issues: z$1.optional(frozenScreenIssuesSchema)
8075
- }), z$1.extend(prototypeBridgeCaptureResponseBaseSchema, {
8076
- outcome: z$1.literal("failed"),
8077
- error: z$1.string().check(z$1.minLength(1)),
8078
- code: z$1.optional(z$1.enum(["capture-failed", "capture-busy"]))
8079
- })]);
8259
+ const prototypeBridgeCaptureResponseSchema = z$1.discriminatedUnion("outcome", [
8260
+ z$1.extend(prototypeBridgeCaptureResponseBaseSchema, {
8261
+ outcome: z$1.literal("captured"),
8262
+ screen: capturedPrototypeScreenSchema,
8263
+ issues: z$1.optional(frozenScreenIssuesSchema)
8264
+ }),
8265
+ z$1.extend(prototypeBridgeCaptureResponseBaseSchema, {
8266
+ outcome: z$1.literal("menu-svg"),
8267
+ markup: z$1.string().check(z$1.startsWith("data:image/svg+xml"))
8268
+ }),
8269
+ z$1.extend(prototypeBridgeCaptureResponseBaseSchema, {
8270
+ outcome: z$1.literal("failed"),
8271
+ error: z$1.string().check(z$1.minLength(1)),
8272
+ code: z$1.optional(z$1.enum(["capture-failed", "capture-busy"]))
8273
+ })
8274
+ ]);
8080
8275
 
8081
8276
  //#endregion
8082
8277
  //#region ../../packages/contract/src/prototype/prototype-input.schema.ts
@@ -8416,7 +8611,9 @@ const recordingSummarySchema = z.object({
8416
8611
  viewport: viewportSchema,
8417
8612
  interrupted: z.boolean(),
8418
8613
  chunkCount: z.number().int().min(0),
8419
- startedAt: z.iso.datetime()
8614
+ startedAt: z.iso.datetime(),
8615
+ /** A walkthrough copy: its player arrives with the paste or duplicate, never placed by itself. */
8616
+ isCopy: z.boolean()
8420
8617
  });
8421
8618
  /**
8422
8619
  * @justified intent
@@ -8430,26 +8627,40 @@ const recordingSummarySchema = z.object({
8430
8627
  * Batched: a page asks for tens of files, and a per-file round trip would cost more than the
8431
8628
  * bytes do.
8432
8629
  */
8433
- const reserveAssetsInputSchema = z.object({
8630
+ const reservedAssetsSchema = z.array(z.object({
8631
+ url: z.url(),
8632
+ contentType: z.string().min(1).max(200),
8633
+ byteSize: z.number().int().min(1),
8634
+ /** The hex SHA-256 of the file's bytes, which a checksum-signed upload is held to. */
8635
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u).optional()
8636
+ })).max(MAX_ASSETS_PER_CALL);
8637
+ /**
8638
+ * Files go into a walkthrough's bundle, or, for a screen with no walkthrough such as a prototype
8639
+ * capture, into that screen's own bundle, which the screen's owner reserves them into by its id.
8640
+ */
8641
+ const reserveAssetsInputSchema = z.union([z.object({
8434
8642
  recordingId: z.uuid(),
8435
- assets: z.array(z.object({
8436
- url: z.url(),
8437
- contentType: z.string().min(1).max(200),
8438
- byteSize: z.number().int().min(1)
8439
- })).max(MAX_ASSETS_PER_CALL)
8440
- });
8643
+ assets: reservedAssetsSchema
8644
+ }), z.object({
8645
+ screenId: z.uuid(),
8646
+ assets: reservedAssetsSchema
8647
+ })]);
8441
8648
  const reserveAssetsOutputSchema = z.object({ reserved: z.array(z.object({
8442
8649
  url: z.string(),
8443
8650
  upload: signedUploadSchema
8444
8651
  })) });
8445
- const confirmAssetsInputSchema = z.object({
8652
+ const arrivedAssetsSchema = z.array(z.object({
8653
+ url: z.url(),
8654
+ etag: z.string().min(1).max(200),
8655
+ byteSize: z.number().int().min(1)
8656
+ })).max(MAX_ASSETS_PER_CALL);
8657
+ const confirmAssetsInputSchema = z.union([z.object({
8446
8658
  recordingId: z.uuid(),
8447
- arrived: z.array(z.object({
8448
- url: z.url(),
8449
- etag: z.string().min(1).max(200),
8450
- byteSize: z.number().int().min(1)
8451
- })).max(MAX_ASSETS_PER_CALL)
8452
- });
8659
+ arrived: arrivedAssetsSchema
8660
+ }), z.object({
8661
+ screenId: z.uuid(),
8662
+ arrived: arrivedAssetsSchema
8663
+ })]);
8453
8664
  const confirmAssetsOutputSchema = z.object({
8454
8665
  /** Reserved and never delivered. Reported rather than left for the replay to discover. */
8455
8666
  missingAssetCount: z.number().int().min(0) });
@@ -8513,7 +8724,9 @@ const refreshRecordingUploadOutputSchema = z.object({ upload: signedUploadSchema
8513
8724
  const confirmRecordingUploadInputSchema = refreshRecordingUploadInputSchema.extend({ etag: z.string().min(1).max(200) });
8514
8725
  const confirmRecordingUploadOutputSchema = z.object({ integrity: recordingIntegritySchema });
8515
8726
  const listRecordingsInputSchema = z.object({ canvasId: z.uuid() });
8516
- const listRecordingsOutputSchema = cappedSchema(recordingSummarySchema);
8727
+ const listRecordingsOutputSchema = cappedSchema(recordingSummarySchema).extend({
8728
+ /** Completed recordings left out because their facts are missing; the API logs each by ID. */
8729
+ unreadableCount: z.number().int().min(0) });
8517
8730
  const discardRecordingInputSchema = z.object({ recordingId: z.uuid() });
8518
8731
  const discardRecordingOutputSchema = z.object({
8519
8732
  recordingId: z.uuid(),
@@ -8571,7 +8784,9 @@ const createScreenInputSchema = z.object({
8571
8784
  width: z.number().int().positive(),
8572
8785
  height: z.number().int().positive()
8573
8786
  }),
8574
- bytes: z.number().int().min(1).max(Number.MAX_SAFE_INTEGER)
8787
+ bytes: z.number().int().min(1).max(Number.MAX_SAFE_INTEGER),
8788
+ /** The hex SHA-256 of the screen file; when given, the upload address takes only those bytes. */
8789
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u).optional()
8575
8790
  });
8576
8791
  const createScreenOutputSchema = z.object({
8577
8792
  screenId: z.uuid(),
@@ -8667,7 +8882,7 @@ const clientConversionOutputSchema = z.object({ accepted: z.literal(true) });
8667
8882
  //#region ../../packages/contract/src/shared/client-performance.schema.ts
8668
8883
  const MAX_CAPABILITY_VERSION$1 = 16;
8669
8884
  const MAX_DURATION_MS$1 = 18e5;
8670
- const MAX_COUNT = 1e6;
8885
+ const MAX_COUNT$1 = 1e6;
8671
8886
  const MAX_BYTES = 1073741824;
8672
8887
  const MAX_PROTOTYPE_OPEN_ATTEMPTS = 16;
8673
8888
  /** How the read of a canvas's unsaved browser copy ended when the canvas opened. */
@@ -8677,7 +8892,7 @@ const browserCopyCheckSchema = z.enum([
8677
8892
  "none"
8678
8893
  ]);
8679
8894
  const durationSchema$1 = z.number().int().min(0).max(MAX_DURATION_MS$1);
8680
- const countSchema = z.number().int().min(0).max(MAX_COUNT);
8895
+ const countSchema = z.number().int().min(0).max(MAX_COUNT$1);
8681
8896
  const base$1 = {
8682
8897
  canvasId: z.uuid(),
8683
8898
  clientViewId: z.uuid(),
@@ -8709,10 +8924,15 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
8709
8924
  "ready",
8710
8925
  "slow",
8711
8926
  "degraded",
8712
- "timed-out"
8927
+ "timed-out",
8928
+ "unavailable"
8713
8929
  ]),
8714
8930
  bottleneck: z.enum([
8715
8931
  "metadata",
8932
+ "details",
8933
+ "document",
8934
+ "walkthrough-list",
8935
+ "restore",
8716
8936
  "projection",
8717
8937
  "sources",
8718
8938
  "replays"
@@ -8758,6 +8978,12 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
8758
8978
  nodeCount: countSchema,
8759
8979
  replayCount: countSchema
8760
8980
  }),
8981
+ z.object({
8982
+ ...base$1,
8983
+ name: z.literal("canvas_measurement"),
8984
+ outcome: z.literal("drift"),
8985
+ layerCount: countSchema
8986
+ }),
8761
8987
  z.object({
8762
8988
  ...base$1,
8763
8989
  name: z.literal("prototype_open"),
@@ -8781,7 +9007,12 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
8781
9007
  "denied",
8782
9008
  "expired-or-used",
8783
9009
  "temporary-error",
8784
- "deadline"
9010
+ "deadline",
9011
+ "ticket-held",
9012
+ "gate-silent",
9013
+ "exchange-held",
9014
+ "document-held",
9015
+ "document-unconfirmed"
8785
9016
  ]),
8786
9017
  attempts: z.number().int().min(1).max(MAX_PROTOTYPE_OPEN_ATTEMPTS),
8787
9018
  durationMs: durationSchema$1,
@@ -8826,6 +9057,10 @@ const clientPerformanceOutputSchema = z.object({ accepted: z.literal(true) });
8826
9057
  const MAX_ASSET_LENGTH = 128;
8827
9058
  const MAX_FRAME_COORDINATE = 1e7;
8828
9059
  const MAX_FRAMES = 8;
9060
+ const MAX_COUNT = 1e3;
9061
+ const HTTP_STATUS_LOWEST = 100;
9062
+ const HTTP_STATUS_HIGHEST = 599;
9063
+ const count$1 = z.number().int().min(0).max(MAX_COUNT);
8829
9064
  const clientRenderFailureDetailsSchema = z.strictObject({
8830
9065
  version: z.literal(1),
8831
9066
  severity: z.enum([
@@ -8856,9 +9091,16 @@ const clientRenderFailureDetailsSchema = z.strictObject({
8856
9091
  "application-empty",
8857
9092
  "startup-stalled",
8858
9093
  "export-incomplete",
9094
+ "export-image-refused",
9095
+ "export-image-unreachable",
9096
+ "export-image-not-an-image",
9097
+ "export-font-unread",
8859
9098
  "clipboard-unavailable",
8860
9099
  "clipboard-image-pending",
8861
- "clipboard-image-unavailable"
9100
+ "clipboard-image-unavailable",
9101
+ "edit-target-unsupported",
9102
+ "react-hook-order",
9103
+ "menu-rows-unsupported"
8862
9104
  ]),
8863
9105
  controlId: z.enum([
8864
9106
  "canvas-stacking",
@@ -8870,6 +9112,7 @@ const clientRenderFailureDetailsSchema = z.strictObject({
8870
9112
  outcome: z.enum([
8871
9113
  "failed",
8872
9114
  "displayed",
9115
+ "shown",
8873
9116
  "retried",
8874
9117
  "recovered"
8875
9118
  ]),
@@ -8877,7 +9120,33 @@ const clientRenderFailureDetailsSchema = z.strictObject({
8877
9120
  asset: z.string().max(MAX_ASSET_LENGTH).regex(/^[\w-][\w.-]*\.js$/u),
8878
9121
  line: z.number().int().min(1).max(MAX_FRAME_COORDINATE),
8879
9122
  column: z.number().int().min(1).max(MAX_FRAME_COORDINATE)
8880
- })).max(MAX_FRAMES)
9123
+ })).max(MAX_FRAMES),
9124
+ occurredAt: z.iso.datetime().optional(),
9125
+ clientBuild: z.string().regex(/^[\w-]{1,64}$/u).optional(),
9126
+ frameStatus: z.enum([
9127
+ "recorded",
9128
+ "no-stack",
9129
+ "no-application-frames",
9130
+ "malformed-stack",
9131
+ "no-asset-list",
9132
+ "kept-local"
9133
+ ]).optional(),
9134
+ subsystem: z.enum([
9135
+ "menu",
9136
+ "menu-picture",
9137
+ "unknown"
9138
+ ]).optional(),
9139
+ repeats: count$1.optional(),
9140
+ /** How many images or fonts an export could not read, for the `export-…-unread` codes. */
9141
+ resourceCount: count$1.optional(),
9142
+ /** The status a refused export read answered with. */
9143
+ httpStatus: z.number().int().min(HTTP_STATUS_LOWEST).max(HTTP_STATUS_HIGHEST).optional(),
9144
+ deliveryGap: z.strictObject({
9145
+ refused: count$1,
9146
+ expired: count$1,
9147
+ evicted: count$1,
9148
+ exhausted: count$1
9149
+ }).optional()
8881
9150
  });
8882
9151
  const incidentFields = {
8883
9152
  incidentId: z.uuid(),
@@ -8895,6 +9164,24 @@ const clientRenderFailureInputSchema = z.discriminatedUnion("surface", [z.object
8895
9164
  })]);
8896
9165
  const clientRenderFailureOutputSchema = z.object({ accepted: z.literal(true) });
8897
9166
 
9167
+ //#endregion
9168
+ //#region ../../packages/contract/src/canvas/canvas-object-kinds.consts.ts
9169
+ /** Each object kind by name, for records that may state which kind and nothing else. */
9170
+ const CANVAS_OBJECT_KINDS = [
9171
+ "root",
9172
+ "page",
9173
+ "screen",
9174
+ "frame",
9175
+ "group",
9176
+ "rectangle",
9177
+ "image",
9178
+ "svg",
9179
+ "boolean",
9180
+ "recording",
9181
+ "prototype",
9182
+ "text"
9183
+ ];
9184
+
8898
9185
  //#endregion
8899
9186
  //#region ../../packages/contract/src/shared/client-save.schema.ts
8900
9187
  /** Why the sync owner could not merge pending text the ordinary way. Never document content. */
@@ -8922,7 +9209,8 @@ const CANVAS_SYNC_REPORTS = [
8922
9209
  "deleted-target",
8923
9210
  "whole-value-text",
8924
9211
  "retrying",
8925
- "recovery"
9212
+ "recovery",
9213
+ "trace"
8926
9214
  ];
8927
9215
  const CANVAS_SYNC_DETAILS = [
8928
9216
  ...CLIENT_SAVE_ISSUES,
@@ -8963,6 +9251,150 @@ const CANVAS_SYNC_REPORT_STATUSES = [
8963
9251
  ];
8964
9252
  /** Whether a recovery state began in this visit or was reopened from the browser copy. */
8965
9253
  const CANVAS_SYNC_EPISODES = ["new", "reopened"];
9254
+ /** The transition a traced record states. `reported` marks a report with no step of its own. */
9255
+ const CANVAS_SAVE_TRACE_KINDS = [
9256
+ "started",
9257
+ "resolved",
9258
+ "superseded",
9259
+ "shown",
9260
+ "held-back",
9261
+ "dismissed",
9262
+ "action-started",
9263
+ "action-outcome",
9264
+ "long-wait",
9265
+ "long-wait-ended",
9266
+ "reported"
9267
+ ];
9268
+ /** Why a notice appearance happened, from facts held at that moment. Never guessed from timing. */
9269
+ const CANVAS_SAVE_TRIGGERS = [
9270
+ "departure-protection",
9271
+ "retained-copy-review",
9272
+ "host-priority",
9273
+ "owner-reentry",
9274
+ "new-edit-while-blocked",
9275
+ "restored-work",
9276
+ "new-blocker",
9277
+ "unknown"
9278
+ ];
9279
+ const CANVAS_SAVE_NOTICE_CAUSES = [
9280
+ "offline",
9281
+ "retrying",
9282
+ "upload",
9283
+ "missing-image",
9284
+ "missing-capture",
9285
+ "review",
9286
+ "view-only",
9287
+ "not-backed-up",
9288
+ "gone",
9289
+ "refused",
9290
+ "copy-refused",
9291
+ "copy-preview",
9292
+ "unknown"
9293
+ ];
9294
+ const CANVAS_SAVE_SEVERITIES = [
9295
+ "critical",
9296
+ "warning",
9297
+ "info"
9298
+ ];
9299
+ const CANVAS_SAVE_DEVICE_PROTECTIONS = [
9300
+ "kept",
9301
+ "writing",
9302
+ "unprotected"
9303
+ ];
9304
+ const CANVAS_SAVE_ACTIONS = [
9305
+ "try-again",
9306
+ "sync",
9307
+ "overwrite",
9308
+ "review",
9309
+ "save-copy",
9310
+ "save-separate-copy",
9311
+ "download-copy",
9312
+ "retry-upload",
9313
+ "choose-file",
9314
+ "remove-screen",
9315
+ "go-to-canvases"
9316
+ ];
9317
+ const CANVAS_SAVE_OUTCOMES = [
9318
+ "saved",
9319
+ "kept-copy",
9320
+ "still-blocked"
9321
+ ];
9322
+ const CANVAS_SAVE_REPLAY_STATES = [
9323
+ "active",
9324
+ "disabled",
9325
+ "unavailable"
9326
+ ];
9327
+ /** Why the first waiting change has not been answered. */
9328
+ const CANVAS_SAVE_HOLDS = [
9329
+ "in-flight",
9330
+ "retry-wait",
9331
+ "device-write",
9332
+ "upload",
9333
+ "read",
9334
+ "recovery",
9335
+ "decision",
9336
+ "offline",
9337
+ "paused",
9338
+ "not-held"
9339
+ ];
9340
+ /** Why Sync or Overwrite cannot run now, as a fixed value. */
9341
+ const CANVAS_SYNC_BLOCKS = [
9342
+ "current-changes-unresolved",
9343
+ "checking-saved-canvas",
9344
+ "offline",
9345
+ "saved-canvas-unavailable",
9346
+ "sign-in",
9347
+ "request-unsettled",
9348
+ "no-edit-access",
9349
+ "missing-file",
9350
+ "local-copy-unsaved",
9351
+ "file-unavailable",
9352
+ "invalid-review",
9353
+ "too-large"
9354
+ ];
9355
+ const CANVAS_SAVE_REFUSAL_CODES = [
9356
+ "unknown",
9357
+ "unclassified",
9358
+ ...CANVAS_REFUSAL_CODES
9359
+ ];
9360
+ const OPAQUE_IDENTITY_LENGTH = 256;
9361
+ const MAX_OPERATION_KINDS = 64;
9362
+ const identity = z.string().max(OPAQUE_IDENTITY_LENGTH).regex(/^[\w:.-]*$/u);
9363
+ const count = z.number().int().nonnegative();
9364
+ const listedName = (names) => z.string().refine((name) => name === "unknown" || names.includes(name));
9365
+ const operationName = listedName(CANVAS_OPERATION_NAMES);
9366
+ /**
9367
+ * The lifecycle fields of a save record: counts, listed values and opaque identities, so no field
9368
+ * can carry canvas content, names, addresses or the words of an error.
9369
+ */
9370
+ const canvasSaveTraceSchema = z.strictObject({
9371
+ schema: z.literal(1),
9372
+ eventId: z.uuid(),
9373
+ occurredAt: z.number().int().nonnegative(),
9374
+ kind: z.enum(CANVAS_SAVE_TRACE_KINDS),
9375
+ episodeKey: identity.optional(),
9376
+ nextEpisodeKey: identity.optional(),
9377
+ appearanceId: z.uuid().optional(),
9378
+ trigger: z.enum(CANVAS_SAVE_TRIGGERS).optional(),
9379
+ cause: z.enum(CANVAS_SAVE_NOTICE_CAUSES).optional(),
9380
+ severity: z.enum(CANVAS_SAVE_SEVERITIES),
9381
+ command: z.literal("unknown"),
9382
+ operationKinds: z.array(operationName).max(MAX_OPERATION_KINDS),
9383
+ refusalCode: z.enum(CANVAS_SAVE_REFUSAL_CODES).optional(),
9384
+ operation: operationName.optional(),
9385
+ component: listedName(CANVAS_OBJECT_KINDS).optional(),
9386
+ deviceProtection: z.enum(CANVAS_SAVE_DEVICE_PROTECTIONS),
9387
+ uploadsWaiting: count,
9388
+ uploadsBlocked: count,
9389
+ saveHold: z.enum(CANVAS_SAVE_HOLDS).optional(),
9390
+ actions: z.array(z.enum(CANVAS_SAVE_ACTIONS)).max(CANVAS_SAVE_ACTIONS.length),
9391
+ syncBlock: z.enum(CANVAS_SYNC_BLOCKS).optional(),
9392
+ overwriteBlock: z.enum(CANVAS_SYNC_BLOCKS).optional(),
9393
+ outcome: z.enum(CANVAS_SAVE_OUTCOMES).optional(),
9394
+ action: z.enum(CANVAS_SAVE_ACTIONS).optional(),
9395
+ replay: z.enum(CANVAS_SAVE_REPLAY_STATES),
9396
+ lostRecords: count
9397
+ });
8966
9398
  const clientSaveIncidentInputSchema = z.strictObject({
8967
9399
  canvasId: z.uuid(),
8968
9400
  releaseIdentity: z.string().min(1).max(100),
@@ -8975,9 +9407,20 @@ const clientSaveIncidentInputSchema = z.strictObject({
8975
9407
  pendingChanges: z.number().int().nonnegative(),
8976
9408
  reason: z.enum(CANVAS_SYNC_DETAILS).optional(),
8977
9409
  status: z.enum(CANVAS_SYNC_REPORT_STATUSES).optional(),
8978
- episode: z.enum(CANVAS_SYNC_EPISODES).optional()
9410
+ episode: z.enum(CANVAS_SYNC_EPISODES).optional(),
9411
+ trace: canvasSaveTraceSchema.optional()
9412
+ });
9413
+ /** Whether the API's analytics destination took the record. Older clients ignore it. */
9414
+ const CANVAS_SAVE_ANALYTICS_STATES = [
9415
+ "delivered",
9416
+ "failed",
9417
+ "disabled",
9418
+ "no-identity"
9419
+ ];
9420
+ const clientSaveIncidentOutputSchema = z.object({
9421
+ accepted: z.literal(true),
9422
+ analytics: z.enum(CANVAS_SAVE_ANALYTICS_STATES).optional()
8979
9423
  });
8980
- const clientSaveIncidentOutputSchema = z.object({ accepted: z.literal(true) });
8981
9424
 
8982
9425
  //#endregion
8983
9426
  //#region ../../packages/contract/src/shared/extension-bridge.schema.ts
@@ -9189,12 +9632,28 @@ const extensionTelemetryOutputSchema = z.object({ accepted: z.literal(true) });
9189
9632
 
9190
9633
  //#endregion
9191
9634
  //#region ../../packages/contract/src/shared/request-outcome.lib.ts
9635
+ const listed = (allowed, value) => typeof value === "string" && allowed.includes(value) ? value : null;
9636
+ const refusalOf = (error) => {
9637
+ const { refusalCode, operation, component } = error.fields ?? {};
9638
+ if (refusalCode === void 0 && operation === void 0 && component === void 0) return void 0;
9639
+ const code = CANVAS_SAVE_REFUSAL_CODES.find((value) => value === refusalCode);
9640
+ return {
9641
+ refusalCode: refusalCode === void 0 ? "unclassified" : code ?? "unknown",
9642
+ operation: listed(CANVAS_OPERATION_NAMES, operation) ?? "unknown",
9643
+ component: listed(CANVAS_OBJECT_KINDS, component) ?? "unknown"
9644
+ };
9645
+ };
9192
9646
  /** `fields.retry` on a CONFLICT the server expects to clear by itself. */
9193
9647
  const RETRY_LATER = "later";
9194
9648
  /** `fields.reason` on a CONFLICT that only a client defect can cause. */
9195
9649
  const MUTATION_ID_REUSED = "mutation-id-reused";
9196
9650
  /** The message for input the api's schema refused; `fields` names each field and why. */
9197
9651
  const REQUEST_REJECTED = "that request will not do";
9652
+ /**
9653
+ * `fields.reason` on the NOT_FOUND of a deleted canvas, told only to a person who could read it
9654
+ * before the delete. Lost access, and a canvas the person never had, answer plain NOT_FOUND.
9655
+ */
9656
+ const CANVAS_DELETED = "canvas-deleted";
9198
9657
  /** `fields.reason` on a 413, whether the server's envelope or a proxy's bare status says so. */
9199
9658
  const REQUEST_TOO_LARGE = "request-too-large";
9200
9659
  const HTTP_UNAUTHORIZED = 401;
@@ -9242,9 +9701,11 @@ const badRequestOutcome = (error) => {
9242
9701
  kind: "refused",
9243
9702
  reason: REQUEST_TOO_LARGE
9244
9703
  };
9704
+ const refusal = refusalOf(error);
9245
9705
  return {
9246
9706
  kind: "refused",
9247
- reason: error.message
9707
+ reason: error.message,
9708
+ ...refusal !== void 0 && { refusal }
9248
9709
  };
9249
9710
  };
9250
9711
  const appErrorOutcome = (error, retryAfterMs) => {
@@ -9407,20 +9868,40 @@ const fitCaptureNames = (raw) => {
9407
9868
  }
9408
9869
  return capture;
9409
9870
  };
9871
+ /** The format check's one rule about the picture: its size must be the page's. */
9872
+ const isPictureMismatch = (issues) => issues.length > 0 && issues.every((issue) => issue.path.length === 1 && issue.path[0] === "preview");
9873
+ /** A capture that fails its format check, named in words about the capture, never the check's text. */
9874
+ const leftOutCapture = (capture, testId, issues) => {
9875
+ const key = typeof capture === "object" && capture !== null ? captureKeySchema.safeParse(Reflect.get(capture, "key")) : null;
9876
+ return {
9877
+ ...key?.success === true && { key: key.data },
9878
+ ...testId !== void 0 && { testId },
9879
+ message: isPictureMismatch(issues) ? CAPTURE_LEFT_OUT_REASONS.pictureMismatch : CAPTURE_LEFT_OUT_REASONS.notACapture
9880
+ };
9881
+ };
9882
+ const lenientCaptures = { captures: z.array(z.unknown()) };
9410
9883
  /**
9411
9884
  * A manifest checked in outline, then capture by capture: one capture that fails its own checks
9412
- * is left out, and the rest of the run still publishes.
9885
+ * is left out and named in the manifest's `leftOut`, and the rest of the run still publishes.
9413
9886
  */
9414
- const lenientCaptureManifestSchema = captureManifestSchema.extend({ attempts: z.array(captureAttemptSchema.extend({ captures: z.array(z.unknown()) })) }).transform((manifest) => ({
9415
- ...manifest,
9416
- attempts: manifest.attempts.map((attempt) => ({
9887
+ const lenientCaptureManifestSchema = captureManifestSchema.extend({ attempts: z.array(z.union([playwrightCaptureAttemptSchema.extend(lenientCaptures), scriptCaptureAttemptSchema.extend(lenientCaptures)])) }).transform((manifest) => {
9888
+ const leftOut = [...manifest.leftOut ?? []];
9889
+ const attempts = manifest.attempts.map((attempt) => ({
9417
9890
  ...attempt,
9418
- captures: attempt.captures.flatMap((capture) => {
9419
- const parsed = captureArtifactSchema.safeParse(fitCaptureNames(capture));
9420
- return parsed.success ? [parsed.data] : [];
9891
+ captures: attempt.captures.flatMap((raw) => {
9892
+ const capture = fitCaptureNames(raw);
9893
+ const parsed = captureArtifactSchema.safeParse(capture);
9894
+ if (parsed.success) return [parsed.data];
9895
+ leftOut.push(leftOutCapture(capture, "testId" in attempt ? attempt.testId : void 0, parsed.error.issues));
9896
+ return [];
9421
9897
  })
9422
- }))
9423
- }));
9898
+ }));
9899
+ return {
9900
+ ...manifest,
9901
+ attempts,
9902
+ ...leftOut.length > 0 && { leftOut }
9903
+ };
9904
+ });
9424
9905
  const sealCaptureRunInputSchema = z.strictObject({ manifest: lenientCaptureManifestSchema });
9425
9906
 
9426
9907
  //#endregion
@@ -11346,6 +11827,7 @@ const PROCEDURE_DESCRIPTIONS = {
11346
11827
  "canvas.delete": "Move a canvas to its recoverable bin; retention is currently indefinite.",
11347
11828
  "canvas.move": "Move a canvas between the personal shelf and a team shelf.",
11348
11829
  "canvas.duplicate": "Copy a canvas and its document into the selected shelf.",
11830
+ "canvas.copyWalkthroughs": "Copy walkthroughs from a readable canvas into this one before saving players that name the copies.",
11349
11831
  "canvas.deletePermanently": "Permanently delete a canvas already in the recoverable bin.",
11350
11832
  "canvas.restore": "Restore a canvas from the recoverable bin.",
11351
11833
  "canvas.list": "Find canvas ids by collection, title, access, review state, or deletion state.",
@@ -11405,8 +11887,8 @@ const PROCEDURE_DESCRIPTIONS = {
11405
11887
  "recording.delete": "Soft-delete a completed recording while preserving screens and clearing their provenance.",
11406
11888
  "recording.refreshUpload": "Replace an expired signed upload for a recording chunk.",
11407
11889
  "recording.confirmUpload": "Confirm that a repaired recording chunk reached storage.",
11408
- "recordingAsset.reserve": "Reserve signed uploads for external assets used by a recording.",
11409
- "recordingAsset.confirm": "Confirm which reserved recording assets reached storage.",
11890
+ "recordingAsset.reserve": "Reserve signed uploads for external assets used by a recording or by a screen with no walkthrough.",
11891
+ "recordingAsset.confirm": "Confirm which reserved recording or screen assets reached storage.",
11410
11892
  "screen.create": "Reserve a signed upload for a captured page and return its screen id.",
11411
11893
  "screen.complete": "Confirm a captured page after its bytes have been uploaded.",
11412
11894
  "screen.delete": "Delete an unattached captured page owned by this person."
@@ -11414,6 +11896,10 @@ const PROCEDURE_DESCRIPTIONS = {
11414
11896
 
11415
11897
  //#endregion
11416
11898
  //#region src/infrastructure/procedure-options.consts.ts
11899
+ const PROTOTYPE_UPDATE_GUIDANCE = "To update a prototype, publish to its owner node: pass source.prototypeId and that node's id as source.nodeId. Any other node that shows it forks into its own prototype and keeps its label. An update keeps the title the node shows; you must still pass a title of 200 characters or fewer, which only names a new node.";
11900
+ const PROTOTYPE_TITLE_OPTION = "Label above a new prototype frame, up to 200 characters. An update or a fork ignores it and keeps the title the node shows.";
11901
+ const PROTOTYPE_ID_OPTION = "Existing prototype to update. Without --node-id it goes to the owner node, and is refused if that node is gone.";
11902
+ const PROTOTYPE_NODE_OPTION = "The prototype's owner node to update it. Pass it with --prototype-id; any other node that shows the prototype forks into its own prototype.";
11417
11903
  const OPTION_DESCRIPTIONS = {
11418
11904
  ...CANVAS_VERSION_OPTION_DESCRIPTIONS,
11419
11905
  "--canvas-ref": "Complete canvas, page or selection URL, or canvas UUID. Preserve the supplied scope.",
@@ -11433,7 +11919,7 @@ const OPTION_DESCRIPTIONS = {
11433
11919
  "operation.status --operation": "Exact durable operation reference returned by a prior call, including its kind and identity fields.",
11434
11920
  "operation.status --include-image": "Include available render image evidence when true; this does not start another render.",
11435
11921
  "operation.status --offset": "Zero-based entry offset; continue using nextOffset until the result reports complete.",
11436
- "prototype.publishCanvas --source": "Selected local build directory and attachment metadata, or an existing ready deployment to attach after replanning.",
11922
+ "prototype.publishCanvas --source": `Selected local build directory and attachment metadata, or an existing ready deployment to attach after replanning. ${PROTOTYPE_UPDATE_GUIDANCE}`,
11437
11923
  "--canvas-id": "Canvas id, from `enhance canvas list`.",
11438
11924
  "--mutation-id": "Client-minted UUID identifying this atomic canvas mutation.",
11439
11925
  "--organisation-id": "Team id, from `enhance organisation list`.",
@@ -11476,6 +11962,14 @@ const OPTION_DESCRIPTIONS = {
11476
11962
  "--route": "Original page route retained with the captured screen.",
11477
11963
  "--page-title": "Page title retained with the capture or used for a new canvas.",
11478
11964
  "--title": "Human-readable title used to name or find the resource.",
11965
+ "prototype publish --title": PROTOTYPE_TITLE_OPTION,
11966
+ "prototype.publish --title": PROTOTYPE_TITLE_OPTION,
11967
+ "prototype publish --prototype-id": PROTOTYPE_ID_OPTION,
11968
+ "prototype.publish --prototype-id": PROTOTYPE_ID_OPTION,
11969
+ "canvas.node --node-id": "Stable node id returned by `enhance canvas tree`. Required unless --canvas is a single-node selection link.",
11970
+ "prototype publish --node-id": PROTOTYPE_NODE_OPTION,
11971
+ "prototype.publish --node-id": PROTOTYPE_NODE_OPTION,
11972
+ "canvas publish-prototype --input": `Publish request JSON. ${PROTOTYPE_UPDATE_GUIDANCE}`,
11479
11973
  "--email": "Email address of the person to invite or add.",
11480
11974
  "--body": "Comment text; use the JSON input for content that is difficult to quote.",
11481
11975
  "--source-url": "Original page URL associated with the capture or recording.",
@@ -11519,6 +12013,9 @@ const OPTION_DESCRIPTIONS = {
11519
12013
  "auth login --token": "Existing agent token for CI or headless fallback; omit it to authenticate in a browser.",
11520
12014
  "canvas.create --organisation-id": "Team UUID from `enhance organisation list`; omit it to create on the personal shelf.",
11521
12015
  "canvas.move --organisation-id": "Destination team UUID from `enhance organisation list`, or the literal `personal`.",
12016
+ "canvas.copyWalkthroughs --canvas-id": "Destination canvas id, from `enhance canvas list`; you need edit access to it.",
12017
+ "canvas.copyWalkthroughs --source-canvas-id": "Canvas id the walkthroughs are on, from `enhance canvas list`; you need read access to it.",
12018
+ "canvas.copyWalkthroughs --recording-ids": "Walkthrough ids on the source canvas, from `enhance recording list`; each gets one copy.",
11522
12019
  "canvas.duplicate --organisation-id": "Destination team UUID from `enhance organisation list`, or the literal `personal`.",
11523
12020
  "canvas.deletePermanently --confirmation": "Exact canvas title returned by `enhance canvas list --deleted true`.",
11524
12021
  "canvas.textStyleLibrary.list --search": "Match published library titles in your teams and files shared with you.",
@@ -11555,13 +12052,16 @@ const OPTION_DESCRIPTIONS = {
11555
12052
  "recording.start --page-title": "Required captured page title, or the literal null.",
11556
12053
  "recording.appendChunk --etag": "ETag from the already-uploaded chunk at --index; omit only when abandoning that range.",
11557
12054
  "recording.appendAudioChunk --etag": "ETag from the already-uploaded audio chunk at --index; omit only when abandoning it.",
11558
- "recordingAsset.reserve --assets": "One or more JSON objects shaped `{\"url\":\"https://…\",\"contentType\":\"image/png\",\"byteSize\":123}`.",
12055
+ "recordingAsset.reserve --assets": "One or more JSON objects shaped `{\"url\":\"https://…\",\"contentType\":\"image/png\",\"byteSize\":123}`, with an optional hex `\"sha256\"` that the upload is then held to.",
12056
+ "recordingAsset.reserve --screen-id": "Screen id from `enhance screen create` for a capture with no walkthrough; use instead of --recording-id.",
12057
+ "recordingAsset.confirm --screen-id": "Screen id the files were reserved against; use instead of --recording-id.",
11559
12058
  "recordingAsset.confirm --arrived": "One or more JSON objects shaped `{\"url\":\"https://…\",\"etag\":\"…\",\"byteSize\":123}`.",
11560
12059
  "screen.create --client-token": "Client-minted capture UUID; reuse it when retrying the same screen reservation.",
11561
12060
  "screen.create --is-recording-mark": "Defaults to true for recording marks. Use false for an explicit canvas capture that retains recording provenance without adding a recording mark.",
11562
12061
  "screen.create --provenance": "Required origin JSON `{\"sourceRecordingId\":\"UUID\",\"atMs\":0}`, or the literal null.",
11563
12062
  "screen.create --route": "Required original page route, or the literal null.",
11564
12063
  "screen.create --page-title": "Required captured page title, or the literal null.",
12064
+ "screen.create --sha256": "Optional hex SHA-256 of the screen file; the upload address then accepts only those bytes.",
11565
12065
  "fixture recording --source-url": "Required original page URL represented by this recording."
11566
12066
  };
11567
12067
 
@@ -11580,7 +12080,7 @@ const ordered = (value) => {
11580
12080
  return Object.fromEntries(Object.entries(record).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, held]) => [key, ordered(held)]));
11581
12081
  };
11582
12082
  const digest = (value) => createHash("sha256").update(JSON.stringify(ordered(value))).digest("hex");
11583
- const kebab = (value) => value.replaceAll(/[A-Z]/gu, (letter) => `-${letter.toLowerCase()}`);
12083
+ const toKebabCase = (value) => value.replaceAll(/[A-Z]/gu, (letter) => `-${letter.toLowerCase()}`);
11584
12084
  const fieldsFrom = (schemaValue, procedure, direction) => {
11585
12085
  const schema = recordFrom$2(schemaValue);
11586
12086
  const properties = recordFrom$2(schema?.["properties"]);
@@ -11588,7 +12088,7 @@ const fieldsFrom = (schemaValue, procedure, direction) => {
11588
12088
  const required = new Set(Array.isArray(schema?.["required"]) ? schema["required"] : []);
11589
12089
  return Object.entries(properties).map(([name, property]) => {
11590
12090
  const detail = recordFrom$2(property);
11591
- const option = `--${kebab(name)}`;
12091
+ const option = `--${toKebabCase(name)}`;
11592
12092
  const meaning = direction === "input" ? OPTION_DESCRIPTIONS[`${procedure} ${option}`] ?? OPTION_DESCRIPTIONS[option] : void 0;
11593
12093
  return {
11594
12094
  name,
@@ -11735,6 +12235,15 @@ const CANVAS_RECOVERY_POLICIES = {
11735
12235
  "canvas.chats.delete": CHAT_HISTORY_POLICY
11736
12236
  };
11737
12237
 
12238
+ //#endregion
12239
+ //#region src/infrastructure/recovery-copy-capability.consts.ts
12240
+ /** Save a copy and Open recovery file run in the browser; an agent copies with canvas.duplicate. */
12241
+ const RECOVERY_COPY_POLICY = {
12242
+ exposure: "internal",
12243
+ reason: "Browser recovery copies of unsaved work; agents copy a canvas with canvas.duplicate.",
12244
+ owner: "product"
12245
+ };
12246
+
11738
12247
  //#endregion
11739
12248
  //#region src/infrastructure/capability-policy.consts.ts
11740
12249
  const FONT_ASSET_POLICY = {
@@ -11833,6 +12342,7 @@ const PROCEDURE_CAPABILITY_POLICIES = {
11833
12342
  },
11834
12343
  ...CANVAS_RECOVERY_POLICIES,
11835
12344
  "canvas.chats.publish": CHAT_HISTORY_POLICY,
12345
+ "canvas.copyFromWork": RECOVERY_COPY_POLICY,
11836
12346
  "canvas.applyOperations": {
11837
12347
  exposure: "internal",
11838
12348
  reason: "Wrapped by bounded, intention-revealing authoring capabilities.",
@@ -11985,6 +12495,7 @@ const PROCEDURE_CAPABILITY_POLICIES = {
11985
12495
  //#endregion
11986
12496
  //#region src/infrastructure/shared-capability-procedure.consts.ts
11987
12497
  const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
12498
+ "canvas.copyWalkthroughs",
11988
12499
  "canvas.create",
11989
12500
  "canvas.createEditableFrame",
11990
12501
  "canvas.delete",
@@ -12525,7 +13036,8 @@ const PROCEDURES_WITHOUT_GENERIC_RECEIPTS = /* @__PURE__ */ new Set([
12525
13036
  "canvas.render.create",
12526
13037
  "canvas.render.importSource",
12527
13038
  "canvas.render.preparation.create",
12528
- "screen.create"
13039
+ "screen.create",
13040
+ "canvas.copyFromWork"
12529
13041
  ]);
12530
13042
  const outcomeFrom = (result) => {
12531
13043
  if (result.ok) return {
@@ -12626,7 +13138,8 @@ const timed = trpcMiddleware(async ({ ctx, path, type, next }) => {
12626
13138
  outcome: await next(),
12627
13139
  statements: span.statements,
12628
13140
  blobAttempts: span.blobAttempts,
12629
- degraded: span.degraded
13141
+ degraded: span.degraded,
13142
+ layerRows: span.layerRows
12630
13143
  }));
12631
13144
  const failure = call.outcome.ok ? null : failureOf(call.outcome.error);
12632
13145
  const line = {
@@ -12636,6 +13149,8 @@ const timed = trpcMiddleware(async ({ ctx, path, type, next }) => {
12636
13149
  kind: type,
12637
13150
  durationMs: Math.round(performance.now() - startedAt),
12638
13151
  queryCount: call.statements.length,
13152
+ layerRowsRead: call.layerRows.read,
13153
+ layerRowsWritten: call.layerRows.written,
12639
13154
  blobCallCount: call.blobAttempts.length,
12640
13155
  blobRetryCount: call.blobAttempts.reduce((total, made) => total + made.attempts - 1, 0),
12641
13156
  degraded: call.degraded.toSorted((a, b) => a.localeCompare(b)).join(","),
@@ -12727,7 +13242,7 @@ const withAccess = trpcMiddleware(async ({ ctx, getRawInput, next }) => {
12727
13242
  })).match((snapshot) => snapshot, (error) => {
12728
13243
  throw toTrpcError(error);
12729
13244
  });
12730
- if (!access.canRead) throw toTrpcError(appError$1("NOT_FOUND", "no such canvas"));
13245
+ if (!access.canRead) throw toTrpcError(access.isDeletedForReader === true ? appError$1("NOT_FOUND", "no such canvas", { reason: CANVAS_DELETED }) : appError$1("NOT_FOUND", "no such canvas"));
12731
13246
  ctx.tag("canvasId", scope.data.canvasId);
12732
13247
  return next({ ctx: {
12733
13248
  ...ctx,
@@ -12821,22 +13336,21 @@ const toCanvasActorColour = (identity) => {
12821
13336
  for (const character of identity) hash = hash * HASH_RADIX + (character.codePointAt(0) ?? 0) >>> 0;
12822
13337
  return COLOURS[hash % COLOURS.length] ?? "blue";
12823
13338
  };
12824
- const toCanvasMutationActor = (viewer) => {
12825
- const common = {
12826
- personId: viewer.personId,
12827
- displayName: viewer.displayName,
12828
- initials: viewer.initials,
12829
- colour: toCanvasActorColour(viewer.kind === "agent" ? viewer.tokenId : viewer.personId)
12830
- };
12831
- return viewer.kind === "agent" ? {
12832
- ...common,
12833
- kind: "agent",
12834
- tokenLabel: viewer.tokenLabel,
12835
- ...viewer.agentAttribution !== void 0 && { agentAttribution: viewer.agentAttribution }
12836
- } : {
12837
- ...common,
12838
- kind: "person"
12839
- };
13339
+ const toAgentCanvasActor = (input) => ({
13340
+ personId: input.personId,
13341
+ displayName: input.displayName,
13342
+ initials: input.initials,
13343
+ colour: toCanvasActorColour(input.tokenId),
13344
+ kind: "agent",
13345
+ tokenLabel: input.tokenLabel,
13346
+ ...input.agentAttribution !== void 0 && { agentAttribution: input.agentAttribution }
13347
+ });
13348
+ const toCanvasMutationActor = (viewer) => viewer.kind === "agent" ? toAgentCanvasActor(viewer) : {
13349
+ personId: viewer.personId,
13350
+ displayName: viewer.displayName,
13351
+ initials: viewer.initials,
13352
+ colour: toCanvasActorColour(viewer.personId),
13353
+ kind: "person"
12840
13354
  };
12841
13355
  const toAgentCanvasRequestActor = (viewer) => viewer.kind === "agent" ? {
12842
13356
  personId: viewer.personId,
@@ -12875,7 +13389,8 @@ const toCanvasContract = (view) => ({
12875
13389
  grants: [...view.reach.grants],
12876
13390
  grantableAccessLevels: [...view.reach.grantableAccessLevels],
12877
13391
  share: view.reach.canShare,
12878
- manage: view.reach.canManage
13392
+ manage: view.reach.canManage,
13393
+ readHistory: view.reach.canSeeRoutes
12879
13394
  },
12880
13395
  createdAt: view.canvas.createdAt.toISOString(),
12881
13396
  lastActivityAt: view.canvas.lastActivityAt.toISOString()
@@ -13648,12 +14163,20 @@ const createCanvasChatRouter = (handlers) => trpcRouter({
13648
14163
  * always the creator, so tightening it breaks re-recording onto somebody else's canvas —
13649
14164
  * while widening it lets a `can-view` reviewer rearrange one.
13650
14165
  */
14166
+ /** The line for a catch-up that met an unreadable batch record and answered the document. */
14167
+ const unreadableBatchLine = (canvasId, unreadable) => ({
14168
+ event: "CanvasCatchUpUnreadableBatch",
14169
+ canvasId,
14170
+ mutationId: unreadable.mutationId,
14171
+ version: unreadable.version
14172
+ });
13651
14173
  const getDocument = (handlers) => canvasReaderProcedure.input(getCanvasDocumentInputSchema).output(getCanvasDocumentOutputSchema).query(async ({ input, ctx }) => {
13652
14174
  const result = orThrow(await handlers.getDocument.execute({
13653
14175
  canvasId: input.canvasId,
13654
14176
  afterVersion: input.afterVersion,
13655
14177
  withRoutes: ctx.canvasAccess.canSeeRoutes
13656
14178
  }));
14179
+ if (result.unreadable !== void 0) ctx.logger.error(unreadableBatchLine(input.canvasId, result.unreadable), "event");
13657
14180
  return {
13658
14181
  ...result.mutations !== void 0 && { mutations: result.mutations.map((commit) => ({
13659
14182
  mutationId: commit.mutationId,
@@ -13661,9 +14184,9 @@ const getDocument = (handlers) => canvasReaderProcedure.input(getCanvasDocumentI
13661
14184
  version: commit.version,
13662
14185
  operations: commit.operations.map((operation) => canvasOperationSchema.parse(operation))
13663
14186
  })) },
13664
- version: result.document.version,
13665
- ...(result.document.restoreFenceVersion ?? 0) > 0 && { restoreFenceVersion: result.document.restoreFenceVersion },
13666
- document: result.document.document,
14187
+ version: result.version,
14188
+ ...result.restoreFenceVersion > 0 && { restoreFenceVersion: result.restoreFenceVersion },
14189
+ ...result.document !== void 0 && { document: result.document },
13667
14190
  screens: result.screens.map((screen) => ({
13668
14191
  screenId: screen.screenId,
13669
14192
  clientToken: screen.clientToken,
@@ -14050,6 +14573,18 @@ const remove$1 = (handlers) => personProcedure.input(deleteCanvasInputSchema).ou
14050
14573
  deletedAt: result.deletedAt.toISOString()
14051
14574
  };
14052
14575
  });
14576
+ const copyFromWork = (handlers) => personProcedure.input(copyCanvasFromWorkInputSchema).output(copyCanvasFromWorkOutputSchema).mutation(async ({ input, ctx }) => {
14577
+ const copy = orThrow(await handlers.copyFromWork.execute({
14578
+ ...input,
14579
+ sourceCanvasId: input.sourceCanvasId ?? null,
14580
+ organisationId: input.organisationId === "personal" ? null : input.organisationId,
14581
+ personId: ctx.viewer.personId
14582
+ }));
14583
+ return {
14584
+ canvas: toCanvasContract(copy.view),
14585
+ document: copy.document
14586
+ };
14587
+ });
14053
14588
  const createCanvasLifecycleRouter = (handlers) => trpcRouter({
14054
14589
  delete: remove$1(handlers),
14055
14590
  move: canvasOwnerProcedure.input(moveCanvasInputSchema).output(moveCanvasOutputSchema).mutation(async ({ input, ctx }) => ({ canvas: toCanvasContract(orThrow(await handlers.move.execute({
@@ -14062,6 +14597,7 @@ const createCanvasLifecycleRouter = (handlers) => trpcRouter({
14062
14597
  organisationId: input.organisationId === "personal" ? null : input.organisationId,
14063
14598
  personId: ctx.viewer.personId
14064
14599
  }))) })),
14600
+ copyFromWork: copyFromWork(handlers),
14065
14601
  deletePermanently: personProcedure.input(permanentlyDeleteCanvasInputSchema).output(permanentlyDeleteCanvasOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.removePermanently.execute({
14066
14602
  ...input,
14067
14603
  personId: ctx.viewer.personId
@@ -14413,18 +14949,22 @@ const createCanvasSelectionRoute = (selection, readCanvas) => agentCanvasReaderP
14413
14949
 
14414
14950
  //#endregion
14415
14951
  //#region ../api/src/canvas/infrastructure/canvas-thumbnail.router.ts
14416
- const reportUnavailable = canvasReaderProcedure.input(reportCanvasThumbnailUnavailableInputSchema).output(reportCanvasThumbnailUnavailableOutputSchema).mutation(({ input, ctx }) => {
14952
+ const createCanvasThumbnailRouter = (handlers) => trpcRouter({ reportUnavailable: canvasReaderProcedure.input(reportCanvasThumbnailUnavailableInputSchema).output(reportCanvasThumbnailUnavailableOutputSchema).mutation(async ({ input, ctx }) => {
14953
+ const found = orThrow(await handlers.thumbnailReports.reportUnavailable({
14954
+ canvasId: input.canvasId,
14955
+ thumbnailId: input.thumbnailId
14956
+ }));
14417
14957
  ctx.logger.warn({
14418
14958
  event: "ThumbnailBlobUnavailable",
14419
14959
  canvasId: input.canvasId,
14420
14960
  blobId: input.thumbnailId,
14421
14961
  clientReleaseIdentity: input.clientReleaseIdentity,
14422
14962
  attemptedOperation: input.attemptedOperation,
14423
- recoveryOutcome: input.recoveryOutcome
14963
+ recoveryOutcome: input.recoveryOutcome,
14964
+ storageOutcome: found
14424
14965
  }, "event");
14425
14966
  return { recorded: true };
14426
- });
14427
- const createCanvasThumbnailRouter = () => trpcRouter({ reportUnavailable });
14967
+ }) });
14428
14968
 
14429
14969
  //#endregion
14430
14970
  //#region ../api/src/canvas/infrastructure/canvas-version-contract.mapper.ts
@@ -14571,6 +15111,16 @@ const createCanvasVersionRouter = (handlers) => trpcRouter({
14571
15111
  duplicate: duplicate(handlers)
14572
15112
  });
14573
15113
 
15114
+ //#endregion
15115
+ //#region ../api/src/canvas/infrastructure/canvas-walkthrough.router.ts
15116
+ const createCanvasWalkthroughRouter = (handlers) => trpcRouter({ copyWalkthroughs: canvasEditorProcedure.meta({ description: "Copy walkthroughs from a canvas you can read into this canvas before saving players that name the copies. Each pair names a walkthrough and its copy; one that is deleted, unfinished or unreadable has no pair." }).input(copyCanvasWalkthroughsInputSchema).output(copyCanvasWalkthroughsOutputSchema).mutation(async ({ input, ctx }) => {
15117
+ const { copies } = orThrow(await handlers.copyWalkthroughs.execute({
15118
+ ...input,
15119
+ viewer: ctx.viewer
15120
+ }));
15121
+ return { copies: [...copies] };
15122
+ }) });
15123
+
14574
15124
  //#endregion
14575
15125
  //#region ../api/src/canvas/infrastructure/capture-run.router.ts
14576
15126
  const actorOf$1 = (viewer) => {
@@ -14657,6 +15207,28 @@ const createFontCatalogRouter = ({ fontCatalog }) => trpcRouter({
14657
15207
  })
14658
15208
  });
14659
15209
 
15210
+ //#endregion
15211
+ //#region ../api/src/canvas/domain/render-job-limits.policy.ts
15212
+ const MILLISECONDS_PER_MINUTE = 6e4;
15213
+ const MAX_AGE_MINUTES = 10;
15214
+ const OUTPUT_TTL_MINUTES = 15;
15215
+ const RENDER_JOB_MAX_AGE_MS = MAX_AGE_MINUTES * MILLISECONDS_PER_MINUTE;
15216
+ const RENDER_JOB_OUTPUT_TTL_MS = OUTPUT_TTL_MINUTES * MILLISECONDS_PER_MINUTE;
15217
+ const EXPORT_MAX_AGE_MINUTES = 60;
15218
+ const EXPORT_ATTEMPT_DEADLINE_MINUTES = 30;
15219
+ /** A person's export of a tall or wide layer is banded, so it may run longer than other renders. */
15220
+ const RENDER_EXPORT_MAX_AGE_MS = EXPORT_MAX_AGE_MINUTES * MILLISECONDS_PER_MINUTE;
15221
+ const RENDER_EXPORT_ATTEMPT_DEADLINE_MS = EXPORT_ATTEMPT_DEADLINE_MINUTES * MILLISECONDS_PER_MINUTE;
15222
+ const CAPTURE_COMPILE_ATTEMPT_DEADLINE_MINUTES = 2;
15223
+ /**
15224
+ * A screen compile of a capture run has two minutes of work. A page not editable by then lands as
15225
+ * its picture, so a run never waits on one slow page (Haziq, 7 November 2026).
15226
+ */
15227
+ const RENDER_CAPTURE_COMPILE_ATTEMPT_DEADLINE_MS = CAPTURE_COMPILE_ATTEMPT_DEADLINE_MINUTES * MILLISECONDS_PER_MINUTE;
15228
+ const OUTAGE_RETRY_LIMIT_MS = 15 * MILLISECONDS_PER_MINUTE;
15229
+ /** Tries that a storage outage ended do not count against a job's tries. */
15230
+ const countedRenderJobAttempts = (job) => job.attempt - (job.outageAttempts ?? 0);
15231
+
14660
15232
  //#endregion
14661
15233
  //#region ../api/src/canvas/domain/render-result.value-object.ts
14662
15234
  const isRenderConversionResult = (result) => "rootNodeId" in result;
@@ -14664,6 +15236,18 @@ const isRenderOutputResult = (result) => "storageKey" in result;
14664
15236
 
14665
15237
  //#endregion
14666
15238
  //#region ../api/src/canvas/infrastructure/render-job.presenter.ts
15239
+ /**
15240
+ * The screens a preparation compiles, the tries a worker counts, and when this try ends, so a
15241
+ * screen compile can use all of it.
15242
+ */
15243
+ const toPreparationWorkExposure = (job) => ({
15244
+ screens: job.screens?.map((screen) => toCanvasVersionContractScreen(screen)),
15245
+ attempts: {
15246
+ counted: countedRenderJobAttempts(job),
15247
+ limit: 3
15248
+ },
15249
+ ...job.leaseExpiresAt !== null && { deadlineAt: job.leaseExpiresAt.toISOString() }
15250
+ });
14667
15251
  const wireResult = (job, result) => ({
14668
15252
  canvasId: job.canvasId,
14669
15253
  requestedVersion: job.requestedVersion,
@@ -15005,10 +15589,13 @@ const createExport = (handlers) => canvasPersonReaderProcedure.meta({ descriptio
15005
15589
  };
15006
15590
  });
15007
15591
  const requireExport = (job) => job.purpose === "export" ? job : orThrow((0, import_index_cjs.err)(appError("NOT_FOUND", "no such export")));
15008
- const getExport = (handlers) => personProcedure.input(getCanvasRenderInputSchema).output(getCanvasRenderOutputSchema).query(async ({ input, ctx }) => {
15009
- const job = orThrow(await handlers.get.execute({
15592
+ /** Waits up to `waitMs` for the export to settle, so the editor learns of it as soon as it does. */
15593
+ const getExport = (handlers) => personProcedure.input(getCanvasExportInputSchema).output(getCanvasRenderOutputSchema).query(async ({ input, ctx, signal }) => {
15594
+ const job = orThrow(await handlers.awaitSettled.execute({
15010
15595
  jobId: input.jobId,
15011
- actor: personActorOf(ctx.viewer)
15596
+ actor: personActorOf(ctx.viewer),
15597
+ waitMs: input.waitMs ?? 0,
15598
+ signal
15012
15599
  }));
15013
15600
  return { job: presentRender(requireExport(job)) };
15014
15601
  });
@@ -15059,7 +15646,7 @@ const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderPr
15059
15646
  ...base,
15060
15647
  purpose: job.purpose,
15061
15648
  preparation: job.preparationRequest,
15062
- screens: job.screens?.map((screen) => toCanvasVersionContractScreen(screen)),
15649
+ ...toPreparationWorkExposure(job),
15063
15650
  scale: 1,
15064
15651
  format: "json"
15065
15652
  });
@@ -15770,20 +16357,13 @@ const toAgentPrototypePublisher = (viewer) => {
15770
16357
  displayName: viewer.displayName,
15771
16358
  initials: viewer.initials,
15772
16359
  tokenId: viewer.tokenId,
15773
- tokenLabel: viewer.tokenLabel
16360
+ tokenLabel: viewer.tokenLabel,
16361
+ ...viewer.agentAttribution !== void 0 && { agentAttribution: viewer.agentAttribution }
15774
16362
  }
15775
16363
  };
15776
16364
  };
15777
16365
  const toPrototypePublisher = (viewer) => {
15778
- return {
15779
- personId: viewer.personId,
15780
- ...viewer.kind === "agent" && { publisher: {
15781
- displayName: viewer.displayName,
15782
- initials: viewer.initials,
15783
- tokenId: viewer.tokenId,
15784
- tokenLabel: viewer.tokenLabel
15785
- } }
15786
- };
16366
+ return viewer.kind === "agent" ? toAgentPrototypePublisher(viewer) : { personId: viewer.personId };
15787
16367
  };
15788
16368
 
15789
16369
  //#endregion
@@ -16124,16 +16704,19 @@ const createRecordingRouter = (handlers) => trpcRouter({
16124
16704
  };
16125
16705
  }),
16126
16706
  list: canvasReaderProcedure.input(listRecordingsInputSchema).output(listRecordingsOutputSchema).query(async ({ input }) => {
16707
+ const { recordings, unreadableCount } = orThrow(await handlers.list.execute(input));
16127
16708
  return {
16128
- items: orThrow(await handlers.list.execute(input)).map((recording) => ({
16709
+ items: recordings.map((recording) => ({
16129
16710
  recordingId: recording.id,
16130
16711
  durationMs: recording.durationMs,
16131
16712
  viewport: recording.viewport,
16132
16713
  interrupted: recording.interrupted,
16133
16714
  chunkCount: recording.chunkCount,
16134
- startedAt: recording.startedAt.toISOString()
16715
+ startedAt: recording.startedAt.toISOString(),
16716
+ isCopy: recording.isCopy
16135
16717
  })),
16136
- truncated: false
16718
+ truncated: false,
16719
+ unreadableCount
16137
16720
  };
16138
16721
  }),
16139
16722
  delete: canvasOwnerProcedure.input(deleteRecordingInputSchema).output(deleteRecordingOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.remove.execute({
@@ -16150,6 +16733,18 @@ const onWire$1 = (upload) => ({
16150
16733
  expiresAt: upload.expiresAt.toISOString(),
16151
16734
  headers: upload.headers
16152
16735
  });
16736
+ /** A batch names a walkthrough or a screen; the log line carries whichever it named. */
16737
+ const targetOf = (input) => "recordingId" in input ? {
16738
+ recordingId: input.recordingId,
16739
+ screenId: null
16740
+ } : {
16741
+ recordingId: null,
16742
+ screenId: input.screenId
16743
+ };
16744
+ const tagTarget = (ctx, input) => {
16745
+ if ("recordingId" in input) ctx.tag("recordingId", input.recordingId);
16746
+ else ctx.tag("screenId", input.screenId);
16747
+ };
16153
16748
  /**
16154
16749
  * Somewhere to put the files the recorded page loaded — its fonts, its images, the stylesheets
16155
16750
  * rrweb could not read. The extension fetches them, because it holds the user's cookies and its
@@ -16160,9 +16755,9 @@ const reserveAssets = (handlers) => personProcedure.input(reserveAssetsInputSche
16160
16755
  ...input,
16161
16756
  ownerPersonId: ctx.viewer.personId
16162
16757
  }));
16163
- ctx.tag("recordingId", input.recordingId);
16758
+ tagTarget(ctx, input);
16164
16759
  ctx.telemetry.emit("RecordingAssetsReserved", {
16165
- recordingId: input.recordingId,
16760
+ ...targetOf(input),
16166
16761
  assetCount: input.assets.length
16167
16762
  });
16168
16763
  return { reserved: result.reserved.map((entry) => ({
@@ -16176,9 +16771,9 @@ const confirmAssets = (handlers) => personProcedure.input(confirmAssetsInputSche
16176
16771
  ...input,
16177
16772
  ownerPersonId: ctx.viewer.personId
16178
16773
  }));
16179
- ctx.tag("recordingId", input.recordingId);
16774
+ tagTarget(ctx, input);
16180
16775
  ctx.telemetry.emit("RecordingAssetsConfirmed", {
16181
- recordingId: input.recordingId,
16776
+ ...targetOf(input),
16182
16777
  assetCount: input.arrived.length,
16183
16778
  missingAssetCount: result.missingAssetCount
16184
16779
  });
@@ -16296,7 +16891,11 @@ const fieldsOf$1 = (input) => {
16296
16891
  signal: name,
16297
16892
  supportedClient: input.capabilityVersion === 2 ? 1 : 0,
16298
16893
  isSlow: input.name === "canvas_load" && ["slow", "timed-out"].includes(input.outcome) ? 1 : 0,
16299
- isDegraded: input.name === "canvas_load" && ["degraded", "timed-out"].includes(input.outcome) ? 1 : 0,
16894
+ isDegraded: input.name === "canvas_load" && [
16895
+ "degraded",
16896
+ "timed-out",
16897
+ "unavailable"
16898
+ ].includes(input.outcome) ? 1 : 0,
16300
16899
  isJanky: input.name === "canvas_interaction" && input.outcome === "janky" ? 1 : 0,
16301
16900
  isRealtimeFailure: input.name === "canvas_realtime" && input.outcome === "failed" ? 1 : 0,
16302
16901
  isPrototypeOpen: Number(isPrototypeOpen),
@@ -16309,6 +16908,7 @@ const isFailure$1 = (input) => {
16309
16908
  if (input.name === "canvas_load") return input.outcome !== "ready";
16310
16909
  if (input.name === "canvas_interaction") return input.outcome !== "smooth";
16311
16910
  if (input.name === "prototype_open") return input.outcome !== "loaded";
16911
+ if (input.name === "canvas_measurement") return true;
16312
16912
  return input.outcome !== "succeeded";
16313
16913
  };
16314
16914
  const clientPerformanceTelemetryRoute = () => baseProcedure.input(clientPerformanceInputSchema).output(clientPerformanceOutputSchema).mutation(({ input, ctx }) => {
@@ -16323,7 +16923,7 @@ const clientPerformanceTelemetryRoute = () => baseProcedure.input(clientPerforma
16323
16923
  const FINGERPRINT_LENGTH = 24;
16324
16924
  const clientRenderFailureRoute = () => baseProcedure.input(clientRenderFailureInputSchema).output(clientRenderFailureOutputSchema).mutation(({ input, ctx }) => {
16325
16925
  const { details, ...identity } = input;
16326
- const { frames, ...classification } = details ?? {
16926
+ const { frames, deliveryGap, ...classification } = details ?? {
16327
16927
  version: 1,
16328
16928
  severity: "fatal",
16329
16929
  boundary: "application",
@@ -16342,10 +16942,18 @@ const clientRenderFailureRoute = () => baseProcedure.input(clientRenderFailureIn
16342
16942
  const event = classification.outcome === "failed" ? "EditorRenderFailed" : "EditorRecoveryReported";
16343
16943
  const fields = {
16344
16944
  ...identity,
16345
- ...classification,
16945
+ ...Object.fromEntries(Object.entries(classification).filter(([key]) => key !== "version")),
16346
16946
  fingerprint,
16347
16947
  frames: JSON.stringify(frames),
16348
- event
16948
+ event,
16949
+ ...classification.errorCode === "unexpected-error" && frames.length === 0 && { lowInformation: true },
16950
+ ...deliveryGap !== void 0 && {
16951
+ deliveryGapRefused: deliveryGap.refused,
16952
+ deliveryGapExpired: deliveryGap.expired,
16953
+ deliveryGapEvicted: deliveryGap.evicted,
16954
+ deliveryGapExhausted: deliveryGap.exhausted
16955
+ },
16956
+ ...ctx.testRun !== null && { testRun: ctx.testRun }
16349
16957
  };
16350
16958
  if (classification.outcome !== "failed" || classification.severity === "recovered") ctx.logger.info(fields, "event");
16351
16959
  else ctx.logger.error(fields, "event");
@@ -16354,12 +16962,86 @@ const clientRenderFailureRoute = () => baseProcedure.input(clientRenderFailureIn
16354
16962
 
16355
16963
  //#endregion
16356
16964
  //#region ../api/src/shared/observability/client-save-telemetry.router.ts
16357
- const clientSaveTelemetryRoute = () => baseProcedure.input(clientSaveIncidentInputSchema).output(clientSaveIncidentOutputSchema).mutation(({ input, ctx }) => {
16965
+ /** A release names itself by its commit, short or full; `dev` or an instance label is not that. */
16966
+ const isExactBuild = (build) => /^(?:[0-9a-f]{12}|[0-9a-f]{40})$/u.test(build);
16967
+ const eventPropertiesOf = (input, trace, apiBuild, environment) => ({
16968
+ schema_version: trace.schema,
16969
+ event_id: trace.eventId,
16970
+ kind: trace.kind,
16971
+ episode_key: trace.episodeKey ?? null,
16972
+ next_episode_key: trace.nextEpisodeKey ?? null,
16973
+ appearance_id: trace.appearanceId ?? null,
16974
+ trigger: trace.trigger ?? null,
16975
+ notice_cause: trace.cause ?? null,
16976
+ severity: trace.severity,
16977
+ command: trace.command,
16978
+ operation_kinds: trace.operationKinds,
16979
+ refusal_code: trace.refusalCode ?? null,
16980
+ refused_operation: trace.operation ?? null,
16981
+ refused_component: trace.component ?? null,
16982
+ device_protection: trace.deviceProtection,
16983
+ uploads_waiting: trace.uploadsWaiting,
16984
+ uploads_blocked: trace.uploadsBlocked,
16985
+ save_hold: trace.saveHold ?? null,
16986
+ available_actions: trace.actions,
16987
+ sync_block: trace.syncBlock ?? null,
16988
+ overwrite_block: trace.overwriteBlock ?? null,
16989
+ outcome: trace.outcome ?? null,
16990
+ action: trace.action ?? null,
16991
+ replay: trace.replay,
16992
+ lost_records: trace.lostRecords,
16993
+ canvas_id: input.canvasId,
16994
+ mutation_id: input.mutationId ?? null,
16995
+ document_version: input.version,
16996
+ retry_count: input.attempts,
16997
+ duration_ms: input.durationMs,
16998
+ pending_changes: input.pendingChanges,
16999
+ client_build: input.releaseIdentity,
17000
+ client_build_exact: isExactBuild(input.releaseIdentity),
17001
+ api_build: apiBuild,
17002
+ api_build_exact: isExactBuild(apiBuild),
17003
+ environment
17004
+ });
17005
+ /**
17006
+ * Sends one traced record and says what became of it. Only the API sends these events, because the
17007
+ * browser's library can be blocked and turns itself off under automation.
17008
+ */
17009
+ const deliverCanvasSaveRecord = async (analytics, input, personId, build) => {
17010
+ const { trace } = input;
17011
+ if (trace === void 0) return void 0;
17012
+ if (analytics.isEnabled !== true || analytics.deliver === void 0) return "disabled";
17013
+ if (personId === null) return "no-identity";
17014
+ return (await analytics.deliver({
17015
+ distinctId: personId,
17016
+ event: trace.kind === "shown" ? "canvas_save_notice_shown" : "canvas_save_recovery_transition",
17017
+ properties: eventPropertiesOf(input, trace, build.apiBuild, build.environment),
17018
+ insertId: trace.eventId,
17019
+ occurredAt: new Date(trace.occurredAt)
17020
+ })).unwrapOr(false) ? "delivered" : "failed";
17021
+ };
17022
+ const clientSaveTelemetryRoute = (deps) => baseProcedure.input(clientSaveIncidentInputSchema).output(clientSaveIncidentOutputSchema).mutation(async ({ input, ctx }) => {
17023
+ const { analytics, apiBuild, environment } = deps;
17024
+ const { trace, ...report } = input;
16358
17025
  ctx.logger.warn({
16359
- ...input,
17026
+ ...report,
17027
+ ...trace !== void 0 && {
17028
+ ...trace,
17029
+ operationKinds: trace.operationKinds.join(","),
17030
+ actions: trace.actions.join(","),
17031
+ apiBuild,
17032
+ apiBuildExact: isExactBuild(apiBuild),
17033
+ environment
17034
+ },
16360
17035
  event: "CanvasSyncOutcome"
16361
17036
  }, "event");
16362
- return { accepted: true };
17037
+ const state = await deliverCanvasSaveRecord(analytics, input, ctx.viewer.kind === "person" ? ctx.viewer.personId : null, {
17038
+ apiBuild,
17039
+ environment
17040
+ });
17041
+ return {
17042
+ accepted: true,
17043
+ ...state !== void 0 && { analytics: state }
17044
+ };
16363
17045
  });
16364
17046
 
16365
17047
  //#endregion
@@ -16477,6 +17159,7 @@ const canvasRouter = (handlers, options) => trpcRouter({
16477
17159
  ...createCanvasRouter(handlers.canvas)._def.record,
16478
17160
  ...createCanvasImageRouter(handlers.canvas)._def.record,
16479
17161
  ...createCanvasFontRouter(handlers.canvas)._def.record,
17162
+ ...createCanvasWalkthroughRouter(handlers.canvas)._def.record,
16480
17163
  fontCatalog: createFontCatalogRouter(handlers.canvas),
16481
17164
  textStyleLibrary: createTextStyleLibraryRouter(handlers.canvas),
16482
17165
  ...createCanvasLifecycleRouter(handlers.canvas)._def.record,
@@ -16491,7 +17174,7 @@ const canvasRouter = (handlers, options) => trpcRouter({
16491
17174
  ...createRenderExposureRouter(handlers.render)._def.record,
16492
17175
  ...createRenderExportRouter(handlers.render)._def.record
16493
17176
  }),
16494
- thumbnail: createCanvasThumbnailRouter(),
17177
+ thumbnail: createCanvasThumbnailRouter(handlers.canvas),
16495
17178
  participants: createCanvasParticipantRouter(handlers.canvas),
16496
17179
  invites: createCanvasInviteRouter(handlers.canvas, options.shouldExposeInviteTokens)
16497
17180
  });
@@ -16525,7 +17208,7 @@ const createAppRouter = (handlers, options = DEFAULT_ROUTER_OPTIONS) => trpcRout
16525
17208
  performance: clientPerformanceTelemetryRoute(),
16526
17209
  conversion: clientConversionTelemetryRoute(),
16527
17210
  renderFailure: clientRenderFailureRoute(),
16528
- save: clientSaveTelemetryRoute()
17211
+ save: clientSaveTelemetryRoute(handlers.saveTelemetry)
16529
17212
  })
16530
17213
  });
16531
17214
 
@@ -16575,6 +17258,7 @@ const handlers = {
16575
17258
  undo: unavailable.execute,
16576
17259
  receipt: unavailable.execute
16577
17260
  },
17261
+ thumbnailReports: { reportUnavailable: unavailable.execute },
16578
17262
  chats: {
16579
17263
  publish: unavailable.execute,
16580
17264
  list: unavailable.execute,
@@ -16593,6 +17277,8 @@ const handlers = {
16593
17277
  remove: unavailable,
16594
17278
  move: unavailable,
16595
17279
  duplicate: unavailable,
17280
+ copyFromWork: unavailable,
17281
+ copyWalkthroughs: unavailable,
16596
17282
  removePermanently: unavailable,
16597
17283
  markViewed: unavailable,
16598
17284
  firstAgentWork: unavailable,
@@ -16719,6 +17405,7 @@ const handlers = {
16719
17405
  render: {
16720
17406
  create: unavailable,
16721
17407
  get: unavailable,
17408
+ awaitSettled: unavailable,
16722
17409
  cancel: unavailable,
16723
17410
  download: unavailable,
16724
17411
  expose: unavailable,
@@ -16732,6 +17419,11 @@ const handlers = {
16732
17419
  transcript: {
16733
17420
  get: unavailable,
16734
17421
  retry: unavailable
17422
+ },
17423
+ saveTelemetry: {
17424
+ analytics: { track: () => {} },
17425
+ apiBuild: "cli",
17426
+ environment: "test"
16735
17427
  }
16736
17428
  };
16737
17429
  const createRouterShapeAdapter = () => createAppRouter(handlers);
@@ -16889,7 +17581,7 @@ const createCapabilityCatalogAdapter = () => {
16889
17581
  outputSchema: schemas.output,
16890
17582
  meta: parsed.meta,
16891
17583
  policy: procedurePolicy,
16892
- cliPath: procedurePolicy.exposure === "shared" ? id.replaceAll(".", " ") : null,
17584
+ cliPath: procedurePolicy.exposure === "shared" ? id.split(".").map((part) => toKebabCase(part)).join(" ") : null,
16893
17585
  ...ROUTER_INPUT_EXAMPLES[id] !== void 0 && { inputExample: ROUTER_INPUT_EXAMPLES[id] }
16894
17586
  });
16895
17587
  });
@@ -16928,6 +17620,156 @@ var ProcessExitError = class extends FailedToExitError {
16928
17620
  }
16929
17621
  };
16930
17622
 
17623
+ //#endregion
17624
+ //#region src/infrastructure/failure-exit.consts.ts
17625
+ const BAD_REQUEST_EXIT = 3;
17626
+ const UNAUTHORIZED_EXIT = 4;
17627
+ const REFUSED_EXIT = 5;
17628
+ const OTHER_EXIT = 1;
17629
+ const EXIT_CODE_OF_FAILURE = {
17630
+ BAD_REQUEST: 3,
17631
+ UNAUTHORIZED: 4,
17632
+ FORBIDDEN: 5,
17633
+ NOT_FOUND: 5,
17634
+ CONFLICT: 5,
17635
+ RATE_LIMITED: 5,
17636
+ INTERNAL: 1
17637
+ };
17638
+
17639
+ //#endregion
17640
+ //#region src/infrastructure/failure.mapper.ts
17641
+ const remediationFor = (code) => {
17642
+ switch (code) {
17643
+ case "BAD_REQUEST": return "Run the command with '--help', then rewrite every rejected argument.";
17644
+ case "UNAUTHORIZED": return "Run 'enhance auth login' and complete authentication in the browser.";
17645
+ case "FORBIDDEN": return "Run 'enhance canvas list --scope mine' and choose a target you can change.";
17646
+ case "NOT_FOUND": return "List the resource again and retry with an identifier from that result.";
17647
+ case "CONFLICT": return "Read the resource again before retrying the change.";
17648
+ case "RATE_LIMITED": return "Wait for the server retry window, then retry once.";
17649
+ case "INTERNAL": return "Run 'enhance doctor', report the result, and stop.";
17650
+ }
17651
+ };
17652
+ const SESSION_EXPIRED_REMEDIATION = `Your Enhance session expired. ${remediationFor("UNAUTHORIZED")}`;
17653
+ /** What the shared classifier can say beyond the code, for the answers that carry more. */
17654
+ const remediationOf = (error, status) => {
17655
+ if (status === void 0) return remediationFor(error.code);
17656
+ const outcome = requestOutcomeOf({
17657
+ kind: "response",
17658
+ status,
17659
+ appError: error,
17660
+ retryAfterMs: null
17661
+ });
17662
+ if (outcome.kind === "sign-in" && outcome.reason === "session-expired") return SESSION_EXPIRED_REMEDIATION;
17663
+ if (error.code === "CONFLICT" && outcome.kind === "transient") return "Wait a few seconds, then retry the same command with the same clientToken.";
17664
+ if (outcome.kind === "fault" && outcome.detail === "mutation-id-reused") return "Do not reuse a clientToken with different arguments. Send this change with a new clientToken.";
17665
+ return remediationFor(error.code);
17666
+ };
17667
+ const trpcErrorSchema = z.object({ data: z.looseObject({
17668
+ appError: z.unknown(),
17669
+ httpStatus: z.number().optional()
17670
+ }) });
17671
+ const appErrorFrom = (error) => {
17672
+ const parsed = trpcErrorSchema.safeParse(error);
17673
+ const appError = appErrorSchema.safeParse(parsed.success ? parsed.data.data.appError : null);
17674
+ if (!appError.success) return null;
17675
+ return {
17676
+ appError: appError.data,
17677
+ remediation: remediationOf(appError.data, parsed.data?.data.httpStatus)
17678
+ };
17679
+ };
17680
+ const toRemoteError = (error) => {
17681
+ if (!(error instanceof TRPCClientError)) return error;
17682
+ if (error.cause instanceof CliError) return error.cause;
17683
+ const parsed = appErrorFrom(error);
17684
+ if (parsed === null) return error;
17685
+ return new CliError(parsed.appError.code, parsed.appError.message, parsed.remediation, parsed.appError.fields);
17686
+ };
17687
+ const failureFields = (fields) => fields === void 0 ? {} : { fields: Object.entries(fields).toSorted(([left], [right]) => left.localeCompare(right)).map(([path, message]) => ({
17688
+ path,
17689
+ message
17690
+ })) };
17691
+ const toFailurePayload = (error, parserMessage) => {
17692
+ if (error instanceof CliError) return {
17693
+ code: error.code,
17694
+ message: error.message,
17695
+ remediation: error.remediation,
17696
+ ...failureFields(error.fields)
17697
+ };
17698
+ if (error instanceof TRPCClientError) {
17699
+ if (error.cause instanceof CliError) return toFailurePayload(error.cause, parserMessage);
17700
+ const parsed = appErrorFrom(error);
17701
+ if (parsed !== null) return {
17702
+ code: parsed.appError.code,
17703
+ message: parsed.appError.message,
17704
+ remediation: parsed.remediation,
17705
+ ...failureFields(parsed.appError.fields)
17706
+ };
17707
+ }
17708
+ if (error instanceof ProcessExitError) {
17709
+ const message = parserMessage?.trim();
17710
+ return {
17711
+ code: "BAD_REQUEST",
17712
+ message: message === void 0 || message === "" ? "The command line is malformed." : message,
17713
+ remediation: "Run 'enhance --help' and use one of the complete command paths shown there."
17714
+ };
17715
+ }
17716
+ return {
17717
+ code: "INTERNAL",
17718
+ message: "The request failed before it received a usable result.",
17719
+ remediation: "Run 'enhance doctor', report the result, and stop."
17720
+ };
17721
+ };
17722
+ const toMcpFailurePayload = (error) => {
17723
+ const failure = toFailurePayload(error, null);
17724
+ if (failure.remediation !== remediationFor(failure.code) && failure.remediation !== SESSION_EXPIRED_REMEDIATION) return failure;
17725
+ const remediation = {
17726
+ BAD_REQUEST: "Review this tool’s input schema and correct the reported argument errors.",
17727
+ UNAUTHORIZED: "Reconnect Enhance through this host’s connection flow, then repeat the request.",
17728
+ FORBIDDEN: "Choose a canvas you can access. Do not repeat this write against the denied canvas.",
17729
+ INTERNAL: "A write may have an unknown outcome. Inspect a returned operation reference before retrying. Otherwise retry only identical arguments with the original clientToken; never create a new intent to recover a failed request. If the failure repeats, stop and report this error."
17730
+ };
17731
+ return {
17732
+ ...failure,
17733
+ remediation: remediation[failure.code] ?? failure.remediation
17734
+ };
17735
+ };
17736
+ const toExitCode = (failure, isMalformed, error) => {
17737
+ if (isMalformed) return 2;
17738
+ if (error instanceof PartialBatchError) return 6;
17739
+ return EXIT_CODE_OF_FAILURE[failure.code];
17740
+ };
17741
+ const failureCodesExiting = (exitCode) => Object.entries(EXIT_CODE_OF_FAILURE).filter(([, code]) => code === exitCode).map(([name]) => `\`${name}\``).join(", ");
17742
+ const toPublishedExitTable = () => [
17743
+ {
17744
+ code: 0,
17745
+ meaning: "The command succeeded."
17746
+ },
17747
+ {
17748
+ code: 1,
17749
+ meaning: `The command failed for another reason (${failureCodesExiting(1)}). A write may have an unknown outcome.`
17750
+ },
17751
+ {
17752
+ code: 2,
17753
+ meaning: "The command line was malformed. Nothing ran."
17754
+ },
17755
+ {
17756
+ code: 3,
17757
+ meaning: `The API refused the input (${failureCodesExiting(3)}).`
17758
+ },
17759
+ {
17760
+ code: 4,
17761
+ meaning: `The credential is missing or expired (${failureCodesExiting(4)}).`
17762
+ },
17763
+ {
17764
+ code: 5,
17765
+ meaning: `The API refused the request (${failureCodesExiting(5)}).`
17766
+ },
17767
+ {
17768
+ code: 6,
17769
+ meaning: "A batch finished only in part. Retry with the same `--client-token`."
17770
+ }
17771
+ ];
17772
+
16931
17773
  //#endregion
16932
17774
  //#region src/infrastructure/mcp-capability-discovery.adapter.ts
16933
17775
  const NO_MATCH_SCORE = 0;
@@ -17058,123 +17900,6 @@ const createMcpCapabilityDiscoveryAdapter = (catalog) => ({
17058
17900
  const toPresentedCapabilities = (catalog, exposures) => catalog.filter((capability) => exposures.includes(capability.policy.exposure));
17059
17901
  const toSharedCapabilities = (catalog) => toPresentedCapabilities(catalog, ["shared"]);
17060
17902
 
17061
- //#endregion
17062
- //#region src/infrastructure/failure.mapper.ts
17063
- const MALFORMED_EXIT = 2;
17064
- const BAD_REQUEST_EXIT = 3;
17065
- const UNAUTHORIZED_EXIT = 4;
17066
- const REFUSED_EXIT = 5;
17067
- const PARTIAL_EXIT = 6;
17068
- const REFUSALS = /* @__PURE__ */ new Set([
17069
- "FORBIDDEN",
17070
- "NOT_FOUND",
17071
- "CONFLICT",
17072
- "RATE_LIMITED"
17073
- ]);
17074
- const remediationFor = (code) => {
17075
- switch (code) {
17076
- case "BAD_REQUEST": return "Run the command with '--help', then rewrite every rejected argument.";
17077
- case "UNAUTHORIZED": return "Run 'enhance auth login' and complete authentication in the browser.";
17078
- case "FORBIDDEN": return "Run 'enhance canvas list --scope mine' and choose a target you can change.";
17079
- case "NOT_FOUND": return "List the resource again and retry with an identifier from that result.";
17080
- case "CONFLICT": return "Read the resource again before retrying the change.";
17081
- case "RATE_LIMITED": return "Wait for the server retry window, then retry once.";
17082
- case "INTERNAL": return "Run 'enhance doctor', report the result, and stop.";
17083
- }
17084
- };
17085
- const SESSION_EXPIRED_REMEDIATION = `Your Enhance session expired. ${remediationFor("UNAUTHORIZED")}`;
17086
- /** What the shared classifier can say beyond the code, for the answers that carry more. */
17087
- const remediationOf = (error, status) => {
17088
- if (status === void 0) return remediationFor(error.code);
17089
- const outcome = requestOutcomeOf({
17090
- kind: "response",
17091
- status,
17092
- appError: error,
17093
- retryAfterMs: null
17094
- });
17095
- if (outcome.kind === "sign-in" && outcome.reason === "session-expired") return SESSION_EXPIRED_REMEDIATION;
17096
- if (error.code === "CONFLICT" && outcome.kind === "transient") return "Wait a few seconds, then retry the same command with the same clientToken.";
17097
- if (outcome.kind === "fault" && outcome.detail === "mutation-id-reused") return "Do not reuse a clientToken with different arguments. Send this change with a new clientToken.";
17098
- return remediationFor(error.code);
17099
- };
17100
- const trpcErrorSchema = z.object({ data: z.looseObject({
17101
- appError: z.unknown(),
17102
- httpStatus: z.number().optional()
17103
- }) });
17104
- const appErrorFrom = (error) => {
17105
- const parsed = trpcErrorSchema.safeParse(error);
17106
- const appError = appErrorSchema.safeParse(parsed.success ? parsed.data.data.appError : null);
17107
- if (!appError.success) return null;
17108
- return {
17109
- appError: appError.data,
17110
- remediation: remediationOf(appError.data, parsed.data?.data.httpStatus)
17111
- };
17112
- };
17113
- const toRemoteError = (error) => {
17114
- if (!(error instanceof TRPCClientError)) return error;
17115
- if (error.cause instanceof CliError) return error.cause;
17116
- const parsed = appErrorFrom(error);
17117
- if (parsed === null) return error;
17118
- return new CliError(parsed.appError.code, parsed.appError.message, parsed.remediation, parsed.appError.fields);
17119
- };
17120
- const failureFields = (fields) => fields === void 0 ? {} : { fields: Object.entries(fields).toSorted(([left], [right]) => left.localeCompare(right)).map(([path, message]) => ({
17121
- path,
17122
- message
17123
- })) };
17124
- const toFailurePayload = (error, parserMessage) => {
17125
- if (error instanceof CliError) return {
17126
- code: error.code,
17127
- message: error.message,
17128
- remediation: error.remediation,
17129
- ...failureFields(error.fields)
17130
- };
17131
- if (error instanceof TRPCClientError) {
17132
- if (error.cause instanceof CliError) return toFailurePayload(error.cause, parserMessage);
17133
- const parsed = appErrorFrom(error);
17134
- if (parsed !== null) return {
17135
- code: parsed.appError.code,
17136
- message: parsed.appError.message,
17137
- remediation: parsed.remediation,
17138
- ...failureFields(parsed.appError.fields)
17139
- };
17140
- }
17141
- if (error instanceof ProcessExitError) {
17142
- const message = parserMessage?.trim();
17143
- return {
17144
- code: "BAD_REQUEST",
17145
- message: message === void 0 || message === "" ? "The command line is malformed." : message,
17146
- remediation: "Run 'enhance --help' and use one of the complete command paths shown there."
17147
- };
17148
- }
17149
- return {
17150
- code: "INTERNAL",
17151
- message: "The request failed before it received a usable result.",
17152
- remediation: "Run 'enhance doctor', report the result, and stop."
17153
- };
17154
- };
17155
- const toMcpFailurePayload = (error) => {
17156
- const failure = toFailurePayload(error, null);
17157
- if (failure.remediation !== remediationFor(failure.code) && failure.remediation !== SESSION_EXPIRED_REMEDIATION) return failure;
17158
- const remediation = {
17159
- BAD_REQUEST: "Review this tool’s input schema and correct the reported argument errors.",
17160
- UNAUTHORIZED: "Reconnect Enhance through this host’s connection flow, then repeat the request.",
17161
- FORBIDDEN: "Choose a canvas you can access. Do not repeat this write against the denied canvas.",
17162
- INTERNAL: "A write may have an unknown outcome. Inspect a returned operation reference before retrying. Otherwise retry only identical arguments with the original clientToken; never create a new intent to recover a failed request. If the failure repeats, stop and report this error."
17163
- };
17164
- return {
17165
- ...failure,
17166
- remediation: remediation[failure.code] ?? failure.remediation
17167
- };
17168
- };
17169
- const toExitCode = (failure, isMalformed, error) => {
17170
- if (isMalformed) return MALFORMED_EXIT;
17171
- if (error instanceof PartialBatchError) return PARTIAL_EXIT;
17172
- if (failure.code === "BAD_REQUEST") return BAD_REQUEST_EXIT;
17173
- if (failure.code === "UNAUTHORIZED") return UNAUTHORIZED_EXIT;
17174
- if (REFUSALS.has(failure.code)) return REFUSED_EXIT;
17175
- return 1;
17176
- };
17177
-
17178
17903
  //#endregion
17179
17904
  //#region src/infrastructure/canvas-authoring-result.mapper.ts
17180
17905
  const MAX_RECEIPT_BYTES = 4096;
@@ -17302,4 +18027,4 @@ const withCommandInFailure = (value, commandName) => ({
17302
18027
  });
17303
18028
 
17304
18029
  //#endregion
17305
- export { canvasRenderPendingSchema as $, canvasNodeStylePatchSchema as $n, createOrganisationOutputSchema as $t, operationStatusOutputSchema as A, canvasReferencePageOf as An, canvasBlendModeSchema as Ar, PartialBatchError as At, canvasCaptureCapabilityInputSchema as B, IMAGE_KIND as Bn, PROTOTYPE_ARTIFACT_MANIFEST_PATH as Bt, canvasSnapshotToken as C, canvasTextPropsWithContent as Cn, canvasImageAssetIdentityFromPath as Cr, canvasEditsSchema as Ct, canvasConversionStatusSchema as D, canvasPrototypePropsSchema as Dn, CANVAS_RICH_TEXT_STYLE_PROPERTIES as Dr, fromCanvasReference as Dt, resolveCanvasSnapshot as E, canvasConversionMetadataSchema as En, hasCanvasRichTextPaints as Er, canvasReferenceRenderTarget as Et, canvasArrangeInputSchema as F, agentClientMetadata as Fn, createScreenOutputSchema as Ft, canvasRenderCapabilityInputSchema as G, applyCanvasOperationsOutputSchema as Gn, getPrototypePublishStatusOutputSchema as Gt, canvasCaptureOutputSchema as H, RECTANGLE_KIND as Hn, createPrototypeArtifactOutputSchema as Ht, canvasDuplicateCapabilityInputSchema as I, createCanvasPreparationOutputSchema as In, appendRecordingChunkOutputSchema as It, prototypePublishCapabilityInputSchema as J, textOf as Jn, submitPrototypeArtifactOutputSchema as Jt, canvasWriteHtmlCapabilityInputSchema as K, getCanvasMutationOutputSchema as Kn, prototypeArtifactManifestSchema as Kt, canvasDuplicateInputSchema as L, getCanvasPreparationOutputSchema as Ln, completeRecordingOutputSchema as Lt, canvasAssetImportInputSchema as M, beginCanvasActivityOutputSchema as Mn, canvasSchema as Mr, transcriptOutputSchema as Mt, canvasAssetImportOutputSchema as N, canvasAgentActivityPhaseSchema as Nn, createCanvasOutputSchema as Nr, appErrorSchema as Nt, operationStatusImageSchema as O, canvasRecordingPropsSchema as On, canvasAdditionalStyleSchema as Or, hasCanvasReferenceScope as Ot, canvasArrangeCapabilityInputSchema as P, AGENT_CLIENT_HEADER as Pn, listCanvasesOutputSchema as Pr, completeScreenOutputSchema as Pt, canvasRenderBatchResultSchema as Q, canvasOperationSchema as Qn, createAgentTokenOutputSchema as Qt, canvasPreparationOutputSchema as R, FRAME_KIND as Rn, getRecordingOutputSchema as Rt, canvasExchangeDigest as S, canvasTextChangeBetween as Sn, canvasFontAssetIdentityFromPath as Sr, canvasEditCapabilityInputSchema as St, encodeCanvasExchangeToken as T, canvasCaptureSchema as Tn, canvasRichTextValueOf as Tr, canvasReferenceNodeIds as Tt, canvasApplyCapabilityInputSchema as U, TEXT_KIND as Un, foldPrototypeArtifactPath as Ut, canvasCaptureInputSchema as V, PAGE_KIND as Vn, attachPrototypeArtifactOutputSchema as Vt, canvasReadCapabilityInputSchema as W, applyCanvasOperationsInputSchema as Wn, getPrototypeArtifactCapabilitiesOutputSchema as Wt, transcriptReadCapabilityInputSchema as X, getCanvasDocumentOutputSchema as Xn, MCP_AUTH_SCOPE as Xt, recordingSnapshotCapabilityInputSchema as Y, mapCanvasFontSources as Yn, getMeOutputSchema as Yt, canvasRenderBatchRequestSchema as Z, saveCanvasDocumentOutputSchema as Zn, cliAuthConfigurationSchema as Zt, PROCEDURE_DESCRIPTIONS as _, screenElementsCommentTargetSchema as _n, canvasCssTokens as _r, canvasFindOutputSchema as _t, toFailurePayload as a, commentMessageSchema as an, canvasWorldBoundsSchema as ar, canvasRemoveInputSchema as at, canvasPrototypeIntentSchema as b, applyCanvasTypographyPatch as bn, reserveCanvasAssetInputSchema as br, canvasMakeEditableCapabilityInputSchema as bt, toPresentedCapabilities as c, domLocatorSchema as cn, downloadCanvasRenderOutputSchema as cr, canvasReadOutputSchema as ct, ProcessExitError as d, listCommentsInputSchema as dn, canvasSceneDocumentSchema as dr, canvasTranscriptCursorSchema as dt, listOrganisationsOutputSchema as en, createCanvasConversionOutputSchema as er, canvasRenderScopedInputSchema as et, createCapabilityCatalogAdapter as f, listCommentsOutputSchema as fn, canvasAuthoredLayoutValueOf as fr, canvasResourcesCursorSchema as ft, OPTION_DESCRIPTIONS as g, screenElementCommentTargetSchema as gn, canvasLayoutPriorityDeclarations as gr, canvasFindInputSchema as gt, toCapabilityDefinition as h, screenAreaCommentTargetSchema as hn, canvasLayoutMainAxisOf as hr, canvasFindCursorSchema as ht, toExitCode as i, commentCanvasContextSchema as in, canvasRenderTargetSchema as ir, canvasRemoveCapabilityInputSchema as it, canvasAssetImportCapabilityInputSchema as j, resolveCanvasReference as jn, canvasPaintSchema as jr, CliError as jt, operationStatusInputSchema as k, DEFAULT_CANVAS_REFERENCE_PAGE_ID as kn, CANVAS_BLEND_MODES as kr, parseCanvasReference as kt, toSharedCapabilities as l, elementAnchorSchema as ln, getCanvasRenderOutputSchema as lr, canvasUpdateHtmlCapabilityInputSchema as lt, createCapabilityPolicyAdapter as m, replyCommentOutputSchema as mn, canvasAxisStyleProperties as mr, canvasCreateToolOutputSchema as mt, withCommandName as n, withFixtureScreen as nn, canvasRenderSourceStateSchema as nr, canvasRenderRequestSchema as nt, toMcpFailurePayload as o, commentResolverSchema as on, createCanvasRenderOutputSchema as or, canvasOutlineCursorSchema as ot, createRouterShapeAdapter as p, replyCommentInputSchema as pn, canvasAuthoredStyleDeclarations as pr, canvasCreateToolInputSchema as pt, commentAttentionCapabilityInputSchema as q, canvasLayoutWithoutCssProperties as qn, prototypeArtifactPathSchema as qt, toCanvasAuthoringResult as r, commentAuthorSchema as rn, canvasRenderStateSchema as rr, canvasRenderFileSchema as rt, toRemoteError as s, commentThreadSchema as sn, createRecordingSnapshotOutputSchema as sr, canvasReadInputSchema as st, withCommandInFailure as t, emptyFixtureDocument as tn, getCanvasConversionOutputSchema as tr, canvasRenderScopedToolInputSchema as tt, createMcpCapabilityDiscoveryAdapter as u, getCommentOutputSchema as un, canvasReadableSceneDocumentSchema as ur, canvasUpdateHtmlInputSchema as ut, canvasPrototypeCapabilityInputSchema as v, screenTextCommentTargetSchema as vn, canvasCssValue as vr, canvasInsertHtmlCapabilityInputSchema as vt, decodeCanvasExchangeToken as w, canvasTextRunsOf as wn, canvasRichTextOf as wr, assertCanvasReferenceNodes as wt, canvasPrototypeOutputSchema as x, canvasCssTypographyOwners as xn, reserveCanvasAssetOutputSchema as xr, canvasMakeEditableInputSchema as xt, canvasPrototypeInputSchema as y, startCommentInputSchema as yn, canvasAssetUploadOutputSchema as yr, canvasInsertHtmlInputSchema as yt, canvasWriteReceiptSchema as z, GROUP_KIND as zn, startRecordingOutputSchema as zt };
18030
+ export { canvasRenderBatchRequestSchema as $, wholeCanvasDocumentOutputSchema as $n, cliAuthConfigurationSchema as $t, operationStatusImageSchema as A, canvasRecordingPropsSchema as An, canvasAdditionalStyleSchema as Ar, hasCanvasReferenceScope as At, canvasPreparationOutputSchema as B, FRAME_KIND as Bn, getRecordingOutputSchema as Bt, canvasPrototypeOutputSchema as C, canvasCssTypographyOwners as Cn, reserveCanvasAssetOutputSchema as Cr, canvasMakeEditableInputSchema as Ct, encodeCanvasExchangeToken as D, canvasCaptureSchema as Dn, canvasRichTextValueOf as Dr, canvasReferenceNodeIds as Dt, decodeCanvasExchangeToken as E, canvasTextRunsOf as En, canvasRichTextOf as Er, assertCanvasReferenceNodes as Et, canvasAssetImportOutputSchema as F, canvasAgentActivityPhaseSchema as Fn, createCanvasOutputSchema as Fr, appErrorSchema as Ft, canvasApplyCapabilityInputSchema as G, TEXT_KIND as Gn, foldPrototypeArtifactPath as Gt, canvasCaptureCapabilityInputSchema as H, IMAGE_KIND as Hn, PROTOTYPE_ARTIFACT_MANIFEST_PATH as Ht, canvasArrangeCapabilityInputSchema as I, AGENT_CLIENT_HEADER as In, listCanvasesOutputSchema as Ir, completeScreenOutputSchema as It, canvasWriteHtmlCapabilityInputSchema as J, getCanvasMutationOutputSchema as Jn, prototypeArtifactManifestSchema as Jt, canvasReadCapabilityInputSchema as K, applyCanvasOperationsInputSchema as Kn, getPrototypeArtifactCapabilitiesOutputSchema as Kt, canvasArrangeInputSchema as L, agentClientMetadata as Ln, createScreenOutputSchema as Lt, operationStatusOutputSchema as M, canvasReferencePageOf as Mn, canvasBlendModeSchema as Mr, PartialBatchError as Mt, canvasAssetImportCapabilityInputSchema as N, resolveCanvasReference as Nn, canvasPaintSchema as Nr, CliError as Nt, resolveCanvasSnapshot as O, canvasConversionMetadataSchema as On, hasCanvasRichTextPaints as Or, canvasReferenceRenderTarget as Ot, canvasAssetImportInputSchema as P, beginCanvasActivityOutputSchema as Pn, canvasSchema as Pr, transcriptOutputSchema as Pt, transcriptReadCapabilityInputSchema as Q, saveCanvasDocumentOutputSchema as Qn, MCP_AUTH_SCOPE as Qt, canvasDuplicateCapabilityInputSchema as R, createCanvasPreparationOutputSchema as Rn, appendRecordingChunkOutputSchema as Rt, canvasPrototypeIntentSchema as S, applyCanvasTypographyPatch as Sn, reserveCanvasAssetInputSchema as Sr, canvasMakeEditableCapabilityInputSchema as St, canvasSnapshotToken as T, canvasTextPropsWithContent as Tn, canvasImageAssetIdentityFromPath as Tr, canvasEditsSchema as Tt, canvasCaptureInputSchema as U, PAGE_KIND as Un, attachPrototypeArtifactOutputSchema as Ut, canvasWriteReceiptSchema as V, GROUP_KIND as Vn, startRecordingOutputSchema as Vt, canvasCaptureOutputSchema as W, RECTANGLE_KIND as Wn, createPrototypeArtifactOutputSchema as Wt, prototypePublishCapabilityInputSchema as X, textOf as Xn, submitPrototypeArtifactOutputSchema as Xt, commentAttentionCapabilityInputSchema as Y, canvasLayoutWithoutCssProperties as Yn, prototypeArtifactPathSchema as Yt, recordingSnapshotCapabilityInputSchema as Z, mapCanvasFontSources as Zn, getMeOutputSchema as Zt, OPTION_DESCRIPTIONS as _, screenAreaCommentTargetSchema as _n, canvasLayoutMainAxisOf as _r, canvasFindCursorSchema as _t, toSharedCapabilities as a, commentAuthorSchema as an, canvasRenderStateSchema as ar, canvasRenderFileSchema as at, canvasPrototypeCapabilityInputSchema as b, screenTextCommentTargetSchema as bn, canvasCssValue as br, canvasInsertHtmlCapabilityInputSchema as bt, toFailurePayload as c, commentResolverSchema as cn, createCanvasRenderOutputSchema as cr, canvasOutlineCursorSchema as ct, toRemoteError as d, elementAnchorSchema as dn, getCanvasRenderOutputSchema as dr, canvasUpdateHtmlCapabilityInputSchema as dt, createAgentTokenOutputSchema as en, canvasOperationSchema as er, canvasRenderBatchResultSchema as et, ProcessExitError as f, getCommentOutputSchema as fn, canvasReadableSceneDocumentSchema as fr, canvasUpdateHtmlInputSchema as ft, toCapabilityDefinition as g, replyCommentOutputSchema as gn, canvasAxisStyleProperties as gr, canvasCreateToolOutputSchema as gt, createCapabilityPolicyAdapter as h, replyCommentInputSchema as hn, canvasAuthoredStyleDeclarations as hr, canvasCreateToolInputSchema as ht, toPresentedCapabilities as i, withFixtureScreen as in, canvasRenderSourceStateSchema as ir, canvasRenderRequestSchema as it, operationStatusInputSchema as j, DEFAULT_CANVAS_REFERENCE_PAGE_ID as jn, CANVAS_BLEND_MODES as jr, parseCanvasReference as jt, canvasConversionStatusSchema as k, canvasPrototypePropsSchema as kn, CANVAS_RICH_TEXT_STYLE_PROPERTIES as kr, fromCanvasReference as kt, toMcpFailurePayload as l, commentThreadSchema as ln, createRecordingSnapshotOutputSchema as lr, canvasReadInputSchema as lt, createRouterShapeAdapter as m, listCommentsOutputSchema as mn, canvasAuthoredLayoutValueOf as mr, canvasResourcesCursorSchema as mt, withCommandName as n, listOrganisationsOutputSchema as nn, createCanvasConversionOutputSchema as nr, canvasRenderScopedInputSchema as nt, createMcpCapabilityDiscoveryAdapter as o, commentCanvasContextSchema as on, canvasRenderTargetSchema as or, canvasRemoveCapabilityInputSchema as ot, createCapabilityCatalogAdapter as p, listCommentsInputSchema as pn, canvasSceneDocumentSchema as pr, canvasTranscriptCursorSchema as pt, canvasRenderCapabilityInputSchema as q, applyCanvasOperationsOutputSchema as qn, getPrototypePublishStatusOutputSchema as qt, toCanvasAuthoringResult as r, emptyFixtureDocument as rn, getCanvasConversionOutputSchema as rr, canvasRenderScopedToolInputSchema as rt, toExitCode as s, commentMessageSchema as sn, canvasWorldBoundsSchema as sr, canvasRemoveInputSchema as st, withCommandInFailure as t, createOrganisationOutputSchema as tn, canvasNodeStylePatchSchema as tr, canvasRenderPendingSchema as tt, toPublishedExitTable as u, domLocatorSchema as un, downloadCanvasRenderOutputSchema as ur, canvasReadOutputSchema as ut, PROTOTYPE_UPDATE_GUIDANCE as v, screenElementCommentTargetSchema as vn, canvasLayoutPriorityDeclarations as vr, canvasFindInputSchema as vt, canvasExchangeDigest as w, canvasTextChangeBetween as wn, canvasFontAssetIdentityFromPath as wr, canvasEditCapabilityInputSchema as wt, canvasPrototypeInputSchema as x, startCommentInputSchema as xn, canvasAssetUploadOutputSchema as xr, canvasInsertHtmlInputSchema as xt, PROCEDURE_DESCRIPTIONS as y, screenElementsCommentTargetSchema as yn, canvasCssTokens as yr, canvasFindOutputSchema as yt, canvasDuplicateInputSchema as z, getCanvasPreparationOutputSchema as zn, completeRecordingOutputSchema as zt };