@enhance-eng/enhance 0.1.160 → 0.1.161

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.
@@ -2378,14 +2378,26 @@ const canvasSubtreeDraftSchema = z.object({
2378
2378
  nodeCount: draft.nodes.length
2379
2379
  }
2380
2380
  }));
2381
- const createEditableFrameInputSchema = z.object({
2381
+ /** A capture that lands as a new editable frame on a page, with no screen layer. */
2382
+ const editableFrameCaptureSchema = z.object({
2383
+ screenId: z.string().min(1),
2384
+ pageId: z.string().min(1)
2385
+ });
2386
+ const editableFrameInputBase = {
2382
2387
  canvasId: z.uuid(),
2383
2388
  documentFormatVersion: canvasDocumentFormatSchema,
2384
2389
  mutationId: z.uuid(),
2385
2390
  baseVersion: z.number().int().positive(),
2386
- screenNodeId: z.string().min(1),
2387
2391
  draft: canvasSubtreeDraftSchema
2388
- });
2392
+ };
2393
+ /** An editable frame comes from exactly one screen layer or one capture, never both. */
2394
+ const createEditableFrameInputSchema = z.union([z.strictObject({
2395
+ ...editableFrameInputBase,
2396
+ screenNodeId: z.string().min(1).describe("The screen layer to convert beside itself.")
2397
+ }), z.strictObject({
2398
+ ...editableFrameInputBase,
2399
+ capture: editableFrameCaptureSchema.describe("The stored page a new capture lands from, and the page its frame goes on.")
2400
+ })]);
2389
2401
  const createEditableFrameResultSchema = z.object({
2390
2402
  canvasId: z.uuid(),
2391
2403
  mutationId: z.uuid(),
@@ -2492,7 +2504,10 @@ const canvasRenderSnapshotResultSchema = z.object({
2492
2504
  recordingId: z.uuid(),
2493
2505
  atMs: z.number().int().nonnegative(),
2494
2506
  screenId: z.uuid(),
2495
- screenNodeId: z.string().min(1),
2507
+ /** Null when the snapshot asked for a place only, so no screen layer was added. */
2508
+ screenNodeId: z.string().min(1).nullable(),
2509
+ /** The page the place is on. */
2510
+ pageId: z.string().min(1).optional(),
2496
2511
  viewport: z.object({
2497
2512
  width: z.number().int().positive(),
2498
2513
  height: z.number().int().positive()
@@ -2661,7 +2676,11 @@ const canvasSnapshotRequestSchema = z.strictObject({
2661
2676
  pageId: z.string().min(1).optional(),
2662
2677
  nodeIds: z.array(z.string().min(1))
2663
2678
  }),
2664
- placement: z.strictObject({ kind: z.literal("below-source") })
2679
+ /**
2680
+ * Below the walkthrough: as a screen layer, which installed CLIs ask for, or as a place only,
2681
+ * where the agent's CLI lands an editable frame.
2682
+ */
2683
+ placement: z.strictObject({ kind: z.enum(["below-source", "editable-below-source"]) })
2665
2684
  });
2666
2685
  const createRecordingSnapshotInputSchema = z.object({
2667
2686
  canvasId: z.uuid(),
@@ -2933,6 +2952,21 @@ const canvasTextStylesSchema = z.strictObject({
2933
2952
  "text-align": textStyleValues["text-align"].optional(),
2934
2953
  "white-space": textStyleValues["white-space"].optional()
2935
2954
  });
2955
+ /** Every alignment a browser computes, which conversion stores and Undo must be able to put back. */
2956
+ const storedTextAlignSchema = z.enum([
2957
+ "start",
2958
+ "end",
2959
+ "left",
2960
+ "right",
2961
+ "center",
2962
+ "justify",
2963
+ "justify-all",
2964
+ "match-parent",
2965
+ "-webkit-left",
2966
+ "-webkit-right",
2967
+ "-webkit-center"
2968
+ ]);
2969
+ const storedFontStyleSchema = z.union([textStyleValues["font-style"], z.string().regex(/^oblique -?(?:\d+(?:\.\d+)?|\.\d+)deg$/u)]);
2936
2970
  const restorableTextStyleValue = z.union([canvasAdditionalStyleSchema.shape.value, canvasNumberSchema]).nullable().optional();
2937
2971
  const canvasTextStylePatchSchema = z.strictObject({
2938
2972
  "text-decoration": restorableTextStyleValue,
@@ -2955,7 +2989,7 @@ const canvasTextStylePatchSchema = z.strictObject({
2955
2989
  "text-box": canvasAdditionalStyleSchema.shape.value.nullable().optional(),
2956
2990
  "text-box-trim": canvasAdditionalStyleSchema.shape.value.nullable().optional(),
2957
2991
  "text-box-edge": canvasAdditionalStyleSchema.shape.value.nullable().optional(),
2958
- "font-style": textStyleValues["font-style"].nullable().optional(),
2992
+ "font-style": storedFontStyleSchema.nullable().optional(),
2959
2993
  "font-stretch": z.union([z.enum([
2960
2994
  "normal",
2961
2995
  "ultra-condensed",
@@ -2973,14 +3007,22 @@ const canvasTextStylePatchSchema = z.strictObject({
2973
3007
  z.literal("normal")
2974
3008
  ]).nullable().optional(),
2975
3009
  "line-height": textStyleValues["line-height"].nullable().optional(),
2976
- "text-align": textStyleValues["text-align"].nullable().optional(),
3010
+ "text-align": storedTextAlignSchema.nullable().optional(),
2977
3011
  "text-indent": z.union([canvasNumberSchema, signedPixelLengthSchema]).nullable().optional(),
2978
3012
  "white-space": textStyleValues["white-space"].nullable().optional(),
2979
3013
  "word-spacing": z.union([
2980
3014
  canvasNumberSchema,
2981
3015
  signedPixelLengthSchema,
2982
3016
  z.literal("normal")
2983
- ]).nullable().optional()
3017
+ ]).nullable().optional(),
3018
+ direction: restorableTextStyleValue,
3019
+ "unicode-bidi": restorableTextStyleValue,
3020
+ "hanging-punctuation": restorableTextStyleValue,
3021
+ "text-transform": restorableTextStyleValue,
3022
+ "-webkit-text-stroke": restorableTextStyleValue,
3023
+ "-webkit-text-stroke-width": restorableTextStyleValue,
3024
+ "-webkit-text-stroke-color": restorableTextStyleValue,
3025
+ "paint-order": restorableTextStyleValue
2984
3026
  });
2985
3027
  const overflowStyleValue = canvasAdditionalStyleSchema.shape.value;
2986
3028
  const dimensionalStyleValue = z.union([z.string(), canvasNumberSchema]);
@@ -8194,6 +8236,11 @@ const prototypeBridgeConnectedSchema = z$1.extend(prototypeBridgeConnectRequestS
8194
8236
  capabilities: z$1.array(z$1.string()),
8195
8237
  release: z$1.string().check(z$1.minLength(1))
8196
8238
  });
8239
+ /**
8240
+ * The input script's answer to a connect request when the page's own Content Security Policy
8241
+ * refused the capture script, which therefore can never answer it.
8242
+ */
8243
+ const prototypeBridgeCaptureBlockedSchema = z$1.extend(prototypeBridgeConnectRequestSchema, { type: z$1.literal("enhance.prototype.capture-blocked") });
8197
8244
  const prototypeBridgeUnloadingSchema = z$1.object({
8198
8245
  protocol: z$1.literal(1),
8199
8246
  type: z$1.literal("enhance.prototype.unloading"),
@@ -8811,6 +8858,8 @@ const createScreenInputSchema = z.object({
8811
8858
  });
8812
8859
  const createScreenOutputSchema = z.object({
8813
8860
  screenId: z.uuid(),
8861
+ /** Where the screen's files are stored; a capture names its stored copies by it. */
8862
+ assetBundleId: z.uuid().nullable(),
8814
8863
  /** Re-issued on every call, because the usual reason for a retry is an expired presign. */
8815
8864
  upload: signedUploadSchema,
8816
8865
  alreadyExists: z.boolean(),
@@ -9120,6 +9169,7 @@ const clientRenderFailureDetailsSchema = z.strictObject({
9120
9169
  "clipboard-image-pending",
9121
9170
  "clipboard-image-unavailable",
9122
9171
  "edit-target-unsupported",
9172
+ "edit-result-invalid",
9123
9173
  "react-hook-order",
9124
9174
  "menu-rows-unsupported"
9125
9175
  ]),
@@ -9436,7 +9486,8 @@ const CANVAS_SAVE_ANALYTICS_STATES = [
9436
9486
  "delivered",
9437
9487
  "failed",
9438
9488
  "disabled",
9439
- "no-identity"
9489
+ "no-identity",
9490
+ "expired"
9440
9491
  ];
9441
9492
  const clientSaveIncidentOutputSchema = z.object({
9442
9493
  accepted: z.literal(true),
@@ -10878,50 +10929,6 @@ const CANVAS_CAPABILITY_SPECS = [
10878
10929
  }
10879
10930
  ];
10880
10931
 
10881
- //#endregion
10882
- //#region src/application/canvas-capture.schema.ts
10883
- const canvasCaptureCapabilityInputSchema = z.strictObject({
10884
- ...canvasRenderRequestSchema.pick({
10885
- canvasRef: true,
10886
- waitMs: true
10887
- }).shape,
10888
- baseVersion: z.number().int().positive(),
10889
- source: z.strictObject({
10890
- kind: z.literal("recording"),
10891
- recordingId: z.uuid(),
10892
- atMs: z.number().int().nonnegative()
10893
- }),
10894
- previewJobId: z.uuid().describe("The successful canvas_render job whose pixels you inspected at this exact recording time and canvas version."),
10895
- placement: canvasSnapshotRequestSchema.shape.placement
10896
- });
10897
- const canvasCaptureInputSchema = canvasCaptureCapabilityInputSchema.extend({ clientToken: z.uuid() });
10898
- const canvasCaptureOutputSchema = z.strictObject({
10899
- operation: z.strictObject({
10900
- kind: z.literal("canvas-render"),
10901
- canvasId: z.uuid(),
10902
- jobId: z.uuid()
10903
- }),
10904
- state: z.enum([
10905
- "queued",
10906
- "running",
10907
- "succeeded",
10908
- "failed",
10909
- "cancelled",
10910
- "expired"
10911
- ]),
10912
- requestedVersion: z.number().int().positive(),
10913
- source: canvasCaptureCapabilityInputSchema.shape.source,
10914
- attachment: z.enum([
10915
- "pending",
10916
- "committed",
10917
- "not_confirmed"
10918
- ]),
10919
- result: canvasRenderSnapshotResultSchema.nullable(),
10920
- failure: canvasRenderFailureSchema.nullable(),
10921
- warningCount: z.number().int().nonnegative(),
10922
- warnings: z.array(z.string())
10923
- });
10924
-
10925
10932
  //#endregion
10926
10933
  //#region src/application/canvas-receipt.schema.ts
10927
10934
  const nodeId = canvasSceneNodeSchema.shape.id;
@@ -11002,6 +11009,58 @@ const canvasPreparationStatusSchema = z.strictObject({
11002
11009
  });
11003
11010
  const canvasPreparationOutputSchema = z.union([canvasWriteReceiptSchema, canvasPreparationStatusSchema]).meta({ type: "object" });
11004
11011
 
11012
+ //#endregion
11013
+ //#region src/application/canvas-capture.schema.ts
11014
+ const canvasCaptureCapabilityInputSchema = z.strictObject({
11015
+ ...canvasRenderRequestSchema.pick({
11016
+ canvasRef: true,
11017
+ waitMs: true
11018
+ }).shape,
11019
+ baseVersion: z.number().int().positive(),
11020
+ source: z.strictObject({
11021
+ kind: z.literal("recording"),
11022
+ recordingId: z.uuid(),
11023
+ atMs: z.number().int().nonnegative()
11024
+ }),
11025
+ previewJobId: z.uuid().describe("The successful canvas_render job whose pixels you inspected at this exact recording time and canvas version."),
11026
+ placement: canvasSnapshotRequestSchema.shape.placement.describe("Use editable-below-source. below-source is kept for older clients and lands the same editable frame below the root-level recording on its page.")
11027
+ });
11028
+ const canvasCaptureInputSchema = canvasCaptureCapabilityInputSchema.extend({ clientToken: z.uuid() });
11029
+ const canvasCaptureOutputSchema = z.strictObject({
11030
+ operation: z.discriminatedUnion("kind", [
11031
+ z.strictObject({
11032
+ kind: z.literal("canvas-render"),
11033
+ canvasId: z.uuid(),
11034
+ jobId: z.uuid()
11035
+ }),
11036
+ canvasPreparationOperationSchema,
11037
+ canvasMutationReferenceSchema
11038
+ ]).describe("The step to follow with operation_status: the snapshot, the compile, or the saved frame."),
11039
+ state: z.enum([
11040
+ "queued",
11041
+ "running",
11042
+ "succeeded",
11043
+ "failed",
11044
+ "cancelled",
11045
+ "expired"
11046
+ ]),
11047
+ requestedVersion: z.number().int().positive(),
11048
+ source: canvasCaptureCapabilityInputSchema.shape.source,
11049
+ attachment: z.enum([
11050
+ "pending",
11051
+ "committed",
11052
+ "not_confirmed"
11053
+ ]),
11054
+ result: canvasRenderSnapshotResultSchema.nullable(),
11055
+ frame: z.strictObject({
11056
+ nodeId: canvasSceneNodeSchema.shape.id,
11057
+ version: z.number().int().positive()
11058
+ }).nullable().describe("The editable frame the capture saved, once attachment is committed; version is the canvas version for your next write."),
11059
+ failure: canvasRenderFailureSchema.nullable(),
11060
+ warningCount: z.number().int().nonnegative(),
11061
+ warnings: z.array(z.string())
11062
+ });
11063
+
11005
11064
  //#endregion
11006
11065
  //#region src/application/canvas-asset.schema.ts
11007
11066
  const canvasAssetOperationSchema = canvasAssetUploadIdentitySchema.extend({ kind: z.literal("canvas-asset") });
@@ -11202,8 +11261,15 @@ const CANVAS_CONVERSION_CAPABILITY_SPECS = [
11202
11261
  idempotency: "single",
11203
11262
  inputSchema: canvasCaptureCapabilityInputSchema,
11204
11263
  outputSchema: canvasCaptureOutputSchema,
11205
- summary: "Freeze an inspected recording moment into a durable screen on its source page, holding the observed canvas revision through attachment.",
11206
- procedures: ["canvas.render.snapshot", "canvas.render.get"],
11264
+ summary: "Land an inspected recording moment as an editable frame below its recording, saved as one change at the observed canvas revision.",
11265
+ procedures: [
11266
+ "canvas.mutation.get",
11267
+ "canvas.render.snapshot",
11268
+ "canvas.render.get",
11269
+ "canvas.render.preparation.create",
11270
+ "canvas.render.preparation.get",
11271
+ "canvas.applyOperations"
11272
+ ],
11207
11273
  inputExample: {
11208
11274
  canvasRef: CAPABILITY_UUID_EXAMPLE,
11209
11275
  baseVersion: 1,
@@ -11213,7 +11279,7 @@ const CANVAS_CONVERSION_CAPABILITY_SPECS = [
11213
11279
  atMs: 500
11214
11280
  },
11215
11281
  previewJobId: CAPABILITY_UUID_EXAMPLE,
11216
- placement: { kind: "below-source" },
11282
+ placement: { kind: "editable-below-source" },
11217
11283
  waitMs: 1500
11218
11284
  },
11219
11285
  outputExample: {
@@ -11231,6 +11297,7 @@ const CANVAS_CONVERSION_CAPABILITY_SPECS = [
11231
11297
  },
11232
11298
  attachment: "pending",
11233
11299
  result: null,
11300
+ frame: null,
11234
11301
  failure: null,
11235
11302
  warningCount: 0,
11236
11303
  warnings: []
@@ -11952,6 +12019,7 @@ const OPTION_DESCRIPTIONS = {
11952
12019
  "--message-id": "Comment message id returned by comment writes or `enhance comment list`.",
11953
12020
  "--node-id": "Stable node id returned by `enhance canvas tree`.",
11954
12021
  "--screen-node-id": "Root-level screen node id returned by `enhance canvas tree`.",
12022
+ "--capture": "JSON `{screenId, pageId}`: a stored captured page and the page for its frame.",
11955
12023
  "--job-id": "Render or conversion job id returned by its create command.",
11956
12024
  "--person-id": "Person id returned by the relevant people or participants list.",
11957
12025
  "--display-name": "Name to show for the current person in comments and collaboration surfaces.",
@@ -12931,8 +12999,10 @@ const credentialRefusedError = (reason) => appError("UNAUTHORIZED", REFUSED_CRED
12931
12999
 
12932
13000
  //#endregion
12933
13001
  //#region ../api/src/shared/trpc/instance.trpc.ts
12934
- /** Never the reason. That is on the `rpc` line, against the id the caller is holding. */
12935
- const OPAQUE = "something went wrong on our side; quote the correlation id";
13002
+ const OPAQUE_FAILURE = {
13003
+ code: "INTERNAL",
13004
+ message: "something went wrong on our side; quote the correlation id"
13005
+ };
12936
13006
  /** What a caller is told when their input failed validation. The detail is in `fields`. */
12937
13007
  const REJECTED = REQUEST_REJECTED;
12938
13008
  /** Structural, not `instanceof ZodError`, which breaks across two installed copies of zod. */
@@ -12986,10 +13056,7 @@ const fieldMessage = (issue) => {
12986
13056
  const fieldsOf$2 = ({ code, cause }) => {
12987
13057
  const parsed = issueList.safeParse(cause);
12988
13058
  if (!parsed.success) return null;
12989
- if (code !== "BAD_REQUEST") return {
12990
- code: "INTERNAL",
12991
- message: OPAQUE
12992
- };
13059
+ if (code !== "BAD_REQUEST") return OPAQUE_FAILURE;
12993
13060
  return {
12994
13061
  code: "BAD_REQUEST",
12995
13062
  message: REJECTED,
@@ -13015,11 +13082,8 @@ const fieldsOf$2 = ({ code, cause }) => {
13015
13082
  */
13016
13083
  const toWireAppError = (failure) => {
13017
13084
  const { cause } = failure;
13018
- if (!isAppError(cause)) return fieldsOf$2(failure);
13019
- if (cause.code === "INTERNAL") return {
13020
- code: "INTERNAL",
13021
- message: OPAQUE
13022
- };
13085
+ if (!isAppError(cause)) return fieldsOf$2(failure) ?? (failure.code === "INTERNAL_SERVER_ERROR" ? OPAQUE_FAILURE : null);
13086
+ if (cause.code === "INTERNAL") return OPAQUE_FAILURE;
13023
13087
  return {
13024
13088
  code: cause.code,
13025
13089
  message: cause.message,
@@ -13472,6 +13536,30 @@ const toCanvasSceneNodeContract = (node) => canvasSceneNodeSchema.parse({
13472
13536
  ...node.box !== void 0 && { box: { ...node.box } }
13473
13537
  });
13474
13538
 
13539
+ //#endregion
13540
+ //#region ../api/src/canvas/infrastructure/editable-frame-origin.mapper.ts
13541
+ /**
13542
+ * Where an editable frame comes from and where it goes: beside its screen layer, or, for a capture
13543
+ * that has no screen layer, onto its page at the box the draft gives.
13544
+ */
13545
+ const toEditableFrameOrigin = (input) => "screenNodeId" in input ? {
13546
+ destination: { kind: "adjacent" },
13547
+ source: {
13548
+ kind: "screen",
13549
+ nodeId: input.screenNodeId
13550
+ }
13551
+ } : {
13552
+ destination: {
13553
+ kind: "insert-children",
13554
+ targetNodeId: "root",
13555
+ pageId: input.capture.pageId
13556
+ },
13557
+ source: {
13558
+ kind: "captured-page",
13559
+ screenId: input.capture.screenId
13560
+ }
13561
+ };
13562
+
13475
13563
  //#endregion
13476
13564
  //#region ../api/src/canvas/infrastructure/canvas.router.ts
13477
13565
  const applyOperations = (handlers) => canvasEditorProcedure.input(applyCanvasOperationsInputSchema).output(applyCanvasOperationsOutputSchema).mutation(async ({ input, ctx }) => {
@@ -13495,11 +13583,7 @@ const applyOperations = (handlers) => canvasEditorProcedure.input(applyCanvasOpe
13495
13583
  const createEditableFrame = (handlers) => canvasEditorProcedure.meta({ description: "Atomically insert a validated editable frame subtree beside an existing screen." }).input(createEditableFrameInputSchema).output(createEditableFrameOutputSchema).mutation(async ({ input, ctx }) => {
13496
13584
  const created = orThrow(await handlers.createEditableFrame.execute({
13497
13585
  ...input,
13498
- destination: { kind: "adjacent" },
13499
- source: {
13500
- kind: "screen",
13501
- nodeId: input.screenNodeId
13502
- },
13586
+ ...toEditableFrameOrigin(input),
13503
13587
  personId: ctx.viewer.personId,
13504
13588
  actor: toCanvasMutationActor(ctx.viewer)
13505
13589
  }));
@@ -14789,18 +14873,30 @@ const toCanvasPreparationJob = (job) => {
14789
14873
  const actorOf$2 = (viewer) => toAgentCanvasRequestActor(viewer) ?? orThrow((0, import_index_cjs.err)(appError("UNAUTHORIZED", "this call needs an agent token")));
14790
14874
  const present = (job) => toCanvasPreparationJob(job) ?? orThrow((0, import_index_cjs.err)(appError("NOT_FOUND", "no such preparation")));
14791
14875
  const firstNodeId = (request) => {
14792
- if (request.kind === "compile-screens") return void 0;
14876
+ if (request.kind === "compile-screens") return "root";
14793
14877
  if (request.kind === "compile-html") return request.fragments[0]?.parentNodeId;
14794
14878
  if (request.kind === "duplicate") return request.nodeIds[0];
14795
14879
  const change = request.changes[0];
14796
14880
  if (change === void 0) return void 0;
14797
14881
  return "nodeIds" in change ? change.nodeIds[0] : change.nodeId;
14798
14882
  };
14883
+ /**
14884
+ * An agent compiles a stored page only when it captured that page on this canvas: each page is the
14885
+ * agent's own succeeded snapshot, so the compile reads nothing the agent could not read already.
14886
+ */
14887
+ const hasOwnCapturedPages = async (handlers, canvasId, request, actor) => {
14888
+ if (request.kind !== "compile-screens") return true;
14889
+ return (await Promise.all(request.sources.map(async ({ screenId }) => handlers.get.execute({
14890
+ jobId: screenId,
14891
+ actor
14892
+ })))).every((snapshot) => snapshot.isOk() && snapshot.value.purpose === "snapshot" && snapshot.value.canvasId === canvasId && snapshot.value.state === "succeeded");
14893
+ };
14799
14894
  const createCanvasPreparationRouter = (handlers) => trpcRouter({
14800
- create: agentCanvasEditorProcedure.meta({ description: "Prepare a typed canvas arrangement, duplicate or HTML compilation through the native renderer without committing it." }).input(createCanvasPreparationInputSchema).output(createCanvasPreparationOutputSchema).mutation(async ({ input, ctx }) => {
14895
+ create: agentCanvasEditorProcedure.meta({ description: "Prepare a typed canvas arrangement, duplicate, HTML compilation or captured-page compilation through the native renderer without committing it." }).input(createCanvasPreparationInputSchema).output(createCanvasPreparationOutputSchema).mutation(async ({ input, ctx }) => {
14801
14896
  const actor = actorOf$2(ctx.viewer);
14802
14897
  const nodeId = firstNodeId(input.request);
14803
14898
  if (nodeId === void 0) return orThrow((0, import_index_cjs.err)(appError("BAD_REQUEST", "preparation needs explicit objects")));
14899
+ if (!await hasOwnCapturedPages(handlers, input.canvasId, input.request, actor)) return orThrow((0, import_index_cjs.err)(appError("FORBIDDEN", "an agent compiles only a page it captured on this canvas")));
14804
14900
  const made = orThrow(await handlers.create.execute({
14805
14901
  canvasId: input.canvasId,
14806
14902
  expectedVersion: input.expectedVersion,
@@ -15250,6 +15346,12 @@ const EXPORT_ATTEMPT_DEADLINE_MINUTES = 30;
15250
15346
  /** A person's export of a tall or wide layer is banded, so it may run longer than other renders. */
15251
15347
  const RENDER_EXPORT_MAX_AGE_MS = EXPORT_MAX_AGE_MINUTES * MILLISECONDS_PER_MINUTE;
15252
15348
  const RENDER_EXPORT_ATTEMPT_DEADLINE_MS = EXPORT_ATTEMPT_DEADLINE_MINUTES * MILLISECONDS_PER_MINUTE;
15349
+ const THUMBNAIL_MAX_AGE_MINUTES = 60;
15350
+ /**
15351
+ * A release asks for its thumbnails in batches of 50, and a large canvas takes minutes on the
15352
+ * lane's few workers, so the last in line must outlast the whole batch ahead of it.
15353
+ */
15354
+ const RENDER_THUMBNAIL_MAX_AGE_MS = THUMBNAIL_MAX_AGE_MINUTES * MILLISECONDS_PER_MINUTE;
15253
15355
  const CAPTURE_COMPILE_ATTEMPT_DEADLINE_MINUTES = 2;
15254
15356
  /**
15255
15357
  * A screen compile of a capture run has two minutes of work. A page not editable by then lands as
@@ -16871,6 +16973,7 @@ const createScreenRouter = (handlers) => trpcRouter({
16871
16973
  });
16872
16974
  return {
16873
16975
  screenId: result.screen.id,
16976
+ assetBundleId: result.screen.assetBundleId,
16874
16977
  upload: {
16875
16978
  url: result.upload.url,
16876
16979
  expiresAt: result.upload.expiresAt.toISOString(),
@@ -17054,7 +17157,7 @@ const deliverCanvasSaveRecord = async (analytics, input, personId, build) => {
17054
17157
  properties: eventPropertiesOf(input, trace, build.apiBuild, build.environment),
17055
17158
  insertId: trace.eventId,
17056
17159
  occurredAt: new Date(trace.occurredAt)
17057
- })).unwrapOr(false) ? "delivered" : "failed";
17160
+ })).unwrapOr("failed");
17058
17161
  };
17059
17162
  const clientSaveTelemetryRoute = (deps) => baseProcedure.input(clientSaveIncidentInputSchema).output(clientSaveIncidentOutputSchema).mutation(async ({ input, ctx }) => {
17060
17163
  const { analytics, apiBuild, environment } = deps;
@@ -18064,4 +18167,4 @@ const withCommandInFailure = (value, commandName) => ({
18064
18167
  });
18065
18168
 
18066
18169
  //#endregion
18067
- 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 };
18170
+ export { canvasRenderBatchRequestSchema as $, wholeCanvasDocumentOutputSchema as $n, cliAuthConfigurationSchema as $t, operationStatusImageSchema as A, canvasRecordingPropsSchema as An, canvasAdditionalStyleSchema as Ar, hasCanvasReferenceScope as At, canvasArrangeInputSchema 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, canvasDuplicateInputSchema as H, IMAGE_KIND as Hn, PROTOTYPE_ARTIFACT_MANIFEST_PATH as Ht, canvasCaptureCapabilityInputSchema 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, canvasCaptureInputSchema 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, canvasCaptureOutputSchema 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, canvasPreparationOutputSchema as U, PAGE_KIND as Un, attachPrototypeArtifactOutputSchema as Ut, canvasDuplicateCapabilityInputSchema as V, GROUP_KIND as Vn, startRecordingOutputSchema as Vt, canvasWriteReceiptSchema 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, canvasArrangeCapabilityInputSchema as z, getCanvasPreparationOutputSchema as zn, completeRecordingOutputSchema as zt };