@enhance-eng/enhance 0.1.39 → 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,22 +7,12 @@ 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);
15
15
 
16
- //#endregion
17
- //#region ../../packages/canvas-format/src/canvas-edit-support.lib.ts
18
- /** Why the API refused an operation, as a fixed value. Never the words of the refusal. */
19
- const CANVAS_REFUSAL_CODES = [
20
- "appearance-unsupported-component",
21
- "styles-unsupported-component",
22
- "text-shadow-blend-unsupported",
23
- "recording-aspect-not-preserved"
24
- ];
25
-
26
16
  //#endregion
27
17
  //#region ../../packages/canvas-format/src/canvas-format.consts.ts
28
18
  /** Historical formats stay pinned; an ordinary writer always uses CANVAS_SCENE_VERSION. */
@@ -39,7 +29,8 @@ const LEGACY_CANVAS_FORMATS = {
39
29
  v9: 9,
40
30
  v10: 10,
41
31
  v11: 11,
42
- v12: 12
32
+ v12: 12,
33
+ v13: 13
43
34
  };
44
35
  const LEGACY_CANVAS_ADAPTATIONS = {
45
36
  [LEGACY_CANVAS_FORMATS.v1]: "layout",
@@ -53,9 +44,20 @@ const LEGACY_CANVAS_ADAPTATIONS = {
53
44
  [LEGACY_CANVAS_FORMATS.v9]: "geometry",
54
45
  [LEGACY_CANVAS_FORMATS.v10]: "geometry",
55
46
  [LEGACY_CANVAS_FORMATS.v11]: "css",
56
- [LEGACY_CANVAS_FORMATS.v12]: "text-shadow-blend"
47
+ [LEGACY_CANVAS_FORMATS.v12]: "text-shadow-blend",
48
+ [LEGACY_CANVAS_FORMATS.v13]: "format-number"
57
49
  };
58
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
+
59
61
  //#endregion
60
62
  //#region ../../packages/canvas-format/src/canvas-css-adaptation.lib.ts
61
63
  const isRecord$3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -305,10 +307,11 @@ const withoutTextShadowBlends = (document) => {
305
307
 
306
308
  //#endregion
307
309
  //#region ../../packages/canvas-format/src/canvas-format.lib.ts
308
- 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]);
309
311
  const isReadableCanvasFormat = (version) => READABLE_FORMATS.has(version);
310
312
  /** Formats whose adaptation rewrites the stored document in place, keeping its geometry. */
311
313
  const ADAPTED_IN_PLACE = /* @__PURE__ */ new Set([
314
+ "format-number",
312
315
  "text-shadow-blend",
313
316
  "css",
314
317
  "geometry"
@@ -328,20 +331,20 @@ const legacyLayout = (layout) => {
328
331
  const adaptLegacyFormat = (document) => {
329
332
  const version = document["version"];
330
333
  if (!isReadableCanvasFormat(version)) return null;
331
- if (version === 13 || !isRecord$1(document["nodes"])) return document;
334
+ if (version === 14 || !isRecord$1(document["nodes"])) return document;
332
335
  const adaptation = Object.entries(LEGACY_CANVAS_ADAPTATIONS).find(([format]) => Number(format) === version)?.[1];
333
336
  if (ADAPTED_IN_PLACE.has(adaptation)) return {
334
337
  ...document,
335
- version: 13
338
+ version: 14
336
339
  };
337
340
  if (Object.values(document["nodes"]).some((node) => isRecord$1(node) && node["geometry"] !== void 0)) return null;
338
341
  if (adaptation === "typography") return {
339
342
  ...document,
340
- version: 13
343
+ version: 14
341
344
  };
342
345
  return {
343
346
  ...document,
344
- version: 13,
347
+ version: 14,
345
348
  nodes: Object.fromEntries(Object.entries(document["nodes"]).map(([id, node]) => [id, isRecord$1(node) && node["layout"] !== void 0 ? {
346
349
  ...node,
347
350
  layout: legacyLayout(node["layout"])
@@ -350,12 +353,14 @@ const adaptLegacyFormat = (document) => {
350
353
  };
351
354
  /**
352
355
  * Adapt known formats in memory, retaining malformed content for each boundary's validator. Format
353
- * 12 already has the CSS model, so it takes only the text shadow step that every older format takes
354
- * 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.
355
359
  */
356
360
  const adaptCanvasDocumentFormat = (document) => {
357
361
  const adapted = adaptLegacyFormat(document);
358
362
  if (adapted === null || adapted === document) return adapted;
363
+ if (document["version"] === LEGACY_CANVAS_FORMATS.v13) return adapted;
359
364
  return withoutTextShadowBlends(document["version"] === LEGACY_CANVAS_FORMATS.v12 ? adapted : adaptCanvasCss(adapted));
360
365
  };
361
366
 
@@ -481,7 +486,8 @@ const viewerCapabilitySchema = z.object({
481
486
  })).default([]),
482
487
  grantableAccessLevels: z.array(grantableAccessLevelSchema).default([]),
483
488
  share: z.boolean(),
484
- manage: z.boolean()
489
+ manage: z.boolean(),
490
+ readHistory: z.boolean().default(false)
485
491
  });
486
492
  const canvasSchema = z.object({
487
493
  id: z.uuid(),
@@ -557,6 +563,25 @@ const duplicateCanvasInputSchema = z.object({
557
563
  title: z.string().trim().min(1).optional()
558
564
  });
559
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
+ });
560
585
  const permanentlyDeleteCanvasInputSchema = z.object({
561
586
  canvasId: z.uuid(),
562
587
  confirmation: z.string().min(1)
@@ -781,14 +806,22 @@ const canvasPaintCoreSchema = z.discriminatedUnion("kind", [
781
806
  path: ["transform"]
782
807
  })
783
808
  ]);
784
- const canvasPaintSchema = z.intersection(canvasPaintCoreSchema, z.object({ alternatives: z.partialRecord(z.enum([
785
- "solid",
786
- "linear-gradient",
787
- "radial-gradient",
788
- "angular-gradient",
789
- "diamond-gradient",
790
- "image"
791
- ]), 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
+ }));
792
825
  const canvasColorDefinitionSchema = z.object({
793
826
  id: itemId$1,
794
827
  name: z.string().trim().min(1),
@@ -887,6 +920,17 @@ const canvasFlexLayoutSchema = z.object({
887
920
  gridAutoRepeat: canvasGridAutoRepeatSchema.optional(),
888
921
  padding: canvasFlexPaddingSchema
889
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();
890
934
  const canvasNodeLayoutSchema = z.object({
891
935
  rotation: canvasNumberSchema.optional(),
892
936
  flipHorizontal: z.boolean().optional(),
@@ -926,6 +970,7 @@ const canvasNodeLayoutSchema = z.object({
926
970
  order: canvasNumberSchema.int().optional(),
927
971
  margin: canvasFlexMarginSchema.partial().optional(),
928
972
  clipContent: z.boolean().optional(),
973
+ baselineSource: canvasBaselineSourceSchema.optional(),
929
974
  container: canvasFlexLayoutSchema.partial().extend({ padding: canvasFlexPaddingSchema.partial().optional() }).optional()
930
975
  }).strict();
931
976
 
@@ -1357,6 +1402,7 @@ const CANVAS_RICH_TEXT_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
1357
1402
  "marginRight",
1358
1403
  "marginTop",
1359
1404
  "opacity",
1405
+ "overflowWrap",
1360
1406
  "paddingBottom",
1361
1407
  "paddingLeft",
1362
1408
  "paddingRight",
@@ -1367,11 +1413,16 @@ const CANVAS_RICH_TEXT_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
1367
1413
  "textDecorationSkipInk",
1368
1414
  "textDecorationStyle",
1369
1415
  "textDecorationThickness",
1416
+ "textRendering",
1370
1417
  "textShadow",
1371
1418
  "textTransform",
1372
1419
  "textUnderlineOffset",
1373
1420
  "verticalAlign",
1374
1421
  "whiteSpace",
1422
+ "wordBreak",
1423
+ "wordSpacing",
1424
+ "WebkitFontSmoothing",
1425
+ "WebkitTextFillColor",
1375
1426
  "WebkitTextStrokeColor",
1376
1427
  "WebkitTextStrokeWidth",
1377
1428
  "--canvas-text-stroke-alignment"
@@ -1646,6 +1697,11 @@ const CANVAS_IMAGE_CONTENT_TYPES = [
1646
1697
  "image/png",
1647
1698
  "image/webp"
1648
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);
1649
1705
  const reserveCanvasImageInputSchema = z.object({
1650
1706
  canvasId: z.uuid(),
1651
1707
  contentType: z.enum(CANVAS_IMAGE_CONTENT_TYPES),
@@ -1674,7 +1730,8 @@ const CANVAS_FONT_CONTENT_TYPES = [
1674
1730
  "font/ttf",
1675
1731
  "font/otf",
1676
1732
  "font/woff",
1677
- "font/woff2"
1733
+ "font/woff2",
1734
+ "font/collection"
1678
1735
  ];
1679
1736
  const canvasFontAssetIdentitySchema = z.object({
1680
1737
  canvasId: z.uuid(),
@@ -1706,10 +1763,8 @@ const canvasFontAssetIdentityFromPath = (path) => {
1706
1763
  //#endregion
1707
1764
  //#region ../../packages/contract/src/canvas/canvas-asset-upload.schema.ts
1708
1765
  const MAX_FONT_WEIGHT = 1e3;
1709
- const CONTENT_TYPES = {
1710
- image: CANVAS_IMAGE_CONTENT_TYPES,
1711
- font: CANVAS_FONT_CONTENT_TYPES
1712
- };
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);
1713
1768
  const canvasAssetUploadIdentitySchema = z.strictObject({
1714
1769
  canvasId: z.uuid(),
1715
1770
  clientToken: z.uuid()
@@ -1752,7 +1807,7 @@ const canvasAssetUploadOutputSchema = z.strictObject({
1752
1807
  path: z.string().startsWith("/v1/canvas-assets/"),
1753
1808
  state: z.enum(["awaiting_upload", "ready"]),
1754
1809
  metadata: canvasAssetMetadataSchema.nullable()
1755
- }).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.");
1756
1811
  const reserveCanvasAssetOutputSchema = canvasAssetUploadOutputSchema.safeExtend({ upload: signedUploadSchema.nullable() }).refine((asset) => asset.state === "awaiting_upload" === (asset.upload !== null), "Only pending uploads receive upload access.");
1757
1812
 
1758
1813
  //#endregion
@@ -1978,8 +2033,7 @@ const cssValue = (value, shouldPreserveCase) => {
1978
2033
  const source = String(value).replace(/\s*!important\s*$/iu, "").trim();
1979
2034
  return shouldPreserveCase || source.includes("(") ? source : source.toLowerCase();
1980
2035
  };
1981
- /** Read supported authored longhands without measuring or rewriting unresolved CSS expressions. */
1982
- const canvasAuthoredLayoutValueOf = (node, property) => {
2036
+ const authoredLayoutValue = (node, property) => {
1983
2037
  let result = null;
1984
2038
  let isImportant = false;
1985
2039
  const declarations = Object.entries(canvasAuthoredStyleDeclarations(node));
@@ -1995,6 +2049,24 @@ const canvasAuthoredLayoutValueOf = (node, property) => {
1995
2049
  }
1996
2050
  return result ?? void 0;
1997
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
+ };
1998
2070
  /** Named controls override only their own longhand, even beside an important shorthand. */
1999
2071
  const canvasLayoutPriorityDeclarations = (node, declarations) => {
2000
2072
  const important = new Set(Object.entries(canvasAuthoredStyleDeclarations(node)).filter(([, value]) => hasCanvasCssPriority(value)).flatMap(([property]) => canvasCssPropertyScope(property)));
@@ -2123,10 +2195,11 @@ const canvasGeometrySchema = z.discriminatedUnion("kind", [
2123
2195
  //#endregion
2124
2196
  //#region ../../packages/contract/src/canvas/canvas-scene.schema.ts
2125
2197
  const CANVAS_COMPOSITING_RETIRED = "Update Enhance: compositing is no longer supported. Use the isolation style or a mask group.";
2126
- 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." });
2127
2199
  const canvasPreservedFontAppearanceSchema = z.object({
2128
2200
  signature: z.string().regex(/^[a-f0-9]{16}$/u),
2129
- 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),
2130
2203
  families: z.array(z.string().min(1)).min(1)
2131
2204
  });
2132
2205
  const canvasSceneBoxSchema = z.object({
@@ -2173,7 +2246,7 @@ const canvasSceneNodeSchema = z.looseObject({
2173
2246
  box: canvasSceneBoxSchema.optional()
2174
2247
  });
2175
2248
  const canvasSceneDocumentSchema = z.object({
2176
- version: z.literal(13),
2249
+ version: z.literal(14),
2177
2250
  nodes: z.record(z.string(), canvasSceneNodeSchema),
2178
2251
  relationships: z.record(z.string(), z.object({
2179
2252
  parentId: z.string().min(1),
@@ -2190,7 +2263,7 @@ const canvasReadableSceneDocumentSchema = z.preprocess((value) => {
2190
2263
  return adaptCanvasDocumentFormat(blob);
2191
2264
  }, canvasSceneDocumentSchema);
2192
2265
  const emptyCanvasSceneDocument = () => ({
2193
- version: 13,
2266
+ version: 14,
2194
2267
  nodes: { root: {
2195
2268
  id: "root",
2196
2269
  label: "Canvas",
@@ -2355,7 +2428,8 @@ const RENDER_WARNING_CODES = [
2355
2428
  "FONT_FALLBACK",
2356
2429
  "LOCAL_FONT_FALLBACK",
2357
2430
  "SOURCE_FALLBACK",
2358
- "SCALE_REDUCED"
2431
+ "SCALE_REDUCED",
2432
+ "LAYOUT_FALLBACK"
2359
2433
  ];
2360
2434
 
2361
2435
  //#endregion
@@ -2519,6 +2593,9 @@ const createCanvasRenderOutputSchema = z.object({
2519
2593
  alreadyExists: z.boolean()
2520
2594
  });
2521
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() });
2522
2599
  const getCanvasRenderOutputSchema = z.object({ job: canvasRenderJobSchema });
2523
2600
  const cancelCanvasRenderInputSchema = z.object({ jobId: z.uuid() });
2524
2601
  const cancelCanvasRenderOutputSchema = z.object({ job: canvasRenderJobSchema });
@@ -3133,7 +3210,6 @@ const insertConvertedSubtreeOperationSchema = z.object({
3133
3210
  relationships: z.record(z.string().min(1), convertedSubtreeRelationshipSchema)
3134
3211
  });
3135
3212
  const nodeIdSchema$3 = z.string().min(1);
3136
- const sortKeySchema = z.string().min(1);
3137
3213
  const writableBoxSchema$1 = canvasSceneBoxSchema.extend({
3138
3214
  width: z.number().positive(),
3139
3215
  height: z.number().positive()
@@ -3142,10 +3218,7 @@ const placementSchema = z.object({
3142
3218
  parentId: nodeIdSchema$3,
3143
3219
  afterId: nodeIdSchema$3.optional()
3144
3220
  });
3145
- const parentageSchema = z.object({
3146
- parentId: nodeIdSchema$3,
3147
- sortKey: sortKeySchema
3148
- });
3221
+ const parentageSchema = convertedSubtreeRelationshipSchema;
3149
3222
  const canvasSetStylesOperationSchema = z.object({
3150
3223
  op: z.literal("setStyles"),
3151
3224
  nodeId: nodeIdSchema$3,
@@ -3164,6 +3237,11 @@ const currentCanvasOperationSchema = z.discriminatedUnion("op", [
3164
3237
  documentVersion: z.number().int().nonnegative(),
3165
3238
  versionEntryId: z.uuid().optional()
3166
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(),
3167
3245
  /** A page copy's base name; the API gives the copy the first free name from it. */
3168
3246
  pageCopyBase: z.string().refine((base) => base.trim() !== "").optional()
3169
3247
  }),
@@ -3381,10 +3459,17 @@ const getCanvasDocumentOutputSchema = z.object({
3381
3459
  * has not seen the restore, and the log never reaches back past it.
3382
3460
  */
3383
3461
  restoreFenceVersion: z.number().int().positive().optional(),
3384
- 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(),
3385
3468
  /** The manifest, resolved and signed. This is what makes a cold open one round trip. */
3386
3469
  screens: z.array(documentScreenSchema)
3387
3470
  });
3471
+ /** The answer to a document read without `afterVersion`, which always carries the document. */
3472
+ const wholeCanvasDocumentOutputSchema = getCanvasDocumentOutputSchema.extend({ document: canvasDocumentBlobSchema });
3388
3473
  const saveCanvasDocumentInputSchema = z.object({
3389
3474
  canvasId: z.uuid(),
3390
3475
  baseVersion: z.number().int().min(1),
@@ -4138,7 +4223,9 @@ const canvasPreparationPlanSchema = z.strictObject({
4138
4223
  });
4139
4224
  const canvasPreparationWorkPlanSchema = canvasPreparationPlanSchema.extend({ compilations: z.array(z.strictObject({
4140
4225
  id: nodeId$5,
4141
- 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()
4142
4229
  })).optional() });
4143
4230
  const preparationRouteStateSchema = z.discriminatedUnion("state", [
4144
4231
  z.object({
@@ -4154,7 +4241,10 @@ const preparationRouteStateSchema = z.discriminatedUnion("state", [
4154
4241
  z.object({
4155
4242
  state: z.literal("failed"),
4156
4243
  jobId: z.uuid(),
4157
- 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()
4158
4248
  })
4159
4249
  ]);
4160
4250
  const job = z.object({
@@ -4731,6 +4821,13 @@ const exposeCanvasRenderOutputSchema = z.discriminatedUnion("purpose", [
4731
4821
  purpose: z.literal("preparation"),
4732
4822
  preparation: canvasRenderPreparationSchema,
4733
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(),
4734
4831
  sourceState: z.undefined().optional(),
4735
4832
  scale: z.literal(1),
4736
4833
  format: z.literal("json")
@@ -5460,19 +5557,20 @@ const lastRunWith = (nodes, text) => {
5460
5557
  };
5461
5558
  /**
5462
5559
  * The one-character runs whose formatting typed text takes. Typing at a link's edge stays
5463
- * outside the link; empty text and an empty last paragraph have no character, so the last run
5464
- * 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.
5465
5562
  */
5466
- const canvasTextTypedFormatting = (runs, range) => {
5563
+ const canvasTextTypedFormatting = (runs, range, shouldContinueLink = false) => {
5467
5564
  const index = typedCharacterOf(canvasRichTextValueOf(runs), range);
5468
5565
  const character = sliceRuns(runs, index, index + 1);
5469
5566
  const formatting = character.length > 0 ? character : lastRunWith(runs, " ");
5470
- 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, {
5471
5569
  type: "link",
5472
5570
  href: null
5473
5571
  }) : formatting;
5474
5572
  };
5475
- 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);
5476
5574
  const canvasTextReplacementRange = (before, text, range) => {
5477
5575
  const replacementEnd = text.length - before.length + (range?.end ?? 0);
5478
5576
  if (range !== void 0 && isValidTextRange(before, range) && isValidTextRange(text, {
@@ -5577,7 +5675,7 @@ const paragraphProps = (node, range, command) => {
5577
5675
  Reflect.deleteProperty(props, "links");
5578
5676
  return props;
5579
5677
  };
5580
- const replacementRuns = (runs, range, command) => {
5678
+ const replacementRuns = (runs, range, command, shouldContinueLink) => {
5581
5679
  if (command.richText !== void 0) {
5582
5680
  const rich = canvasRichTextOf({ props: {
5583
5681
  text: command.text,
@@ -5586,7 +5684,10 @@ const replacementRuns = (runs, range, command) => {
5586
5684
  if (rich.length > 0) return rich;
5587
5685
  }
5588
5686
  const shouldKeepEmpty = range.start === 0 && range.end === canvasRichTextValueOf(runs).length;
5589
- let next = insertedRuns(runs, range, command.text, shouldKeepEmpty);
5687
+ let next = insertedRuns(runs, range, command.text, {
5688
+ shouldKeepEmpty,
5689
+ shouldContinueLink
5690
+ });
5590
5691
  if (command.text === "") return next;
5591
5692
  if (Object.keys(command.styles ?? {}).length > 0 || Object.keys(textRunFormattingOf(command)).length > 0) next = formattedRuns(next, {
5592
5693
  type: "format",
@@ -5604,14 +5705,14 @@ const replacementRuns = (runs, range, command) => {
5604
5705
  return next;
5605
5706
  };
5606
5707
  /** Commands write the existing text/run pair atomically and retain unrelated source metadata. */
5607
- const canvasTextPropsWithCommand = (node, range, command) => {
5708
+ const canvasTextPropsWithCommand = (node, range, command, shouldContinueLink) => {
5608
5709
  const text = textOf(node) ?? "";
5609
5710
  if (!(command.type === "paint" ? isValidTextCharacterRange(text, range) : isValidTextRange(text, range))) return node.props ?? {};
5610
5711
  if (command.type === "paragraph" || command.type === "list-indent") return paragraphProps(node, range, command);
5611
5712
  if (command.type !== "replace" && range.start === range.end && (text !== "" || command.type !== "text-style" && command.type !== "format")) return node.props ?? {};
5612
5713
  if (command.type === "link" && command.href !== null && !isCanvasRichTextHref(command.href)) return node.props ?? {};
5613
5714
  const runs = canvasTextRunsOf(node);
5614
- 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);
5615
5716
  const next = canvasTextParagraphRunsAfterEdit(runs, joinRuns([
5616
5717
  ...sliceRuns(runs, 0, range.start),
5617
5718
  ...middle,
@@ -5633,14 +5734,14 @@ const canvasTextPropsWithCommand = (node, range, command) => {
5633
5734
  const canvasTextPropsWithContent = (node, text, styles, formatting) => {
5634
5735
  const before = textOf(node) ?? "";
5635
5736
  if (before === text) return node.props ?? {};
5636
- const { range, ...marks } = formatting ?? {};
5737
+ const { range, shouldContinueLink, ...marks } = formatting ?? {};
5637
5738
  const replacement = canvasTextReplacementRange(before, text, range);
5638
5739
  return canvasTextPropsWithCommand(node, replacement, {
5639
5740
  type: "replace",
5640
5741
  styles,
5641
5742
  ...marks,
5642
5743
  text: text.slice(replacement.start, text.length - before.length + replacement.end)
5643
- });
5744
+ }, shouldContinueLink);
5644
5745
  };
5645
5746
 
5646
5747
  //#endregion
@@ -6001,6 +6102,20 @@ const duplicateCanvasVersionOutputSchema = z.object({
6001
6102
  version: z.literal(1)
6002
6103
  });
6003
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
+
6004
6119
  //#endregion
6005
6120
  //#region ../../packages/contract/src/canvas/font-catalog.schema.ts
6006
6121
  const MAX_WEIGHT = 1e3;
@@ -6189,6 +6304,7 @@ const setReviewStateOutputSchema = z.object({ reviewState: setReviewStateInputSc
6189
6304
  /** The longest journey, step, variant or label a capture may carry. */
6190
6305
  const CAPTURE_KEY_LENGTH = 160;
6191
6306
  const CAPTURE_METADATA_LENGTH = 200;
6307
+ /** The longest capture issue message a capture or a receipt carries. */
6192
6308
  const CAPTURE_ISSUE_LENGTH = 500;
6193
6309
  const CAPTURE_FAILURE_LENGTH = 1e3;
6194
6310
  const CAPTURE_UPLOAD_BATCH_SIZE = 400;
@@ -6271,7 +6387,7 @@ const captureArtifactSchema = z.strictObject({
6271
6387
  }),
6272
6388
  issues: z.array(z.strictObject({
6273
6389
  code: key,
6274
- message: z.string().min(1).max(CAPTURE_ISSUE_LENGTH)
6390
+ message: z.string().min(1).max(500)
6275
6391
  }))
6276
6392
  }).superRefine((artifact, ctx) => {
6277
6393
  if (artifact.preview.width / artifact.preview.pixelRatio !== artifact.viewport.width || artifact.preview.height / artifact.preview.pixelRatio !== artifact.viewport.height) ctx.addIssue({
@@ -6314,10 +6430,8 @@ const captureRunDescriptorSchema = z.strictObject({
6314
6430
  formatVersion: z.literal(1),
6315
6431
  review: captureReviewMetadataSchema.optional()
6316
6432
  });
6317
- const captureAttemptSchema = z.strictObject({
6433
+ const attemptFields = {
6318
6434
  participant: key,
6319
- testId: key,
6320
- project: key,
6321
6435
  retry: z.number().int().nonnegative(),
6322
6436
  status: z.enum([
6323
6437
  "passed",
@@ -6332,6 +6446,27 @@ const captureAttemptSchema = z.strictObject({
6332
6446
  line: z.number().int()
6333
6447
  }).optional(),
6334
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)
6335
6470
  });
6336
6471
  const captureManifestSchema = z.strictObject({
6337
6472
  format: z.literal("enhance-capture-run"),
@@ -6346,7 +6481,8 @@ const captureManifestSchema = z.strictObject({
6346
6481
  ])
6347
6482
  })).min(1),
6348
6483
  attempts: z.array(captureAttemptSchema),
6349
- ordering: z.enum(["partial", "complete"])
6484
+ ordering: z.enum(["partial", "complete"]),
6485
+ leftOut: z.array(captureLeftOutSchema).optional()
6350
6486
  });
6351
6487
  const captureReceiptSchema = z.strictObject({
6352
6488
  runId: z.uuid(),
@@ -6361,7 +6497,7 @@ const captureReceiptSchema = z.strictObject({
6361
6497
  })),
6362
6498
  issues: z.array(z.strictObject({
6363
6499
  code: key,
6364
- message: z.string().max(CAPTURE_ISSUE_LENGTH)
6500
+ message: z.string().max(500)
6365
6501
  }))
6366
6502
  });
6367
6503
  const beginCaptureRunInputSchema = z.strictObject({
@@ -6418,6 +6554,38 @@ const reserveCaptureBlobsOutputSchema = z.strictObject({ uploads: z.array(z.stri
6418
6554
  }).nullable()
6419
6555
  })).max(CAPTURE_UPLOAD_BATCH_SIZE) });
6420
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
+
6421
6589
  //#endregion
6422
6590
  //#region ../../packages/contract/src/capture/capture-name.lib.ts
6423
6591
  const CODE_LENGTH = 8;
@@ -7329,7 +7497,7 @@ const ROOT_FIXTURE_NODE_ID = "root";
7329
7497
  const SORT_KEY_DIGITS = 4;
7330
7498
  const sortKeyAt = (seat) => `a${String(seat).padStart(SORT_KEY_DIGITS, "0")}`;
7331
7499
  const emptyFixtureDocument = () => ({
7332
- version: 13,
7500
+ version: 14,
7333
7501
  nodes: { [ROOT_FIXTURE_NODE_ID]: {
7334
7502
  id: ROOT_FIXTURE_NODE_ID,
7335
7503
  label: "Canvas",
@@ -7952,24 +8120,6 @@ const requestPrototypeRuntimeTicketOutputSchema = z.object({
7952
8120
  expiresAt: z.iso.datetime()
7953
8121
  });
7954
8122
 
7955
- //#endregion
7956
- //#region ../../packages/contract/src/recording/frozen-screen.schema.ts
7957
- const MAX_ISSUE_CODE_LENGTH = 160;
7958
- const MAX_ISSUE_MESSAGE_LENGTH = 500;
7959
- const MAX_ISSUE_KINDS = 32;
7960
- const frozenScreenIssuesSchema = z$1.array(z$1.object({
7961
- code: z$1.string().check(z$1.minLength(1), z$1.maxLength(MAX_ISSUE_CODE_LENGTH)),
7962
- message: z$1.string().check(z$1.minLength(1), z$1.maxLength(MAX_ISSUE_MESSAGE_LENGTH))
7963
- })).check(z$1.maxLength(MAX_ISSUE_KINDS));
7964
- /** Missing issues are historical or unreported; an empty array explicitly reports no omissions. */
7965
- const frozenScreenCaptureSchema = z$1.object({
7966
- issues: z$1.optional(frozenScreenIssuesSchema),
7967
- prototype: z$1.optional(z$1.object({
7968
- prototypeId: z$1.uuid(),
7969
- deploymentId: z$1.uuid()
7970
- }))
7971
- });
7972
-
7973
8123
  //#endregion
7974
8124
  //#region ../../packages/contract/src/prototype/prototype-bridge.schema.ts
7975
8125
  const PROTOTYPE_BRIDGE_PROTOCOL = 1;
@@ -8008,7 +8158,9 @@ const prototypeBridgeCaptureRequestSchema = z$1.object({
8008
8158
  type: z$1.literal("enhance.prototype.capture"),
8009
8159
  requestId: z$1.uuid(),
8010
8160
  connectionId: z$1.optional(z$1.uuid()),
8011
- 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"))
8012
8164
  });
8013
8165
  const prototypeBridgeConnectRequestSchema = z$1.object({
8014
8166
  protocol: z$1.literal(1),
@@ -8083,7 +8235,19 @@ const capturedPrototypeScreenSchema = z$1.object({
8083
8235
  width: z$1.number().check(z$1.positive()),
8084
8236
  height: z$1.number().check(z$1.positive())
8085
8237
  }),
8086
- 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
+ }))
8087
8251
  });
8088
8252
  const prototypeBridgeCaptureResponseBaseSchema = z$1.object({
8089
8253
  protocol: z$1.literal(1),
@@ -8092,15 +8256,22 @@ const prototypeBridgeCaptureResponseBaseSchema = z$1.object({
8092
8256
  connectionId: z$1.optional(z$1.uuid()),
8093
8257
  documentId: z$1.optional(z$1.uuid())
8094
8258
  });
8095
- const prototypeBridgeCaptureResponseSchema = z$1.discriminatedUnion("outcome", [z$1.extend(prototypeBridgeCaptureResponseBaseSchema, {
8096
- outcome: z$1.literal("captured"),
8097
- screen: capturedPrototypeScreenSchema,
8098
- issues: z$1.optional(frozenScreenIssuesSchema)
8099
- }), z$1.extend(prototypeBridgeCaptureResponseBaseSchema, {
8100
- outcome: z$1.literal("failed"),
8101
- error: z$1.string().check(z$1.minLength(1)),
8102
- code: z$1.optional(z$1.enum(["capture-failed", "capture-busy"]))
8103
- })]);
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
+ ]);
8104
8275
 
8105
8276
  //#endregion
8106
8277
  //#region ../../packages/contract/src/prototype/prototype-input.schema.ts
@@ -8440,7 +8611,9 @@ const recordingSummarySchema = z.object({
8440
8611
  viewport: viewportSchema,
8441
8612
  interrupted: z.boolean(),
8442
8613
  chunkCount: z.number().int().min(0),
8443
- 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()
8444
8617
  });
8445
8618
  /**
8446
8619
  * @justified intent
@@ -8454,26 +8627,40 @@ const recordingSummarySchema = z.object({
8454
8627
  * Batched: a page asks for tens of files, and a per-file round trip would cost more than the
8455
8628
  * bytes do.
8456
8629
  */
8457
- 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({
8458
8642
  recordingId: z.uuid(),
8459
- assets: z.array(z.object({
8460
- url: z.url(),
8461
- contentType: z.string().min(1).max(200),
8462
- byteSize: z.number().int().min(1)
8463
- })).max(MAX_ASSETS_PER_CALL)
8464
- });
8643
+ assets: reservedAssetsSchema
8644
+ }), z.object({
8645
+ screenId: z.uuid(),
8646
+ assets: reservedAssetsSchema
8647
+ })]);
8465
8648
  const reserveAssetsOutputSchema = z.object({ reserved: z.array(z.object({
8466
8649
  url: z.string(),
8467
8650
  upload: signedUploadSchema
8468
8651
  })) });
8469
- 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({
8470
8658
  recordingId: z.uuid(),
8471
- arrived: z.array(z.object({
8472
- url: z.url(),
8473
- etag: z.string().min(1).max(200),
8474
- byteSize: z.number().int().min(1)
8475
- })).max(MAX_ASSETS_PER_CALL)
8476
- });
8659
+ arrived: arrivedAssetsSchema
8660
+ }), z.object({
8661
+ screenId: z.uuid(),
8662
+ arrived: arrivedAssetsSchema
8663
+ })]);
8477
8664
  const confirmAssetsOutputSchema = z.object({
8478
8665
  /** Reserved and never delivered. Reported rather than left for the replay to discover. */
8479
8666
  missingAssetCount: z.number().int().min(0) });
@@ -8597,7 +8784,9 @@ const createScreenInputSchema = z.object({
8597
8784
  width: z.number().int().positive(),
8598
8785
  height: z.number().int().positive()
8599
8786
  }),
8600
- 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()
8601
8790
  });
8602
8791
  const createScreenOutputSchema = z.object({
8603
8792
  screenId: z.uuid(),
@@ -8693,7 +8882,7 @@ const clientConversionOutputSchema = z.object({ accepted: z.literal(true) });
8693
8882
  //#region ../../packages/contract/src/shared/client-performance.schema.ts
8694
8883
  const MAX_CAPABILITY_VERSION$1 = 16;
8695
8884
  const MAX_DURATION_MS$1 = 18e5;
8696
- const MAX_COUNT = 1e6;
8885
+ const MAX_COUNT$1 = 1e6;
8697
8886
  const MAX_BYTES = 1073741824;
8698
8887
  const MAX_PROTOTYPE_OPEN_ATTEMPTS = 16;
8699
8888
  /** How the read of a canvas's unsaved browser copy ended when the canvas opened. */
@@ -8703,7 +8892,7 @@ const browserCopyCheckSchema = z.enum([
8703
8892
  "none"
8704
8893
  ]);
8705
8894
  const durationSchema$1 = z.number().int().min(0).max(MAX_DURATION_MS$1);
8706
- const countSchema = z.number().int().min(0).max(MAX_COUNT);
8895
+ const countSchema = z.number().int().min(0).max(MAX_COUNT$1);
8707
8896
  const base$1 = {
8708
8897
  canvasId: z.uuid(),
8709
8898
  clientViewId: z.uuid(),
@@ -8818,7 +9007,12 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
8818
9007
  "denied",
8819
9008
  "expired-or-used",
8820
9009
  "temporary-error",
8821
- "deadline"
9010
+ "deadline",
9011
+ "ticket-held",
9012
+ "gate-silent",
9013
+ "exchange-held",
9014
+ "document-held",
9015
+ "document-unconfirmed"
8822
9016
  ]),
8823
9017
  attempts: z.number().int().min(1).max(MAX_PROTOTYPE_OPEN_ATTEMPTS),
8824
9018
  durationMs: durationSchema$1,
@@ -8863,7 +9057,10 @@ const clientPerformanceOutputSchema = z.object({ accepted: z.literal(true) });
8863
9057
  const MAX_ASSET_LENGTH = 128;
8864
9058
  const MAX_FRAME_COORDINATE = 1e7;
8865
9059
  const MAX_FRAMES = 8;
8866
- const count$1 = z.number().int().min(0).max(1e3);
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);
8867
9064
  const clientRenderFailureDetailsSchema = z.strictObject({
8868
9065
  version: z.literal(1),
8869
9066
  severity: z.enum([
@@ -8894,6 +9091,10 @@ const clientRenderFailureDetailsSchema = z.strictObject({
8894
9091
  "application-empty",
8895
9092
  "startup-stalled",
8896
9093
  "export-incomplete",
9094
+ "export-image-refused",
9095
+ "export-image-unreachable",
9096
+ "export-image-not-an-image",
9097
+ "export-font-unread",
8897
9098
  "clipboard-unavailable",
8898
9099
  "clipboard-image-pending",
8899
9100
  "clipboard-image-unavailable",
@@ -8930,8 +9131,16 @@ const clientRenderFailureDetailsSchema = z.strictObject({
8930
9131
  "no-asset-list",
8931
9132
  "kept-local"
8932
9133
  ]).optional(),
8933
- subsystem: z.enum(["menu", "unknown"]).optional(),
9134
+ subsystem: z.enum([
9135
+ "menu",
9136
+ "menu-picture",
9137
+ "unknown"
9138
+ ]).optional(),
8934
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(),
8935
9144
  deliveryGap: z.strictObject({
8936
9145
  refused: count$1,
8937
9146
  expired: count$1,
@@ -9071,8 +9280,15 @@ const CANVAS_SAVE_NOTICE_CAUSES = [
9071
9280
  "offline",
9072
9281
  "retrying",
9073
9282
  "upload",
9283
+ "missing-image",
9284
+ "missing-capture",
9074
9285
  "review",
9075
9286
  "view-only",
9287
+ "not-backed-up",
9288
+ "gone",
9289
+ "refused",
9290
+ "copy-refused",
9291
+ "copy-preview",
9076
9292
  "unknown"
9077
9293
  ];
9078
9294
  const CANVAS_SAVE_SEVERITIES = [
@@ -9088,7 +9304,15 @@ const CANVAS_SAVE_DEVICE_PROTECTIONS = [
9088
9304
  const CANVAS_SAVE_ACTIONS = [
9089
9305
  "try-again",
9090
9306
  "sync",
9091
- "overwrite"
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"
9092
9316
  ];
9093
9317
  const CANVAS_SAVE_OUTCOMES = [
9094
9318
  "saved",
@@ -9425,6 +9649,11 @@ const RETRY_LATER = "later";
9425
9649
  const MUTATION_ID_REUSED = "mutation-id-reused";
9426
9650
  /** The message for input the api's schema refused; `fields` names each field and why. */
9427
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";
9428
9657
  /** `fields.reason` on a 413, whether the server's envelope or a proxy's bare status says so. */
9429
9658
  const REQUEST_TOO_LARGE = "request-too-large";
9430
9659
  const HTTP_UNAUTHORIZED = 401;
@@ -9639,20 +9868,40 @@ const fitCaptureNames = (raw) => {
9639
9868
  }
9640
9869
  return capture;
9641
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()) };
9642
9883
  /**
9643
9884
  * A manifest checked in outline, then capture by capture: one capture that fails its own checks
9644
- * 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.
9645
9886
  */
9646
- const lenientCaptureManifestSchema = captureManifestSchema.extend({ attempts: z.array(captureAttemptSchema.extend({ captures: z.array(z.unknown()) })) }).transform((manifest) => ({
9647
- ...manifest,
9648
- 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) => ({
9649
9890
  ...attempt,
9650
- captures: attempt.captures.flatMap((capture) => {
9651
- const parsed = captureArtifactSchema.safeParse(fitCaptureNames(capture));
9652
- 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 [];
9653
9897
  })
9654
- }))
9655
- }));
9898
+ }));
9899
+ return {
9900
+ ...manifest,
9901
+ attempts,
9902
+ ...leftOut.length > 0 && { leftOut }
9903
+ };
9904
+ });
9656
9905
  const sealCaptureRunInputSchema = z.strictObject({ manifest: lenientCaptureManifestSchema });
9657
9906
 
9658
9907
  //#endregion
@@ -11578,6 +11827,7 @@ const PROCEDURE_DESCRIPTIONS = {
11578
11827
  "canvas.delete": "Move a canvas to its recoverable bin; retention is currently indefinite.",
11579
11828
  "canvas.move": "Move a canvas between the personal shelf and a team shelf.",
11580
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.",
11581
11831
  "canvas.deletePermanently": "Permanently delete a canvas already in the recoverable bin.",
11582
11832
  "canvas.restore": "Restore a canvas from the recoverable bin.",
11583
11833
  "canvas.list": "Find canvas ids by collection, title, access, review state, or deletion state.",
@@ -11637,8 +11887,8 @@ const PROCEDURE_DESCRIPTIONS = {
11637
11887
  "recording.delete": "Soft-delete a completed recording while preserving screens and clearing their provenance.",
11638
11888
  "recording.refreshUpload": "Replace an expired signed upload for a recording chunk.",
11639
11889
  "recording.confirmUpload": "Confirm that a repaired recording chunk reached storage.",
11640
- "recordingAsset.reserve": "Reserve signed uploads for external assets used by a recording.",
11641
- "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.",
11642
11892
  "screen.create": "Reserve a signed upload for a captured page and return its screen id.",
11643
11893
  "screen.complete": "Confirm a captured page after its bytes have been uploaded.",
11644
11894
  "screen.delete": "Delete an unattached captured page owned by this person."
@@ -11646,6 +11896,10 @@ const PROCEDURE_DESCRIPTIONS = {
11646
11896
 
11647
11897
  //#endregion
11648
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.";
11649
11903
  const OPTION_DESCRIPTIONS = {
11650
11904
  ...CANVAS_VERSION_OPTION_DESCRIPTIONS,
11651
11905
  "--canvas-ref": "Complete canvas, page or selection URL, or canvas UUID. Preserve the supplied scope.",
@@ -11665,7 +11919,7 @@ const OPTION_DESCRIPTIONS = {
11665
11919
  "operation.status --operation": "Exact durable operation reference returned by a prior call, including its kind and identity fields.",
11666
11920
  "operation.status --include-image": "Include available render image evidence when true; this does not start another render.",
11667
11921
  "operation.status --offset": "Zero-based entry offset; continue using nextOffset until the result reports complete.",
11668
- "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}`,
11669
11923
  "--canvas-id": "Canvas id, from `enhance canvas list`.",
11670
11924
  "--mutation-id": "Client-minted UUID identifying this atomic canvas mutation.",
11671
11925
  "--organisation-id": "Team id, from `enhance organisation list`.",
@@ -11708,6 +11962,14 @@ const OPTION_DESCRIPTIONS = {
11708
11962
  "--route": "Original page route retained with the captured screen.",
11709
11963
  "--page-title": "Page title retained with the capture or used for a new canvas.",
11710
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}`,
11711
11973
  "--email": "Email address of the person to invite or add.",
11712
11974
  "--body": "Comment text; use the JSON input for content that is difficult to quote.",
11713
11975
  "--source-url": "Original page URL associated with the capture or recording.",
@@ -11751,6 +12013,9 @@ const OPTION_DESCRIPTIONS = {
11751
12013
  "auth login --token": "Existing agent token for CI or headless fallback; omit it to authenticate in a browser.",
11752
12014
  "canvas.create --organisation-id": "Team UUID from `enhance organisation list`; omit it to create on the personal shelf.",
11753
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.",
11754
12019
  "canvas.duplicate --organisation-id": "Destination team UUID from `enhance organisation list`, or the literal `personal`.",
11755
12020
  "canvas.deletePermanently --confirmation": "Exact canvas title returned by `enhance canvas list --deleted true`.",
11756
12021
  "canvas.textStyleLibrary.list --search": "Match published library titles in your teams and files shared with you.",
@@ -11787,13 +12052,16 @@ const OPTION_DESCRIPTIONS = {
11787
12052
  "recording.start --page-title": "Required captured page title, or the literal null.",
11788
12053
  "recording.appendChunk --etag": "ETag from the already-uploaded chunk at --index; omit only when abandoning that range.",
11789
12054
  "recording.appendAudioChunk --etag": "ETag from the already-uploaded audio chunk at --index; omit only when abandoning it.",
11790
- "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.",
11791
12058
  "recordingAsset.confirm --arrived": "One or more JSON objects shaped `{\"url\":\"https://…\",\"etag\":\"…\",\"byteSize\":123}`.",
11792
12059
  "screen.create --client-token": "Client-minted capture UUID; reuse it when retrying the same screen reservation.",
11793
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.",
11794
12061
  "screen.create --provenance": "Required origin JSON `{\"sourceRecordingId\":\"UUID\",\"atMs\":0}`, or the literal null.",
11795
12062
  "screen.create --route": "Required original page route, or the literal null.",
11796
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.",
11797
12065
  "fixture recording --source-url": "Required original page URL represented by this recording."
11798
12066
  };
11799
12067
 
@@ -11812,7 +12080,7 @@ const ordered = (value) => {
11812
12080
  return Object.fromEntries(Object.entries(record).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, held]) => [key, ordered(held)]));
11813
12081
  };
11814
12082
  const digest = (value) => createHash("sha256").update(JSON.stringify(ordered(value))).digest("hex");
11815
- const kebab = (value) => value.replaceAll(/[A-Z]/gu, (letter) => `-${letter.toLowerCase()}`);
12083
+ const toKebabCase = (value) => value.replaceAll(/[A-Z]/gu, (letter) => `-${letter.toLowerCase()}`);
11816
12084
  const fieldsFrom = (schemaValue, procedure, direction) => {
11817
12085
  const schema = recordFrom$2(schemaValue);
11818
12086
  const properties = recordFrom$2(schema?.["properties"]);
@@ -11820,7 +12088,7 @@ const fieldsFrom = (schemaValue, procedure, direction) => {
11820
12088
  const required = new Set(Array.isArray(schema?.["required"]) ? schema["required"] : []);
11821
12089
  return Object.entries(properties).map(([name, property]) => {
11822
12090
  const detail = recordFrom$2(property);
11823
- const option = `--${kebab(name)}`;
12091
+ const option = `--${toKebabCase(name)}`;
11824
12092
  const meaning = direction === "input" ? OPTION_DESCRIPTIONS[`${procedure} ${option}`] ?? OPTION_DESCRIPTIONS[option] : void 0;
11825
12093
  return {
11826
12094
  name,
@@ -11967,6 +12235,15 @@ const CANVAS_RECOVERY_POLICIES = {
11967
12235
  "canvas.chats.delete": CHAT_HISTORY_POLICY
11968
12236
  };
11969
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
+
11970
12247
  //#endregion
11971
12248
  //#region src/infrastructure/capability-policy.consts.ts
11972
12249
  const FONT_ASSET_POLICY = {
@@ -12065,6 +12342,7 @@ const PROCEDURE_CAPABILITY_POLICIES = {
12065
12342
  },
12066
12343
  ...CANVAS_RECOVERY_POLICIES,
12067
12344
  "canvas.chats.publish": CHAT_HISTORY_POLICY,
12345
+ "canvas.copyFromWork": RECOVERY_COPY_POLICY,
12068
12346
  "canvas.applyOperations": {
12069
12347
  exposure: "internal",
12070
12348
  reason: "Wrapped by bounded, intention-revealing authoring capabilities.",
@@ -12217,6 +12495,7 @@ const PROCEDURE_CAPABILITY_POLICIES = {
12217
12495
  //#endregion
12218
12496
  //#region src/infrastructure/shared-capability-procedure.consts.ts
12219
12497
  const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
12498
+ "canvas.copyWalkthroughs",
12220
12499
  "canvas.create",
12221
12500
  "canvas.createEditableFrame",
12222
12501
  "canvas.delete",
@@ -12757,7 +13036,8 @@ const PROCEDURES_WITHOUT_GENERIC_RECEIPTS = /* @__PURE__ */ new Set([
12757
13036
  "canvas.render.create",
12758
13037
  "canvas.render.importSource",
12759
13038
  "canvas.render.preparation.create",
12760
- "screen.create"
13039
+ "screen.create",
13040
+ "canvas.copyFromWork"
12761
13041
  ]);
12762
13042
  const outcomeFrom = (result) => {
12763
13043
  if (result.ok) return {
@@ -12858,7 +13138,8 @@ const timed = trpcMiddleware(async ({ ctx, path, type, next }) => {
12858
13138
  outcome: await next(),
12859
13139
  statements: span.statements,
12860
13140
  blobAttempts: span.blobAttempts,
12861
- degraded: span.degraded
13141
+ degraded: span.degraded,
13142
+ layerRows: span.layerRows
12862
13143
  }));
12863
13144
  const failure = call.outcome.ok ? null : failureOf(call.outcome.error);
12864
13145
  const line = {
@@ -12868,6 +13149,8 @@ const timed = trpcMiddleware(async ({ ctx, path, type, next }) => {
12868
13149
  kind: type,
12869
13150
  durationMs: Math.round(performance.now() - startedAt),
12870
13151
  queryCount: call.statements.length,
13152
+ layerRowsRead: call.layerRows.read,
13153
+ layerRowsWritten: call.layerRows.written,
12871
13154
  blobCallCount: call.blobAttempts.length,
12872
13155
  blobRetryCount: call.blobAttempts.reduce((total, made) => total + made.attempts - 1, 0),
12873
13156
  degraded: call.degraded.toSorted((a, b) => a.localeCompare(b)).join(","),
@@ -12959,7 +13242,7 @@ const withAccess = trpcMiddleware(async ({ ctx, getRawInput, next }) => {
12959
13242
  })).match((snapshot) => snapshot, (error) => {
12960
13243
  throw toTrpcError(error);
12961
13244
  });
12962
- 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"));
12963
13246
  ctx.tag("canvasId", scope.data.canvasId);
12964
13247
  return next({ ctx: {
12965
13248
  ...ctx,
@@ -13053,22 +13336,21 @@ const toCanvasActorColour = (identity) => {
13053
13336
  for (const character of identity) hash = hash * HASH_RADIX + (character.codePointAt(0) ?? 0) >>> 0;
13054
13337
  return COLOURS[hash % COLOURS.length] ?? "blue";
13055
13338
  };
13056
- const toCanvasMutationActor = (viewer) => {
13057
- const common = {
13058
- personId: viewer.personId,
13059
- displayName: viewer.displayName,
13060
- initials: viewer.initials,
13061
- colour: toCanvasActorColour(viewer.kind === "agent" ? viewer.tokenId : viewer.personId)
13062
- };
13063
- return viewer.kind === "agent" ? {
13064
- ...common,
13065
- kind: "agent",
13066
- tokenLabel: viewer.tokenLabel,
13067
- ...viewer.agentAttribution !== void 0 && { agentAttribution: viewer.agentAttribution }
13068
- } : {
13069
- ...common,
13070
- kind: "person"
13071
- };
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"
13072
13354
  };
13073
13355
  const toAgentCanvasRequestActor = (viewer) => viewer.kind === "agent" ? {
13074
13356
  personId: viewer.personId,
@@ -13107,7 +13389,8 @@ const toCanvasContract = (view) => ({
13107
13389
  grants: [...view.reach.grants],
13108
13390
  grantableAccessLevels: [...view.reach.grantableAccessLevels],
13109
13391
  share: view.reach.canShare,
13110
- manage: view.reach.canManage
13392
+ manage: view.reach.canManage,
13393
+ readHistory: view.reach.canSeeRoutes
13111
13394
  },
13112
13395
  createdAt: view.canvas.createdAt.toISOString(),
13113
13396
  lastActivityAt: view.canvas.lastActivityAt.toISOString()
@@ -13880,12 +14163,20 @@ const createCanvasChatRouter = (handlers) => trpcRouter({
13880
14163
  * always the creator, so tightening it breaks re-recording onto somebody else's canvas —
13881
14164
  * while widening it lets a `can-view` reviewer rearrange one.
13882
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
+ });
13883
14173
  const getDocument = (handlers) => canvasReaderProcedure.input(getCanvasDocumentInputSchema).output(getCanvasDocumentOutputSchema).query(async ({ input, ctx }) => {
13884
14174
  const result = orThrow(await handlers.getDocument.execute({
13885
14175
  canvasId: input.canvasId,
13886
14176
  afterVersion: input.afterVersion,
13887
14177
  withRoutes: ctx.canvasAccess.canSeeRoutes
13888
14178
  }));
14179
+ if (result.unreadable !== void 0) ctx.logger.error(unreadableBatchLine(input.canvasId, result.unreadable), "event");
13889
14180
  return {
13890
14181
  ...result.mutations !== void 0 && { mutations: result.mutations.map((commit) => ({
13891
14182
  mutationId: commit.mutationId,
@@ -13893,9 +14184,9 @@ const getDocument = (handlers) => canvasReaderProcedure.input(getCanvasDocumentI
13893
14184
  version: commit.version,
13894
14185
  operations: commit.operations.map((operation) => canvasOperationSchema.parse(operation))
13895
14186
  })) },
13896
- version: result.document.version,
13897
- ...(result.document.restoreFenceVersion ?? 0) > 0 && { restoreFenceVersion: result.document.restoreFenceVersion },
13898
- document: result.document.document,
14187
+ version: result.version,
14188
+ ...result.restoreFenceVersion > 0 && { restoreFenceVersion: result.restoreFenceVersion },
14189
+ ...result.document !== void 0 && { document: result.document },
13899
14190
  screens: result.screens.map((screen) => ({
13900
14191
  screenId: screen.screenId,
13901
14192
  clientToken: screen.clientToken,
@@ -14282,6 +14573,18 @@ const remove$1 = (handlers) => personProcedure.input(deleteCanvasInputSchema).ou
14282
14573
  deletedAt: result.deletedAt.toISOString()
14283
14574
  };
14284
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
+ });
14285
14588
  const createCanvasLifecycleRouter = (handlers) => trpcRouter({
14286
14589
  delete: remove$1(handlers),
14287
14590
  move: canvasOwnerProcedure.input(moveCanvasInputSchema).output(moveCanvasOutputSchema).mutation(async ({ input, ctx }) => ({ canvas: toCanvasContract(orThrow(await handlers.move.execute({
@@ -14294,6 +14597,7 @@ const createCanvasLifecycleRouter = (handlers) => trpcRouter({
14294
14597
  organisationId: input.organisationId === "personal" ? null : input.organisationId,
14295
14598
  personId: ctx.viewer.personId
14296
14599
  }))) })),
14600
+ copyFromWork: copyFromWork(handlers),
14297
14601
  deletePermanently: personProcedure.input(permanentlyDeleteCanvasInputSchema).output(permanentlyDeleteCanvasOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.removePermanently.execute({
14298
14602
  ...input,
14299
14603
  personId: ctx.viewer.personId
@@ -14645,18 +14949,22 @@ const createCanvasSelectionRoute = (selection, readCanvas) => agentCanvasReaderP
14645
14949
 
14646
14950
  //#endregion
14647
14951
  //#region ../api/src/canvas/infrastructure/canvas-thumbnail.router.ts
14648
- 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
+ }));
14649
14957
  ctx.logger.warn({
14650
14958
  event: "ThumbnailBlobUnavailable",
14651
14959
  canvasId: input.canvasId,
14652
14960
  blobId: input.thumbnailId,
14653
14961
  clientReleaseIdentity: input.clientReleaseIdentity,
14654
14962
  attemptedOperation: input.attemptedOperation,
14655
- recoveryOutcome: input.recoveryOutcome
14963
+ recoveryOutcome: input.recoveryOutcome,
14964
+ storageOutcome: found
14656
14965
  }, "event");
14657
14966
  return { recorded: true };
14658
- });
14659
- const createCanvasThumbnailRouter = () => trpcRouter({ reportUnavailable });
14967
+ }) });
14660
14968
 
14661
14969
  //#endregion
14662
14970
  //#region ../api/src/canvas/infrastructure/canvas-version-contract.mapper.ts
@@ -14803,6 +15111,16 @@ const createCanvasVersionRouter = (handlers) => trpcRouter({
14803
15111
  duplicate: duplicate(handlers)
14804
15112
  });
14805
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
+
14806
15124
  //#endregion
14807
15125
  //#region ../api/src/canvas/infrastructure/capture-run.router.ts
14808
15126
  const actorOf$1 = (viewer) => {
@@ -14889,6 +15207,28 @@ const createFontCatalogRouter = ({ fontCatalog }) => trpcRouter({
14889
15207
  })
14890
15208
  });
14891
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
+
14892
15232
  //#endregion
14893
15233
  //#region ../api/src/canvas/domain/render-result.value-object.ts
14894
15234
  const isRenderConversionResult = (result) => "rootNodeId" in result;
@@ -14896,6 +15236,18 @@ const isRenderOutputResult = (result) => "storageKey" in result;
14896
15236
 
14897
15237
  //#endregion
14898
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
+ });
14899
15251
  const wireResult = (job, result) => ({
14900
15252
  canvasId: job.canvasId,
14901
15253
  requestedVersion: job.requestedVersion,
@@ -15237,10 +15589,13 @@ const createExport = (handlers) => canvasPersonReaderProcedure.meta({ descriptio
15237
15589
  };
15238
15590
  });
15239
15591
  const requireExport = (job) => job.purpose === "export" ? job : orThrow((0, import_index_cjs.err)(appError("NOT_FOUND", "no such export")));
15240
- const getExport = (handlers) => personProcedure.input(getCanvasRenderInputSchema).output(getCanvasRenderOutputSchema).query(async ({ input, ctx }) => {
15241
- 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({
15242
15595
  jobId: input.jobId,
15243
- actor: personActorOf(ctx.viewer)
15596
+ actor: personActorOf(ctx.viewer),
15597
+ waitMs: input.waitMs ?? 0,
15598
+ signal
15244
15599
  }));
15245
15600
  return { job: presentRender(requireExport(job)) };
15246
15601
  });
@@ -15291,7 +15646,7 @@ const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderPr
15291
15646
  ...base,
15292
15647
  purpose: job.purpose,
15293
15648
  preparation: job.preparationRequest,
15294
- screens: job.screens?.map((screen) => toCanvasVersionContractScreen(screen)),
15649
+ ...toPreparationWorkExposure(job),
15295
15650
  scale: 1,
15296
15651
  format: "json"
15297
15652
  });
@@ -16002,20 +16357,13 @@ const toAgentPrototypePublisher = (viewer) => {
16002
16357
  displayName: viewer.displayName,
16003
16358
  initials: viewer.initials,
16004
16359
  tokenId: viewer.tokenId,
16005
- tokenLabel: viewer.tokenLabel
16360
+ tokenLabel: viewer.tokenLabel,
16361
+ ...viewer.agentAttribution !== void 0 && { agentAttribution: viewer.agentAttribution }
16006
16362
  }
16007
16363
  };
16008
16364
  };
16009
16365
  const toPrototypePublisher = (viewer) => {
16010
- return {
16011
- personId: viewer.personId,
16012
- ...viewer.kind === "agent" && { publisher: {
16013
- displayName: viewer.displayName,
16014
- initials: viewer.initials,
16015
- tokenId: viewer.tokenId,
16016
- tokenLabel: viewer.tokenLabel
16017
- } }
16018
- };
16366
+ return viewer.kind === "agent" ? toAgentPrototypePublisher(viewer) : { personId: viewer.personId };
16019
16367
  };
16020
16368
 
16021
16369
  //#endregion
@@ -16364,7 +16712,8 @@ const createRecordingRouter = (handlers) => trpcRouter({
16364
16712
  viewport: recording.viewport,
16365
16713
  interrupted: recording.interrupted,
16366
16714
  chunkCount: recording.chunkCount,
16367
- startedAt: recording.startedAt.toISOString()
16715
+ startedAt: recording.startedAt.toISOString(),
16716
+ isCopy: recording.isCopy
16368
16717
  })),
16369
16718
  truncated: false,
16370
16719
  unreadableCount
@@ -16384,6 +16733,18 @@ const onWire$1 = (upload) => ({
16384
16733
  expiresAt: upload.expiresAt.toISOString(),
16385
16734
  headers: upload.headers
16386
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
+ };
16387
16748
  /**
16388
16749
  * Somewhere to put the files the recorded page loaded — its fonts, its images, the stylesheets
16389
16750
  * rrweb could not read. The extension fetches them, because it holds the user's cookies and its
@@ -16394,9 +16755,9 @@ const reserveAssets = (handlers) => personProcedure.input(reserveAssetsInputSche
16394
16755
  ...input,
16395
16756
  ownerPersonId: ctx.viewer.personId
16396
16757
  }));
16397
- ctx.tag("recordingId", input.recordingId);
16758
+ tagTarget(ctx, input);
16398
16759
  ctx.telemetry.emit("RecordingAssetsReserved", {
16399
- recordingId: input.recordingId,
16760
+ ...targetOf(input),
16400
16761
  assetCount: input.assets.length
16401
16762
  });
16402
16763
  return { reserved: result.reserved.map((entry) => ({
@@ -16410,9 +16771,9 @@ const confirmAssets = (handlers) => personProcedure.input(confirmAssetsInputSche
16410
16771
  ...input,
16411
16772
  ownerPersonId: ctx.viewer.personId
16412
16773
  }));
16413
- ctx.tag("recordingId", input.recordingId);
16774
+ tagTarget(ctx, input);
16414
16775
  ctx.telemetry.emit("RecordingAssetsConfirmed", {
16415
- recordingId: input.recordingId,
16776
+ ...targetOf(input),
16416
16777
  assetCount: input.arrived.length,
16417
16778
  missingAssetCount: result.missingAssetCount
16418
16779
  });
@@ -16601,8 +16962,8 @@ const clientRenderFailureRoute = () => baseProcedure.input(clientRenderFailureIn
16601
16962
 
16602
16963
  //#endregion
16603
16964
  //#region ../api/src/shared/observability/client-save-telemetry.router.ts
16604
- /** A deployed release names itself by its image tag; `dev` or an instance label is not that. */
16605
- const isExactBuild = (build) => /^[0-9a-f]{12}$/u.test(build);
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);
16606
16967
  const eventPropertiesOf = (input, trace, apiBuild, environment) => ({
16607
16968
  schema_version: trace.schema,
16608
16969
  event_id: trace.eventId,
@@ -16798,6 +17159,7 @@ const canvasRouter = (handlers, options) => trpcRouter({
16798
17159
  ...createCanvasRouter(handlers.canvas)._def.record,
16799
17160
  ...createCanvasImageRouter(handlers.canvas)._def.record,
16800
17161
  ...createCanvasFontRouter(handlers.canvas)._def.record,
17162
+ ...createCanvasWalkthroughRouter(handlers.canvas)._def.record,
16801
17163
  fontCatalog: createFontCatalogRouter(handlers.canvas),
16802
17164
  textStyleLibrary: createTextStyleLibraryRouter(handlers.canvas),
16803
17165
  ...createCanvasLifecycleRouter(handlers.canvas)._def.record,
@@ -16812,7 +17174,7 @@ const canvasRouter = (handlers, options) => trpcRouter({
16812
17174
  ...createRenderExposureRouter(handlers.render)._def.record,
16813
17175
  ...createRenderExportRouter(handlers.render)._def.record
16814
17176
  }),
16815
- thumbnail: createCanvasThumbnailRouter(),
17177
+ thumbnail: createCanvasThumbnailRouter(handlers.canvas),
16816
17178
  participants: createCanvasParticipantRouter(handlers.canvas),
16817
17179
  invites: createCanvasInviteRouter(handlers.canvas, options.shouldExposeInviteTokens)
16818
17180
  });
@@ -16896,6 +17258,7 @@ const handlers = {
16896
17258
  undo: unavailable.execute,
16897
17259
  receipt: unavailable.execute
16898
17260
  },
17261
+ thumbnailReports: { reportUnavailable: unavailable.execute },
16899
17262
  chats: {
16900
17263
  publish: unavailable.execute,
16901
17264
  list: unavailable.execute,
@@ -16914,6 +17277,8 @@ const handlers = {
16914
17277
  remove: unavailable,
16915
17278
  move: unavailable,
16916
17279
  duplicate: unavailable,
17280
+ copyFromWork: unavailable,
17281
+ copyWalkthroughs: unavailable,
16917
17282
  removePermanently: unavailable,
16918
17283
  markViewed: unavailable,
16919
17284
  firstAgentWork: unavailable,
@@ -17040,6 +17405,7 @@ const handlers = {
17040
17405
  render: {
17041
17406
  create: unavailable,
17042
17407
  get: unavailable,
17408
+ awaitSettled: unavailable,
17043
17409
  cancel: unavailable,
17044
17410
  download: unavailable,
17045
17411
  expose: unavailable,
@@ -17215,7 +17581,7 @@ const createCapabilityCatalogAdapter = () => {
17215
17581
  outputSchema: schemas.output,
17216
17582
  meta: parsed.meta,
17217
17583
  policy: procedurePolicy,
17218
- cliPath: procedurePolicy.exposure === "shared" ? id.replaceAll(".", " ") : null,
17584
+ cliPath: procedurePolicy.exposure === "shared" ? id.split(".").map((part) => toKebabCase(part)).join(" ") : null,
17219
17585
  ...ROUTER_INPUT_EXAMPLES[id] !== void 0 && { inputExample: ROUTER_INPUT_EXAMPLES[id] }
17220
17586
  });
17221
17587
  });
@@ -17254,6 +17620,156 @@ var ProcessExitError = class extends FailedToExitError {
17254
17620
  }
17255
17621
  };
17256
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
+
17257
17773
  //#endregion
17258
17774
  //#region src/infrastructure/mcp-capability-discovery.adapter.ts
17259
17775
  const NO_MATCH_SCORE = 0;
@@ -17384,123 +17900,6 @@ const createMcpCapabilityDiscoveryAdapter = (catalog) => ({
17384
17900
  const toPresentedCapabilities = (catalog, exposures) => catalog.filter((capability) => exposures.includes(capability.policy.exposure));
17385
17901
  const toSharedCapabilities = (catalog) => toPresentedCapabilities(catalog, ["shared"]);
17386
17902
 
17387
- //#endregion
17388
- //#region src/infrastructure/failure.mapper.ts
17389
- const MALFORMED_EXIT = 2;
17390
- const BAD_REQUEST_EXIT = 3;
17391
- const UNAUTHORIZED_EXIT = 4;
17392
- const REFUSED_EXIT = 5;
17393
- const PARTIAL_EXIT = 6;
17394
- const REFUSALS = /* @__PURE__ */ new Set([
17395
- "FORBIDDEN",
17396
- "NOT_FOUND",
17397
- "CONFLICT",
17398
- "RATE_LIMITED"
17399
- ]);
17400
- const remediationFor = (code) => {
17401
- switch (code) {
17402
- case "BAD_REQUEST": return "Run the command with '--help', then rewrite every rejected argument.";
17403
- case "UNAUTHORIZED": return "Run 'enhance auth login' and complete authentication in the browser.";
17404
- case "FORBIDDEN": return "Run 'enhance canvas list --scope mine' and choose a target you can change.";
17405
- case "NOT_FOUND": return "List the resource again and retry with an identifier from that result.";
17406
- case "CONFLICT": return "Read the resource again before retrying the change.";
17407
- case "RATE_LIMITED": return "Wait for the server retry window, then retry once.";
17408
- case "INTERNAL": return "Run 'enhance doctor', report the result, and stop.";
17409
- }
17410
- };
17411
- const SESSION_EXPIRED_REMEDIATION = `Your Enhance session expired. ${remediationFor("UNAUTHORIZED")}`;
17412
- /** What the shared classifier can say beyond the code, for the answers that carry more. */
17413
- const remediationOf = (error, status) => {
17414
- if (status === void 0) return remediationFor(error.code);
17415
- const outcome = requestOutcomeOf({
17416
- kind: "response",
17417
- status,
17418
- appError: error,
17419
- retryAfterMs: null
17420
- });
17421
- if (outcome.kind === "sign-in" && outcome.reason === "session-expired") return SESSION_EXPIRED_REMEDIATION;
17422
- if (error.code === "CONFLICT" && outcome.kind === "transient") return "Wait a few seconds, then retry the same command with the same clientToken.";
17423
- 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.";
17424
- return remediationFor(error.code);
17425
- };
17426
- const trpcErrorSchema = z.object({ data: z.looseObject({
17427
- appError: z.unknown(),
17428
- httpStatus: z.number().optional()
17429
- }) });
17430
- const appErrorFrom = (error) => {
17431
- const parsed = trpcErrorSchema.safeParse(error);
17432
- const appError = appErrorSchema.safeParse(parsed.success ? parsed.data.data.appError : null);
17433
- if (!appError.success) return null;
17434
- return {
17435
- appError: appError.data,
17436
- remediation: remediationOf(appError.data, parsed.data?.data.httpStatus)
17437
- };
17438
- };
17439
- const toRemoteError = (error) => {
17440
- if (!(error instanceof TRPCClientError)) return error;
17441
- if (error.cause instanceof CliError) return error.cause;
17442
- const parsed = appErrorFrom(error);
17443
- if (parsed === null) return error;
17444
- return new CliError(parsed.appError.code, parsed.appError.message, parsed.remediation, parsed.appError.fields);
17445
- };
17446
- const failureFields = (fields) => fields === void 0 ? {} : { fields: Object.entries(fields).toSorted(([left], [right]) => left.localeCompare(right)).map(([path, message]) => ({
17447
- path,
17448
- message
17449
- })) };
17450
- const toFailurePayload = (error, parserMessage) => {
17451
- if (error instanceof CliError) return {
17452
- code: error.code,
17453
- message: error.message,
17454
- remediation: error.remediation,
17455
- ...failureFields(error.fields)
17456
- };
17457
- if (error instanceof TRPCClientError) {
17458
- if (error.cause instanceof CliError) return toFailurePayload(error.cause, parserMessage);
17459
- const parsed = appErrorFrom(error);
17460
- if (parsed !== null) return {
17461
- code: parsed.appError.code,
17462
- message: parsed.appError.message,
17463
- remediation: parsed.remediation,
17464
- ...failureFields(parsed.appError.fields)
17465
- };
17466
- }
17467
- if (error instanceof ProcessExitError) {
17468
- const message = parserMessage?.trim();
17469
- return {
17470
- code: "BAD_REQUEST",
17471
- message: message === void 0 || message === "" ? "The command line is malformed." : message,
17472
- remediation: "Run 'enhance --help' and use one of the complete command paths shown there."
17473
- };
17474
- }
17475
- return {
17476
- code: "INTERNAL",
17477
- message: "The request failed before it received a usable result.",
17478
- remediation: "Run 'enhance doctor', report the result, and stop."
17479
- };
17480
- };
17481
- const toMcpFailurePayload = (error) => {
17482
- const failure = toFailurePayload(error, null);
17483
- if (failure.remediation !== remediationFor(failure.code) && failure.remediation !== SESSION_EXPIRED_REMEDIATION) return failure;
17484
- const remediation = {
17485
- BAD_REQUEST: "Review this tool’s input schema and correct the reported argument errors.",
17486
- UNAUTHORIZED: "Reconnect Enhance through this host’s connection flow, then repeat the request.",
17487
- FORBIDDEN: "Choose a canvas you can access. Do not repeat this write against the denied canvas.",
17488
- 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."
17489
- };
17490
- return {
17491
- ...failure,
17492
- remediation: remediation[failure.code] ?? failure.remediation
17493
- };
17494
- };
17495
- const toExitCode = (failure, isMalformed, error) => {
17496
- if (isMalformed) return MALFORMED_EXIT;
17497
- if (error instanceof PartialBatchError) return PARTIAL_EXIT;
17498
- if (failure.code === "BAD_REQUEST") return BAD_REQUEST_EXIT;
17499
- if (failure.code === "UNAUTHORIZED") return UNAUTHORIZED_EXIT;
17500
- if (REFUSALS.has(failure.code)) return REFUSED_EXIT;
17501
- return 1;
17502
- };
17503
-
17504
17903
  //#endregion
17505
17904
  //#region src/infrastructure/canvas-authoring-result.mapper.ts
17506
17905
  const MAX_RECEIPT_BYTES = 4096;
@@ -17628,4 +18027,4 @@ const withCommandInFailure = (value, commandName) => ({
17628
18027
  });
17629
18028
 
17630
18029
  //#endregion
17631
- 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 };