@enhance-eng/enhance 0.1.6 → 0.1.13
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/{capability-inventory.mapper-DN3TEDbU.mjs → capability-inventory.mapper-DyYXyVBJ.mjs} +2 -1
- package/dist/{failure.mapper-CNRVSTrf.mjs → cli-output-identity.lib-DAJiBMGX.mjs} +1546 -211
- package/dist/{file-credential.adapter-WNl4GM58.mjs → file-credential.adapter-rI5HpMEo.mjs} +3 -1
- package/dist/main.mjs +656 -673
- package/dist/mcp-invocation.adapter-BG-WBGEr.mjs +119 -0
- package/dist/mcp-main.mjs +175 -9
- package/dist/{mcp-server.adapter-T8UqHf6A.mjs → mcp-server.adapter-BgUZCdl4.mjs} +165 -153
- package/dist/mcp.mjs +5 -4
- package/dist/{mutation-key.adapter-B7Ss_464.mjs → mutation-key.adapter-BffKsNR-.mjs} +283 -29
- package/dist/remote-mcp-main.mjs +11 -8
- package/package.json +1 -1
- package/dist/mcp-invocation.adapter-D0o0vb_-.mjs +0 -17
|
@@ -5,8 +5,10 @@ import { createHash } from "node:crypto";
|
|
|
5
5
|
import { TRPCError, initTRPC } from "@trpc/server";
|
|
6
6
|
import { middlewareMarker } from "@trpc/server/unstable-core-do-not-import";
|
|
7
7
|
import { TRPCClientError } from "@trpc/client";
|
|
8
|
+
|
|
8
9
|
//#region \0rolldown/runtime.js
|
|
9
10
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
|
+
|
|
10
12
|
//#endregion
|
|
11
13
|
//#region ../../packages/contract/src/shared/limits.consts.ts
|
|
12
14
|
const MAX_URL_LENGTH = 2048;
|
|
@@ -19,10 +21,21 @@ const MAX_COMMENT_TEXT_LENGTH = 1e3;
|
|
|
19
21
|
/** Sizes and durations as factors, so a ceiling reads as a quantity rather than as arithmetic. */
|
|
20
22
|
const BYTES_PER_KIB$2 = 1024;
|
|
21
23
|
const BYTES_PER_MIB$2 = BYTES_PER_KIB$2 * BYTES_PER_KIB$2;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
+
const MS_PER_SECOND$2 = 1e3;
|
|
25
|
+
const SECONDS_PER_MINUTE$2 = 60;
|
|
26
|
+
const MINUTES_PER_HOUR$2 = 60;
|
|
27
|
+
const MS_PER_MINUTE$1 = MS_PER_SECOND$2 * 60;
|
|
28
|
+
const MS_PER_HOUR$1 = MS_PER_MINUTE$1 * 60;
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region ../../packages/contract/src/shared/pagination.schema.ts
|
|
32
|
+
/** As many rows as any caller may ask for at once, and what it gets for not asking. */
|
|
33
|
+
const MAX_PAGE_SIZE = 100;
|
|
34
|
+
const DEFAULT_PAGE_SIZE = 20;
|
|
35
|
+
/** Cursor pagination, defined once so no endpoint invents its own page shape. */
|
|
36
|
+
const paginationSchema = z.object({
|
|
24
37
|
cursor: z.string().nullable().default(null),
|
|
25
|
-
limit: z.number().int().min(1).max(
|
|
38
|
+
limit: z.number().int().min(1).max(MAX_PAGE_SIZE).default(DEFAULT_PAGE_SIZE)
|
|
26
39
|
});
|
|
27
40
|
/**
|
|
28
41
|
* A collection bounded by human behaviour rather than by a cursor: every row up to a
|
|
@@ -36,7 +49,15 @@ const cappedSchema = (item) => z.object({
|
|
|
36
49
|
items: z.array(item),
|
|
37
50
|
truncated: z.boolean()
|
|
38
51
|
});
|
|
39
|
-
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../../packages/contract/src/canvas/canvas-thumbnail.schema.ts
|
|
55
|
+
const THUMBNAIL_WIDTH = 528;
|
|
56
|
+
const THUMBNAIL_HEIGHT = 312;
|
|
57
|
+
/** @justified docs/comments.md#warning Lossless PNG needs more headroom than client JPEG/WebP. */
|
|
58
|
+
const THUMBNAIL_MAX_KIB = 1024;
|
|
59
|
+
const MAX_RELEASE_IDENTITY_LENGTH = 100;
|
|
60
|
+
const MAX_THUMBNAIL_BYTES = THUMBNAIL_MAX_KIB * BYTES_PER_KIB$2;
|
|
40
61
|
const thumbnailFallbackReasonSchema = z.enum([
|
|
41
62
|
"never-captured",
|
|
42
63
|
"capture-pending",
|
|
@@ -63,16 +84,27 @@ const reportCanvasThumbnailUnavailableInputSchema = z.object({
|
|
|
63
84
|
recoveryOutcome: z.literal("fallback-shown")
|
|
64
85
|
});
|
|
65
86
|
const reportCanvasThumbnailUnavailableOutputSchema = z.object({ recorded: z.literal(true) });
|
|
66
|
-
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region ../../packages/contract/src/canvas/canvas.schema.ts
|
|
90
|
+
/**
|
|
91
|
+
* The canvas: the surface a walkthrough lands on, and the unit of access.
|
|
92
|
+
*
|
|
93
|
+
* These schemas are the wire contract. The api's domain has its own `Canvas` entity and its
|
|
94
|
+
* own vocabulary; the two are mapped, never shared (`core-not-to-contract`).
|
|
95
|
+
*/
|
|
96
|
+
const CANVAS_ACCESS_STATES = [
|
|
67
97
|
"invite-only",
|
|
68
98
|
"link-view",
|
|
69
99
|
"link-comment"
|
|
70
|
-
]
|
|
71
|
-
const
|
|
100
|
+
];
|
|
101
|
+
const canvasAccessStateSchema = z.enum(CANVAS_ACCESS_STATES);
|
|
102
|
+
const ACCESS_LEVELS = [
|
|
72
103
|
"owner",
|
|
73
104
|
"can-comment",
|
|
74
105
|
"can-view"
|
|
75
|
-
]
|
|
106
|
+
];
|
|
107
|
+
const accessLevelSchema = z.enum(ACCESS_LEVELS);
|
|
76
108
|
/** The two levels an invite may offer. Only the creator is an owner, and only by creating. */
|
|
77
109
|
const grantableAccessLevelSchema = z.enum(["can-comment", "can-view"]);
|
|
78
110
|
/** What this viewer may do here, resolved server-side so the UI never has to guess. */
|
|
@@ -132,10 +164,11 @@ const canvasCardBaseSchema = canvasSchema.extend({
|
|
|
132
164
|
screenCount: z.number().int().min(0),
|
|
133
165
|
hasRecording: z.boolean()
|
|
134
166
|
});
|
|
135
|
-
const
|
|
167
|
+
const canvasCardSchema = z.union([canvasCardBaseSchema.extend({ thumbnail: canvasThumbnailPreviewSchema }), canvasCardBaseSchema.extend({
|
|
136
168
|
thumbnail: z.null(),
|
|
137
169
|
thumbnailFallbackReason: thumbnailFallbackReasonSchema
|
|
138
|
-
})])
|
|
170
|
+
})]);
|
|
171
|
+
const listCanvasesOutputSchema = cappedSchema(canvasCardSchema);
|
|
139
172
|
const renameCanvasInputSchema = z.object({
|
|
140
173
|
canvasId: z.uuid(),
|
|
141
174
|
title: z.string().trim().min(1).max(200)
|
|
@@ -175,11 +208,299 @@ const markCanvasViewedInputSchema = z.object({ canvasId: z.uuid() });
|
|
|
175
208
|
const markCanvasViewedOutputSchema = z.object({ lastViewedAt: z.iso.datetime().nullable() });
|
|
176
209
|
const restoreCanvasInputSchema = z.object({ canvasId: z.uuid() });
|
|
177
210
|
const restoreCanvasOutputSchema = z.object({ canvasId: z.uuid() });
|
|
211
|
+
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region ../../packages/contract/src/canvas/canvas-css-values.lib.ts
|
|
214
|
+
const UNITLESS_PROPERTIES = /* @__PURE__ */ new Set([
|
|
215
|
+
"aspect-ratio",
|
|
216
|
+
"-webkit-line-clamp",
|
|
217
|
+
"line-clamp",
|
|
218
|
+
"flex-grow",
|
|
219
|
+
"flex-shrink",
|
|
220
|
+
"font-weight",
|
|
221
|
+
"opacity",
|
|
222
|
+
"order",
|
|
223
|
+
"z-index",
|
|
224
|
+
"grid-area",
|
|
225
|
+
"grid-row",
|
|
226
|
+
"grid-column",
|
|
227
|
+
"grid-row-start",
|
|
228
|
+
"grid-row-end",
|
|
229
|
+
"grid-column-start",
|
|
230
|
+
"grid-column-end"
|
|
231
|
+
]);
|
|
232
|
+
const canvasCssValue = (property, value) => typeof value === "number" && !UNITLESS_PROPERTIES.has(property.toLowerCase()) ? `${String(value)}px` : String(value);
|
|
233
|
+
const SIDES$1 = [
|
|
234
|
+
"top",
|
|
235
|
+
"right",
|
|
236
|
+
"bottom",
|
|
237
|
+
"left"
|
|
238
|
+
];
|
|
239
|
+
const LEFT_SIDE_INDEX = 3;
|
|
240
|
+
const GRID_TEMPLATE_PROPERTIES = [
|
|
241
|
+
"grid-template-rows",
|
|
242
|
+
"grid-template-columns",
|
|
243
|
+
"grid-template-areas"
|
|
244
|
+
];
|
|
245
|
+
const SHORTHANDS = {
|
|
246
|
+
gap: ["row-gap", "column-gap"],
|
|
247
|
+
padding: SIDES$1.map((side) => `padding-${side}`),
|
|
248
|
+
margin: SIDES$1.map((side) => `margin-${side}`),
|
|
249
|
+
flex: [
|
|
250
|
+
"flex-grow",
|
|
251
|
+
"flex-shrink",
|
|
252
|
+
"flex-basis"
|
|
253
|
+
],
|
|
254
|
+
"flex-flow": ["flex-direction", "flex-wrap"],
|
|
255
|
+
"place-content": ["align-content", "justify-content"],
|
|
256
|
+
"place-items": ["align-items", "justify-items"],
|
|
257
|
+
"place-self": ["align-self", "justify-self"],
|
|
258
|
+
"grid-template": GRID_TEMPLATE_PROPERTIES,
|
|
259
|
+
grid: [
|
|
260
|
+
...GRID_TEMPLATE_PROPERTIES,
|
|
261
|
+
"grid-auto-rows",
|
|
262
|
+
"grid-auto-columns",
|
|
263
|
+
"grid-auto-flow"
|
|
264
|
+
],
|
|
265
|
+
"grid-row": ["grid-row-start", "grid-row-end"],
|
|
266
|
+
"grid-column": ["grid-column-start", "grid-column-end"],
|
|
267
|
+
"grid-area": [
|
|
268
|
+
"grid-row-start",
|
|
269
|
+
"grid-column-start",
|
|
270
|
+
"grid-row-end",
|
|
271
|
+
"grid-column-end"
|
|
272
|
+
]
|
|
273
|
+
};
|
|
274
|
+
/** Related declarations stay authored; a longhand edit must not discard the rest of a shorthand. */
|
|
275
|
+
const canvasCssPropertyScope = (property) => SHORTHANDS[property.toLowerCase()] ?? [property.toLowerCase()];
|
|
276
|
+
const componentStateAfter = (state, character) => {
|
|
277
|
+
if (state.isEscaped) return {
|
|
278
|
+
...state,
|
|
279
|
+
isEscaped: false
|
|
280
|
+
};
|
|
281
|
+
if (character === "\\") return {
|
|
282
|
+
...state,
|
|
283
|
+
isEscaped: true
|
|
284
|
+
};
|
|
285
|
+
if (state.quote !== "") return {
|
|
286
|
+
...state,
|
|
287
|
+
quote: state.quote === character ? "" : state.quote
|
|
288
|
+
};
|
|
289
|
+
if (["\"", "'"].includes(character)) return {
|
|
290
|
+
...state,
|
|
291
|
+
quote: character
|
|
292
|
+
};
|
|
293
|
+
const delta = [
|
|
294
|
+
"(",
|
|
295
|
+
"[",
|
|
296
|
+
"{"
|
|
297
|
+
].includes(character) ? 1 : [
|
|
298
|
+
")",
|
|
299
|
+
"]",
|
|
300
|
+
"}"
|
|
301
|
+
].includes(character) ? -1 : 0;
|
|
302
|
+
return {
|
|
303
|
+
...state,
|
|
304
|
+
depth: state.depth + delta
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
/** Split only at CSS component boundaries, keeping functions, line names and strings intact. */
|
|
308
|
+
const canvasCssTokens = (value, separator = "space") => {
|
|
309
|
+
const tokens = [];
|
|
310
|
+
let token = "";
|
|
311
|
+
let state = {
|
|
312
|
+
depth: 0,
|
|
313
|
+
quote: "",
|
|
314
|
+
isEscaped: false
|
|
315
|
+
};
|
|
316
|
+
for (const character of value) {
|
|
317
|
+
const canSplit = state.depth === 0 && state.quote === "" && !state.isEscaped;
|
|
318
|
+
state = componentStateAfter(state, character);
|
|
319
|
+
if (canSplit && (separator === "space" ? /\s/u.test(character) : character === separator)) {
|
|
320
|
+
if (separator !== "space" || token !== "") tokens.push(token.trim());
|
|
321
|
+
token = "";
|
|
322
|
+
} else token += character;
|
|
323
|
+
}
|
|
324
|
+
if (separator !== "space" || token !== "") tokens.push(token.trim());
|
|
325
|
+
return tokens;
|
|
326
|
+
};
|
|
327
|
+
const omittedGridLine = (value) => /^(?:--|-?[_a-z\u{80}-\u{FFFF}])[-\w\u{80}-\u{FFFF}]*$/iu.test(value) && !/^(?:auto|span|initial|unset)$/iu.test(value) ? value : "auto";
|
|
328
|
+
const gridPlacementValue = (property, value, index) => {
|
|
329
|
+
const parts = canvasCssTokens(value, "/");
|
|
330
|
+
const first = parts[0] ?? value;
|
|
331
|
+
if (property !== "grid-area") return parts[index] ?? omittedGridLine(first);
|
|
332
|
+
const column = parts[1] ?? omittedGridLine(first);
|
|
333
|
+
return [
|
|
334
|
+
first,
|
|
335
|
+
column,
|
|
336
|
+
parts[2] ?? omittedGridLine(first),
|
|
337
|
+
parts[3] ?? omittedGridLine(column)
|
|
338
|
+
][index] ?? value;
|
|
339
|
+
};
|
|
340
|
+
const implicitGridValues = (row, column, hasAutoRows) => {
|
|
341
|
+
const tokens = canvasCssTokens(hasAutoRows ? row : column);
|
|
342
|
+
const size = tokens.filter((token) => !/^(?:auto-flow|dense)$/iu.test(token)).join(" ");
|
|
343
|
+
const flow = `${hasAutoRows ? "row" : "column"}${tokens.some((token) => /^dense$/iu.test(token)) ? " dense" : ""}`;
|
|
344
|
+
return [
|
|
345
|
+
hasAutoRows ? "none" : row,
|
|
346
|
+
hasAutoRows ? column : "none",
|
|
347
|
+
"none",
|
|
348
|
+
hasAutoRows && size !== "" ? size : "auto",
|
|
349
|
+
!hasAutoRows && size !== "" ? size : "auto",
|
|
350
|
+
flow
|
|
351
|
+
];
|
|
352
|
+
};
|
|
353
|
+
const gridTemplateValue = (property, value, index) => {
|
|
354
|
+
if (/^(?:none|initial|unset)$/iu.test(value)) return [
|
|
355
|
+
"none",
|
|
356
|
+
"none",
|
|
357
|
+
"none",
|
|
358
|
+
"auto",
|
|
359
|
+
"auto",
|
|
360
|
+
"row"
|
|
361
|
+
][index] ?? value;
|
|
362
|
+
const parts = canvasCssTokens(value, "/");
|
|
363
|
+
const row = parts[0] ?? value;
|
|
364
|
+
const column = parts[1];
|
|
365
|
+
if (row === "" || column === "" || parts.length > 2) return value;
|
|
366
|
+
const hasAutoRows = canvasCssTokens(row).some((token) => token.toLowerCase() === "auto-flow");
|
|
367
|
+
const hasAutoColumns = column !== void 0 && canvasCssTokens(column).some((token) => token.toLowerCase() === "auto-flow");
|
|
368
|
+
if (property === "grid" && column !== void 0 && hasAutoRows !== hasAutoColumns) return implicitGridValues(row, column, hasAutoRows)[index] ?? value;
|
|
369
|
+
if (hasAutoRows || hasAutoColumns) return value;
|
|
370
|
+
const hasAreas = /["']/u.test(row);
|
|
371
|
+
if (column === void 0 && !hasAreas) return value;
|
|
372
|
+
return [
|
|
373
|
+
hasAreas ? value : row,
|
|
374
|
+
column ?? "none",
|
|
375
|
+
hasAreas ? row : "none",
|
|
376
|
+
"auto",
|
|
377
|
+
"auto",
|
|
378
|
+
"row"
|
|
379
|
+
][index] ?? value;
|
|
380
|
+
};
|
|
381
|
+
const flexValues = (tokens) => {
|
|
382
|
+
const numbers = [];
|
|
383
|
+
let basis = "0%";
|
|
384
|
+
for (const token of tokens) if (/^(?:\d+(?:\.\d*)?|\.\d+)$/u.test(token) && numbers.length < 2) numbers.push(token);
|
|
385
|
+
else basis = token;
|
|
386
|
+
return [
|
|
387
|
+
numbers[0] ?? "1",
|
|
388
|
+
numbers[1] ?? "1",
|
|
389
|
+
basis
|
|
390
|
+
];
|
|
391
|
+
};
|
|
392
|
+
const canvasCssShorthandValue = (property, value, index) => {
|
|
393
|
+
if (/(?:var|env)\(|^(?:inherit|revert(?:-layer)?)$/iu.test(value)) return value;
|
|
394
|
+
if (/^grid-(?:area|row|column)$/u.test(property)) return gridPlacementValue(property, value, index);
|
|
395
|
+
if (property === "grid-template" || property === "grid") return gridTemplateValue(property, value, index);
|
|
396
|
+
const tokens = canvasCssTokens(value);
|
|
397
|
+
if (property === "flex-flow") return index === 0 ? tokens.find((token) => /^(?:row|column)(?:-reverse)?$/u.test(token)) ?? "row" : tokens.find((token) => /^(?:nowrap|wrap|wrap-reverse)$/u.test(token)) ?? "nowrap";
|
|
398
|
+
if (property === "flex") {
|
|
399
|
+
if (value === "none") return [
|
|
400
|
+
"0",
|
|
401
|
+
"0",
|
|
402
|
+
"auto"
|
|
403
|
+
][index] ?? value;
|
|
404
|
+
if (value === "initial") return [
|
|
405
|
+
"0",
|
|
406
|
+
"1",
|
|
407
|
+
"auto"
|
|
408
|
+
][index] ?? value;
|
|
409
|
+
return flexValues(tokens)[index] ?? value;
|
|
410
|
+
}
|
|
411
|
+
return tokens[index] ?? (index === LEFT_SIDE_INDEX ? tokens[1] : void 0) ?? tokens[0] ?? value;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region ../../packages/contract/src/canvas/canvas-authored-css.lib.ts
|
|
416
|
+
const canvasAdditionalStyleDeclarations = (node) => {
|
|
417
|
+
if (node.additionalStyles === void 0) return {};
|
|
418
|
+
return Object.fromEntries(node.additionalStyles.declarations.filter((declaration) => declaration.enabled).map((declaration) => [declaration.property, declaration.value]));
|
|
419
|
+
};
|
|
420
|
+
/** Additional-style controls exclusively own every property they expose, including when off. */
|
|
421
|
+
const canvasAuthoredStyleDeclarations = (node) => {
|
|
422
|
+
const controlledProperties = new Set(node.additionalStyles?.declarations.map((declaration) => declaration.property.toLowerCase()));
|
|
423
|
+
return {
|
|
424
|
+
...Object.fromEntries(Object.entries(node.styles).filter(([property]) => !controlledProperties.has(property.toLowerCase()))),
|
|
425
|
+
...canvasAdditionalStyleDeclarations(node)
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
const hasCanvasCssPriority = (value) => /!important\s*$/iu.test(String(value));
|
|
429
|
+
const cssValue = (value, shouldPreserveCase) => {
|
|
430
|
+
const source = String(value).replace(/\s*!important\s*$/iu, "").trim();
|
|
431
|
+
return shouldPreserveCase || source.includes("(") ? source : source.toLowerCase();
|
|
432
|
+
};
|
|
433
|
+
/** Read supported authored longhands without measuring or rewriting unresolved CSS expressions. */
|
|
434
|
+
const canvasAuthoredLayoutValueOf = (node, property) => {
|
|
435
|
+
let result = null;
|
|
436
|
+
let isImportant = false;
|
|
437
|
+
const declarations = Object.entries(canvasAuthoredStyleDeclarations(node));
|
|
438
|
+
for (const [key, raw] of declarations) {
|
|
439
|
+
const scope = canvasCssPropertyScope(key);
|
|
440
|
+
const index = scope.indexOf(property);
|
|
441
|
+
if (index === -1) continue;
|
|
442
|
+
const isPriority = hasCanvasCssPriority(raw);
|
|
443
|
+
if (isImportant && !isPriority) continue;
|
|
444
|
+
const value = cssValue(raw, /^grid(?:-|$)/iu.test(key));
|
|
445
|
+
result = scope.length === 1 ? value : canvasCssShorthandValue(key.toLowerCase(), value, index);
|
|
446
|
+
isImportant = isPriority;
|
|
447
|
+
}
|
|
448
|
+
return result ?? void 0;
|
|
449
|
+
};
|
|
450
|
+
/** Named controls override only their own longhand, even beside an important shorthand. */
|
|
451
|
+
const canvasLayoutPriorityDeclarations = (node, declarations) => {
|
|
452
|
+
const important = new Set(Object.entries(canvasAuthoredStyleDeclarations(node)).filter(([, value]) => hasCanvasCssPriority(value)).flatMap(([property]) => canvasCssPropertyScope(property)));
|
|
453
|
+
return Object.fromEntries(Object.entries(declarations).map(([property, value]) => [property, canvasCssPropertyScope(property).some((owned) => important.has(owned)) && !hasCanvasCssPriority(value) ? `${canvasCssValue(property, value)} !important` : value]));
|
|
454
|
+
};
|
|
455
|
+
const canvasWritingModeOf = (node, document) => {
|
|
456
|
+
const visited = /* @__PURE__ */ new Set();
|
|
457
|
+
let current = node;
|
|
458
|
+
while (current !== void 0 && !visited.has(current.id)) {
|
|
459
|
+
visited.add(current.id);
|
|
460
|
+
const value = canvasAuthoredLayoutValueOf(current, "writing-mode");
|
|
461
|
+
if (value !== void 0 && value !== "inherit" && value !== "unset") return value;
|
|
462
|
+
if (document === void 0) break;
|
|
463
|
+
const parentId = document.relationships[current.id]?.parentId;
|
|
464
|
+
if (parentId === void 0) break;
|
|
465
|
+
current = document.nodes[parentId];
|
|
466
|
+
}
|
|
467
|
+
return "horizontal-tb";
|
|
468
|
+
};
|
|
469
|
+
const canvasAxisStyleProperties = (node, axis, document) => {
|
|
470
|
+
const isVerticalWriting = /^(?:vertical|sideways)-/u.test(canvasWritingModeOf(node, document));
|
|
471
|
+
return [axis === "horizontal" ? "width" : "height", axis === "vertical" === isVerticalWriting ? "inline-size" : "block-size"];
|
|
472
|
+
};
|
|
473
|
+
/** Authored display wins over legacy presets; Grid has no Flex main axis. */
|
|
474
|
+
const canvasLayoutFlowOf = (node) => {
|
|
475
|
+
if (node === void 0) return "freeform";
|
|
476
|
+
const display = canvasAuthoredLayoutValueOf(node, "display");
|
|
477
|
+
if (display !== void 0) {
|
|
478
|
+
if (/^(?:(?:inline|block)\s+|inline-)?grid$/u.test(display)) return "grid";
|
|
479
|
+
if (/^(?:(?:inline|block)\s+|inline-)?flex$/u.test(display)) return "flex";
|
|
480
|
+
return "freeform";
|
|
481
|
+
}
|
|
482
|
+
const container = node.layout?.container;
|
|
483
|
+
if (container === void 0) return "freeform";
|
|
484
|
+
return container.gridColumns !== void 0 || container.gridAutoRepeat !== void 0 ? "grid" : "flex";
|
|
485
|
+
};
|
|
486
|
+
/** Read a Flex main axis in its inherited writing mode without persisting a preset. */
|
|
487
|
+
const canvasLayoutMainAxisOf = (node, document) => {
|
|
488
|
+
if (node === void 0) return void 0;
|
|
489
|
+
if (canvasLayoutFlowOf(node) !== "flex") return void 0;
|
|
490
|
+
const container = node.layout?.container;
|
|
491
|
+
const css = (property) => canvasAuthoredLayoutValueOf(node, property);
|
|
492
|
+
const direction = container?.direction ?? css("flex-direction") ?? "row";
|
|
493
|
+
if (!/^(?:row|column)(?:-reverse)?$/u.test(direction)) return void 0;
|
|
494
|
+
const isVerticalWriting = /^(?:vertical|sideways)-/u.test(canvasWritingModeOf(node, document));
|
|
495
|
+
return direction.startsWith("column") === isVerticalWriting ? "horizontal" : "vertical";
|
|
496
|
+
};
|
|
497
|
+
|
|
178
498
|
//#endregion
|
|
179
499
|
//#region ../../packages/contract/src/canvas/canvas-limits.schema.ts
|
|
180
500
|
const MAX_CANVAS_VALUE = 1e5;
|
|
181
501
|
const boundedCanvasNumberSchema = z.number().min(-1e5).max(MAX_CANVAS_VALUE);
|
|
182
502
|
const nonNegativeCanvasNumberSchema = z.number().nonnegative().max(MAX_CANVAS_VALUE);
|
|
503
|
+
|
|
183
504
|
//#endregion
|
|
184
505
|
//#region ../../packages/contract/src/canvas/canvas-layout.schema.ts
|
|
185
506
|
const canvasParentSizeBoundSchema = z.object({
|
|
@@ -196,15 +517,12 @@ const canvasSizeIntentSchema = z.discriminatedUnion("mode", [
|
|
|
196
517
|
z.object({
|
|
197
518
|
mode: z.literal("fixed"),
|
|
198
519
|
value: nonNegativeCanvasNumberSchema
|
|
199
|
-
}),
|
|
200
|
-
canvasSizeIntentBoundsSchema.extend({
|
|
201
|
-
mode: z.literal("hug"),
|
|
202
|
-
basis: nonNegativeCanvasNumberSchema.optional()
|
|
203
|
-
}),
|
|
520
|
+
}).strict(),
|
|
521
|
+
canvasSizeIntentBoundsSchema.extend({ mode: z.literal("hug") }).strict(),
|
|
204
522
|
canvasSizeIntentBoundsSchema.extend({
|
|
205
523
|
mode: z.literal("fill"),
|
|
206
524
|
offset: boundedCanvasNumberSchema.optional()
|
|
207
|
-
})
|
|
525
|
+
}).strict()
|
|
208
526
|
]);
|
|
209
527
|
const canvasFlexPaddingSchema = z.object({
|
|
210
528
|
top: nonNegativeCanvasNumberSchema,
|
|
@@ -219,15 +537,6 @@ const canvasFlexMarginSchema = z.object({
|
|
|
219
537
|
bottom: canvasFlexMarginValueSchema,
|
|
220
538
|
left: canvasFlexMarginValueSchema
|
|
221
539
|
});
|
|
222
|
-
const canvasGridTrackSchema = z.object({
|
|
223
|
-
basis: nonNegativeCanvasNumberSchema,
|
|
224
|
-
align: z.enum([
|
|
225
|
-
"start",
|
|
226
|
-
"center",
|
|
227
|
-
"end",
|
|
228
|
-
"stretch"
|
|
229
|
-
])
|
|
230
|
-
});
|
|
231
540
|
const canvasGridAutoRepeatSchema = z.object({
|
|
232
541
|
mode: z.enum(["auto-fill", "auto-fit"]),
|
|
233
542
|
minimum: z.number().positive().max(MAX_CANVAS_VALUE)
|
|
@@ -268,16 +577,16 @@ const canvasFlexLayoutSchema = z.object({
|
|
|
268
577
|
gridColumns: z.number().int().positive().max(MAX_CANVAS_VALUE).optional(),
|
|
269
578
|
gridAutoRepeat: canvasGridAutoRepeatSchema.optional(),
|
|
270
579
|
padding: canvasFlexPaddingSchema
|
|
271
|
-
});
|
|
580
|
+
}).strict();
|
|
272
581
|
const canvasNodeLayoutSchema = z.object({
|
|
273
|
-
rotation: boundedCanvasNumberSchema,
|
|
582
|
+
rotation: boundedCanvasNumberSchema.optional(),
|
|
274
583
|
flipHorizontal: z.boolean().optional(),
|
|
275
584
|
flipVertical: z.boolean().optional(),
|
|
276
585
|
aspectRatioLocked: z.boolean().optional(),
|
|
277
586
|
aspectRatio: z.number().positive().max(MAX_CANVAS_VALUE).optional(),
|
|
278
|
-
horizontal: canvasSizeIntentSchema,
|
|
279
|
-
vertical: canvasSizeIntentSchema,
|
|
280
|
-
position: z.enum(["flow", "absolute"]),
|
|
587
|
+
horizontal: canvasSizeIntentSchema.optional(),
|
|
588
|
+
vertical: canvasSizeIntentSchema.optional(),
|
|
589
|
+
position: z.enum(["flow", "absolute"]).optional(),
|
|
281
590
|
alignSelf: z.enum([
|
|
282
591
|
"auto",
|
|
283
592
|
"start",
|
|
@@ -294,11 +603,11 @@ const canvasNodeLayoutSchema = z.object({
|
|
|
294
603
|
]).optional(),
|
|
295
604
|
flowOffset: canvasFlowOffsetSchema.optional(),
|
|
296
605
|
order: boundedCanvasNumberSchema.int().optional(),
|
|
297
|
-
margin: canvasFlexMarginSchema.optional(),
|
|
298
|
-
gridTrack: canvasGridTrackSchema.optional(),
|
|
606
|
+
margin: canvasFlexMarginSchema.partial().optional(),
|
|
299
607
|
clipContent: z.boolean().optional(),
|
|
300
|
-
container: canvasFlexLayoutSchema.optional()
|
|
301
|
-
});
|
|
608
|
+
container: canvasFlexLayoutSchema.partial().extend({ padding: canvasFlexPaddingSchema.partial().optional() }).optional()
|
|
609
|
+
}).strict();
|
|
610
|
+
|
|
302
611
|
//#endregion
|
|
303
612
|
//#region ../../packages/contract/src/canvas/canvas-presentation.schema.ts
|
|
304
613
|
const MAX_ITEM_ID_LENGTH$1 = 200;
|
|
@@ -364,7 +673,8 @@ const canvasCornerRadiusSchema = z.object({
|
|
|
364
673
|
topLeft: nonNegativeNumber$1,
|
|
365
674
|
topRight: nonNegativeNumber$1,
|
|
366
675
|
bottomRight: nonNegativeNumber$1,
|
|
367
|
-
bottomLeft: nonNegativeNumber$1
|
|
676
|
+
bottomLeft: nonNegativeNumber$1,
|
|
677
|
+
smoothing: ratio.optional()
|
|
368
678
|
});
|
|
369
679
|
const canvasBorderSchema = z.object({
|
|
370
680
|
visible: z.boolean(),
|
|
@@ -445,7 +755,7 @@ const canvasFilterSchema = z.discriminatedUnion("kind", [
|
|
|
445
755
|
value: ratio
|
|
446
756
|
})
|
|
447
757
|
]);
|
|
448
|
-
const
|
|
758
|
+
const CANVAS_BLEND_MODES = [
|
|
449
759
|
"normal",
|
|
450
760
|
"multiply",
|
|
451
761
|
"screen",
|
|
@@ -463,8 +773,9 @@ const canvasBlendModeSchema = z.enum([
|
|
|
463
773
|
"saturation",
|
|
464
774
|
"color",
|
|
465
775
|
"luminosity"
|
|
466
|
-
]
|
|
467
|
-
z.
|
|
776
|
+
];
|
|
777
|
+
const canvasBlendModeSchema = z.enum(CANVAS_BLEND_MODES);
|
|
778
|
+
const canvasAppearanceSchema = z.object({
|
|
468
779
|
opacity: ratio,
|
|
469
780
|
blendMode: canvasBlendModeSchema,
|
|
470
781
|
fills: z.array(canvasPaintSchema).max(32),
|
|
@@ -510,10 +821,16 @@ const canvasAppearancePatchSchema = z.object({
|
|
|
510
821
|
backdropFilters: z.array(canvasFilterSchema).max(32).optional(),
|
|
511
822
|
clear: z.array(canvasAppearancePropertySchema).min(1).max(CANVAS_APPEARANCE_PROPERTIES.length).optional()
|
|
512
823
|
}).refine((patch) => Object.keys(patch).length > 0, "appearance patch cannot be empty").refine(({ clear, ...values }) => clear === void 0 || clear.every((property) => values[property] === void 0), "appearance patch cannot set and clear the same property");
|
|
824
|
+
|
|
825
|
+
//#endregion
|
|
826
|
+
//#region ../../packages/contract/src/canvas/canvas-content-styles.schema.ts
|
|
827
|
+
const MAX_CANVAS_FONT_FAMILIES = 20;
|
|
513
828
|
const MAX_CANVAS_FONT_WEIGHT = 1e3;
|
|
514
829
|
const MAX_ITEM_ID_LENGTH = 200;
|
|
830
|
+
const MAX_CANVAS_FONT_FAMILY_LENGTH = 500;
|
|
515
831
|
const MAX_CANVAS_ADDITIONAL_STYLE_VALUE_LENGTH = 1e4;
|
|
516
|
-
const
|
|
832
|
+
const MAX_CANVAS_ADDITIONAL_STYLES = 128;
|
|
833
|
+
const boundedNumber = z.number().min(-MAX_CANVAS_VALUE).max(MAX_CANVAS_VALUE);
|
|
517
834
|
const nonNegativeNumber = z.number().nonnegative().max(MAX_CANVAS_VALUE);
|
|
518
835
|
const canvasTypographySchema = z.object({
|
|
519
836
|
family: z.string().min(1).max(500),
|
|
@@ -575,6 +892,10 @@ const canvasTypographySchema = z.object({
|
|
|
575
892
|
"pre-wrap",
|
|
576
893
|
"break-spaces"
|
|
577
894
|
]),
|
|
895
|
+
truncation: z.object({
|
|
896
|
+
mode: z.enum(["none", "ellipsis"]),
|
|
897
|
+
maxLines: z.number().int().min(1).max(MAX_CANVAS_VALUE).nullable()
|
|
898
|
+
}).optional(),
|
|
578
899
|
insets: z.object({
|
|
579
900
|
top: boundedNumber,
|
|
580
901
|
right: boundedNumber,
|
|
@@ -584,7 +905,7 @@ const canvasTypographySchema = z.object({
|
|
|
584
905
|
});
|
|
585
906
|
const unsafeStyleValue = /javascript|vbscript|data\s*:\s*text\/html|expression\s*\(|@import/iu;
|
|
586
907
|
const blockedStyleProperty = /^(?:behavior|-moz-binding)$/iu;
|
|
587
|
-
const canvasAdditionalStylePropertySchema = z.string().min(1).max(MAX_ITEM_ID_LENGTH).regex(/^(?:--[\w-]
|
|
908
|
+
const canvasAdditionalStylePropertySchema = z.string().min(1).max(MAX_ITEM_ID_LENGTH).regex(/^(?:--[\w-]+|-(?:webkit|moz|ms|o)-[a-z][a-z\d-]*|[a-z][a-z\d-]*)$/iu).refine((property) => !blockedStyleProperty.test(property), "unsafe CSS property");
|
|
588
909
|
const canvasAdditionalStyleValueSchema = z.string().max(MAX_CANVAS_ADDITIONAL_STYLE_VALUE_LENGTH).refine((value) => !unsafeStyleValue.test(value), "unsafe CSS value");
|
|
589
910
|
const canvasAdditionalStyleSchema = z.object({
|
|
590
911
|
id: z.string().min(1).max(MAX_ITEM_ID_LENGTH),
|
|
@@ -593,12 +914,15 @@ const canvasAdditionalStyleSchema = z.object({
|
|
|
593
914
|
enabled: z.boolean()
|
|
594
915
|
});
|
|
595
916
|
const canvasAdditionalStylesSchema = z.object({ declarations: z.array(canvasAdditionalStyleSchema).max(128) }).refine(({ declarations }) => new Set(declarations.map((declaration) => declaration.id)).size === declarations.length, "additional style ids must be unique");
|
|
917
|
+
|
|
596
918
|
//#endregion
|
|
597
919
|
//#region ../../packages/contract/src/canvas/canvas-scene.schema.ts
|
|
598
920
|
const MAX_SCENE_NODE_ID_LENGTH = 200;
|
|
599
921
|
const MAX_SCENE_LABEL_LENGTH = 500;
|
|
600
922
|
const MAX_SCENE_COMPONENT_LENGTH = 100;
|
|
601
923
|
const MAX_SCENE_SORT_KEY_LENGTH = 500;
|
|
924
|
+
const CANVAS_SCENE_VERSION = 3;
|
|
925
|
+
const canvasDocumentFormatSchema = z.literal(3, { error: "This editor uses an unsupported document format. Update the editor before changing this canvas." });
|
|
602
926
|
const canvasSceneBoxSchema = z.object({
|
|
603
927
|
x: z.number(),
|
|
604
928
|
y: z.number(),
|
|
@@ -639,7 +963,7 @@ const canvasSceneNodeSchema = z.looseObject({
|
|
|
639
963
|
box: canvasSceneBoxSchema.optional()
|
|
640
964
|
});
|
|
641
965
|
const canvasSceneDocumentSchema = z.object({
|
|
642
|
-
version: z.literal(
|
|
966
|
+
version: z.literal(3),
|
|
643
967
|
nodes: z.record(z.string(), canvasSceneNodeSchema),
|
|
644
968
|
relationships: z.record(z.string(), z.object({
|
|
645
969
|
parentId: z.string().min(1).max(MAX_SCENE_NODE_ID_LENGTH),
|
|
@@ -647,8 +971,45 @@ const canvasSceneDocumentSchema = z.object({
|
|
|
647
971
|
})),
|
|
648
972
|
tombstones: z.record(z.string(), z.literal(true)).default({})
|
|
649
973
|
});
|
|
974
|
+
const legacyRecordSchema = z.record(z.string(), z.unknown());
|
|
975
|
+
const legacyNode = (node) => {
|
|
976
|
+
const layout = legacyRecordSchema.safeParse(node["layout"]).data;
|
|
977
|
+
if (layout === void 0) return node;
|
|
978
|
+
const next = Object.fromEntries(Object.entries(layout).filter(([key]) => key !== "gridTrack"));
|
|
979
|
+
const container = legacyRecordSchema.safeParse(next["container"]).data;
|
|
980
|
+
if (container !== void 0) next["container"] = Object.fromEntries(Object.entries(container).filter(([key]) => key !== "materialized"));
|
|
981
|
+
for (const axis of ["horizontal", "vertical"]) {
|
|
982
|
+
const intent = legacyRecordSchema.safeParse(next[axis]).data;
|
|
983
|
+
if (intent?.["mode"] === "hug") next[axis] = Object.fromEntries(Object.entries(intent).filter(([key]) => key !== "basis"));
|
|
984
|
+
}
|
|
985
|
+
return {
|
|
986
|
+
...node,
|
|
987
|
+
layout: next
|
|
988
|
+
};
|
|
989
|
+
};
|
|
990
|
+
const legacyDocument = (blob) => {
|
|
991
|
+
if (Object.keys(blob).length === 0) return emptyCanvasSceneDocument();
|
|
992
|
+
const nodes = z.record(z.string(), legacyRecordSchema).safeParse(blob["nodes"]).data;
|
|
993
|
+
if (nodes === void 0) return blob;
|
|
994
|
+
return {
|
|
995
|
+
...blob,
|
|
996
|
+
version: 3,
|
|
997
|
+
nodes: Object.fromEntries(Object.entries(nodes).map(([id, node]) => [id, legacyNode(node)]))
|
|
998
|
+
};
|
|
999
|
+
};
|
|
1000
|
+
/** Known old scenes are adapted in memory; only an explicit mutation persists the new format. */
|
|
1001
|
+
const canvasReadableSceneDocumentSchema = z.preprocess((value) => {
|
|
1002
|
+
const blob = legacyRecordSchema.safeParse(value).data;
|
|
1003
|
+
if (blob === void 0) return value;
|
|
1004
|
+
const version = blob["version"];
|
|
1005
|
+
return (/* @__PURE__ */ new Set([
|
|
1006
|
+
void 0,
|
|
1007
|
+
1,
|
|
1008
|
+
2
|
|
1009
|
+
])).has(version) ? legacyDocument(blob) : blob;
|
|
1010
|
+
}, canvasSceneDocumentSchema);
|
|
650
1011
|
const emptyCanvasSceneDocument = () => ({
|
|
651
|
-
version:
|
|
1012
|
+
version: 3,
|
|
652
1013
|
nodes: { root: {
|
|
653
1014
|
id: "root",
|
|
654
1015
|
label: "Canvas",
|
|
@@ -661,10 +1022,13 @@ const emptyCanvasSceneDocument = () => ({
|
|
|
661
1022
|
relationships: {},
|
|
662
1023
|
tombstones: {}
|
|
663
1024
|
});
|
|
1025
|
+
|
|
664
1026
|
//#endregion
|
|
665
1027
|
//#region ../../packages/contract/src/canvas/canvas-conversion-draft.schema.ts
|
|
666
1028
|
const MAX_CANVAS_CONVERSION_NODES = 3e4;
|
|
667
1029
|
const MAX_CANVAS_CONVERSION_SOURCE_NODES = 5e4;
|
|
1030
|
+
const MAX_CANVAS_CONVERSION_ID_LENGTH = 200;
|
|
1031
|
+
const MAX_CANVAS_CONVERSION_TEXT_LENGTH = 500;
|
|
668
1032
|
const MAX_CANVAS_HTML_SOURCE_LENGTH = 262144;
|
|
669
1033
|
const temporaryIdSchema = z.string().min(1).max(200);
|
|
670
1034
|
const canvasConversionIssueSchema = z.object({
|
|
@@ -690,9 +1054,10 @@ const canvasConversionReportSchema = z.object({
|
|
|
690
1054
|
layoutContainerCount: z.number().int().nonnegative().max(MAX_CANVAS_CONVERSION_NODES).optional(),
|
|
691
1055
|
removedLeafNodeCount: z.number().int().nonnegative().max(MAX_CANVAS_CONVERSION_SOURCE_NODES).optional(),
|
|
692
1056
|
retainedSemanticOwnerNodeCount: z.number().int().nonnegative().max(MAX_CANVAS_CONVERSION_SOURCE_NODES).optional(),
|
|
693
|
-
truncatedNodeCount: z.number().int().nonnegative().max(MAX_CANVAS_CONVERSION_SOURCE_NODES).optional(),
|
|
1057
|
+
truncatedNodeCount: z.number().int().nonnegative().max(MAX_CANVAS_CONVERSION_SOURCE_NODES * 2).optional(),
|
|
1058
|
+
addedLayoutNodeCount: z.number().int().nonnegative().max(MAX_CANVAS_CONVERSION_SOURCE_NODES).optional(),
|
|
694
1059
|
issues: z.array(canvasConversionIssueSchema).max(MAX_CANVAS_CONVERSION_SOURCE_NODES)
|
|
695
|
-
}).refine(({ collapsedNeutralWrapperNodeCount, collapsedTransferredWrapperNodeCount, collapsedWrapperNodeCount }) => collapsedWrapperNodeCount === void 0 || collapsedNeutralWrapperNodeCount === void 0 || collapsedTransferredWrapperNodeCount === void 0 || collapsedNeutralWrapperNodeCount + collapsedTransferredWrapperNodeCount === collapsedWrapperNodeCount, "wrapper collapse proof classes must explain the collapsed wrapper count").refine(({ collapsedNodeCount, collapsedWrapperNodeCount, removedLeafNodeCount }) => collapsedNodeCount === void 0 || collapsedWrapperNodeCount === void 0 || removedLeafNodeCount === void 0 || collapsedWrapperNodeCount + removedLeafNodeCount === collapsedNodeCount, "collapsed node kinds must explain the total collapsed node count").refine(({ collapsedNodeCount, nodeCount, sourceNodeCount, truncatedNodeCount }) => sourceNodeCount === void 0 || collapsedNodeCount === void 0 || sourceNodeCount - nodeCount === collapsedNodeCount + (truncatedNodeCount ?? 0), "collapsed and truncated node counts must explain the source to editable difference").refine(({ layoutContainerCount, nodeCount }) => layoutContainerCount === void 0 || layoutContainerCount <= nodeCount, "layout container count cannot exceed editable node count");
|
|
1060
|
+
}).refine(({ collapsedNeutralWrapperNodeCount, collapsedTransferredWrapperNodeCount, collapsedWrapperNodeCount }) => collapsedWrapperNodeCount === void 0 || collapsedNeutralWrapperNodeCount === void 0 || collapsedTransferredWrapperNodeCount === void 0 || collapsedNeutralWrapperNodeCount + collapsedTransferredWrapperNodeCount === collapsedWrapperNodeCount, "wrapper collapse proof classes must explain the collapsed wrapper count").refine(({ collapsedNodeCount, collapsedWrapperNodeCount, removedLeafNodeCount }) => collapsedNodeCount === void 0 || collapsedWrapperNodeCount === void 0 || removedLeafNodeCount === void 0 || collapsedWrapperNodeCount + removedLeafNodeCount === collapsedNodeCount, "collapsed node kinds must explain the total collapsed node count").refine(({ addedLayoutNodeCount, collapsedNodeCount, nodeCount, sourceNodeCount, truncatedNodeCount }) => sourceNodeCount === void 0 || collapsedNodeCount === void 0 || sourceNodeCount + (addedLayoutNodeCount ?? 0) - nodeCount === collapsedNodeCount + (truncatedNodeCount ?? 0), "added, collapsed and truncated node counts must explain the source to editable difference").refine(({ layoutContainerCount, nodeCount }) => layoutContainerCount === void 0 || layoutContainerCount <= nodeCount, "layout container count cannot exceed editable node count");
|
|
696
1061
|
const canvasSubtreeDraftNodeSchema = canvasSceneNodeSchema.omit({ id: true }).extend({ temporaryId: temporaryIdSchema });
|
|
697
1062
|
const canvasSubtreeDraftRelationshipSchema = z.object({
|
|
698
1063
|
temporaryId: temporaryIdSchema,
|
|
@@ -708,6 +1073,7 @@ const canvasSubtreeDraftSchema = z.object({
|
|
|
708
1073
|
});
|
|
709
1074
|
const createEditableFrameInputSchema = z.object({
|
|
710
1075
|
canvasId: z.uuid(),
|
|
1076
|
+
documentFormatVersion: canvasDocumentFormatSchema,
|
|
711
1077
|
mutationId: z.uuid(),
|
|
712
1078
|
baseVersion: z.number().int().positive(),
|
|
713
1079
|
screenNodeId: z.string().min(1).max(200),
|
|
@@ -725,6 +1091,7 @@ const createEditableFrameResultSchema = z.object({
|
|
|
725
1091
|
boxes: z.record(z.string().min(1).max(200), canvasSceneBoxSchema),
|
|
726
1092
|
affectedBounds: canvasSceneBoxSchema
|
|
727
1093
|
});
|
|
1094
|
+
|
|
728
1095
|
//#endregion
|
|
729
1096
|
//#region ../../packages/contract/src/shared/blob.schema.ts
|
|
730
1097
|
/**
|
|
@@ -742,6 +1109,7 @@ const signedDownloadSchema = z.object({
|
|
|
742
1109
|
expiresAt: z.iso.datetime(),
|
|
743
1110
|
bytes: z.number().int().min(0)
|
|
744
1111
|
});
|
|
1112
|
+
|
|
745
1113
|
//#endregion
|
|
746
1114
|
//#region ../../packages/contract/src/canvas/canvas-render.schema.ts
|
|
747
1115
|
const RENDER_PHASES = [
|
|
@@ -791,6 +1159,7 @@ const RENDER_WARNING_CODES = [
|
|
|
791
1159
|
"SOURCE_FALLBACK",
|
|
792
1160
|
"SCALE_REDUCED"
|
|
793
1161
|
];
|
|
1162
|
+
const RENDER_MAX_SCALE = 4;
|
|
794
1163
|
const RENDER_MAX_OUTPUT_PIXELS = 16e6;
|
|
795
1164
|
const RENDER_MAX_OUTPUT_MIB = 32;
|
|
796
1165
|
const RENDER_MAX_SNAPSHOT_MIB = 64;
|
|
@@ -854,7 +1223,7 @@ const createCanvasRenderInputSchema = z.object({
|
|
|
854
1223
|
path: ["sourceState"]
|
|
855
1224
|
});
|
|
856
1225
|
const canvasRenderPhaseSchema = z.enum(RENDER_PHASES);
|
|
857
|
-
z.enum(RENDER_STATES);
|
|
1226
|
+
const canvasRenderStateSchema = z.enum(RENDER_STATES);
|
|
858
1227
|
const canvasRenderFailureReasonSchema = z.enum(RENDER_FAILURE_REASONS);
|
|
859
1228
|
const canvasRenderWarningCodeSchema = z.enum(RENDER_WARNING_CODES);
|
|
860
1229
|
const canvasRenderWarningSchema = z.object({
|
|
@@ -966,6 +1335,7 @@ const createRecordingSnapshotOutputSchema = z.object({
|
|
|
966
1335
|
job: canvasRenderJobSchema,
|
|
967
1336
|
alreadyExists: z.boolean()
|
|
968
1337
|
});
|
|
1338
|
+
|
|
969
1339
|
//#endregion
|
|
970
1340
|
//#region ../../packages/contract/src/canvas/canvas-conversion.schema.ts
|
|
971
1341
|
const MAX_CANVAS_ID_PREFIX_LENGTH = 80;
|
|
@@ -1067,7 +1437,7 @@ const getCanvasConversionInputSchema = z.object({ jobId: z.uuid() });
|
|
|
1067
1437
|
const getCanvasConversionOutputSchema = z.object({ job: canvasConversionJobSchema });
|
|
1068
1438
|
const cancelCanvasConversionInputSchema = z.object({ jobId: z.uuid() });
|
|
1069
1439
|
const cancelCanvasConversionOutputSchema = z.object({ job: canvasConversionJobSchema });
|
|
1070
|
-
z.discriminatedUnion("state", [
|
|
1440
|
+
const conversionRouteStateSchema = z.discriminatedUnion("state", [
|
|
1071
1441
|
z.object({
|
|
1072
1442
|
state: z.literal("loading"),
|
|
1073
1443
|
jobId: z.uuid()
|
|
@@ -1084,15 +1454,12 @@ z.discriminatedUnion("state", [
|
|
|
1084
1454
|
message: z.string().min(1).max(500)
|
|
1085
1455
|
})
|
|
1086
1456
|
]);
|
|
1457
|
+
|
|
1087
1458
|
//#endregion
|
|
1088
1459
|
//#region ../../packages/contract/src/canvas/canvas-document.schema.ts
|
|
1089
1460
|
/** More screens than one canvas has ever held, and a bound on one save's work. */
|
|
1090
1461
|
const MAX_SCREENS_PER_DOCUMENT = 2e3;
|
|
1091
|
-
/**
|
|
1092
|
-
* The server never parses this. `record(string, unknown)` is the honest schema: it accepts
|
|
1093
|
-
* any JSON object and rejects a top-level array or scalar, which is the whole of the
|
|
1094
|
-
* server's knowledge of a document's shape.
|
|
1095
|
-
*/
|
|
1462
|
+
/** Reads retain unsupported documents; the write boundary validates the current scene format. */
|
|
1096
1463
|
const canvasDocumentBlobSchema = z.record(z.string(), z.unknown());
|
|
1097
1464
|
const getCanvasDocumentInputSchema = z.object({ canvasId: z.uuid() });
|
|
1098
1465
|
const documentScreenSchema = z.object({
|
|
@@ -1129,7 +1496,7 @@ const getCanvasDocumentOutputSchema = z.object({
|
|
|
1129
1496
|
const saveCanvasDocumentInputSchema = z.object({
|
|
1130
1497
|
canvasId: z.uuid(),
|
|
1131
1498
|
baseVersion: z.number().int().min(1),
|
|
1132
|
-
document: canvasDocumentBlobSchema,
|
|
1499
|
+
document: canvasDocumentBlobSchema.refine((document) => canvasSceneDocumentSchema.safeParse(document).success, "A save requires a valid current-format canvas document."),
|
|
1133
1500
|
/** Every screen the document names. Replaces the manifest wholesale. */
|
|
1134
1501
|
screenIds: z.array(z.uuid()).max(MAX_SCREENS_PER_DOCUMENT)
|
|
1135
1502
|
});
|
|
@@ -1146,16 +1513,24 @@ const saveCanvasDocumentOutputSchema = z.discriminatedUnion("outcome", [z.object
|
|
|
1146
1513
|
version: z.number().int().min(1),
|
|
1147
1514
|
document: canvasDocumentBlobSchema
|
|
1148
1515
|
})]);
|
|
1516
|
+
|
|
1517
|
+
//#endregion
|
|
1518
|
+
//#region ../../packages/contract/src/canvas/canvas-image-asset.schema.ts
|
|
1519
|
+
const CANVAS_IMAGE_CONTENT_TYPES = [
|
|
1520
|
+
"image/avif",
|
|
1521
|
+
"image/gif",
|
|
1522
|
+
"image/jpeg",
|
|
1523
|
+
"image/png",
|
|
1524
|
+
"image/webp"
|
|
1525
|
+
];
|
|
1526
|
+
const BYTES_PER_KIBIBYTE = 1024;
|
|
1527
|
+
const KIBIBYTES_PER_MEBIBYTE = 1024;
|
|
1528
|
+
const MAX_CANVAS_IMAGE_MEBIBYTES = 20;
|
|
1529
|
+
const MAX_CANVAS_IMAGE_BYTES = MAX_CANVAS_IMAGE_MEBIBYTES * BYTES_PER_KIBIBYTE * KIBIBYTES_PER_MEBIBYTE;
|
|
1149
1530
|
const reserveCanvasImageInputSchema = z.object({
|
|
1150
1531
|
canvasId: z.uuid(),
|
|
1151
|
-
contentType: z.enum(
|
|
1152
|
-
|
|
1153
|
-
"image/gif",
|
|
1154
|
-
"image/jpeg",
|
|
1155
|
-
"image/png",
|
|
1156
|
-
"image/webp"
|
|
1157
|
-
]),
|
|
1158
|
-
bytes: z.number().int().positive().max(20 * 1024 * 1024)
|
|
1532
|
+
contentType: z.enum(CANVAS_IMAGE_CONTENT_TYPES),
|
|
1533
|
+
bytes: z.number().int().positive().max(MAX_CANVAS_IMAGE_BYTES)
|
|
1159
1534
|
});
|
|
1160
1535
|
const reserveCanvasImageOutputSchema = z.object({
|
|
1161
1536
|
assetId: z.uuid(),
|
|
@@ -1163,13 +1538,17 @@ const reserveCanvasImageOutputSchema = z.object({
|
|
|
1163
1538
|
upload: signedUploadSchema
|
|
1164
1539
|
});
|
|
1165
1540
|
const canvasImageAssetPath = (canvasId, assetId) => `/v1/canvas-assets/${encodeURIComponent(canvasId)}/${encodeURIComponent(assetId)}`;
|
|
1166
|
-
|
|
1541
|
+
|
|
1542
|
+
//#endregion
|
|
1543
|
+
//#region ../../packages/contract/src/canvas/canvas-property-section.schema.ts
|
|
1544
|
+
const CANVAS_PROPERTY_SECTIONS = [
|
|
1167
1545
|
"position",
|
|
1168
1546
|
"layout",
|
|
1169
1547
|
"clip",
|
|
1170
1548
|
"cornerRadius",
|
|
1171
1549
|
"blending",
|
|
1172
1550
|
"typography",
|
|
1551
|
+
"nativeControl",
|
|
1173
1552
|
"textDecoration",
|
|
1174
1553
|
"fill",
|
|
1175
1554
|
"outline",
|
|
@@ -1179,16 +1558,21 @@ const canvasPropertySectionSchema = z.enum([
|
|
|
1179
1558
|
"innerShadow",
|
|
1180
1559
|
"filters",
|
|
1181
1560
|
"additionalStyles",
|
|
1561
|
+
"vector",
|
|
1182
1562
|
"export",
|
|
1183
1563
|
"source"
|
|
1184
|
-
]
|
|
1564
|
+
];
|
|
1565
|
+
const canvasPropertySectionSchema = z.enum(CANVAS_PROPERTY_SECTIONS);
|
|
1566
|
+
|
|
1185
1567
|
//#endregion
|
|
1186
1568
|
//#region ../../packages/contract/src/canvas/canvas-inspection.schema.ts
|
|
1187
1569
|
const MAX_NODE_ID_LENGTH$4 = 200;
|
|
1570
|
+
const MAX_RENDER_MESSAGE_LENGTH = 500;
|
|
1571
|
+
const MAX_RENDER_KIND_LENGTH = 100;
|
|
1188
1572
|
const canvasInspectNodeSummarySchema = z.object({
|
|
1189
1573
|
id: z.string().min(1).max(MAX_NODE_ID_LENGTH$4),
|
|
1190
|
-
label: z.string().max(
|
|
1191
|
-
kind: z.string().min(1).max(
|
|
1574
|
+
label: z.string().max(MAX_RENDER_MESSAGE_LENGTH),
|
|
1575
|
+
kind: z.string().min(1).max(MAX_RENDER_KIND_LENGTH),
|
|
1192
1576
|
parentId: z.string().min(1).max(MAX_NODE_ID_LENGTH$4).nullable(),
|
|
1193
1577
|
childCount: z.number().int().min(0),
|
|
1194
1578
|
box: canvasWorldBoundsSchema.nullable(),
|
|
@@ -1197,6 +1581,7 @@ const canvasInspectNodeSummarySchema = z.object({
|
|
|
1197
1581
|
const inspectCanvasInputSchema = z.object({ canvasId: z.uuid() });
|
|
1198
1582
|
const inspectCanvasOutputSchema = z.object({
|
|
1199
1583
|
canvasId: z.uuid(),
|
|
1584
|
+
openUrl: z.url(),
|
|
1200
1585
|
title: z.string().min(1),
|
|
1201
1586
|
version: z.number().int().positive(),
|
|
1202
1587
|
nodeCount: z.number().int().min(0),
|
|
@@ -1229,14 +1614,109 @@ const inspectCanvasNodeOutputSchema = z.object({
|
|
|
1229
1614
|
}),
|
|
1230
1615
|
next: z.array(z.string().min(1))
|
|
1231
1616
|
});
|
|
1617
|
+
|
|
1618
|
+
//#endregion
|
|
1619
|
+
//#region ../../packages/contract/src/canvas/canvas-layout-ownership.lib.ts
|
|
1620
|
+
const CANVAS_LAYOUT_CSS_FIELDS = [
|
|
1621
|
+
["alignSelf", "align-self"],
|
|
1622
|
+
["order", "order"],
|
|
1623
|
+
["flexGrow", "flex-grow"],
|
|
1624
|
+
["flexShrink", "flex-shrink"],
|
|
1625
|
+
["flexBasis", "flex-basis"],
|
|
1626
|
+
["aspectRatio", "aspect-ratio"]
|
|
1627
|
+
];
|
|
1628
|
+
const CANVAS_CONTAINER_CSS_FIELDS = [
|
|
1629
|
+
["direction", "flex-direction"],
|
|
1630
|
+
["wrap", "flex-wrap"],
|
|
1631
|
+
["alignItems", "align-items"],
|
|
1632
|
+
["alignContent", "align-content"],
|
|
1633
|
+
["justifyContent", "justify-content"],
|
|
1634
|
+
["rowGap", "row-gap"],
|
|
1635
|
+
["columnGap", "column-gap"]
|
|
1636
|
+
];
|
|
1637
|
+
const SIDES = [
|
|
1638
|
+
"top",
|
|
1639
|
+
"right",
|
|
1640
|
+
"bottom",
|
|
1641
|
+
"left"
|
|
1642
|
+
];
|
|
1643
|
+
const releasedSpacing = (held, prefix, properties) => {
|
|
1644
|
+
const next = { ...held };
|
|
1645
|
+
for (const side of SIDES) if (properties.has(`${prefix}-${side}`)) Reflect.deleteProperty(next, side);
|
|
1646
|
+
return next;
|
|
1647
|
+
};
|
|
1648
|
+
/** A shorthand can release several named controls; a longhand releases only itself. */
|
|
1649
|
+
const releasedFields = (held, changed) => {
|
|
1650
|
+
const properties = new Set([...changed].flatMap((property) => canvasCssPropertyScope(property)));
|
|
1651
|
+
const layout = { ...held };
|
|
1652
|
+
for (const [key, property] of CANVAS_LAYOUT_CSS_FIELDS) if (properties.has(property)) Reflect.deleteProperty(layout, key);
|
|
1653
|
+
if (layout.margin !== void 0) layout.margin = releasedSpacing(layout.margin, "margin", properties);
|
|
1654
|
+
if (layout.container === void 0) return layout;
|
|
1655
|
+
const container = { ...layout.container };
|
|
1656
|
+
if ((properties.has("row-gap") || properties.has("column-gap")) && container.gap !== void 0) {
|
|
1657
|
+
container.rowGap ??= container.gap;
|
|
1658
|
+
container.columnGap ??= container.gap;
|
|
1659
|
+
Reflect.deleteProperty(container, "gap");
|
|
1660
|
+
}
|
|
1661
|
+
for (const [key, property] of CANVAS_CONTAINER_CSS_FIELDS) if (properties.has(property)) Reflect.deleteProperty(container, key);
|
|
1662
|
+
if (container.padding !== void 0) container.padding = releasedSpacing(container.padding, "padding", properties);
|
|
1663
|
+
if (properties.has("grid-template-columns")) {
|
|
1664
|
+
Reflect.deleteProperty(container, "gridColumns");
|
|
1665
|
+
Reflect.deleteProperty(container, "gridAutoRepeat");
|
|
1666
|
+
}
|
|
1667
|
+
layout.container = container;
|
|
1668
|
+
return layout;
|
|
1669
|
+
};
|
|
1670
|
+
const axisWithoutCssBounds = (intent, properties, changed) => {
|
|
1671
|
+
if (intent === void 0 || intent.mode === "fixed") return intent;
|
|
1672
|
+
const released = { ...intent };
|
|
1673
|
+
for (const bound of ["min", "max"]) {
|
|
1674
|
+
if (properties.every((property) => !changed.has(`${bound}-${property}`))) continue;
|
|
1675
|
+
Reflect.deleteProperty(released, bound);
|
|
1676
|
+
Reflect.deleteProperty(released, `${bound}Parent`);
|
|
1677
|
+
}
|
|
1678
|
+
return released;
|
|
1679
|
+
};
|
|
1680
|
+
/** Editors hand CSS control back property by property; absent presets stay absent. */
|
|
1681
|
+
const canvasLayoutWithoutCssProperties = (held, changed, axes) => {
|
|
1682
|
+
const properties = new Set([...changed].flatMap((property) => canvasCssPropertyScope(property)));
|
|
1683
|
+
const layout = releasedFields(held, properties);
|
|
1684
|
+
if ([
|
|
1685
|
+
"overflow",
|
|
1686
|
+
"overflow-x",
|
|
1687
|
+
"overflow-y"
|
|
1688
|
+
].some((property) => properties.has(property))) Reflect.deleteProperty(layout, "clipContent");
|
|
1689
|
+
if (properties.has("position")) Reflect.deleteProperty(layout, "position");
|
|
1690
|
+
if (properties.has("transform")) for (const key of [
|
|
1691
|
+
"rotation",
|
|
1692
|
+
"flipHorizontal",
|
|
1693
|
+
"flipVertical"
|
|
1694
|
+
]) Reflect.deleteProperty(layout, key);
|
|
1695
|
+
if ([
|
|
1696
|
+
"inset",
|
|
1697
|
+
"left",
|
|
1698
|
+
"right",
|
|
1699
|
+
"top",
|
|
1700
|
+
"bottom"
|
|
1701
|
+
].some((property) => properties.has(property))) Reflect.deleteProperty(layout, "flowOffset");
|
|
1702
|
+
for (const axis of ["horizontal", "vertical"]) {
|
|
1703
|
+
const intent = axes[axis].some((property) => properties.has(property)) ? void 0 : axisWithoutCssBounds(layout[axis], axes[axis], properties);
|
|
1704
|
+
if (intent === void 0) Reflect.deleteProperty(layout, axis);
|
|
1705
|
+
else layout[axis] = intent;
|
|
1706
|
+
}
|
|
1707
|
+
return layout;
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1232
1710
|
//#endregion
|
|
1233
1711
|
//#region ../../packages/contract/src/canvas/canvas-object-kind.lib.ts
|
|
1234
1712
|
const ROOT_KIND = "root";
|
|
1713
|
+
const PAGE_KIND = "page";
|
|
1235
1714
|
const SCREEN_KIND = "screen";
|
|
1236
1715
|
const FRAME_KIND = "frame";
|
|
1237
1716
|
const GROUP_KIND = "group";
|
|
1238
1717
|
const RECTANGLE_KIND = "rectangle";
|
|
1239
1718
|
const IMAGE_KIND = "image";
|
|
1719
|
+
const SVG_KIND = "svg";
|
|
1240
1720
|
const RECORDING_KIND = "recording";
|
|
1241
1721
|
const PROTOTYPE_KIND = "prototype";
|
|
1242
1722
|
const TEXT_KIND = "text";
|
|
@@ -1260,6 +1740,7 @@ const FRAME_PROPERTY_SECTIONS = [
|
|
|
1260
1740
|
"clip",
|
|
1261
1741
|
...SHAPE_PROPERTY_SECTIONS.filter((section) => section !== "position" && section !== "layout")
|
|
1262
1742
|
];
|
|
1743
|
+
const SVG_PROPERTY_SECTIONS = [...SHAPE_PROPERTY_SECTIONS, "vector"];
|
|
1263
1744
|
const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
1264
1745
|
{
|
|
1265
1746
|
objectKind: PROTOTYPE_KIND,
|
|
@@ -1292,6 +1773,18 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
1292
1773
|
selectionBehavior: { hitTarget: "children" },
|
|
1293
1774
|
propertySections: []
|
|
1294
1775
|
},
|
|
1776
|
+
{
|
|
1777
|
+
objectKind: PAGE_KIND,
|
|
1778
|
+
label: "Page",
|
|
1779
|
+
category: "container",
|
|
1780
|
+
capabilities: {
|
|
1781
|
+
canSelect: false,
|
|
1782
|
+
canContainChildren: false,
|
|
1783
|
+
canEditProperties: false
|
|
1784
|
+
},
|
|
1785
|
+
selectionBehavior: { hitTarget: "children" },
|
|
1786
|
+
propertySections: []
|
|
1787
|
+
},
|
|
1295
1788
|
{
|
|
1296
1789
|
objectKind: SCREEN_KIND,
|
|
1297
1790
|
label: "Screen",
|
|
@@ -1410,7 +1903,7 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
1410
1903
|
preservesAspect: true,
|
|
1411
1904
|
heightFollowsContent: false
|
|
1412
1905
|
},
|
|
1413
|
-
propertySections:
|
|
1906
|
+
propertySections: SVG_PROPERTY_SECTIONS
|
|
1414
1907
|
},
|
|
1415
1908
|
{
|
|
1416
1909
|
objectKind: RECORDING_KIND,
|
|
@@ -1450,6 +1943,7 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
1450
1943
|
"position",
|
|
1451
1944
|
"layout",
|
|
1452
1945
|
"typography",
|
|
1946
|
+
"nativeControl",
|
|
1453
1947
|
"textDecoration",
|
|
1454
1948
|
"textStroke",
|
|
1455
1949
|
"blending",
|
|
@@ -1463,8 +1957,19 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
1463
1957
|
].map((descriptor) => [descriptor.objectKind, descriptor]));
|
|
1464
1958
|
const canvasObjectKindDescriptor = (objectKind) => DESCRIPTOR_BY_KIND[objectKind] ?? null;
|
|
1465
1959
|
const canvasPropertySectionsForKind = (objectKind) => canvasObjectKindDescriptor(objectKind)?.propertySections ?? [];
|
|
1960
|
+
|
|
1466
1961
|
//#endregion
|
|
1467
1962
|
//#region ../../packages/contract/src/canvas/canvas-operation-styles.schema.ts
|
|
1963
|
+
const TEXT_SIZE_SMALL = 16;
|
|
1964
|
+
const TEXT_SIZE_MEDIUM = 24;
|
|
1965
|
+
const TEXT_SIZE_LARGE = 40;
|
|
1966
|
+
const TEXT_SIZE_HUGE = 64;
|
|
1967
|
+
const TEXT_SIZE_MEGA = 96;
|
|
1968
|
+
const MIN_LETTER_SPACING = -100;
|
|
1969
|
+
const MAX_LETTER_SPACING = 100;
|
|
1970
|
+
const MAX_LINE_HEIGHT = 1e4;
|
|
1971
|
+
const nonNegativePixelLengthSchema = z.string().regex(/^(?:\d+(?:\.\d+)?|\.\d+)px$/u);
|
|
1972
|
+
const signedPixelLengthSchema = z.string().regex(/^-?(?:\d+(?:\.\d+)?|\.\d+)px$/u);
|
|
1468
1973
|
const textStyleValues = {
|
|
1469
1974
|
color: z.union([z.enum([
|
|
1470
1975
|
"var(--note-ink)",
|
|
@@ -1480,11 +1985,11 @@ const textStyleValues = {
|
|
|
1480
1985
|
]), z.string().regex(/^#[\da-f]{6}$/iu)]),
|
|
1481
1986
|
"font-family": z.enum(["var(--sans)", "var(--mono)"]),
|
|
1482
1987
|
"font-size": z.union([
|
|
1483
|
-
z.literal(
|
|
1484
|
-
z.literal(
|
|
1485
|
-
z.literal(
|
|
1486
|
-
z.literal(
|
|
1487
|
-
z.literal(
|
|
1988
|
+
z.literal(TEXT_SIZE_SMALL),
|
|
1989
|
+
z.literal(TEXT_SIZE_MEDIUM),
|
|
1990
|
+
z.literal(TEXT_SIZE_LARGE),
|
|
1991
|
+
z.literal(TEXT_SIZE_HUGE),
|
|
1992
|
+
z.literal(TEXT_SIZE_MEGA)
|
|
1488
1993
|
]),
|
|
1489
1994
|
"font-weight": z.enum(["400", "700"]),
|
|
1490
1995
|
"font-style": z.enum([
|
|
@@ -1492,8 +1997,8 @@ const textStyleValues = {
|
|
|
1492
1997
|
"italic",
|
|
1493
1998
|
"oblique"
|
|
1494
1999
|
]),
|
|
1495
|
-
"letter-spacing": z.number().min(
|
|
1496
|
-
"line-height": z.union([z.number().positive().max(
|
|
2000
|
+
"letter-spacing": z.number().min(MIN_LETTER_SPACING).max(MAX_LETTER_SPACING),
|
|
2001
|
+
"line-height": z.union([z.number().positive().max(MAX_LINE_HEIGHT), z.string().regex(/^(?:\d+(?:\.\d+)?(?:px|em|rem|%)?|normal)$/u)]),
|
|
1497
2002
|
"text-align": z.enum([
|
|
1498
2003
|
"left",
|
|
1499
2004
|
"center",
|
|
@@ -1522,7 +2027,7 @@ const canvasTextStylesSchema = z.strictObject({
|
|
|
1522
2027
|
const canvasTextStylePatchSchema = z.strictObject({
|
|
1523
2028
|
color: textStyleValues.color.nullable().optional(),
|
|
1524
2029
|
"font-family": textStyleValues["font-family"].nullable().optional(),
|
|
1525
|
-
"font-size": nonNegativeCanvasNumberSchema.nullable().optional(),
|
|
2030
|
+
"font-size": z.union([nonNegativeCanvasNumberSchema, nonNegativePixelLengthSchema]).nullable().optional(),
|
|
1526
2031
|
"font-weight": z.string().regex(/^(?:[1-9]\d{0,2}|1000)$/u).nullable().optional(),
|
|
1527
2032
|
"font-style": textStyleValues["font-style"].nullable().optional(),
|
|
1528
2033
|
"font-stretch": z.union([z.enum([
|
|
@@ -1536,38 +2041,117 @@ const canvasTextStylePatchSchema = z.strictObject({
|
|
|
1536
2041
|
"extra-expanded",
|
|
1537
2042
|
"ultra-expanded"
|
|
1538
2043
|
]), z.string().regex(/^\d+(?:\.\d+)?%$/u)]).nullable().optional(),
|
|
1539
|
-
"letter-spacing": z.union([
|
|
2044
|
+
"letter-spacing": z.union([
|
|
2045
|
+
boundedCanvasNumberSchema,
|
|
2046
|
+
signedPixelLengthSchema,
|
|
2047
|
+
z.literal("normal")
|
|
2048
|
+
]).nullable().optional(),
|
|
1540
2049
|
"line-height": textStyleValues["line-height"].nullable().optional(),
|
|
1541
2050
|
"text-align": textStyleValues["text-align"].nullable().optional(),
|
|
1542
|
-
"text-indent": boundedCanvasNumberSchema.nullable().optional(),
|
|
2051
|
+
"text-indent": z.union([boundedCanvasNumberSchema, signedPixelLengthSchema]).nullable().optional(),
|
|
1543
2052
|
"white-space": textStyleValues["white-space"].nullable().optional(),
|
|
1544
|
-
"word-spacing": z.union([
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
]);
|
|
2053
|
+
"word-spacing": z.union([
|
|
2054
|
+
boundedCanvasNumberSchema,
|
|
2055
|
+
signedPixelLengthSchema,
|
|
2056
|
+
z.literal("normal")
|
|
2057
|
+
]).nullable().optional()
|
|
2058
|
+
});
|
|
2059
|
+
const overflowStyleValue = canvasAdditionalStyleSchema.shape.value;
|
|
2060
|
+
const dimensionalStyleValue = z.union([z.string(), boundedCanvasNumberSchema]);
|
|
2061
|
+
const layoutStylePatchValue = z.union([canvasAdditionalStyleSchema.shape.value, boundedCanvasNumberSchema]).nullable().optional();
|
|
1553
2062
|
const canvasNodeStylePatchSchema = canvasTextStylePatchSchema.extend({
|
|
2063
|
+
"align-content": layoutStylePatchValue,
|
|
2064
|
+
"align-items": layoutStylePatchValue,
|
|
2065
|
+
"align-self": layoutStylePatchValue,
|
|
2066
|
+
"aspect-ratio": layoutStylePatchValue,
|
|
2067
|
+
"block-size": layoutStylePatchValue,
|
|
2068
|
+
bottom: layoutStylePatchValue,
|
|
2069
|
+
"box-sizing": layoutStylePatchValue,
|
|
2070
|
+
display: layoutStylePatchValue,
|
|
2071
|
+
flex: layoutStylePatchValue,
|
|
2072
|
+
"flex-basis": layoutStylePatchValue,
|
|
2073
|
+
"flex-direction": layoutStylePatchValue,
|
|
2074
|
+
"flex-grow": layoutStylePatchValue,
|
|
2075
|
+
"flex-shrink": layoutStylePatchValue,
|
|
2076
|
+
"flex-wrap": layoutStylePatchValue,
|
|
2077
|
+
height: layoutStylePatchValue,
|
|
2078
|
+
"inline-size": layoutStylePatchValue,
|
|
2079
|
+
inset: layoutStylePatchValue,
|
|
2080
|
+
"inset-block": layoutStylePatchValue,
|
|
2081
|
+
"inset-block-end": layoutStylePatchValue,
|
|
2082
|
+
"inset-block-start": layoutStylePatchValue,
|
|
2083
|
+
"inset-inline": layoutStylePatchValue,
|
|
2084
|
+
"inset-inline-end": layoutStylePatchValue,
|
|
2085
|
+
"inset-inline-start": layoutStylePatchValue,
|
|
2086
|
+
"justify-content": layoutStylePatchValue,
|
|
2087
|
+
left: layoutStylePatchValue,
|
|
2088
|
+
margin: layoutStylePatchValue,
|
|
2089
|
+
"margin-block": layoutStylePatchValue,
|
|
2090
|
+
"margin-block-end": layoutStylePatchValue,
|
|
2091
|
+
"margin-block-start": layoutStylePatchValue,
|
|
2092
|
+
"margin-inline": layoutStylePatchValue,
|
|
2093
|
+
"margin-inline-end": layoutStylePatchValue,
|
|
2094
|
+
"margin-inline-start": layoutStylePatchValue,
|
|
2095
|
+
"max-block-size": layoutStylePatchValue,
|
|
2096
|
+
"max-height": layoutStylePatchValue,
|
|
2097
|
+
"max-inline-size": layoutStylePatchValue,
|
|
2098
|
+
"max-width": layoutStylePatchValue,
|
|
2099
|
+
"min-block-size": layoutStylePatchValue,
|
|
2100
|
+
"min-height": layoutStylePatchValue,
|
|
2101
|
+
"min-inline-size": layoutStylePatchValue,
|
|
2102
|
+
"min-width": layoutStylePatchValue,
|
|
2103
|
+
order: layoutStylePatchValue,
|
|
2104
|
+
padding: layoutStylePatchValue,
|
|
2105
|
+
"padding-block": layoutStylePatchValue,
|
|
2106
|
+
"padding-block-end": layoutStylePatchValue,
|
|
2107
|
+
"padding-block-start": layoutStylePatchValue,
|
|
2108
|
+
"padding-inline": layoutStylePatchValue,
|
|
2109
|
+
"padding-inline-end": layoutStylePatchValue,
|
|
2110
|
+
"padding-inline-start": layoutStylePatchValue,
|
|
2111
|
+
position: layoutStylePatchValue,
|
|
2112
|
+
right: layoutStylePatchValue,
|
|
2113
|
+
top: layoutStylePatchValue,
|
|
2114
|
+
width: layoutStylePatchValue,
|
|
1554
2115
|
background: z.string().nullable().optional(),
|
|
1555
2116
|
"background-color": z.string().nullable().optional(),
|
|
1556
|
-
"border-radius":
|
|
2117
|
+
"border-bottom-left-radius": dimensionalStyleValue.optional(),
|
|
2118
|
+
"border-bottom-right-radius": dimensionalStyleValue.optional(),
|
|
2119
|
+
"border-bottom-width": dimensionalStyleValue.optional(),
|
|
1557
2120
|
"border-color": z.string().nullable().optional(),
|
|
1558
|
-
"border-width":
|
|
2121
|
+
"border-left-width": dimensionalStyleValue.optional(),
|
|
2122
|
+
"border-radius": dimensionalStyleValue.nullable().optional(),
|
|
2123
|
+
"border-right-width": dimensionalStyleValue.optional(),
|
|
1559
2124
|
"border-style": z.enum([
|
|
1560
2125
|
"none",
|
|
1561
2126
|
"solid",
|
|
1562
2127
|
"dashed",
|
|
1563
2128
|
"dotted"
|
|
1564
2129
|
]).nullable().optional(),
|
|
2130
|
+
"border-top-left-radius": dimensionalStyleValue.optional(),
|
|
2131
|
+
"border-top-right-radius": dimensionalStyleValue.optional(),
|
|
2132
|
+
"border-top-width": dimensionalStyleValue.optional(),
|
|
2133
|
+
"border-width": dimensionalStyleValue.nullable().optional(),
|
|
1565
2134
|
"box-shadow": z.string().nullable().optional(),
|
|
2135
|
+
"column-gap": dimensionalStyleValue.optional(),
|
|
2136
|
+
gap: dimensionalStyleValue.optional(),
|
|
2137
|
+
"margin-bottom": dimensionalStyleValue.optional(),
|
|
2138
|
+
"margin-left": dimensionalStyleValue.optional(),
|
|
2139
|
+
"margin-right": dimensionalStyleValue.optional(),
|
|
2140
|
+
"margin-top": dimensionalStyleValue.optional(),
|
|
1566
2141
|
opacity: z.union([z.string(), z.number()]).nullable().optional(),
|
|
2142
|
+
"outline-offset": dimensionalStyleValue.optional(),
|
|
2143
|
+
"outline-width": dimensionalStyleValue.optional(),
|
|
1567
2144
|
overflow: overflowStyleValue.nullable().optional(),
|
|
1568
2145
|
"overflow-x": overflowStyleValue.nullable().optional(),
|
|
1569
|
-
"overflow-y": overflowStyleValue.nullable().optional()
|
|
1570
|
-
|
|
2146
|
+
"overflow-y": overflowStyleValue.nullable().optional(),
|
|
2147
|
+
"padding-bottom": dimensionalStyleValue.optional(),
|
|
2148
|
+
"padding-left": dimensionalStyleValue.optional(),
|
|
2149
|
+
"padding-right": dimensionalStyleValue.optional(),
|
|
2150
|
+
"padding-top": dimensionalStyleValue.optional(),
|
|
2151
|
+
"row-gap": dimensionalStyleValue.optional(),
|
|
2152
|
+
"stroke-width": dimensionalStyleValue.optional()
|
|
2153
|
+
});
|
|
2154
|
+
|
|
1571
2155
|
//#endregion
|
|
1572
2156
|
//#region ../../packages/contract/src/canvas/canvas-operation.schema.ts
|
|
1573
2157
|
const convertedSubtreeRelationshipSchema = z.object({
|
|
@@ -1600,6 +2184,12 @@ const parentageSchema = z.object({
|
|
|
1600
2184
|
parentId: nodeIdSchema$1,
|
|
1601
2185
|
sortKey: sortKeySchema
|
|
1602
2186
|
});
|
|
2187
|
+
const canvasSetStylesOperationSchema = z.object({
|
|
2188
|
+
op: z.literal("setStyles"),
|
|
2189
|
+
nodeId: nodeIdSchema$1,
|
|
2190
|
+
styles: canvasNodeStylePatchSchema,
|
|
2191
|
+
clear: z.array(canvasNodeStylePatchSchema.keyof()).min(1).max(Object.keys(canvasNodeStylePatchSchema.shape).length).refine((properties) => new Set(properties).size === properties.length).optional()
|
|
2192
|
+
}).refine((operation) => (operation.clear ?? []).every((property) => !Object.hasOwn(operation.styles, property)));
|
|
1603
2193
|
const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
1604
2194
|
insertConvertedSubtreeOperationSchema,
|
|
1605
2195
|
z.object({
|
|
@@ -1621,7 +2211,8 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
1621
2211
|
label: z.string().max(MAX_LABEL_LENGTH).default("Prototype"),
|
|
1622
2212
|
prototypeId: z.uuid(),
|
|
1623
2213
|
deploymentId: z.uuid(),
|
|
1624
|
-
box: writableBoxSchema
|
|
2214
|
+
box: writableBoxSchema,
|
|
2215
|
+
canvasPageId: nodeIdSchema$1.optional()
|
|
1625
2216
|
}),
|
|
1626
2217
|
z.object({
|
|
1627
2218
|
op: z.literal("setPrototypeDeployment"),
|
|
@@ -1637,18 +2228,23 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
1637
2228
|
z.object({
|
|
1638
2229
|
op: z.literal("setBox"),
|
|
1639
2230
|
nodeId: nodeIdSchema$1,
|
|
1640
|
-
box: canvasSceneBoxSchema
|
|
2231
|
+
box: z.union([canvasSceneBoxSchema, z.literal("default")])
|
|
1641
2232
|
}),
|
|
1642
2233
|
z.object({
|
|
1643
2234
|
op: z.literal("setLabel"),
|
|
1644
2235
|
nodeId: nodeIdSchema$1,
|
|
1645
2236
|
label: z.string().trim().min(1).max(MAX_LABEL_LENGTH),
|
|
1646
|
-
labelOrigin: canvasNodeLabelOriginSchema.optional()
|
|
2237
|
+
labelOrigin: canvasNodeLabelOriginSchema.nullable().optional()
|
|
2238
|
+
}),
|
|
2239
|
+
z.object({
|
|
2240
|
+
op: z.literal("setContainerKind"),
|
|
2241
|
+
nodeId: nodeIdSchema$1,
|
|
2242
|
+
component: z.enum(["frame", "group"])
|
|
1647
2243
|
}),
|
|
1648
2244
|
z.object({
|
|
1649
2245
|
op: z.literal("setVisibility"),
|
|
1650
2246
|
nodeId: nodeIdSchema$1,
|
|
1651
|
-
visible: z.boolean()
|
|
2247
|
+
visible: z.boolean().nullable()
|
|
1652
2248
|
}),
|
|
1653
2249
|
z.object({
|
|
1654
2250
|
op: z.literal("setLocked"),
|
|
@@ -1660,11 +2256,7 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
1660
2256
|
nodeId: nodeIdSchema$1,
|
|
1661
2257
|
constraints: canvasNodeConstraintsSchema
|
|
1662
2258
|
}),
|
|
1663
|
-
|
|
1664
|
-
op: z.literal("setStyles"),
|
|
1665
|
-
nodeId: nodeIdSchema$1,
|
|
1666
|
-
styles: canvasNodeStylePatchSchema
|
|
1667
|
-
}),
|
|
2259
|
+
canvasSetStylesOperationSchema,
|
|
1668
2260
|
z.object({
|
|
1669
2261
|
op: z.literal("setAppearance"),
|
|
1670
2262
|
nodeId: nodeIdSchema$1,
|
|
@@ -1688,7 +2280,7 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
1688
2280
|
z.object({
|
|
1689
2281
|
op: z.literal("setProps"),
|
|
1690
2282
|
nodeId: nodeIdSchema$1,
|
|
1691
|
-
props: z.record(z.string(), z.unknown())
|
|
2283
|
+
props: z.union([z.record(z.string(), z.unknown()), z.literal("default")])
|
|
1692
2284
|
}),
|
|
1693
2285
|
z.object({
|
|
1694
2286
|
op: z.literal("setParentage"),
|
|
@@ -1707,6 +2299,7 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
1707
2299
|
const applyCanvasOperationsInputSchema = z.object({
|
|
1708
2300
|
canvasId: z.uuid(),
|
|
1709
2301
|
mutationId: z.uuid(),
|
|
2302
|
+
documentFormatVersion: canvasDocumentFormatSchema,
|
|
1710
2303
|
baseVersion: z.number().int().positive(),
|
|
1711
2304
|
operations: z.array(canvasOperationSchema).min(1).max(MAX_CANVAS_OPERATIONS)
|
|
1712
2305
|
});
|
|
@@ -1726,6 +2319,7 @@ const createEditableFrameOutputSchema = createEditableFrameResultSchema.extend({
|
|
|
1726
2319
|
operation: insertConvertedSubtreeOperationSchema,
|
|
1727
2320
|
next: z.array(z.string().min(1))
|
|
1728
2321
|
});
|
|
2322
|
+
|
|
1729
2323
|
//#endregion
|
|
1730
2324
|
//#region ../../packages/contract/src/canvas/canvas-realtime.schema.ts
|
|
1731
2325
|
const CANVAS_REALTIME_PROTOCOL = "enhance3.canvas.v1";
|
|
@@ -1736,6 +2330,7 @@ const MAX_SELECTION_SIZE = 100;
|
|
|
1736
2330
|
const MAX_ACTIVITY_TARGETS = 100;
|
|
1737
2331
|
const MAX_REALTIME_TICKET_LENGTH = 4096;
|
|
1738
2332
|
const MAX_ERROR_MESSAGE_LENGTH = 200;
|
|
2333
|
+
const MAX_CURSOR_CHAT_LENGTH = 140;
|
|
1739
2334
|
const canvasActorColourSchema = z.enum([
|
|
1740
2335
|
"blue",
|
|
1741
2336
|
"violet",
|
|
@@ -1856,7 +2451,7 @@ const endCanvasActivityInputSchema = z.object({
|
|
|
1856
2451
|
activityId: z.uuid()
|
|
1857
2452
|
});
|
|
1858
2453
|
const endCanvasActivityOutputSchema = z.object({ ended: z.literal(true) });
|
|
1859
|
-
z.discriminatedUnion("type", [z.object({
|
|
2454
|
+
const canvasRealtimeClientEnvelopeSchema = z.discriminatedUnion("type", [z.object({
|
|
1860
2455
|
v: z.literal(1),
|
|
1861
2456
|
type: z.literal("presence.patch"),
|
|
1862
2457
|
seq: z.number().int().nonnegative(),
|
|
@@ -1871,7 +2466,7 @@ const serverEnvelopeBase = {
|
|
|
1871
2466
|
v: z.literal(1),
|
|
1872
2467
|
seq: z.number().int().nonnegative()
|
|
1873
2468
|
};
|
|
1874
|
-
z.discriminatedUnion("type", [
|
|
2469
|
+
const canvasRealtimeServerEnvelopeSchema = z.discriminatedUnion("type", [
|
|
1875
2470
|
z.object({
|
|
1876
2471
|
...serverEnvelopeBase,
|
|
1877
2472
|
type: z.literal("room.snapshot"),
|
|
@@ -1919,7 +2514,8 @@ z.discriminatedUnion("type", [
|
|
|
1919
2514
|
reason: z.enum([
|
|
1920
2515
|
"gap",
|
|
1921
2516
|
"relay",
|
|
1922
|
-
"replace"
|
|
2517
|
+
"replace",
|
|
2518
|
+
"history-restored"
|
|
1923
2519
|
])
|
|
1924
2520
|
})
|
|
1925
2521
|
}),
|
|
@@ -1947,6 +2543,7 @@ z.discriminatedUnion("type", [
|
|
|
1947
2543
|
})
|
|
1948
2544
|
})
|
|
1949
2545
|
]);
|
|
2546
|
+
|
|
1950
2547
|
//#endregion
|
|
1951
2548
|
//#region ../../packages/contract/src/canvas/canvas-render-exposure.schema.ts
|
|
1952
2549
|
const MAX_NODE_ID_LENGTH$1 = 200;
|
|
@@ -1978,6 +2575,7 @@ const exposeCanvasRenderOutputSchema = z.discriminatedUnion("purpose", [exposeCa
|
|
|
1978
2575
|
scale: z.literal(1),
|
|
1979
2576
|
format: z.literal("json")
|
|
1980
2577
|
})]);
|
|
2578
|
+
|
|
1981
2579
|
//#endregion
|
|
1982
2580
|
//#region ../../packages/contract/src/canvas/canvas-render-worker.schema.ts
|
|
1983
2581
|
const MIN_GRANT_TOKEN_LENGTH = 40;
|
|
@@ -1989,8 +2587,8 @@ const MAX_WORKER_MAC_LENGTH = 200;
|
|
|
1989
2587
|
const MAX_FAILURE_MESSAGE_LENGTH = 500;
|
|
1990
2588
|
const MAX_SOURCE_ID_LENGTH = 200;
|
|
1991
2589
|
const MAX_COOKIE_NAME_LENGTH = 100;
|
|
1992
|
-
z.object({ jobId: z.uuid() });
|
|
1993
|
-
z.object({ jobId: z.uuid() });
|
|
2590
|
+
const renderQueueMessageSchema = z.object({ jobId: z.uuid() });
|
|
2591
|
+
const claimRenderWorkInputSchema = z.object({ jobId: z.uuid() });
|
|
1994
2592
|
const claimRenderWorkBaseSchema = z.object({
|
|
1995
2593
|
jobId: z.uuid(),
|
|
1996
2594
|
canvasId: z.uuid(),
|
|
@@ -2000,7 +2598,7 @@ const claimRenderWorkBaseSchema = z.object({
|
|
|
2000
2598
|
renderUrl: z.url(),
|
|
2001
2599
|
releaseIdentity: z.string().min(1).max(100)
|
|
2002
2600
|
});
|
|
2003
|
-
z.discriminatedUnion("purpose", [claimRenderWorkBaseSchema.extend({
|
|
2601
|
+
const claimRenderWorkOutputSchema = z.discriminatedUnion("purpose", [claimRenderWorkBaseSchema.extend({
|
|
2004
2602
|
purpose: z.enum([
|
|
2005
2603
|
"inspection",
|
|
2006
2604
|
"snapshot",
|
|
@@ -2020,7 +2618,7 @@ z.discriminatedUnion("purpose", [claimRenderWorkBaseSchema.extend({
|
|
|
2020
2618
|
conversion: canvasConversionRequestSchema,
|
|
2021
2619
|
scale: z.literal(1)
|
|
2022
2620
|
})]);
|
|
2023
|
-
z.object({
|
|
2621
|
+
const completeRenderWorkInputSchema = z.object({
|
|
2024
2622
|
jobId: z.uuid(),
|
|
2025
2623
|
loadedVersion: z.number().int().positive(),
|
|
2026
2624
|
bounds: canvasWorldBoundsSchema,
|
|
@@ -2043,14 +2641,14 @@ z.object({
|
|
|
2043
2641
|
})
|
|
2044
2642
|
}).optional()
|
|
2045
2643
|
});
|
|
2046
|
-
z.object({ accepted: z.literal(true) });
|
|
2047
|
-
z.object({
|
|
2644
|
+
const completeRenderWorkOutputSchema = z.object({ accepted: z.literal(true) });
|
|
2645
|
+
const completeConversionWorkInputSchema = z.object({
|
|
2048
2646
|
jobId: z.uuid(),
|
|
2049
2647
|
loadedVersion: z.number().int().positive(),
|
|
2050
2648
|
draft: canvasSubtreeDraftSchema
|
|
2051
2649
|
});
|
|
2052
|
-
z.object({ accepted: z.literal(true) });
|
|
2053
|
-
z.object({
|
|
2650
|
+
const completeConversionWorkOutputSchema = z.object({ accepted: z.literal(true) });
|
|
2651
|
+
const renderRouteSnapshotSchema = z.object({
|
|
2054
2652
|
recordingId: z.uuid(),
|
|
2055
2653
|
requestedAtMs: z.number().int().nonnegative(),
|
|
2056
2654
|
settledAtMs: z.number().int().nonnegative(),
|
|
@@ -2062,15 +2660,15 @@ z.object({
|
|
|
2062
2660
|
height: z.number().int().positive()
|
|
2063
2661
|
})
|
|
2064
2662
|
});
|
|
2065
|
-
z.object({
|
|
2663
|
+
const failRenderWorkInputSchema = z.object({
|
|
2066
2664
|
jobId: z.uuid(),
|
|
2067
2665
|
failure: canvasRenderFailureSchema
|
|
2068
2666
|
});
|
|
2069
|
-
z.object({
|
|
2667
|
+
const failRenderWorkOutputSchema = z.object({
|
|
2070
2668
|
accepted: z.literal(true),
|
|
2071
2669
|
willRetry: z.boolean()
|
|
2072
2670
|
});
|
|
2073
|
-
z.object({
|
|
2671
|
+
const renderWorkerProofHeadersSchema = z.object({
|
|
2074
2672
|
workerId: z.string().regex(/^[\w.-]+$/u).min(1).max(MAX_WORKER_ID_LENGTH),
|
|
2075
2673
|
releaseIdentity: z.string().min(1).max(100),
|
|
2076
2674
|
timestamp: z.coerce.number().int().nonnegative(),
|
|
@@ -2108,7 +2706,7 @@ const renderRouteCaptureSchema = z.object({
|
|
|
2108
2706
|
height: z.number().int().positive(),
|
|
2109
2707
|
scale: z.number().positive()
|
|
2110
2708
|
});
|
|
2111
|
-
z.discriminatedUnion("state", [
|
|
2709
|
+
const renderRouteStateSchema = z.discriminatedUnion("state", [
|
|
2112
2710
|
renderRouteStateBaseSchema.extend({
|
|
2113
2711
|
state: z.literal("loading"),
|
|
2114
2712
|
capture: z.null(),
|
|
@@ -2133,6 +2731,7 @@ z.discriminatedUnion("state", [
|
|
|
2133
2731
|
capture: z.null()
|
|
2134
2732
|
})
|
|
2135
2733
|
]);
|
|
2734
|
+
|
|
2136
2735
|
//#endregion
|
|
2137
2736
|
//#region ../../packages/contract/src/canvas/canvas-selection.schema.ts
|
|
2138
2737
|
const MAX_SELECTION_COMMANDS = 12;
|
|
@@ -2156,6 +2755,140 @@ const readCanvasSelectionOutputSchema = z.object({
|
|
|
2156
2755
|
visibleWorldBox: canvasWorldBoundsSchema.nullable(),
|
|
2157
2756
|
next: z.array(z.string().min(1)).max(MAX_SELECTION_COMMANDS)
|
|
2158
2757
|
});
|
|
2758
|
+
|
|
2759
|
+
//#endregion
|
|
2760
|
+
//#region ../../packages/contract/src/canvas/canvas-version.schema.ts
|
|
2761
|
+
const CANVAS_VERSION_DESCRIPTION_MAX_LENGTH = 1e3;
|
|
2762
|
+
const CANVAS_VERSION_PAGE_MAX = 100;
|
|
2763
|
+
const CANVAS_VERSION_PAGE_DEFAULT = 50;
|
|
2764
|
+
const CANVAS_VERSION_CURSOR_MAX_LENGTH = 1e3;
|
|
2765
|
+
const canvasVersionActorSchema = z.discriminatedUnion("kind", [z.object({
|
|
2766
|
+
kind: z.literal("person"),
|
|
2767
|
+
personId: z.uuid(),
|
|
2768
|
+
displayName: z.string().min(1).max(200),
|
|
2769
|
+
initials: z.string().min(1).max(2)
|
|
2770
|
+
}), z.object({
|
|
2771
|
+
kind: z.literal("agent"),
|
|
2772
|
+
personId: z.uuid(),
|
|
2773
|
+
displayName: z.string().min(1).max(200),
|
|
2774
|
+
initials: z.string().min(1).max(2),
|
|
2775
|
+
tokenLabel: z.string().min(1).max(200)
|
|
2776
|
+
})]);
|
|
2777
|
+
const canvasVersionEntrySchema = z.object({
|
|
2778
|
+
id: z.uuid(),
|
|
2779
|
+
canvasId: z.uuid(),
|
|
2780
|
+
documentVersion: z.number().int().positive(),
|
|
2781
|
+
origin: z.enum([
|
|
2782
|
+
"automatic",
|
|
2783
|
+
"manual",
|
|
2784
|
+
"restore"
|
|
2785
|
+
]),
|
|
2786
|
+
restoreRole: z.enum(["before", "result"]).nullable(),
|
|
2787
|
+
retention: z.enum([
|
|
2788
|
+
"automatic",
|
|
2789
|
+
"named",
|
|
2790
|
+
"restore-boundary"
|
|
2791
|
+
]),
|
|
2792
|
+
title: z.string().min(1).max(200).nullable(),
|
|
2793
|
+
description: z.string().max(CANVAS_VERSION_DESCRIPTION_MAX_LENGTH).nullable(),
|
|
2794
|
+
actor: canvasVersionActorSchema,
|
|
2795
|
+
sourceVersionEntryId: z.uuid().nullable(),
|
|
2796
|
+
expiresAt: z.iso.datetime().nullable(),
|
|
2797
|
+
createdAt: z.iso.datetime(),
|
|
2798
|
+
updatedAt: z.iso.datetime(),
|
|
2799
|
+
screenCount: z.number().int().min(0)
|
|
2800
|
+
});
|
|
2801
|
+
const listCanvasVersionsInputSchema = z.object({
|
|
2802
|
+
canvasId: z.uuid(),
|
|
2803
|
+
limit: z.number().int().min(1).max(100).default(50),
|
|
2804
|
+
cursor: z.string().min(1).max(CANVAS_VERSION_CURSOR_MAX_LENGTH).optional(),
|
|
2805
|
+
includeAutomatic: z.boolean().default(false),
|
|
2806
|
+
actor: z.enum(["all", "mine"]).default("all")
|
|
2807
|
+
});
|
|
2808
|
+
const listCanvasVersionsOutputSchema = z.object({
|
|
2809
|
+
current: z.object({
|
|
2810
|
+
documentVersion: z.number().int().positive(),
|
|
2811
|
+
updatedAt: z.iso.datetime()
|
|
2812
|
+
}),
|
|
2813
|
+
items: z.array(canvasVersionEntrySchema),
|
|
2814
|
+
nextCursor: z.string().min(1).nullable(),
|
|
2815
|
+
hasExpiredHistory: z.boolean()
|
|
2816
|
+
});
|
|
2817
|
+
const getCanvasVersionInputSchema = z.object({
|
|
2818
|
+
canvasId: z.uuid(),
|
|
2819
|
+
versionId: z.uuid()
|
|
2820
|
+
});
|
|
2821
|
+
const canvasVersionReadySchema = z.object({
|
|
2822
|
+
outcome: z.literal("ready"),
|
|
2823
|
+
entry: canvasVersionEntrySchema,
|
|
2824
|
+
document: canvasDocumentBlobSchema,
|
|
2825
|
+
screens: z.array(documentScreenSchema)
|
|
2826
|
+
});
|
|
2827
|
+
const canvasVersionDegradedSchema = z.object({
|
|
2828
|
+
outcome: z.literal("missing-resources"),
|
|
2829
|
+
entry: canvasVersionEntrySchema,
|
|
2830
|
+
document: canvasDocumentBlobSchema,
|
|
2831
|
+
screens: z.array(documentScreenSchema),
|
|
2832
|
+
missingScreenIds: z.array(z.uuid()).min(1)
|
|
2833
|
+
});
|
|
2834
|
+
const getCanvasVersionOutputSchema = z.discriminatedUnion("outcome", [
|
|
2835
|
+
canvasVersionReadySchema,
|
|
2836
|
+
canvasVersionDegradedSchema,
|
|
2837
|
+
z.object({
|
|
2838
|
+
outcome: z.literal("corrupt"),
|
|
2839
|
+
entry: canvasVersionEntrySchema
|
|
2840
|
+
})
|
|
2841
|
+
]);
|
|
2842
|
+
const canvasVersionTargetSchema = z.discriminatedUnion("kind", [z.object({
|
|
2843
|
+
kind: z.literal("current"),
|
|
2844
|
+
expectedVersion: z.number().int().positive()
|
|
2845
|
+
}), z.object({
|
|
2846
|
+
kind: z.literal("version"),
|
|
2847
|
+
versionId: z.uuid()
|
|
2848
|
+
})]);
|
|
2849
|
+
const nameCanvasVersionInputSchema = z.object({
|
|
2850
|
+
canvasId: z.uuid(),
|
|
2851
|
+
target: canvasVersionTargetSchema,
|
|
2852
|
+
title: z.string().trim().min(1).max(200),
|
|
2853
|
+
description: z.string().trim().max(CANVAS_VERSION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
|
|
2854
|
+
});
|
|
2855
|
+
const updateCanvasVersionMetadataInputSchema = z.object({
|
|
2856
|
+
canvasId: z.uuid(),
|
|
2857
|
+
versionId: z.uuid(),
|
|
2858
|
+
title: z.string().trim().min(1).max(200),
|
|
2859
|
+
description: z.string().trim().max(CANVAS_VERSION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
|
|
2860
|
+
});
|
|
2861
|
+
const removeCanvasVersionNameInputSchema = z.object({
|
|
2862
|
+
canvasId: z.uuid(),
|
|
2863
|
+
versionId: z.uuid()
|
|
2864
|
+
});
|
|
2865
|
+
const canvasVersionMutationOutputSchema = z.object({ entry: canvasVersionEntrySchema });
|
|
2866
|
+
const restoreCanvasVersionInputSchema = z.object({
|
|
2867
|
+
canvasId: z.uuid(),
|
|
2868
|
+
documentFormatVersion: canvasDocumentFormatSchema,
|
|
2869
|
+
versionId: z.uuid(),
|
|
2870
|
+
expectedVersion: z.number().int().positive()
|
|
2871
|
+
});
|
|
2872
|
+
const restoreCanvasVersionOutputSchema = z.object({
|
|
2873
|
+
canvasId: z.uuid(),
|
|
2874
|
+
version: z.number().int().positive(),
|
|
2875
|
+
beforeVersionId: z.uuid(),
|
|
2876
|
+
restoredVersionId: z.uuid(),
|
|
2877
|
+
restoreFenceVersion: z.number().int().positive()
|
|
2878
|
+
});
|
|
2879
|
+
const duplicateCanvasVersionInputSchema = z.object({
|
|
2880
|
+
canvasId: z.uuid(),
|
|
2881
|
+
documentFormatVersion: canvasDocumentFormatSchema,
|
|
2882
|
+
versionId: z.uuid(),
|
|
2883
|
+
organisationId: z.union([z.uuid(), z.literal("personal")]),
|
|
2884
|
+
title: z.string().trim().min(1).max(200).optional()
|
|
2885
|
+
});
|
|
2886
|
+
const duplicateCanvasVersionOutputSchema = z.object({
|
|
2887
|
+
canvasId: z.uuid(),
|
|
2888
|
+
title: z.string().min(1).max(200),
|
|
2889
|
+
version: z.literal(1)
|
|
2890
|
+
});
|
|
2891
|
+
|
|
2159
2892
|
//#endregion
|
|
2160
2893
|
//#region ../../packages/contract/src/canvas/invite.schema.ts
|
|
2161
2894
|
const inviteSchema = z.object({
|
|
@@ -2210,6 +2943,7 @@ const acceptInviteOutputSchema = z.object({
|
|
|
2210
2943
|
canvasId: z.uuid(),
|
|
2211
2944
|
accessLevel: grantableAccessLevelSchema
|
|
2212
2945
|
});
|
|
2946
|
+
|
|
2213
2947
|
//#endregion
|
|
2214
2948
|
//#region ../../packages/contract/src/canvas/participant.schema.ts
|
|
2215
2949
|
/**
|
|
@@ -2262,6 +2996,7 @@ const setReviewStateInputSchema = z.object({
|
|
|
2262
2996
|
* read as stored and disagree with the next read.
|
|
2263
2997
|
*/
|
|
2264
2998
|
const setReviewStateOutputSchema = z.object({ reviewState: setReviewStateInputSchema.shape.reviewState.nullable() });
|
|
2999
|
+
|
|
2265
3000
|
//#endregion
|
|
2266
3001
|
//#region ../../packages/contract/src/comment/comment.schema.ts
|
|
2267
3002
|
/** How many replies a thread hands back in one go before `hasMoreMessages` takes over. */
|
|
@@ -2483,6 +3218,52 @@ const deleteCommentOutputSchema = z.object({
|
|
|
2483
3218
|
deletedThreadIds: z.array(z.uuid()),
|
|
2484
3219
|
deletedMessageIds: z.array(z.uuid())
|
|
2485
3220
|
});
|
|
3221
|
+
|
|
3222
|
+
//#endregion
|
|
3223
|
+
//#region ../../packages/contract/src/fixture/canvas-fixture.lib.ts
|
|
3224
|
+
const ROOT_FIXTURE_NODE_ID = "root";
|
|
3225
|
+
const SORT_KEY_DIGITS = 4;
|
|
3226
|
+
const sortKeyAt = (seat) => `a${String(seat).padStart(SORT_KEY_DIGITS, "0")}`;
|
|
3227
|
+
const emptyFixtureDocument = () => ({
|
|
3228
|
+
version: 3,
|
|
3229
|
+
nodes: { [ROOT_FIXTURE_NODE_ID]: {
|
|
3230
|
+
id: ROOT_FIXTURE_NODE_ID,
|
|
3231
|
+
label: "Canvas",
|
|
3232
|
+
component: "root",
|
|
3233
|
+
styles: {}
|
|
3234
|
+
} },
|
|
3235
|
+
relationships: {}
|
|
3236
|
+
});
|
|
3237
|
+
const withFixtureNode = (document, node) => ({
|
|
3238
|
+
...document,
|
|
3239
|
+
nodes: {
|
|
3240
|
+
...document.nodes,
|
|
3241
|
+
[node.id]: node
|
|
3242
|
+
},
|
|
3243
|
+
relationships: {
|
|
3244
|
+
...document.relationships,
|
|
3245
|
+
[node.id]: {
|
|
3246
|
+
parentId: ROOT_FIXTURE_NODE_ID,
|
|
3247
|
+
sortKey: sortKeyAt(Object.keys(document.relationships).length)
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
});
|
|
3251
|
+
const withFixtureScreen = (document, input) => withFixtureNode(document, {
|
|
3252
|
+
id: input.id,
|
|
3253
|
+
label: input.label,
|
|
3254
|
+
component: "screen",
|
|
3255
|
+
props: { capture: {
|
|
3256
|
+
viewport: input.viewport,
|
|
3257
|
+
atMs: 0,
|
|
3258
|
+
screenId: input.screenId
|
|
3259
|
+
} },
|
|
3260
|
+
styles: {},
|
|
3261
|
+
box: {
|
|
3262
|
+
...input.at,
|
|
3263
|
+
...input.viewport
|
|
3264
|
+
}
|
|
3265
|
+
});
|
|
3266
|
+
|
|
2486
3267
|
//#endregion
|
|
2487
3268
|
//#region ../../packages/contract/src/organisation/organisation.schema.ts
|
|
2488
3269
|
const organisationRoleSchema = z.enum([
|
|
@@ -2601,6 +3382,7 @@ const teamInvitePreviewSchema = z.object({
|
|
|
2601
3382
|
hasAccount: z.boolean()
|
|
2602
3383
|
});
|
|
2603
3384
|
const acceptTeamInviteOutputSchema = z.object({ organisationId: z.uuid() });
|
|
3385
|
+
|
|
2604
3386
|
//#endregion
|
|
2605
3387
|
//#region ../../packages/contract/src/person/agent-token.schema.ts
|
|
2606
3388
|
const agentTokenSchema = z.object({
|
|
@@ -2620,12 +3402,16 @@ const createAgentTokenOutputSchema = z.object({
|
|
|
2620
3402
|
agentToken: agentTokenSchema
|
|
2621
3403
|
});
|
|
2622
3404
|
const listAgentTokensInputSchema = z.object({});
|
|
2623
|
-
const listAgentTokensOutputSchema = z.object({
|
|
3405
|
+
const listAgentTokensOutputSchema = z.object({
|
|
3406
|
+
items: z.array(agentTokenSchema),
|
|
3407
|
+
isConnected: z.boolean()
|
|
3408
|
+
});
|
|
2624
3409
|
const revokeAgentTokenInputSchema = z.object({ tokenId: z.uuid() });
|
|
2625
3410
|
const revokeAgentTokenOutputSchema = z.object({
|
|
2626
3411
|
tokenId: z.uuid(),
|
|
2627
3412
|
revoked: z.literal(true)
|
|
2628
3413
|
});
|
|
3414
|
+
|
|
2629
3415
|
//#endregion
|
|
2630
3416
|
//#region ../../packages/contract/src/person/cli-auth.schema.ts
|
|
2631
3417
|
const CLI_AUTH_SCOPE = "openid";
|
|
@@ -2636,10 +3422,12 @@ const cliAuthConfigurationSchema = z.discriminatedUnion("method", [z.object({ me
|
|
|
2636
3422
|
clientId: z.string().min(1),
|
|
2637
3423
|
scope: z.literal(CLI_AUTH_SCOPE)
|
|
2638
3424
|
})]);
|
|
3425
|
+
|
|
2639
3426
|
//#endregion
|
|
2640
3427
|
//#region ../../packages/contract/src/person/person.schema.ts
|
|
2641
3428
|
const personSchema = z.object({
|
|
2642
3429
|
id: z.uuid(),
|
|
3430
|
+
preparedCanvasId: z.uuid(),
|
|
2643
3431
|
displayName: z.string().min(1).max(120),
|
|
2644
3432
|
initials: z.string().min(1).max(4),
|
|
2645
3433
|
avatarUrl: z.string().max(MAX_URL_LENGTH).nullable(),
|
|
@@ -2701,8 +3489,13 @@ const signInOutputSchema = z.object({
|
|
|
2701
3489
|
person: personSchema,
|
|
2702
3490
|
token: z.string().nullable()
|
|
2703
3491
|
});
|
|
3492
|
+
const signUpOutputSchema = signInOutputSchema.extend({ preparedCanvasId: z.uuid() });
|
|
2704
3493
|
const signOutInputSchema = z.object({});
|
|
2705
3494
|
const signOutOutputSchema = z.object({ signedOut: z.literal(true) });
|
|
3495
|
+
|
|
3496
|
+
//#endregion
|
|
3497
|
+
//#region ../../packages/contract/src/person/recipient.schema.ts
|
|
3498
|
+
const MAX_RECIPIENT_RESULTS = 5;
|
|
2706
3499
|
const recipientEmailSchema = z.string().max(254).pipe(z.email());
|
|
2707
3500
|
const recipientSchema = z.discriminatedUnion("kind", [z.object({
|
|
2708
3501
|
kind: z.literal("person"),
|
|
@@ -2718,6 +3511,7 @@ const searchRecipientsInputSchema = z.object({ query: z.string().trim().min(1).m
|
|
|
2718
3511
|
const searchRecipientsOutputSchema = z.object({ recipients: z.array(recipientSchema).max(5) });
|
|
2719
3512
|
const recentRecipientsInputSchema = z.object({});
|
|
2720
3513
|
const recentRecipientsOutputSchema = searchRecipientsOutputSchema.extend({});
|
|
3514
|
+
|
|
2721
3515
|
//#endregion
|
|
2722
3516
|
//#region ../../packages/contract/src/person/session-handoff.lib.ts
|
|
2723
3517
|
/**
|
|
@@ -2730,7 +3524,7 @@ const recentRecipientsOutputSchema = searchRecipientsOutputSchema.extend({});
|
|
|
2730
3524
|
* app. A different trust story wants a different door — see docs/features/auth.md.
|
|
2731
3525
|
*/
|
|
2732
3526
|
const SESSION_HANDOFF = "enhance3:session-handoff";
|
|
2733
|
-
z.union([z.object({
|
|
3527
|
+
const sessionHandoffSchema = z.union([z.object({
|
|
2734
3528
|
kind: z.literal(SESSION_HANDOFF),
|
|
2735
3529
|
body: z.object({
|
|
2736
3530
|
token: z.string().min(1),
|
|
@@ -2740,6 +3534,7 @@ z.union([z.object({
|
|
|
2740
3534
|
kind: z.literal(SESSION_HANDOFF),
|
|
2741
3535
|
signedOut: z.literal(true)
|
|
2742
3536
|
})]);
|
|
3537
|
+
|
|
2743
3538
|
//#endregion
|
|
2744
3539
|
//#region ../../packages/contract/src/prototype/prototype.schema.ts
|
|
2745
3540
|
const MAX_PROTOTYPE_FILES = 2e3;
|
|
@@ -2748,6 +3543,7 @@ const MAX_PROTOTYPE_FILE_MEBIBYTES = 25;
|
|
|
2748
3543
|
const MAX_PROTOTYPE_MEBIBYTES = 250;
|
|
2749
3544
|
const MAX_PROTOTYPE_FILE_BYTES = MAX_PROTOTYPE_FILE_MEBIBYTES * BYTES_PER_MEBIBYTE$1;
|
|
2750
3545
|
const MAX_PROTOTYPE_BYTES = MAX_PROTOTYPE_MEBIBYTES * BYTES_PER_MEBIBYTE$1;
|
|
3546
|
+
const PROTOTYPE_UPLOAD_PAGE_SIZE = 50;
|
|
2751
3547
|
const MAX_PROTOTYPE_PATH_LENGTH = 500;
|
|
2752
3548
|
const MAX_PROTOTYPE_CONTENT_TYPE_LENGTH = 200;
|
|
2753
3549
|
const MAX_PROTOTYPE_NODE_ID_LENGTH = 200;
|
|
@@ -2803,7 +3599,8 @@ const reservePrototypeUploadsOutputSchema = z.object({
|
|
|
2803
3599
|
const completePrototypeDeploymentInputSchema = z.object({
|
|
2804
3600
|
canvasId: z.uuid(),
|
|
2805
3601
|
deploymentId: z.uuid(),
|
|
2806
|
-
baseVersion: z.number().int().positive()
|
|
3602
|
+
baseVersion: z.number().int().positive(),
|
|
3603
|
+
canvasPageId: z.string().min(1).max(MAX_PROTOTYPE_NODE_ID_LENGTH).optional()
|
|
2807
3604
|
});
|
|
2808
3605
|
const completePrototypeDeploymentOutputSchema = z.object({
|
|
2809
3606
|
canvasId: z.uuid(),
|
|
@@ -2826,9 +3623,15 @@ const requestPrototypeRuntimeTicketOutputSchema = z.object({
|
|
|
2826
3623
|
bootUrl: z.url(),
|
|
2827
3624
|
expiresAt: z.iso.datetime()
|
|
2828
3625
|
});
|
|
3626
|
+
|
|
3627
|
+
//#endregion
|
|
3628
|
+
//#region ../../packages/contract/src/prototype/prototype-artifact.schema.ts
|
|
3629
|
+
const PROTOTYPE_ARTIFACT_PROTOCOL_VERSION = 1;
|
|
3630
|
+
const PROTOTYPE_ARTIFACT_FORMAT = "zip";
|
|
2829
3631
|
const PROTOTYPE_ARTIFACT_MANIFEST_PATH = "__enhance/manifest.json";
|
|
2830
3632
|
const SHA256_HEX_LENGTH = 64;
|
|
2831
3633
|
const CONTENT_TYPE_LENGTH = 200;
|
|
3634
|
+
const MAX_PROTOTYPE_ARTIFACT_NODE_ID_LENGTH = 200;
|
|
2832
3635
|
const LAST_C0_CONTROL = 31;
|
|
2833
3636
|
const DELETE_CONTROL = 127;
|
|
2834
3637
|
const sha256Schema = z.string().length(SHA256_HEX_LENGTH).refine((value) => {
|
|
@@ -2949,7 +3752,8 @@ const getPrototypePublishStatusOutputSchema = z.discriminatedUnion("state", [get
|
|
|
2949
3752
|
const attachPrototypeArtifactInputSchema = z.object({
|
|
2950
3753
|
canvasId: z.uuid(),
|
|
2951
3754
|
deploymentId: z.uuid(),
|
|
2952
|
-
baseVersion: z.number().int().positive()
|
|
3755
|
+
baseVersion: z.number().int().positive(),
|
|
3756
|
+
canvasPageId: z.string().min(1).max(MAX_PROTOTYPE_ARTIFACT_NODE_ID_LENGTH).optional()
|
|
2953
3757
|
});
|
|
2954
3758
|
const attachPrototypeArtifactOutputSchema = z.object({
|
|
2955
3759
|
canvasId: z.uuid(),
|
|
@@ -2961,25 +3765,44 @@ const attachPrototypeArtifactOutputSchema = z.object({
|
|
|
2961
3765
|
origin: z.url(),
|
|
2962
3766
|
openUrl: z.string().startsWith("/c/")
|
|
2963
3767
|
});
|
|
2964
|
-
|
|
3768
|
+
|
|
3769
|
+
//#endregion
|
|
3770
|
+
//#region ../../packages/contract/src/prototype/prototype-bridge.schema.ts
|
|
3771
|
+
const PROTOTYPE_BRIDGE_PROTOCOL = 1;
|
|
3772
|
+
const PROTOTYPE_VIEWPORT_ATTRIBUTE = "data-enhance-prototype-viewport";
|
|
3773
|
+
const PROTOTYPE_VIEWPORT_SELECTOR = `[${PROTOTYPE_VIEWPORT_ATTRIBUTE}]`;
|
|
3774
|
+
const prototypeBridgeCaptureRequestSchema = z.object({
|
|
2965
3775
|
protocol: z.literal(1),
|
|
2966
3776
|
type: z.literal("enhance.prototype.capture"),
|
|
2967
3777
|
requestId: z.uuid()
|
|
2968
3778
|
});
|
|
2969
|
-
z.object({
|
|
3779
|
+
const prototypeBridgeReadySchema = z.object({
|
|
2970
3780
|
protocol: z.literal(1),
|
|
2971
3781
|
type: z.literal("enhance.prototype.ready")
|
|
2972
3782
|
});
|
|
2973
|
-
z.object({
|
|
3783
|
+
const prototypeBridgeEscapeSchema = z.object({
|
|
2974
3784
|
protocol: z.literal(1),
|
|
2975
3785
|
type: z.literal("enhance.prototype.escape")
|
|
2976
3786
|
});
|
|
2977
|
-
z.object({
|
|
3787
|
+
const prototypeBridgeZoomSchema = z.object({
|
|
3788
|
+
protocol: z.literal(1),
|
|
3789
|
+
type: z.literal("enhance.prototype.zoom"),
|
|
3790
|
+
deltaX: z.number(),
|
|
3791
|
+
deltaY: z.number(),
|
|
3792
|
+
deltaMode: z.union([
|
|
3793
|
+
z.literal(0),
|
|
3794
|
+
z.literal(1),
|
|
3795
|
+
z.literal(2)
|
|
3796
|
+
]),
|
|
3797
|
+
anchorX: z.number().min(0).max(1),
|
|
3798
|
+
anchorY: z.number().min(0).max(1)
|
|
3799
|
+
});
|
|
3800
|
+
const prototypeBridgeNavigationRequestSchema = z.object({
|
|
2978
3801
|
protocol: z.literal(1),
|
|
2979
3802
|
type: z.literal("enhance.prototype.navigate"),
|
|
2980
3803
|
direction: z.enum(["back", "forward"])
|
|
2981
3804
|
});
|
|
2982
|
-
z.object({
|
|
3805
|
+
const prototypeBridgeNavigationStateSchema = z.object({
|
|
2983
3806
|
protocol: z.literal(1),
|
|
2984
3807
|
type: z.literal("enhance.prototype.navigation"),
|
|
2985
3808
|
canGoBack: z.boolean(),
|
|
@@ -2998,13 +3821,14 @@ const prototypeBridgeCaptureResponseBaseSchema = z.object({
|
|
|
2998
3821
|
type: z.literal("enhance.prototype.captured"),
|
|
2999
3822
|
requestId: z.uuid()
|
|
3000
3823
|
});
|
|
3001
|
-
z.discriminatedUnion("outcome", [prototypeBridgeCaptureResponseBaseSchema.extend({
|
|
3824
|
+
const prototypeBridgeCaptureResponseSchema = z.discriminatedUnion("outcome", [prototypeBridgeCaptureResponseBaseSchema.extend({
|
|
3002
3825
|
outcome: z.literal("captured"),
|
|
3003
3826
|
screen: capturedPrototypeScreenSchema
|
|
3004
3827
|
}), prototypeBridgeCaptureResponseBaseSchema.extend({
|
|
3005
3828
|
outcome: z.literal("failed"),
|
|
3006
3829
|
error: z.string().min(1)
|
|
3007
3830
|
})]);
|
|
3831
|
+
|
|
3008
3832
|
//#endregion
|
|
3009
3833
|
//#region ../../packages/contract/src/recording/inline-data-asset.lib.ts
|
|
3010
3834
|
const HASH_RADIX$1 = 16;
|
|
@@ -3012,7 +3836,32 @@ const FNV_OFFSET_BASIS = 2166136261;
|
|
|
3012
3836
|
const GOLDEN_RATIO_HASH = Number.parseInt("9e3779b9", HASH_RADIX$1);
|
|
3013
3837
|
const MURMUR_HASH_2 = Number.parseInt("85ebca6b", HASH_RADIX$1);
|
|
3014
3838
|
const MURMUR_HASH_3 = Number.parseInt("c2b2ae35", HASH_RADIX$1);
|
|
3015
|
-
|
|
3839
|
+
const HASH_SEEDS = [
|
|
3840
|
+
FNV_OFFSET_BASIS,
|
|
3841
|
+
FNV_OFFSET_BASIS ^ GOLDEN_RATIO_HASH,
|
|
3842
|
+
FNV_OFFSET_BASIS ^ MURMUR_HASH_2,
|
|
3843
|
+
FNV_OFFSET_BASIS ^ MURMUR_HASH_3
|
|
3844
|
+
];
|
|
3845
|
+
|
|
3846
|
+
//#endregion
|
|
3847
|
+
//#region ../../packages/contract/src/recording/recording-asset-reference.lib.ts
|
|
3848
|
+
const RECORDING_ASSET_PATH_PREFIX = "/v1/recording-assets/";
|
|
3849
|
+
/** A durable asset identity. The delivery behind it may issue fresh temporary storage access. */
|
|
3850
|
+
const recordingAssetPath = (assetBundleId, urlHash) => `${RECORDING_ASSET_PATH_PREFIX}${encodeURIComponent(assetBundleId)}/${encodeURIComponent(urlHash)}`;
|
|
3851
|
+
|
|
3852
|
+
//#endregion
|
|
3853
|
+
//#region ../../packages/contract/src/recording/popover-state.lib.ts
|
|
3854
|
+
/**
|
|
3855
|
+
* @justified docs/comments.md#clarification
|
|
3856
|
+
* Added to the serialised copy: native popover state has no corresponding HTML attribute.
|
|
3857
|
+
*/
|
|
3858
|
+
const OPEN_POPOVER_ATTRIBUTE = "data-enhance-popover-open";
|
|
3859
|
+
/**
|
|
3860
|
+
* @justified docs/comments.md#intent
|
|
3861
|
+
* A scriptless captured screen still draws the popover even though it cannot call showPopover.
|
|
3862
|
+
*/
|
|
3863
|
+
const OPEN_POPOVER_RULE = `[${OPEN_POPOVER_ATTRIBUTE}] { display: block !important; }`;
|
|
3864
|
+
|
|
3016
3865
|
//#endregion
|
|
3017
3866
|
//#region ../../packages/contract/src/recording/recording.schema.ts
|
|
3018
3867
|
const viewportSchema = z.object({
|
|
@@ -3287,13 +4136,10 @@ const deleteRecordingOutputSchema = z.object({
|
|
|
3287
4136
|
/** Screens survive with their provenance nulled. That is what makes iteration safe. */
|
|
3288
4137
|
detachedScreenCount: z.number().int().min(0)
|
|
3289
4138
|
});
|
|
4139
|
+
|
|
3290
4140
|
//#endregion
|
|
3291
|
-
//#region ../../packages/contract/src/recording/
|
|
3292
|
-
const
|
|
3293
|
-
/** A durable asset identity. The delivery behind it may issue fresh temporary storage access. */
|
|
3294
|
-
const recordingAssetPath = (assetBundleId, urlHash) => `${RECORDING_ASSET_PATH_PREFIX}${encodeURIComponent(assetBundleId)}/${encodeURIComponent(urlHash)}`;
|
|
3295
|
-
[
|
|
3296
|
-
`[data-enhance-unsupported]:not([data-enhance-unsupported-hidden]):not([style*="display: none"]) {
|
|
4141
|
+
//#region ../../packages/contract/src/recording/unsupported-surface-style.lib.ts
|
|
4142
|
+
const SURFACE_RULE = `[data-enhance-unsupported]:not([data-enhance-unsupported-hidden]):not([style*="display: none"]) {
|
|
3297
4143
|
align-items: center !important;
|
|
3298
4144
|
background-color: #f7f7f8 !important;
|
|
3299
4145
|
background-image: linear-gradient(to top right, transparent calc(50% - 1px), #a8a8b0 50%, transparent calc(50% + 1px)), linear-gradient(to bottom right, transparent calc(50% - 1px), #a8a8b0 50%, transparent calc(50% + 1px)) !important;
|
|
@@ -3305,21 +4151,30 @@ const recordingAssetPath = (assetBundleId, urlHash) => `${RECORDING_ASSET_PATH_P
|
|
|
3305
4151
|
justify-content: center !important;
|
|
3306
4152
|
overflow: hidden !important;
|
|
3307
4153
|
text-align: center !important;
|
|
3308
|
-
}
|
|
3309
|
-
|
|
4154
|
+
}`;
|
|
4155
|
+
const HIDDEN_RULE = `[data-enhance-unsupported-hidden], [data-enhance-unsupported][style*="display: none"] {
|
|
3310
4156
|
display: none !important;
|
|
3311
|
-
}
|
|
3312
|
-
|
|
4157
|
+
}`;
|
|
4158
|
+
const LABEL_RULE = `[data-enhance-unsupported]::after {
|
|
3313
4159
|
background: #f7f7f8 !important;
|
|
3314
4160
|
content: attr(data-enhance-unsupported) !important;
|
|
3315
4161
|
padding: 4px 8px !important;
|
|
3316
|
-
}
|
|
3317
|
-
|
|
4162
|
+
}`;
|
|
4163
|
+
const FRAME_RULE = `iframe[data-enhance-unsupported="Embedded content not supported"] {
|
|
3318
4164
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='44'%3E%3Crect width='260' height='44' rx='6' fill='%23f7f7f8'/%3E%3Ctext x='130' y='27' text-anchor='middle' font-family='Arial,sans-serif' font-size='14' font-weight='500' fill='%234f4f55'%3EEmbedded%20content%20not%20supported%3C/text%3E%3C/svg%3E"), linear-gradient(to top right, transparent calc(50% - 1px), #a8a8b0 50%, transparent calc(50% + 1px)), linear-gradient(to bottom right, transparent calc(50% - 1px), #a8a8b0 50%, transparent calc(50% + 1px)) !important;
|
|
3319
4165
|
background-position: center, center, center !important;
|
|
3320
4166
|
background-repeat: no-repeat !important;
|
|
3321
|
-
}
|
|
3322
|
-
|
|
4167
|
+
}`;
|
|
4168
|
+
/** One rule per entry because rrweb passes each entry to `CSSStyleSheet.insertRule`. */
|
|
4169
|
+
const UNSUPPORTED_SURFACE_RULES = [
|
|
4170
|
+
SURFACE_RULE,
|
|
4171
|
+
HIDDEN_RULE,
|
|
4172
|
+
LABEL_RULE,
|
|
4173
|
+
FRAME_RULE
|
|
4174
|
+
];
|
|
4175
|
+
/** Shared by standalone marked-page HTML, whose `<style>` element takes one stylesheet string. */
|
|
4176
|
+
const UNSUPPORTED_SURFACE_STYLE = UNSUPPORTED_SURFACE_RULES.join("\n");
|
|
4177
|
+
|
|
3323
4178
|
//#endregion
|
|
3324
4179
|
//#region ../../packages/contract/src/screen/screen.schema.ts
|
|
3325
4180
|
const createScreenInputSchema = z.object({
|
|
@@ -3363,16 +4218,24 @@ const deleteScreenOutputSchema = z.object({
|
|
|
3363
4218
|
/** Threads anchored to it go with it. Their canvases and their pins do not. */
|
|
3364
4219
|
deletedThreadCount: z.number().int().min(0)
|
|
3365
4220
|
});
|
|
4221
|
+
|
|
4222
|
+
//#endregion
|
|
4223
|
+
//#region ../../packages/contract/src/shared/app-error.error.ts
|
|
4224
|
+
/**
|
|
4225
|
+
* The one error shape that crosses the wire. The codes are a fixed union, so adding one
|
|
4226
|
+
* is a compile error at every `switch` that handles them.
|
|
4227
|
+
*/
|
|
4228
|
+
const APP_ERROR_CODES = [
|
|
4229
|
+
"BAD_REQUEST",
|
|
4230
|
+
"UNAUTHORIZED",
|
|
4231
|
+
"FORBIDDEN",
|
|
4232
|
+
"NOT_FOUND",
|
|
4233
|
+
"CONFLICT",
|
|
4234
|
+
"RATE_LIMITED",
|
|
4235
|
+
"INTERNAL"
|
|
4236
|
+
];
|
|
3366
4237
|
const appErrorSchema = z.object({
|
|
3367
|
-
code: z.enum(
|
|
3368
|
-
"BAD_REQUEST",
|
|
3369
|
-
"UNAUTHORIZED",
|
|
3370
|
-
"FORBIDDEN",
|
|
3371
|
-
"NOT_FOUND",
|
|
3372
|
-
"CONFLICT",
|
|
3373
|
-
"RATE_LIMITED",
|
|
3374
|
-
"INTERNAL"
|
|
3375
|
-
]),
|
|
4238
|
+
code: z.enum(APP_ERROR_CODES),
|
|
3376
4239
|
message: z.string().min(1),
|
|
3377
4240
|
/** Field-level detail, keyed by the input path that failed. */
|
|
3378
4241
|
fields: z.record(z.string(), z.string()).optional()
|
|
@@ -3386,6 +4249,7 @@ const appError$1 = (code, message, fields) => fields === void 0 ? {
|
|
|
3386
4249
|
message,
|
|
3387
4250
|
fields
|
|
3388
4251
|
};
|
|
4252
|
+
|
|
3389
4253
|
//#endregion
|
|
3390
4254
|
//#region ../../packages/contract/src/shared/client-performance.schema.ts
|
|
3391
4255
|
const MAX_CAPABILITY_VERSION$1 = 16;
|
|
@@ -3483,13 +4347,20 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
|
|
|
3483
4347
|
"snapshot",
|
|
3484
4348
|
"gap",
|
|
3485
4349
|
"replace",
|
|
3486
|
-
"relay"
|
|
4350
|
+
"relay",
|
|
4351
|
+
"history-restored"
|
|
3487
4352
|
]),
|
|
3488
4353
|
durationMs: durationSchema$1
|
|
3489
4354
|
})
|
|
3490
4355
|
]);
|
|
3491
4356
|
const clientPerformanceOutputSchema = z.object({ accepted: z.literal(true) });
|
|
3492
|
-
|
|
4357
|
+
|
|
4358
|
+
//#endregion
|
|
4359
|
+
//#region ../../packages/contract/src/shared/extension-bridge.schema.ts
|
|
4360
|
+
const EXTENSION_BRIDGE_PROBE = "enhance3:extension-probe";
|
|
4361
|
+
const EXTENSION_BRIDGE_PRESENT = "enhance3:extension-present";
|
|
4362
|
+
const extensionBridgeSchema = z.discriminatedUnion("type", [z.object({ type: z.literal(EXTENSION_BRIDGE_PROBE) }).strict(), z.object({ type: z.literal(EXTENSION_BRIDGE_PRESENT) }).strict()]);
|
|
4363
|
+
|
|
3493
4364
|
//#endregion
|
|
3494
4365
|
//#region ../../packages/contract/src/shared/extension-telemetry.schema.ts
|
|
3495
4366
|
const MAX_CAPABILITY_VERSION = 16;
|
|
@@ -3691,6 +4562,7 @@ const extensionTelemetryInputSchema = z.discriminatedUnion("name", [
|
|
|
3691
4562
|
})
|
|
3692
4563
|
]);
|
|
3693
4564
|
const extensionTelemetryOutputSchema = z.object({ accepted: z.literal(true) });
|
|
4565
|
+
|
|
3694
4566
|
//#endregion
|
|
3695
4567
|
//#region ../../packages/contract/src/transcript/transcript.schema.ts
|
|
3696
4568
|
const transcriptScopeSchema = z.object({
|
|
@@ -3736,6 +4608,7 @@ const transcriptOutputSchema = z.discriminatedUnion("state", [
|
|
|
3736
4608
|
]);
|
|
3737
4609
|
const retryTranscriptInputSchema = transcriptScopeSchema;
|
|
3738
4610
|
const retryTranscriptOutputSchema = processingTranscriptSchema;
|
|
4611
|
+
|
|
3739
4612
|
//#endregion
|
|
3740
4613
|
//#region src/application/cli.error.ts
|
|
3741
4614
|
var CliError = class extends Error {
|
|
@@ -3750,6 +4623,7 @@ var CliError = class extends Error {
|
|
|
3750
4623
|
this.fields = fields;
|
|
3751
4624
|
}
|
|
3752
4625
|
};
|
|
4626
|
+
|
|
3753
4627
|
//#endregion
|
|
3754
4628
|
//#region src/application/partial-batch.error.ts
|
|
3755
4629
|
var PartialBatchError = class extends CliError {
|
|
@@ -3758,9 +4632,11 @@ var PartialBatchError = class extends CliError {
|
|
|
3758
4632
|
this.name = "PartialBatchError";
|
|
3759
4633
|
}
|
|
3760
4634
|
};
|
|
4635
|
+
|
|
3761
4636
|
//#endregion
|
|
3762
4637
|
//#region src/application/capability-example.consts.ts
|
|
3763
4638
|
const CAPABILITY_UUID_EXAMPLE = "00000000-0000-4000-8000-000000000010";
|
|
4639
|
+
|
|
3764
4640
|
//#endregion
|
|
3765
4641
|
//#region src/infrastructure/product-capability.schema.ts
|
|
3766
4642
|
const MIN_RENDER_SCALE = .1;
|
|
@@ -3768,7 +4644,10 @@ const MAX_RENDER_SCALE = 4;
|
|
|
3768
4644
|
const MAX_NODE_ID_LENGTH = 200;
|
|
3769
4645
|
const MAX_HTML_LENGTH = 1e6;
|
|
3770
4646
|
const MAX_ID_PREFIX_LENGTH = 100;
|
|
3771
|
-
const canvasApplyCapabilityInputSchema = applyCanvasOperationsInputSchema.omit({
|
|
4647
|
+
const canvasApplyCapabilityInputSchema = applyCanvasOperationsInputSchema.omit({
|
|
4648
|
+
mutationId: true,
|
|
4649
|
+
documentFormatVersion: true
|
|
4650
|
+
});
|
|
3772
4651
|
const canvasRenderCapabilityInputSchema = z.object({
|
|
3773
4652
|
canvasId: z.uuid(),
|
|
3774
4653
|
expectedVersion: z.number().int().positive().nullable().describe("Exact document version to render, or null to accept the current version."),
|
|
@@ -3817,6 +4696,7 @@ const transcriptReadCapabilityInputSchema = z.object({
|
|
|
3817
4696
|
canvasId: z.uuid(),
|
|
3818
4697
|
recordingId: z.uuid()
|
|
3819
4698
|
});
|
|
4699
|
+
|
|
3820
4700
|
//#endregion
|
|
3821
4701
|
//#region src/infrastructure/canvas-capability.consts.ts
|
|
3822
4702
|
const CANVAS_CAPABILITY_SPECS = [
|
|
@@ -3960,6 +4840,7 @@ const CANVAS_CAPABILITY_SPECS = [
|
|
|
3960
4840
|
}
|
|
3961
4841
|
}
|
|
3962
4842
|
];
|
|
4843
|
+
|
|
3963
4844
|
//#endregion
|
|
3964
4845
|
//#region src/infrastructure/capability-example.mapper.ts
|
|
3965
4846
|
const jsonRecordSchema$2 = z.record(z.string(), z.unknown());
|
|
@@ -4013,9 +4894,30 @@ const toCapabilityExample = (schemaValue) => {
|
|
|
4013
4894
|
}
|
|
4014
4895
|
return objectExample(schema);
|
|
4015
4896
|
};
|
|
4897
|
+
|
|
4898
|
+
//#endregion
|
|
4899
|
+
//#region src/infrastructure/canvas-version-descriptions.consts.ts
|
|
4900
|
+
const CANVAS_VERSION_PROCEDURE_DESCRIPTIONS = {
|
|
4901
|
+
"canvas.version.list": "List retained versions of a canvas, newest first.",
|
|
4902
|
+
"canvas.version.get": "Read the document and screen manifest retained for one canvas version.",
|
|
4903
|
+
"canvas.version.name": "Name the current or a retained canvas version so it is kept.",
|
|
4904
|
+
"canvas.version.updateMetadata": "Replace the title and description of a named canvas version.",
|
|
4905
|
+
"canvas.version.removeName": "Remove a canvas version’s name and return it to automatic retention."
|
|
4906
|
+
};
|
|
4907
|
+
const CANVAS_VERSION_OPTION_DESCRIPTIONS = {
|
|
4908
|
+
"--version-id": "Canvas version entry id returned by `enhance canvas version list`.",
|
|
4909
|
+
"--cursor": "Opaque continuation cursor returned by the preceding list page.",
|
|
4910
|
+
"--limit": "Maximum number of results to return on this page.",
|
|
4911
|
+
"--include-automatic": "Include unnamed automatic versions as well as retained versions.",
|
|
4912
|
+
"--actor": "Version author filter: `all` or only versions created by `mine`.",
|
|
4913
|
+
"--target": "Version target JSON: current with its expectedVersion, or a retained version with its versionId.",
|
|
4914
|
+
"--description": "Optional detail explaining why this named version matters, or null."
|
|
4915
|
+
};
|
|
4916
|
+
|
|
4016
4917
|
//#endregion
|
|
4017
4918
|
//#region src/infrastructure/procedure-descriptions.consts.ts
|
|
4018
4919
|
const PROCEDURE_DESCRIPTIONS = {
|
|
4920
|
+
...CANVAS_VERSION_PROCEDURE_DESCRIPTIONS,
|
|
4019
4921
|
"canvas.createEditableFrame": "Insert one validated primitive subtree beside its source screen as an atomic canvas edit.",
|
|
4020
4922
|
"canvas.create": "Create a canvas and return the id required by canvas-scoped commands.",
|
|
4021
4923
|
"canvas.applyOperations": "Atomically apply validated text, geometry, style, ordering, and removal operations to one canvas version.",
|
|
@@ -4036,19 +4938,19 @@ const PROCEDURE_DESCRIPTIONS = {
|
|
|
4036
4938
|
"canvas.setReviewState": "Change the authenticated person’s review state on a canvas.",
|
|
4037
4939
|
"canvas.document.get": "Read a canvas document, version, and attached screen manifest.",
|
|
4038
4940
|
"canvas.document.save": "Replace a canvas document. A stale base version exits 5 as CONFLICT; read, merge, and retry.",
|
|
4039
|
-
"canvas.inspect": "
|
|
4941
|
+
"canvas.inspect": "Read the canonical browser URL for a canvas, its exact document version, kind counts, bounds, and next inspection commands.",
|
|
4040
4942
|
"canvas.tree": "List stable node ids, hierarchy, kinds, and world-space boxes for one canvas.",
|
|
4041
4943
|
"canvas.node": "Read one stable node with its exact styles, props, children, and current version.",
|
|
4042
4944
|
"canvas.selection": "Read the accountable person’s most recently changed live browser selection at an exact canvas version.",
|
|
4043
4945
|
"canvas.participants.list": "List people with direct access to a canvas.",
|
|
4044
4946
|
"canvas.participants.setAccess": "Change a canvas participant between view and comment access.",
|
|
4045
4947
|
"canvas.participants.revoke": "Remove a participant’s direct access to a canvas.",
|
|
4046
|
-
"canvas.invites.create": "Invite an email
|
|
4948
|
+
"canvas.invites.create": "Invite an email address to access a canvas and return the pending invitation.",
|
|
4047
4949
|
"canvas.invites.accept": "Accept a canvas invitation using its secret token.",
|
|
4048
4950
|
"canvas.invites.preview": "Inspect what an invitation grants before accepting it.",
|
|
4049
4951
|
"canvas.invites.list": "List pending and expired invitations for a canvas.",
|
|
4050
4952
|
"canvas.invites.revoke": "Revoke a pending canvas invitation.",
|
|
4051
|
-
"canvas.invites.resend": "Replace
|
|
4953
|
+
"canvas.invites.resend": "Replace a pending canvas invitation token and send the invitation again.",
|
|
4052
4954
|
"comment.list": "List comment threads and replies on a canvas.",
|
|
4053
4955
|
"comment.start": "Start a comment thread anchored to a canvas location.",
|
|
4054
4956
|
"comment.resolve": "Set a thread resolved or reopened with an explicit target state.",
|
|
@@ -4093,6 +4995,7 @@ const PROCEDURE_DESCRIPTIONS = {
|
|
|
4093
4995
|
"screen.delete": "Delete an unattached captured page owned by this person."
|
|
4094
4996
|
};
|
|
4095
4997
|
const OPTION_DESCRIPTIONS = {
|
|
4998
|
+
...CANVAS_VERSION_OPTION_DESCRIPTIONS,
|
|
4096
4999
|
"--canvas-id": "Canvas id, from `enhance canvas list`.",
|
|
4097
5000
|
"--mutation-id": "Client-minted UUID identifying this atomic canvas mutation.",
|
|
4098
5001
|
"--organisation-id": "Team id, from `enhance organisation list`.",
|
|
@@ -4113,6 +5016,7 @@ const OPTION_DESCRIPTIONS = {
|
|
|
4113
5016
|
"--access-state": "Filter or set link reach: invite-only, link-view, or link-comment.",
|
|
4114
5017
|
"--has-unresolved": "Set true to return only canvases with unresolved comment threads.",
|
|
4115
5018
|
"--base-version": "Document version returned by `enhance canvas document get`.",
|
|
5019
|
+
"--document-format-version": "Supported canvas schema version for this writer, not the saved revision in baseVersion. Update the client if its format is no longer supported.",
|
|
4116
5020
|
"--operations": "One or more validated canvas operations; use the canvas apply command’s @file form for a batch.",
|
|
4117
5021
|
"--phase": "Agent work now in progress: reading, writing, creating, deleting, or rendering.",
|
|
4118
5022
|
"--node-ids": "Stable canvas node ids affected by the current agent activity.",
|
|
@@ -4206,6 +5110,7 @@ const OPTION_DESCRIPTIONS = {
|
|
|
4206
5110
|
"screen.create --page-title": "Required captured page title, or the literal null.",
|
|
4207
5111
|
"fixture recording --source-url": "Required original page URL represented by this recording."
|
|
4208
5112
|
};
|
|
5113
|
+
|
|
4209
5114
|
//#endregion
|
|
4210
5115
|
//#region src/infrastructure/capability-definition.mapper.ts
|
|
4211
5116
|
const jsonRecordSchema$1 = z.record(z.string(), z.unknown());
|
|
@@ -4300,7 +5205,7 @@ const resultSchemaFor = (output) => z.union([
|
|
|
4300
5205
|
const toCapabilityDefinition = (input) => {
|
|
4301
5206
|
const inputJson = z.toJSONSchema(input.inputSchema, { unrepresentable: "any" });
|
|
4302
5207
|
const outputJson = z.toJSONSchema(input.outputSchema, { unrepresentable: "any" });
|
|
4303
|
-
const guide = guideFor({
|
|
5208
|
+
const guide = input.guide ?? guideFor({
|
|
4304
5209
|
id: input.id,
|
|
4305
5210
|
operation: input.operation,
|
|
4306
5211
|
meta: input.meta,
|
|
@@ -4338,6 +5243,7 @@ const toCapabilityDefinition = (input) => {
|
|
|
4338
5243
|
})
|
|
4339
5244
|
};
|
|
4340
5245
|
};
|
|
5246
|
+
|
|
4341
5247
|
//#endregion
|
|
4342
5248
|
//#region src/infrastructure/capability-policy.consts.ts
|
|
4343
5249
|
const SHARED_CAPABILITY_POLICY = {
|
|
@@ -4396,6 +5302,16 @@ const PROCEDURE_CAPABILITY_POLICIES = {
|
|
|
4396
5302
|
reason: "Browser thumbnail telemetry is not an agent capability.",
|
|
4397
5303
|
owner: "product"
|
|
4398
5304
|
},
|
|
5305
|
+
"canvas.version.duplicate": {
|
|
5306
|
+
exposure: "internal",
|
|
5307
|
+
reason: "Duplicating historical state is restricted to an interactive person session.",
|
|
5308
|
+
owner: "product"
|
|
5309
|
+
},
|
|
5310
|
+
"canvas.version.restore": {
|
|
5311
|
+
exposure: "internal",
|
|
5312
|
+
reason: "Restoring historical state is restricted to an interactive person session.",
|
|
5313
|
+
owner: "product"
|
|
5314
|
+
},
|
|
4399
5315
|
"person.createAgentToken": {
|
|
4400
5316
|
exposure: "cli-transport",
|
|
4401
5317
|
reason: "Credential lifecycle remains in the interactive CLI auth surface.",
|
|
@@ -4564,6 +5480,7 @@ const UTILITY_CAPABILITY_POLICIES = {
|
|
|
4564
5480
|
owner: "development"
|
|
4565
5481
|
}
|
|
4566
5482
|
};
|
|
5483
|
+
|
|
4567
5484
|
//#endregion
|
|
4568
5485
|
//#region src/infrastructure/shared-capability-procedure.consts.ts
|
|
4569
5486
|
const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
@@ -4601,6 +5518,11 @@ const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
|
4601
5518
|
"canvas.setAccess",
|
|
4602
5519
|
"canvas.setReviewState",
|
|
4603
5520
|
"canvas.tree",
|
|
5521
|
+
"canvas.version.get",
|
|
5522
|
+
"canvas.version.list",
|
|
5523
|
+
"canvas.version.name",
|
|
5524
|
+
"canvas.version.removeName",
|
|
5525
|
+
"canvas.version.updateMetadata",
|
|
4604
5526
|
"comment.delete",
|
|
4605
5527
|
"comment.edit",
|
|
4606
5528
|
"comment.list",
|
|
@@ -4645,6 +5567,7 @@ const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
|
4645
5567
|
"screen.delete",
|
|
4646
5568
|
"transcript.retry"
|
|
4647
5569
|
]);
|
|
5570
|
+
|
|
4648
5571
|
//#endregion
|
|
4649
5572
|
//#region src/infrastructure/capability-policy.adapter.ts
|
|
4650
5573
|
const createCapabilityPolicyAdapter = () => ({
|
|
@@ -4673,6 +5596,7 @@ const createCapabilityPolicyAdapter = () => ({
|
|
|
4673
5596
|
},
|
|
4674
5597
|
excludedProcedures: new Set(Object.entries(PROCEDURE_CAPABILITY_POLICIES).flatMap(([procedure, policy]) => policy.exposure === "shared" ? [] : [procedure]))
|
|
4675
5598
|
});
|
|
5599
|
+
|
|
4676
5600
|
//#endregion
|
|
4677
5601
|
//#region src/infrastructure/collaboration-capability.consts.ts
|
|
4678
5602
|
const COLLABORATION_CAPABILITY_SPECS = [
|
|
@@ -4793,6 +5717,7 @@ const COLLABORATION_CAPABILITY_SPECS = [
|
|
|
4793
5717
|
}
|
|
4794
5718
|
}
|
|
4795
5719
|
];
|
|
5720
|
+
|
|
4796
5721
|
//#endregion
|
|
4797
5722
|
//#region ../api/src/shared/errors/app.error.ts
|
|
4798
5723
|
const appError = (code, message, fields) => fields ? {
|
|
@@ -4804,6 +5729,7 @@ const appError = (code, message, fields) => fields ? {
|
|
|
4804
5729
|
message
|
|
4805
5730
|
};
|
|
4806
5731
|
const internalError = (message) => appError("INTERNAL", message);
|
|
5732
|
+
|
|
4807
5733
|
//#endregion
|
|
4808
5734
|
//#region ../api/src/shared/trpc/instance.trpc.ts
|
|
4809
5735
|
/** Never the reason. That is on the `rpc` line, against the id the caller is holding. */
|
|
@@ -4922,6 +5848,7 @@ const toTrpcError = (error) => new TRPCError({
|
|
|
4922
5848
|
message: error.message,
|
|
4923
5849
|
cause: error
|
|
4924
5850
|
});
|
|
5851
|
+
|
|
4925
5852
|
//#endregion
|
|
4926
5853
|
//#region ../api/src/shared/trpc/idempotency.procedure.ts
|
|
4927
5854
|
const NATIVE_REPLAY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
@@ -4976,6 +5903,7 @@ const idempotentMutations = trpcMiddleware(async ({ ctx, type, path, getRawInput
|
|
|
4976
5903
|
if (completed.isErr()) throw toTrpcError(internalError(completed.error.message));
|
|
4977
5904
|
return result;
|
|
4978
5905
|
});
|
|
5906
|
+
|
|
4979
5907
|
//#endregion
|
|
4980
5908
|
//#region ../api/src/shared/trpc/base.procedure.ts
|
|
4981
5909
|
/** Query timings are logged to the hundredth of a millisecond; finer is noise. */
|
|
@@ -5170,6 +6098,7 @@ const canvasOwnerProcedure = canvasReaderProcedure.use(async ({ ctx, next }) =>
|
|
|
5170
6098
|
const orThrow = (result) => result.match((value) => value, (error) => {
|
|
5171
6099
|
throw toTrpcError(error);
|
|
5172
6100
|
});
|
|
6101
|
+
|
|
5173
6102
|
//#endregion
|
|
5174
6103
|
//#region ../api/src/canvas/infrastructure/canvas-actor.mapper.ts
|
|
5175
6104
|
const COLOURS = [
|
|
@@ -5209,6 +6138,7 @@ const toAgentCanvasRequestActor = (viewer) => viewer.kind === "agent" ? {
|
|
|
5209
6138
|
tokenId: viewer.tokenId,
|
|
5210
6139
|
mutationActor: toCanvasMutationActor(viewer)
|
|
5211
6140
|
} : null;
|
|
6141
|
+
|
|
5212
6142
|
//#endregion
|
|
5213
6143
|
//#region ../api/src/canvas/infrastructure/canvas-collection.mapper.ts
|
|
5214
6144
|
/** The wire's one field, into the three collection shapes the application names. */
|
|
@@ -5219,6 +6149,7 @@ const toCanvasCollection = (collection) => {
|
|
|
5219
6149
|
organisationId: collection
|
|
5220
6150
|
};
|
|
5221
6151
|
};
|
|
6152
|
+
|
|
5222
6153
|
//#endregion
|
|
5223
6154
|
//#region ../api/src/canvas/infrastructure/canvas-contract.mapper.ts
|
|
5224
6155
|
/**
|
|
@@ -5265,6 +6196,7 @@ const toCanvasCardContract = (view) => {
|
|
|
5265
6196
|
}
|
|
5266
6197
|
};
|
|
5267
6198
|
};
|
|
6199
|
+
|
|
5268
6200
|
//#endregion
|
|
5269
6201
|
//#region ../api/src/canvas/infrastructure/canvas-scene-node.mapper.ts
|
|
5270
6202
|
const toCanvasSceneNodeContract = (node) => canvasSceneNodeSchema.parse({
|
|
@@ -5283,6 +6215,7 @@ const toCanvasSceneNodeContract = (node) => canvasSceneNodeSchema.parse({
|
|
|
5283
6215
|
...node.props !== void 0 && { props: { ...node.props } },
|
|
5284
6216
|
...node.box !== void 0 && { box: { ...node.box } }
|
|
5285
6217
|
});
|
|
6218
|
+
|
|
5286
6219
|
//#endregion
|
|
5287
6220
|
//#region ../api/src/canvas/infrastructure/canvas.router.ts
|
|
5288
6221
|
const applyOperations = (handlers) => canvasCommenterProcedure.input(applyCanvasOperationsInputSchema).output(applyCanvasOperationsOutputSchema).mutation(async ({ input, ctx }) => {
|
|
@@ -5339,7 +6272,7 @@ const create$2 = (handlers) => personProcedure.input(createCanvasInputSchema).ou
|
|
|
5339
6272
|
sourceUrl: input.sourceUrl,
|
|
5340
6273
|
origin: ctx.viewer.kind === "agent" ? "agent" : "dashboard"
|
|
5341
6274
|
}))));
|
|
5342
|
-
const get$
|
|
6275
|
+
const get$2 = (handlers) => canvasReaderProcedure.input(getCanvasInputSchema).output(canvasSchema).query(async ({ input, ctx }) => {
|
|
5343
6276
|
const view = orThrow(await handlers.get.execute({
|
|
5344
6277
|
canvasId: input.canvasId,
|
|
5345
6278
|
reach: ctx.canvasAccess,
|
|
@@ -5381,7 +6314,7 @@ const createCanvasRouter = (handlers) => trpcRouter({
|
|
|
5381
6314
|
applyOperations: applyOperations(handlers),
|
|
5382
6315
|
createEditableFrame: createEditableFrame(handlers),
|
|
5383
6316
|
create: create$2(handlers),
|
|
5384
|
-
get: get$
|
|
6317
|
+
get: get$2(handlers),
|
|
5385
6318
|
setAccess: setAccess(handlers),
|
|
5386
6319
|
markViewed: markViewed(handlers),
|
|
5387
6320
|
list: personProcedure.input(listCanvasesInputSchema).output(listCanvasesOutputSchema).query(async ({ input, ctx }) => {
|
|
@@ -5411,6 +6344,7 @@ const createCanvasRouter = (handlers) => trpcRouter({
|
|
|
5411
6344
|
}));
|
|
5412
6345
|
})
|
|
5413
6346
|
});
|
|
6347
|
+
|
|
5414
6348
|
//#endregion
|
|
5415
6349
|
//#region ../api/src/canvas/infrastructure/canvas-document.router.ts
|
|
5416
6350
|
/**
|
|
@@ -5456,7 +6390,8 @@ const saveDocument = (handlers) => canvasCommenterProcedure.input(saveCanvasDocu
|
|
|
5456
6390
|
personId: ctx.viewer.personId,
|
|
5457
6391
|
baseVersion: input.baseVersion,
|
|
5458
6392
|
document: input.document,
|
|
5459
|
-
screenIds: input.screenIds
|
|
6393
|
+
screenIds: input.screenIds,
|
|
6394
|
+
actor: toCanvasMutationActor(ctx.viewer)
|
|
5460
6395
|
}));
|
|
5461
6396
|
if (result.outcome === "conflict") {
|
|
5462
6397
|
ctx.telemetry.emit("CanvasDocumentConflict", {
|
|
@@ -5479,6 +6414,7 @@ const createCanvasDocumentRouter = (handlers) => trpcRouter({
|
|
|
5479
6414
|
get: getDocument(handlers),
|
|
5480
6415
|
save: saveDocument(handlers)
|
|
5481
6416
|
});
|
|
6417
|
+
|
|
5482
6418
|
//#endregion
|
|
5483
6419
|
//#region ../api/src/canvas/infrastructure/canvas-image.router.ts
|
|
5484
6420
|
const createCanvasImageRouter = (handlers) => trpcRouter({ reserveImage: canvasCommenterProcedure.meta({ description: "Reserve storage and upload instructions for one canvas image." }).input(reserveCanvasImageInputSchema).output(reserveCanvasImageOutputSchema).mutation(async ({ input }) => {
|
|
@@ -5492,9 +6428,10 @@ const createCanvasImageRouter = (handlers) => trpcRouter({ reserveImage: canvasC
|
|
|
5492
6428
|
}
|
|
5493
6429
|
};
|
|
5494
6430
|
}) });
|
|
6431
|
+
|
|
5495
6432
|
//#endregion
|
|
5496
|
-
//#region
|
|
5497
|
-
var
|
|
6433
|
+
//#region ../../node_modules/.pnpm/neverthrow@8.2.0/node_modules/neverthrow/dist/index.cjs.js
|
|
6434
|
+
var require_index_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5498
6435
|
const defaultErrorConfig = { withStackTrace: false };
|
|
5499
6436
|
const createNeverThrowError = (message, result, config = defaultErrorConfig) => {
|
|
5500
6437
|
return {
|
|
@@ -5980,7 +6917,11 @@ var import_index_cjs = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5980
6917
|
exports.ok = ok;
|
|
5981
6918
|
exports.okAsync = okAsync;
|
|
5982
6919
|
exports.safeTry = safeTry;
|
|
5983
|
-
}))
|
|
6920
|
+
}));
|
|
6921
|
+
|
|
6922
|
+
//#endregion
|
|
6923
|
+
//#region ../api/src/canvas/infrastructure/canvas-inspection.mapper.ts
|
|
6924
|
+
var import_index_cjs = require_index_cjs();
|
|
5984
6925
|
const ROOT_NODE_ID$1 = "root";
|
|
5985
6926
|
const unionBounds = (boxes) => {
|
|
5986
6927
|
let union = null;
|
|
@@ -6069,8 +7010,7 @@ const worldBoxesOf = (document) => {
|
|
|
6069
7010
|
return boxes;
|
|
6070
7011
|
};
|
|
6071
7012
|
const toCanvasInspection = (value) => {
|
|
6072
|
-
const
|
|
6073
|
-
const parsed = canvasSceneDocumentSchema.safeParse(candidate);
|
|
7013
|
+
const parsed = canvasReadableSceneDocumentSchema.safeParse(value);
|
|
6074
7014
|
if (!parsed.success) return topologyFailure("its scene shape is invalid");
|
|
6075
7015
|
const topology = validateTopology(parsed.data);
|
|
6076
7016
|
if (topology.isErr()) return (0, import_index_cjs.err)(topology.error);
|
|
@@ -6096,6 +7036,7 @@ const toCanvasInspection = (value) => {
|
|
|
6096
7036
|
kinds
|
|
6097
7037
|
});
|
|
6098
7038
|
};
|
|
7039
|
+
|
|
6099
7040
|
//#endregion
|
|
6100
7041
|
//#region ../api/src/canvas/infrastructure/canvas-inspection.router.ts
|
|
6101
7042
|
const inspection = async (handlers, canvasId) => {
|
|
@@ -6105,20 +7046,22 @@ const inspection = async (handlers, canvasId) => {
|
|
|
6105
7046
|
projected: orThrow(toCanvasInspection(source.document).mapErr((message) => appError("INTERNAL", message)))
|
|
6106
7047
|
};
|
|
6107
7048
|
};
|
|
6108
|
-
const
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
7049
|
+
const inspect = (handlers, webOrigin) => agentCanvasReaderProcedure.input(inspectCanvasInputSchema).output(inspectCanvasOutputSchema).query(async ({ input }) => {
|
|
7050
|
+
const { source, projected } = await inspection(handlers, input.canvasId);
|
|
7051
|
+
return {
|
|
7052
|
+
canvasId: input.canvasId,
|
|
7053
|
+
openUrl: new URL(`/c/${input.canvasId}`, webOrigin).href,
|
|
7054
|
+
title: source.title,
|
|
7055
|
+
version: source.version,
|
|
7056
|
+
nodeCount: Math.max(0, projected.nodes.length - 1),
|
|
7057
|
+
rootChildCount: projected.children.get("root")?.length ?? 0,
|
|
7058
|
+
bounds: projected.bounds,
|
|
7059
|
+
kinds: projected.kinds,
|
|
7060
|
+
next: [`enhance canvas tree --canvas ${input.canvasId}`, `enhance canvas render --canvas ${input.canvasId} --expected-version ${String(source.version)}`]
|
|
7061
|
+
};
|
|
7062
|
+
});
|
|
7063
|
+
const createCanvasInspectionRouter = (handlers, webOrigin) => ({
|
|
7064
|
+
inspect: inspect(handlers, webOrigin),
|
|
6122
7065
|
tree: agentCanvasReaderProcedure.input(inspectCanvasTreeInputSchema).output(inspectCanvasTreeOutputSchema).query(async ({ input }) => {
|
|
6123
7066
|
const { source, projected } = await inspection(handlers, input.canvasId);
|
|
6124
7067
|
return {
|
|
@@ -6152,7 +7095,27 @@ const createCanvasInspectionRouter = (handlers) => ({
|
|
|
6152
7095
|
};
|
|
6153
7096
|
})
|
|
6154
7097
|
});
|
|
7098
|
+
|
|
7099
|
+
//#endregion
|
|
7100
|
+
//#region ../api/src/canvas/domain/units.consts.ts
|
|
7101
|
+
/**
|
|
7102
|
+
* The canvas domain's own factors. A duplicate of `shared/lib/units.consts.ts` by design:
|
|
7103
|
+
* `API_LAYER_MAY_SEE.domain` is `['domain']`, so the domain imports nothing at all — that is
|
|
7104
|
+
* what makes it testable with no framework, no clock and no database in the room.
|
|
7105
|
+
*/
|
|
7106
|
+
const MS_PER_SECOND$1 = 1e3;
|
|
7107
|
+
const SECONDS_PER_MINUTE$1 = 60;
|
|
7108
|
+
const MINUTES_PER_HOUR$1 = 60;
|
|
7109
|
+
const HOURS_PER_DAY$1 = 24;
|
|
7110
|
+
const MS_PER_DAY$1 = MS_PER_SECOND$1 * 60 * 60 * 24;
|
|
7111
|
+
const BYTES_PER_KIB$1 = 1024;
|
|
7112
|
+
const BYTES_PER_MIB$1 = BYTES_PER_KIB$1 * BYTES_PER_KIB$1;
|
|
7113
|
+
|
|
7114
|
+
//#endregion
|
|
7115
|
+
//#region ../api/src/canvas/domain/invite.entity.ts
|
|
7116
|
+
const LIFETIME_MS = 14 * MS_PER_DAY$1;
|
|
6155
7117
|
const isInviteExpired = (invite, at) => invite.expiresAt <= at;
|
|
7118
|
+
|
|
6156
7119
|
//#endregion
|
|
6157
7120
|
//#region ../api/src/canvas/infrastructure/invite-contract.mapper.ts
|
|
6158
7121
|
/** Domain to wire. `state` is derived: expired and pending get different answers in the dialog. */
|
|
@@ -6167,6 +7130,7 @@ const toInviteContract = (invite, at) => ({
|
|
|
6167
7130
|
deliveryState: invite.deliveryState,
|
|
6168
7131
|
deliveryError: invite.deliveryError ?? ""
|
|
6169
7132
|
});
|
|
7133
|
+
|
|
6170
7134
|
//#endregion
|
|
6171
7135
|
//#region ../api/src/canvas/infrastructure/canvas-invite.router.ts
|
|
6172
7136
|
const create$1 = (handlers, shouldExposeTokens) => canvasSharerProcedure.input(createInviteInputSchema).output(createInviteOutputSchema).mutation(async ({ input, ctx }) => {
|
|
@@ -6227,6 +7191,7 @@ const createCanvasInviteRouter = (handlers, shouldExposeTokens = false) => trpcR
|
|
|
6227
7191
|
};
|
|
6228
7192
|
})
|
|
6229
7193
|
});
|
|
7194
|
+
|
|
6230
7195
|
//#endregion
|
|
6231
7196
|
//#region ../api/src/canvas/infrastructure/canvas-lifecycle.router.ts
|
|
6232
7197
|
const remove$1 = (handlers) => personProcedure.input(deleteCanvasInputSchema).output(deleteCanvasOutputSchema).mutation(async ({ input, ctx }) => {
|
|
@@ -6264,6 +7229,7 @@ const createCanvasLifecycleRouter = (handlers) => trpcRouter({
|
|
|
6264
7229
|
personId: ctx.viewer.personId
|
|
6265
7230
|
})))
|
|
6266
7231
|
});
|
|
7232
|
+
|
|
6267
7233
|
//#endregion
|
|
6268
7234
|
//#region ../api/src/canvas/infrastructure/participant-contract.mapper.ts
|
|
6269
7235
|
/** Domain to wire. */
|
|
@@ -6278,6 +7244,7 @@ const toParticipantContract = (row) => ({
|
|
|
6278
7244
|
reviewState: row.reviewState,
|
|
6279
7245
|
lastViewedAt: row.lastViewedAt?.toISOString() ?? null
|
|
6280
7246
|
});
|
|
7247
|
+
|
|
6281
7248
|
//#endregion
|
|
6282
7249
|
//#region ../api/src/canvas/infrastructure/canvas-participant.router.ts
|
|
6283
7250
|
/**
|
|
@@ -6303,9 +7270,11 @@ const createCanvasParticipantRouter = (handlers) => trpcRouter({
|
|
|
6303
7270
|
}),
|
|
6304
7271
|
revoke: canvasOwnerProcedure.input(revokeParticipantInputSchema).output(revokeParticipantOutputSchema).mutation(async ({ input }) => orThrow(await handlers.revokeParticipant.execute(input)))
|
|
6305
7272
|
});
|
|
7273
|
+
|
|
6306
7274
|
//#endregion
|
|
6307
7275
|
//#region ../api/src/canvas/application/canvas-activity.use-case.ts
|
|
6308
7276
|
const CANVAS_ACTIVITY_RENEW_AFTER_MS = 15e3;
|
|
7277
|
+
|
|
6309
7278
|
//#endregion
|
|
6310
7279
|
//#region ../api/src/canvas/infrastructure/canvas-realtime.router.ts
|
|
6311
7280
|
const agentActor = (viewer) => {
|
|
@@ -6372,6 +7341,7 @@ const createCanvasRealtimeRouter = (handlers, endpoint) => trpcRouter({
|
|
|
6372
7341
|
}),
|
|
6373
7342
|
activity: createCanvasActivityRouter(handlers.activity)
|
|
6374
7343
|
});
|
|
7344
|
+
|
|
6375
7345
|
//#endregion
|
|
6376
7346
|
//#region ../api/src/canvas/infrastructure/canvas-selection.presenter.ts
|
|
6377
7347
|
const ROOT_NODE_ID = "root";
|
|
@@ -6423,6 +7393,7 @@ const toCanvasSelection = (canvasId, source, selection) => toCanvasInspection(so
|
|
|
6423
7393
|
next: nextCommands(canvasId, source.version, nodes.map((node) => node.id))
|
|
6424
7394
|
};
|
|
6425
7395
|
});
|
|
7396
|
+
|
|
6426
7397
|
//#endregion
|
|
6427
7398
|
//#region ../api/src/canvas/infrastructure/canvas-selection.router.ts
|
|
6428
7399
|
const createCanvasSelectionRoute = (selection, readCanvas) => agentCanvasReaderProcedure.input(readCanvasSelectionInputSchema).output(readCanvasSelectionOutputSchema).query(async ({ input, ctx }) => {
|
|
@@ -6433,6 +7404,7 @@ const createCanvasSelectionRoute = (selection, readCanvas) => agentCanvasReaderP
|
|
|
6433
7404
|
}), readCanvas.execute(input.canvasId)]);
|
|
6434
7405
|
return orThrow(toCanvasSelection(input.canvasId, orThrow(source), orThrow(heldSelection)).mapErr((message) => appError("INTERNAL", message)));
|
|
6435
7406
|
});
|
|
7407
|
+
|
|
6436
7408
|
//#endregion
|
|
6437
7409
|
//#region ../api/src/canvas/infrastructure/canvas-thumbnail.router.ts
|
|
6438
7410
|
const reportUnavailable = canvasReaderProcedure.input(reportCanvasThumbnailUnavailableInputSchema).output(reportCanvasThumbnailUnavailableOutputSchema).mutation(({ input, ctx }) => {
|
|
@@ -6447,10 +7419,189 @@ const reportUnavailable = canvasReaderProcedure.input(reportCanvasThumbnailUnava
|
|
|
6447
7419
|
return { recorded: true };
|
|
6448
7420
|
});
|
|
6449
7421
|
const createCanvasThumbnailRouter = () => trpcRouter({ reportUnavailable });
|
|
7422
|
+
|
|
7423
|
+
//#endregion
|
|
7424
|
+
//#region ../api/src/canvas/infrastructure/canvas-version-contract.mapper.ts
|
|
7425
|
+
const toCanvasVersionActor = (viewer) => viewer.kind === "agent" ? {
|
|
7426
|
+
kind: "agent",
|
|
7427
|
+
personId: viewer.personId,
|
|
7428
|
+
displayName: viewer.displayName,
|
|
7429
|
+
initials: viewer.initials,
|
|
7430
|
+
tokenLabel: viewer.tokenLabel ?? "Agent"
|
|
7431
|
+
} : {
|
|
7432
|
+
kind: "person",
|
|
7433
|
+
personId: viewer.personId,
|
|
7434
|
+
displayName: viewer.displayName,
|
|
7435
|
+
initials: viewer.initials
|
|
7436
|
+
};
|
|
7437
|
+
const toCanvasVersionContractEntry = (entry) => ({
|
|
7438
|
+
id: entry.id,
|
|
7439
|
+
canvasId: entry.canvasId,
|
|
7440
|
+
documentVersion: entry.documentVersion,
|
|
7441
|
+
origin: entry.origin,
|
|
7442
|
+
restoreRole: entry.restoreRole,
|
|
7443
|
+
retention: entry.retention,
|
|
7444
|
+
title: entry.title,
|
|
7445
|
+
description: entry.description,
|
|
7446
|
+
actor: entry.actor,
|
|
7447
|
+
sourceVersionEntryId: entry.sourceVersionEntryId,
|
|
7448
|
+
expiresAt: entry.expiresAt?.toISOString() ?? null,
|
|
7449
|
+
createdAt: entry.createdAt.toISOString(),
|
|
7450
|
+
updatedAt: entry.updatedAt.toISOString(),
|
|
7451
|
+
screenCount: entry.screenCount
|
|
7452
|
+
});
|
|
7453
|
+
const toCanvasVersionContractScreen = (screen) => ({
|
|
7454
|
+
screenId: screen.screenId,
|
|
7455
|
+
route: screen.route,
|
|
7456
|
+
title: screen.title,
|
|
7457
|
+
viewport: screen.viewport,
|
|
7458
|
+
atMs: screen.atMs,
|
|
7459
|
+
sourceRecordingId: screen.sourceRecordingId,
|
|
7460
|
+
assetBundle: screen.assetBundle === null ? null : {
|
|
7461
|
+
...screen.assetBundle,
|
|
7462
|
+
assets: [...screen.assetBundle.assets]
|
|
7463
|
+
},
|
|
7464
|
+
download: screen.download === null ? null : {
|
|
7465
|
+
url: screen.download.url,
|
|
7466
|
+
expiresAt: screen.download.expiresAt.toISOString(),
|
|
7467
|
+
bytes: screen.download.bytes
|
|
7468
|
+
}
|
|
7469
|
+
});
|
|
7470
|
+
|
|
7471
|
+
//#endregion
|
|
7472
|
+
//#region ../api/src/canvas/infrastructure/canvas-version.router.ts
|
|
7473
|
+
const requireHistoryReach = (context) => {
|
|
7474
|
+
if (!context.canSeeRoutes || context.viewerKind === "anonymous" || context.viewerKind === "render") throw toTrpcError(appError("NOT_FOUND", "no such canvas"));
|
|
7475
|
+
};
|
|
7476
|
+
const list$3 = (handlers) => canvasReaderProcedure.input(listCanvasVersionsInputSchema).output(listCanvasVersionsOutputSchema).query(async ({ input, ctx }) => {
|
|
7477
|
+
requireHistoryReach({
|
|
7478
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7479
|
+
viewerKind: ctx.viewer.kind
|
|
7480
|
+
});
|
|
7481
|
+
if (ctx.viewer.kind === "anonymous" || ctx.viewer.kind === "render") throw toTrpcError(appError("NOT_FOUND", "no such canvas"));
|
|
7482
|
+
const page = orThrow(await handlers.versions.list({
|
|
7483
|
+
...input,
|
|
7484
|
+
personId: ctx.viewer.personId
|
|
7485
|
+
}));
|
|
7486
|
+
ctx.telemetry.emit("CanvasVersionListServed", {
|
|
7487
|
+
entryCount: page.items.length,
|
|
7488
|
+
automaticIncluded: input.includeAutomatic ? 1 : 0,
|
|
7489
|
+
hasMore: page.nextCursor === null ? 0 : 1
|
|
7490
|
+
});
|
|
7491
|
+
return {
|
|
7492
|
+
current: {
|
|
7493
|
+
documentVersion: page.current.documentVersion,
|
|
7494
|
+
updatedAt: page.current.updatedAt.toISOString()
|
|
7495
|
+
},
|
|
7496
|
+
items: page.items.map((entry) => toCanvasVersionContractEntry(entry)),
|
|
7497
|
+
nextCursor: page.nextCursor,
|
|
7498
|
+
hasExpiredHistory: page.hasExpiredHistory
|
|
7499
|
+
};
|
|
7500
|
+
});
|
|
7501
|
+
const get$1 = (handlers) => canvasReaderProcedure.input(getCanvasVersionInputSchema).output(getCanvasVersionOutputSchema).query(async ({ input, ctx }) => {
|
|
7502
|
+
requireHistoryReach({
|
|
7503
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7504
|
+
viewerKind: ctx.viewer.kind
|
|
7505
|
+
});
|
|
7506
|
+
const result = orThrow(await handlers.versions.get({
|
|
7507
|
+
...input,
|
|
7508
|
+
withRoutes: ctx.canvasAccess.canSeeRoutes
|
|
7509
|
+
}));
|
|
7510
|
+
if (result.outcome === "corrupt") return {
|
|
7511
|
+
outcome: result.outcome,
|
|
7512
|
+
entry: toCanvasVersionContractEntry(result.entry)
|
|
7513
|
+
};
|
|
7514
|
+
return result.outcome === "ready" ? {
|
|
7515
|
+
outcome: "ready",
|
|
7516
|
+
entry: toCanvasVersionContractEntry(result.entry),
|
|
7517
|
+
document: result.document,
|
|
7518
|
+
screens: result.screens.map((screen) => toCanvasVersionContractScreen(screen))
|
|
7519
|
+
} : {
|
|
7520
|
+
outcome: "missing-resources",
|
|
7521
|
+
entry: toCanvasVersionContractEntry(result.entry),
|
|
7522
|
+
document: result.document,
|
|
7523
|
+
screens: result.screens.map((screen) => toCanvasVersionContractScreen(screen)),
|
|
7524
|
+
missingScreenIds: [...result.missingScreenIds]
|
|
7525
|
+
};
|
|
7526
|
+
});
|
|
7527
|
+
const name = (handlers) => canvasCommenterProcedure.input(nameCanvasVersionInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7528
|
+
requireHistoryReach({
|
|
7529
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7530
|
+
viewerKind: ctx.viewer.kind
|
|
7531
|
+
});
|
|
7532
|
+
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.name({
|
|
7533
|
+
...input,
|
|
7534
|
+
actor: toCanvasVersionActor(ctx.viewer),
|
|
7535
|
+
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
7536
|
+
}))) };
|
|
7537
|
+
});
|
|
7538
|
+
const updateMetadata = (handlers) => canvasCommenterProcedure.input(updateCanvasVersionMetadataInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7539
|
+
requireHistoryReach({
|
|
7540
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7541
|
+
viewerKind: ctx.viewer.kind
|
|
7542
|
+
});
|
|
7543
|
+
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.name({
|
|
7544
|
+
canvasId: input.canvasId,
|
|
7545
|
+
target: {
|
|
7546
|
+
kind: "version",
|
|
7547
|
+
versionId: input.versionId
|
|
7548
|
+
},
|
|
7549
|
+
title: input.title,
|
|
7550
|
+
description: input.description,
|
|
7551
|
+
actor: toCanvasVersionActor(ctx.viewer),
|
|
7552
|
+
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
7553
|
+
}))) };
|
|
7554
|
+
});
|
|
7555
|
+
const removeName = (handlers) => canvasCommenterProcedure.input(removeCanvasVersionNameInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7556
|
+
requireHistoryReach({
|
|
7557
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7558
|
+
viewerKind: ctx.viewer.kind
|
|
7559
|
+
});
|
|
7560
|
+
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.removeName({
|
|
7561
|
+
...input,
|
|
7562
|
+
requesterPersonId: ctx.viewer.personId,
|
|
7563
|
+
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
7564
|
+
}))) };
|
|
7565
|
+
});
|
|
7566
|
+
const restore = (handlers) => canvasCommenterProcedure.input(restoreCanvasVersionInputSchema).output(restoreCanvasVersionOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7567
|
+
requireHistoryReach({
|
|
7568
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7569
|
+
viewerKind: ctx.viewer.kind
|
|
7570
|
+
});
|
|
7571
|
+
if (ctx.viewer.kind !== "person") throw toTrpcError(appError("FORBIDDEN", "an agent cannot restore canvas history"));
|
|
7572
|
+
const restored = orThrow(await handlers.versions.restore({
|
|
7573
|
+
...input,
|
|
7574
|
+
actor: toCanvasVersionActor(ctx.viewer)
|
|
7575
|
+
}));
|
|
7576
|
+
ctx.telemetry.emit("CanvasVersionRestored", {
|
|
7577
|
+
documentVersion: restored.version,
|
|
7578
|
+
outcome: "restored"
|
|
7579
|
+
});
|
|
7580
|
+
return restored;
|
|
7581
|
+
});
|
|
7582
|
+
const duplicate = (handlers) => canvasOwnerProcedure.input(duplicateCanvasVersionInputSchema).output(duplicateCanvasVersionOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7583
|
+
if (ctx.viewer.kind !== "person") throw toTrpcError(appError("FORBIDDEN", "an agent cannot duplicate canvas history"));
|
|
7584
|
+
return orThrow(await handlers.versions.duplicate({
|
|
7585
|
+
...input,
|
|
7586
|
+
personId: ctx.viewer.personId,
|
|
7587
|
+
organisationId: input.organisationId === "personal" ? null : input.organisationId
|
|
7588
|
+
}));
|
|
7589
|
+
});
|
|
7590
|
+
const createCanvasVersionRouter = (handlers) => trpcRouter({
|
|
7591
|
+
list: list$3(handlers),
|
|
7592
|
+
get: get$1(handlers),
|
|
7593
|
+
name: name(handlers),
|
|
7594
|
+
updateMetadata: updateMetadata(handlers),
|
|
7595
|
+
removeName: removeName(handlers),
|
|
7596
|
+
restore: restore(handlers),
|
|
7597
|
+
duplicate: duplicate(handlers)
|
|
7598
|
+
});
|
|
7599
|
+
|
|
6450
7600
|
//#endregion
|
|
6451
7601
|
//#region ../api/src/canvas/domain/render-result.value-object.ts
|
|
6452
7602
|
const isRenderConversionResult = (result) => "rootNodeId" in result;
|
|
6453
7603
|
const isRenderOutputResult = (result) => "storageKey" in result;
|
|
7604
|
+
|
|
6454
7605
|
//#endregion
|
|
6455
7606
|
//#region ../api/src/canvas/infrastructure/render-job.presenter.ts
|
|
6456
7607
|
const wireResult = (job, result) => ({
|
|
@@ -6609,6 +7760,7 @@ const toCanvasConversionJob = (job) => {
|
|
|
6609
7760
|
};
|
|
6610
7761
|
return null;
|
|
6611
7762
|
};
|
|
7763
|
+
|
|
6612
7764
|
//#endregion
|
|
6613
7765
|
//#region ../api/src/canvas/infrastructure/render.router.ts
|
|
6614
7766
|
const actorOf = (viewer) => toAgentCanvasRequestActor(viewer) ?? orThrow((0, import_index_cjs.err)(appError("UNAUTHORIZED", "this call needs an agent token")));
|
|
@@ -6748,6 +7900,7 @@ const createRenderRouter = (handlers) => trpcRouter({
|
|
|
6748
7900
|
cancel: cancelRender(handlers),
|
|
6749
7901
|
download: downloadRender(handlers)
|
|
6750
7902
|
});
|
|
7903
|
+
|
|
6751
7904
|
//#endregion
|
|
6752
7905
|
//#region ../api/src/canvas/infrastructure/render-exposure.router.ts
|
|
6753
7906
|
const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderProcedure.input(exposeCanvasRenderInputSchema).output(exposeCanvasRenderOutputSchema).query(async ({ input, ctx }) => {
|
|
@@ -6781,6 +7934,7 @@ const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderPr
|
|
|
6781
7934
|
format: "png"
|
|
6782
7935
|
};
|
|
6783
7936
|
}) });
|
|
7937
|
+
|
|
6784
7938
|
//#endregion
|
|
6785
7939
|
//#region ../api/src/shared/lib/units.consts.ts
|
|
6786
7940
|
/**
|
|
@@ -6792,6 +7946,15 @@ const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderPr
|
|
|
6792
7946
|
* domain sees nothing outside itself, not even this. That is the enforced boundary, not drift.
|
|
6793
7947
|
*/
|
|
6794
7948
|
const MS_PER_SECOND = 1e3;
|
|
7949
|
+
const SECONDS_PER_MINUTE = 60;
|
|
7950
|
+
const MINUTES_PER_HOUR = 60;
|
|
7951
|
+
const HOURS_PER_DAY = 24;
|
|
7952
|
+
const MS_PER_MINUTE = MS_PER_SECOND * 60;
|
|
7953
|
+
const MS_PER_HOUR = MS_PER_MINUTE * 60;
|
|
7954
|
+
const MS_PER_DAY = MS_PER_HOUR * 24;
|
|
7955
|
+
const BYTES_PER_KIB = 1024;
|
|
7956
|
+
const BYTES_PER_MIB = BYTES_PER_KIB * BYTES_PER_KIB;
|
|
7957
|
+
|
|
6795
7958
|
//#endregion
|
|
6796
7959
|
//#region ../api/src/comment/infrastructure/comment-contract.mapper.ts
|
|
6797
7960
|
const bounded = (value) => Math.min(1, Math.max(0, value));
|
|
@@ -6896,6 +8059,7 @@ const toCommentThreadContract = (view, directory) => {
|
|
|
6896
8059
|
lastMessageAt: view.thread.lastMessageAt.toISOString()
|
|
6897
8060
|
};
|
|
6898
8061
|
};
|
|
8062
|
+
|
|
6899
8063
|
//#endregion
|
|
6900
8064
|
//#region ../api/src/comment/infrastructure/comment.router.ts
|
|
6901
8065
|
/**
|
|
@@ -7040,6 +8204,7 @@ const createCommentRouter = (handlers) => trpcRouter({
|
|
|
7040
8204
|
canManage: ctx.canvasAccess.canManage
|
|
7041
8205
|
})))
|
|
7042
8206
|
});
|
|
8207
|
+
|
|
7043
8208
|
//#endregion
|
|
7044
8209
|
//#region ../api/src/organisation/infrastructure/organisation.router.ts
|
|
7045
8210
|
/** Translates a transport call into a command or a query. No rules, no persistence. */
|
|
@@ -7061,6 +8226,7 @@ const createOrganisationRouter = (handlers) => trpcRouter({
|
|
|
7061
8226
|
personId: ctx.viewer.personId
|
|
7062
8227
|
})))
|
|
7063
8228
|
});
|
|
8229
|
+
|
|
7064
8230
|
//#endregion
|
|
7065
8231
|
//#region ../api/src/organisation/infrastructure/organisation-invite.router.ts
|
|
7066
8232
|
const inviteContract = (invite, at) => ({
|
|
@@ -7122,6 +8288,7 @@ const createOrganisationInviteRouter = (handlers) => trpcRouter({
|
|
|
7122
8288
|
preview: preview(handlers),
|
|
7123
8289
|
accept: accept(handlers)
|
|
7124
8290
|
});
|
|
8291
|
+
|
|
7125
8292
|
//#endregion
|
|
7126
8293
|
//#region ../api/src/organisation/infrastructure/organisation-people.router.ts
|
|
7127
8294
|
const list = (handlers) => personProcedure.input(listMembersInputSchema).output(listMembersOutputSchema).query(async ({ input, ctx }) => ({
|
|
@@ -7157,17 +8324,32 @@ const createOrganisationPeopleRouter = (handlers) => trpcRouter({
|
|
|
7157
8324
|
remove: remove(handlers),
|
|
7158
8325
|
transferOwnership: transferOwnership(handlers)
|
|
7159
8326
|
});
|
|
8327
|
+
|
|
8328
|
+
//#endregion
|
|
8329
|
+
//#region ../api/src/person/domain/prepared-canvas-id.domain-service.ts
|
|
8330
|
+
const UUID_PART_LIMIT = 5;
|
|
8331
|
+
const UUID_HEX_RADIX = 16;
|
|
8332
|
+
const UUID_FIRST_PART_WIDTH = 8;
|
|
8333
|
+
const PREPARED_CANVAS_MASK = 1162758195;
|
|
8334
|
+
/** A stable one-to-one canvas id lets a failed first-account request retry without duplicates. */
|
|
8335
|
+
const preparedCanvasIdFor = (personId) => {
|
|
8336
|
+
const [first = "", second = "", third = "", fourth = "", fifth = ""] = personId.split("-", UUID_PART_LIMIT);
|
|
8337
|
+
return `${((Number.parseInt(first, UUID_HEX_RADIX) ^ PREPARED_CANVAS_MASK) >>> 0).toString(UUID_HEX_RADIX).padStart(UUID_FIRST_PART_WIDTH, "0")}-${second}-5${third.slice(1)}-a${fourth.slice(1)}-${fifth}`;
|
|
8338
|
+
};
|
|
8339
|
+
|
|
7160
8340
|
//#endregion
|
|
7161
8341
|
//#region ../api/src/person/infrastructure/person-contract.mapper.ts
|
|
7162
8342
|
/** Domain to wire. `Date` becomes an ISO string here and nowhere else. */
|
|
7163
8343
|
const toPersonContract = (person) => ({
|
|
7164
8344
|
id: person.id,
|
|
8345
|
+
preparedCanvasId: preparedCanvasIdFor(person.id),
|
|
7165
8346
|
displayName: person.displayName,
|
|
7166
8347
|
initials: person.initials,
|
|
7167
8348
|
avatarUrl: person.avatarUrl,
|
|
7168
8349
|
email: person.email,
|
|
7169
8350
|
createdAt: person.createdAt.toISOString()
|
|
7170
8351
|
});
|
|
8352
|
+
|
|
7171
8353
|
//#endregion
|
|
7172
8354
|
//#region ../api/src/person/infrastructure/person.router.ts
|
|
7173
8355
|
const tokenOnWire = (token) => ({
|
|
@@ -7190,7 +8372,10 @@ const agentTokenRoutes = (handlers) => ({
|
|
|
7190
8372
|
agentToken: tokenOnWire(created.token)
|
|
7191
8373
|
};
|
|
7192
8374
|
}),
|
|
7193
|
-
listAgentTokens: personProcedure.meta({ description: "List agent credentials so unused or revoked ones can be identified." }).input(listAgentTokensInputSchema).output(listAgentTokensOutputSchema).query(async ({ ctx }) => ({
|
|
8375
|
+
listAgentTokens: personProcedure.meta({ description: "List agent credentials so unused or revoked ones can be identified." }).input(listAgentTokensInputSchema).output(listAgentTokensOutputSchema).query(async ({ ctx }) => ({
|
|
8376
|
+
isConnected: orThrow(await handlers.agentTokens.isConnected(ctx.viewer.personId)),
|
|
8377
|
+
items: orThrow(await handlers.agentTokens.list(ctx.viewer.personId)).map((token) => tokenOnWire(token))
|
|
8378
|
+
})),
|
|
7194
8379
|
revokeAgentToken: personProcedure.meta({ description: "Revoke an agent credential before its next request." }).input(revokeAgentTokenInputSchema).output(revokeAgentTokenOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7195
8380
|
return {
|
|
7196
8381
|
tokenId: orThrow(await handlers.agentTokens.revoke({
|
|
@@ -7258,11 +8443,12 @@ const recipientRoutes = (handlers) => trpcRouter({
|
|
|
7258
8443
|
});
|
|
7259
8444
|
const createPersonRouter = (handlers) => trpcRouter({
|
|
7260
8445
|
...agentTokenRoutes(handlers),
|
|
7261
|
-
signUp: baseProcedure.meta({ description: "Create a local account when no signed-in person exists." }).input(signUpInputSchema).output(
|
|
7262
|
-
const
|
|
7263
|
-
const token = ctx.session.issue(person.id, input.deliver);
|
|
8446
|
+
signUp: baseProcedure.meta({ description: "Create a local account when no signed-in person exists." }).input(signUpInputSchema).output(signUpOutputSchema).mutation(async ({ input, ctx }) => {
|
|
8447
|
+
const signedUp = orThrow(await handlers.signUp.execute(input));
|
|
8448
|
+
const token = ctx.session.issue(signedUp.person.id, input.deliver);
|
|
7264
8449
|
return {
|
|
7265
|
-
person: toPersonContract(person),
|
|
8450
|
+
person: toPersonContract(signedUp.person),
|
|
8451
|
+
preparedCanvasId: signedUp.preparedCanvasId,
|
|
7266
8452
|
token
|
|
7267
8453
|
};
|
|
7268
8454
|
}),
|
|
@@ -7285,6 +8471,7 @@ const createPersonRouter = (handlers) => trpcRouter({
|
|
|
7285
8471
|
}))) })),
|
|
7286
8472
|
recipients: recipientRoutes(handlers)
|
|
7287
8473
|
});
|
|
8474
|
+
|
|
7288
8475
|
//#endregion
|
|
7289
8476
|
//#region ../api/src/prototype/infrastructure/prototype-publisher.mapper.ts
|
|
7290
8477
|
const toAgentPrototypePublisher = (viewer) => {
|
|
@@ -7309,6 +8496,7 @@ const toPrototypePublisher = (viewer) => {
|
|
|
7309
8496
|
} }
|
|
7310
8497
|
};
|
|
7311
8498
|
};
|
|
8499
|
+
|
|
7312
8500
|
//#endregion
|
|
7313
8501
|
//#region ../api/src/prototype/infrastructure/prototype.router.ts
|
|
7314
8502
|
const agentPublisher = (viewer) => {
|
|
@@ -7480,6 +8668,7 @@ const createPrototypeRouter = (handlers) => trpcRouter({
|
|
|
7480
8668
|
complete: completeProcedure(handlers),
|
|
7481
8669
|
requestRuntimeTicket: runtimeTicketProcedure(handlers)
|
|
7482
8670
|
});
|
|
8671
|
+
|
|
7483
8672
|
//#endregion
|
|
7484
8673
|
//#region ../api/src/recording/infrastructure/recording.router.ts
|
|
7485
8674
|
const onWire$2 = (upload) => ({
|
|
@@ -7656,6 +8845,7 @@ const createRecordingRouter = (handlers) => trpcRouter({
|
|
|
7656
8845
|
}),
|
|
7657
8846
|
delete: canvasOwnerProcedure.input(deleteRecordingInputSchema).output(deleteRecordingOutputSchema).mutation(async ({ input }) => orThrow(await handlers.remove.execute(input)))
|
|
7658
8847
|
});
|
|
8848
|
+
|
|
7659
8849
|
//#endregion
|
|
7660
8850
|
//#region ../api/src/recording/infrastructure/recording-asset.router.ts
|
|
7661
8851
|
/** The same shape `recording.router.ts` puts a signed upload on the wire in. */
|
|
@@ -7703,6 +8893,7 @@ const createRecordingAssetRouter = (handlers) => trpcRouter({
|
|
|
7703
8893
|
reserve: reserveAssets(handlers),
|
|
7704
8894
|
confirm: confirmAssets(handlers)
|
|
7705
8895
|
});
|
|
8896
|
+
|
|
7706
8897
|
//#endregion
|
|
7707
8898
|
//#region ../api/src/recording/infrastructure/recording-repair.router.ts
|
|
7708
8899
|
const onWire = (upload) => ({
|
|
@@ -7730,7 +8921,14 @@ const recordingRepairRoutes = (handlers) => ({
|
|
|
7730
8921
|
refreshUpload: refreshUpload(handlers),
|
|
7731
8922
|
confirmUpload: confirmUpload(handlers)
|
|
7732
8923
|
});
|
|
7733
|
-
|
|
8924
|
+
|
|
8925
|
+
//#endregion
|
|
8926
|
+
//#region ../api/src/screen/domain/screen.consts.ts
|
|
8927
|
+
/** The direct-to-blob-store ceiling; API request bodies never carry these bytes. */
|
|
8928
|
+
const SCREEN_MEBIBYTES = 64;
|
|
8929
|
+
const BYTES_PER_MEBIBYTE = 1048576;
|
|
8930
|
+
const MAX_SCREEN_BYTES = 64 * BYTES_PER_MEBIBYTE;
|
|
8931
|
+
|
|
7734
8932
|
//#endregion
|
|
7735
8933
|
//#region ../api/src/screen/infrastructure/screen.router.ts
|
|
7736
8934
|
/**
|
|
@@ -7791,6 +8989,7 @@ const createScreenRouter = (handlers) => trpcRouter({
|
|
|
7791
8989
|
ownerPersonId: ctx.viewer.personId
|
|
7792
8990
|
})))
|
|
7793
8991
|
});
|
|
8992
|
+
|
|
7794
8993
|
//#endregion
|
|
7795
8994
|
//#region ../api/src/shared/observability/client-performance-telemetry.router.ts
|
|
7796
8995
|
const fieldsOf$1 = (input) => {
|
|
@@ -7818,6 +9017,7 @@ const clientPerformanceTelemetryRoute = () => baseProcedure.input(clientPerforma
|
|
|
7818
9017
|
else ctx.logger.info(fields, "event");
|
|
7819
9018
|
return { accepted: true };
|
|
7820
9019
|
});
|
|
9020
|
+
|
|
7821
9021
|
//#endregion
|
|
7822
9022
|
//#region ../api/src/shared/observability/extension-telemetry.router.ts
|
|
7823
9023
|
const isFailure = (input) => {
|
|
@@ -7855,6 +9055,7 @@ const createExtensionTelemetryRouter = () => trpcRouter({ lifecycle: baseProcedu
|
|
|
7855
9055
|
else ctx.logger.info(fields, "event");
|
|
7856
9056
|
return { accepted: true };
|
|
7857
9057
|
}) });
|
|
9058
|
+
|
|
7858
9059
|
//#endregion
|
|
7859
9060
|
//#region ../api/src/transcript/infrastructure/transcript.router.ts
|
|
7860
9061
|
const createTranscriptRouter = (handlers) => trpcRouter({
|
|
@@ -7864,11 +9065,13 @@ const createTranscriptRouter = (handlers) => trpcRouter({
|
|
|
7864
9065
|
}))),
|
|
7865
9066
|
retry: canvasOwnerProcedure.meta({ description: "Retry a failed transcription for one recording." }).input(retryTranscriptInputSchema).output(retryTranscriptOutputSchema).mutation(async ({ input }) => orThrow(await handlers.retry.execute(input)))
|
|
7866
9067
|
});
|
|
9068
|
+
|
|
7867
9069
|
//#endregion
|
|
7868
9070
|
//#region ../api/src/app.router.ts
|
|
7869
9071
|
const DEFAULT_ROUTER_OPTIONS = {
|
|
7870
9072
|
shouldExposeInviteTokens: false,
|
|
7871
|
-
realtimeEndpoint: "ws://localhost:3000/v1/canvas-realtime"
|
|
9073
|
+
realtimeEndpoint: "ws://localhost:3000/v1/canvas-realtime",
|
|
9074
|
+
webOrigin: "http://localhost:5173"
|
|
7872
9075
|
};
|
|
7873
9076
|
/**
|
|
7874
9077
|
* The one tRPC surface, assembled from each bounded context's router.
|
|
@@ -7882,10 +9085,11 @@ const createAppRouter = (handlers, options = DEFAULT_ROUTER_OPTIONS) => trpcRout
|
|
|
7882
9085
|
...createCanvasRouter(handlers.canvas)._def.record,
|
|
7883
9086
|
...createCanvasImageRouter(handlers.canvas)._def.record,
|
|
7884
9087
|
...createCanvasLifecycleRouter(handlers.canvas)._def.record,
|
|
7885
|
-
...createCanvasInspectionRouter(handlers.render),
|
|
9088
|
+
...createCanvasInspectionRouter(handlers.render, options.webOrigin),
|
|
7886
9089
|
selection: createCanvasSelectionRoute(handlers.canvas.selection, handlers.render.readCanvas),
|
|
7887
9090
|
realtime: createCanvasRealtimeRouter(handlers.canvas, options.realtimeEndpoint),
|
|
7888
9091
|
document: createCanvasDocumentRouter(handlers.canvas),
|
|
9092
|
+
version: createCanvasVersionRouter(handlers.canvas),
|
|
7889
9093
|
render: trpcRouter({
|
|
7890
9094
|
...createRenderRouter(handlers.render)._def.record,
|
|
7891
9095
|
...createRenderExposureRouter(handlers.render)._def.record
|
|
@@ -7914,6 +9118,7 @@ const createAppRouter = (handlers, options = DEFAULT_ROUTER_OPTIONS) => trpcRout
|
|
|
7914
9118
|
performance: clientPerformanceTelemetryRoute()
|
|
7915
9119
|
})
|
|
7916
9120
|
});
|
|
9121
|
+
|
|
7917
9122
|
//#endregion
|
|
7918
9123
|
//#region src/infrastructure/router-shape.adapter.ts
|
|
7919
9124
|
const unavailable = { execute: () => {
|
|
@@ -7952,6 +9157,14 @@ const handlers = {
|
|
|
7952
9157
|
markViewed: unavailable,
|
|
7953
9158
|
setReviewState: unavailable,
|
|
7954
9159
|
restore: unavailable,
|
|
9160
|
+
versions: {
|
|
9161
|
+
list: unavailable.execute,
|
|
9162
|
+
get: unavailable.execute,
|
|
9163
|
+
name: unavailable.execute,
|
|
9164
|
+
removeName: unavailable.execute,
|
|
9165
|
+
restore: unavailable.execute,
|
|
9166
|
+
duplicate: unavailable.execute
|
|
9167
|
+
},
|
|
7955
9168
|
getDocument: unavailable,
|
|
7956
9169
|
saveDocument: unavailable,
|
|
7957
9170
|
reserveImage: unavailable,
|
|
@@ -7994,6 +9207,7 @@ const handlers = {
|
|
|
7994
9207
|
create: () => unavailable.execute(),
|
|
7995
9208
|
list: () => unavailable.execute(),
|
|
7996
9209
|
find: () => unavailable.execute(),
|
|
9210
|
+
isConnected: () => unavailable.execute(),
|
|
7997
9211
|
revoke: () => unavailable.execute()
|
|
7998
9212
|
}
|
|
7999
9213
|
},
|
|
@@ -8054,6 +9268,7 @@ const handlers = {
|
|
|
8054
9268
|
}
|
|
8055
9269
|
};
|
|
8056
9270
|
const createRouterShapeAdapter = () => createAppRouter(handlers);
|
|
9271
|
+
|
|
8057
9272
|
//#endregion
|
|
8058
9273
|
//#region src/infrastructure/capability-catalog.adapter.ts
|
|
8059
9274
|
const jsonRecordSchema = z.record(z.string(), z.unknown());
|
|
@@ -8078,6 +9293,11 @@ const reflected = (value, key, label) => {
|
|
|
8078
9293
|
if (!(typeof value === "object" && value !== null || typeof value === "function")) throw new TypeError(`${label} is not reflectable`);
|
|
8079
9294
|
return Reflect.get(value, key);
|
|
8080
9295
|
};
|
|
9296
|
+
const effectFor = (id, operation) => {
|
|
9297
|
+
if (operation === "query") return "read";
|
|
9298
|
+
if (/(?:\.delete(?:Permanently)?|\.discard|\.remove(?:Name)?|\.revoke)$/u.test(id)) return "delete";
|
|
9299
|
+
return "write";
|
|
9300
|
+
};
|
|
8081
9301
|
const procedureSchemas = (definitions, id) => {
|
|
8082
9302
|
const internals = reflected(definitions[id], "_def", `${id} definition`);
|
|
8083
9303
|
const inputs = z.array(z.unknown()).safeParse(reflected(internals, "inputs", `${id} internals`));
|
|
@@ -8106,7 +9326,7 @@ const createCapabilityCatalogAdapter = () => {
|
|
|
8106
9326
|
id,
|
|
8107
9327
|
operation: parsed.type,
|
|
8108
9328
|
source: "router",
|
|
8109
|
-
effect: parsed.type
|
|
9329
|
+
effect: effectFor(id, parsed.type),
|
|
8110
9330
|
idempotency: parsed.type === "query" ? "none" : "single",
|
|
8111
9331
|
execution: {
|
|
8112
9332
|
kind: "remote",
|
|
@@ -8117,7 +9337,13 @@ const createCapabilityCatalogAdapter = () => {
|
|
|
8117
9337
|
meta: parsed.meta,
|
|
8118
9338
|
policy: procedurePolicy,
|
|
8119
9339
|
cliPath: procedurePolicy.exposure === "shared" ? id.replaceAll(".", " ") : null,
|
|
8120
|
-
...id === "canvas.render.importSource" && { inputExample: IMPORT_SOURCE_EXAMPLE }
|
|
9340
|
+
...id === "canvas.render.importSource" && { inputExample: IMPORT_SOURCE_EXAMPLE },
|
|
9341
|
+
...id === "canvas.document.save" && { inputExample: {
|
|
9342
|
+
canvasId: "00000000-0000-4000-8000-000000000010",
|
|
9343
|
+
baseVersion: 1,
|
|
9344
|
+
document: emptyCanvasSceneDocument(),
|
|
9345
|
+
screenIds: []
|
|
9346
|
+
} }
|
|
8121
9347
|
});
|
|
8122
9348
|
});
|
|
8123
9349
|
const productCapabilities = [...CANVAS_CAPABILITY_SPECS, ...COLLABORATION_CAPABILITY_SPECS].map((spec) => toCapabilityDefinition({
|
|
@@ -8140,6 +9366,7 @@ const createCapabilityCatalogAdapter = () => {
|
|
|
8140
9366
|
}));
|
|
8141
9367
|
return [...routerCapabilities, ...productCapabilities].toSorted((left, right) => left.id.localeCompare(right.id));
|
|
8142
9368
|
};
|
|
9369
|
+
|
|
8143
9370
|
//#endregion
|
|
8144
9371
|
//#region src/infrastructure/process-exit.error.ts
|
|
8145
9372
|
var ProcessExitError = class extends FailedToExitError {
|
|
@@ -8153,6 +9380,94 @@ var ProcessExitError = class extends FailedToExitError {
|
|
|
8153
9380
|
this.requestedCode = requestedCode;
|
|
8154
9381
|
}
|
|
8155
9382
|
};
|
|
9383
|
+
|
|
9384
|
+
//#endregion
|
|
9385
|
+
//#region src/infrastructure/mcp-capability-discovery.adapter.ts
|
|
9386
|
+
const EXACT_ID_SCORE = 1e4;
|
|
9387
|
+
const ID_PREFIX_SCORE = 1e3;
|
|
9388
|
+
const ID_SEGMENT_SCORE = 100;
|
|
9389
|
+
const ID_SUBSTRING_SCORE = 40;
|
|
9390
|
+
const GUIDE_MATCH_SCORE = 10;
|
|
9391
|
+
const NO_MATCH_SCORE = 0;
|
|
9392
|
+
const normalized = (value) => value.toLocaleLowerCase("en-AU").replaceAll(/[^a-z0-9]+/gu, " ").trim();
|
|
9393
|
+
const scoreFor = (capability, offered) => {
|
|
9394
|
+
const query = normalized(offered);
|
|
9395
|
+
const id = normalized(capability.id);
|
|
9396
|
+
if (query === id) return EXACT_ID_SCORE;
|
|
9397
|
+
const idSegments = new Set(id.split(" "));
|
|
9398
|
+
const guide = normalized([
|
|
9399
|
+
capability.guide.summary,
|
|
9400
|
+
capability.guide.useWhen,
|
|
9401
|
+
...capability.guide.preconditions,
|
|
9402
|
+
...capability.guide.input.map((field) => `${field.name} ${field.meaning}`),
|
|
9403
|
+
...capability.guide.output.map((field) => `${field.name} ${field.meaning}`),
|
|
9404
|
+
...capability.guide.next
|
|
9405
|
+
].join(" "));
|
|
9406
|
+
const terms = query.split(" ").filter((term) => term !== "");
|
|
9407
|
+
let score = id.startsWith(query) ? ID_PREFIX_SCORE : NO_MATCH_SCORE;
|
|
9408
|
+
for (const term of terms) {
|
|
9409
|
+
if (idSegments.has(term)) score += ID_SEGMENT_SCORE;
|
|
9410
|
+
else if (id.includes(term)) score += ID_SUBSTRING_SCORE;
|
|
9411
|
+
if (guide.includes(term)) score += GUIDE_MATCH_SCORE;
|
|
9412
|
+
}
|
|
9413
|
+
return score;
|
|
9414
|
+
};
|
|
9415
|
+
const exampleFor = (capability) => {
|
|
9416
|
+
const example = capability.guide.examples[0];
|
|
9417
|
+
if (example === void 0) throw new TypeError(`${capability.id} has no capability example`);
|
|
9418
|
+
return example;
|
|
9419
|
+
};
|
|
9420
|
+
const toContract = (capability) => ({
|
|
9421
|
+
id: capability.id,
|
|
9422
|
+
operation: capability.operation,
|
|
9423
|
+
effect: capability.effect,
|
|
9424
|
+
idempotency: capability.idempotency,
|
|
9425
|
+
summary: capability.guide.summary,
|
|
9426
|
+
useWhen: capability.guide.useWhen,
|
|
9427
|
+
preconditions: capability.guide.preconditions,
|
|
9428
|
+
inputSchema: z.toJSONSchema(capability.inputSchema, { unrepresentable: "any" }),
|
|
9429
|
+
exampleInput: exampleFor(capability).input,
|
|
9430
|
+
output: capability.guide.output,
|
|
9431
|
+
result: capability.guide.result,
|
|
9432
|
+
recovery: capability.guide.recovery,
|
|
9433
|
+
next: capability.guide.next,
|
|
9434
|
+
schemaDigest: capability.schemaDigest,
|
|
9435
|
+
guidanceDigest: capability.guidanceDigest,
|
|
9436
|
+
behaviorDigest: capability.behaviorDigest
|
|
9437
|
+
});
|
|
9438
|
+
const toBrief = (capability) => ({
|
|
9439
|
+
id: capability.id,
|
|
9440
|
+
operation: capability.operation,
|
|
9441
|
+
effect: capability.effect,
|
|
9442
|
+
summary: capability.guide.summary,
|
|
9443
|
+
useWhen: capability.guide.useWhen
|
|
9444
|
+
});
|
|
9445
|
+
const createMcpCapabilityDiscoveryAdapter = (catalog) => ({
|
|
9446
|
+
search: (input) => {
|
|
9447
|
+
const ranked = catalog.filter((capability) => input.operation === "any" || capability.operation === input.operation).map((capability) => ({
|
|
9448
|
+
capability,
|
|
9449
|
+
score: scoreFor(capability, input.query)
|
|
9450
|
+
})).filter((candidate) => candidate.score > NO_MATCH_SCORE).toSorted((left, right) => {
|
|
9451
|
+
const scoreDifference = right.score - left.score;
|
|
9452
|
+
return scoreDifference === NO_MATCH_SCORE ? left.capability.id.localeCompare(right.capability.id) : scoreDifference;
|
|
9453
|
+
});
|
|
9454
|
+
return {
|
|
9455
|
+
matches: ranked.slice(0, input.limit).map(({ capability }) => toBrief(capability)),
|
|
9456
|
+
totalMatches: ranked.length,
|
|
9457
|
+
truncated: ranked.length > input.limit
|
|
9458
|
+
};
|
|
9459
|
+
},
|
|
9460
|
+
describe: (id) => {
|
|
9461
|
+
const capability = catalog.find((candidate) => candidate.id === id);
|
|
9462
|
+
return capability === void 0 ? null : toContract(capability);
|
|
9463
|
+
}
|
|
9464
|
+
});
|
|
9465
|
+
|
|
9466
|
+
//#endregion
|
|
9467
|
+
//#region src/infrastructure/shared-capabilities.mapper.ts
|
|
9468
|
+
const toPresentedCapabilities = (catalog, exposures) => catalog.filter((capability) => exposures.includes(capability.policy.exposure));
|
|
9469
|
+
const toSharedCapabilities = (catalog) => toPresentedCapabilities(catalog, ["shared"]);
|
|
9470
|
+
|
|
8156
9471
|
//#endregion
|
|
8157
9472
|
//#region src/infrastructure/failure.mapper.ts
|
|
8158
9473
|
const MALFORMED_EXIT = 2;
|
|
@@ -8182,33 +9497,26 @@ const appErrorFrom = (error) => {
|
|
|
8182
9497
|
const parsed = trpcErrorSchema.safeParse(error);
|
|
8183
9498
|
return appErrorSchema.safeParse(parsed.success ? parsed.data.data.appError : null);
|
|
8184
9499
|
};
|
|
9500
|
+
const failureFields = (fields) => fields === void 0 ? {} : { fields: Object.entries(fields).toSorted(([left], [right]) => left.localeCompare(right)).map(([path, message]) => ({
|
|
9501
|
+
path,
|
|
9502
|
+
message
|
|
9503
|
+
})) };
|
|
8185
9504
|
const toFailurePayload = (error, parserMessage) => {
|
|
8186
|
-
if (error instanceof CliError) {
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
code: error.code,
|
|
8193
|
-
message: error.message,
|
|
8194
|
-
remediation: error.remediation,
|
|
8195
|
-
...fields !== void 0 && { fields }
|
|
8196
|
-
};
|
|
8197
|
-
}
|
|
9505
|
+
if (error instanceof CliError) return {
|
|
9506
|
+
code: error.code,
|
|
9507
|
+
message: error.message,
|
|
9508
|
+
remediation: error.remediation,
|
|
9509
|
+
...failureFields(error.fields)
|
|
9510
|
+
};
|
|
8198
9511
|
if (error instanceof TRPCClientError) {
|
|
9512
|
+
if (error.cause instanceof CliError) return toFailurePayload(error.cause, parserMessage);
|
|
8199
9513
|
const parsed = appErrorFrom(error);
|
|
8200
|
-
if (parsed.success) {
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
code: parsed.data.code,
|
|
8207
|
-
message: parsed.data.message,
|
|
8208
|
-
remediation: remediationFor(parsed.data.code),
|
|
8209
|
-
...fields !== void 0 && { fields }
|
|
8210
|
-
};
|
|
8211
|
-
}
|
|
9514
|
+
if (parsed.success) return {
|
|
9515
|
+
code: parsed.data.code,
|
|
9516
|
+
message: parsed.data.message,
|
|
9517
|
+
remediation: remediationFor(parsed.data.code),
|
|
9518
|
+
...failureFields(parsed.data.fields)
|
|
9519
|
+
};
|
|
8212
9520
|
}
|
|
8213
9521
|
if (error instanceof ProcessExitError) {
|
|
8214
9522
|
const message = parserMessage?.trim();
|
|
@@ -8232,5 +9540,32 @@ const toExitCode = (failure, isMalformed, error) => {
|
|
|
8232
9540
|
if (REFUSALS.has(failure.code)) return REFUSED_EXIT;
|
|
8233
9541
|
return 1;
|
|
8234
9542
|
};
|
|
9543
|
+
|
|
9544
|
+
//#endregion
|
|
9545
|
+
//#region src/infrastructure/cli-output-identity.lib.ts
|
|
9546
|
+
const commandReferencePattern = /(?<![-\w@])enhance(?=(?:-mcp)?(?:[^-\w]|$))/gu;
|
|
9547
|
+
const withCommandInText = (value, commandName) => value.replaceAll(commandReferencePattern, () => commandName);
|
|
9548
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9549
|
+
const withCommandInstruction = (value, commandName) => {
|
|
9550
|
+
if (typeof value === "string") return withCommandInText(value, commandName);
|
|
9551
|
+
if (Array.isArray(value)) return value.map((entry) => withCommandInstruction(entry, commandName));
|
|
9552
|
+
if (!isObject(value)) return value;
|
|
9553
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, withCommandInstruction(entry, commandName)]));
|
|
9554
|
+
};
|
|
9555
|
+
const withCommandName = (value, commandName) => {
|
|
9556
|
+
if (typeof value === "string") return withCommandInText(value, commandName);
|
|
9557
|
+
if (!isObject(value)) return value;
|
|
9558
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, key === "next" ? withCommandInstruction(entry, commandName) : entry]));
|
|
9559
|
+
};
|
|
9560
|
+
const withCommandInFailure = (value, commandName) => ({
|
|
9561
|
+
...value,
|
|
9562
|
+
message: withCommandInText(value.message, commandName),
|
|
9563
|
+
remediation: withCommandInText(value.remediation, commandName),
|
|
9564
|
+
...value.fields !== void 0 && { fields: value.fields.map((field) => ({
|
|
9565
|
+
...field,
|
|
9566
|
+
message: withCommandInText(field.message, commandName)
|
|
9567
|
+
})) }
|
|
9568
|
+
});
|
|
9569
|
+
|
|
8235
9570
|
//#endregion
|
|
8236
|
-
export {
|
|
9571
|
+
export { canvasLayoutWithoutCssProperties as $, startRecordingOutputSchema as A, getMeOutputSchema as B, CliError as C, createScreenOutputSchema as D, completeScreenOutputSchema as E, getPrototypeArtifactCapabilitiesOutputSchema as F, emptyFixtureDocument as G, cliAuthConfigurationSchema as H, getPrototypePublishStatusOutputSchema as I, canvasAgentActivityPhaseSchema as J, withFixtureScreen as K, prototypeArtifactManifestSchema as L, attachPrototypeArtifactOutputSchema as M, createPrototypeArtifactOutputSchema as N, appendRecordingChunkOutputSchema as O, foldPrototypeArtifactPath as P, canvasNodeStylePatchSchema as Q, prototypeArtifactPathSchema as R, PartialBatchError as S, appErrorSchema as T, createAgentTokenOutputSchema as U, MCP_AUTH_SCOPE as V, createOrganisationOutputSchema as W, applyCanvasOperationsOutputSchema as X, MAX_CANVAS_OPERATIONS as Y, canvasOperationSchema as Z, canvasWriteHtmlCapabilityInputSchema as _, canvasSchema as _t, toPresentedCapabilities as a, canvasWorldBoundsSchema as at, recordingSnapshotCapabilityInputSchema as b, ProcessExitError as c, downloadCanvasRenderOutputSchema as ct, createCapabilityPolicyAdapter as d, canvasAdditionalStyleSchema as dt, getCanvasDocumentOutputSchema as et, toCapabilityDefinition as f, canvasAuthoredLayoutValueOf as ft, canvasRenderCapabilityInputSchema as g, canvasLayoutPriorityDeclarations as gt, canvasApplyCapabilityInputSchema as h, canvasLayoutMainAxisOf as ht, toFailurePayload as i, RENDER_MIN_SCALE as it, PROTOTYPE_ARTIFACT_MANIFEST_PATH as j, completeRecordingOutputSchema as k, createCapabilityCatalogAdapter as l, getCanvasRenderOutputSchema as lt, PROCEDURE_DESCRIPTIONS as m, canvasAxisStyleProperties as mt, withCommandName as n, createCanvasConversionOutputSchema as nt, toSharedCapabilities as o, createCanvasRenderOutputSchema as ot, OPTION_DESCRIPTIONS as p, canvasAuthoredStyleDeclarations as pt, beginCanvasActivityOutputSchema as q, toExitCode as r, getCanvasConversionOutputSchema as rt, createMcpCapabilityDiscoveryAdapter as s, createRecordingSnapshotOutputSchema as st, withCommandInFailure as t, saveCanvasDocumentOutputSchema as tt, createRouterShapeAdapter as u, canvasReadableSceneDocumentSchema as ut, commentAttentionCapabilityInputSchema as v, transcriptOutputSchema as w, transcriptReadCapabilityInputSchema as x, prototypePublishCapabilityInputSchema as y, submitPrototypeArtifactOutputSchema as z };
|