@enhance-eng/enhance 0.1.37 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cli-output-identity.lib-i4KnVAYs.mjs → cli-output-identity.lib-DgHRuXTI.mjs} +1325 -393
- package/dist/main.mjs +335 -388
- package/dist/{mcp-invocation.adapter-CBnzmPZl.mjs → mcp-invocation.adapter-CjZnnMCd.mjs} +18 -13
- package/dist/mcp-main.mjs +7 -7
- package/dist/{mcp-server.adapter-DC9gAePw.mjs → mcp-server.adapter-DOHJxL6l.mjs} +1 -1
- package/dist/mcp.mjs +2 -2
- package/dist/{mutation-key.adapter-Ck8nOqke.mjs → mutation-key.adapter-BWkNj5jp.mjs} +4060 -134
- package/dist/remote-mcp-main.mjs +5 -5
- package/package.json +5 -1
|
@@ -13,6 +13,352 @@ import { TRPCClientError } from "@trpc/client";
|
|
|
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
|
+
//#endregion
|
|
27
|
+
//#region ../../packages/canvas-format/src/canvas-format.consts.ts
|
|
28
|
+
/** Historical formats stay pinned; an ordinary writer always uses CANVAS_SCENE_VERSION. */
|
|
29
|
+
const LEGACY_CANVAS_FORMATS = {
|
|
30
|
+
unversioned: void 0,
|
|
31
|
+
v1: 1,
|
|
32
|
+
v2: 2,
|
|
33
|
+
v3: 3,
|
|
34
|
+
v4: 4,
|
|
35
|
+
v5: 5,
|
|
36
|
+
v6: 6,
|
|
37
|
+
v7: 7,
|
|
38
|
+
v8: 8,
|
|
39
|
+
v9: 9,
|
|
40
|
+
v10: 10,
|
|
41
|
+
v11: 11,
|
|
42
|
+
v12: 12
|
|
43
|
+
};
|
|
44
|
+
const LEGACY_CANVAS_ADAPTATIONS = {
|
|
45
|
+
[LEGACY_CANVAS_FORMATS.v1]: "layout",
|
|
46
|
+
[LEGACY_CANVAS_FORMATS.v2]: "layout",
|
|
47
|
+
[LEGACY_CANVAS_FORMATS.v3]: "typography",
|
|
48
|
+
[LEGACY_CANVAS_FORMATS.v4]: "typography",
|
|
49
|
+
[LEGACY_CANVAS_FORMATS.v5]: "typography",
|
|
50
|
+
[LEGACY_CANVAS_FORMATS.v6]: "geometry",
|
|
51
|
+
[LEGACY_CANVAS_FORMATS.v7]: "geometry",
|
|
52
|
+
[LEGACY_CANVAS_FORMATS.v8]: "geometry",
|
|
53
|
+
[LEGACY_CANVAS_FORMATS.v9]: "geometry",
|
|
54
|
+
[LEGACY_CANVAS_FORMATS.v10]: "geometry",
|
|
55
|
+
[LEGACY_CANVAS_FORMATS.v11]: "css",
|
|
56
|
+
[LEGACY_CANVAS_FORMATS.v12]: "text-shadow-blend"
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region ../../packages/canvas-format/src/canvas-css-adaptation.lib.ts
|
|
61
|
+
const isRecord$3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
62
|
+
const listOf = (value) => Array.isArray(value) ? value : void 0;
|
|
63
|
+
const without = (record, ...keys) => Object.fromEntries(Object.entries(record).filter(([key]) => !keys.includes(key)));
|
|
64
|
+
/** The one owner of a wrapped mask group's identity, shared by the format adapter and Figma paste. */
|
|
65
|
+
const canvasMaskWrapperId = (sourceId) => `${sourceId}~mask`;
|
|
66
|
+
const MASK_MODES = {
|
|
67
|
+
alpha: "alpha",
|
|
68
|
+
luminance: "luminance",
|
|
69
|
+
vector: "outline"
|
|
70
|
+
};
|
|
71
|
+
const maskModeOf = (node) => {
|
|
72
|
+
if (!isRecord$3(node) || !isRecord$3(node["compositing"])) return void 0;
|
|
73
|
+
const mask = node["compositing"]["mask"];
|
|
74
|
+
return typeof mask === "string" ? MASK_MODES[mask] : void 0;
|
|
75
|
+
};
|
|
76
|
+
const unblended = (paint) => isRecord$3(paint) ? without(paint, "blendMode", "blendSource") : paint;
|
|
77
|
+
/** An older border's alignment is a retired mode that never painted; absent means inside. */
|
|
78
|
+
const borderPaints = (stroke) => isRecord$3(stroke) && "paint" in stroke ? {
|
|
79
|
+
...without(stroke, "paint", "alignment"),
|
|
80
|
+
paints: [stroke["paint"]]
|
|
81
|
+
} : stroke;
|
|
82
|
+
const uniformBlur = (filter) => {
|
|
83
|
+
if (!isRecord$3(filter) || !isRecord$3(filter["progression"])) return filter;
|
|
84
|
+
const start = filter["progression"]["startValue"];
|
|
85
|
+
const value = filter["value"];
|
|
86
|
+
return {
|
|
87
|
+
...without(filter, "progression"),
|
|
88
|
+
value: typeof start === "number" && typeof value === "number" ? Math.max(start, value) : value
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
const imageWithoutAdjustments = (paint) => isRecord$3(paint) && paint["kind"] === "image" ? without(paint, "adjustments") : paint;
|
|
92
|
+
const textShadows = (shadows) => listOf(shadows)?.filter((shadow) => !isRecord$3(shadow) || shadow["kind"] !== "inner").map((shadow) => isRecord$3(shadow) ? {
|
|
93
|
+
...shadow,
|
|
94
|
+
spread: 0
|
|
95
|
+
} : shadow) ?? shadows;
|
|
96
|
+
const textStroke = (stroke) => {
|
|
97
|
+
if (!isRecord$3(stroke)) return stroke;
|
|
98
|
+
const next = {
|
|
99
|
+
...stroke,
|
|
100
|
+
paint: unblended(stroke["paint"])
|
|
101
|
+
};
|
|
102
|
+
return stroke["alignment"] === "inside" ? {
|
|
103
|
+
...next,
|
|
104
|
+
alignment: "center"
|
|
105
|
+
} : next;
|
|
106
|
+
};
|
|
107
|
+
const richTextSpan = (child) => {
|
|
108
|
+
if (!isRecord$3(child) || child["kind"] !== "span") return child;
|
|
109
|
+
const next = without(child, "decorationBlendMode");
|
|
110
|
+
const fills = listOf(child["fills"]);
|
|
111
|
+
if (fills !== void 0) next["fills"] = fills.map((paint) => unblended(paint));
|
|
112
|
+
if (isRecord$3(child["stroke"])) next["stroke"] = textStroke(child["stroke"]);
|
|
113
|
+
const children = listOf(child["children"]);
|
|
114
|
+
if (children !== void 0) next["children"] = children.map((span) => richTextSpan(span));
|
|
115
|
+
return next;
|
|
116
|
+
};
|
|
117
|
+
/** Text paints cannot blend on their own: one fill under a Normal layer lends the layer its blend. */
|
|
118
|
+
const textFills = (appearance, next) => {
|
|
119
|
+
const fills = listOf(next["fills"]);
|
|
120
|
+
if (fills === void 0) return;
|
|
121
|
+
const [only] = fills;
|
|
122
|
+
const paintBlend = isRecord$3(only) ? only["blendMode"] : void 0;
|
|
123
|
+
if (typeof paintBlend === "string" && fills.length === 1 && (appearance["blendMode"] ?? "normal") === "normal") next["blendMode"] = paintBlend;
|
|
124
|
+
next["fills"] = fills.map((paint) => unblended(paint));
|
|
125
|
+
};
|
|
126
|
+
const adaptAppearance = (appearance, isText) => {
|
|
127
|
+
const next = { ...appearance };
|
|
128
|
+
if ("border" in appearance) next["border"] = borderPaints(appearance["border"]);
|
|
129
|
+
if ("outline" in appearance) next["outline"] = borderPaints(appearance["outline"]);
|
|
130
|
+
const fills = listOf(appearance["fills"]);
|
|
131
|
+
if (fills !== void 0) next["fills"] = fills.map((paint) => imageWithoutAdjustments(paint));
|
|
132
|
+
const filters = listOf(appearance["filters"]);
|
|
133
|
+
if (filters !== void 0) next["filters"] = filters.map((filter) => uniformBlur(filter));
|
|
134
|
+
if (!isText) return next;
|
|
135
|
+
if ("shadows" in appearance) next["shadows"] = textShadows(appearance["shadows"]);
|
|
136
|
+
textFills(appearance, next);
|
|
137
|
+
return next;
|
|
138
|
+
};
|
|
139
|
+
const withoutCopiedMaskCss = (node) => {
|
|
140
|
+
const props = node["props"];
|
|
141
|
+
if (!isRecord$3(props) || !isRecord$3(props["paintFallback"])) return { ...node };
|
|
142
|
+
const copied = props["paintFallback"]["mask"];
|
|
143
|
+
if (copied === void 0) return { ...node };
|
|
144
|
+
const fallback = without(props["paintFallback"], "mask");
|
|
145
|
+
const nextProps = Object.keys(fallback).length === 0 ? without(props, "paintFallback") : {
|
|
146
|
+
...props,
|
|
147
|
+
paintFallback: fallback
|
|
148
|
+
};
|
|
149
|
+
const styles = node["styles"];
|
|
150
|
+
const next = without(node, "props");
|
|
151
|
+
if (isRecord$3(copied) && isRecord$3(styles)) next["styles"] = Object.fromEntries(Object.entries(styles).filter(([key, value]) => copied[key] !== value));
|
|
152
|
+
if (Object.keys(nextProps).length > 0) next["props"] = nextProps;
|
|
153
|
+
return next;
|
|
154
|
+
};
|
|
155
|
+
const isIsolating = (node) => {
|
|
156
|
+
const compositing = node["compositing"];
|
|
157
|
+
if (!isRecord$3(compositing)) return false;
|
|
158
|
+
if (compositing["groupMode"] !== void 0) return compositing["groupMode"] === "isolated";
|
|
159
|
+
return compositing["paintSemantics"] === "web" && (node["component"] === "frame" || node["component"] === "group");
|
|
160
|
+
};
|
|
161
|
+
const adaptTypography = (typography) => {
|
|
162
|
+
const next = { ...typography };
|
|
163
|
+
if ("stroke" in typography) next["stroke"] = textStroke(typography["stroke"]);
|
|
164
|
+
if (isRecord$3(typography["decoration"])) next["decoration"] = without(typography["decoration"], "blendMode");
|
|
165
|
+
return next;
|
|
166
|
+
};
|
|
167
|
+
const adaptNode$1 = (node) => {
|
|
168
|
+
if (!isRecord$3(node)) return node;
|
|
169
|
+
const next = without(withoutCopiedMaskCss(node), "compositing");
|
|
170
|
+
if (isIsolating(node) && isRecord$3(next["styles"])) next["styles"] = {
|
|
171
|
+
...next["styles"],
|
|
172
|
+
isolation: "isolate"
|
|
173
|
+
};
|
|
174
|
+
const isText = node["component"] === "text";
|
|
175
|
+
if (isRecord$3(node["appearance"])) next["appearance"] = adaptAppearance(node["appearance"], isText);
|
|
176
|
+
if (!isText) return next;
|
|
177
|
+
if (isRecord$3(node["typography"])) next["typography"] = adaptTypography(node["typography"]);
|
|
178
|
+
const props = next["props"];
|
|
179
|
+
const richText = isRecord$3(props) ? listOf(props["richText"]) : void 0;
|
|
180
|
+
if (richText !== void 0 && isRecord$3(props)) next["props"] = {
|
|
181
|
+
...props,
|
|
182
|
+
richText: richText.map((span) => richTextSpan(span))
|
|
183
|
+
};
|
|
184
|
+
return next;
|
|
185
|
+
};
|
|
186
|
+
const sortKeyOf = (relationship) => isRecord$3(relationship) && typeof relationship["sortKey"] === "string" ? relationship["sortKey"] : "";
|
|
187
|
+
const childrenByParent = (relationships) => {
|
|
188
|
+
const children = /* @__PURE__ */ new Map();
|
|
189
|
+
for (const [id, relationship] of Object.entries(relationships)) {
|
|
190
|
+
if (!isRecord$3(relationship) || typeof relationship["parentId"] !== "string") continue;
|
|
191
|
+
const list = children.get(relationship["parentId"]);
|
|
192
|
+
if (list === void 0) children.set(relationship["parentId"], [id]);
|
|
193
|
+
else list.push(id);
|
|
194
|
+
}
|
|
195
|
+
const order = (id) => sortKeyOf(relationships[id]);
|
|
196
|
+
/** Sort keys order by code unit, as fractional indexes do; a locale compare would reorder them. */
|
|
197
|
+
const byKey = (a, b) => {
|
|
198
|
+
if (order(a) < order(b)) return -1;
|
|
199
|
+
return Number(order(a) > order(b));
|
|
200
|
+
};
|
|
201
|
+
for (const list of children.values()) list.sort(byKey);
|
|
202
|
+
return children;
|
|
203
|
+
};
|
|
204
|
+
const maskGroupNode = (id, sourceId, mode) => ({
|
|
205
|
+
id,
|
|
206
|
+
label: "Mask",
|
|
207
|
+
labelOrigin: "generated",
|
|
208
|
+
component: "group",
|
|
209
|
+
styles: {},
|
|
210
|
+
geometry: {
|
|
211
|
+
kind: "mask",
|
|
212
|
+
maskId: sourceId,
|
|
213
|
+
mode
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
/** Wraps each mask source and the layers above it, up to the next mask, in a mask group. */
|
|
217
|
+
const wrapMaskRuns = (original, children, nodes, relationships) => {
|
|
218
|
+
let wrapper = "";
|
|
219
|
+
for (const id of children) {
|
|
220
|
+
const mode = maskModeOf(original[id]);
|
|
221
|
+
if (mode !== void 0) {
|
|
222
|
+
wrapper = canvasMaskWrapperId(id);
|
|
223
|
+
nodes[wrapper] = maskGroupNode(wrapper, id, mode);
|
|
224
|
+
relationships[wrapper] = relationships[id];
|
|
225
|
+
}
|
|
226
|
+
const relationship = relationships[id];
|
|
227
|
+
if (wrapper !== "" && isRecord$3(relationship)) relationships[id] = {
|
|
228
|
+
...relationship,
|
|
229
|
+
parentId: wrapper
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
/** A backmost mask of a plain group makes that group the mask group; every other mask is wrapped. */
|
|
234
|
+
const maskGroups = (original, nodes, relationships) => {
|
|
235
|
+
for (const [parentId, children] of childrenByParent(relationships)) {
|
|
236
|
+
const masks = children.filter((id) => maskModeOf(original[id]) !== void 0);
|
|
237
|
+
const [first] = children;
|
|
238
|
+
const parent = nodes[parentId];
|
|
239
|
+
const mode = maskModeOf(original[first]);
|
|
240
|
+
if (mode !== void 0 && masks.length === 1 && isRecord$3(parent) && parent["component"] === "group" && parent["geometry"] === void 0) nodes[parentId] = {
|
|
241
|
+
...parent,
|
|
242
|
+
geometry: {
|
|
243
|
+
kind: "mask",
|
|
244
|
+
maskId: first,
|
|
245
|
+
mode
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
else wrapMaskRuns(original, children, nodes, relationships);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
/** Rewrites format 11 compositing, and the settings CSS cannot draw, to what the browser paints. */
|
|
252
|
+
const adaptCanvasCss = (document) => {
|
|
253
|
+
const original = document["nodes"];
|
|
254
|
+
if (!isRecord$3(original)) return document;
|
|
255
|
+
const nodes = Object.fromEntries(Object.entries(original).map(([id, node]) => [id, adaptNode$1(node)]));
|
|
256
|
+
if (!isRecord$3(document["relationships"])) return {
|
|
257
|
+
...document,
|
|
258
|
+
nodes
|
|
259
|
+
};
|
|
260
|
+
const relationships = { ...document["relationships"] };
|
|
261
|
+
maskGroups(original, nodes, relationships);
|
|
262
|
+
return {
|
|
263
|
+
...document,
|
|
264
|
+
nodes,
|
|
265
|
+
relationships
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region ../../packages/canvas-format/src/canvas-text-shadow-adaptation.lib.ts
|
|
271
|
+
const isRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
272
|
+
const isList = (value) => Array.isArray(value);
|
|
273
|
+
/** A text shadow is drawn as part of the text, so it holds no blend and no source for one. */
|
|
274
|
+
const withoutCanvasShadowBlend = (shadow) => {
|
|
275
|
+
if (!isRecord$2(shadow)) return shadow;
|
|
276
|
+
const copy = { ...shadow };
|
|
277
|
+
Reflect.deleteProperty(copy, "blendMode");
|
|
278
|
+
Reflect.deleteProperty(copy, "blendSource");
|
|
279
|
+
return copy;
|
|
280
|
+
};
|
|
281
|
+
const adaptNode = (node) => {
|
|
282
|
+
if (!isRecord$2(node) || node["component"] !== "text" || !isRecord$2(node["appearance"])) return node;
|
|
283
|
+
const shadows = node["appearance"]["shadows"];
|
|
284
|
+
if (!isList(shadows)) return node;
|
|
285
|
+
return {
|
|
286
|
+
...node,
|
|
287
|
+
appearance: {
|
|
288
|
+
...node["appearance"],
|
|
289
|
+
shadows: shadows.map((shadow) => withoutCanvasShadowBlend(shadow))
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* The format 13 step: CSS draws a text shadow as part of the text, so a text shadow keeps its
|
|
295
|
+
* colour, offset, blur and visibility and loses its blend and that blend's source.
|
|
296
|
+
*/
|
|
297
|
+
const withoutTextShadowBlends = (document) => {
|
|
298
|
+
const nodes = document["nodes"];
|
|
299
|
+
if (!isRecord$2(nodes)) return document;
|
|
300
|
+
return {
|
|
301
|
+
...document,
|
|
302
|
+
nodes: Object.fromEntries(Object.entries(nodes).map(([id, node]) => [id, adaptNode(node)]))
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region ../../packages/canvas-format/src/canvas-format.lib.ts
|
|
308
|
+
const READABLE_FORMATS = /* @__PURE__ */ new Set([...Object.values(LEGACY_CANVAS_FORMATS), 13]);
|
|
309
|
+
const isReadableCanvasFormat = (version) => READABLE_FORMATS.has(version);
|
|
310
|
+
/** Formats whose adaptation rewrites the stored document in place, keeping its geometry. */
|
|
311
|
+
const ADAPTED_IN_PLACE = /* @__PURE__ */ new Set([
|
|
312
|
+
"text-shadow-blend",
|
|
313
|
+
"css",
|
|
314
|
+
"geometry"
|
|
315
|
+
]);
|
|
316
|
+
const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
317
|
+
const legacyLayout = (layout) => {
|
|
318
|
+
if (!isRecord$1(layout)) return layout;
|
|
319
|
+
const next = Object.fromEntries(Object.entries(layout).filter(([key]) => key !== "gridTrack"));
|
|
320
|
+
const container = next["container"];
|
|
321
|
+
if (isRecord$1(container)) next["container"] = Object.fromEntries(Object.entries(container).filter(([key]) => key !== "materialized"));
|
|
322
|
+
for (const axis of ["horizontal", "vertical"]) {
|
|
323
|
+
const intent = next[axis];
|
|
324
|
+
if (isRecord$1(intent) && intent["mode"] === "hug") next[axis] = Object.fromEntries(Object.entries(intent).filter(([key]) => key !== "basis"));
|
|
325
|
+
}
|
|
326
|
+
return next;
|
|
327
|
+
};
|
|
328
|
+
const adaptLegacyFormat = (document) => {
|
|
329
|
+
const version = document["version"];
|
|
330
|
+
if (!isReadableCanvasFormat(version)) return null;
|
|
331
|
+
if (version === 13 || !isRecord$1(document["nodes"])) return document;
|
|
332
|
+
const adaptation = Object.entries(LEGACY_CANVAS_ADAPTATIONS).find(([format]) => Number(format) === version)?.[1];
|
|
333
|
+
if (ADAPTED_IN_PLACE.has(adaptation)) return {
|
|
334
|
+
...document,
|
|
335
|
+
version: 13
|
|
336
|
+
};
|
|
337
|
+
if (Object.values(document["nodes"]).some((node) => isRecord$1(node) && node["geometry"] !== void 0)) return null;
|
|
338
|
+
if (adaptation === "typography") return {
|
|
339
|
+
...document,
|
|
340
|
+
version: 13
|
|
341
|
+
};
|
|
342
|
+
return {
|
|
343
|
+
...document,
|
|
344
|
+
version: 13,
|
|
345
|
+
nodes: Object.fromEntries(Object.entries(document["nodes"]).map(([id, node]) => [id, isRecord$1(node) && node["layout"] !== void 0 ? {
|
|
346
|
+
...node,
|
|
347
|
+
layout: legacyLayout(node["layout"])
|
|
348
|
+
} : node]))
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* 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.
|
|
355
|
+
*/
|
|
356
|
+
const adaptCanvasDocumentFormat = (document) => {
|
|
357
|
+
const adapted = adaptLegacyFormat(document);
|
|
358
|
+
if (adapted === null || adapted === document) return adapted;
|
|
359
|
+
return withoutTextShadowBlends(document["version"] === LEGACY_CANVAS_FORMATS.v12 ? adapted : adaptCanvasCss(adapted));
|
|
360
|
+
};
|
|
361
|
+
|
|
16
362
|
//#endregion
|
|
17
363
|
//#region ../../packages/contract/src/canvas/first-agent-work.schema.ts
|
|
18
364
|
const firstAgentWorkInputSchema = z.strictObject({});
|
|
@@ -182,7 +528,9 @@ const listCanvasesInputSchema = z.object({
|
|
|
182
528
|
});
|
|
183
529
|
const canvasCardBaseSchema = canvasSchema.extend({
|
|
184
530
|
screenCount: z.number().int().min(0),
|
|
185
|
-
hasRecording: z.boolean()
|
|
531
|
+
hasRecording: z.boolean(),
|
|
532
|
+
/** When the person listing last opened it in the web app; `null` if they never have. */
|
|
533
|
+
lastViewedAt: z.iso.datetime().nullable()
|
|
186
534
|
});
|
|
187
535
|
const canvasCardSchema = z.union([canvasCardBaseSchema.extend({ thumbnail: canvasThumbnailPreviewSchema }), canvasCardBaseSchema.extend({
|
|
188
536
|
thumbnail: z.null(),
|
|
@@ -224,7 +572,10 @@ const setCanvasAccessOutputSchema = z.object({
|
|
|
224
572
|
widened: z.boolean()
|
|
225
573
|
});
|
|
226
574
|
const markCanvasViewedInputSchema = z.object({ canvasId: z.uuid() });
|
|
227
|
-
/**
|
|
575
|
+
/**
|
|
576
|
+
* Kept for each person, for a direct or team grant. `null` for a link visitor and for any call
|
|
577
|
+
* from an agent, because only the person's own opens in the web app count.
|
|
578
|
+
*/
|
|
228
579
|
const markCanvasViewedOutputSchema = z.object({ lastViewedAt: z.iso.datetime().nullable() });
|
|
229
580
|
const restoreCanvasInputSchema = z.object({ canvasId: z.uuid() });
|
|
230
581
|
const restoreCanvasOutputSchema = z.object({ canvasId: z.uuid() });
|
|
@@ -261,16 +612,61 @@ const canvasGradientStopSchema = z.object({
|
|
|
261
612
|
position: ratio$1,
|
|
262
613
|
color: canvasColorSchema
|
|
263
614
|
});
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
shadows: adjustment.optional()
|
|
615
|
+
const canvasFilterBaseSchema = z.object({
|
|
616
|
+
id: itemId$1,
|
|
617
|
+
visible: z.boolean()
|
|
618
|
+
});
|
|
619
|
+
const canvasBlurFilterSchema = canvasFilterBaseSchema.extend({
|
|
620
|
+
kind: z.literal("blur"),
|
|
621
|
+
value: nonNegativeNumber$2,
|
|
622
|
+
parameter: z.enum(["radius", "standard-deviation"]).optional()
|
|
273
623
|
});
|
|
624
|
+
const canvasFilterKinds = [
|
|
625
|
+
canvasFilterBaseSchema.extend({
|
|
626
|
+
kind: z.literal("brightness"),
|
|
627
|
+
value: nonNegativeNumber$2
|
|
628
|
+
}),
|
|
629
|
+
canvasFilterBaseSchema.extend({
|
|
630
|
+
kind: z.literal("contrast"),
|
|
631
|
+
value: nonNegativeNumber$2
|
|
632
|
+
}),
|
|
633
|
+
canvasFilterBaseSchema.extend({
|
|
634
|
+
kind: z.literal("grayscale"),
|
|
635
|
+
value: ratio$1
|
|
636
|
+
}),
|
|
637
|
+
canvasFilterBaseSchema.extend({
|
|
638
|
+
kind: z.literal("hue-rotate"),
|
|
639
|
+
value: boundedNumber$1
|
|
640
|
+
}),
|
|
641
|
+
canvasFilterBaseSchema.extend({
|
|
642
|
+
kind: z.literal("invert"),
|
|
643
|
+
value: ratio$1
|
|
644
|
+
}),
|
|
645
|
+
canvasFilterBaseSchema.extend({
|
|
646
|
+
kind: z.literal("saturate"),
|
|
647
|
+
value: nonNegativeNumber$2
|
|
648
|
+
}),
|
|
649
|
+
canvasFilterBaseSchema.extend({
|
|
650
|
+
kind: z.literal("sepia"),
|
|
651
|
+
value: ratio$1
|
|
652
|
+
})
|
|
653
|
+
];
|
|
654
|
+
/** A CSS filter on a layer or on an image fill. */
|
|
655
|
+
const canvasFilterSchema = z.discriminatedUnion("kind", [canvasBlurFilterSchema, ...canvasFilterKinds]);
|
|
656
|
+
/** A CSS backdrop filter; only a background blur can progress across the layer. */
|
|
657
|
+
const canvasBackdropFilterSchema = z.discriminatedUnion("kind", [canvasBlurFilterSchema.extend({
|
|
658
|
+
/** Endpoints use normalized body coordinates; startValue uses the filter's authored unit. */
|
|
659
|
+
progression: z.object({
|
|
660
|
+
startValue: nonNegativeNumber$2,
|
|
661
|
+
start: z.object({
|
|
662
|
+
x: boundedNumber$1,
|
|
663
|
+
y: boundedNumber$1
|
|
664
|
+
}),
|
|
665
|
+
end: z.object({
|
|
666
|
+
x: boundedNumber$1,
|
|
667
|
+
y: boundedNumber$1
|
|
668
|
+
})
|
|
669
|
+
}).optional() }), ...canvasFilterKinds]);
|
|
274
670
|
/** Maps normalized source (u,v) into body (a*u+c*v+e,b*u+d*v+f), before node rotation. */
|
|
275
671
|
const canvasPaintTransformSchema = z.tuple([
|
|
276
672
|
boundedNumber$1,
|
|
@@ -374,7 +770,12 @@ const canvasPaintCoreSchema = z.discriminatedUnion("kind", [
|
|
|
374
770
|
height: ratio$1
|
|
375
771
|
}).optional(),
|
|
376
772
|
transform: canvasPaintTransformSchema.optional(),
|
|
377
|
-
|
|
773
|
+
filters: z.array(canvasFilterSchema).optional(),
|
|
774
|
+
/** The image's own pixel size, which cover, fit and tile need to place it outside its layer. */
|
|
775
|
+
naturalSize: z.object({
|
|
776
|
+
width: boundedNumber$1.positive(),
|
|
777
|
+
height: boundedNumber$1.positive()
|
|
778
|
+
}).optional()
|
|
378
779
|
}).refine((paint) => paint.crop === void 0 || paint.transform === void 0, {
|
|
379
780
|
message: "image paint cannot have both a crop rectangle and an affine transform",
|
|
380
781
|
path: ["transform"]
|
|
@@ -541,6 +942,14 @@ const canvasCornerRadiusSchema = z.object({
|
|
|
541
942
|
bottomLeft: nonNegativeNumber$1,
|
|
542
943
|
smoothing: ratio.optional()
|
|
543
944
|
});
|
|
945
|
+
/** Dash and gap lengths, repeated; an odd list repeats twice as SVG does. Writers store all zeros as none. */
|
|
946
|
+
const canvasDashPatternSchema = z.array(nonNegativeNumber$1).min(1);
|
|
947
|
+
/** none is a butt cap. */
|
|
948
|
+
const canvasDashCapSchema = z.enum([
|
|
949
|
+
"none",
|
|
950
|
+
"round",
|
|
951
|
+
"square"
|
|
952
|
+
]);
|
|
544
953
|
const canvasBorderSchema = z.object({
|
|
545
954
|
visible: z.boolean(),
|
|
546
955
|
/** Absent reserves CSS widths; visible reserves only visible paint, while none separates paint from layout. */
|
|
@@ -560,7 +969,17 @@ const canvasBorderSchema = z.object({
|
|
|
560
969
|
"dashed",
|
|
561
970
|
"dotted"
|
|
562
971
|
]),
|
|
563
|
-
|
|
972
|
+
paints: z.array(canvasPaintSchema),
|
|
973
|
+
dashPattern: canvasDashPatternSchema.optional(),
|
|
974
|
+
dashCap: canvasDashCapSchema.optional(),
|
|
975
|
+
/** Captured CSS dashes, which the browser draws: the editor's own dashes have other lengths. */
|
|
976
|
+
dashOrigin: z.literal("css").optional(),
|
|
977
|
+
/** Absent paints inside the layer box, as CSS borders do. */
|
|
978
|
+
alignment: z.enum([
|
|
979
|
+
"inside",
|
|
980
|
+
"center",
|
|
981
|
+
"outside"
|
|
982
|
+
]).optional()
|
|
564
983
|
});
|
|
565
984
|
const retainedBorderSchema = canvasBorderSchema.pick({
|
|
566
985
|
width: true,
|
|
@@ -576,7 +995,9 @@ const canvasOutlineSchema = z.object({
|
|
|
576
995
|
"dashed",
|
|
577
996
|
"dotted"
|
|
578
997
|
]),
|
|
579
|
-
|
|
998
|
+
paints: z.array(canvasPaintSchema),
|
|
999
|
+
dashPattern: canvasDashPatternSchema.optional(),
|
|
1000
|
+
dashCap: canvasDashCapSchema.optional()
|
|
580
1001
|
});
|
|
581
1002
|
const canvasShadowSchema = z.object({
|
|
582
1003
|
id: itemId,
|
|
@@ -591,57 +1012,6 @@ const canvasShadowSchema = z.object({
|
|
|
591
1012
|
blendSource: canvasBlendSourceSchema.optional(),
|
|
592
1013
|
isShownBehindNode: z.boolean().optional()
|
|
593
1014
|
});
|
|
594
|
-
const canvasFilterBaseSchema = z.object({
|
|
595
|
-
id: itemId,
|
|
596
|
-
visible: z.boolean()
|
|
597
|
-
});
|
|
598
|
-
const canvasFilterSchema = z.discriminatedUnion("kind", [
|
|
599
|
-
canvasFilterBaseSchema.extend({
|
|
600
|
-
kind: z.literal("blur"),
|
|
601
|
-
value: nonNegativeNumber$1,
|
|
602
|
-
parameter: z.enum(["radius", "standard-deviation"]).optional(),
|
|
603
|
-
/** Endpoints use normalized body coordinates; startValue uses the filter's authored unit. */
|
|
604
|
-
progression: z.object({
|
|
605
|
-
startValue: nonNegativeNumber$1,
|
|
606
|
-
start: z.object({
|
|
607
|
-
x: boundedNumber,
|
|
608
|
-
y: boundedNumber
|
|
609
|
-
}),
|
|
610
|
-
end: z.object({
|
|
611
|
-
x: boundedNumber,
|
|
612
|
-
y: boundedNumber
|
|
613
|
-
})
|
|
614
|
-
}).optional()
|
|
615
|
-
}),
|
|
616
|
-
canvasFilterBaseSchema.extend({
|
|
617
|
-
kind: z.literal("brightness"),
|
|
618
|
-
value: nonNegativeNumber$1
|
|
619
|
-
}),
|
|
620
|
-
canvasFilterBaseSchema.extend({
|
|
621
|
-
kind: z.literal("contrast"),
|
|
622
|
-
value: nonNegativeNumber$1
|
|
623
|
-
}),
|
|
624
|
-
canvasFilterBaseSchema.extend({
|
|
625
|
-
kind: z.literal("grayscale"),
|
|
626
|
-
value: ratio
|
|
627
|
-
}),
|
|
628
|
-
canvasFilterBaseSchema.extend({
|
|
629
|
-
kind: z.literal("hue-rotate"),
|
|
630
|
-
value: boundedNumber
|
|
631
|
-
}),
|
|
632
|
-
canvasFilterBaseSchema.extend({
|
|
633
|
-
kind: z.literal("invert"),
|
|
634
|
-
value: ratio
|
|
635
|
-
}),
|
|
636
|
-
canvasFilterBaseSchema.extend({
|
|
637
|
-
kind: z.literal("saturate"),
|
|
638
|
-
value: nonNegativeNumber$1
|
|
639
|
-
}),
|
|
640
|
-
canvasFilterBaseSchema.extend({
|
|
641
|
-
kind: z.literal("sepia"),
|
|
642
|
-
value: ratio
|
|
643
|
-
})
|
|
644
|
-
]);
|
|
645
1015
|
const canvasAppearanceSchema = z.object({
|
|
646
1016
|
opacity: ratio,
|
|
647
1017
|
blendMode: canvasBlendModeSchema,
|
|
@@ -652,7 +1022,7 @@ const canvasAppearanceSchema = z.object({
|
|
|
652
1022
|
radius: canvasCornerRadiusSchema,
|
|
653
1023
|
shadows: z.array(canvasShadowSchema),
|
|
654
1024
|
filters: z.array(canvasFilterSchema),
|
|
655
|
-
backdropFilters: z.array(
|
|
1025
|
+
backdropFilters: z.array(canvasBackdropFilterSchema)
|
|
656
1026
|
});
|
|
657
1027
|
const canvasAppearanceValuesSchema = canvasAppearanceSchema.partial().refine((values) => Object.keys(values).length > 0, "appearance values cannot be empty");
|
|
658
1028
|
const CANVAS_APPEARANCE_PROPERTIES = [
|
|
@@ -772,11 +1142,8 @@ const canvasTypographySchema = z.object({
|
|
|
772
1142
|
stroke: z.object({
|
|
773
1143
|
width: nonNegativeNumber,
|
|
774
1144
|
paint: canvasPaintSchema,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
"center",
|
|
778
|
-
"outside"
|
|
779
|
-
]).optional()
|
|
1145
|
+
/** CSS strokes text on the glyph outline or, painted under the fill, outside it. */
|
|
1146
|
+
alignment: z.enum(["center", "outside"]).optional()
|
|
780
1147
|
}).optional(),
|
|
781
1148
|
wrapping: z.enum([
|
|
782
1149
|
"wrap",
|
|
@@ -878,6 +1245,7 @@ const CANVAS_TYPOGRAPHY_CSS_OWNERS = {
|
|
|
878
1245
|
"-webkit-text-stroke-width": ["stroke"],
|
|
879
1246
|
"-webkit-text-stroke-color": ["stroke"],
|
|
880
1247
|
"--canvas-text-stroke-alignment": ["stroke"],
|
|
1248
|
+
"paint-order": ["stroke"],
|
|
881
1249
|
"white-space": ["wrapping"],
|
|
882
1250
|
"text-wrap-style": ["wrapStyle"],
|
|
883
1251
|
"text-wrap": ["wrapStyle"]
|
|
@@ -1078,6 +1446,8 @@ const canvasTextStyleBindingSchema = z.object({
|
|
|
1078
1446
|
//#endregion
|
|
1079
1447
|
//#region ../../packages/contract/src/canvas/canvas-rich-text.lib.ts
|
|
1080
1448
|
const fillsSchema = canvasPaintSchema.array().optional();
|
|
1449
|
+
/** What one rich text run stores besides its text, which the owner list of paint blends reads. */
|
|
1450
|
+
const canvasRichTextRunPaintSchema = z.object({ fills: fillsSchema });
|
|
1081
1451
|
const characterFormattingSchema = canvasTextParagraphSchema.pick({
|
|
1082
1452
|
paragraphSpacing: true,
|
|
1083
1453
|
paragraphIndent: true,
|
|
@@ -1218,6 +1588,16 @@ const canvasRichTextOf = (node) => {
|
|
|
1218
1588
|
const text = props["text"];
|
|
1219
1589
|
return canvasRichTextValueOf(rich) === text ? rich : [];
|
|
1220
1590
|
};
|
|
1591
|
+
const hasCanvasRichTextPaints = (node) => {
|
|
1592
|
+
const pending = [...canvasRichTextOf(node)];
|
|
1593
|
+
while (pending.length > 0) {
|
|
1594
|
+
const run = pending.pop();
|
|
1595
|
+
if (run?.kind !== "span") continue;
|
|
1596
|
+
if (run.fills !== void 0) return true;
|
|
1597
|
+
for (const child of run.children) pending.push(child);
|
|
1598
|
+
}
|
|
1599
|
+
return false;
|
|
1600
|
+
};
|
|
1221
1601
|
/** Existing-link edits retain authored formatting, including nested descendants. */
|
|
1222
1602
|
const canvasRichTextLinkOf = (runs) => {
|
|
1223
1603
|
const destinations = /* @__PURE__ */ new Set();
|
|
@@ -1228,6 +1608,15 @@ const canvasRichTextLinkOf = (runs) => {
|
|
|
1228
1608
|
visit(runs);
|
|
1229
1609
|
return destinations.size === 1 ? [...destinations][0] ?? null : null;
|
|
1230
1610
|
};
|
|
1611
|
+
/**
|
|
1612
|
+
* The style text a run edit clears: the properties it sets, and for a stroke edit the style text
|
|
1613
|
+
* that copies a stroke, since the stroke value owns it.
|
|
1614
|
+
*/
|
|
1615
|
+
const canvasRunStylesClearedBy = (command) => [...Object.keys(command.styles), ...command.stroke === void 0 ? [] : [
|
|
1616
|
+
"WebkitTextStrokeWidth",
|
|
1617
|
+
"WebkitTextStrokeColor",
|
|
1618
|
+
"--canvas-text-stroke-alignment"
|
|
1619
|
+
]];
|
|
1231
1620
|
|
|
1232
1621
|
//#endregion
|
|
1233
1622
|
//#region ../../packages/contract/src/shared/blob.schema.ts
|
|
@@ -1654,89 +2043,6 @@ const canvasLayoutMainAxisOf = (node, document) => {
|
|
|
1654
2043
|
return direction.startsWith("column") === isVerticalWriting ? "horizontal" : "vertical";
|
|
1655
2044
|
};
|
|
1656
2045
|
|
|
1657
|
-
//#endregion
|
|
1658
|
-
//#region ../../packages/contract/src/canvas/canvas-compositing.schema.ts
|
|
1659
|
-
const canvasCompositingSchema = z.strictObject({
|
|
1660
|
-
groupMode: z.enum(["pass-through", "isolated"]).optional(),
|
|
1661
|
-
mask: z.enum([
|
|
1662
|
-
"alpha",
|
|
1663
|
-
"luminance",
|
|
1664
|
-
"vector"
|
|
1665
|
-
]).optional(),
|
|
1666
|
-
/** Absence retains the stored document's legacy paint and isolation behavior. */
|
|
1667
|
-
paintSemantics: z.literal("web").optional()
|
|
1668
|
-
}).refine((value) => value.groupMode !== void 0 || value.mask !== void 0 || value.paintSemantics !== void 0, "compositing intent cannot be empty");
|
|
1669
|
-
|
|
1670
|
-
//#endregion
|
|
1671
|
-
//#region ../../packages/canvas-format/src/canvas-format.consts.ts
|
|
1672
|
-
/** Historical formats stay pinned; an ordinary writer always uses CANVAS_SCENE_VERSION. */
|
|
1673
|
-
const LEGACY_CANVAS_FORMATS = {
|
|
1674
|
-
unversioned: void 0,
|
|
1675
|
-
v1: 1,
|
|
1676
|
-
v2: 2,
|
|
1677
|
-
v3: 3,
|
|
1678
|
-
v4: 4,
|
|
1679
|
-
v5: 5,
|
|
1680
|
-
v6: 6,
|
|
1681
|
-
v7: 7,
|
|
1682
|
-
v8: 8,
|
|
1683
|
-
v9: 9,
|
|
1684
|
-
v10: 10
|
|
1685
|
-
};
|
|
1686
|
-
const LEGACY_CANVAS_ADAPTATIONS = {
|
|
1687
|
-
[LEGACY_CANVAS_FORMATS.v1]: "layout",
|
|
1688
|
-
[LEGACY_CANVAS_FORMATS.v2]: "layout",
|
|
1689
|
-
[LEGACY_CANVAS_FORMATS.v3]: "typography",
|
|
1690
|
-
[LEGACY_CANVAS_FORMATS.v4]: "typography",
|
|
1691
|
-
[LEGACY_CANVAS_FORMATS.v5]: "typography",
|
|
1692
|
-
[LEGACY_CANVAS_FORMATS.v6]: "geometry",
|
|
1693
|
-
[LEGACY_CANVAS_FORMATS.v7]: "geometry",
|
|
1694
|
-
[LEGACY_CANVAS_FORMATS.v8]: "geometry",
|
|
1695
|
-
[LEGACY_CANVAS_FORMATS.v9]: "geometry",
|
|
1696
|
-
[LEGACY_CANVAS_FORMATS.v10]: "geometry"
|
|
1697
|
-
};
|
|
1698
|
-
|
|
1699
|
-
//#endregion
|
|
1700
|
-
//#region ../../packages/canvas-format/src/canvas-format.lib.ts
|
|
1701
|
-
const READABLE_FORMATS = /* @__PURE__ */ new Set([...Object.values(LEGACY_CANVAS_FORMATS), 11]);
|
|
1702
|
-
const isReadableCanvasFormat = (version) => READABLE_FORMATS.has(version);
|
|
1703
|
-
const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1704
|
-
const legacyLayout = (layout) => {
|
|
1705
|
-
if (!isRecord$1(layout)) return layout;
|
|
1706
|
-
const next = Object.fromEntries(Object.entries(layout).filter(([key]) => key !== "gridTrack"));
|
|
1707
|
-
const container = next["container"];
|
|
1708
|
-
if (isRecord$1(container)) next["container"] = Object.fromEntries(Object.entries(container).filter(([key]) => key !== "materialized"));
|
|
1709
|
-
for (const axis of ["horizontal", "vertical"]) {
|
|
1710
|
-
const intent = next[axis];
|
|
1711
|
-
if (isRecord$1(intent) && intent["mode"] === "hug") next[axis] = Object.fromEntries(Object.entries(intent).filter(([key]) => key !== "basis"));
|
|
1712
|
-
}
|
|
1713
|
-
return next;
|
|
1714
|
-
};
|
|
1715
|
-
/** Adapt known formats in memory, retaining malformed content for each boundary's validator. */
|
|
1716
|
-
const adaptCanvasDocumentFormat = (document) => {
|
|
1717
|
-
const version = document["version"];
|
|
1718
|
-
if (!isReadableCanvasFormat(version)) return null;
|
|
1719
|
-
if (version === 11 || !isRecord$1(document["nodes"])) return document;
|
|
1720
|
-
const adaptation = Object.entries(LEGACY_CANVAS_ADAPTATIONS).find(([format]) => Number(format) === version)?.[1];
|
|
1721
|
-
if (adaptation === "geometry") return {
|
|
1722
|
-
...document,
|
|
1723
|
-
version: 11
|
|
1724
|
-
};
|
|
1725
|
-
if (Object.values(document["nodes"]).some((node) => isRecord$1(node) && node["geometry"] !== void 0)) return null;
|
|
1726
|
-
if (adaptation === "typography") return {
|
|
1727
|
-
...document,
|
|
1728
|
-
version: 11
|
|
1729
|
-
};
|
|
1730
|
-
return {
|
|
1731
|
-
...document,
|
|
1732
|
-
version: 11,
|
|
1733
|
-
nodes: Object.fromEntries(Object.entries(document["nodes"]).map(([id, node]) => [id, isRecord$1(node) && node["layout"] !== void 0 ? {
|
|
1734
|
-
...node,
|
|
1735
|
-
layout: legacyLayout(node["layout"])
|
|
1736
|
-
} : node]))
|
|
1737
|
-
};
|
|
1738
|
-
};
|
|
1739
|
-
|
|
1740
2046
|
//#endregion
|
|
1741
2047
|
//#region ../../packages/contract/src/canvas/canvas-export-settings.schema.ts
|
|
1742
2048
|
const format = z.enum(["png", "jpeg"]);
|
|
@@ -1756,7 +2062,7 @@ const coordinate = z.number();
|
|
|
1756
2062
|
const dimension$1 = coordinate.nonnegative();
|
|
1757
2063
|
const MAX_ID_LENGTH = 200;
|
|
1758
2064
|
const MIN_POLYGON_POINTS = 3;
|
|
1759
|
-
const identity = z.string().min(1).max(MAX_ID_LENGTH);
|
|
2065
|
+
const identity$1 = z.string().min(1).max(MAX_ID_LENGTH);
|
|
1760
2066
|
const path = z.string().regex(/^[MmLlHhVvCcSsQqTtAaZzEe\d\s.,+-]*$/u);
|
|
1761
2067
|
const canvasGeometryBoundsSchema = z.strictObject({
|
|
1762
2068
|
x: coordinate,
|
|
@@ -1789,7 +2095,7 @@ const canvasBooleanOperationSchema = z.enum([
|
|
|
1789
2095
|
const canvasBooleanGeometrySchema = z.strictObject({
|
|
1790
2096
|
kind: z.literal("boolean"),
|
|
1791
2097
|
operation: canvasBooleanOperationSchema,
|
|
1792
|
-
operandIds: z.array(identity).min(1).refine((ids) => new Set(ids).size === ids.length),
|
|
2098
|
+
operandIds: z.array(identity$1).min(1).refine((ids) => new Set(ids).size === ids.length),
|
|
1793
2099
|
result: z.strictObject({
|
|
1794
2100
|
path,
|
|
1795
2101
|
fillRule: z.literal("nonzero"),
|
|
@@ -1803,14 +2109,21 @@ const canvasGeometrySchema = z.discriminatedUnion("kind", [
|
|
|
1803
2109
|
canvasPolygonGeometrySchema,
|
|
1804
2110
|
z.strictObject({
|
|
1805
2111
|
kind: z.literal("mask"),
|
|
1806
|
-
maskId: identity
|
|
2112
|
+
maskId: identity$1,
|
|
2113
|
+
/** Absent paints as alpha. An outline mask clips to the source's shape only. */
|
|
2114
|
+
mode: z.enum([
|
|
2115
|
+
"alpha",
|
|
2116
|
+
"luminance",
|
|
2117
|
+
"outline"
|
|
2118
|
+
]).optional()
|
|
1807
2119
|
}),
|
|
1808
2120
|
canvasBooleanGeometrySchema
|
|
1809
2121
|
]);
|
|
1810
2122
|
|
|
1811
2123
|
//#endregion
|
|
1812
2124
|
//#region ../../packages/contract/src/canvas/canvas-scene.schema.ts
|
|
1813
|
-
const
|
|
2125
|
+
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." });
|
|
1814
2127
|
const canvasPreservedFontAppearanceSchema = z.object({
|
|
1815
2128
|
signature: z.string().regex(/^[a-f0-9]{16}$/u),
|
|
1816
2129
|
image: z.string().startsWith("data:image/jpeg;base64,"),
|
|
@@ -1855,12 +2168,12 @@ const canvasSceneNodeSchema = z.looseObject({
|
|
|
1855
2168
|
typography: canvasAuthoredTypographySchema.optional(),
|
|
1856
2169
|
additionalStyles: canvasAdditionalStylesSchema.optional(),
|
|
1857
2170
|
geometry: canvasGeometrySchema.optional(),
|
|
1858
|
-
compositing:
|
|
2171
|
+
compositing: z.never({ error: CANVAS_COMPOSITING_RETIRED }).optional(),
|
|
1859
2172
|
props: z.record(z.string(), z.unknown()).optional(),
|
|
1860
2173
|
box: canvasSceneBoxSchema.optional()
|
|
1861
2174
|
});
|
|
1862
2175
|
const canvasSceneDocumentSchema = z.object({
|
|
1863
|
-
version: z.literal(
|
|
2176
|
+
version: z.literal(13),
|
|
1864
2177
|
nodes: z.record(z.string(), canvasSceneNodeSchema),
|
|
1865
2178
|
relationships: z.record(z.string(), z.object({
|
|
1866
2179
|
parentId: z.string().min(1),
|
|
@@ -1877,7 +2190,7 @@ const canvasReadableSceneDocumentSchema = z.preprocess((value) => {
|
|
|
1877
2190
|
return adaptCanvasDocumentFormat(blob);
|
|
1878
2191
|
}, canvasSceneDocumentSchema);
|
|
1879
2192
|
const emptyCanvasSceneDocument = () => ({
|
|
1880
|
-
version:
|
|
2193
|
+
version: 13,
|
|
1881
2194
|
nodes: { root: {
|
|
1882
2195
|
id: "root",
|
|
1883
2196
|
label: "Canvas",
|
|
@@ -1907,8 +2220,37 @@ const canvasConversionIssueSchema = z.object({
|
|
|
1907
2220
|
message: z.string().min(1),
|
|
1908
2221
|
temporaryId: temporaryIdSchema.optional()
|
|
1909
2222
|
});
|
|
2223
|
+
/** Source features that CSS cannot draw; a conversion writes the closest CSS and counts each. */
|
|
2224
|
+
const CANVAS_UNSUPPORTED_FEATURES = [
|
|
2225
|
+
"text-stroke-inside",
|
|
2226
|
+
"text-stroke-outside-translucent",
|
|
2227
|
+
"text-stroke-paints",
|
|
2228
|
+
"text-inner-shadow",
|
|
2229
|
+
"text-shadow-spread",
|
|
2230
|
+
"text-shadow-blend",
|
|
2231
|
+
"text-background-blur",
|
|
2232
|
+
"progressive-layer-blur",
|
|
2233
|
+
"progressive-background-blur",
|
|
2234
|
+
"blend-plus-darker",
|
|
2235
|
+
"blend-linear-burn",
|
|
2236
|
+
"image-exposure",
|
|
2237
|
+
"image-contrast",
|
|
2238
|
+
"image-saturation",
|
|
2239
|
+
"image-temperature",
|
|
2240
|
+
"image-tint",
|
|
2241
|
+
"image-highlights",
|
|
2242
|
+
"image-shadows",
|
|
2243
|
+
"effect-noise",
|
|
2244
|
+
"effect-texture",
|
|
2245
|
+
"effect-glass"
|
|
2246
|
+
];
|
|
2247
|
+
const canvasUnsupportedFeatureSchema = z.enum(CANVAS_UNSUPPORTED_FEATURES);
|
|
1910
2248
|
const canvasConversionReportSchema = z.object({
|
|
1911
2249
|
nodeCount: z.number().int().positive(),
|
|
2250
|
+
unsupportedFeatures: z.array(z.object({
|
|
2251
|
+
feature: canvasUnsupportedFeatureSchema,
|
|
2252
|
+
count: z.number().int().positive()
|
|
2253
|
+
})).optional(),
|
|
1912
2254
|
sourceNodeCount: z.number().int().positive().optional(),
|
|
1913
2255
|
collapsedNodeCount: z.number().int().nonnegative().optional(),
|
|
1914
2256
|
collapsedWrapperNodeCount: z.number().int().nonnegative().optional(),
|
|
@@ -2124,7 +2466,8 @@ const canvasRenderJobBaseSchema = z.object({
|
|
|
2124
2466
|
purpose: z.enum([
|
|
2125
2467
|
"inspection",
|
|
2126
2468
|
"snapshot",
|
|
2127
|
-
"thumbnail"
|
|
2469
|
+
"thumbnail",
|
|
2470
|
+
"export"
|
|
2128
2471
|
]),
|
|
2129
2472
|
phase: canvasRenderPhaseSchema,
|
|
2130
2473
|
requestedVersion: z.number().int().positive(),
|
|
@@ -2202,6 +2545,13 @@ const canvasRenderSourceSchema = z.discriminatedUnion("status", [z.object({
|
|
|
2202
2545
|
status: z.literal("unavailable"),
|
|
2203
2546
|
guidance: z.string()
|
|
2204
2547
|
})]);
|
|
2548
|
+
/** A person's image export of one layer at the saved revision, drawn by the render worker. */
|
|
2549
|
+
const createCanvasExportInputSchema = z.object({
|
|
2550
|
+
canvasId: z.uuid(),
|
|
2551
|
+
nodeId: z.string().min(1),
|
|
2552
|
+
expectedVersion: z.number().int().positive(),
|
|
2553
|
+
scale: z.number().positive()
|
|
2554
|
+
});
|
|
2205
2555
|
const downloadCanvasRenderInputSchema = z.object({ jobId: z.uuid() });
|
|
2206
2556
|
const downloadCanvasRenderOutputSchema = z.object({
|
|
2207
2557
|
jobId: z.uuid(),
|
|
@@ -2582,6 +2932,7 @@ const canvasKnownNodeStylePatchSchema = canvasTextStylePatchSchema.extend(canvas
|
|
|
2582
2932
|
"inset-inline": layoutStylePatchValue,
|
|
2583
2933
|
"inset-inline-end": layoutStylePatchValue,
|
|
2584
2934
|
"inset-inline-start": layoutStylePatchValue,
|
|
2935
|
+
isolation: layoutStylePatchValue,
|
|
2585
2936
|
"justify-content": layoutStylePatchValue,
|
|
2586
2937
|
left: layoutStylePatchValue,
|
|
2587
2938
|
margin: layoutStylePatchValue,
|
|
@@ -2801,7 +3152,7 @@ const canvasSetStylesOperationSchema = z.object({
|
|
|
2801
3152
|
styles: canvasNodeStylePatchSchema,
|
|
2802
3153
|
clear: z.array(canvasRestorableStylePropertySchema).min(1).refine((properties) => new Set(properties).size === properties.length).optional()
|
|
2803
3154
|
}).refine((operation) => (operation.clear ?? []).every((property) => !Object.hasOwn(operation.styles, property)));
|
|
2804
|
-
const
|
|
3155
|
+
const currentCanvasOperationSchema = z.discriminatedUnion("op", [
|
|
2805
3156
|
insertConvertedSubtreeOperationSchema,
|
|
2806
3157
|
z.object({
|
|
2807
3158
|
op: z.literal("insertNode"),
|
|
@@ -2812,7 +3163,9 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
2812
3163
|
nodeId: nodeIdSchema$3,
|
|
2813
3164
|
documentVersion: z.number().int().nonnegative(),
|
|
2814
3165
|
versionEntryId: z.uuid().optional()
|
|
2815
|
-
}).optional()
|
|
3166
|
+
}).optional(),
|
|
3167
|
+
/** A page copy's base name; the API gives the copy the first free name from it. */
|
|
3168
|
+
pageCopyBase: z.string().refine((base) => base.trim() !== "").optional()
|
|
2816
3169
|
}),
|
|
2817
3170
|
placementSchema.extend({
|
|
2818
3171
|
op: z.literal("insertText"),
|
|
@@ -2939,11 +3292,6 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
2939
3292
|
nodeId: nodeIdSchema$3,
|
|
2940
3293
|
geometry: z.union([canvasGeometrySchema, z.literal("default")])
|
|
2941
3294
|
}),
|
|
2942
|
-
z.object({
|
|
2943
|
-
op: z.literal("setCompositing"),
|
|
2944
|
-
nodeId: nodeIdSchema$3,
|
|
2945
|
-
compositing: z.union([canvasCompositingSchema, z.literal("default")])
|
|
2946
|
-
}),
|
|
2947
3295
|
z.object({
|
|
2948
3296
|
op: z.literal("setProps"),
|
|
2949
3297
|
nodeId: nodeIdSchema$3,
|
|
@@ -2964,6 +3312,18 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
2964
3312
|
removedText: z.record(nodeIdSchema$3, canvasSceneNodeSchema.pick({ props: true })).optional()
|
|
2965
3313
|
})
|
|
2966
3314
|
]);
|
|
3315
|
+
/** An older client's compositing write is refused with the CSS that replaces it. */
|
|
3316
|
+
/** Each operation's name, for records that may state which kind failed and nothing else. */
|
|
3317
|
+
const CANVAS_OPERATION_NAMES = currentCanvasOperationSchema.options.map((option) => option.shape.op.value);
|
|
3318
|
+
const canvasOperationSchema = z.preprocess((value, context) => {
|
|
3319
|
+
if (typeof value !== "object" || value === null || Reflect.get(value, "op") !== "setCompositing") return value;
|
|
3320
|
+
context.issues.push({
|
|
3321
|
+
code: "custom",
|
|
3322
|
+
message: CANVAS_COMPOSITING_RETIRED,
|
|
3323
|
+
input: value
|
|
3324
|
+
});
|
|
3325
|
+
return z.NEVER;
|
|
3326
|
+
}, currentCanvasOperationSchema);
|
|
2967
3327
|
const createEditableFrameOutputSchema = createEditableFrameResultSchema.extend({
|
|
2968
3328
|
operation: insertConvertedSubtreeOperationSchema,
|
|
2969
3329
|
next: z.array(z.string().min(1))
|
|
@@ -2979,6 +3339,11 @@ const getCanvasDocumentInputSchema = z.object({
|
|
|
2979
3339
|
});
|
|
2980
3340
|
const documentScreenSchema = z.object({
|
|
2981
3341
|
screenId: z.uuid(),
|
|
3342
|
+
/**
|
|
3343
|
+
* The change identity the screen was reserved with, or the screen's own identity when it had
|
|
3344
|
+
* none. A capture's layer is named after it.
|
|
3345
|
+
*/
|
|
3346
|
+
clientToken: z.uuid(),
|
|
2982
3347
|
/** Null for a link visitor. Always present on the agent surface. */
|
|
2983
3348
|
route: z.string().nullable(),
|
|
2984
3349
|
title: z.string().nullable(),
|
|
@@ -3165,7 +3530,6 @@ const inspectCanvasNodeOutputSchema = z.object({
|
|
|
3165
3530
|
styles: z.record(z.string(), z.union([z.string(), z.number()])),
|
|
3166
3531
|
layout: canvasNodeLayoutSchema.optional(),
|
|
3167
3532
|
appearance: canvasAppearanceValuesSchema.optional(),
|
|
3168
|
-
compositing: canvasCompositingSchema.optional(),
|
|
3169
3533
|
geometry: canvasGeometrySchema.optional(),
|
|
3170
3534
|
typography: canvasAuthoredTypographySchema.optional(),
|
|
3171
3535
|
additionalStyles: canvasAdditionalStylesSchema.optional(),
|
|
@@ -3216,7 +3580,7 @@ const releasedGridPolicy = (held, properties) => {
|
|
|
3216
3580
|
return layout;
|
|
3217
3581
|
};
|
|
3218
3582
|
/** A shorthand can release several named controls; a longhand releases only itself. */
|
|
3219
|
-
const
|
|
3583
|
+
const canvasLayoutReleasedFields = (held, changed) => {
|
|
3220
3584
|
const properties = new Set([...changed].flatMap((property) => canvasCssPropertyScope(property)));
|
|
3221
3585
|
const layout = releasedGridPolicy(held, properties);
|
|
3222
3586
|
for (const [key, property] of CANVAS_LAYOUT_CSS_FIELDS) if (properties.has(property)) Reflect.deleteProperty(layout, key);
|
|
@@ -3252,7 +3616,7 @@ const axisWithoutCssBounds = (intent, properties, changed) => {
|
|
|
3252
3616
|
/** Editors hand CSS control back property by property; absent presets stay absent. */
|
|
3253
3617
|
const canvasLayoutWithoutCssProperties = (held, changed, axes) => {
|
|
3254
3618
|
const properties = new Set([...changed].flatMap((property) => canvasCssPropertyScope(property)));
|
|
3255
|
-
const layout =
|
|
3619
|
+
const layout = canvasLayoutReleasedFields(held, properties);
|
|
3256
3620
|
if (properties.has("display")) Reflect.deleteProperty(layout, "retainedFlexSpacing");
|
|
3257
3621
|
if ([
|
|
3258
3622
|
"overflow",
|
|
@@ -3643,80 +4007,6 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
3643
4007
|
const canvasObjectKindDescriptor = (objectKind) => DESCRIPTOR_BY_KIND[objectKind] ?? null;
|
|
3644
4008
|
const canvasPropertySectionsForKind = (objectKind) => canvasObjectKindDescriptor(objectKind)?.propertySections ?? [];
|
|
3645
4009
|
|
|
3646
|
-
//#endregion
|
|
3647
|
-
//#region ../../packages/contract/src/canvas/canvas-reference-scope.lib.ts
|
|
3648
|
-
const ROOT_ID = "root";
|
|
3649
|
-
const DEFAULT_CANVAS_REFERENCE_PAGE_ID = "canvas-page-default";
|
|
3650
|
-
const rootIdsOf = (document) => Object.entries(document.relationships).filter(([, relationship]) => relationship.parentId === ROOT_ID).toSorted(([firstId, first], [secondId, second]) => first.sortKey === second.sortKey ? firstId.localeCompare(secondId) : first.sortKey < second.sortKey ? -1 : 1).map(([id]) => id);
|
|
3651
|
-
const canvasReferencePageIds = (document) => {
|
|
3652
|
-
const pages = rootIdsOf(document).filter((id) => document.nodes[id]?.component === PAGE_KIND);
|
|
3653
|
-
return pages.length > 0 ? pages : [DEFAULT_CANVAS_REFERENCE_PAGE_ID];
|
|
3654
|
-
};
|
|
3655
|
-
const canvasReferencePageOf = (document, nodeId) => {
|
|
3656
|
-
const visited = /* @__PURE__ */ new Set();
|
|
3657
|
-
let currentId = nodeId;
|
|
3658
|
-
while (currentId !== void 0 && !visited.has(currentId)) {
|
|
3659
|
-
visited.add(currentId);
|
|
3660
|
-
const node = document.nodes[currentId];
|
|
3661
|
-
if (node === void 0 || node.component === "page") return null;
|
|
3662
|
-
const parentId = document.relationships[currentId]?.parentId;
|
|
3663
|
-
if (parentId === ROOT_ID) {
|
|
3664
|
-
const assigned = node.props?.["canvasPageId"];
|
|
3665
|
-
return typeof assigned === "string" ? assigned : DEFAULT_CANVAS_REFERENCE_PAGE_ID;
|
|
3666
|
-
}
|
|
3667
|
-
currentId = parentId;
|
|
3668
|
-
}
|
|
3669
|
-
return null;
|
|
3670
|
-
};
|
|
3671
|
-
const descendantsOf = (document, rootIds) => {
|
|
3672
|
-
const children = /* @__PURE__ */ new Map();
|
|
3673
|
-
for (const [id, relation] of Object.entries(document.relationships)) {
|
|
3674
|
-
const siblings = children.get(relation.parentId) ?? [];
|
|
3675
|
-
siblings.push(id);
|
|
3676
|
-
children.set(relation.parentId, siblings);
|
|
3677
|
-
}
|
|
3678
|
-
const result = /* @__PURE__ */ new Set();
|
|
3679
|
-
const pending = [...rootIds];
|
|
3680
|
-
while (pending.length > 0) {
|
|
3681
|
-
const id = pending.pop();
|
|
3682
|
-
if (id === void 0 || result.has(id) || document.nodes[id] === void 0) continue;
|
|
3683
|
-
result.add(id);
|
|
3684
|
-
pending.push(...children.get(id) ?? []);
|
|
3685
|
-
}
|
|
3686
|
-
return result;
|
|
3687
|
-
};
|
|
3688
|
-
const resolveCanvasReference = (reference, document) => {
|
|
3689
|
-
const pages = canvasReferencePageIds(document);
|
|
3690
|
-
if (reference.pageId !== void 0 && !pages.includes(reference.pageId)) return {
|
|
3691
|
-
ok: false,
|
|
3692
|
-
reason: "page"
|
|
3693
|
-
};
|
|
3694
|
-
const selectionPages = reference.nodeIds.map((id) => canvasReferencePageOf(document, id));
|
|
3695
|
-
if (selectionPages.some((pageId) => pageId === null || !pages.includes(pageId))) return {
|
|
3696
|
-
ok: false,
|
|
3697
|
-
reason: "selection"
|
|
3698
|
-
};
|
|
3699
|
-
if (reference.pageId !== void 0 && selectionPages.some((pageId) => pageId !== reference.pageId)) return {
|
|
3700
|
-
ok: false,
|
|
3701
|
-
reason: "inconsistent-page"
|
|
3702
|
-
};
|
|
3703
|
-
if (new Set(selectionPages).size > 1) return {
|
|
3704
|
-
ok: false,
|
|
3705
|
-
reason: "mixed-pages"
|
|
3706
|
-
};
|
|
3707
|
-
const pageId = reference.pageId ?? selectionPages[0] ?? null;
|
|
3708
|
-
const rootNodeIds = reference.nodeIds.length > 0 ? [...new Set(reference.nodeIds)] : rootIdsOf(document).filter((id) => {
|
|
3709
|
-
const ownedPage = canvasReferencePageOf(document, id);
|
|
3710
|
-
return ownedPage !== null && (pageId === null || ownedPage === pageId);
|
|
3711
|
-
});
|
|
3712
|
-
return {
|
|
3713
|
-
ok: true,
|
|
3714
|
-
pageId,
|
|
3715
|
-
rootNodeIds,
|
|
3716
|
-
nodeIds: descendantsOf(document, rootNodeIds)
|
|
3717
|
-
};
|
|
3718
|
-
};
|
|
3719
|
-
|
|
3720
4010
|
//#endregion
|
|
3721
4011
|
//#region ../../packages/contract/src/canvas/canvas-preparation.schema.ts
|
|
3722
4012
|
const nodeId$5 = canvasSceneNodeSchema.shape.id;
|
|
@@ -3951,6 +4241,36 @@ const agentClientMetadata = (value) => {
|
|
|
3951
4241
|
return { path: transport.success ? transport.data.path : "direct_cli" };
|
|
3952
4242
|
};
|
|
3953
4243
|
|
|
4244
|
+
//#endregion
|
|
4245
|
+
//#region ../../packages/contract/src/canvas/canvas-realtime-view.schema.ts
|
|
4246
|
+
/** The follow colours: the 500 shade of twelve approved colours, never the focus orange. */
|
|
4247
|
+
const followColourSchema = z.enum([
|
|
4248
|
+
"green",
|
|
4249
|
+
"blue",
|
|
4250
|
+
"indigo",
|
|
4251
|
+
"amber",
|
|
4252
|
+
"lime",
|
|
4253
|
+
"teal",
|
|
4254
|
+
"cyan",
|
|
4255
|
+
"sky",
|
|
4256
|
+
"violet",
|
|
4257
|
+
"purple",
|
|
4258
|
+
"fuchsia",
|
|
4259
|
+
"pink"
|
|
4260
|
+
]);
|
|
4261
|
+
const canvasViewKeySchema = z.string().regex(/^[0-9a-f]{32}$/);
|
|
4262
|
+
/** The fields the room adds to a room identity for one open view. */
|
|
4263
|
+
const canvasRoomViewSchema = z.object({
|
|
4264
|
+
viewKey: canvasViewKeySchema.optional(),
|
|
4265
|
+
admissionOrder: z.number().int().nonnegative().optional(),
|
|
4266
|
+
followColour: followColourSchema.optional()
|
|
4267
|
+
});
|
|
4268
|
+
/** The page a presence value belongs to (null when not known), and the view it follows. */
|
|
4269
|
+
const canvasPresenceViewSchema = z.object({
|
|
4270
|
+
pageId: z.string().min(1).nullable().optional(),
|
|
4271
|
+
followingViewKey: canvasViewKeySchema.nullable().optional()
|
|
4272
|
+
});
|
|
4273
|
+
|
|
3954
4274
|
//#endregion
|
|
3955
4275
|
//#region ../../packages/contract/src/canvas/canvas-realtime.schema.ts
|
|
3956
4276
|
const CANVAS_REALTIME_PROTOCOL = "enhance3.canvas.v1";
|
|
@@ -3961,7 +4281,6 @@ const MAX_CANVAS_PRESENCE_DETAIL_BYTES = 16384;
|
|
|
3961
4281
|
const MAX_CANVAS_SELECTION_CHUNK_IDS = 1e3;
|
|
3962
4282
|
const MAX_CANVAS_SELECTION_CHUNK_BYTES = 49152;
|
|
3963
4283
|
const MAX_ACTIVITY_TARGETS = 100;
|
|
3964
|
-
const MAX_REALTIME_TICKET_LENGTH = 4096;
|
|
3965
4284
|
const MAX_ERROR_MESSAGE_LENGTH = 200;
|
|
3966
4285
|
const MAX_CURSOR_CHAT_LENGTH = 140;
|
|
3967
4286
|
const canvasActorColourSchema = z.enum([
|
|
@@ -3974,7 +4293,7 @@ const canvasActorColourSchema = z.enum([
|
|
|
3974
4293
|
"red",
|
|
3975
4294
|
"orange"
|
|
3976
4295
|
]);
|
|
3977
|
-
const
|
|
4296
|
+
const personRoomIdentitySchema = z.object({
|
|
3978
4297
|
kind: z.literal("person"),
|
|
3979
4298
|
connectionId: z.uuid(),
|
|
3980
4299
|
personId: z.uuid(),
|
|
@@ -3983,12 +4302,14 @@ const personRoomActorSchema = z.object({
|
|
|
3983
4302
|
avatarUrl: z.string().max(MAX_URL_LENGTH).nullable().optional(),
|
|
3984
4303
|
colour: canvasActorColourSchema
|
|
3985
4304
|
});
|
|
4305
|
+
const personRoomActorSchema = personRoomIdentitySchema.extend(canvasRoomViewSchema.shape);
|
|
3986
4306
|
const guestRoomActorSchema = z.object({
|
|
3987
4307
|
kind: z.literal("guest"),
|
|
3988
4308
|
connectionId: z.uuid(),
|
|
3989
4309
|
displayName: z.string().min(1).max(MAX_DISPLAY_NAME_LENGTH),
|
|
3990
4310
|
initials: z.string().min(1).max(MAX_INITIALS_LENGTH),
|
|
3991
|
-
colour: canvasActorColourSchema
|
|
4311
|
+
colour: canvasActorColourSchema,
|
|
4312
|
+
...canvasRoomViewSchema.shape
|
|
3992
4313
|
});
|
|
3993
4314
|
const canvasRoomActorSchema = z.discriminatedUnion("kind", [personRoomActorSchema, guestRoomActorSchema]);
|
|
3994
4315
|
const agentMutationActorSchema = z.object({
|
|
@@ -4000,7 +4321,7 @@ const agentMutationActorSchema = z.object({
|
|
|
4000
4321
|
agentAttribution: agentClientPropertiesSchema.optional(),
|
|
4001
4322
|
colour: canvasActorColourSchema
|
|
4002
4323
|
});
|
|
4003
|
-
const canvasMutationActorSchema = z.discriminatedUnion("kind", [
|
|
4324
|
+
const canvasMutationActorSchema = z.discriminatedUnion("kind", [personRoomIdentitySchema.omit({
|
|
4004
4325
|
connectionId: true,
|
|
4005
4326
|
avatarUrl: true
|
|
4006
4327
|
}), agentMutationActorSchema]);
|
|
@@ -4034,7 +4355,8 @@ const canvasPresencePatchSchema = z.object({
|
|
|
4034
4355
|
selectionSummary: selectionSummarySchema.nullable().optional(),
|
|
4035
4356
|
visibleWorldBox: visibleWorldBoxSchema.optional(),
|
|
4036
4357
|
gesture: gesturePreviewSchema.nullable().optional(),
|
|
4037
|
-
cursorChat: z.string().max(140).nullable().optional()
|
|
4358
|
+
cursorChat: z.string().max(140).nullable().optional(),
|
|
4359
|
+
...canvasPresenceViewSchema.shape
|
|
4038
4360
|
}).refine((patch) => Object.keys(patch).length > 0, "presence patch cannot be empty");
|
|
4039
4361
|
const canvasPresenceSchema = z.object({
|
|
4040
4362
|
actor: canvasRoomActorSchema,
|
|
@@ -4051,6 +4373,8 @@ const canvasPresenceSchema = z.object({
|
|
|
4051
4373
|
visibleWorldBox: visibleWorldBoxSchema.nullable(),
|
|
4052
4374
|
gesture: gesturePreviewSchema.nullable(),
|
|
4053
4375
|
cursorChat: z.string().max(140).nullable().default(null),
|
|
4376
|
+
...canvasPresenceViewSchema.shape,
|
|
4377
|
+
followOrder: z.number().int().nonnegative().optional(),
|
|
4054
4378
|
expiresAt: z.iso.datetime()
|
|
4055
4379
|
});
|
|
4056
4380
|
const canvasAgentActivityPhaseSchema = z.enum([
|
|
@@ -4069,16 +4393,6 @@ const canvasAgentActivitySchema = z.object({
|
|
|
4069
4393
|
bounds: visibleWorldBoxSchema.nullable(),
|
|
4070
4394
|
expiresAt: z.iso.datetime()
|
|
4071
4395
|
});
|
|
4072
|
-
const canvasRealtimeTicketInputSchema = z.object({
|
|
4073
|
-
canvasId: z.uuid(),
|
|
4074
|
-
protocols: z.array(z.literal(CANVAS_REALTIME_PROTOCOL)).min(1).max(1)
|
|
4075
|
-
});
|
|
4076
|
-
const canvasRealtimeTicketOutputSchema = z.object({
|
|
4077
|
-
endpoint: z.url(),
|
|
4078
|
-
ticket: z.string().min(1).max(MAX_REALTIME_TICKET_LENGTH),
|
|
4079
|
-
protocol: z.literal(CANVAS_REALTIME_PROTOCOL),
|
|
4080
|
-
expiresAt: z.iso.datetime()
|
|
4081
|
-
});
|
|
4082
4396
|
const beginCanvasActivityInputSchema = z.object({
|
|
4083
4397
|
canvasId: z.uuid(),
|
|
4084
4398
|
phase: canvasAgentActivityPhaseSchema,
|
|
@@ -4121,6 +4435,7 @@ const canvasRealtimeServerEnvelopeSchema = z.discriminatedUnion("type", [
|
|
|
4121
4435
|
type: z.literal("room.snapshot"),
|
|
4122
4436
|
payload: z.object({
|
|
4123
4437
|
connectionId: z.uuid(),
|
|
4438
|
+
viewKey: canvasRoomViewSchema.shape.viewKey,
|
|
4124
4439
|
peers: z.array(canvasPresenceSchema),
|
|
4125
4440
|
activities: z.array(canvasAgentActivitySchema),
|
|
4126
4441
|
documentVersion: z.number().int().positive()
|
|
@@ -4227,6 +4542,21 @@ const canvasRealtimeClientEnvelopeSchema = z.discriminatedUnion("type", [
|
|
|
4227
4542
|
})
|
|
4228
4543
|
]).refine((envelope) => envelope.type !== "selection.chunk" || envelope.payload.offset + envelope.payload.nodeIds.length <= envelope.payload.total && new TextEncoder().encode(JSON.stringify(envelope)).byteLength <= 49152);
|
|
4229
4544
|
|
|
4545
|
+
//#endregion
|
|
4546
|
+
//#region ../../packages/contract/src/canvas/canvas-realtime-ticket.schema.ts
|
|
4547
|
+
const MAX_REALTIME_TICKET_LENGTH = 4096;
|
|
4548
|
+
const canvasRealtimeTicketInputSchema = z.object({
|
|
4549
|
+
canvasId: z.uuid(),
|
|
4550
|
+
protocols: z.array(z.literal(CANVAS_REALTIME_PROTOCOL)).min(1).max(1),
|
|
4551
|
+
viewId: z.uuid().optional()
|
|
4552
|
+
});
|
|
4553
|
+
const canvasRealtimeTicketOutputSchema = z.object({
|
|
4554
|
+
endpoint: z.url(),
|
|
4555
|
+
ticket: z.string().min(1).max(MAX_REALTIME_TICKET_LENGTH),
|
|
4556
|
+
protocol: z.literal(CANVAS_REALTIME_PROTOCOL),
|
|
4557
|
+
expiresAt: z.iso.datetime()
|
|
4558
|
+
});
|
|
4559
|
+
|
|
4230
4560
|
//#endregion
|
|
4231
4561
|
//#region ../../packages/contract/src/canvas/canvas-reference.lib.ts
|
|
4232
4562
|
const canvasIdSchema = z.uuid();
|
|
@@ -4311,6 +4641,80 @@ const buildCanvasReference = (origin, reference) => {
|
|
|
4311
4641
|
} : read;
|
|
4312
4642
|
};
|
|
4313
4643
|
|
|
4644
|
+
//#endregion
|
|
4645
|
+
//#region ../../packages/contract/src/canvas/canvas-reference-scope.lib.ts
|
|
4646
|
+
const ROOT_ID = "root";
|
|
4647
|
+
const DEFAULT_CANVAS_REFERENCE_PAGE_ID = "canvas-page-default";
|
|
4648
|
+
const rootIdsOf = (document) => Object.entries(document.relationships).filter(([, relationship]) => relationship.parentId === ROOT_ID).toSorted(([firstId, first], [secondId, second]) => first.sortKey === second.sortKey ? firstId.localeCompare(secondId) : first.sortKey < second.sortKey ? -1 : 1).map(([id]) => id);
|
|
4649
|
+
const canvasReferencePageIds = (document) => {
|
|
4650
|
+
const pages = rootIdsOf(document).filter((id) => document.nodes[id]?.component === PAGE_KIND);
|
|
4651
|
+
return pages.length > 0 ? pages : [DEFAULT_CANVAS_REFERENCE_PAGE_ID];
|
|
4652
|
+
};
|
|
4653
|
+
const canvasReferencePageOf = (document, nodeId) => {
|
|
4654
|
+
const visited = /* @__PURE__ */ new Set();
|
|
4655
|
+
let currentId = nodeId;
|
|
4656
|
+
while (currentId !== void 0 && !visited.has(currentId)) {
|
|
4657
|
+
visited.add(currentId);
|
|
4658
|
+
const node = document.nodes[currentId];
|
|
4659
|
+
if (node === void 0 || node.component === "page") return null;
|
|
4660
|
+
const parentId = document.relationships[currentId]?.parentId;
|
|
4661
|
+
if (parentId === ROOT_ID) {
|
|
4662
|
+
const assigned = node.props?.["canvasPageId"];
|
|
4663
|
+
return typeof assigned === "string" ? assigned : DEFAULT_CANVAS_REFERENCE_PAGE_ID;
|
|
4664
|
+
}
|
|
4665
|
+
currentId = parentId;
|
|
4666
|
+
}
|
|
4667
|
+
return null;
|
|
4668
|
+
};
|
|
4669
|
+
const descendantsOf = (document, rootIds) => {
|
|
4670
|
+
const children = /* @__PURE__ */ new Map();
|
|
4671
|
+
for (const [id, relation] of Object.entries(document.relationships)) {
|
|
4672
|
+
const siblings = children.get(relation.parentId) ?? [];
|
|
4673
|
+
siblings.push(id);
|
|
4674
|
+
children.set(relation.parentId, siblings);
|
|
4675
|
+
}
|
|
4676
|
+
const result = /* @__PURE__ */ new Set();
|
|
4677
|
+
const pending = [...rootIds];
|
|
4678
|
+
while (pending.length > 0) {
|
|
4679
|
+
const id = pending.pop();
|
|
4680
|
+
if (id === void 0 || result.has(id) || document.nodes[id] === void 0) continue;
|
|
4681
|
+
result.add(id);
|
|
4682
|
+
pending.push(...children.get(id) ?? []);
|
|
4683
|
+
}
|
|
4684
|
+
return result;
|
|
4685
|
+
};
|
|
4686
|
+
const resolveCanvasReference = (reference, document) => {
|
|
4687
|
+
const pages = canvasReferencePageIds(document);
|
|
4688
|
+
if (reference.pageId !== void 0 && !pages.includes(reference.pageId)) return {
|
|
4689
|
+
ok: false,
|
|
4690
|
+
reason: "page"
|
|
4691
|
+
};
|
|
4692
|
+
const selectionPages = reference.nodeIds.map((id) => canvasReferencePageOf(document, id));
|
|
4693
|
+
if (selectionPages.some((pageId) => pageId === null || !pages.includes(pageId))) return {
|
|
4694
|
+
ok: false,
|
|
4695
|
+
reason: "selection"
|
|
4696
|
+
};
|
|
4697
|
+
if (reference.pageId !== void 0 && selectionPages.some((pageId) => pageId !== reference.pageId)) return {
|
|
4698
|
+
ok: false,
|
|
4699
|
+
reason: "inconsistent-page"
|
|
4700
|
+
};
|
|
4701
|
+
if (new Set(selectionPages).size > 1) return {
|
|
4702
|
+
ok: false,
|
|
4703
|
+
reason: "mixed-pages"
|
|
4704
|
+
};
|
|
4705
|
+
const pageId = reference.pageId ?? selectionPages[0] ?? null;
|
|
4706
|
+
const rootNodeIds = reference.nodeIds.length > 0 ? [...new Set(reference.nodeIds)] : rootIdsOf(document).filter((id) => {
|
|
4707
|
+
const ownedPage = canvasReferencePageOf(document, id);
|
|
4708
|
+
return ownedPage !== null && (pageId === null || ownedPage === pageId);
|
|
4709
|
+
});
|
|
4710
|
+
return {
|
|
4711
|
+
ok: true,
|
|
4712
|
+
pageId,
|
|
4713
|
+
rootNodeIds,
|
|
4714
|
+
nodeIds: descendantsOf(document, rootNodeIds)
|
|
4715
|
+
};
|
|
4716
|
+
};
|
|
4717
|
+
|
|
4314
4718
|
//#endregion
|
|
4315
4719
|
//#region ../../packages/contract/src/canvas/canvas-render-exposure.schema.ts
|
|
4316
4720
|
/** The only job metadata exposed to the browser carrying a one-job render grant. */
|
|
@@ -4335,7 +4739,8 @@ const exposeCanvasRenderOutputSchema = z.discriminatedUnion("purpose", [
|
|
|
4335
4739
|
purpose: z.enum([
|
|
4336
4740
|
"inspection",
|
|
4337
4741
|
"snapshot",
|
|
4338
|
-
"thumbnail"
|
|
4742
|
+
"thumbnail",
|
|
4743
|
+
"export"
|
|
4339
4744
|
]),
|
|
4340
4745
|
scale: z.number().positive(),
|
|
4341
4746
|
maxOutputPixels: canvasRenderPixelLimitSchema.optional(),
|
|
@@ -4389,7 +4794,8 @@ const claimRenderWorkOutputSchema = z.discriminatedUnion("purpose", [
|
|
|
4389
4794
|
purpose: z.enum([
|
|
4390
4795
|
"inspection",
|
|
4391
4796
|
"snapshot",
|
|
4392
|
-
"thumbnail"
|
|
4797
|
+
"thumbnail",
|
|
4798
|
+
"export"
|
|
4393
4799
|
]),
|
|
4394
4800
|
target: canvasRenderTargetSchema,
|
|
4395
4801
|
sourceState: canvasRenderSourceStateSchema.optional(),
|
|
@@ -4491,6 +4897,8 @@ const renderRouteStateBaseSchema = z.object({
|
|
|
4491
4897
|
const renderRouteCaptureSchema = z.object({
|
|
4492
4898
|
selector: z.string().min(1).max(MAX_RENDER_CAPTURE_SELECTOR_LENGTH),
|
|
4493
4899
|
contentSelector: z.string().min(1).max(MAX_RENDER_CAPTURE_SELECTOR_LENGTH).optional(),
|
|
4900
|
+
/** An export's layer draws something, so a picture with no pixel in it went wrong. */
|
|
4901
|
+
expectsPaint: z.boolean().optional(),
|
|
4494
4902
|
bounds: canvasWorldBoundsSchema,
|
|
4495
4903
|
width: z.number().int().positive(),
|
|
4496
4904
|
height: z.number().int().positive(),
|
|
@@ -4856,6 +5264,13 @@ const textRunFormattingOf = (command) => ({
|
|
|
4856
5264
|
...command.decorationBlendMode !== void 0 && { decorationBlendMode: command.decorationBlendMode },
|
|
4857
5265
|
...command.backgroundBlendMode !== void 0 && { backgroundBlendMode: command.backgroundBlendMode }
|
|
4858
5266
|
});
|
|
5267
|
+
/** A run that loses its address loses the styles the link added with it. */
|
|
5268
|
+
const withoutLink = (span) => {
|
|
5269
|
+
if (span.href !== void 0) {
|
|
5270
|
+
for (const [property, value] of Object.entries(LINK_STYLES)) if (span.styles[property] === value) Reflect.deleteProperty(span.styles, property);
|
|
5271
|
+
}
|
|
5272
|
+
Reflect.deleteProperty(span, "href");
|
|
5273
|
+
};
|
|
4859
5274
|
const clearedOverrides = (nodes, command) => nodes.flatMap((node) => {
|
|
4860
5275
|
if (node.kind !== "span") return [node];
|
|
4861
5276
|
const next = {
|
|
@@ -4881,11 +5296,11 @@ const clearedOverrides = (nodes, command) => nodes.flatMap((node) => {
|
|
|
4881
5296
|
Reflect.deleteProperty(next, "textStyle");
|
|
4882
5297
|
return [next];
|
|
4883
5298
|
}
|
|
4884
|
-
if (command.type === "link")
|
|
5299
|
+
if (command.type === "link") withoutLink(next);
|
|
4885
5300
|
else if (command.type === "paint") {
|
|
4886
5301
|
Reflect.deleteProperty(next, "fills");
|
|
4887
5302
|
Reflect.deleteProperty(next.styles, "color");
|
|
4888
|
-
} else for (const property of
|
|
5303
|
+
} else for (const property of canvasRunStylesClearedBy(command)) Reflect.deleteProperty(next.styles, property);
|
|
4889
5304
|
const metadata = Object.keys(next).filter((key) => ![
|
|
4890
5305
|
"kind",
|
|
4891
5306
|
"children",
|
|
@@ -4893,14 +5308,14 @@ const clearedOverrides = (nodes, command) => nodes.flatMap((node) => {
|
|
|
4893
5308
|
].includes(key));
|
|
4894
5309
|
return Object.keys(next.styles).length === 0 && metadata.length === 0 ? next.children : [next];
|
|
4895
5310
|
});
|
|
4896
|
-
/** Leading and decoration must share the glyph's font; outer spans add a second line-box strut. */
|
|
5311
|
+
/** Leading and decoration must share the glyph's font; outer spans add a second line-box strut. A link span keeps only its own styles, so removing the link leaves the person's. */
|
|
4897
5312
|
const metricRuns = (nodes, styles) => nodes.map((node) => {
|
|
4898
5313
|
if (node.kind !== "span") return {
|
|
4899
5314
|
kind: "span",
|
|
4900
5315
|
styles,
|
|
4901
5316
|
children: [node]
|
|
4902
5317
|
};
|
|
4903
|
-
return node.children.some((child) => child.kind === "span") ? {
|
|
5318
|
+
return node.href !== void 0 || node.children.some((child) => child.kind === "span") ? {
|
|
4904
5319
|
...node,
|
|
4905
5320
|
children: metricRuns(node.children, styles)
|
|
4906
5321
|
} : {
|
|
@@ -4917,7 +5332,7 @@ const linkedRuns = (nodes, command) => {
|
|
|
4917
5332
|
const children = clearedOverrides(nodes, command);
|
|
4918
5333
|
return command.href === null ? children : [{
|
|
4919
5334
|
kind: "span",
|
|
4920
|
-
styles:
|
|
5335
|
+
styles: LINK_STYLES,
|
|
4921
5336
|
href: command.href,
|
|
4922
5337
|
children
|
|
4923
5338
|
}];
|
|
@@ -5030,19 +5445,34 @@ const insertedText = (text, source) => text.split(/([\n\u{2028}])/u).flatMap((pa
|
|
|
5030
5445
|
kind: "text",
|
|
5031
5446
|
text: part
|
|
5032
5447
|
}]);
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5448
|
+
/** Before the caret, or after it at the start of the text and of a paragraph; a selection keeps its first character. */
|
|
5449
|
+
const typedCharacterOf = (text, range) => range.start !== range.end || range.start === 0 || text.charAt(range.start - 1) === "\n" ? range.start : range.start - 1;
|
|
5450
|
+
const withText = (nodes, text) => nodes.flatMap((node) => node.kind === "span" ? [{
|
|
5451
|
+
...node,
|
|
5452
|
+
children: withText(node.children, text)
|
|
5453
|
+
}] : insertedText(text, node));
|
|
5454
|
+
const lastRunWith = (nodes, text) => {
|
|
5455
|
+
const last = nodes.at(-1);
|
|
5456
|
+
return last?.kind === "span" ? [{
|
|
5457
|
+
...last,
|
|
5458
|
+
children: lastRunWith(last.children, text)
|
|
5459
|
+
}] : insertedText(text, last);
|
|
5045
5460
|
};
|
|
5461
|
+
/**
|
|
5462
|
+
* 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.
|
|
5465
|
+
*/
|
|
5466
|
+
const canvasTextTypedFormatting = (runs, range) => {
|
|
5467
|
+
const index = typedCharacterOf(canvasRichTextValueOf(runs), range);
|
|
5468
|
+
const character = sliceRuns(runs, index, index + 1);
|
|
5469
|
+
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, {
|
|
5471
|
+
type: "link",
|
|
5472
|
+
href: null
|
|
5473
|
+
}) : formatting;
|
|
5474
|
+
};
|
|
5475
|
+
const insertedRuns = (nodes, range, text, shouldKeepEmpty = false) => text === "" && !shouldKeepEmpty ? [] : withText(canvasTextTypedFormatting(nodes, range), text);
|
|
5046
5476
|
const canvasTextReplacementRange = (before, text, range) => {
|
|
5047
5477
|
const replacementEnd = text.length - before.length + (range?.end ?? 0);
|
|
5048
5478
|
if (range !== void 0 && isValidTextRange(before, range) && isValidTextRange(text, {
|
|
@@ -5156,13 +5586,8 @@ const replacementRuns = (runs, range, command) => {
|
|
|
5156
5586
|
if (rich.length > 0) return rich;
|
|
5157
5587
|
}
|
|
5158
5588
|
const shouldKeepEmpty = range.start === 0 && range.end === canvasRichTextValueOf(runs).length;
|
|
5159
|
-
let next = insertedRuns(runs, range
|
|
5589
|
+
let next = insertedRuns(runs, range, command.text, shouldKeepEmpty);
|
|
5160
5590
|
if (command.text === "") return next;
|
|
5161
|
-
const link = canvasRichTextLinkOf(sliceRuns(runs, range.start, range.start + 1));
|
|
5162
|
-
if (link !== null && range.start === range.end && canvasRichTextLinkOf(sliceRuns(runs, range.start - 1, range.start)) !== link) next = formattedRuns(next, {
|
|
5163
|
-
type: "link",
|
|
5164
|
-
href: null
|
|
5165
|
-
});
|
|
5166
5591
|
if (Object.keys(command.styles ?? {}).length > 0 || Object.keys(textRunFormattingOf(command)).length > 0) next = formattedRuns(next, {
|
|
5167
5592
|
type: "format",
|
|
5168
5593
|
styles: command.styles ?? {},
|
|
@@ -5725,6 +6150,7 @@ const participantSchema = z.object({
|
|
|
5725
6150
|
"in-progress",
|
|
5726
6151
|
"done"
|
|
5727
6152
|
]).nullable(),
|
|
6153
|
+
/** Always `null`: view times stay on their owner's dashboard. Kept because published plugins require it. */
|
|
5728
6154
|
lastViewedAt: z.iso.datetime().nullable()
|
|
5729
6155
|
});
|
|
5730
6156
|
const listParticipantsInputSchema = z.object({ canvasId: z.uuid() });
|
|
@@ -5760,13 +6186,14 @@ const setReviewStateOutputSchema = z.object({ reviewState: setReviewStateInputSc
|
|
|
5760
6186
|
|
|
5761
6187
|
//#endregion
|
|
5762
6188
|
//#region ../../packages/contract/src/capture/capture.schema.ts
|
|
6189
|
+
/** The longest journey, step, variant or label a capture may carry. */
|
|
5763
6190
|
const CAPTURE_KEY_LENGTH = 160;
|
|
5764
6191
|
const CAPTURE_METADATA_LENGTH = 200;
|
|
5765
6192
|
const CAPTURE_ISSUE_LENGTH = 500;
|
|
5766
6193
|
const CAPTURE_FAILURE_LENGTH = 1e3;
|
|
5767
6194
|
const CAPTURE_UPLOAD_BATCH_SIZE = 400;
|
|
5768
6195
|
const CAPTURE_FORMAT_VERSION = 1;
|
|
5769
|
-
const key = z.string().trim().min(1).max(
|
|
6196
|
+
const key = z.string().trim().min(1).max(160);
|
|
5770
6197
|
const digest$1 = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
5771
6198
|
const dimension = z.number().int().positive();
|
|
5772
6199
|
const captureKeySchema = z.strictObject({
|
|
@@ -5899,6 +6326,11 @@ const captureAttemptSchema = z.strictObject({
|
|
|
5899
6326
|
"interrupted",
|
|
5900
6327
|
"timedOut"
|
|
5901
6328
|
]),
|
|
6329
|
+
title: z.string().min(1).optional(),
|
|
6330
|
+
location: z.strictObject({
|
|
6331
|
+
file: z.string().min(1),
|
|
6332
|
+
line: z.number().int()
|
|
6333
|
+
}).optional(),
|
|
5902
6334
|
captures: z.array(captureArtifactSchema)
|
|
5903
6335
|
});
|
|
5904
6336
|
const captureManifestSchema = z.strictObject({
|
|
@@ -5985,7 +6417,31 @@ const reserveCaptureBlobsOutputSchema = z.strictObject({ uploads: z.array(z.stri
|
|
|
5985
6417
|
expiresAt: z.iso.datetime()
|
|
5986
6418
|
}).nullable()
|
|
5987
6419
|
})).max(CAPTURE_UPLOAD_BATCH_SIZE) });
|
|
5988
|
-
|
|
6420
|
+
|
|
6421
|
+
//#endregion
|
|
6422
|
+
//#region ../../packages/contract/src/capture/capture-name.lib.ts
|
|
6423
|
+
const CODE_LENGTH = 8;
|
|
6424
|
+
const FNV_OFFSET = 2166136261;
|
|
6425
|
+
const FNV_PRIME = 16777619;
|
|
6426
|
+
const HEX = 16;
|
|
6427
|
+
/** FNV-1a: a short code that is the same for the same text on every run and every platform. */
|
|
6428
|
+
const shortCode = (text) => {
|
|
6429
|
+
let hash = FNV_OFFSET;
|
|
6430
|
+
for (const character of text) {
|
|
6431
|
+
hash ^= character.codePointAt(0) ?? 0;
|
|
6432
|
+
hash = Math.imul(hash, FNV_PRIME) >>> 0;
|
|
6433
|
+
}
|
|
6434
|
+
return hash.toString(HEX).padStart(CODE_LENGTH, "0");
|
|
6435
|
+
};
|
|
6436
|
+
/**
|
|
6437
|
+
* A name within the key limit. A longer one keeps its start and gains a code made from the whole
|
|
6438
|
+
* name, so two long names that share a start stay apart and the same name always shortens the same way.
|
|
6439
|
+
*/
|
|
6440
|
+
const fitCaptureName = (name) => {
|
|
6441
|
+
const trimmed = name.trim();
|
|
6442
|
+
if (trimmed.length <= 160) return trimmed;
|
|
6443
|
+
return `${trimmed.slice(0, 160 - CODE_LENGTH - 1).trimEnd()} ${shortCode(trimmed)}`;
|
|
6444
|
+
};
|
|
5989
6445
|
|
|
5990
6446
|
//#endregion
|
|
5991
6447
|
//#region ../../packages/contract/src/comment/comment.schema.ts
|
|
@@ -6122,6 +6578,8 @@ const commentMessageSchema = z.object({
|
|
|
6122
6578
|
messageId: z.uuid(),
|
|
6123
6579
|
seq: z.number().int().min(1),
|
|
6124
6580
|
body: z.string().min(1),
|
|
6581
|
+
/** A deleted message keeps its place in the sequence, so pages still meet; readers hide it. */
|
|
6582
|
+
isDeleted: z.boolean(),
|
|
6125
6583
|
author: commentAuthorSchema,
|
|
6126
6584
|
createdAt: z.iso.datetime(),
|
|
6127
6585
|
/** A comment that changed after somebody read it should say so. */
|
|
@@ -6871,7 +7329,7 @@ const ROOT_FIXTURE_NODE_ID = "root";
|
|
|
6871
7329
|
const SORT_KEY_DIGITS = 4;
|
|
6872
7330
|
const sortKeyAt = (seat) => `a${String(seat).padStart(SORT_KEY_DIGITS, "0")}`;
|
|
6873
7331
|
const emptyFixtureDocument = () => ({
|
|
6874
|
-
version:
|
|
7332
|
+
version: 13,
|
|
6875
7333
|
nodes: { [ROOT_FIXTURE_NODE_ID]: {
|
|
6876
7334
|
id: ROOT_FIXTURE_NODE_ID,
|
|
6877
7335
|
label: "Canvas",
|
|
@@ -8079,7 +8537,9 @@ const refreshRecordingUploadOutputSchema = z.object({ upload: signedUploadSchema
|
|
|
8079
8537
|
const confirmRecordingUploadInputSchema = refreshRecordingUploadInputSchema.extend({ etag: z.string().min(1).max(200) });
|
|
8080
8538
|
const confirmRecordingUploadOutputSchema = z.object({ integrity: recordingIntegritySchema });
|
|
8081
8539
|
const listRecordingsInputSchema = z.object({ canvasId: z.uuid() });
|
|
8082
|
-
const listRecordingsOutputSchema = cappedSchema(recordingSummarySchema)
|
|
8540
|
+
const listRecordingsOutputSchema = cappedSchema(recordingSummarySchema).extend({
|
|
8541
|
+
/** Completed recordings left out because their facts are missing; the API logs each by ID. */
|
|
8542
|
+
unreadableCount: z.number().int().min(0) });
|
|
8083
8543
|
const discardRecordingInputSchema = z.object({ recordingId: z.uuid() });
|
|
8084
8544
|
const discardRecordingOutputSchema = z.object({
|
|
8085
8545
|
recordingId: z.uuid(),
|
|
@@ -8210,6 +8670,17 @@ const clientConversionInputSchema = z.object({
|
|
|
8210
8670
|
reason: z.enum([
|
|
8211
8671
|
"none",
|
|
8212
8672
|
"pending-changes",
|
|
8673
|
+
"editor-busy",
|
|
8674
|
+
"editor-stale",
|
|
8675
|
+
"editor-read-only",
|
|
8676
|
+
"source-missing",
|
|
8677
|
+
"editor-changed",
|
|
8678
|
+
"cancelled",
|
|
8679
|
+
"source-invalid-box",
|
|
8680
|
+
"source-loading",
|
|
8681
|
+
"source-unavailable",
|
|
8682
|
+
"source-unreadable",
|
|
8683
|
+
"source-changed",
|
|
8213
8684
|
"source-unsettled",
|
|
8214
8685
|
"captured-fonts-unavailable",
|
|
8215
8686
|
"conversion-failed"
|
|
@@ -8225,6 +8696,12 @@ const MAX_DURATION_MS$1 = 18e5;
|
|
|
8225
8696
|
const MAX_COUNT = 1e6;
|
|
8226
8697
|
const MAX_BYTES = 1073741824;
|
|
8227
8698
|
const MAX_PROTOTYPE_OPEN_ATTEMPTS = 16;
|
|
8699
|
+
/** How the read of a canvas's unsaved browser copy ended when the canvas opened. */
|
|
8700
|
+
const browserCopyCheckSchema = z.enum([
|
|
8701
|
+
"answered",
|
|
8702
|
+
"skipped",
|
|
8703
|
+
"none"
|
|
8704
|
+
]);
|
|
8228
8705
|
const durationSchema$1 = z.number().int().min(0).max(MAX_DURATION_MS$1);
|
|
8229
8706
|
const countSchema = z.number().int().min(0).max(MAX_COUNT);
|
|
8230
8707
|
const base$1 = {
|
|
@@ -8258,14 +8735,20 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
|
|
|
8258
8735
|
"ready",
|
|
8259
8736
|
"slow",
|
|
8260
8737
|
"degraded",
|
|
8261
|
-
"timed-out"
|
|
8738
|
+
"timed-out",
|
|
8739
|
+
"unavailable"
|
|
8262
8740
|
]),
|
|
8263
8741
|
bottleneck: z.enum([
|
|
8264
8742
|
"metadata",
|
|
8743
|
+
"details",
|
|
8744
|
+
"document",
|
|
8745
|
+
"walkthrough-list",
|
|
8746
|
+
"restore",
|
|
8265
8747
|
"projection",
|
|
8266
8748
|
"sources",
|
|
8267
8749
|
"replays"
|
|
8268
8750
|
]),
|
|
8751
|
+
browserCopyCheck: browserCopyCheckSchema.optional(),
|
|
8269
8752
|
durationMs: durationSchema$1,
|
|
8270
8753
|
shellMs: durationSchema$1,
|
|
8271
8754
|
projectionMs: durationSchema$1,
|
|
@@ -8293,7 +8776,12 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
|
|
|
8293
8776
|
"drag",
|
|
8294
8777
|
"edit"
|
|
8295
8778
|
]),
|
|
8296
|
-
outcome: z.enum([
|
|
8779
|
+
outcome: z.enum([
|
|
8780
|
+
"smooth",
|
|
8781
|
+
"janky",
|
|
8782
|
+
"refused"
|
|
8783
|
+
]),
|
|
8784
|
+
pendingCandidateCount: countSchema.optional(),
|
|
8297
8785
|
durationMs: durationSchema$1,
|
|
8298
8786
|
frameCount: countSchema,
|
|
8299
8787
|
slowFrameCount: countSchema,
|
|
@@ -8301,6 +8789,12 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
|
|
|
8301
8789
|
nodeCount: countSchema,
|
|
8302
8790
|
replayCount: countSchema
|
|
8303
8791
|
}),
|
|
8792
|
+
z.object({
|
|
8793
|
+
...base$1,
|
|
8794
|
+
name: z.literal("canvas_measurement"),
|
|
8795
|
+
outcome: z.literal("drift"),
|
|
8796
|
+
layerCount: countSchema
|
|
8797
|
+
}),
|
|
8304
8798
|
z.object({
|
|
8305
8799
|
...base$1,
|
|
8306
8800
|
name: z.literal("prototype_open"),
|
|
@@ -8369,6 +8863,7 @@ const clientPerformanceOutputSchema = z.object({ accepted: z.literal(true) });
|
|
|
8369
8863
|
const MAX_ASSET_LENGTH = 128;
|
|
8370
8864
|
const MAX_FRAME_COORDINATE = 1e7;
|
|
8371
8865
|
const MAX_FRAMES = 8;
|
|
8866
|
+
const count$1 = z.number().int().min(0).max(1e3);
|
|
8372
8867
|
const clientRenderFailureDetailsSchema = z.strictObject({
|
|
8373
8868
|
version: z.literal(1),
|
|
8374
8869
|
severity: z.enum([
|
|
@@ -8401,7 +8896,10 @@ const clientRenderFailureDetailsSchema = z.strictObject({
|
|
|
8401
8896
|
"export-incomplete",
|
|
8402
8897
|
"clipboard-unavailable",
|
|
8403
8898
|
"clipboard-image-pending",
|
|
8404
|
-
"clipboard-image-unavailable"
|
|
8899
|
+
"clipboard-image-unavailable",
|
|
8900
|
+
"edit-target-unsupported",
|
|
8901
|
+
"react-hook-order",
|
|
8902
|
+
"menu-rows-unsupported"
|
|
8405
8903
|
]),
|
|
8406
8904
|
controlId: z.enum([
|
|
8407
8905
|
"canvas-stacking",
|
|
@@ -8413,6 +8911,7 @@ const clientRenderFailureDetailsSchema = z.strictObject({
|
|
|
8413
8911
|
outcome: z.enum([
|
|
8414
8912
|
"failed",
|
|
8415
8913
|
"displayed",
|
|
8914
|
+
"shown",
|
|
8416
8915
|
"retried",
|
|
8417
8916
|
"recovered"
|
|
8418
8917
|
]),
|
|
@@ -8420,7 +8919,25 @@ const clientRenderFailureDetailsSchema = z.strictObject({
|
|
|
8420
8919
|
asset: z.string().max(MAX_ASSET_LENGTH).regex(/^[\w-][\w.-]*\.js$/u),
|
|
8421
8920
|
line: z.number().int().min(1).max(MAX_FRAME_COORDINATE),
|
|
8422
8921
|
column: z.number().int().min(1).max(MAX_FRAME_COORDINATE)
|
|
8423
|
-
})).max(MAX_FRAMES)
|
|
8922
|
+
})).max(MAX_FRAMES),
|
|
8923
|
+
occurredAt: z.iso.datetime().optional(),
|
|
8924
|
+
clientBuild: z.string().regex(/^[\w-]{1,64}$/u).optional(),
|
|
8925
|
+
frameStatus: z.enum([
|
|
8926
|
+
"recorded",
|
|
8927
|
+
"no-stack",
|
|
8928
|
+
"no-application-frames",
|
|
8929
|
+
"malformed-stack",
|
|
8930
|
+
"no-asset-list",
|
|
8931
|
+
"kept-local"
|
|
8932
|
+
]).optional(),
|
|
8933
|
+
subsystem: z.enum(["menu", "unknown"]).optional(),
|
|
8934
|
+
repeats: count$1.optional(),
|
|
8935
|
+
deliveryGap: z.strictObject({
|
|
8936
|
+
refused: count$1,
|
|
8937
|
+
expired: count$1,
|
|
8938
|
+
evicted: count$1,
|
|
8939
|
+
exhausted: count$1
|
|
8940
|
+
}).optional()
|
|
8424
8941
|
});
|
|
8425
8942
|
const incidentFields = {
|
|
8426
8943
|
incidentId: z.uuid(),
|
|
@@ -8438,6 +8955,24 @@ const clientRenderFailureInputSchema = z.discriminatedUnion("surface", [z.object
|
|
|
8438
8955
|
})]);
|
|
8439
8956
|
const clientRenderFailureOutputSchema = z.object({ accepted: z.literal(true) });
|
|
8440
8957
|
|
|
8958
|
+
//#endregion
|
|
8959
|
+
//#region ../../packages/contract/src/canvas/canvas-object-kinds.consts.ts
|
|
8960
|
+
/** Each object kind by name, for records that may state which kind and nothing else. */
|
|
8961
|
+
const CANVAS_OBJECT_KINDS = [
|
|
8962
|
+
"root",
|
|
8963
|
+
"page",
|
|
8964
|
+
"screen",
|
|
8965
|
+
"frame",
|
|
8966
|
+
"group",
|
|
8967
|
+
"rectangle",
|
|
8968
|
+
"image",
|
|
8969
|
+
"svg",
|
|
8970
|
+
"boolean",
|
|
8971
|
+
"recording",
|
|
8972
|
+
"prototype",
|
|
8973
|
+
"text"
|
|
8974
|
+
];
|
|
8975
|
+
|
|
8441
8976
|
//#endregion
|
|
8442
8977
|
//#region ../../packages/contract/src/shared/client-save.schema.ts
|
|
8443
8978
|
/** Why the sync owner could not merge pending text the ordinary way. Never document content. */
|
|
@@ -8464,7 +8999,9 @@ const CANVAS_SYNC_REPORTS = [
|
|
|
8464
8999
|
"replan",
|
|
8465
9000
|
"deleted-target",
|
|
8466
9001
|
"whole-value-text",
|
|
8467
|
-
"retrying"
|
|
9002
|
+
"retrying",
|
|
9003
|
+
"recovery",
|
|
9004
|
+
"trace"
|
|
8468
9005
|
];
|
|
8469
9006
|
const CANVAS_SYNC_DETAILS = [
|
|
8470
9007
|
...CLIENT_SAVE_ISSUES,
|
|
@@ -8473,8 +9010,167 @@ const CANVAS_SYNC_DETAILS = [
|
|
|
8473
9010
|
"repeated-server-error",
|
|
8474
9011
|
"mutation-id-reused",
|
|
8475
9012
|
"base-ahead",
|
|
8476
|
-
"upload-not-kept"
|
|
9013
|
+
"upload-not-kept",
|
|
9014
|
+
"preview-conflict",
|
|
9015
|
+
"competing-edits",
|
|
9016
|
+
"invalid-reconciliation",
|
|
9017
|
+
"invalid-recovery-plan",
|
|
9018
|
+
"history-restored",
|
|
9019
|
+
"local-changes",
|
|
9020
|
+
"no-edit-access",
|
|
9021
|
+
"saved-canvas-unavailable",
|
|
9022
|
+
"image-unreadable",
|
|
9023
|
+
"storage-refused",
|
|
9024
|
+
"unknown-baseline",
|
|
9025
|
+
"invalid-text-source",
|
|
9026
|
+
"session-expired"
|
|
9027
|
+
];
|
|
9028
|
+
/** The save status the person sees when a recovery report is sent. */
|
|
9029
|
+
const CANVAS_SYNC_REPORT_STATUSES = [
|
|
9030
|
+
"saved",
|
|
9031
|
+
"saving",
|
|
9032
|
+
"review",
|
|
9033
|
+
"retrying",
|
|
9034
|
+
"upload",
|
|
9035
|
+
"reconnecting",
|
|
9036
|
+
"offline",
|
|
9037
|
+
"not-kept",
|
|
9038
|
+
"view-only",
|
|
9039
|
+
"sign-in",
|
|
9040
|
+
"gone",
|
|
9041
|
+
"restored"
|
|
9042
|
+
];
|
|
9043
|
+
/** Whether a recovery state began in this visit or was reopened from the browser copy. */
|
|
9044
|
+
const CANVAS_SYNC_EPISODES = ["new", "reopened"];
|
|
9045
|
+
/** The transition a traced record states. `reported` marks a report with no step of its own. */
|
|
9046
|
+
const CANVAS_SAVE_TRACE_KINDS = [
|
|
9047
|
+
"started",
|
|
9048
|
+
"resolved",
|
|
9049
|
+
"superseded",
|
|
9050
|
+
"shown",
|
|
9051
|
+
"held-back",
|
|
9052
|
+
"dismissed",
|
|
9053
|
+
"action-started",
|
|
9054
|
+
"action-outcome",
|
|
9055
|
+
"long-wait",
|
|
9056
|
+
"long-wait-ended",
|
|
9057
|
+
"reported"
|
|
9058
|
+
];
|
|
9059
|
+
/** Why a notice appearance happened, from facts held at that moment. Never guessed from timing. */
|
|
9060
|
+
const CANVAS_SAVE_TRIGGERS = [
|
|
9061
|
+
"departure-protection",
|
|
9062
|
+
"retained-copy-review",
|
|
9063
|
+
"host-priority",
|
|
9064
|
+
"owner-reentry",
|
|
9065
|
+
"new-edit-while-blocked",
|
|
9066
|
+
"restored-work",
|
|
9067
|
+
"new-blocker",
|
|
9068
|
+
"unknown"
|
|
9069
|
+
];
|
|
9070
|
+
const CANVAS_SAVE_NOTICE_CAUSES = [
|
|
9071
|
+
"offline",
|
|
9072
|
+
"retrying",
|
|
9073
|
+
"upload",
|
|
9074
|
+
"review",
|
|
9075
|
+
"view-only",
|
|
9076
|
+
"unknown"
|
|
9077
|
+
];
|
|
9078
|
+
const CANVAS_SAVE_SEVERITIES = [
|
|
9079
|
+
"critical",
|
|
9080
|
+
"warning",
|
|
9081
|
+
"info"
|
|
9082
|
+
];
|
|
9083
|
+
const CANVAS_SAVE_DEVICE_PROTECTIONS = [
|
|
9084
|
+
"kept",
|
|
9085
|
+
"writing",
|
|
9086
|
+
"unprotected"
|
|
9087
|
+
];
|
|
9088
|
+
const CANVAS_SAVE_ACTIONS = [
|
|
9089
|
+
"try-again",
|
|
9090
|
+
"sync",
|
|
9091
|
+
"overwrite"
|
|
9092
|
+
];
|
|
9093
|
+
const CANVAS_SAVE_OUTCOMES = [
|
|
9094
|
+
"saved",
|
|
9095
|
+
"kept-copy",
|
|
9096
|
+
"still-blocked"
|
|
9097
|
+
];
|
|
9098
|
+
const CANVAS_SAVE_REPLAY_STATES = [
|
|
9099
|
+
"active",
|
|
9100
|
+
"disabled",
|
|
9101
|
+
"unavailable"
|
|
9102
|
+
];
|
|
9103
|
+
/** Why the first waiting change has not been answered. */
|
|
9104
|
+
const CANVAS_SAVE_HOLDS = [
|
|
9105
|
+
"in-flight",
|
|
9106
|
+
"retry-wait",
|
|
9107
|
+
"device-write",
|
|
9108
|
+
"upload",
|
|
9109
|
+
"read",
|
|
9110
|
+
"recovery",
|
|
9111
|
+
"decision",
|
|
9112
|
+
"offline",
|
|
9113
|
+
"paused",
|
|
9114
|
+
"not-held"
|
|
9115
|
+
];
|
|
9116
|
+
/** Why Sync or Overwrite cannot run now, as a fixed value. */
|
|
9117
|
+
const CANVAS_SYNC_BLOCKS = [
|
|
9118
|
+
"current-changes-unresolved",
|
|
9119
|
+
"checking-saved-canvas",
|
|
9120
|
+
"offline",
|
|
9121
|
+
"saved-canvas-unavailable",
|
|
9122
|
+
"sign-in",
|
|
9123
|
+
"request-unsettled",
|
|
9124
|
+
"no-edit-access",
|
|
9125
|
+
"missing-file",
|
|
9126
|
+
"local-copy-unsaved",
|
|
9127
|
+
"file-unavailable",
|
|
9128
|
+
"invalid-review",
|
|
9129
|
+
"too-large"
|
|
8477
9130
|
];
|
|
9131
|
+
const CANVAS_SAVE_REFUSAL_CODES = [
|
|
9132
|
+
"unknown",
|
|
9133
|
+
"unclassified",
|
|
9134
|
+
...CANVAS_REFUSAL_CODES
|
|
9135
|
+
];
|
|
9136
|
+
const OPAQUE_IDENTITY_LENGTH = 256;
|
|
9137
|
+
const MAX_OPERATION_KINDS = 64;
|
|
9138
|
+
const identity = z.string().max(OPAQUE_IDENTITY_LENGTH).regex(/^[\w:.-]*$/u);
|
|
9139
|
+
const count = z.number().int().nonnegative();
|
|
9140
|
+
const listedName = (names) => z.string().refine((name) => name === "unknown" || names.includes(name));
|
|
9141
|
+
const operationName = listedName(CANVAS_OPERATION_NAMES);
|
|
9142
|
+
/**
|
|
9143
|
+
* The lifecycle fields of a save record: counts, listed values and opaque identities, so no field
|
|
9144
|
+
* can carry canvas content, names, addresses or the words of an error.
|
|
9145
|
+
*/
|
|
9146
|
+
const canvasSaveTraceSchema = z.strictObject({
|
|
9147
|
+
schema: z.literal(1),
|
|
9148
|
+
eventId: z.uuid(),
|
|
9149
|
+
occurredAt: z.number().int().nonnegative(),
|
|
9150
|
+
kind: z.enum(CANVAS_SAVE_TRACE_KINDS),
|
|
9151
|
+
episodeKey: identity.optional(),
|
|
9152
|
+
nextEpisodeKey: identity.optional(),
|
|
9153
|
+
appearanceId: z.uuid().optional(),
|
|
9154
|
+
trigger: z.enum(CANVAS_SAVE_TRIGGERS).optional(),
|
|
9155
|
+
cause: z.enum(CANVAS_SAVE_NOTICE_CAUSES).optional(),
|
|
9156
|
+
severity: z.enum(CANVAS_SAVE_SEVERITIES),
|
|
9157
|
+
command: z.literal("unknown"),
|
|
9158
|
+
operationKinds: z.array(operationName).max(MAX_OPERATION_KINDS),
|
|
9159
|
+
refusalCode: z.enum(CANVAS_SAVE_REFUSAL_CODES).optional(),
|
|
9160
|
+
operation: operationName.optional(),
|
|
9161
|
+
component: listedName(CANVAS_OBJECT_KINDS).optional(),
|
|
9162
|
+
deviceProtection: z.enum(CANVAS_SAVE_DEVICE_PROTECTIONS),
|
|
9163
|
+
uploadsWaiting: count,
|
|
9164
|
+
uploadsBlocked: count,
|
|
9165
|
+
saveHold: z.enum(CANVAS_SAVE_HOLDS).optional(),
|
|
9166
|
+
actions: z.array(z.enum(CANVAS_SAVE_ACTIONS)).max(CANVAS_SAVE_ACTIONS.length),
|
|
9167
|
+
syncBlock: z.enum(CANVAS_SYNC_BLOCKS).optional(),
|
|
9168
|
+
overwriteBlock: z.enum(CANVAS_SYNC_BLOCKS).optional(),
|
|
9169
|
+
outcome: z.enum(CANVAS_SAVE_OUTCOMES).optional(),
|
|
9170
|
+
action: z.enum(CANVAS_SAVE_ACTIONS).optional(),
|
|
9171
|
+
replay: z.enum(CANVAS_SAVE_REPLAY_STATES),
|
|
9172
|
+
lostRecords: count
|
|
9173
|
+
});
|
|
8478
9174
|
const clientSaveIncidentInputSchema = z.strictObject({
|
|
8479
9175
|
canvasId: z.uuid(),
|
|
8480
9176
|
releaseIdentity: z.string().min(1).max(100),
|
|
@@ -8484,9 +9180,23 @@ const clientSaveIncidentInputSchema = z.strictObject({
|
|
|
8484
9180
|
version: z.number().int().nonnegative(),
|
|
8485
9181
|
attempts: z.number().int().nonnegative(),
|
|
8486
9182
|
durationMs: z.number().int().nonnegative(),
|
|
8487
|
-
pendingChanges: z.number().int().nonnegative()
|
|
9183
|
+
pendingChanges: z.number().int().nonnegative(),
|
|
9184
|
+
reason: z.enum(CANVAS_SYNC_DETAILS).optional(),
|
|
9185
|
+
status: z.enum(CANVAS_SYNC_REPORT_STATUSES).optional(),
|
|
9186
|
+
episode: z.enum(CANVAS_SYNC_EPISODES).optional(),
|
|
9187
|
+
trace: canvasSaveTraceSchema.optional()
|
|
9188
|
+
});
|
|
9189
|
+
/** Whether the API's analytics destination took the record. Older clients ignore it. */
|
|
9190
|
+
const CANVAS_SAVE_ANALYTICS_STATES = [
|
|
9191
|
+
"delivered",
|
|
9192
|
+
"failed",
|
|
9193
|
+
"disabled",
|
|
9194
|
+
"no-identity"
|
|
9195
|
+
];
|
|
9196
|
+
const clientSaveIncidentOutputSchema = z.object({
|
|
9197
|
+
accepted: z.literal(true),
|
|
9198
|
+
analytics: z.enum(CANVAS_SAVE_ANALYTICS_STATES).optional()
|
|
8488
9199
|
});
|
|
8489
|
-
const clientSaveIncidentOutputSchema = z.object({ accepted: z.literal(true) });
|
|
8490
9200
|
|
|
8491
9201
|
//#endregion
|
|
8492
9202
|
//#region ../../packages/contract/src/shared/extension-bridge.schema.ts
|
|
@@ -8698,6 +9408,17 @@ const extensionTelemetryOutputSchema = z.object({ accepted: z.literal(true) });
|
|
|
8698
9408
|
|
|
8699
9409
|
//#endregion
|
|
8700
9410
|
//#region ../../packages/contract/src/shared/request-outcome.lib.ts
|
|
9411
|
+
const listed = (allowed, value) => typeof value === "string" && allowed.includes(value) ? value : null;
|
|
9412
|
+
const refusalOf = (error) => {
|
|
9413
|
+
const { refusalCode, operation, component } = error.fields ?? {};
|
|
9414
|
+
if (refusalCode === void 0 && operation === void 0 && component === void 0) return void 0;
|
|
9415
|
+
const code = CANVAS_SAVE_REFUSAL_CODES.find((value) => value === refusalCode);
|
|
9416
|
+
return {
|
|
9417
|
+
refusalCode: refusalCode === void 0 ? "unclassified" : code ?? "unknown",
|
|
9418
|
+
operation: listed(CANVAS_OPERATION_NAMES, operation) ?? "unknown",
|
|
9419
|
+
component: listed(CANVAS_OBJECT_KINDS, component) ?? "unknown"
|
|
9420
|
+
};
|
|
9421
|
+
};
|
|
8701
9422
|
/** `fields.retry` on a CONFLICT the server expects to clear by itself. */
|
|
8702
9423
|
const RETRY_LATER = "later";
|
|
8703
9424
|
/** `fields.reason` on a CONFLICT that only a client defect can cause. */
|
|
@@ -8751,9 +9472,11 @@ const badRequestOutcome = (error) => {
|
|
|
8751
9472
|
kind: "refused",
|
|
8752
9473
|
reason: REQUEST_TOO_LARGE
|
|
8753
9474
|
};
|
|
9475
|
+
const refusal = refusalOf(error);
|
|
8754
9476
|
return {
|
|
8755
9477
|
kind: "refused",
|
|
8756
|
-
reason: error.message
|
|
9478
|
+
reason: error.message,
|
|
9479
|
+
...refusal !== void 0 && { refusal }
|
|
8757
9480
|
};
|
|
8758
9481
|
};
|
|
8759
9482
|
const appErrorOutcome = (error, retryAfterMs) => {
|
|
@@ -8871,6 +9594,106 @@ var PartialBatchError = class extends CliError {
|
|
|
8871
9594
|
}
|
|
8872
9595
|
};
|
|
8873
9596
|
|
|
9597
|
+
//#endregion
|
|
9598
|
+
//#region ../../packages/contract/src/capture/capture-comparison.schema.ts
|
|
9599
|
+
const COMMIT_LENGTH = 200;
|
|
9600
|
+
const captureComparisonInputSchema = z.strictObject({
|
|
9601
|
+
canvasId: z.uuid(),
|
|
9602
|
+
frameId: z.string().min(1),
|
|
9603
|
+
captureId: z.uuid()
|
|
9604
|
+
});
|
|
9605
|
+
const preview$1 = z.strictObject({
|
|
9606
|
+
captureId: z.uuid(),
|
|
9607
|
+
capturedAt: z.iso.datetime(),
|
|
9608
|
+
commit: z.string().max(COMMIT_LENGTH).optional(),
|
|
9609
|
+
url: z.string().min(1),
|
|
9610
|
+
width: z.number().positive(),
|
|
9611
|
+
height: z.number().positive(),
|
|
9612
|
+
pixelRatio: z.number().positive()
|
|
9613
|
+
});
|
|
9614
|
+
const captureComparisonSchema = z.strictObject({
|
|
9615
|
+
frameId: z.string(),
|
|
9616
|
+
before: preview$1,
|
|
9617
|
+
after: preview$1
|
|
9618
|
+
});
|
|
9619
|
+
|
|
9620
|
+
//#endregion
|
|
9621
|
+
//#region ../../packages/contract/src/capture/capture-manifest-input.lib.ts
|
|
9622
|
+
const NAMED_KEY_FIELDS = [
|
|
9623
|
+
"journey",
|
|
9624
|
+
"step",
|
|
9625
|
+
"variant"
|
|
9626
|
+
];
|
|
9627
|
+
const NAMED_FIELDS = ["label", "journeyLabel"];
|
|
9628
|
+
const fitted = (value) => typeof value === "string" ? fitCaptureName(value) : value;
|
|
9629
|
+
/** A capture whose names a test author wrote too long is shortened, never refused. */
|
|
9630
|
+
const fitCaptureNames = (raw) => {
|
|
9631
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return raw;
|
|
9632
|
+
const capture = { ...raw };
|
|
9633
|
+
for (const field of NAMED_FIELDS) capture[field] = fitted(capture[field]);
|
|
9634
|
+
const captureKey = capture["key"];
|
|
9635
|
+
if (typeof captureKey === "object" && captureKey !== null && !Array.isArray(captureKey)) {
|
|
9636
|
+
const named = { ...captureKey };
|
|
9637
|
+
for (const field of NAMED_KEY_FIELDS) named[field] = fitted(named[field]);
|
|
9638
|
+
capture["key"] = named;
|
|
9639
|
+
}
|
|
9640
|
+
return capture;
|
|
9641
|
+
};
|
|
9642
|
+
/**
|
|
9643
|
+
* 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.
|
|
9645
|
+
*/
|
|
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) => ({
|
|
9649
|
+
...attempt,
|
|
9650
|
+
captures: attempt.captures.flatMap((capture) => {
|
|
9651
|
+
const parsed = captureArtifactSchema.safeParse(fitCaptureNames(capture));
|
|
9652
|
+
return parsed.success ? [parsed.data] : [];
|
|
9653
|
+
})
|
|
9654
|
+
}))
|
|
9655
|
+
}));
|
|
9656
|
+
const sealCaptureRunInputSchema = z.strictObject({ manifest: lenientCaptureManifestSchema });
|
|
9657
|
+
|
|
9658
|
+
//#endregion
|
|
9659
|
+
//#region ../../packages/contract/src/capture/capture-review.schema.ts
|
|
9660
|
+
const captureReviewInputSchema = z.strictObject({ canvasId: z.uuid() });
|
|
9661
|
+
const setCaptureVerdictInputSchema = captureReviewInputSchema.extend({ verdict: captureVerdictSchema });
|
|
9662
|
+
const captureReferenceInputSchema = z.strictObject({
|
|
9663
|
+
canvasId: z.uuid(),
|
|
9664
|
+
name: z.string().min(1)
|
|
9665
|
+
});
|
|
9666
|
+
const captureReferenceSchema = z.strictObject({
|
|
9667
|
+
runId: z.uuid(),
|
|
9668
|
+
revision: z.string(),
|
|
9669
|
+
version: z.number().int().positive()
|
|
9670
|
+
});
|
|
9671
|
+
const updateCaptureReferenceInputSchema = captureReferenceInputSchema.extend({
|
|
9672
|
+
expectedVersion: z.number().int().nonnegative(),
|
|
9673
|
+
revision: z.string().min(1)
|
|
9674
|
+
});
|
|
9675
|
+
const captureReviewSchema = z.strictObject({
|
|
9676
|
+
current: getCaptureRunOutputSchema,
|
|
9677
|
+
latest: captureRunDescriptorSchema,
|
|
9678
|
+
related: z.array(z.strictObject({
|
|
9679
|
+
run: captureRunDescriptorSchema,
|
|
9680
|
+
verdict: captureVerdictSchema
|
|
9681
|
+
})),
|
|
9682
|
+
changes: z.array(z.strictObject({
|
|
9683
|
+
key: captureKeySchema,
|
|
9684
|
+
frameId: z.string(),
|
|
9685
|
+
label: z.string(),
|
|
9686
|
+
journeyLabel: z.string(),
|
|
9687
|
+
page: z.string().optional(),
|
|
9688
|
+
change: z.enum([
|
|
9689
|
+
"new",
|
|
9690
|
+
"changed",
|
|
9691
|
+
"unchanged",
|
|
9692
|
+
"uncompared"
|
|
9693
|
+
])
|
|
9694
|
+
}))
|
|
9695
|
+
});
|
|
9696
|
+
|
|
8874
9697
|
//#endregion
|
|
8875
9698
|
//#region src/application/canvas-reference.use-case.ts
|
|
8876
9699
|
const hasCanvasReferenceScope = (reference) => reference.pageId !== void 0 || reference.nodeIds.length > 0;
|
|
@@ -9286,11 +10109,12 @@ const canvasEditableReadOutputSchema = z.strictObject({
|
|
|
9286
10109
|
...readResult,
|
|
9287
10110
|
view: z.literal("editable"),
|
|
9288
10111
|
complete: z.literal(true),
|
|
9289
|
-
projectionVersion: z.literal(
|
|
10112
|
+
projectionVersion: z.literal(2),
|
|
9290
10113
|
snapshotToken: cursor,
|
|
9291
10114
|
rootNodeId: nodeId$1,
|
|
9292
10115
|
html: z.string(),
|
|
9293
|
-
opaqueNodeIds: z.array(nodeId$1)
|
|
10116
|
+
opaqueNodeIds: z.array(nodeId$1),
|
|
10117
|
+
sealedReasons: z.record(nodeId$1, z.string())
|
|
9294
10118
|
});
|
|
9295
10119
|
const canvasOutlineReadOutputSchema = z.strictObject({
|
|
9296
10120
|
...readResult,
|
|
@@ -10756,7 +11580,6 @@ const PROCEDURE_DESCRIPTIONS = {
|
|
|
10756
11580
|
"canvas.duplicate": "Copy a canvas and its document into the selected shelf.",
|
|
10757
11581
|
"canvas.deletePermanently": "Permanently delete a canvas already in the recoverable bin.",
|
|
10758
11582
|
"canvas.restore": "Restore a canvas from the recoverable bin.",
|
|
10759
|
-
"canvas.markViewed": "Record that the authenticated person has viewed a canvas.",
|
|
10760
11583
|
"canvas.list": "Find canvas ids by collection, title, access, review state, or deletion state.",
|
|
10761
11584
|
"canvas.rename": "Rename a canvas owned by the authenticated person.",
|
|
10762
11585
|
"canvas.setReviewState": "Change the authenticated person’s review state on a canvas.",
|
|
@@ -10783,7 +11606,7 @@ const PROCEDURE_DESCRIPTIONS = {
|
|
|
10783
11606
|
"comment.react": "Set or remove one emoji reaction on a comment message.",
|
|
10784
11607
|
"comment.edit": "Replace the body of a comment message authored by this person.",
|
|
10785
11608
|
"comment.move": "Move a comment thread anchor to a new canvas location.",
|
|
10786
|
-
"comment.delete": "Delete
|
|
11609
|
+
"comment.delete": "Delete a comment thread you started, or tombstone one of your own replies when its id is set. Deleting the first message deletes the thread.",
|
|
10787
11610
|
"organisation.list": "List teams the authenticated person belongs to.",
|
|
10788
11611
|
"organisation.create": "Create a team and make the authenticated person its owner.",
|
|
10789
11612
|
"organisation.update": "Rename a team managed by the authenticated person.",
|
|
@@ -10837,7 +11660,7 @@ const OPTION_DESCRIPTIONS = {
|
|
|
10837
11660
|
"canvas.makeEditable --placement": "Place the editable conversion adjacent to its source; retain the captured original.",
|
|
10838
11661
|
"canvas.remove --root-node-ids": "Explicit roots to remove with their descendants, within the supplied scope and observed version.",
|
|
10839
11662
|
"canvas.updateHtml --snapshot-token": "Opaque snapshot token from a complete editable read. Retain it for the identical retry; reread after a conflict.",
|
|
10840
|
-
"canvas.updateHtml --html": "Complete edited HTML for that snapshot, preserving retained IDs and opaque placeholders. Follow the canvas HTML version
|
|
11663
|
+
"canvas.updateHtml --html": "Complete edited HTML for that snapshot, preserving retained IDs and opaque placeholders. Follow the canvas HTML version 2 reference.",
|
|
10841
11664
|
"canvas.updateHtml --remove-node-ids": "Explicit retained roots intentionally deleted from the HTML. Omission alone never authorizes removal.",
|
|
10842
11665
|
"operation.status --operation": "Exact durable operation reference returned by a prior call, including its kind and identity fields.",
|
|
10843
11666
|
"operation.status --include-image": "Include available render image evidence when true; this does not start another render.",
|
|
@@ -11151,6 +11974,11 @@ const FONT_ASSET_POLICY = {
|
|
|
11151
11974
|
reason: "Font upload and transfer lifecycle belongs to document authoring transactions.",
|
|
11152
11975
|
owner: "product"
|
|
11153
11976
|
};
|
|
11977
|
+
const EDITOR_EXPORT_POLICY = {
|
|
11978
|
+
exposure: "internal",
|
|
11979
|
+
reason: "Image export is the editor's download for a signed-in person; agents use canvas_render.",
|
|
11980
|
+
owner: "product"
|
|
11981
|
+
};
|
|
11154
11982
|
const RENDER_LIFECYCLE_POLICY = {
|
|
11155
11983
|
exposure: "internal",
|
|
11156
11984
|
reason: "Render creation, polling and cancellation belong to higher-level render capabilities.",
|
|
@@ -11200,6 +12028,11 @@ const PROCEDURE_CAPABILITY_POLICIES = {
|
|
|
11200
12028
|
"person.completeProfilePhoto": PROFILE_DRAFT_POLICY,
|
|
11201
12029
|
"person.abandonProfilePhoto": PROFILE_DRAFT_POLICY,
|
|
11202
12030
|
"person.updateProfile": PROFILE_DRAFT_POLICY,
|
|
12031
|
+
"canvas.markViewed": {
|
|
12032
|
+
exposure: "internal",
|
|
12033
|
+
reason: "Opens count only from the product UI.",
|
|
12034
|
+
owner: "product"
|
|
12035
|
+
},
|
|
11203
12036
|
"feedback.submit": {
|
|
11204
12037
|
exposure: "internal",
|
|
11205
12038
|
reason: "Dashboard feedback requires a deliberate human submission.",
|
|
@@ -11271,6 +12104,9 @@ const PROCEDURE_CAPABILITY_POLICIES = {
|
|
|
11271
12104
|
owner: "product"
|
|
11272
12105
|
},
|
|
11273
12106
|
"canvas.render.get": RENDER_LIFECYCLE_POLICY,
|
|
12107
|
+
"canvas.render.export": EDITOR_EXPORT_POLICY,
|
|
12108
|
+
"canvas.render.getExport": EDITOR_EXPORT_POLICY,
|
|
12109
|
+
"canvas.render.downloadExport": EDITOR_EXPORT_POLICY,
|
|
11274
12110
|
"canvas.render.snapshot": {
|
|
11275
12111
|
exposure: "internal",
|
|
11276
12112
|
reason: "Render snapshot creation is owned by higher-level render capabilities.",
|
|
@@ -11397,7 +12233,6 @@ const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
|
11397
12233
|
"canvas.invites.resend",
|
|
11398
12234
|
"canvas.invites.revoke",
|
|
11399
12235
|
"canvas.list",
|
|
11400
|
-
"canvas.markViewed",
|
|
11401
12236
|
"canvas.move",
|
|
11402
12237
|
"canvas.node",
|
|
11403
12238
|
"canvas.participants.list",
|
|
@@ -12286,7 +13121,8 @@ const toCanvasCardContract = (view) => {
|
|
|
12286
13121
|
const base = {
|
|
12287
13122
|
...toCanvasContract(view),
|
|
12288
13123
|
screenCount: view.screenCount,
|
|
12289
|
-
hasRecording: view.hasRecording
|
|
13124
|
+
hasRecording: view.hasRecording,
|
|
13125
|
+
lastViewedAt: view.lastViewedAt?.toISOString() ?? null
|
|
12290
13126
|
};
|
|
12291
13127
|
return view.thumbnail === null ? {
|
|
12292
13128
|
...base,
|
|
@@ -12316,7 +13152,6 @@ const toCanvasSceneNodeContract = (node) => canvasSceneNodeSchema.parse({
|
|
|
12316
13152
|
...node.layout !== void 0 && { layout: node.layout },
|
|
12317
13153
|
...node.appearance !== void 0 && { appearance: node.appearance },
|
|
12318
13154
|
...node.geometry !== void 0 && { geometry: node.geometry },
|
|
12319
|
-
...node.compositing !== void 0 && { compositing: node.compositing },
|
|
12320
13155
|
...node.typography !== void 0 && { typography: node.typography },
|
|
12321
13156
|
...node.additionalStyles !== void 0 && { additionalStyles: node.additionalStyles },
|
|
12322
13157
|
...node.props !== void 0 && { props: { ...node.props } },
|
|
@@ -12422,7 +13257,7 @@ const setAccess = (handlers) => canvasOwnerProcedure.input(setCanvasAccessInputS
|
|
|
12422
13257
|
};
|
|
12423
13258
|
});
|
|
12424
13259
|
const markViewed = (handlers) => canvasReaderProcedure.input(markCanvasViewedInputSchema).output(markCanvasViewedOutputSchema).mutation(async ({ input, ctx }) => {
|
|
12425
|
-
if (ctx.viewer.kind
|
|
13260
|
+
if (ctx.viewer.kind !== "person") return { lastViewedAt: null };
|
|
12426
13261
|
return { lastViewedAt: orThrow(await handlers.markViewed.execute({
|
|
12427
13262
|
canvasId: input.canvasId,
|
|
12428
13263
|
personId: ctx.viewer.personId
|
|
@@ -13063,6 +13898,7 @@ const getDocument = (handlers) => canvasReaderProcedure.input(getCanvasDocumentI
|
|
|
13063
13898
|
document: result.document.document,
|
|
13064
13899
|
screens: result.screens.map((screen) => ({
|
|
13065
13900
|
screenId: screen.screenId,
|
|
13901
|
+
clientToken: screen.clientToken,
|
|
13066
13902
|
route: screen.route,
|
|
13067
13903
|
title: screen.title,
|
|
13068
13904
|
viewport: screen.viewport,
|
|
@@ -13320,7 +14156,6 @@ const createCanvasInspectionRouter = (handlers, webOrigin) => ({
|
|
|
13320
14156
|
...found.node.layout !== void 0 && { layout: found.node.layout },
|
|
13321
14157
|
...found.node.appearance !== void 0 && { appearance: found.node.appearance },
|
|
13322
14158
|
...found.node.geometry !== void 0 && { geometry: found.node.geometry },
|
|
13323
|
-
...found.node.compositing !== void 0 && { compositing: found.node.compositing },
|
|
13324
14159
|
...found.node.typography !== void 0 && { typography: found.node.typography },
|
|
13325
14160
|
...found.node.additionalStyles !== void 0 && { additionalStyles: found.node.additionalStyles },
|
|
13326
14161
|
props: found.node.props ?? {},
|
|
@@ -13549,7 +14384,7 @@ const createCanvasMutationRecoveryRouter = (handlers) => trpcRouter({
|
|
|
13549
14384
|
|
|
13550
14385
|
//#endregion
|
|
13551
14386
|
//#region ../api/src/canvas/infrastructure/participant-contract.mapper.ts
|
|
13552
|
-
/** Domain to wire. */
|
|
14387
|
+
/** Domain to wire. The member list carries no view times, so each person's stay their own. */
|
|
13553
14388
|
const toParticipantContract = (row) => ({
|
|
13554
14389
|
personId: row.personId,
|
|
13555
14390
|
email: row.email,
|
|
@@ -13559,7 +14394,7 @@ const toParticipantContract = (row) => ({
|
|
|
13559
14394
|
accessLevel: row.accessLevel,
|
|
13560
14395
|
isPending: row.isPending,
|
|
13561
14396
|
reviewState: row.reviewState,
|
|
13562
|
-
lastViewedAt:
|
|
14397
|
+
lastViewedAt: null
|
|
13563
14398
|
});
|
|
13564
14399
|
|
|
13565
14400
|
//#endregion
|
|
@@ -13731,7 +14566,8 @@ const createCanvasRealtimeRouter = (handlers, endpoint) => trpcRouter({
|
|
|
13731
14566
|
ticket: canvasReaderProcedure.input(canvasRealtimeTicketInputSchema).output(canvasRealtimeTicketOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13732
14567
|
const issued = orThrow(await handlers.issueRealtimeTicket.execute({
|
|
13733
14568
|
canvasId: input.canvasId,
|
|
13734
|
-
viewer: ctx.viewer
|
|
14569
|
+
viewer: ctx.viewer,
|
|
14570
|
+
viewId: input.viewId
|
|
13735
14571
|
}));
|
|
13736
14572
|
return {
|
|
13737
14573
|
endpoint,
|
|
@@ -13855,6 +14691,7 @@ const toCanvasVersionContractEntry = (entry) => ({
|
|
|
13855
14691
|
});
|
|
13856
14692
|
const toCanvasVersionContractScreen = (screen) => ({
|
|
13857
14693
|
screenId: screen.screenId,
|
|
14694
|
+
clientToken: screen.clientToken,
|
|
13858
14695
|
route: screen.route,
|
|
13859
14696
|
title: screen.title,
|
|
13860
14697
|
viewport: screen.viewport,
|
|
@@ -13966,68 +14803,6 @@ const createCanvasVersionRouter = (handlers) => trpcRouter({
|
|
|
13966
14803
|
duplicate: duplicate(handlers)
|
|
13967
14804
|
});
|
|
13968
14805
|
|
|
13969
|
-
//#endregion
|
|
13970
|
-
//#region ../../packages/contract/src/capture/capture-comparison.schema.ts
|
|
13971
|
-
const COMMIT_LENGTH = 200;
|
|
13972
|
-
const captureComparisonInputSchema = z.strictObject({
|
|
13973
|
-
canvasId: z.uuid(),
|
|
13974
|
-
frameId: z.string().min(1),
|
|
13975
|
-
captureId: z.uuid()
|
|
13976
|
-
});
|
|
13977
|
-
const preview$1 = z.strictObject({
|
|
13978
|
-
captureId: z.uuid(),
|
|
13979
|
-
capturedAt: z.iso.datetime(),
|
|
13980
|
-
commit: z.string().max(COMMIT_LENGTH).optional(),
|
|
13981
|
-
url: z.string().min(1),
|
|
13982
|
-
width: z.number().positive(),
|
|
13983
|
-
height: z.number().positive(),
|
|
13984
|
-
pixelRatio: z.number().positive()
|
|
13985
|
-
});
|
|
13986
|
-
const captureComparisonSchema = z.strictObject({
|
|
13987
|
-
frameId: z.string(),
|
|
13988
|
-
before: preview$1,
|
|
13989
|
-
after: preview$1
|
|
13990
|
-
});
|
|
13991
|
-
|
|
13992
|
-
//#endregion
|
|
13993
|
-
//#region ../../packages/contract/src/capture/capture-review.schema.ts
|
|
13994
|
-
const captureReviewInputSchema = z.strictObject({ canvasId: z.uuid() });
|
|
13995
|
-
const setCaptureVerdictInputSchema = captureReviewInputSchema.extend({ verdict: captureVerdictSchema });
|
|
13996
|
-
const captureReferenceInputSchema = z.strictObject({
|
|
13997
|
-
canvasId: z.uuid(),
|
|
13998
|
-
name: z.string().min(1)
|
|
13999
|
-
});
|
|
14000
|
-
const captureReferenceSchema = z.strictObject({
|
|
14001
|
-
runId: z.uuid(),
|
|
14002
|
-
revision: z.string(),
|
|
14003
|
-
version: z.number().int().positive()
|
|
14004
|
-
});
|
|
14005
|
-
const updateCaptureReferenceInputSchema = captureReferenceInputSchema.extend({
|
|
14006
|
-
expectedVersion: z.number().int().nonnegative(),
|
|
14007
|
-
revision: z.string().min(1)
|
|
14008
|
-
});
|
|
14009
|
-
const captureReviewSchema = z.strictObject({
|
|
14010
|
-
current: getCaptureRunOutputSchema,
|
|
14011
|
-
latest: captureRunDescriptorSchema,
|
|
14012
|
-
related: z.array(z.strictObject({
|
|
14013
|
-
run: captureRunDescriptorSchema,
|
|
14014
|
-
verdict: captureVerdictSchema
|
|
14015
|
-
})),
|
|
14016
|
-
changes: z.array(z.strictObject({
|
|
14017
|
-
key: captureKeySchema,
|
|
14018
|
-
frameId: z.string(),
|
|
14019
|
-
label: z.string(),
|
|
14020
|
-
journeyLabel: z.string(),
|
|
14021
|
-
page: z.string().optional(),
|
|
14022
|
-
change: z.enum([
|
|
14023
|
-
"new",
|
|
14024
|
-
"changed",
|
|
14025
|
-
"unchanged",
|
|
14026
|
-
"uncompared"
|
|
14027
|
-
])
|
|
14028
|
-
}))
|
|
14029
|
-
});
|
|
14030
|
-
|
|
14031
14806
|
//#endregion
|
|
14032
14807
|
//#region ../api/src/canvas/infrastructure/capture-run.router.ts
|
|
14033
14808
|
const actorOf$1 = (viewer) => {
|
|
@@ -14283,7 +15058,7 @@ const toCanvasConversionJob = (job) => {
|
|
|
14283
15058
|
//#endregion
|
|
14284
15059
|
//#region ../api/src/canvas/infrastructure/render.router.ts
|
|
14285
15060
|
const actorOf = (viewer) => toAgentCanvasRequestActor(viewer) ?? orThrow((0, import_index_cjs.err)(appError("UNAUTHORIZED", "this call needs an agent token")));
|
|
14286
|
-
const presentRender = (job) => toCanvasRenderJob(job) ?? orThrow((0, import_index_cjs.err)(appError("INTERNAL", "render outcome is incomplete")));
|
|
15061
|
+
const presentRender$1 = (job) => toCanvasRenderJob(job) ?? orThrow((0, import_index_cjs.err)(appError("INTERNAL", "render outcome is incomplete")));
|
|
14287
15062
|
const presentConversion = (job) => toCanvasConversionJob(job) ?? orThrow((0, import_index_cjs.err)(appError("INTERNAL", "primitive import outcome is incomplete")));
|
|
14288
15063
|
const requirePurpose = (job, purpose) => job.purpose !== "preparation" && purpose === "conversion" === (job.purpose === "conversion") ? job : orThrow((0, import_index_cjs.err)(appError("NOT_FOUND", `no such ${purpose}`)));
|
|
14289
15064
|
const createRender = (handlers) => agentCanvasReaderProcedure.input(createCanvasRenderInputSchema).output(createCanvasRenderOutputSchema).mutation(async ({ input, ctx }) => {
|
|
@@ -14302,7 +15077,7 @@ const createRender = (handlers) => agentCanvasReaderProcedure.input(createCanvas
|
|
|
14302
15077
|
idempotencyKey: ctx.idempotencyKey
|
|
14303
15078
|
}));
|
|
14304
15079
|
return {
|
|
14305
|
-
job: presentRender(made.job),
|
|
15080
|
+
job: presentRender$1(made.job),
|
|
14306
15081
|
alreadyExists: made.alreadyExists
|
|
14307
15082
|
};
|
|
14308
15083
|
});
|
|
@@ -14311,7 +15086,7 @@ const getRender = (handlers) => agentProcedure.input(getCanvasRenderInputSchema)
|
|
|
14311
15086
|
jobId: input.jobId,
|
|
14312
15087
|
actor: actorOf(ctx.viewer)
|
|
14313
15088
|
}));
|
|
14314
|
-
return { job: presentRender(requirePurpose(job, "render")) };
|
|
15089
|
+
return { job: presentRender$1(requirePurpose(job, "render")) };
|
|
14315
15090
|
});
|
|
14316
15091
|
const createSnapshot = (handlers) => agentCanvasEditorProcedure.input(createRecordingSnapshotInputSchema).output(createRecordingSnapshotOutputSchema).mutation(async ({ input, ctx }) => {
|
|
14317
15092
|
const actor = actorOf(ctx.viewer);
|
|
@@ -14337,7 +15112,7 @@ const createSnapshot = (handlers) => agentCanvasEditorProcedure.input(createReco
|
|
|
14337
15112
|
idempotencyKey: ctx.idempotencyKey
|
|
14338
15113
|
}));
|
|
14339
15114
|
return {
|
|
14340
|
-
job: presentRender(made.job),
|
|
15115
|
+
job: presentRender$1(made.job),
|
|
14341
15116
|
alreadyExists: made.alreadyExists
|
|
14342
15117
|
};
|
|
14343
15118
|
});
|
|
@@ -14399,7 +15174,7 @@ const cancelRender = (handlers) => agentProcedure.input(cancelCanvasRenderInputS
|
|
|
14399
15174
|
actor
|
|
14400
15175
|
}));
|
|
14401
15176
|
requirePurpose(current, "render");
|
|
14402
|
-
return { job: presentRender(orThrow(await handlers.cancel.execute({
|
|
15177
|
+
return { job: presentRender$1(orThrow(await handlers.cancel.execute({
|
|
14403
15178
|
jobId: input.jobId,
|
|
14404
15179
|
actor
|
|
14405
15180
|
}))) };
|
|
@@ -14433,6 +15208,68 @@ const createRenderRouter = (handlers) => trpcRouter({
|
|
|
14433
15208
|
download: downloadRender(handlers)
|
|
14434
15209
|
});
|
|
14435
15210
|
|
|
15211
|
+
//#endregion
|
|
15212
|
+
//#region ../api/src/canvas/infrastructure/render-export.router.ts
|
|
15213
|
+
const presentRender = (job) => toCanvasRenderJob(job) ?? orThrow((0, import_index_cjs.err)(appError("INTERNAL", "render outcome is incomplete")));
|
|
15214
|
+
/** A person's own exports, which carry no agent token. */
|
|
15215
|
+
const personActorOf = (viewer) => ({
|
|
15216
|
+
personId: viewer.personId,
|
|
15217
|
+
tokenId: null
|
|
15218
|
+
});
|
|
15219
|
+
const createExport = (handlers) => canvasPersonReaderProcedure.meta({ description: "Export one layer as an image at the saved canvas revision." }).input(createCanvasExportInputSchema).output(createCanvasRenderOutputSchema).mutation(async ({ input, ctx }) => {
|
|
15220
|
+
const made = orThrow(await handlers.create.execute({
|
|
15221
|
+
canvasId: input.canvasId,
|
|
15222
|
+
purpose: "export",
|
|
15223
|
+
expectedVersion: input.expectedVersion,
|
|
15224
|
+
target: {
|
|
15225
|
+
kind: "node",
|
|
15226
|
+
nodeId: input.nodeId
|
|
15227
|
+
},
|
|
15228
|
+
sourceState: null,
|
|
15229
|
+
scale: input.scale,
|
|
15230
|
+
requesterPersonId: ctx.viewer.personId,
|
|
15231
|
+
requesterTokenId: null,
|
|
15232
|
+
idempotencyKey: null
|
|
15233
|
+
}));
|
|
15234
|
+
return {
|
|
15235
|
+
job: presentRender(made.job),
|
|
15236
|
+
alreadyExists: made.alreadyExists
|
|
15237
|
+
};
|
|
15238
|
+
});
|
|
15239
|
+
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({
|
|
15242
|
+
jobId: input.jobId,
|
|
15243
|
+
actor: personActorOf(ctx.viewer)
|
|
15244
|
+
}));
|
|
15245
|
+
return { job: presentRender(requireExport(job)) };
|
|
15246
|
+
});
|
|
15247
|
+
const downloadExport = (handlers) => personProcedure.input(downloadCanvasRenderInputSchema).output(downloadCanvasRenderOutputSchema).query(async ({ input, ctx }) => {
|
|
15248
|
+
const actor = personActorOf(ctx.viewer);
|
|
15249
|
+
requireExport(orThrow(await handlers.get.execute({
|
|
15250
|
+
jobId: input.jobId,
|
|
15251
|
+
actor
|
|
15252
|
+
})));
|
|
15253
|
+
const download = orThrow(await handlers.download.execute({
|
|
15254
|
+
jobId: input.jobId,
|
|
15255
|
+
actor
|
|
15256
|
+
}));
|
|
15257
|
+
return {
|
|
15258
|
+
jobId: input.jobId,
|
|
15259
|
+
download: {
|
|
15260
|
+
url: download.url,
|
|
15261
|
+
expiresAt: download.expiresAt.toISOString(),
|
|
15262
|
+
bytes: download.bytes
|
|
15263
|
+
}
|
|
15264
|
+
};
|
|
15265
|
+
});
|
|
15266
|
+
/** The editor's image export: a person's own render jobs, polled and downloaded by them. */
|
|
15267
|
+
const createRenderExportRouter = (handlers) => trpcRouter({
|
|
15268
|
+
export: createExport(handlers),
|
|
15269
|
+
getExport: getExport(handlers),
|
|
15270
|
+
downloadExport: downloadExport(handlers)
|
|
15271
|
+
});
|
|
15272
|
+
|
|
14436
15273
|
//#endregion
|
|
14437
15274
|
//#region ../api/src/canvas/infrastructure/render-exposure.router.ts
|
|
14438
15275
|
const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderProcedure.input(exposeCanvasRenderInputSchema).output(exposeCanvasRenderOutputSchema).query(async ({ input, ctx }) => {
|
|
@@ -14608,6 +15445,7 @@ const toCommentMessageContract = (message, directory) => ({
|
|
|
14608
15445
|
messageId: message.id,
|
|
14609
15446
|
seq: message.seq,
|
|
14610
15447
|
body: message.deletedAt === null ? message.body : "(deleted)",
|
|
15448
|
+
isDeleted: message.deletedAt !== null,
|
|
14611
15449
|
author: toAuthorContract(message, directory),
|
|
14612
15450
|
createdAt: message.createdAt.toISOString(),
|
|
14613
15451
|
editedAt: message.editedAt?.toISOString() ?? null,
|
|
@@ -14772,8 +15610,7 @@ const createCommentRouter = (handlers) => trpcRouter({
|
|
|
14772
15610
|
move: canvasCommenterProcedure.input(moveCommentInputSchema).output(commentThreadSchema).mutation(async ({ input }) => nameCommentThread(handlers.directory, orThrow(await handlers.move.execute(input)))),
|
|
14773
15611
|
delete: canvasCommenterProcedure.input(deleteCommentInputSchema).output(deleteCommentOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.remove.execute({
|
|
14774
15612
|
...input,
|
|
14775
|
-
personId: ctx.viewer.personId
|
|
14776
|
-
canManage: ctx.canvasAccess.canManage
|
|
15613
|
+
personId: ctx.viewer.personId
|
|
14777
15614
|
})))
|
|
14778
15615
|
});
|
|
14779
15616
|
|
|
@@ -15519,8 +16356,9 @@ const createRecordingRouter = (handlers) => trpcRouter({
|
|
|
15519
16356
|
};
|
|
15520
16357
|
}),
|
|
15521
16358
|
list: canvasReaderProcedure.input(listRecordingsInputSchema).output(listRecordingsOutputSchema).query(async ({ input }) => {
|
|
16359
|
+
const { recordings, unreadableCount } = orThrow(await handlers.list.execute(input));
|
|
15522
16360
|
return {
|
|
15523
|
-
items:
|
|
16361
|
+
items: recordings.map((recording) => ({
|
|
15524
16362
|
recordingId: recording.id,
|
|
15525
16363
|
durationMs: recording.durationMs,
|
|
15526
16364
|
viewport: recording.viewport,
|
|
@@ -15528,7 +16366,8 @@ const createRecordingRouter = (handlers) => trpcRouter({
|
|
|
15528
16366
|
chunkCount: recording.chunkCount,
|
|
15529
16367
|
startedAt: recording.startedAt.toISOString()
|
|
15530
16368
|
})),
|
|
15531
|
-
truncated: false
|
|
16369
|
+
truncated: false,
|
|
16370
|
+
unreadableCount
|
|
15532
16371
|
};
|
|
15533
16372
|
}),
|
|
15534
16373
|
delete: canvasOwnerProcedure.input(deleteRecordingInputSchema).output(deleteRecordingOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.remove.execute({
|
|
@@ -15691,7 +16530,11 @@ const fieldsOf$1 = (input) => {
|
|
|
15691
16530
|
signal: name,
|
|
15692
16531
|
supportedClient: input.capabilityVersion === 2 ? 1 : 0,
|
|
15693
16532
|
isSlow: input.name === "canvas_load" && ["slow", "timed-out"].includes(input.outcome) ? 1 : 0,
|
|
15694
|
-
isDegraded: input.name === "canvas_load" && [
|
|
16533
|
+
isDegraded: input.name === "canvas_load" && [
|
|
16534
|
+
"degraded",
|
|
16535
|
+
"timed-out",
|
|
16536
|
+
"unavailable"
|
|
16537
|
+
].includes(input.outcome) ? 1 : 0,
|
|
15695
16538
|
isJanky: input.name === "canvas_interaction" && input.outcome === "janky" ? 1 : 0,
|
|
15696
16539
|
isRealtimeFailure: input.name === "canvas_realtime" && input.outcome === "failed" ? 1 : 0,
|
|
15697
16540
|
isPrototypeOpen: Number(isPrototypeOpen),
|
|
@@ -15704,6 +16547,7 @@ const isFailure$1 = (input) => {
|
|
|
15704
16547
|
if (input.name === "canvas_load") return input.outcome !== "ready";
|
|
15705
16548
|
if (input.name === "canvas_interaction") return input.outcome !== "smooth";
|
|
15706
16549
|
if (input.name === "prototype_open") return input.outcome !== "loaded";
|
|
16550
|
+
if (input.name === "canvas_measurement") return true;
|
|
15707
16551
|
return input.outcome !== "succeeded";
|
|
15708
16552
|
};
|
|
15709
16553
|
const clientPerformanceTelemetryRoute = () => baseProcedure.input(clientPerformanceInputSchema).output(clientPerformanceOutputSchema).mutation(({ input, ctx }) => {
|
|
@@ -15718,7 +16562,7 @@ const clientPerformanceTelemetryRoute = () => baseProcedure.input(clientPerforma
|
|
|
15718
16562
|
const FINGERPRINT_LENGTH = 24;
|
|
15719
16563
|
const clientRenderFailureRoute = () => baseProcedure.input(clientRenderFailureInputSchema).output(clientRenderFailureOutputSchema).mutation(({ input, ctx }) => {
|
|
15720
16564
|
const { details, ...identity } = input;
|
|
15721
|
-
const { frames, ...classification } = details ?? {
|
|
16565
|
+
const { frames, deliveryGap, ...classification } = details ?? {
|
|
15722
16566
|
version: 1,
|
|
15723
16567
|
severity: "fatal",
|
|
15724
16568
|
boundary: "application",
|
|
@@ -15737,10 +16581,18 @@ const clientRenderFailureRoute = () => baseProcedure.input(clientRenderFailureIn
|
|
|
15737
16581
|
const event = classification.outcome === "failed" ? "EditorRenderFailed" : "EditorRecoveryReported";
|
|
15738
16582
|
const fields = {
|
|
15739
16583
|
...identity,
|
|
15740
|
-
...classification,
|
|
16584
|
+
...Object.fromEntries(Object.entries(classification).filter(([key]) => key !== "version")),
|
|
15741
16585
|
fingerprint,
|
|
15742
16586
|
frames: JSON.stringify(frames),
|
|
15743
|
-
event
|
|
16587
|
+
event,
|
|
16588
|
+
...classification.errorCode === "unexpected-error" && frames.length === 0 && { lowInformation: true },
|
|
16589
|
+
...deliveryGap !== void 0 && {
|
|
16590
|
+
deliveryGapRefused: deliveryGap.refused,
|
|
16591
|
+
deliveryGapExpired: deliveryGap.expired,
|
|
16592
|
+
deliveryGapEvicted: deliveryGap.evicted,
|
|
16593
|
+
deliveryGapExhausted: deliveryGap.exhausted
|
|
16594
|
+
},
|
|
16595
|
+
...ctx.testRun !== null && { testRun: ctx.testRun }
|
|
15744
16596
|
};
|
|
15745
16597
|
if (classification.outcome !== "failed" || classification.severity === "recovered") ctx.logger.info(fields, "event");
|
|
15746
16598
|
else ctx.logger.error(fields, "event");
|
|
@@ -15749,12 +16601,86 @@ const clientRenderFailureRoute = () => baseProcedure.input(clientRenderFailureIn
|
|
|
15749
16601
|
|
|
15750
16602
|
//#endregion
|
|
15751
16603
|
//#region ../api/src/shared/observability/client-save-telemetry.router.ts
|
|
15752
|
-
|
|
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);
|
|
16606
|
+
const eventPropertiesOf = (input, trace, apiBuild, environment) => ({
|
|
16607
|
+
schema_version: trace.schema,
|
|
16608
|
+
event_id: trace.eventId,
|
|
16609
|
+
kind: trace.kind,
|
|
16610
|
+
episode_key: trace.episodeKey ?? null,
|
|
16611
|
+
next_episode_key: trace.nextEpisodeKey ?? null,
|
|
16612
|
+
appearance_id: trace.appearanceId ?? null,
|
|
16613
|
+
trigger: trace.trigger ?? null,
|
|
16614
|
+
notice_cause: trace.cause ?? null,
|
|
16615
|
+
severity: trace.severity,
|
|
16616
|
+
command: trace.command,
|
|
16617
|
+
operation_kinds: trace.operationKinds,
|
|
16618
|
+
refusal_code: trace.refusalCode ?? null,
|
|
16619
|
+
refused_operation: trace.operation ?? null,
|
|
16620
|
+
refused_component: trace.component ?? null,
|
|
16621
|
+
device_protection: trace.deviceProtection,
|
|
16622
|
+
uploads_waiting: trace.uploadsWaiting,
|
|
16623
|
+
uploads_blocked: trace.uploadsBlocked,
|
|
16624
|
+
save_hold: trace.saveHold ?? null,
|
|
16625
|
+
available_actions: trace.actions,
|
|
16626
|
+
sync_block: trace.syncBlock ?? null,
|
|
16627
|
+
overwrite_block: trace.overwriteBlock ?? null,
|
|
16628
|
+
outcome: trace.outcome ?? null,
|
|
16629
|
+
action: trace.action ?? null,
|
|
16630
|
+
replay: trace.replay,
|
|
16631
|
+
lost_records: trace.lostRecords,
|
|
16632
|
+
canvas_id: input.canvasId,
|
|
16633
|
+
mutation_id: input.mutationId ?? null,
|
|
16634
|
+
document_version: input.version,
|
|
16635
|
+
retry_count: input.attempts,
|
|
16636
|
+
duration_ms: input.durationMs,
|
|
16637
|
+
pending_changes: input.pendingChanges,
|
|
16638
|
+
client_build: input.releaseIdentity,
|
|
16639
|
+
client_build_exact: isExactBuild(input.releaseIdentity),
|
|
16640
|
+
api_build: apiBuild,
|
|
16641
|
+
api_build_exact: isExactBuild(apiBuild),
|
|
16642
|
+
environment
|
|
16643
|
+
});
|
|
16644
|
+
/**
|
|
16645
|
+
* Sends one traced record and says what became of it. Only the API sends these events, because the
|
|
16646
|
+
* browser's library can be blocked and turns itself off under automation.
|
|
16647
|
+
*/
|
|
16648
|
+
const deliverCanvasSaveRecord = async (analytics, input, personId, build) => {
|
|
16649
|
+
const { trace } = input;
|
|
16650
|
+
if (trace === void 0) return void 0;
|
|
16651
|
+
if (analytics.isEnabled !== true || analytics.deliver === void 0) return "disabled";
|
|
16652
|
+
if (personId === null) return "no-identity";
|
|
16653
|
+
return (await analytics.deliver({
|
|
16654
|
+
distinctId: personId,
|
|
16655
|
+
event: trace.kind === "shown" ? "canvas_save_notice_shown" : "canvas_save_recovery_transition",
|
|
16656
|
+
properties: eventPropertiesOf(input, trace, build.apiBuild, build.environment),
|
|
16657
|
+
insertId: trace.eventId,
|
|
16658
|
+
occurredAt: new Date(trace.occurredAt)
|
|
16659
|
+
})).unwrapOr(false) ? "delivered" : "failed";
|
|
16660
|
+
};
|
|
16661
|
+
const clientSaveTelemetryRoute = (deps) => baseProcedure.input(clientSaveIncidentInputSchema).output(clientSaveIncidentOutputSchema).mutation(async ({ input, ctx }) => {
|
|
16662
|
+
const { analytics, apiBuild, environment } = deps;
|
|
16663
|
+
const { trace, ...report } = input;
|
|
15753
16664
|
ctx.logger.warn({
|
|
15754
|
-
...
|
|
16665
|
+
...report,
|
|
16666
|
+
...trace !== void 0 && {
|
|
16667
|
+
...trace,
|
|
16668
|
+
operationKinds: trace.operationKinds.join(","),
|
|
16669
|
+
actions: trace.actions.join(","),
|
|
16670
|
+
apiBuild,
|
|
16671
|
+
apiBuildExact: isExactBuild(apiBuild),
|
|
16672
|
+
environment
|
|
16673
|
+
},
|
|
15755
16674
|
event: "CanvasSyncOutcome"
|
|
15756
16675
|
}, "event");
|
|
15757
|
-
|
|
16676
|
+
const state = await deliverCanvasSaveRecord(analytics, input, ctx.viewer.kind === "person" ? ctx.viewer.personId : null, {
|
|
16677
|
+
apiBuild,
|
|
16678
|
+
environment
|
|
16679
|
+
});
|
|
16680
|
+
return {
|
|
16681
|
+
accepted: true,
|
|
16682
|
+
...state !== void 0 && { analytics: state }
|
|
16683
|
+
};
|
|
15758
16684
|
});
|
|
15759
16685
|
|
|
15760
16686
|
//#endregion
|
|
@@ -15883,7 +16809,8 @@ const canvasRouter = (handlers, options) => trpcRouter({
|
|
|
15883
16809
|
render: trpcRouter({
|
|
15884
16810
|
...createRenderRouter(handlers.render)._def.record,
|
|
15885
16811
|
preparation: createCanvasPreparationRouter(handlers.render),
|
|
15886
|
-
...createRenderExposureRouter(handlers.render)._def.record
|
|
16812
|
+
...createRenderExposureRouter(handlers.render)._def.record,
|
|
16813
|
+
...createRenderExportRouter(handlers.render)._def.record
|
|
15887
16814
|
}),
|
|
15888
16815
|
thumbnail: createCanvasThumbnailRouter(),
|
|
15889
16816
|
participants: createCanvasParticipantRouter(handlers.canvas),
|
|
@@ -15919,7 +16846,7 @@ const createAppRouter = (handlers, options = DEFAULT_ROUTER_OPTIONS) => trpcRout
|
|
|
15919
16846
|
performance: clientPerformanceTelemetryRoute(),
|
|
15920
16847
|
conversion: clientConversionTelemetryRoute(),
|
|
15921
16848
|
renderFailure: clientRenderFailureRoute(),
|
|
15922
|
-
save: clientSaveTelemetryRoute()
|
|
16849
|
+
save: clientSaveTelemetryRoute(handlers.saveTelemetry)
|
|
15923
16850
|
})
|
|
15924
16851
|
});
|
|
15925
16852
|
|
|
@@ -16126,6 +17053,11 @@ const handlers = {
|
|
|
16126
17053
|
transcript: {
|
|
16127
17054
|
get: unavailable,
|
|
16128
17055
|
retry: unavailable
|
|
17056
|
+
},
|
|
17057
|
+
saveTelemetry: {
|
|
17058
|
+
analytics: { track: () => {} },
|
|
17059
|
+
apiBuild: "cli",
|
|
17060
|
+
environment: "test"
|
|
16129
17061
|
}
|
|
16130
17062
|
};
|
|
16131
17063
|
const createRouterShapeAdapter = () => createAppRouter(handlers);
|
|
@@ -16696,4 +17628,4 @@ const withCommandInFailure = (value, commandName) => ({
|
|
|
16696
17628
|
});
|
|
16697
17629
|
|
|
16698
17630
|
//#endregion
|
|
16699
|
-
export { canvasRenderPendingSchema as $,
|
|
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 };
|