@enhance-eng/enhance 0.1.6 → 0.1.7
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-BSUBcRJm.mjs} +960 -140
- package/dist/{file-credential.adapter-WNl4GM58.mjs → file-credential.adapter-rI5HpMEo.mjs} +3 -1
- package/dist/main.mjs +406 -334
- package/dist/mcp-invocation.adapter-Bn41hcLB.mjs +64 -0
- package/dist/mcp-main.mjs +159 -9
- package/dist/{mcp-server.adapter-T8UqHf6A.mjs → mcp-server.adapter-lxpsuDlU.mjs} +145 -144
- package/dist/mcp.mjs +5 -4
- package/dist/{mutation-key.adapter-B7Ss_464.mjs → mutation-key.adapter-EvvklGSw.mjs} +267 -26
- 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,13 @@ 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
|
+
|
|
178
212
|
//#endregion
|
|
179
213
|
//#region ../../packages/contract/src/canvas/canvas-limits.schema.ts
|
|
180
214
|
const MAX_CANVAS_VALUE = 1e5;
|
|
181
215
|
const boundedCanvasNumberSchema = z.number().min(-1e5).max(MAX_CANVAS_VALUE);
|
|
182
216
|
const nonNegativeCanvasNumberSchema = z.number().nonnegative().max(MAX_CANVAS_VALUE);
|
|
217
|
+
|
|
183
218
|
//#endregion
|
|
184
219
|
//#region ../../packages/contract/src/canvas/canvas-layout.schema.ts
|
|
185
220
|
const canvasParentSizeBoundSchema = z.object({
|
|
@@ -226,7 +261,8 @@ const canvasGridTrackSchema = z.object({
|
|
|
226
261
|
"center",
|
|
227
262
|
"end",
|
|
228
263
|
"stretch"
|
|
229
|
-
])
|
|
264
|
+
]),
|
|
265
|
+
minimum: nonNegativeCanvasNumberSchema.optional()
|
|
230
266
|
});
|
|
231
267
|
const canvasGridAutoRepeatSchema = z.object({
|
|
232
268
|
mode: z.enum(["auto-fill", "auto-fit"]),
|
|
@@ -267,6 +303,7 @@ const canvasFlexLayoutSchema = z.object({
|
|
|
267
303
|
wrap: z.enum(["nowrap", "wrap"]).optional(),
|
|
268
304
|
gridColumns: z.number().int().positive().max(MAX_CANVAS_VALUE).optional(),
|
|
269
305
|
gridAutoRepeat: canvasGridAutoRepeatSchema.optional(),
|
|
306
|
+
materialized: z.boolean().optional(),
|
|
270
307
|
padding: canvasFlexPaddingSchema
|
|
271
308
|
});
|
|
272
309
|
const canvasNodeLayoutSchema = z.object({
|
|
@@ -299,6 +336,7 @@ const canvasNodeLayoutSchema = z.object({
|
|
|
299
336
|
clipContent: z.boolean().optional(),
|
|
300
337
|
container: canvasFlexLayoutSchema.optional()
|
|
301
338
|
});
|
|
339
|
+
|
|
302
340
|
//#endregion
|
|
303
341
|
//#region ../../packages/contract/src/canvas/canvas-presentation.schema.ts
|
|
304
342
|
const MAX_ITEM_ID_LENGTH$1 = 200;
|
|
@@ -364,7 +402,8 @@ const canvasCornerRadiusSchema = z.object({
|
|
|
364
402
|
topLeft: nonNegativeNumber$1,
|
|
365
403
|
topRight: nonNegativeNumber$1,
|
|
366
404
|
bottomRight: nonNegativeNumber$1,
|
|
367
|
-
bottomLeft: nonNegativeNumber$1
|
|
405
|
+
bottomLeft: nonNegativeNumber$1,
|
|
406
|
+
smoothing: ratio.optional()
|
|
368
407
|
});
|
|
369
408
|
const canvasBorderSchema = z.object({
|
|
370
409
|
visible: z.boolean(),
|
|
@@ -445,7 +484,7 @@ const canvasFilterSchema = z.discriminatedUnion("kind", [
|
|
|
445
484
|
value: ratio
|
|
446
485
|
})
|
|
447
486
|
]);
|
|
448
|
-
const
|
|
487
|
+
const CANVAS_BLEND_MODES = [
|
|
449
488
|
"normal",
|
|
450
489
|
"multiply",
|
|
451
490
|
"screen",
|
|
@@ -463,8 +502,9 @@ const canvasBlendModeSchema = z.enum([
|
|
|
463
502
|
"saturation",
|
|
464
503
|
"color",
|
|
465
504
|
"luminosity"
|
|
466
|
-
]
|
|
467
|
-
z.
|
|
505
|
+
];
|
|
506
|
+
const canvasBlendModeSchema = z.enum(CANVAS_BLEND_MODES);
|
|
507
|
+
const canvasAppearanceSchema = z.object({
|
|
468
508
|
opacity: ratio,
|
|
469
509
|
blendMode: canvasBlendModeSchema,
|
|
470
510
|
fills: z.array(canvasPaintSchema).max(32),
|
|
@@ -510,10 +550,16 @@ const canvasAppearancePatchSchema = z.object({
|
|
|
510
550
|
backdropFilters: z.array(canvasFilterSchema).max(32).optional(),
|
|
511
551
|
clear: z.array(canvasAppearancePropertySchema).min(1).max(CANVAS_APPEARANCE_PROPERTIES.length).optional()
|
|
512
552
|
}).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");
|
|
553
|
+
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region ../../packages/contract/src/canvas/canvas-content-styles.schema.ts
|
|
556
|
+
const MAX_CANVAS_FONT_FAMILIES = 20;
|
|
513
557
|
const MAX_CANVAS_FONT_WEIGHT = 1e3;
|
|
514
558
|
const MAX_ITEM_ID_LENGTH = 200;
|
|
559
|
+
const MAX_CANVAS_FONT_FAMILY_LENGTH = 500;
|
|
515
560
|
const MAX_CANVAS_ADDITIONAL_STYLE_VALUE_LENGTH = 1e4;
|
|
516
|
-
const
|
|
561
|
+
const MAX_CANVAS_ADDITIONAL_STYLES = 128;
|
|
562
|
+
const boundedNumber = z.number().min(-MAX_CANVAS_VALUE).max(MAX_CANVAS_VALUE);
|
|
517
563
|
const nonNegativeNumber = z.number().nonnegative().max(MAX_CANVAS_VALUE);
|
|
518
564
|
const canvasTypographySchema = z.object({
|
|
519
565
|
family: z.string().min(1).max(500),
|
|
@@ -575,6 +621,10 @@ const canvasTypographySchema = z.object({
|
|
|
575
621
|
"pre-wrap",
|
|
576
622
|
"break-spaces"
|
|
577
623
|
]),
|
|
624
|
+
truncation: z.object({
|
|
625
|
+
mode: z.enum(["none", "ellipsis"]),
|
|
626
|
+
maxLines: z.number().int().min(1).max(MAX_CANVAS_VALUE).nullable()
|
|
627
|
+
}).optional(),
|
|
578
628
|
insets: z.object({
|
|
579
629
|
top: boundedNumber,
|
|
580
630
|
right: boundedNumber,
|
|
@@ -584,7 +634,7 @@ const canvasTypographySchema = z.object({
|
|
|
584
634
|
});
|
|
585
635
|
const unsafeStyleValue = /javascript|vbscript|data\s*:\s*text\/html|expression\s*\(|@import/iu;
|
|
586
636
|
const blockedStyleProperty = /^(?:behavior|-moz-binding)$/iu;
|
|
587
|
-
const canvasAdditionalStylePropertySchema = z.string().min(1).max(MAX_ITEM_ID_LENGTH).regex(/^(?:--[\w-]
|
|
637
|
+
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
638
|
const canvasAdditionalStyleValueSchema = z.string().max(MAX_CANVAS_ADDITIONAL_STYLE_VALUE_LENGTH).refine((value) => !unsafeStyleValue.test(value), "unsafe CSS value");
|
|
589
639
|
const canvasAdditionalStyleSchema = z.object({
|
|
590
640
|
id: z.string().min(1).max(MAX_ITEM_ID_LENGTH),
|
|
@@ -593,6 +643,7 @@ const canvasAdditionalStyleSchema = z.object({
|
|
|
593
643
|
enabled: z.boolean()
|
|
594
644
|
});
|
|
595
645
|
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");
|
|
646
|
+
|
|
596
647
|
//#endregion
|
|
597
648
|
//#region ../../packages/contract/src/canvas/canvas-scene.schema.ts
|
|
598
649
|
const MAX_SCENE_NODE_ID_LENGTH = 200;
|
|
@@ -661,10 +712,13 @@ const emptyCanvasSceneDocument = () => ({
|
|
|
661
712
|
relationships: {},
|
|
662
713
|
tombstones: {}
|
|
663
714
|
});
|
|
715
|
+
|
|
664
716
|
//#endregion
|
|
665
717
|
//#region ../../packages/contract/src/canvas/canvas-conversion-draft.schema.ts
|
|
666
718
|
const MAX_CANVAS_CONVERSION_NODES = 3e4;
|
|
667
719
|
const MAX_CANVAS_CONVERSION_SOURCE_NODES = 5e4;
|
|
720
|
+
const MAX_CANVAS_CONVERSION_ID_LENGTH = 200;
|
|
721
|
+
const MAX_CANVAS_CONVERSION_TEXT_LENGTH = 500;
|
|
668
722
|
const MAX_CANVAS_HTML_SOURCE_LENGTH = 262144;
|
|
669
723
|
const temporaryIdSchema = z.string().min(1).max(200);
|
|
670
724
|
const canvasConversionIssueSchema = z.object({
|
|
@@ -725,6 +779,7 @@ const createEditableFrameResultSchema = z.object({
|
|
|
725
779
|
boxes: z.record(z.string().min(1).max(200), canvasSceneBoxSchema),
|
|
726
780
|
affectedBounds: canvasSceneBoxSchema
|
|
727
781
|
});
|
|
782
|
+
|
|
728
783
|
//#endregion
|
|
729
784
|
//#region ../../packages/contract/src/shared/blob.schema.ts
|
|
730
785
|
/**
|
|
@@ -742,6 +797,7 @@ const signedDownloadSchema = z.object({
|
|
|
742
797
|
expiresAt: z.iso.datetime(),
|
|
743
798
|
bytes: z.number().int().min(0)
|
|
744
799
|
});
|
|
800
|
+
|
|
745
801
|
//#endregion
|
|
746
802
|
//#region ../../packages/contract/src/canvas/canvas-render.schema.ts
|
|
747
803
|
const RENDER_PHASES = [
|
|
@@ -791,6 +847,7 @@ const RENDER_WARNING_CODES = [
|
|
|
791
847
|
"SOURCE_FALLBACK",
|
|
792
848
|
"SCALE_REDUCED"
|
|
793
849
|
];
|
|
850
|
+
const RENDER_MAX_SCALE = 4;
|
|
794
851
|
const RENDER_MAX_OUTPUT_PIXELS = 16e6;
|
|
795
852
|
const RENDER_MAX_OUTPUT_MIB = 32;
|
|
796
853
|
const RENDER_MAX_SNAPSHOT_MIB = 64;
|
|
@@ -854,7 +911,7 @@ const createCanvasRenderInputSchema = z.object({
|
|
|
854
911
|
path: ["sourceState"]
|
|
855
912
|
});
|
|
856
913
|
const canvasRenderPhaseSchema = z.enum(RENDER_PHASES);
|
|
857
|
-
z.enum(RENDER_STATES);
|
|
914
|
+
const canvasRenderStateSchema = z.enum(RENDER_STATES);
|
|
858
915
|
const canvasRenderFailureReasonSchema = z.enum(RENDER_FAILURE_REASONS);
|
|
859
916
|
const canvasRenderWarningCodeSchema = z.enum(RENDER_WARNING_CODES);
|
|
860
917
|
const canvasRenderWarningSchema = z.object({
|
|
@@ -966,6 +1023,7 @@ const createRecordingSnapshotOutputSchema = z.object({
|
|
|
966
1023
|
job: canvasRenderJobSchema,
|
|
967
1024
|
alreadyExists: z.boolean()
|
|
968
1025
|
});
|
|
1026
|
+
|
|
969
1027
|
//#endregion
|
|
970
1028
|
//#region ../../packages/contract/src/canvas/canvas-conversion.schema.ts
|
|
971
1029
|
const MAX_CANVAS_ID_PREFIX_LENGTH = 80;
|
|
@@ -1067,7 +1125,7 @@ const getCanvasConversionInputSchema = z.object({ jobId: z.uuid() });
|
|
|
1067
1125
|
const getCanvasConversionOutputSchema = z.object({ job: canvasConversionJobSchema });
|
|
1068
1126
|
const cancelCanvasConversionInputSchema = z.object({ jobId: z.uuid() });
|
|
1069
1127
|
const cancelCanvasConversionOutputSchema = z.object({ job: canvasConversionJobSchema });
|
|
1070
|
-
z.discriminatedUnion("state", [
|
|
1128
|
+
const conversionRouteStateSchema = z.discriminatedUnion("state", [
|
|
1071
1129
|
z.object({
|
|
1072
1130
|
state: z.literal("loading"),
|
|
1073
1131
|
jobId: z.uuid()
|
|
@@ -1084,6 +1142,7 @@ z.discriminatedUnion("state", [
|
|
|
1084
1142
|
message: z.string().min(1).max(500)
|
|
1085
1143
|
})
|
|
1086
1144
|
]);
|
|
1145
|
+
|
|
1087
1146
|
//#endregion
|
|
1088
1147
|
//#region ../../packages/contract/src/canvas/canvas-document.schema.ts
|
|
1089
1148
|
/** More screens than one canvas has ever held, and a bound on one save's work. */
|
|
@@ -1146,16 +1205,24 @@ const saveCanvasDocumentOutputSchema = z.discriminatedUnion("outcome", [z.object
|
|
|
1146
1205
|
version: z.number().int().min(1),
|
|
1147
1206
|
document: canvasDocumentBlobSchema
|
|
1148
1207
|
})]);
|
|
1208
|
+
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region ../../packages/contract/src/canvas/canvas-image-asset.schema.ts
|
|
1211
|
+
const CANVAS_IMAGE_CONTENT_TYPES = [
|
|
1212
|
+
"image/avif",
|
|
1213
|
+
"image/gif",
|
|
1214
|
+
"image/jpeg",
|
|
1215
|
+
"image/png",
|
|
1216
|
+
"image/webp"
|
|
1217
|
+
];
|
|
1218
|
+
const BYTES_PER_KIBIBYTE = 1024;
|
|
1219
|
+
const KIBIBYTES_PER_MEBIBYTE = 1024;
|
|
1220
|
+
const MAX_CANVAS_IMAGE_MEBIBYTES = 20;
|
|
1221
|
+
const MAX_CANVAS_IMAGE_BYTES = MAX_CANVAS_IMAGE_MEBIBYTES * BYTES_PER_KIBIBYTE * KIBIBYTES_PER_MEBIBYTE;
|
|
1149
1222
|
const reserveCanvasImageInputSchema = z.object({
|
|
1150
1223
|
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)
|
|
1224
|
+
contentType: z.enum(CANVAS_IMAGE_CONTENT_TYPES),
|
|
1225
|
+
bytes: z.number().int().positive().max(MAX_CANVAS_IMAGE_BYTES)
|
|
1159
1226
|
});
|
|
1160
1227
|
const reserveCanvasImageOutputSchema = z.object({
|
|
1161
1228
|
assetId: z.uuid(),
|
|
@@ -1163,13 +1230,17 @@ const reserveCanvasImageOutputSchema = z.object({
|
|
|
1163
1230
|
upload: signedUploadSchema
|
|
1164
1231
|
});
|
|
1165
1232
|
const canvasImageAssetPath = (canvasId, assetId) => `/v1/canvas-assets/${encodeURIComponent(canvasId)}/${encodeURIComponent(assetId)}`;
|
|
1166
|
-
|
|
1233
|
+
|
|
1234
|
+
//#endregion
|
|
1235
|
+
//#region ../../packages/contract/src/canvas/canvas-property-section.schema.ts
|
|
1236
|
+
const CANVAS_PROPERTY_SECTIONS = [
|
|
1167
1237
|
"position",
|
|
1168
1238
|
"layout",
|
|
1169
1239
|
"clip",
|
|
1170
1240
|
"cornerRadius",
|
|
1171
1241
|
"blending",
|
|
1172
1242
|
"typography",
|
|
1243
|
+
"nativeControl",
|
|
1173
1244
|
"textDecoration",
|
|
1174
1245
|
"fill",
|
|
1175
1246
|
"outline",
|
|
@@ -1179,16 +1250,21 @@ const canvasPropertySectionSchema = z.enum([
|
|
|
1179
1250
|
"innerShadow",
|
|
1180
1251
|
"filters",
|
|
1181
1252
|
"additionalStyles",
|
|
1253
|
+
"vector",
|
|
1182
1254
|
"export",
|
|
1183
1255
|
"source"
|
|
1184
|
-
]
|
|
1256
|
+
];
|
|
1257
|
+
const canvasPropertySectionSchema = z.enum(CANVAS_PROPERTY_SECTIONS);
|
|
1258
|
+
|
|
1185
1259
|
//#endregion
|
|
1186
1260
|
//#region ../../packages/contract/src/canvas/canvas-inspection.schema.ts
|
|
1187
1261
|
const MAX_NODE_ID_LENGTH$4 = 200;
|
|
1262
|
+
const MAX_RENDER_MESSAGE_LENGTH = 500;
|
|
1263
|
+
const MAX_RENDER_KIND_LENGTH = 100;
|
|
1188
1264
|
const canvasInspectNodeSummarySchema = z.object({
|
|
1189
1265
|
id: z.string().min(1).max(MAX_NODE_ID_LENGTH$4),
|
|
1190
|
-
label: z.string().max(
|
|
1191
|
-
kind: z.string().min(1).max(
|
|
1266
|
+
label: z.string().max(MAX_RENDER_MESSAGE_LENGTH),
|
|
1267
|
+
kind: z.string().min(1).max(MAX_RENDER_KIND_LENGTH),
|
|
1192
1268
|
parentId: z.string().min(1).max(MAX_NODE_ID_LENGTH$4).nullable(),
|
|
1193
1269
|
childCount: z.number().int().min(0),
|
|
1194
1270
|
box: canvasWorldBoundsSchema.nullable(),
|
|
@@ -1229,14 +1305,17 @@ const inspectCanvasNodeOutputSchema = z.object({
|
|
|
1229
1305
|
}),
|
|
1230
1306
|
next: z.array(z.string().min(1))
|
|
1231
1307
|
});
|
|
1308
|
+
|
|
1232
1309
|
//#endregion
|
|
1233
1310
|
//#region ../../packages/contract/src/canvas/canvas-object-kind.lib.ts
|
|
1234
1311
|
const ROOT_KIND = "root";
|
|
1312
|
+
const PAGE_KIND = "page";
|
|
1235
1313
|
const SCREEN_KIND = "screen";
|
|
1236
1314
|
const FRAME_KIND = "frame";
|
|
1237
1315
|
const GROUP_KIND = "group";
|
|
1238
1316
|
const RECTANGLE_KIND = "rectangle";
|
|
1239
1317
|
const IMAGE_KIND = "image";
|
|
1318
|
+
const SVG_KIND = "svg";
|
|
1240
1319
|
const RECORDING_KIND = "recording";
|
|
1241
1320
|
const PROTOTYPE_KIND = "prototype";
|
|
1242
1321
|
const TEXT_KIND = "text";
|
|
@@ -1260,6 +1339,7 @@ const FRAME_PROPERTY_SECTIONS = [
|
|
|
1260
1339
|
"clip",
|
|
1261
1340
|
...SHAPE_PROPERTY_SECTIONS.filter((section) => section !== "position" && section !== "layout")
|
|
1262
1341
|
];
|
|
1342
|
+
const SVG_PROPERTY_SECTIONS = [...SHAPE_PROPERTY_SECTIONS, "vector"];
|
|
1263
1343
|
const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
1264
1344
|
{
|
|
1265
1345
|
objectKind: PROTOTYPE_KIND,
|
|
@@ -1292,6 +1372,18 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
1292
1372
|
selectionBehavior: { hitTarget: "children" },
|
|
1293
1373
|
propertySections: []
|
|
1294
1374
|
},
|
|
1375
|
+
{
|
|
1376
|
+
objectKind: PAGE_KIND,
|
|
1377
|
+
label: "Page",
|
|
1378
|
+
category: "container",
|
|
1379
|
+
capabilities: {
|
|
1380
|
+
canSelect: false,
|
|
1381
|
+
canContainChildren: false,
|
|
1382
|
+
canEditProperties: false
|
|
1383
|
+
},
|
|
1384
|
+
selectionBehavior: { hitTarget: "children" },
|
|
1385
|
+
propertySections: []
|
|
1386
|
+
},
|
|
1295
1387
|
{
|
|
1296
1388
|
objectKind: SCREEN_KIND,
|
|
1297
1389
|
label: "Screen",
|
|
@@ -1410,7 +1502,7 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
1410
1502
|
preservesAspect: true,
|
|
1411
1503
|
heightFollowsContent: false
|
|
1412
1504
|
},
|
|
1413
|
-
propertySections:
|
|
1505
|
+
propertySections: SVG_PROPERTY_SECTIONS
|
|
1414
1506
|
},
|
|
1415
1507
|
{
|
|
1416
1508
|
objectKind: RECORDING_KIND,
|
|
@@ -1450,6 +1542,7 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
1450
1542
|
"position",
|
|
1451
1543
|
"layout",
|
|
1452
1544
|
"typography",
|
|
1545
|
+
"nativeControl",
|
|
1453
1546
|
"textDecoration",
|
|
1454
1547
|
"textStroke",
|
|
1455
1548
|
"blending",
|
|
@@ -1463,8 +1556,19 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
1463
1556
|
].map((descriptor) => [descriptor.objectKind, descriptor]));
|
|
1464
1557
|
const canvasObjectKindDescriptor = (objectKind) => DESCRIPTOR_BY_KIND[objectKind] ?? null;
|
|
1465
1558
|
const canvasPropertySectionsForKind = (objectKind) => canvasObjectKindDescriptor(objectKind)?.propertySections ?? [];
|
|
1559
|
+
|
|
1466
1560
|
//#endregion
|
|
1467
1561
|
//#region ../../packages/contract/src/canvas/canvas-operation-styles.schema.ts
|
|
1562
|
+
const TEXT_SIZE_SMALL = 16;
|
|
1563
|
+
const TEXT_SIZE_MEDIUM = 24;
|
|
1564
|
+
const TEXT_SIZE_LARGE = 40;
|
|
1565
|
+
const TEXT_SIZE_HUGE = 64;
|
|
1566
|
+
const TEXT_SIZE_MEGA = 96;
|
|
1567
|
+
const MIN_LETTER_SPACING = -100;
|
|
1568
|
+
const MAX_LETTER_SPACING = 100;
|
|
1569
|
+
const MAX_LINE_HEIGHT = 1e4;
|
|
1570
|
+
const nonNegativePixelLengthSchema = z.string().regex(/^(?:\d+(?:\.\d+)?|\.\d+)px$/u);
|
|
1571
|
+
const signedPixelLengthSchema = z.string().regex(/^-?(?:\d+(?:\.\d+)?|\.\d+)px$/u);
|
|
1468
1572
|
const textStyleValues = {
|
|
1469
1573
|
color: z.union([z.enum([
|
|
1470
1574
|
"var(--note-ink)",
|
|
@@ -1480,11 +1584,11 @@ const textStyleValues = {
|
|
|
1480
1584
|
]), z.string().regex(/^#[\da-f]{6}$/iu)]),
|
|
1481
1585
|
"font-family": z.enum(["var(--sans)", "var(--mono)"]),
|
|
1482
1586
|
"font-size": z.union([
|
|
1483
|
-
z.literal(
|
|
1484
|
-
z.literal(
|
|
1485
|
-
z.literal(
|
|
1486
|
-
z.literal(
|
|
1487
|
-
z.literal(
|
|
1587
|
+
z.literal(TEXT_SIZE_SMALL),
|
|
1588
|
+
z.literal(TEXT_SIZE_MEDIUM),
|
|
1589
|
+
z.literal(TEXT_SIZE_LARGE),
|
|
1590
|
+
z.literal(TEXT_SIZE_HUGE),
|
|
1591
|
+
z.literal(TEXT_SIZE_MEGA)
|
|
1488
1592
|
]),
|
|
1489
1593
|
"font-weight": z.enum(["400", "700"]),
|
|
1490
1594
|
"font-style": z.enum([
|
|
@@ -1492,8 +1596,8 @@ const textStyleValues = {
|
|
|
1492
1596
|
"italic",
|
|
1493
1597
|
"oblique"
|
|
1494
1598
|
]),
|
|
1495
|
-
"letter-spacing": z.number().min(
|
|
1496
|
-
"line-height": z.union([z.number().positive().max(
|
|
1599
|
+
"letter-spacing": z.number().min(MIN_LETTER_SPACING).max(MAX_LETTER_SPACING),
|
|
1600
|
+
"line-height": z.union([z.number().positive().max(MAX_LINE_HEIGHT), z.string().regex(/^(?:\d+(?:\.\d+)?(?:px|em|rem|%)?|normal)$/u)]),
|
|
1497
1601
|
"text-align": z.enum([
|
|
1498
1602
|
"left",
|
|
1499
1603
|
"center",
|
|
@@ -1522,7 +1626,7 @@ const canvasTextStylesSchema = z.strictObject({
|
|
|
1522
1626
|
const canvasTextStylePatchSchema = z.strictObject({
|
|
1523
1627
|
color: textStyleValues.color.nullable().optional(),
|
|
1524
1628
|
"font-family": textStyleValues["font-family"].nullable().optional(),
|
|
1525
|
-
"font-size": nonNegativeCanvasNumberSchema.nullable().optional(),
|
|
1629
|
+
"font-size": z.union([nonNegativeCanvasNumberSchema, nonNegativePixelLengthSchema]).nullable().optional(),
|
|
1526
1630
|
"font-weight": z.string().regex(/^(?:[1-9]\d{0,2}|1000)$/u).nullable().optional(),
|
|
1527
1631
|
"font-style": textStyleValues["font-style"].nullable().optional(),
|
|
1528
1632
|
"font-stretch": z.union([z.enum([
|
|
@@ -1536,12 +1640,20 @@ const canvasTextStylePatchSchema = z.strictObject({
|
|
|
1536
1640
|
"extra-expanded",
|
|
1537
1641
|
"ultra-expanded"
|
|
1538
1642
|
]), z.string().regex(/^\d+(?:\.\d+)?%$/u)]).nullable().optional(),
|
|
1539
|
-
"letter-spacing": z.union([
|
|
1643
|
+
"letter-spacing": z.union([
|
|
1644
|
+
boundedCanvasNumberSchema,
|
|
1645
|
+
signedPixelLengthSchema,
|
|
1646
|
+
z.literal("normal")
|
|
1647
|
+
]).nullable().optional(),
|
|
1540
1648
|
"line-height": textStyleValues["line-height"].nullable().optional(),
|
|
1541
1649
|
"text-align": textStyleValues["text-align"].nullable().optional(),
|
|
1542
|
-
"text-indent": boundedCanvasNumberSchema.nullable().optional(),
|
|
1650
|
+
"text-indent": z.union([boundedCanvasNumberSchema, signedPixelLengthSchema]).nullable().optional(),
|
|
1543
1651
|
"white-space": textStyleValues["white-space"].nullable().optional(),
|
|
1544
|
-
"word-spacing": z.union([
|
|
1652
|
+
"word-spacing": z.union([
|
|
1653
|
+
boundedCanvasNumberSchema,
|
|
1654
|
+
signedPixelLengthSchema,
|
|
1655
|
+
z.literal("normal")
|
|
1656
|
+
]).nullable().optional()
|
|
1545
1657
|
});
|
|
1546
1658
|
const overflowStyleValue = z.enum([
|
|
1547
1659
|
"auto",
|
|
@@ -1550,24 +1662,48 @@ const overflowStyleValue = z.enum([
|
|
|
1550
1662
|
"scroll",
|
|
1551
1663
|
"visible"
|
|
1552
1664
|
]);
|
|
1665
|
+
const dimensionalStyleValue = z.union([z.string(), boundedCanvasNumberSchema]);
|
|
1553
1666
|
const canvasNodeStylePatchSchema = canvasTextStylePatchSchema.extend({
|
|
1554
1667
|
background: z.string().nullable().optional(),
|
|
1555
1668
|
"background-color": z.string().nullable().optional(),
|
|
1556
|
-
"border-radius":
|
|
1669
|
+
"border-bottom-left-radius": dimensionalStyleValue.optional(),
|
|
1670
|
+
"border-bottom-right-radius": dimensionalStyleValue.optional(),
|
|
1671
|
+
"border-bottom-width": dimensionalStyleValue.optional(),
|
|
1557
1672
|
"border-color": z.string().nullable().optional(),
|
|
1558
|
-
"border-width":
|
|
1673
|
+
"border-left-width": dimensionalStyleValue.optional(),
|
|
1674
|
+
"border-radius": dimensionalStyleValue.nullable().optional(),
|
|
1675
|
+
"border-right-width": dimensionalStyleValue.optional(),
|
|
1559
1676
|
"border-style": z.enum([
|
|
1560
1677
|
"none",
|
|
1561
1678
|
"solid",
|
|
1562
1679
|
"dashed",
|
|
1563
1680
|
"dotted"
|
|
1564
1681
|
]).nullable().optional(),
|
|
1682
|
+
"border-top-left-radius": dimensionalStyleValue.optional(),
|
|
1683
|
+
"border-top-right-radius": dimensionalStyleValue.optional(),
|
|
1684
|
+
"border-top-width": dimensionalStyleValue.optional(),
|
|
1685
|
+
"border-width": dimensionalStyleValue.nullable().optional(),
|
|
1565
1686
|
"box-shadow": z.string().nullable().optional(),
|
|
1687
|
+
"column-gap": dimensionalStyleValue.optional(),
|
|
1688
|
+
gap: dimensionalStyleValue.optional(),
|
|
1689
|
+
"margin-bottom": dimensionalStyleValue.optional(),
|
|
1690
|
+
"margin-left": dimensionalStyleValue.optional(),
|
|
1691
|
+
"margin-right": dimensionalStyleValue.optional(),
|
|
1692
|
+
"margin-top": dimensionalStyleValue.optional(),
|
|
1566
1693
|
opacity: z.union([z.string(), z.number()]).nullable().optional(),
|
|
1694
|
+
"outline-offset": dimensionalStyleValue.optional(),
|
|
1695
|
+
"outline-width": dimensionalStyleValue.optional(),
|
|
1567
1696
|
overflow: overflowStyleValue.nullable().optional(),
|
|
1568
1697
|
"overflow-x": overflowStyleValue.nullable().optional(),
|
|
1569
|
-
"overflow-y": overflowStyleValue.nullable().optional()
|
|
1570
|
-
|
|
1698
|
+
"overflow-y": overflowStyleValue.nullable().optional(),
|
|
1699
|
+
"padding-bottom": dimensionalStyleValue.optional(),
|
|
1700
|
+
"padding-left": dimensionalStyleValue.optional(),
|
|
1701
|
+
"padding-right": dimensionalStyleValue.optional(),
|
|
1702
|
+
"padding-top": dimensionalStyleValue.optional(),
|
|
1703
|
+
"row-gap": dimensionalStyleValue.optional(),
|
|
1704
|
+
"stroke-width": dimensionalStyleValue.optional()
|
|
1705
|
+
});
|
|
1706
|
+
|
|
1571
1707
|
//#endregion
|
|
1572
1708
|
//#region ../../packages/contract/src/canvas/canvas-operation.schema.ts
|
|
1573
1709
|
const convertedSubtreeRelationshipSchema = z.object({
|
|
@@ -1621,7 +1757,8 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
1621
1757
|
label: z.string().max(MAX_LABEL_LENGTH).default("Prototype"),
|
|
1622
1758
|
prototypeId: z.uuid(),
|
|
1623
1759
|
deploymentId: z.uuid(),
|
|
1624
|
-
box: writableBoxSchema
|
|
1760
|
+
box: writableBoxSchema,
|
|
1761
|
+
canvasPageId: nodeIdSchema$1.optional()
|
|
1625
1762
|
}),
|
|
1626
1763
|
z.object({
|
|
1627
1764
|
op: z.literal("setPrototypeDeployment"),
|
|
@@ -1726,6 +1863,7 @@ const createEditableFrameOutputSchema = createEditableFrameResultSchema.extend({
|
|
|
1726
1863
|
operation: insertConvertedSubtreeOperationSchema,
|
|
1727
1864
|
next: z.array(z.string().min(1))
|
|
1728
1865
|
});
|
|
1866
|
+
|
|
1729
1867
|
//#endregion
|
|
1730
1868
|
//#region ../../packages/contract/src/canvas/canvas-realtime.schema.ts
|
|
1731
1869
|
const CANVAS_REALTIME_PROTOCOL = "enhance3.canvas.v1";
|
|
@@ -1736,6 +1874,7 @@ const MAX_SELECTION_SIZE = 100;
|
|
|
1736
1874
|
const MAX_ACTIVITY_TARGETS = 100;
|
|
1737
1875
|
const MAX_REALTIME_TICKET_LENGTH = 4096;
|
|
1738
1876
|
const MAX_ERROR_MESSAGE_LENGTH = 200;
|
|
1877
|
+
const MAX_CURSOR_CHAT_LENGTH = 140;
|
|
1739
1878
|
const canvasActorColourSchema = z.enum([
|
|
1740
1879
|
"blue",
|
|
1741
1880
|
"violet",
|
|
@@ -1856,7 +1995,7 @@ const endCanvasActivityInputSchema = z.object({
|
|
|
1856
1995
|
activityId: z.uuid()
|
|
1857
1996
|
});
|
|
1858
1997
|
const endCanvasActivityOutputSchema = z.object({ ended: z.literal(true) });
|
|
1859
|
-
z.discriminatedUnion("type", [z.object({
|
|
1998
|
+
const canvasRealtimeClientEnvelopeSchema = z.discriminatedUnion("type", [z.object({
|
|
1860
1999
|
v: z.literal(1),
|
|
1861
2000
|
type: z.literal("presence.patch"),
|
|
1862
2001
|
seq: z.number().int().nonnegative(),
|
|
@@ -1871,7 +2010,7 @@ const serverEnvelopeBase = {
|
|
|
1871
2010
|
v: z.literal(1),
|
|
1872
2011
|
seq: z.number().int().nonnegative()
|
|
1873
2012
|
};
|
|
1874
|
-
z.discriminatedUnion("type", [
|
|
2013
|
+
const canvasRealtimeServerEnvelopeSchema = z.discriminatedUnion("type", [
|
|
1875
2014
|
z.object({
|
|
1876
2015
|
...serverEnvelopeBase,
|
|
1877
2016
|
type: z.literal("room.snapshot"),
|
|
@@ -1919,7 +2058,8 @@ z.discriminatedUnion("type", [
|
|
|
1919
2058
|
reason: z.enum([
|
|
1920
2059
|
"gap",
|
|
1921
2060
|
"relay",
|
|
1922
|
-
"replace"
|
|
2061
|
+
"replace",
|
|
2062
|
+
"history-restored"
|
|
1923
2063
|
])
|
|
1924
2064
|
})
|
|
1925
2065
|
}),
|
|
@@ -1947,6 +2087,7 @@ z.discriminatedUnion("type", [
|
|
|
1947
2087
|
})
|
|
1948
2088
|
})
|
|
1949
2089
|
]);
|
|
2090
|
+
|
|
1950
2091
|
//#endregion
|
|
1951
2092
|
//#region ../../packages/contract/src/canvas/canvas-render-exposure.schema.ts
|
|
1952
2093
|
const MAX_NODE_ID_LENGTH$1 = 200;
|
|
@@ -1978,6 +2119,7 @@ const exposeCanvasRenderOutputSchema = z.discriminatedUnion("purpose", [exposeCa
|
|
|
1978
2119
|
scale: z.literal(1),
|
|
1979
2120
|
format: z.literal("json")
|
|
1980
2121
|
})]);
|
|
2122
|
+
|
|
1981
2123
|
//#endregion
|
|
1982
2124
|
//#region ../../packages/contract/src/canvas/canvas-render-worker.schema.ts
|
|
1983
2125
|
const MIN_GRANT_TOKEN_LENGTH = 40;
|
|
@@ -1989,8 +2131,8 @@ const MAX_WORKER_MAC_LENGTH = 200;
|
|
|
1989
2131
|
const MAX_FAILURE_MESSAGE_LENGTH = 500;
|
|
1990
2132
|
const MAX_SOURCE_ID_LENGTH = 200;
|
|
1991
2133
|
const MAX_COOKIE_NAME_LENGTH = 100;
|
|
1992
|
-
z.object({ jobId: z.uuid() });
|
|
1993
|
-
z.object({ jobId: z.uuid() });
|
|
2134
|
+
const renderQueueMessageSchema = z.object({ jobId: z.uuid() });
|
|
2135
|
+
const claimRenderWorkInputSchema = z.object({ jobId: z.uuid() });
|
|
1994
2136
|
const claimRenderWorkBaseSchema = z.object({
|
|
1995
2137
|
jobId: z.uuid(),
|
|
1996
2138
|
canvasId: z.uuid(),
|
|
@@ -2000,7 +2142,7 @@ const claimRenderWorkBaseSchema = z.object({
|
|
|
2000
2142
|
renderUrl: z.url(),
|
|
2001
2143
|
releaseIdentity: z.string().min(1).max(100)
|
|
2002
2144
|
});
|
|
2003
|
-
z.discriminatedUnion("purpose", [claimRenderWorkBaseSchema.extend({
|
|
2145
|
+
const claimRenderWorkOutputSchema = z.discriminatedUnion("purpose", [claimRenderWorkBaseSchema.extend({
|
|
2004
2146
|
purpose: z.enum([
|
|
2005
2147
|
"inspection",
|
|
2006
2148
|
"snapshot",
|
|
@@ -2020,7 +2162,7 @@ z.discriminatedUnion("purpose", [claimRenderWorkBaseSchema.extend({
|
|
|
2020
2162
|
conversion: canvasConversionRequestSchema,
|
|
2021
2163
|
scale: z.literal(1)
|
|
2022
2164
|
})]);
|
|
2023
|
-
z.object({
|
|
2165
|
+
const completeRenderWorkInputSchema = z.object({
|
|
2024
2166
|
jobId: z.uuid(),
|
|
2025
2167
|
loadedVersion: z.number().int().positive(),
|
|
2026
2168
|
bounds: canvasWorldBoundsSchema,
|
|
@@ -2043,14 +2185,14 @@ z.object({
|
|
|
2043
2185
|
})
|
|
2044
2186
|
}).optional()
|
|
2045
2187
|
});
|
|
2046
|
-
z.object({ accepted: z.literal(true) });
|
|
2047
|
-
z.object({
|
|
2188
|
+
const completeRenderWorkOutputSchema = z.object({ accepted: z.literal(true) });
|
|
2189
|
+
const completeConversionWorkInputSchema = z.object({
|
|
2048
2190
|
jobId: z.uuid(),
|
|
2049
2191
|
loadedVersion: z.number().int().positive(),
|
|
2050
2192
|
draft: canvasSubtreeDraftSchema
|
|
2051
2193
|
});
|
|
2052
|
-
z.object({ accepted: z.literal(true) });
|
|
2053
|
-
z.object({
|
|
2194
|
+
const completeConversionWorkOutputSchema = z.object({ accepted: z.literal(true) });
|
|
2195
|
+
const renderRouteSnapshotSchema = z.object({
|
|
2054
2196
|
recordingId: z.uuid(),
|
|
2055
2197
|
requestedAtMs: z.number().int().nonnegative(),
|
|
2056
2198
|
settledAtMs: z.number().int().nonnegative(),
|
|
@@ -2062,15 +2204,15 @@ z.object({
|
|
|
2062
2204
|
height: z.number().int().positive()
|
|
2063
2205
|
})
|
|
2064
2206
|
});
|
|
2065
|
-
z.object({
|
|
2207
|
+
const failRenderWorkInputSchema = z.object({
|
|
2066
2208
|
jobId: z.uuid(),
|
|
2067
2209
|
failure: canvasRenderFailureSchema
|
|
2068
2210
|
});
|
|
2069
|
-
z.object({
|
|
2211
|
+
const failRenderWorkOutputSchema = z.object({
|
|
2070
2212
|
accepted: z.literal(true),
|
|
2071
2213
|
willRetry: z.boolean()
|
|
2072
2214
|
});
|
|
2073
|
-
z.object({
|
|
2215
|
+
const renderWorkerProofHeadersSchema = z.object({
|
|
2074
2216
|
workerId: z.string().regex(/^[\w.-]+$/u).min(1).max(MAX_WORKER_ID_LENGTH),
|
|
2075
2217
|
releaseIdentity: z.string().min(1).max(100),
|
|
2076
2218
|
timestamp: z.coerce.number().int().nonnegative(),
|
|
@@ -2108,7 +2250,7 @@ const renderRouteCaptureSchema = z.object({
|
|
|
2108
2250
|
height: z.number().int().positive(),
|
|
2109
2251
|
scale: z.number().positive()
|
|
2110
2252
|
});
|
|
2111
|
-
z.discriminatedUnion("state", [
|
|
2253
|
+
const renderRouteStateSchema = z.discriminatedUnion("state", [
|
|
2112
2254
|
renderRouteStateBaseSchema.extend({
|
|
2113
2255
|
state: z.literal("loading"),
|
|
2114
2256
|
capture: z.null(),
|
|
@@ -2133,6 +2275,7 @@ z.discriminatedUnion("state", [
|
|
|
2133
2275
|
capture: z.null()
|
|
2134
2276
|
})
|
|
2135
2277
|
]);
|
|
2278
|
+
|
|
2136
2279
|
//#endregion
|
|
2137
2280
|
//#region ../../packages/contract/src/canvas/canvas-selection.schema.ts
|
|
2138
2281
|
const MAX_SELECTION_COMMANDS = 12;
|
|
@@ -2156,6 +2299,138 @@ const readCanvasSelectionOutputSchema = z.object({
|
|
|
2156
2299
|
visibleWorldBox: canvasWorldBoundsSchema.nullable(),
|
|
2157
2300
|
next: z.array(z.string().min(1)).max(MAX_SELECTION_COMMANDS)
|
|
2158
2301
|
});
|
|
2302
|
+
|
|
2303
|
+
//#endregion
|
|
2304
|
+
//#region ../../packages/contract/src/canvas/canvas-version.schema.ts
|
|
2305
|
+
const CANVAS_VERSION_DESCRIPTION_MAX_LENGTH = 1e3;
|
|
2306
|
+
const CANVAS_VERSION_PAGE_MAX = 100;
|
|
2307
|
+
const CANVAS_VERSION_PAGE_DEFAULT = 50;
|
|
2308
|
+
const CANVAS_VERSION_CURSOR_MAX_LENGTH = 1e3;
|
|
2309
|
+
const canvasVersionActorSchema = z.discriminatedUnion("kind", [z.object({
|
|
2310
|
+
kind: z.literal("person"),
|
|
2311
|
+
personId: z.uuid(),
|
|
2312
|
+
displayName: z.string().min(1).max(200),
|
|
2313
|
+
initials: z.string().min(1).max(2)
|
|
2314
|
+
}), z.object({
|
|
2315
|
+
kind: z.literal("agent"),
|
|
2316
|
+
personId: z.uuid(),
|
|
2317
|
+
displayName: z.string().min(1).max(200),
|
|
2318
|
+
initials: z.string().min(1).max(2),
|
|
2319
|
+
tokenLabel: z.string().min(1).max(200)
|
|
2320
|
+
})]);
|
|
2321
|
+
const canvasVersionEntrySchema = z.object({
|
|
2322
|
+
id: z.uuid(),
|
|
2323
|
+
canvasId: z.uuid(),
|
|
2324
|
+
documentVersion: z.number().int().positive(),
|
|
2325
|
+
origin: z.enum([
|
|
2326
|
+
"automatic",
|
|
2327
|
+
"manual",
|
|
2328
|
+
"restore"
|
|
2329
|
+
]),
|
|
2330
|
+
restoreRole: z.enum(["before", "result"]).nullable(),
|
|
2331
|
+
retention: z.enum([
|
|
2332
|
+
"automatic",
|
|
2333
|
+
"named",
|
|
2334
|
+
"restore-boundary"
|
|
2335
|
+
]),
|
|
2336
|
+
title: z.string().min(1).max(200).nullable(),
|
|
2337
|
+
description: z.string().max(CANVAS_VERSION_DESCRIPTION_MAX_LENGTH).nullable(),
|
|
2338
|
+
actor: canvasVersionActorSchema,
|
|
2339
|
+
sourceVersionEntryId: z.uuid().nullable(),
|
|
2340
|
+
expiresAt: z.iso.datetime().nullable(),
|
|
2341
|
+
createdAt: z.iso.datetime(),
|
|
2342
|
+
updatedAt: z.iso.datetime(),
|
|
2343
|
+
screenCount: z.number().int().min(0)
|
|
2344
|
+
});
|
|
2345
|
+
const listCanvasVersionsInputSchema = z.object({
|
|
2346
|
+
canvasId: z.uuid(),
|
|
2347
|
+
limit: z.number().int().min(1).max(100).default(50),
|
|
2348
|
+
cursor: z.string().min(1).max(CANVAS_VERSION_CURSOR_MAX_LENGTH).optional(),
|
|
2349
|
+
includeAutomatic: z.boolean().default(false),
|
|
2350
|
+
actor: z.enum(["all", "mine"]).default("all")
|
|
2351
|
+
});
|
|
2352
|
+
const listCanvasVersionsOutputSchema = z.object({
|
|
2353
|
+
current: z.object({
|
|
2354
|
+
documentVersion: z.number().int().positive(),
|
|
2355
|
+
updatedAt: z.iso.datetime()
|
|
2356
|
+
}),
|
|
2357
|
+
items: z.array(canvasVersionEntrySchema),
|
|
2358
|
+
nextCursor: z.string().min(1).nullable(),
|
|
2359
|
+
hasExpiredHistory: z.boolean()
|
|
2360
|
+
});
|
|
2361
|
+
const getCanvasVersionInputSchema = z.object({
|
|
2362
|
+
canvasId: z.uuid(),
|
|
2363
|
+
versionId: z.uuid()
|
|
2364
|
+
});
|
|
2365
|
+
const canvasVersionReadySchema = z.object({
|
|
2366
|
+
outcome: z.literal("ready"),
|
|
2367
|
+
entry: canvasVersionEntrySchema,
|
|
2368
|
+
document: canvasDocumentBlobSchema,
|
|
2369
|
+
screens: z.array(documentScreenSchema)
|
|
2370
|
+
});
|
|
2371
|
+
const canvasVersionDegradedSchema = z.object({
|
|
2372
|
+
outcome: z.literal("missing-resources"),
|
|
2373
|
+
entry: canvasVersionEntrySchema,
|
|
2374
|
+
document: canvasDocumentBlobSchema,
|
|
2375
|
+
screens: z.array(documentScreenSchema),
|
|
2376
|
+
missingScreenIds: z.array(z.uuid()).min(1)
|
|
2377
|
+
});
|
|
2378
|
+
const getCanvasVersionOutputSchema = z.discriminatedUnion("outcome", [
|
|
2379
|
+
canvasVersionReadySchema,
|
|
2380
|
+
canvasVersionDegradedSchema,
|
|
2381
|
+
z.object({
|
|
2382
|
+
outcome: z.literal("corrupt"),
|
|
2383
|
+
entry: canvasVersionEntrySchema
|
|
2384
|
+
})
|
|
2385
|
+
]);
|
|
2386
|
+
const canvasVersionTargetSchema = z.discriminatedUnion("kind", [z.object({
|
|
2387
|
+
kind: z.literal("current"),
|
|
2388
|
+
expectedVersion: z.number().int().positive()
|
|
2389
|
+
}), z.object({
|
|
2390
|
+
kind: z.literal("version"),
|
|
2391
|
+
versionId: z.uuid()
|
|
2392
|
+
})]);
|
|
2393
|
+
const nameCanvasVersionInputSchema = z.object({
|
|
2394
|
+
canvasId: z.uuid(),
|
|
2395
|
+
target: canvasVersionTargetSchema,
|
|
2396
|
+
title: z.string().trim().min(1).max(200),
|
|
2397
|
+
description: z.string().trim().max(CANVAS_VERSION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
|
|
2398
|
+
});
|
|
2399
|
+
const updateCanvasVersionMetadataInputSchema = z.object({
|
|
2400
|
+
canvasId: z.uuid(),
|
|
2401
|
+
versionId: z.uuid(),
|
|
2402
|
+
title: z.string().trim().min(1).max(200),
|
|
2403
|
+
description: z.string().trim().max(CANVAS_VERSION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
|
|
2404
|
+
});
|
|
2405
|
+
const removeCanvasVersionNameInputSchema = z.object({
|
|
2406
|
+
canvasId: z.uuid(),
|
|
2407
|
+
versionId: z.uuid()
|
|
2408
|
+
});
|
|
2409
|
+
const canvasVersionMutationOutputSchema = z.object({ entry: canvasVersionEntrySchema });
|
|
2410
|
+
const restoreCanvasVersionInputSchema = z.object({
|
|
2411
|
+
canvasId: z.uuid(),
|
|
2412
|
+
versionId: z.uuid(),
|
|
2413
|
+
expectedVersion: z.number().int().positive()
|
|
2414
|
+
});
|
|
2415
|
+
const restoreCanvasVersionOutputSchema = z.object({
|
|
2416
|
+
canvasId: z.uuid(),
|
|
2417
|
+
version: z.number().int().positive(),
|
|
2418
|
+
beforeVersionId: z.uuid(),
|
|
2419
|
+
restoredVersionId: z.uuid(),
|
|
2420
|
+
restoreFenceVersion: z.number().int().positive()
|
|
2421
|
+
});
|
|
2422
|
+
const duplicateCanvasVersionInputSchema = z.object({
|
|
2423
|
+
canvasId: z.uuid(),
|
|
2424
|
+
versionId: z.uuid(),
|
|
2425
|
+
organisationId: z.union([z.uuid(), z.literal("personal")]),
|
|
2426
|
+
title: z.string().trim().min(1).max(200).optional()
|
|
2427
|
+
});
|
|
2428
|
+
const duplicateCanvasVersionOutputSchema = z.object({
|
|
2429
|
+
canvasId: z.uuid(),
|
|
2430
|
+
title: z.string().min(1).max(200),
|
|
2431
|
+
version: z.literal(1)
|
|
2432
|
+
});
|
|
2433
|
+
|
|
2159
2434
|
//#endregion
|
|
2160
2435
|
//#region ../../packages/contract/src/canvas/invite.schema.ts
|
|
2161
2436
|
const inviteSchema = z.object({
|
|
@@ -2210,6 +2485,7 @@ const acceptInviteOutputSchema = z.object({
|
|
|
2210
2485
|
canvasId: z.uuid(),
|
|
2211
2486
|
accessLevel: grantableAccessLevelSchema
|
|
2212
2487
|
});
|
|
2488
|
+
|
|
2213
2489
|
//#endregion
|
|
2214
2490
|
//#region ../../packages/contract/src/canvas/participant.schema.ts
|
|
2215
2491
|
/**
|
|
@@ -2262,6 +2538,7 @@ const setReviewStateInputSchema = z.object({
|
|
|
2262
2538
|
* read as stored and disagree with the next read.
|
|
2263
2539
|
*/
|
|
2264
2540
|
const setReviewStateOutputSchema = z.object({ reviewState: setReviewStateInputSchema.shape.reviewState.nullable() });
|
|
2541
|
+
|
|
2265
2542
|
//#endregion
|
|
2266
2543
|
//#region ../../packages/contract/src/comment/comment.schema.ts
|
|
2267
2544
|
/** How many replies a thread hands back in one go before `hasMoreMessages` takes over. */
|
|
@@ -2483,6 +2760,7 @@ const deleteCommentOutputSchema = z.object({
|
|
|
2483
2760
|
deletedThreadIds: z.array(z.uuid()),
|
|
2484
2761
|
deletedMessageIds: z.array(z.uuid())
|
|
2485
2762
|
});
|
|
2763
|
+
|
|
2486
2764
|
//#endregion
|
|
2487
2765
|
//#region ../../packages/contract/src/organisation/organisation.schema.ts
|
|
2488
2766
|
const organisationRoleSchema = z.enum([
|
|
@@ -2601,6 +2879,7 @@ const teamInvitePreviewSchema = z.object({
|
|
|
2601
2879
|
hasAccount: z.boolean()
|
|
2602
2880
|
});
|
|
2603
2881
|
const acceptTeamInviteOutputSchema = z.object({ organisationId: z.uuid() });
|
|
2882
|
+
|
|
2604
2883
|
//#endregion
|
|
2605
2884
|
//#region ../../packages/contract/src/person/agent-token.schema.ts
|
|
2606
2885
|
const agentTokenSchema = z.object({
|
|
@@ -2620,12 +2899,16 @@ const createAgentTokenOutputSchema = z.object({
|
|
|
2620
2899
|
agentToken: agentTokenSchema
|
|
2621
2900
|
});
|
|
2622
2901
|
const listAgentTokensInputSchema = z.object({});
|
|
2623
|
-
const listAgentTokensOutputSchema = z.object({
|
|
2902
|
+
const listAgentTokensOutputSchema = z.object({
|
|
2903
|
+
items: z.array(agentTokenSchema),
|
|
2904
|
+
isConnected: z.boolean()
|
|
2905
|
+
});
|
|
2624
2906
|
const revokeAgentTokenInputSchema = z.object({ tokenId: z.uuid() });
|
|
2625
2907
|
const revokeAgentTokenOutputSchema = z.object({
|
|
2626
2908
|
tokenId: z.uuid(),
|
|
2627
2909
|
revoked: z.literal(true)
|
|
2628
2910
|
});
|
|
2911
|
+
|
|
2629
2912
|
//#endregion
|
|
2630
2913
|
//#region ../../packages/contract/src/person/cli-auth.schema.ts
|
|
2631
2914
|
const CLI_AUTH_SCOPE = "openid";
|
|
@@ -2636,10 +2919,12 @@ const cliAuthConfigurationSchema = z.discriminatedUnion("method", [z.object({ me
|
|
|
2636
2919
|
clientId: z.string().min(1),
|
|
2637
2920
|
scope: z.literal(CLI_AUTH_SCOPE)
|
|
2638
2921
|
})]);
|
|
2922
|
+
|
|
2639
2923
|
//#endregion
|
|
2640
2924
|
//#region ../../packages/contract/src/person/person.schema.ts
|
|
2641
2925
|
const personSchema = z.object({
|
|
2642
2926
|
id: z.uuid(),
|
|
2927
|
+
preparedCanvasId: z.uuid(),
|
|
2643
2928
|
displayName: z.string().min(1).max(120),
|
|
2644
2929
|
initials: z.string().min(1).max(4),
|
|
2645
2930
|
avatarUrl: z.string().max(MAX_URL_LENGTH).nullable(),
|
|
@@ -2701,8 +2986,13 @@ const signInOutputSchema = z.object({
|
|
|
2701
2986
|
person: personSchema,
|
|
2702
2987
|
token: z.string().nullable()
|
|
2703
2988
|
});
|
|
2989
|
+
const signUpOutputSchema = signInOutputSchema.extend({ preparedCanvasId: z.uuid() });
|
|
2704
2990
|
const signOutInputSchema = z.object({});
|
|
2705
2991
|
const signOutOutputSchema = z.object({ signedOut: z.literal(true) });
|
|
2992
|
+
|
|
2993
|
+
//#endregion
|
|
2994
|
+
//#region ../../packages/contract/src/person/recipient.schema.ts
|
|
2995
|
+
const MAX_RECIPIENT_RESULTS = 5;
|
|
2706
2996
|
const recipientEmailSchema = z.string().max(254).pipe(z.email());
|
|
2707
2997
|
const recipientSchema = z.discriminatedUnion("kind", [z.object({
|
|
2708
2998
|
kind: z.literal("person"),
|
|
@@ -2718,6 +3008,7 @@ const searchRecipientsInputSchema = z.object({ query: z.string().trim().min(1).m
|
|
|
2718
3008
|
const searchRecipientsOutputSchema = z.object({ recipients: z.array(recipientSchema).max(5) });
|
|
2719
3009
|
const recentRecipientsInputSchema = z.object({});
|
|
2720
3010
|
const recentRecipientsOutputSchema = searchRecipientsOutputSchema.extend({});
|
|
3011
|
+
|
|
2721
3012
|
//#endregion
|
|
2722
3013
|
//#region ../../packages/contract/src/person/session-handoff.lib.ts
|
|
2723
3014
|
/**
|
|
@@ -2730,7 +3021,7 @@ const recentRecipientsOutputSchema = searchRecipientsOutputSchema.extend({});
|
|
|
2730
3021
|
* app. A different trust story wants a different door — see docs/features/auth.md.
|
|
2731
3022
|
*/
|
|
2732
3023
|
const SESSION_HANDOFF = "enhance3:session-handoff";
|
|
2733
|
-
z.union([z.object({
|
|
3024
|
+
const sessionHandoffSchema = z.union([z.object({
|
|
2734
3025
|
kind: z.literal(SESSION_HANDOFF),
|
|
2735
3026
|
body: z.object({
|
|
2736
3027
|
token: z.string().min(1),
|
|
@@ -2740,6 +3031,7 @@ z.union([z.object({
|
|
|
2740
3031
|
kind: z.literal(SESSION_HANDOFF),
|
|
2741
3032
|
signedOut: z.literal(true)
|
|
2742
3033
|
})]);
|
|
3034
|
+
|
|
2743
3035
|
//#endregion
|
|
2744
3036
|
//#region ../../packages/contract/src/prototype/prototype.schema.ts
|
|
2745
3037
|
const MAX_PROTOTYPE_FILES = 2e3;
|
|
@@ -2748,6 +3040,7 @@ const MAX_PROTOTYPE_FILE_MEBIBYTES = 25;
|
|
|
2748
3040
|
const MAX_PROTOTYPE_MEBIBYTES = 250;
|
|
2749
3041
|
const MAX_PROTOTYPE_FILE_BYTES = MAX_PROTOTYPE_FILE_MEBIBYTES * BYTES_PER_MEBIBYTE$1;
|
|
2750
3042
|
const MAX_PROTOTYPE_BYTES = MAX_PROTOTYPE_MEBIBYTES * BYTES_PER_MEBIBYTE$1;
|
|
3043
|
+
const PROTOTYPE_UPLOAD_PAGE_SIZE = 50;
|
|
2751
3044
|
const MAX_PROTOTYPE_PATH_LENGTH = 500;
|
|
2752
3045
|
const MAX_PROTOTYPE_CONTENT_TYPE_LENGTH = 200;
|
|
2753
3046
|
const MAX_PROTOTYPE_NODE_ID_LENGTH = 200;
|
|
@@ -2803,7 +3096,8 @@ const reservePrototypeUploadsOutputSchema = z.object({
|
|
|
2803
3096
|
const completePrototypeDeploymentInputSchema = z.object({
|
|
2804
3097
|
canvasId: z.uuid(),
|
|
2805
3098
|
deploymentId: z.uuid(),
|
|
2806
|
-
baseVersion: z.number().int().positive()
|
|
3099
|
+
baseVersion: z.number().int().positive(),
|
|
3100
|
+
canvasPageId: z.string().min(1).max(MAX_PROTOTYPE_NODE_ID_LENGTH).optional()
|
|
2807
3101
|
});
|
|
2808
3102
|
const completePrototypeDeploymentOutputSchema = z.object({
|
|
2809
3103
|
canvasId: z.uuid(),
|
|
@@ -2826,9 +3120,15 @@ const requestPrototypeRuntimeTicketOutputSchema = z.object({
|
|
|
2826
3120
|
bootUrl: z.url(),
|
|
2827
3121
|
expiresAt: z.iso.datetime()
|
|
2828
3122
|
});
|
|
3123
|
+
|
|
3124
|
+
//#endregion
|
|
3125
|
+
//#region ../../packages/contract/src/prototype/prototype-artifact.schema.ts
|
|
3126
|
+
const PROTOTYPE_ARTIFACT_PROTOCOL_VERSION = 1;
|
|
3127
|
+
const PROTOTYPE_ARTIFACT_FORMAT = "zip";
|
|
2829
3128
|
const PROTOTYPE_ARTIFACT_MANIFEST_PATH = "__enhance/manifest.json";
|
|
2830
3129
|
const SHA256_HEX_LENGTH = 64;
|
|
2831
3130
|
const CONTENT_TYPE_LENGTH = 200;
|
|
3131
|
+
const MAX_PROTOTYPE_ARTIFACT_NODE_ID_LENGTH = 200;
|
|
2832
3132
|
const LAST_C0_CONTROL = 31;
|
|
2833
3133
|
const DELETE_CONTROL = 127;
|
|
2834
3134
|
const sha256Schema = z.string().length(SHA256_HEX_LENGTH).refine((value) => {
|
|
@@ -2949,7 +3249,8 @@ const getPrototypePublishStatusOutputSchema = z.discriminatedUnion("state", [get
|
|
|
2949
3249
|
const attachPrototypeArtifactInputSchema = z.object({
|
|
2950
3250
|
canvasId: z.uuid(),
|
|
2951
3251
|
deploymentId: z.uuid(),
|
|
2952
|
-
baseVersion: z.number().int().positive()
|
|
3252
|
+
baseVersion: z.number().int().positive(),
|
|
3253
|
+
canvasPageId: z.string().min(1).max(MAX_PROTOTYPE_ARTIFACT_NODE_ID_LENGTH).optional()
|
|
2953
3254
|
});
|
|
2954
3255
|
const attachPrototypeArtifactOutputSchema = z.object({
|
|
2955
3256
|
canvasId: z.uuid(),
|
|
@@ -2961,25 +3262,44 @@ const attachPrototypeArtifactOutputSchema = z.object({
|
|
|
2961
3262
|
origin: z.url(),
|
|
2962
3263
|
openUrl: z.string().startsWith("/c/")
|
|
2963
3264
|
});
|
|
2964
|
-
|
|
3265
|
+
|
|
3266
|
+
//#endregion
|
|
3267
|
+
//#region ../../packages/contract/src/prototype/prototype-bridge.schema.ts
|
|
3268
|
+
const PROTOTYPE_BRIDGE_PROTOCOL = 1;
|
|
3269
|
+
const PROTOTYPE_VIEWPORT_ATTRIBUTE = "data-enhance-prototype-viewport";
|
|
3270
|
+
const PROTOTYPE_VIEWPORT_SELECTOR = `[${PROTOTYPE_VIEWPORT_ATTRIBUTE}]`;
|
|
3271
|
+
const prototypeBridgeCaptureRequestSchema = z.object({
|
|
2965
3272
|
protocol: z.literal(1),
|
|
2966
3273
|
type: z.literal("enhance.prototype.capture"),
|
|
2967
3274
|
requestId: z.uuid()
|
|
2968
3275
|
});
|
|
2969
|
-
z.object({
|
|
3276
|
+
const prototypeBridgeReadySchema = z.object({
|
|
2970
3277
|
protocol: z.literal(1),
|
|
2971
3278
|
type: z.literal("enhance.prototype.ready")
|
|
2972
3279
|
});
|
|
2973
|
-
z.object({
|
|
3280
|
+
const prototypeBridgeEscapeSchema = z.object({
|
|
2974
3281
|
protocol: z.literal(1),
|
|
2975
3282
|
type: z.literal("enhance.prototype.escape")
|
|
2976
3283
|
});
|
|
2977
|
-
z.object({
|
|
3284
|
+
const prototypeBridgeZoomSchema = z.object({
|
|
3285
|
+
protocol: z.literal(1),
|
|
3286
|
+
type: z.literal("enhance.prototype.zoom"),
|
|
3287
|
+
deltaX: z.number(),
|
|
3288
|
+
deltaY: z.number(),
|
|
3289
|
+
deltaMode: z.union([
|
|
3290
|
+
z.literal(0),
|
|
3291
|
+
z.literal(1),
|
|
3292
|
+
z.literal(2)
|
|
3293
|
+
]),
|
|
3294
|
+
anchorX: z.number().min(0).max(1),
|
|
3295
|
+
anchorY: z.number().min(0).max(1)
|
|
3296
|
+
});
|
|
3297
|
+
const prototypeBridgeNavigationRequestSchema = z.object({
|
|
2978
3298
|
protocol: z.literal(1),
|
|
2979
3299
|
type: z.literal("enhance.prototype.navigate"),
|
|
2980
3300
|
direction: z.enum(["back", "forward"])
|
|
2981
3301
|
});
|
|
2982
|
-
z.object({
|
|
3302
|
+
const prototypeBridgeNavigationStateSchema = z.object({
|
|
2983
3303
|
protocol: z.literal(1),
|
|
2984
3304
|
type: z.literal("enhance.prototype.navigation"),
|
|
2985
3305
|
canGoBack: z.boolean(),
|
|
@@ -2998,13 +3318,14 @@ const prototypeBridgeCaptureResponseBaseSchema = z.object({
|
|
|
2998
3318
|
type: z.literal("enhance.prototype.captured"),
|
|
2999
3319
|
requestId: z.uuid()
|
|
3000
3320
|
});
|
|
3001
|
-
z.discriminatedUnion("outcome", [prototypeBridgeCaptureResponseBaseSchema.extend({
|
|
3321
|
+
const prototypeBridgeCaptureResponseSchema = z.discriminatedUnion("outcome", [prototypeBridgeCaptureResponseBaseSchema.extend({
|
|
3002
3322
|
outcome: z.literal("captured"),
|
|
3003
3323
|
screen: capturedPrototypeScreenSchema
|
|
3004
3324
|
}), prototypeBridgeCaptureResponseBaseSchema.extend({
|
|
3005
3325
|
outcome: z.literal("failed"),
|
|
3006
3326
|
error: z.string().min(1)
|
|
3007
3327
|
})]);
|
|
3328
|
+
|
|
3008
3329
|
//#endregion
|
|
3009
3330
|
//#region ../../packages/contract/src/recording/inline-data-asset.lib.ts
|
|
3010
3331
|
const HASH_RADIX$1 = 16;
|
|
@@ -3012,7 +3333,32 @@ const FNV_OFFSET_BASIS = 2166136261;
|
|
|
3012
3333
|
const GOLDEN_RATIO_HASH = Number.parseInt("9e3779b9", HASH_RADIX$1);
|
|
3013
3334
|
const MURMUR_HASH_2 = Number.parseInt("85ebca6b", HASH_RADIX$1);
|
|
3014
3335
|
const MURMUR_HASH_3 = Number.parseInt("c2b2ae35", HASH_RADIX$1);
|
|
3015
|
-
|
|
3336
|
+
const HASH_SEEDS = [
|
|
3337
|
+
FNV_OFFSET_BASIS,
|
|
3338
|
+
FNV_OFFSET_BASIS ^ GOLDEN_RATIO_HASH,
|
|
3339
|
+
FNV_OFFSET_BASIS ^ MURMUR_HASH_2,
|
|
3340
|
+
FNV_OFFSET_BASIS ^ MURMUR_HASH_3
|
|
3341
|
+
];
|
|
3342
|
+
|
|
3343
|
+
//#endregion
|
|
3344
|
+
//#region ../../packages/contract/src/recording/recording-asset-reference.lib.ts
|
|
3345
|
+
const RECORDING_ASSET_PATH_PREFIX = "/v1/recording-assets/";
|
|
3346
|
+
/** A durable asset identity. The delivery behind it may issue fresh temporary storage access. */
|
|
3347
|
+
const recordingAssetPath = (assetBundleId, urlHash) => `${RECORDING_ASSET_PATH_PREFIX}${encodeURIComponent(assetBundleId)}/${encodeURIComponent(urlHash)}`;
|
|
3348
|
+
|
|
3349
|
+
//#endregion
|
|
3350
|
+
//#region ../../packages/contract/src/recording/popover-state.lib.ts
|
|
3351
|
+
/**
|
|
3352
|
+
* @justified docs/comments.md#clarification
|
|
3353
|
+
* Added to the serialised copy: native popover state has no corresponding HTML attribute.
|
|
3354
|
+
*/
|
|
3355
|
+
const OPEN_POPOVER_ATTRIBUTE = "data-enhance-popover-open";
|
|
3356
|
+
/**
|
|
3357
|
+
* @justified docs/comments.md#intent
|
|
3358
|
+
* A scriptless captured screen still draws the popover even though it cannot call showPopover.
|
|
3359
|
+
*/
|
|
3360
|
+
const OPEN_POPOVER_RULE = `[${OPEN_POPOVER_ATTRIBUTE}] { display: block !important; }`;
|
|
3361
|
+
|
|
3016
3362
|
//#endregion
|
|
3017
3363
|
//#region ../../packages/contract/src/recording/recording.schema.ts
|
|
3018
3364
|
const viewportSchema = z.object({
|
|
@@ -3287,13 +3633,10 @@ const deleteRecordingOutputSchema = z.object({
|
|
|
3287
3633
|
/** Screens survive with their provenance nulled. That is what makes iteration safe. */
|
|
3288
3634
|
detachedScreenCount: z.number().int().min(0)
|
|
3289
3635
|
});
|
|
3636
|
+
|
|
3290
3637
|
//#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"]) {
|
|
3638
|
+
//#region ../../packages/contract/src/recording/unsupported-surface-style.lib.ts
|
|
3639
|
+
const SURFACE_RULE = `[data-enhance-unsupported]:not([data-enhance-unsupported-hidden]):not([style*="display: none"]) {
|
|
3297
3640
|
align-items: center !important;
|
|
3298
3641
|
background-color: #f7f7f8 !important;
|
|
3299
3642
|
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 +3648,30 @@ const recordingAssetPath = (assetBundleId, urlHash) => `${RECORDING_ASSET_PATH_P
|
|
|
3305
3648
|
justify-content: center !important;
|
|
3306
3649
|
overflow: hidden !important;
|
|
3307
3650
|
text-align: center !important;
|
|
3308
|
-
}
|
|
3309
|
-
|
|
3651
|
+
}`;
|
|
3652
|
+
const HIDDEN_RULE = `[data-enhance-unsupported-hidden], [data-enhance-unsupported][style*="display: none"] {
|
|
3310
3653
|
display: none !important;
|
|
3311
|
-
}
|
|
3312
|
-
|
|
3654
|
+
}`;
|
|
3655
|
+
const LABEL_RULE = `[data-enhance-unsupported]::after {
|
|
3313
3656
|
background: #f7f7f8 !important;
|
|
3314
3657
|
content: attr(data-enhance-unsupported) !important;
|
|
3315
3658
|
padding: 4px 8px !important;
|
|
3316
|
-
}
|
|
3317
|
-
|
|
3659
|
+
}`;
|
|
3660
|
+
const FRAME_RULE = `iframe[data-enhance-unsupported="Embedded content not supported"] {
|
|
3318
3661
|
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
3662
|
background-position: center, center, center !important;
|
|
3320
3663
|
background-repeat: no-repeat !important;
|
|
3321
|
-
}
|
|
3322
|
-
|
|
3664
|
+
}`;
|
|
3665
|
+
/** One rule per entry because rrweb passes each entry to `CSSStyleSheet.insertRule`. */
|
|
3666
|
+
const UNSUPPORTED_SURFACE_RULES = [
|
|
3667
|
+
SURFACE_RULE,
|
|
3668
|
+
HIDDEN_RULE,
|
|
3669
|
+
LABEL_RULE,
|
|
3670
|
+
FRAME_RULE
|
|
3671
|
+
];
|
|
3672
|
+
/** Shared by standalone marked-page HTML, whose `<style>` element takes one stylesheet string. */
|
|
3673
|
+
const UNSUPPORTED_SURFACE_STYLE = UNSUPPORTED_SURFACE_RULES.join("\n");
|
|
3674
|
+
|
|
3323
3675
|
//#endregion
|
|
3324
3676
|
//#region ../../packages/contract/src/screen/screen.schema.ts
|
|
3325
3677
|
const createScreenInputSchema = z.object({
|
|
@@ -3363,16 +3715,24 @@ const deleteScreenOutputSchema = z.object({
|
|
|
3363
3715
|
/** Threads anchored to it go with it. Their canvases and their pins do not. */
|
|
3364
3716
|
deletedThreadCount: z.number().int().min(0)
|
|
3365
3717
|
});
|
|
3718
|
+
|
|
3719
|
+
//#endregion
|
|
3720
|
+
//#region ../../packages/contract/src/shared/app-error.error.ts
|
|
3721
|
+
/**
|
|
3722
|
+
* The one error shape that crosses the wire. The codes are a fixed union, so adding one
|
|
3723
|
+
* is a compile error at every `switch` that handles them.
|
|
3724
|
+
*/
|
|
3725
|
+
const APP_ERROR_CODES = [
|
|
3726
|
+
"BAD_REQUEST",
|
|
3727
|
+
"UNAUTHORIZED",
|
|
3728
|
+
"FORBIDDEN",
|
|
3729
|
+
"NOT_FOUND",
|
|
3730
|
+
"CONFLICT",
|
|
3731
|
+
"RATE_LIMITED",
|
|
3732
|
+
"INTERNAL"
|
|
3733
|
+
];
|
|
3366
3734
|
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
|
-
]),
|
|
3735
|
+
code: z.enum(APP_ERROR_CODES),
|
|
3376
3736
|
message: z.string().min(1),
|
|
3377
3737
|
/** Field-level detail, keyed by the input path that failed. */
|
|
3378
3738
|
fields: z.record(z.string(), z.string()).optional()
|
|
@@ -3386,6 +3746,7 @@ const appError$1 = (code, message, fields) => fields === void 0 ? {
|
|
|
3386
3746
|
message,
|
|
3387
3747
|
fields
|
|
3388
3748
|
};
|
|
3749
|
+
|
|
3389
3750
|
//#endregion
|
|
3390
3751
|
//#region ../../packages/contract/src/shared/client-performance.schema.ts
|
|
3391
3752
|
const MAX_CAPABILITY_VERSION$1 = 16;
|
|
@@ -3483,13 +3844,20 @@ const clientPerformanceInputSchema = z.discriminatedUnion("name", [
|
|
|
3483
3844
|
"snapshot",
|
|
3484
3845
|
"gap",
|
|
3485
3846
|
"replace",
|
|
3486
|
-
"relay"
|
|
3847
|
+
"relay",
|
|
3848
|
+
"history-restored"
|
|
3487
3849
|
]),
|
|
3488
3850
|
durationMs: durationSchema$1
|
|
3489
3851
|
})
|
|
3490
3852
|
]);
|
|
3491
3853
|
const clientPerformanceOutputSchema = z.object({ accepted: z.literal(true) });
|
|
3492
|
-
|
|
3854
|
+
|
|
3855
|
+
//#endregion
|
|
3856
|
+
//#region ../../packages/contract/src/shared/extension-bridge.schema.ts
|
|
3857
|
+
const EXTENSION_BRIDGE_PROBE = "enhance3:extension-probe";
|
|
3858
|
+
const EXTENSION_BRIDGE_PRESENT = "enhance3:extension-present";
|
|
3859
|
+
const extensionBridgeSchema = z.discriminatedUnion("type", [z.object({ type: z.literal(EXTENSION_BRIDGE_PROBE) }).strict(), z.object({ type: z.literal(EXTENSION_BRIDGE_PRESENT) }).strict()]);
|
|
3860
|
+
|
|
3493
3861
|
//#endregion
|
|
3494
3862
|
//#region ../../packages/contract/src/shared/extension-telemetry.schema.ts
|
|
3495
3863
|
const MAX_CAPABILITY_VERSION = 16;
|
|
@@ -3691,6 +4059,7 @@ const extensionTelemetryInputSchema = z.discriminatedUnion("name", [
|
|
|
3691
4059
|
})
|
|
3692
4060
|
]);
|
|
3693
4061
|
const extensionTelemetryOutputSchema = z.object({ accepted: z.literal(true) });
|
|
4062
|
+
|
|
3694
4063
|
//#endregion
|
|
3695
4064
|
//#region ../../packages/contract/src/transcript/transcript.schema.ts
|
|
3696
4065
|
const transcriptScopeSchema = z.object({
|
|
@@ -3736,6 +4105,7 @@ const transcriptOutputSchema = z.discriminatedUnion("state", [
|
|
|
3736
4105
|
]);
|
|
3737
4106
|
const retryTranscriptInputSchema = transcriptScopeSchema;
|
|
3738
4107
|
const retryTranscriptOutputSchema = processingTranscriptSchema;
|
|
4108
|
+
|
|
3739
4109
|
//#endregion
|
|
3740
4110
|
//#region src/application/cli.error.ts
|
|
3741
4111
|
var CliError = class extends Error {
|
|
@@ -3750,6 +4120,7 @@ var CliError = class extends Error {
|
|
|
3750
4120
|
this.fields = fields;
|
|
3751
4121
|
}
|
|
3752
4122
|
};
|
|
4123
|
+
|
|
3753
4124
|
//#endregion
|
|
3754
4125
|
//#region src/application/partial-batch.error.ts
|
|
3755
4126
|
var PartialBatchError = class extends CliError {
|
|
@@ -3758,9 +4129,11 @@ var PartialBatchError = class extends CliError {
|
|
|
3758
4129
|
this.name = "PartialBatchError";
|
|
3759
4130
|
}
|
|
3760
4131
|
};
|
|
4132
|
+
|
|
3761
4133
|
//#endregion
|
|
3762
4134
|
//#region src/application/capability-example.consts.ts
|
|
3763
4135
|
const CAPABILITY_UUID_EXAMPLE = "00000000-0000-4000-8000-000000000010";
|
|
4136
|
+
|
|
3764
4137
|
//#endregion
|
|
3765
4138
|
//#region src/infrastructure/product-capability.schema.ts
|
|
3766
4139
|
const MIN_RENDER_SCALE = .1;
|
|
@@ -3817,6 +4190,7 @@ const transcriptReadCapabilityInputSchema = z.object({
|
|
|
3817
4190
|
canvasId: z.uuid(),
|
|
3818
4191
|
recordingId: z.uuid()
|
|
3819
4192
|
});
|
|
4193
|
+
|
|
3820
4194
|
//#endregion
|
|
3821
4195
|
//#region src/infrastructure/canvas-capability.consts.ts
|
|
3822
4196
|
const CANVAS_CAPABILITY_SPECS = [
|
|
@@ -3960,6 +4334,7 @@ const CANVAS_CAPABILITY_SPECS = [
|
|
|
3960
4334
|
}
|
|
3961
4335
|
}
|
|
3962
4336
|
];
|
|
4337
|
+
|
|
3963
4338
|
//#endregion
|
|
3964
4339
|
//#region src/infrastructure/capability-example.mapper.ts
|
|
3965
4340
|
const jsonRecordSchema$2 = z.record(z.string(), z.unknown());
|
|
@@ -4013,9 +4388,30 @@ const toCapabilityExample = (schemaValue) => {
|
|
|
4013
4388
|
}
|
|
4014
4389
|
return objectExample(schema);
|
|
4015
4390
|
};
|
|
4391
|
+
|
|
4392
|
+
//#endregion
|
|
4393
|
+
//#region src/infrastructure/canvas-version-descriptions.consts.ts
|
|
4394
|
+
const CANVAS_VERSION_PROCEDURE_DESCRIPTIONS = {
|
|
4395
|
+
"canvas.version.list": "List retained versions of a canvas, newest first.",
|
|
4396
|
+
"canvas.version.get": "Read the document and screen manifest retained for one canvas version.",
|
|
4397
|
+
"canvas.version.name": "Name the current or a retained canvas version so it is kept.",
|
|
4398
|
+
"canvas.version.updateMetadata": "Replace the title and description of a named canvas version.",
|
|
4399
|
+
"canvas.version.removeName": "Remove a canvas version’s name and return it to automatic retention."
|
|
4400
|
+
};
|
|
4401
|
+
const CANVAS_VERSION_OPTION_DESCRIPTIONS = {
|
|
4402
|
+
"--version-id": "Canvas version entry id returned by `enhance canvas version list`.",
|
|
4403
|
+
"--cursor": "Opaque continuation cursor returned by the preceding list page.",
|
|
4404
|
+
"--limit": "Maximum number of results to return on this page.",
|
|
4405
|
+
"--include-automatic": "Include unnamed automatic versions as well as retained versions.",
|
|
4406
|
+
"--actor": "Version author filter: `all` or only versions created by `mine`.",
|
|
4407
|
+
"--target": "Version target JSON: current with its expectedVersion, or a retained version with its versionId.",
|
|
4408
|
+
"--description": "Optional detail explaining why this named version matters, or null."
|
|
4409
|
+
};
|
|
4410
|
+
|
|
4016
4411
|
//#endregion
|
|
4017
4412
|
//#region src/infrastructure/procedure-descriptions.consts.ts
|
|
4018
4413
|
const PROCEDURE_DESCRIPTIONS = {
|
|
4414
|
+
...CANVAS_VERSION_PROCEDURE_DESCRIPTIONS,
|
|
4019
4415
|
"canvas.createEditableFrame": "Insert one validated primitive subtree beside its source screen as an atomic canvas edit.",
|
|
4020
4416
|
"canvas.create": "Create a canvas and return the id required by canvas-scoped commands.",
|
|
4021
4417
|
"canvas.applyOperations": "Atomically apply validated text, geometry, style, ordering, and removal operations to one canvas version.",
|
|
@@ -4043,12 +4439,12 @@ const PROCEDURE_DESCRIPTIONS = {
|
|
|
4043
4439
|
"canvas.participants.list": "List people with direct access to a canvas.",
|
|
4044
4440
|
"canvas.participants.setAccess": "Change a canvas participant between view and comment access.",
|
|
4045
4441
|
"canvas.participants.revoke": "Remove a participant’s direct access to a canvas.",
|
|
4046
|
-
"canvas.invites.create": "Invite an email
|
|
4442
|
+
"canvas.invites.create": "Invite an email address to access a canvas and return the pending invitation.",
|
|
4047
4443
|
"canvas.invites.accept": "Accept a canvas invitation using its secret token.",
|
|
4048
4444
|
"canvas.invites.preview": "Inspect what an invitation grants before accepting it.",
|
|
4049
4445
|
"canvas.invites.list": "List pending and expired invitations for a canvas.",
|
|
4050
4446
|
"canvas.invites.revoke": "Revoke a pending canvas invitation.",
|
|
4051
|
-
"canvas.invites.resend": "Replace
|
|
4447
|
+
"canvas.invites.resend": "Replace a pending canvas invitation token and send the invitation again.",
|
|
4052
4448
|
"comment.list": "List comment threads and replies on a canvas.",
|
|
4053
4449
|
"comment.start": "Start a comment thread anchored to a canvas location.",
|
|
4054
4450
|
"comment.resolve": "Set a thread resolved or reopened with an explicit target state.",
|
|
@@ -4093,6 +4489,7 @@ const PROCEDURE_DESCRIPTIONS = {
|
|
|
4093
4489
|
"screen.delete": "Delete an unattached captured page owned by this person."
|
|
4094
4490
|
};
|
|
4095
4491
|
const OPTION_DESCRIPTIONS = {
|
|
4492
|
+
...CANVAS_VERSION_OPTION_DESCRIPTIONS,
|
|
4096
4493
|
"--canvas-id": "Canvas id, from `enhance canvas list`.",
|
|
4097
4494
|
"--mutation-id": "Client-minted UUID identifying this atomic canvas mutation.",
|
|
4098
4495
|
"--organisation-id": "Team id, from `enhance organisation list`.",
|
|
@@ -4206,6 +4603,7 @@ const OPTION_DESCRIPTIONS = {
|
|
|
4206
4603
|
"screen.create --page-title": "Required captured page title, or the literal null.",
|
|
4207
4604
|
"fixture recording --source-url": "Required original page URL represented by this recording."
|
|
4208
4605
|
};
|
|
4606
|
+
|
|
4209
4607
|
//#endregion
|
|
4210
4608
|
//#region src/infrastructure/capability-definition.mapper.ts
|
|
4211
4609
|
const jsonRecordSchema$1 = z.record(z.string(), z.unknown());
|
|
@@ -4300,7 +4698,7 @@ const resultSchemaFor = (output) => z.union([
|
|
|
4300
4698
|
const toCapabilityDefinition = (input) => {
|
|
4301
4699
|
const inputJson = z.toJSONSchema(input.inputSchema, { unrepresentable: "any" });
|
|
4302
4700
|
const outputJson = z.toJSONSchema(input.outputSchema, { unrepresentable: "any" });
|
|
4303
|
-
const guide = guideFor({
|
|
4701
|
+
const guide = input.guide ?? guideFor({
|
|
4304
4702
|
id: input.id,
|
|
4305
4703
|
operation: input.operation,
|
|
4306
4704
|
meta: input.meta,
|
|
@@ -4338,6 +4736,7 @@ const toCapabilityDefinition = (input) => {
|
|
|
4338
4736
|
})
|
|
4339
4737
|
};
|
|
4340
4738
|
};
|
|
4739
|
+
|
|
4341
4740
|
//#endregion
|
|
4342
4741
|
//#region src/infrastructure/capability-policy.consts.ts
|
|
4343
4742
|
const SHARED_CAPABILITY_POLICY = {
|
|
@@ -4396,6 +4795,16 @@ const PROCEDURE_CAPABILITY_POLICIES = {
|
|
|
4396
4795
|
reason: "Browser thumbnail telemetry is not an agent capability.",
|
|
4397
4796
|
owner: "product"
|
|
4398
4797
|
},
|
|
4798
|
+
"canvas.version.duplicate": {
|
|
4799
|
+
exposure: "internal",
|
|
4800
|
+
reason: "Duplicating historical state is restricted to an interactive person session.",
|
|
4801
|
+
owner: "product"
|
|
4802
|
+
},
|
|
4803
|
+
"canvas.version.restore": {
|
|
4804
|
+
exposure: "internal",
|
|
4805
|
+
reason: "Restoring historical state is restricted to an interactive person session.",
|
|
4806
|
+
owner: "product"
|
|
4807
|
+
},
|
|
4399
4808
|
"person.createAgentToken": {
|
|
4400
4809
|
exposure: "cli-transport",
|
|
4401
4810
|
reason: "Credential lifecycle remains in the interactive CLI auth surface.",
|
|
@@ -4564,6 +4973,7 @@ const UTILITY_CAPABILITY_POLICIES = {
|
|
|
4564
4973
|
owner: "development"
|
|
4565
4974
|
}
|
|
4566
4975
|
};
|
|
4976
|
+
|
|
4567
4977
|
//#endregion
|
|
4568
4978
|
//#region src/infrastructure/shared-capability-procedure.consts.ts
|
|
4569
4979
|
const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
@@ -4601,6 +5011,11 @@ const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
|
4601
5011
|
"canvas.setAccess",
|
|
4602
5012
|
"canvas.setReviewState",
|
|
4603
5013
|
"canvas.tree",
|
|
5014
|
+
"canvas.version.get",
|
|
5015
|
+
"canvas.version.list",
|
|
5016
|
+
"canvas.version.name",
|
|
5017
|
+
"canvas.version.removeName",
|
|
5018
|
+
"canvas.version.updateMetadata",
|
|
4604
5019
|
"comment.delete",
|
|
4605
5020
|
"comment.edit",
|
|
4606
5021
|
"comment.list",
|
|
@@ -4645,6 +5060,7 @@ const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
|
4645
5060
|
"screen.delete",
|
|
4646
5061
|
"transcript.retry"
|
|
4647
5062
|
]);
|
|
5063
|
+
|
|
4648
5064
|
//#endregion
|
|
4649
5065
|
//#region src/infrastructure/capability-policy.adapter.ts
|
|
4650
5066
|
const createCapabilityPolicyAdapter = () => ({
|
|
@@ -4673,6 +5089,7 @@ const createCapabilityPolicyAdapter = () => ({
|
|
|
4673
5089
|
},
|
|
4674
5090
|
excludedProcedures: new Set(Object.entries(PROCEDURE_CAPABILITY_POLICIES).flatMap(([procedure, policy]) => policy.exposure === "shared" ? [] : [procedure]))
|
|
4675
5091
|
});
|
|
5092
|
+
|
|
4676
5093
|
//#endregion
|
|
4677
5094
|
//#region src/infrastructure/collaboration-capability.consts.ts
|
|
4678
5095
|
const COLLABORATION_CAPABILITY_SPECS = [
|
|
@@ -4793,6 +5210,7 @@ const COLLABORATION_CAPABILITY_SPECS = [
|
|
|
4793
5210
|
}
|
|
4794
5211
|
}
|
|
4795
5212
|
];
|
|
5213
|
+
|
|
4796
5214
|
//#endregion
|
|
4797
5215
|
//#region ../api/src/shared/errors/app.error.ts
|
|
4798
5216
|
const appError = (code, message, fields) => fields ? {
|
|
@@ -4804,6 +5222,7 @@ const appError = (code, message, fields) => fields ? {
|
|
|
4804
5222
|
message
|
|
4805
5223
|
};
|
|
4806
5224
|
const internalError = (message) => appError("INTERNAL", message);
|
|
5225
|
+
|
|
4807
5226
|
//#endregion
|
|
4808
5227
|
//#region ../api/src/shared/trpc/instance.trpc.ts
|
|
4809
5228
|
/** Never the reason. That is on the `rpc` line, against the id the caller is holding. */
|
|
@@ -4922,6 +5341,7 @@ const toTrpcError = (error) => new TRPCError({
|
|
|
4922
5341
|
message: error.message,
|
|
4923
5342
|
cause: error
|
|
4924
5343
|
});
|
|
5344
|
+
|
|
4925
5345
|
//#endregion
|
|
4926
5346
|
//#region ../api/src/shared/trpc/idempotency.procedure.ts
|
|
4927
5347
|
const NATIVE_REPLAY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
@@ -4976,6 +5396,7 @@ const idempotentMutations = trpcMiddleware(async ({ ctx, type, path, getRawInput
|
|
|
4976
5396
|
if (completed.isErr()) throw toTrpcError(internalError(completed.error.message));
|
|
4977
5397
|
return result;
|
|
4978
5398
|
});
|
|
5399
|
+
|
|
4979
5400
|
//#endregion
|
|
4980
5401
|
//#region ../api/src/shared/trpc/base.procedure.ts
|
|
4981
5402
|
/** Query timings are logged to the hundredth of a millisecond; finer is noise. */
|
|
@@ -5170,6 +5591,7 @@ const canvasOwnerProcedure = canvasReaderProcedure.use(async ({ ctx, next }) =>
|
|
|
5170
5591
|
const orThrow = (result) => result.match((value) => value, (error) => {
|
|
5171
5592
|
throw toTrpcError(error);
|
|
5172
5593
|
});
|
|
5594
|
+
|
|
5173
5595
|
//#endregion
|
|
5174
5596
|
//#region ../api/src/canvas/infrastructure/canvas-actor.mapper.ts
|
|
5175
5597
|
const COLOURS = [
|
|
@@ -5209,6 +5631,7 @@ const toAgentCanvasRequestActor = (viewer) => viewer.kind === "agent" ? {
|
|
|
5209
5631
|
tokenId: viewer.tokenId,
|
|
5210
5632
|
mutationActor: toCanvasMutationActor(viewer)
|
|
5211
5633
|
} : null;
|
|
5634
|
+
|
|
5212
5635
|
//#endregion
|
|
5213
5636
|
//#region ../api/src/canvas/infrastructure/canvas-collection.mapper.ts
|
|
5214
5637
|
/** The wire's one field, into the three collection shapes the application names. */
|
|
@@ -5219,6 +5642,7 @@ const toCanvasCollection = (collection) => {
|
|
|
5219
5642
|
organisationId: collection
|
|
5220
5643
|
};
|
|
5221
5644
|
};
|
|
5645
|
+
|
|
5222
5646
|
//#endregion
|
|
5223
5647
|
//#region ../api/src/canvas/infrastructure/canvas-contract.mapper.ts
|
|
5224
5648
|
/**
|
|
@@ -5265,6 +5689,7 @@ const toCanvasCardContract = (view) => {
|
|
|
5265
5689
|
}
|
|
5266
5690
|
};
|
|
5267
5691
|
};
|
|
5692
|
+
|
|
5268
5693
|
//#endregion
|
|
5269
5694
|
//#region ../api/src/canvas/infrastructure/canvas-scene-node.mapper.ts
|
|
5270
5695
|
const toCanvasSceneNodeContract = (node) => canvasSceneNodeSchema.parse({
|
|
@@ -5283,6 +5708,7 @@ const toCanvasSceneNodeContract = (node) => canvasSceneNodeSchema.parse({
|
|
|
5283
5708
|
...node.props !== void 0 && { props: { ...node.props } },
|
|
5284
5709
|
...node.box !== void 0 && { box: { ...node.box } }
|
|
5285
5710
|
});
|
|
5711
|
+
|
|
5286
5712
|
//#endregion
|
|
5287
5713
|
//#region ../api/src/canvas/infrastructure/canvas.router.ts
|
|
5288
5714
|
const applyOperations = (handlers) => canvasCommenterProcedure.input(applyCanvasOperationsInputSchema).output(applyCanvasOperationsOutputSchema).mutation(async ({ input, ctx }) => {
|
|
@@ -5339,7 +5765,7 @@ const create$2 = (handlers) => personProcedure.input(createCanvasInputSchema).ou
|
|
|
5339
5765
|
sourceUrl: input.sourceUrl,
|
|
5340
5766
|
origin: ctx.viewer.kind === "agent" ? "agent" : "dashboard"
|
|
5341
5767
|
}))));
|
|
5342
|
-
const get$
|
|
5768
|
+
const get$2 = (handlers) => canvasReaderProcedure.input(getCanvasInputSchema).output(canvasSchema).query(async ({ input, ctx }) => {
|
|
5343
5769
|
const view = orThrow(await handlers.get.execute({
|
|
5344
5770
|
canvasId: input.canvasId,
|
|
5345
5771
|
reach: ctx.canvasAccess,
|
|
@@ -5381,7 +5807,7 @@ const createCanvasRouter = (handlers) => trpcRouter({
|
|
|
5381
5807
|
applyOperations: applyOperations(handlers),
|
|
5382
5808
|
createEditableFrame: createEditableFrame(handlers),
|
|
5383
5809
|
create: create$2(handlers),
|
|
5384
|
-
get: get$
|
|
5810
|
+
get: get$2(handlers),
|
|
5385
5811
|
setAccess: setAccess(handlers),
|
|
5386
5812
|
markViewed: markViewed(handlers),
|
|
5387
5813
|
list: personProcedure.input(listCanvasesInputSchema).output(listCanvasesOutputSchema).query(async ({ input, ctx }) => {
|
|
@@ -5411,6 +5837,7 @@ const createCanvasRouter = (handlers) => trpcRouter({
|
|
|
5411
5837
|
}));
|
|
5412
5838
|
})
|
|
5413
5839
|
});
|
|
5840
|
+
|
|
5414
5841
|
//#endregion
|
|
5415
5842
|
//#region ../api/src/canvas/infrastructure/canvas-document.router.ts
|
|
5416
5843
|
/**
|
|
@@ -5456,7 +5883,8 @@ const saveDocument = (handlers) => canvasCommenterProcedure.input(saveCanvasDocu
|
|
|
5456
5883
|
personId: ctx.viewer.personId,
|
|
5457
5884
|
baseVersion: input.baseVersion,
|
|
5458
5885
|
document: input.document,
|
|
5459
|
-
screenIds: input.screenIds
|
|
5886
|
+
screenIds: input.screenIds,
|
|
5887
|
+
actor: toCanvasMutationActor(ctx.viewer)
|
|
5460
5888
|
}));
|
|
5461
5889
|
if (result.outcome === "conflict") {
|
|
5462
5890
|
ctx.telemetry.emit("CanvasDocumentConflict", {
|
|
@@ -5479,6 +5907,7 @@ const createCanvasDocumentRouter = (handlers) => trpcRouter({
|
|
|
5479
5907
|
get: getDocument(handlers),
|
|
5480
5908
|
save: saveDocument(handlers)
|
|
5481
5909
|
});
|
|
5910
|
+
|
|
5482
5911
|
//#endregion
|
|
5483
5912
|
//#region ../api/src/canvas/infrastructure/canvas-image.router.ts
|
|
5484
5913
|
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 +5921,10 @@ const createCanvasImageRouter = (handlers) => trpcRouter({ reserveImage: canvasC
|
|
|
5492
5921
|
}
|
|
5493
5922
|
};
|
|
5494
5923
|
}) });
|
|
5924
|
+
|
|
5495
5925
|
//#endregion
|
|
5496
|
-
//#region
|
|
5497
|
-
var
|
|
5926
|
+
//#region ../../node_modules/.pnpm/neverthrow@8.2.0/node_modules/neverthrow/dist/index.cjs.js
|
|
5927
|
+
var require_index_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5498
5928
|
const defaultErrorConfig = { withStackTrace: false };
|
|
5499
5929
|
const createNeverThrowError = (message, result, config = defaultErrorConfig) => {
|
|
5500
5930
|
return {
|
|
@@ -5980,7 +6410,11 @@ var import_index_cjs = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5980
6410
|
exports.ok = ok;
|
|
5981
6411
|
exports.okAsync = okAsync;
|
|
5982
6412
|
exports.safeTry = safeTry;
|
|
5983
|
-
}))
|
|
6413
|
+
}));
|
|
6414
|
+
|
|
6415
|
+
//#endregion
|
|
6416
|
+
//#region ../api/src/canvas/infrastructure/canvas-inspection.mapper.ts
|
|
6417
|
+
var import_index_cjs = require_index_cjs();
|
|
5984
6418
|
const ROOT_NODE_ID$1 = "root";
|
|
5985
6419
|
const unionBounds = (boxes) => {
|
|
5986
6420
|
let union = null;
|
|
@@ -6096,6 +6530,7 @@ const toCanvasInspection = (value) => {
|
|
|
6096
6530
|
kinds
|
|
6097
6531
|
});
|
|
6098
6532
|
};
|
|
6533
|
+
|
|
6099
6534
|
//#endregion
|
|
6100
6535
|
//#region ../api/src/canvas/infrastructure/canvas-inspection.router.ts
|
|
6101
6536
|
const inspection = async (handlers, canvasId) => {
|
|
@@ -6152,7 +6587,27 @@ const createCanvasInspectionRouter = (handlers) => ({
|
|
|
6152
6587
|
};
|
|
6153
6588
|
})
|
|
6154
6589
|
});
|
|
6590
|
+
|
|
6591
|
+
//#endregion
|
|
6592
|
+
//#region ../api/src/canvas/domain/units.consts.ts
|
|
6593
|
+
/**
|
|
6594
|
+
* The canvas domain's own factors. A duplicate of `shared/lib/units.consts.ts` by design:
|
|
6595
|
+
* `API_LAYER_MAY_SEE.domain` is `['domain']`, so the domain imports nothing at all — that is
|
|
6596
|
+
* what makes it testable with no framework, no clock and no database in the room.
|
|
6597
|
+
*/
|
|
6598
|
+
const MS_PER_SECOND$1 = 1e3;
|
|
6599
|
+
const SECONDS_PER_MINUTE$1 = 60;
|
|
6600
|
+
const MINUTES_PER_HOUR$1 = 60;
|
|
6601
|
+
const HOURS_PER_DAY$1 = 24;
|
|
6602
|
+
const MS_PER_DAY$1 = MS_PER_SECOND$1 * 60 * 60 * 24;
|
|
6603
|
+
const BYTES_PER_KIB$1 = 1024;
|
|
6604
|
+
const BYTES_PER_MIB$1 = BYTES_PER_KIB$1 * BYTES_PER_KIB$1;
|
|
6605
|
+
|
|
6606
|
+
//#endregion
|
|
6607
|
+
//#region ../api/src/canvas/domain/invite.entity.ts
|
|
6608
|
+
const LIFETIME_MS = 14 * MS_PER_DAY$1;
|
|
6155
6609
|
const isInviteExpired = (invite, at) => invite.expiresAt <= at;
|
|
6610
|
+
|
|
6156
6611
|
//#endregion
|
|
6157
6612
|
//#region ../api/src/canvas/infrastructure/invite-contract.mapper.ts
|
|
6158
6613
|
/** Domain to wire. `state` is derived: expired and pending get different answers in the dialog. */
|
|
@@ -6167,6 +6622,7 @@ const toInviteContract = (invite, at) => ({
|
|
|
6167
6622
|
deliveryState: invite.deliveryState,
|
|
6168
6623
|
deliveryError: invite.deliveryError ?? ""
|
|
6169
6624
|
});
|
|
6625
|
+
|
|
6170
6626
|
//#endregion
|
|
6171
6627
|
//#region ../api/src/canvas/infrastructure/canvas-invite.router.ts
|
|
6172
6628
|
const create$1 = (handlers, shouldExposeTokens) => canvasSharerProcedure.input(createInviteInputSchema).output(createInviteOutputSchema).mutation(async ({ input, ctx }) => {
|
|
@@ -6227,6 +6683,7 @@ const createCanvasInviteRouter = (handlers, shouldExposeTokens = false) => trpcR
|
|
|
6227
6683
|
};
|
|
6228
6684
|
})
|
|
6229
6685
|
});
|
|
6686
|
+
|
|
6230
6687
|
//#endregion
|
|
6231
6688
|
//#region ../api/src/canvas/infrastructure/canvas-lifecycle.router.ts
|
|
6232
6689
|
const remove$1 = (handlers) => personProcedure.input(deleteCanvasInputSchema).output(deleteCanvasOutputSchema).mutation(async ({ input, ctx }) => {
|
|
@@ -6264,6 +6721,7 @@ const createCanvasLifecycleRouter = (handlers) => trpcRouter({
|
|
|
6264
6721
|
personId: ctx.viewer.personId
|
|
6265
6722
|
})))
|
|
6266
6723
|
});
|
|
6724
|
+
|
|
6267
6725
|
//#endregion
|
|
6268
6726
|
//#region ../api/src/canvas/infrastructure/participant-contract.mapper.ts
|
|
6269
6727
|
/** Domain to wire. */
|
|
@@ -6278,6 +6736,7 @@ const toParticipantContract = (row) => ({
|
|
|
6278
6736
|
reviewState: row.reviewState,
|
|
6279
6737
|
lastViewedAt: row.lastViewedAt?.toISOString() ?? null
|
|
6280
6738
|
});
|
|
6739
|
+
|
|
6281
6740
|
//#endregion
|
|
6282
6741
|
//#region ../api/src/canvas/infrastructure/canvas-participant.router.ts
|
|
6283
6742
|
/**
|
|
@@ -6303,9 +6762,11 @@ const createCanvasParticipantRouter = (handlers) => trpcRouter({
|
|
|
6303
6762
|
}),
|
|
6304
6763
|
revoke: canvasOwnerProcedure.input(revokeParticipantInputSchema).output(revokeParticipantOutputSchema).mutation(async ({ input }) => orThrow(await handlers.revokeParticipant.execute(input)))
|
|
6305
6764
|
});
|
|
6765
|
+
|
|
6306
6766
|
//#endregion
|
|
6307
6767
|
//#region ../api/src/canvas/application/canvas-activity.use-case.ts
|
|
6308
6768
|
const CANVAS_ACTIVITY_RENEW_AFTER_MS = 15e3;
|
|
6769
|
+
|
|
6309
6770
|
//#endregion
|
|
6310
6771
|
//#region ../api/src/canvas/infrastructure/canvas-realtime.router.ts
|
|
6311
6772
|
const agentActor = (viewer) => {
|
|
@@ -6372,6 +6833,7 @@ const createCanvasRealtimeRouter = (handlers, endpoint) => trpcRouter({
|
|
|
6372
6833
|
}),
|
|
6373
6834
|
activity: createCanvasActivityRouter(handlers.activity)
|
|
6374
6835
|
});
|
|
6836
|
+
|
|
6375
6837
|
//#endregion
|
|
6376
6838
|
//#region ../api/src/canvas/infrastructure/canvas-selection.presenter.ts
|
|
6377
6839
|
const ROOT_NODE_ID = "root";
|
|
@@ -6423,6 +6885,7 @@ const toCanvasSelection = (canvasId, source, selection) => toCanvasInspection(so
|
|
|
6423
6885
|
next: nextCommands(canvasId, source.version, nodes.map((node) => node.id))
|
|
6424
6886
|
};
|
|
6425
6887
|
});
|
|
6888
|
+
|
|
6426
6889
|
//#endregion
|
|
6427
6890
|
//#region ../api/src/canvas/infrastructure/canvas-selection.router.ts
|
|
6428
6891
|
const createCanvasSelectionRoute = (selection, readCanvas) => agentCanvasReaderProcedure.input(readCanvasSelectionInputSchema).output(readCanvasSelectionOutputSchema).query(async ({ input, ctx }) => {
|
|
@@ -6433,6 +6896,7 @@ const createCanvasSelectionRoute = (selection, readCanvas) => agentCanvasReaderP
|
|
|
6433
6896
|
}), readCanvas.execute(input.canvasId)]);
|
|
6434
6897
|
return orThrow(toCanvasSelection(input.canvasId, orThrow(source), orThrow(heldSelection)).mapErr((message) => appError("INTERNAL", message)));
|
|
6435
6898
|
});
|
|
6899
|
+
|
|
6436
6900
|
//#endregion
|
|
6437
6901
|
//#region ../api/src/canvas/infrastructure/canvas-thumbnail.router.ts
|
|
6438
6902
|
const reportUnavailable = canvasReaderProcedure.input(reportCanvasThumbnailUnavailableInputSchema).output(reportCanvasThumbnailUnavailableOutputSchema).mutation(({ input, ctx }) => {
|
|
@@ -6447,10 +6911,189 @@ const reportUnavailable = canvasReaderProcedure.input(reportCanvasThumbnailUnava
|
|
|
6447
6911
|
return { recorded: true };
|
|
6448
6912
|
});
|
|
6449
6913
|
const createCanvasThumbnailRouter = () => trpcRouter({ reportUnavailable });
|
|
6914
|
+
|
|
6915
|
+
//#endregion
|
|
6916
|
+
//#region ../api/src/canvas/infrastructure/canvas-version-contract.mapper.ts
|
|
6917
|
+
const toCanvasVersionActor = (viewer) => viewer.kind === "agent" ? {
|
|
6918
|
+
kind: "agent",
|
|
6919
|
+
personId: viewer.personId,
|
|
6920
|
+
displayName: viewer.displayName,
|
|
6921
|
+
initials: viewer.initials,
|
|
6922
|
+
tokenLabel: viewer.tokenLabel ?? "Agent"
|
|
6923
|
+
} : {
|
|
6924
|
+
kind: "person",
|
|
6925
|
+
personId: viewer.personId,
|
|
6926
|
+
displayName: viewer.displayName,
|
|
6927
|
+
initials: viewer.initials
|
|
6928
|
+
};
|
|
6929
|
+
const toCanvasVersionContractEntry = (entry) => ({
|
|
6930
|
+
id: entry.id,
|
|
6931
|
+
canvasId: entry.canvasId,
|
|
6932
|
+
documentVersion: entry.documentVersion,
|
|
6933
|
+
origin: entry.origin,
|
|
6934
|
+
restoreRole: entry.restoreRole,
|
|
6935
|
+
retention: entry.retention,
|
|
6936
|
+
title: entry.title,
|
|
6937
|
+
description: entry.description,
|
|
6938
|
+
actor: entry.actor,
|
|
6939
|
+
sourceVersionEntryId: entry.sourceVersionEntryId,
|
|
6940
|
+
expiresAt: entry.expiresAt?.toISOString() ?? null,
|
|
6941
|
+
createdAt: entry.createdAt.toISOString(),
|
|
6942
|
+
updatedAt: entry.updatedAt.toISOString(),
|
|
6943
|
+
screenCount: entry.screenCount
|
|
6944
|
+
});
|
|
6945
|
+
const toCanvasVersionContractScreen = (screen) => ({
|
|
6946
|
+
screenId: screen.screenId,
|
|
6947
|
+
route: screen.route,
|
|
6948
|
+
title: screen.title,
|
|
6949
|
+
viewport: screen.viewport,
|
|
6950
|
+
atMs: screen.atMs,
|
|
6951
|
+
sourceRecordingId: screen.sourceRecordingId,
|
|
6952
|
+
assetBundle: screen.assetBundle === null ? null : {
|
|
6953
|
+
...screen.assetBundle,
|
|
6954
|
+
assets: [...screen.assetBundle.assets]
|
|
6955
|
+
},
|
|
6956
|
+
download: screen.download === null ? null : {
|
|
6957
|
+
url: screen.download.url,
|
|
6958
|
+
expiresAt: screen.download.expiresAt.toISOString(),
|
|
6959
|
+
bytes: screen.download.bytes
|
|
6960
|
+
}
|
|
6961
|
+
});
|
|
6962
|
+
|
|
6963
|
+
//#endregion
|
|
6964
|
+
//#region ../api/src/canvas/infrastructure/canvas-version.router.ts
|
|
6965
|
+
const requireHistoryReach = (context) => {
|
|
6966
|
+
if (!context.canSeeRoutes || context.viewerKind === "anonymous" || context.viewerKind === "render") throw toTrpcError(appError("NOT_FOUND", "no such canvas"));
|
|
6967
|
+
};
|
|
6968
|
+
const list$3 = (handlers) => canvasReaderProcedure.input(listCanvasVersionsInputSchema).output(listCanvasVersionsOutputSchema).query(async ({ input, ctx }) => {
|
|
6969
|
+
requireHistoryReach({
|
|
6970
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
6971
|
+
viewerKind: ctx.viewer.kind
|
|
6972
|
+
});
|
|
6973
|
+
if (ctx.viewer.kind === "anonymous" || ctx.viewer.kind === "render") throw toTrpcError(appError("NOT_FOUND", "no such canvas"));
|
|
6974
|
+
const page = orThrow(await handlers.versions.list({
|
|
6975
|
+
...input,
|
|
6976
|
+
personId: ctx.viewer.personId
|
|
6977
|
+
}));
|
|
6978
|
+
ctx.telemetry.emit("CanvasVersionListServed", {
|
|
6979
|
+
entryCount: page.items.length,
|
|
6980
|
+
automaticIncluded: input.includeAutomatic ? 1 : 0,
|
|
6981
|
+
hasMore: page.nextCursor === null ? 0 : 1
|
|
6982
|
+
});
|
|
6983
|
+
return {
|
|
6984
|
+
current: {
|
|
6985
|
+
documentVersion: page.current.documentVersion,
|
|
6986
|
+
updatedAt: page.current.updatedAt.toISOString()
|
|
6987
|
+
},
|
|
6988
|
+
items: page.items.map((entry) => toCanvasVersionContractEntry(entry)),
|
|
6989
|
+
nextCursor: page.nextCursor,
|
|
6990
|
+
hasExpiredHistory: page.hasExpiredHistory
|
|
6991
|
+
};
|
|
6992
|
+
});
|
|
6993
|
+
const get$1 = (handlers) => canvasReaderProcedure.input(getCanvasVersionInputSchema).output(getCanvasVersionOutputSchema).query(async ({ input, ctx }) => {
|
|
6994
|
+
requireHistoryReach({
|
|
6995
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
6996
|
+
viewerKind: ctx.viewer.kind
|
|
6997
|
+
});
|
|
6998
|
+
const result = orThrow(await handlers.versions.get({
|
|
6999
|
+
...input,
|
|
7000
|
+
withRoutes: ctx.canvasAccess.canSeeRoutes
|
|
7001
|
+
}));
|
|
7002
|
+
if (result.outcome === "corrupt") return {
|
|
7003
|
+
outcome: result.outcome,
|
|
7004
|
+
entry: toCanvasVersionContractEntry(result.entry)
|
|
7005
|
+
};
|
|
7006
|
+
return result.outcome === "ready" ? {
|
|
7007
|
+
outcome: "ready",
|
|
7008
|
+
entry: toCanvasVersionContractEntry(result.entry),
|
|
7009
|
+
document: result.document,
|
|
7010
|
+
screens: result.screens.map((screen) => toCanvasVersionContractScreen(screen))
|
|
7011
|
+
} : {
|
|
7012
|
+
outcome: "missing-resources",
|
|
7013
|
+
entry: toCanvasVersionContractEntry(result.entry),
|
|
7014
|
+
document: result.document,
|
|
7015
|
+
screens: result.screens.map((screen) => toCanvasVersionContractScreen(screen)),
|
|
7016
|
+
missingScreenIds: [...result.missingScreenIds]
|
|
7017
|
+
};
|
|
7018
|
+
});
|
|
7019
|
+
const name = (handlers) => canvasCommenterProcedure.input(nameCanvasVersionInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7020
|
+
requireHistoryReach({
|
|
7021
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7022
|
+
viewerKind: ctx.viewer.kind
|
|
7023
|
+
});
|
|
7024
|
+
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.name({
|
|
7025
|
+
...input,
|
|
7026
|
+
actor: toCanvasVersionActor(ctx.viewer),
|
|
7027
|
+
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
7028
|
+
}))) };
|
|
7029
|
+
});
|
|
7030
|
+
const updateMetadata = (handlers) => canvasCommenterProcedure.input(updateCanvasVersionMetadataInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7031
|
+
requireHistoryReach({
|
|
7032
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7033
|
+
viewerKind: ctx.viewer.kind
|
|
7034
|
+
});
|
|
7035
|
+
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.name({
|
|
7036
|
+
canvasId: input.canvasId,
|
|
7037
|
+
target: {
|
|
7038
|
+
kind: "version",
|
|
7039
|
+
versionId: input.versionId
|
|
7040
|
+
},
|
|
7041
|
+
title: input.title,
|
|
7042
|
+
description: input.description,
|
|
7043
|
+
actor: toCanvasVersionActor(ctx.viewer),
|
|
7044
|
+
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
7045
|
+
}))) };
|
|
7046
|
+
});
|
|
7047
|
+
const removeName = (handlers) => canvasCommenterProcedure.input(removeCanvasVersionNameInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7048
|
+
requireHistoryReach({
|
|
7049
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7050
|
+
viewerKind: ctx.viewer.kind
|
|
7051
|
+
});
|
|
7052
|
+
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.removeName({
|
|
7053
|
+
...input,
|
|
7054
|
+
requesterPersonId: ctx.viewer.personId,
|
|
7055
|
+
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
7056
|
+
}))) };
|
|
7057
|
+
});
|
|
7058
|
+
const restore = (handlers) => canvasCommenterProcedure.input(restoreCanvasVersionInputSchema).output(restoreCanvasVersionOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7059
|
+
requireHistoryReach({
|
|
7060
|
+
canSeeRoutes: ctx.canvasAccess.canSeeRoutes,
|
|
7061
|
+
viewerKind: ctx.viewer.kind
|
|
7062
|
+
});
|
|
7063
|
+
if (ctx.viewer.kind !== "person") throw toTrpcError(appError("FORBIDDEN", "an agent cannot restore canvas history"));
|
|
7064
|
+
const restored = orThrow(await handlers.versions.restore({
|
|
7065
|
+
...input,
|
|
7066
|
+
actor: toCanvasVersionActor(ctx.viewer)
|
|
7067
|
+
}));
|
|
7068
|
+
ctx.telemetry.emit("CanvasVersionRestored", {
|
|
7069
|
+
documentVersion: restored.version,
|
|
7070
|
+
outcome: "restored"
|
|
7071
|
+
});
|
|
7072
|
+
return restored;
|
|
7073
|
+
});
|
|
7074
|
+
const duplicate = (handlers) => canvasOwnerProcedure.input(duplicateCanvasVersionInputSchema).output(duplicateCanvasVersionOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7075
|
+
if (ctx.viewer.kind !== "person") throw toTrpcError(appError("FORBIDDEN", "an agent cannot duplicate canvas history"));
|
|
7076
|
+
return orThrow(await handlers.versions.duplicate({
|
|
7077
|
+
...input,
|
|
7078
|
+
personId: ctx.viewer.personId,
|
|
7079
|
+
organisationId: input.organisationId === "personal" ? null : input.organisationId
|
|
7080
|
+
}));
|
|
7081
|
+
});
|
|
7082
|
+
const createCanvasVersionRouter = (handlers) => trpcRouter({
|
|
7083
|
+
list: list$3(handlers),
|
|
7084
|
+
get: get$1(handlers),
|
|
7085
|
+
name: name(handlers),
|
|
7086
|
+
updateMetadata: updateMetadata(handlers),
|
|
7087
|
+
removeName: removeName(handlers),
|
|
7088
|
+
restore: restore(handlers),
|
|
7089
|
+
duplicate: duplicate(handlers)
|
|
7090
|
+
});
|
|
7091
|
+
|
|
6450
7092
|
//#endregion
|
|
6451
7093
|
//#region ../api/src/canvas/domain/render-result.value-object.ts
|
|
6452
7094
|
const isRenderConversionResult = (result) => "rootNodeId" in result;
|
|
6453
7095
|
const isRenderOutputResult = (result) => "storageKey" in result;
|
|
7096
|
+
|
|
6454
7097
|
//#endregion
|
|
6455
7098
|
//#region ../api/src/canvas/infrastructure/render-job.presenter.ts
|
|
6456
7099
|
const wireResult = (job, result) => ({
|
|
@@ -6609,6 +7252,7 @@ const toCanvasConversionJob = (job) => {
|
|
|
6609
7252
|
};
|
|
6610
7253
|
return null;
|
|
6611
7254
|
};
|
|
7255
|
+
|
|
6612
7256
|
//#endregion
|
|
6613
7257
|
//#region ../api/src/canvas/infrastructure/render.router.ts
|
|
6614
7258
|
const actorOf = (viewer) => toAgentCanvasRequestActor(viewer) ?? orThrow((0, import_index_cjs.err)(appError("UNAUTHORIZED", "this call needs an agent token")));
|
|
@@ -6748,6 +7392,7 @@ const createRenderRouter = (handlers) => trpcRouter({
|
|
|
6748
7392
|
cancel: cancelRender(handlers),
|
|
6749
7393
|
download: downloadRender(handlers)
|
|
6750
7394
|
});
|
|
7395
|
+
|
|
6751
7396
|
//#endregion
|
|
6752
7397
|
//#region ../api/src/canvas/infrastructure/render-exposure.router.ts
|
|
6753
7398
|
const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderProcedure.input(exposeCanvasRenderInputSchema).output(exposeCanvasRenderOutputSchema).query(async ({ input, ctx }) => {
|
|
@@ -6781,6 +7426,7 @@ const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderPr
|
|
|
6781
7426
|
format: "png"
|
|
6782
7427
|
};
|
|
6783
7428
|
}) });
|
|
7429
|
+
|
|
6784
7430
|
//#endregion
|
|
6785
7431
|
//#region ../api/src/shared/lib/units.consts.ts
|
|
6786
7432
|
/**
|
|
@@ -6792,6 +7438,15 @@ const createRenderExposureRouter = (handlers) => trpcRouter({ exposure: renderPr
|
|
|
6792
7438
|
* domain sees nothing outside itself, not even this. That is the enforced boundary, not drift.
|
|
6793
7439
|
*/
|
|
6794
7440
|
const MS_PER_SECOND = 1e3;
|
|
7441
|
+
const SECONDS_PER_MINUTE = 60;
|
|
7442
|
+
const MINUTES_PER_HOUR = 60;
|
|
7443
|
+
const HOURS_PER_DAY = 24;
|
|
7444
|
+
const MS_PER_MINUTE = MS_PER_SECOND * 60;
|
|
7445
|
+
const MS_PER_HOUR = MS_PER_MINUTE * 60;
|
|
7446
|
+
const MS_PER_DAY = MS_PER_HOUR * 24;
|
|
7447
|
+
const BYTES_PER_KIB = 1024;
|
|
7448
|
+
const BYTES_PER_MIB = BYTES_PER_KIB * BYTES_PER_KIB;
|
|
7449
|
+
|
|
6795
7450
|
//#endregion
|
|
6796
7451
|
//#region ../api/src/comment/infrastructure/comment-contract.mapper.ts
|
|
6797
7452
|
const bounded = (value) => Math.min(1, Math.max(0, value));
|
|
@@ -6896,6 +7551,7 @@ const toCommentThreadContract = (view, directory) => {
|
|
|
6896
7551
|
lastMessageAt: view.thread.lastMessageAt.toISOString()
|
|
6897
7552
|
};
|
|
6898
7553
|
};
|
|
7554
|
+
|
|
6899
7555
|
//#endregion
|
|
6900
7556
|
//#region ../api/src/comment/infrastructure/comment.router.ts
|
|
6901
7557
|
/**
|
|
@@ -7040,6 +7696,7 @@ const createCommentRouter = (handlers) => trpcRouter({
|
|
|
7040
7696
|
canManage: ctx.canvasAccess.canManage
|
|
7041
7697
|
})))
|
|
7042
7698
|
});
|
|
7699
|
+
|
|
7043
7700
|
//#endregion
|
|
7044
7701
|
//#region ../api/src/organisation/infrastructure/organisation.router.ts
|
|
7045
7702
|
/** Translates a transport call into a command or a query. No rules, no persistence. */
|
|
@@ -7061,6 +7718,7 @@ const createOrganisationRouter = (handlers) => trpcRouter({
|
|
|
7061
7718
|
personId: ctx.viewer.personId
|
|
7062
7719
|
})))
|
|
7063
7720
|
});
|
|
7721
|
+
|
|
7064
7722
|
//#endregion
|
|
7065
7723
|
//#region ../api/src/organisation/infrastructure/organisation-invite.router.ts
|
|
7066
7724
|
const inviteContract = (invite, at) => ({
|
|
@@ -7122,6 +7780,7 @@ const createOrganisationInviteRouter = (handlers) => trpcRouter({
|
|
|
7122
7780
|
preview: preview(handlers),
|
|
7123
7781
|
accept: accept(handlers)
|
|
7124
7782
|
});
|
|
7783
|
+
|
|
7125
7784
|
//#endregion
|
|
7126
7785
|
//#region ../api/src/organisation/infrastructure/organisation-people.router.ts
|
|
7127
7786
|
const list = (handlers) => personProcedure.input(listMembersInputSchema).output(listMembersOutputSchema).query(async ({ input, ctx }) => ({
|
|
@@ -7157,17 +7816,32 @@ const createOrganisationPeopleRouter = (handlers) => trpcRouter({
|
|
|
7157
7816
|
remove: remove(handlers),
|
|
7158
7817
|
transferOwnership: transferOwnership(handlers)
|
|
7159
7818
|
});
|
|
7819
|
+
|
|
7820
|
+
//#endregion
|
|
7821
|
+
//#region ../api/src/person/domain/prepared-canvas-id.domain-service.ts
|
|
7822
|
+
const UUID_PART_LIMIT = 5;
|
|
7823
|
+
const UUID_HEX_RADIX = 16;
|
|
7824
|
+
const UUID_FIRST_PART_WIDTH = 8;
|
|
7825
|
+
const PREPARED_CANVAS_MASK = 1162758195;
|
|
7826
|
+
/** A stable one-to-one canvas id lets a failed first-account request retry without duplicates. */
|
|
7827
|
+
const preparedCanvasIdFor = (personId) => {
|
|
7828
|
+
const [first = "", second = "", third = "", fourth = "", fifth = ""] = personId.split("-", UUID_PART_LIMIT);
|
|
7829
|
+
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}`;
|
|
7830
|
+
};
|
|
7831
|
+
|
|
7160
7832
|
//#endregion
|
|
7161
7833
|
//#region ../api/src/person/infrastructure/person-contract.mapper.ts
|
|
7162
7834
|
/** Domain to wire. `Date` becomes an ISO string here and nowhere else. */
|
|
7163
7835
|
const toPersonContract = (person) => ({
|
|
7164
7836
|
id: person.id,
|
|
7837
|
+
preparedCanvasId: preparedCanvasIdFor(person.id),
|
|
7165
7838
|
displayName: person.displayName,
|
|
7166
7839
|
initials: person.initials,
|
|
7167
7840
|
avatarUrl: person.avatarUrl,
|
|
7168
7841
|
email: person.email,
|
|
7169
7842
|
createdAt: person.createdAt.toISOString()
|
|
7170
7843
|
});
|
|
7844
|
+
|
|
7171
7845
|
//#endregion
|
|
7172
7846
|
//#region ../api/src/person/infrastructure/person.router.ts
|
|
7173
7847
|
const tokenOnWire = (token) => ({
|
|
@@ -7190,7 +7864,10 @@ const agentTokenRoutes = (handlers) => ({
|
|
|
7190
7864
|
agentToken: tokenOnWire(created.token)
|
|
7191
7865
|
};
|
|
7192
7866
|
}),
|
|
7193
|
-
listAgentTokens: personProcedure.meta({ description: "List agent credentials so unused or revoked ones can be identified." }).input(listAgentTokensInputSchema).output(listAgentTokensOutputSchema).query(async ({ ctx }) => ({
|
|
7867
|
+
listAgentTokens: personProcedure.meta({ description: "List agent credentials so unused or revoked ones can be identified." }).input(listAgentTokensInputSchema).output(listAgentTokensOutputSchema).query(async ({ ctx }) => ({
|
|
7868
|
+
isConnected: orThrow(await handlers.agentTokens.isConnected(ctx.viewer.personId)),
|
|
7869
|
+
items: orThrow(await handlers.agentTokens.list(ctx.viewer.personId)).map((token) => tokenOnWire(token))
|
|
7870
|
+
})),
|
|
7194
7871
|
revokeAgentToken: personProcedure.meta({ description: "Revoke an agent credential before its next request." }).input(revokeAgentTokenInputSchema).output(revokeAgentTokenOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7195
7872
|
return {
|
|
7196
7873
|
tokenId: orThrow(await handlers.agentTokens.revoke({
|
|
@@ -7258,11 +7935,12 @@ const recipientRoutes = (handlers) => trpcRouter({
|
|
|
7258
7935
|
});
|
|
7259
7936
|
const createPersonRouter = (handlers) => trpcRouter({
|
|
7260
7937
|
...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);
|
|
7938
|
+
signUp: baseProcedure.meta({ description: "Create a local account when no signed-in person exists." }).input(signUpInputSchema).output(signUpOutputSchema).mutation(async ({ input, ctx }) => {
|
|
7939
|
+
const signedUp = orThrow(await handlers.signUp.execute(input));
|
|
7940
|
+
const token = ctx.session.issue(signedUp.person.id, input.deliver);
|
|
7264
7941
|
return {
|
|
7265
|
-
person: toPersonContract(person),
|
|
7942
|
+
person: toPersonContract(signedUp.person),
|
|
7943
|
+
preparedCanvasId: signedUp.preparedCanvasId,
|
|
7266
7944
|
token
|
|
7267
7945
|
};
|
|
7268
7946
|
}),
|
|
@@ -7285,6 +7963,7 @@ const createPersonRouter = (handlers) => trpcRouter({
|
|
|
7285
7963
|
}))) })),
|
|
7286
7964
|
recipients: recipientRoutes(handlers)
|
|
7287
7965
|
});
|
|
7966
|
+
|
|
7288
7967
|
//#endregion
|
|
7289
7968
|
//#region ../api/src/prototype/infrastructure/prototype-publisher.mapper.ts
|
|
7290
7969
|
const toAgentPrototypePublisher = (viewer) => {
|
|
@@ -7309,6 +7988,7 @@ const toPrototypePublisher = (viewer) => {
|
|
|
7309
7988
|
} }
|
|
7310
7989
|
};
|
|
7311
7990
|
};
|
|
7991
|
+
|
|
7312
7992
|
//#endregion
|
|
7313
7993
|
//#region ../api/src/prototype/infrastructure/prototype.router.ts
|
|
7314
7994
|
const agentPublisher = (viewer) => {
|
|
@@ -7480,6 +8160,7 @@ const createPrototypeRouter = (handlers) => trpcRouter({
|
|
|
7480
8160
|
complete: completeProcedure(handlers),
|
|
7481
8161
|
requestRuntimeTicket: runtimeTicketProcedure(handlers)
|
|
7482
8162
|
});
|
|
8163
|
+
|
|
7483
8164
|
//#endregion
|
|
7484
8165
|
//#region ../api/src/recording/infrastructure/recording.router.ts
|
|
7485
8166
|
const onWire$2 = (upload) => ({
|
|
@@ -7656,6 +8337,7 @@ const createRecordingRouter = (handlers) => trpcRouter({
|
|
|
7656
8337
|
}),
|
|
7657
8338
|
delete: canvasOwnerProcedure.input(deleteRecordingInputSchema).output(deleteRecordingOutputSchema).mutation(async ({ input }) => orThrow(await handlers.remove.execute(input)))
|
|
7658
8339
|
});
|
|
8340
|
+
|
|
7659
8341
|
//#endregion
|
|
7660
8342
|
//#region ../api/src/recording/infrastructure/recording-asset.router.ts
|
|
7661
8343
|
/** The same shape `recording.router.ts` puts a signed upload on the wire in. */
|
|
@@ -7703,6 +8385,7 @@ const createRecordingAssetRouter = (handlers) => trpcRouter({
|
|
|
7703
8385
|
reserve: reserveAssets(handlers),
|
|
7704
8386
|
confirm: confirmAssets(handlers)
|
|
7705
8387
|
});
|
|
8388
|
+
|
|
7706
8389
|
//#endregion
|
|
7707
8390
|
//#region ../api/src/recording/infrastructure/recording-repair.router.ts
|
|
7708
8391
|
const onWire = (upload) => ({
|
|
@@ -7730,7 +8413,14 @@ const recordingRepairRoutes = (handlers) => ({
|
|
|
7730
8413
|
refreshUpload: refreshUpload(handlers),
|
|
7731
8414
|
confirmUpload: confirmUpload(handlers)
|
|
7732
8415
|
});
|
|
7733
|
-
|
|
8416
|
+
|
|
8417
|
+
//#endregion
|
|
8418
|
+
//#region ../api/src/screen/domain/screen.consts.ts
|
|
8419
|
+
/** The direct-to-blob-store ceiling; API request bodies never carry these bytes. */
|
|
8420
|
+
const SCREEN_MEBIBYTES = 64;
|
|
8421
|
+
const BYTES_PER_MEBIBYTE = 1048576;
|
|
8422
|
+
const MAX_SCREEN_BYTES = 64 * BYTES_PER_MEBIBYTE;
|
|
8423
|
+
|
|
7734
8424
|
//#endregion
|
|
7735
8425
|
//#region ../api/src/screen/infrastructure/screen.router.ts
|
|
7736
8426
|
/**
|
|
@@ -7791,6 +8481,7 @@ const createScreenRouter = (handlers) => trpcRouter({
|
|
|
7791
8481
|
ownerPersonId: ctx.viewer.personId
|
|
7792
8482
|
})))
|
|
7793
8483
|
});
|
|
8484
|
+
|
|
7794
8485
|
//#endregion
|
|
7795
8486
|
//#region ../api/src/shared/observability/client-performance-telemetry.router.ts
|
|
7796
8487
|
const fieldsOf$1 = (input) => {
|
|
@@ -7818,6 +8509,7 @@ const clientPerformanceTelemetryRoute = () => baseProcedure.input(clientPerforma
|
|
|
7818
8509
|
else ctx.logger.info(fields, "event");
|
|
7819
8510
|
return { accepted: true };
|
|
7820
8511
|
});
|
|
8512
|
+
|
|
7821
8513
|
//#endregion
|
|
7822
8514
|
//#region ../api/src/shared/observability/extension-telemetry.router.ts
|
|
7823
8515
|
const isFailure = (input) => {
|
|
@@ -7855,6 +8547,7 @@ const createExtensionTelemetryRouter = () => trpcRouter({ lifecycle: baseProcedu
|
|
|
7855
8547
|
else ctx.logger.info(fields, "event");
|
|
7856
8548
|
return { accepted: true };
|
|
7857
8549
|
}) });
|
|
8550
|
+
|
|
7858
8551
|
//#endregion
|
|
7859
8552
|
//#region ../api/src/transcript/infrastructure/transcript.router.ts
|
|
7860
8553
|
const createTranscriptRouter = (handlers) => trpcRouter({
|
|
@@ -7864,6 +8557,7 @@ const createTranscriptRouter = (handlers) => trpcRouter({
|
|
|
7864
8557
|
}))),
|
|
7865
8558
|
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
8559
|
});
|
|
8560
|
+
|
|
7867
8561
|
//#endregion
|
|
7868
8562
|
//#region ../api/src/app.router.ts
|
|
7869
8563
|
const DEFAULT_ROUTER_OPTIONS = {
|
|
@@ -7886,6 +8580,7 @@ const createAppRouter = (handlers, options = DEFAULT_ROUTER_OPTIONS) => trpcRout
|
|
|
7886
8580
|
selection: createCanvasSelectionRoute(handlers.canvas.selection, handlers.render.readCanvas),
|
|
7887
8581
|
realtime: createCanvasRealtimeRouter(handlers.canvas, options.realtimeEndpoint),
|
|
7888
8582
|
document: createCanvasDocumentRouter(handlers.canvas),
|
|
8583
|
+
version: createCanvasVersionRouter(handlers.canvas),
|
|
7889
8584
|
render: trpcRouter({
|
|
7890
8585
|
...createRenderRouter(handlers.render)._def.record,
|
|
7891
8586
|
...createRenderExposureRouter(handlers.render)._def.record
|
|
@@ -7914,6 +8609,7 @@ const createAppRouter = (handlers, options = DEFAULT_ROUTER_OPTIONS) => trpcRout
|
|
|
7914
8609
|
performance: clientPerformanceTelemetryRoute()
|
|
7915
8610
|
})
|
|
7916
8611
|
});
|
|
8612
|
+
|
|
7917
8613
|
//#endregion
|
|
7918
8614
|
//#region src/infrastructure/router-shape.adapter.ts
|
|
7919
8615
|
const unavailable = { execute: () => {
|
|
@@ -7952,6 +8648,14 @@ const handlers = {
|
|
|
7952
8648
|
markViewed: unavailable,
|
|
7953
8649
|
setReviewState: unavailable,
|
|
7954
8650
|
restore: unavailable,
|
|
8651
|
+
versions: {
|
|
8652
|
+
list: unavailable.execute,
|
|
8653
|
+
get: unavailable.execute,
|
|
8654
|
+
name: unavailable.execute,
|
|
8655
|
+
removeName: unavailable.execute,
|
|
8656
|
+
restore: unavailable.execute,
|
|
8657
|
+
duplicate: unavailable.execute
|
|
8658
|
+
},
|
|
7955
8659
|
getDocument: unavailable,
|
|
7956
8660
|
saveDocument: unavailable,
|
|
7957
8661
|
reserveImage: unavailable,
|
|
@@ -7994,6 +8698,7 @@ const handlers = {
|
|
|
7994
8698
|
create: () => unavailable.execute(),
|
|
7995
8699
|
list: () => unavailable.execute(),
|
|
7996
8700
|
find: () => unavailable.execute(),
|
|
8701
|
+
isConnected: () => unavailable.execute(),
|
|
7997
8702
|
revoke: () => unavailable.execute()
|
|
7998
8703
|
}
|
|
7999
8704
|
},
|
|
@@ -8054,6 +8759,7 @@ const handlers = {
|
|
|
8054
8759
|
}
|
|
8055
8760
|
};
|
|
8056
8761
|
const createRouterShapeAdapter = () => createAppRouter(handlers);
|
|
8762
|
+
|
|
8057
8763
|
//#endregion
|
|
8058
8764
|
//#region src/infrastructure/capability-catalog.adapter.ts
|
|
8059
8765
|
const jsonRecordSchema = z.record(z.string(), z.unknown());
|
|
@@ -8078,6 +8784,11 @@ const reflected = (value, key, label) => {
|
|
|
8078
8784
|
if (!(typeof value === "object" && value !== null || typeof value === "function")) throw new TypeError(`${label} is not reflectable`);
|
|
8079
8785
|
return Reflect.get(value, key);
|
|
8080
8786
|
};
|
|
8787
|
+
const effectFor = (id, operation) => {
|
|
8788
|
+
if (operation === "query") return "read";
|
|
8789
|
+
if (/(?:\.delete(?:Permanently)?|\.discard|\.remove(?:Name)?|\.revoke)$/u.test(id)) return "delete";
|
|
8790
|
+
return "write";
|
|
8791
|
+
};
|
|
8081
8792
|
const procedureSchemas = (definitions, id) => {
|
|
8082
8793
|
const internals = reflected(definitions[id], "_def", `${id} definition`);
|
|
8083
8794
|
const inputs = z.array(z.unknown()).safeParse(reflected(internals, "inputs", `${id} internals`));
|
|
@@ -8106,7 +8817,7 @@ const createCapabilityCatalogAdapter = () => {
|
|
|
8106
8817
|
id,
|
|
8107
8818
|
operation: parsed.type,
|
|
8108
8819
|
source: "router",
|
|
8109
|
-
effect: parsed.type
|
|
8820
|
+
effect: effectFor(id, parsed.type),
|
|
8110
8821
|
idempotency: parsed.type === "query" ? "none" : "single",
|
|
8111
8822
|
execution: {
|
|
8112
8823
|
kind: "remote",
|
|
@@ -8140,6 +8851,7 @@ const createCapabilityCatalogAdapter = () => {
|
|
|
8140
8851
|
}));
|
|
8141
8852
|
return [...routerCapabilities, ...productCapabilities].toSorted((left, right) => left.id.localeCompare(right.id));
|
|
8142
8853
|
};
|
|
8854
|
+
|
|
8143
8855
|
//#endregion
|
|
8144
8856
|
//#region src/infrastructure/process-exit.error.ts
|
|
8145
8857
|
var ProcessExitError = class extends FailedToExitError {
|
|
@@ -8153,6 +8865,94 @@ var ProcessExitError = class extends FailedToExitError {
|
|
|
8153
8865
|
this.requestedCode = requestedCode;
|
|
8154
8866
|
}
|
|
8155
8867
|
};
|
|
8868
|
+
|
|
8869
|
+
//#endregion
|
|
8870
|
+
//#region src/infrastructure/mcp-capability-discovery.adapter.ts
|
|
8871
|
+
const EXACT_ID_SCORE = 1e4;
|
|
8872
|
+
const ID_PREFIX_SCORE = 1e3;
|
|
8873
|
+
const ID_SEGMENT_SCORE = 100;
|
|
8874
|
+
const ID_SUBSTRING_SCORE = 40;
|
|
8875
|
+
const GUIDE_MATCH_SCORE = 10;
|
|
8876
|
+
const NO_MATCH_SCORE = 0;
|
|
8877
|
+
const normalized = (value) => value.toLocaleLowerCase("en-AU").replaceAll(/[^a-z0-9]+/gu, " ").trim();
|
|
8878
|
+
const scoreFor = (capability, offered) => {
|
|
8879
|
+
const query = normalized(offered);
|
|
8880
|
+
const id = normalized(capability.id);
|
|
8881
|
+
if (query === id) return EXACT_ID_SCORE;
|
|
8882
|
+
const idSegments = new Set(id.split(" "));
|
|
8883
|
+
const guide = normalized([
|
|
8884
|
+
capability.guide.summary,
|
|
8885
|
+
capability.guide.useWhen,
|
|
8886
|
+
...capability.guide.preconditions,
|
|
8887
|
+
...capability.guide.input.map((field) => `${field.name} ${field.meaning}`),
|
|
8888
|
+
...capability.guide.output.map((field) => `${field.name} ${field.meaning}`),
|
|
8889
|
+
...capability.guide.next
|
|
8890
|
+
].join(" "));
|
|
8891
|
+
const terms = query.split(" ").filter((term) => term !== "");
|
|
8892
|
+
let score = id.startsWith(query) ? ID_PREFIX_SCORE : NO_MATCH_SCORE;
|
|
8893
|
+
for (const term of terms) {
|
|
8894
|
+
if (idSegments.has(term)) score += ID_SEGMENT_SCORE;
|
|
8895
|
+
else if (id.includes(term)) score += ID_SUBSTRING_SCORE;
|
|
8896
|
+
if (guide.includes(term)) score += GUIDE_MATCH_SCORE;
|
|
8897
|
+
}
|
|
8898
|
+
return score;
|
|
8899
|
+
};
|
|
8900
|
+
const exampleFor = (capability) => {
|
|
8901
|
+
const example = capability.guide.examples[0];
|
|
8902
|
+
if (example === void 0) throw new TypeError(`${capability.id} has no capability example`);
|
|
8903
|
+
return example;
|
|
8904
|
+
};
|
|
8905
|
+
const toContract = (capability) => ({
|
|
8906
|
+
id: capability.id,
|
|
8907
|
+
operation: capability.operation,
|
|
8908
|
+
effect: capability.effect,
|
|
8909
|
+
idempotency: capability.idempotency,
|
|
8910
|
+
summary: capability.guide.summary,
|
|
8911
|
+
useWhen: capability.guide.useWhen,
|
|
8912
|
+
preconditions: capability.guide.preconditions,
|
|
8913
|
+
inputSchema: z.toJSONSchema(capability.inputSchema, { unrepresentable: "any" }),
|
|
8914
|
+
exampleInput: exampleFor(capability).input,
|
|
8915
|
+
output: capability.guide.output,
|
|
8916
|
+
result: capability.guide.result,
|
|
8917
|
+
recovery: capability.guide.recovery,
|
|
8918
|
+
next: capability.guide.next,
|
|
8919
|
+
schemaDigest: capability.schemaDigest,
|
|
8920
|
+
guidanceDigest: capability.guidanceDigest,
|
|
8921
|
+
behaviorDigest: capability.behaviorDigest
|
|
8922
|
+
});
|
|
8923
|
+
const toBrief = (capability) => ({
|
|
8924
|
+
id: capability.id,
|
|
8925
|
+
operation: capability.operation,
|
|
8926
|
+
effect: capability.effect,
|
|
8927
|
+
summary: capability.guide.summary,
|
|
8928
|
+
useWhen: capability.guide.useWhen
|
|
8929
|
+
});
|
|
8930
|
+
const createMcpCapabilityDiscoveryAdapter = (catalog) => ({
|
|
8931
|
+
search: (input) => {
|
|
8932
|
+
const ranked = catalog.filter((capability) => input.operation === "any" || capability.operation === input.operation).map((capability) => ({
|
|
8933
|
+
capability,
|
|
8934
|
+
score: scoreFor(capability, input.query)
|
|
8935
|
+
})).filter((candidate) => candidate.score > NO_MATCH_SCORE).toSorted((left, right) => {
|
|
8936
|
+
const scoreDifference = right.score - left.score;
|
|
8937
|
+
return scoreDifference === NO_MATCH_SCORE ? left.capability.id.localeCompare(right.capability.id) : scoreDifference;
|
|
8938
|
+
});
|
|
8939
|
+
return {
|
|
8940
|
+
matches: ranked.slice(0, input.limit).map(({ capability }) => toBrief(capability)),
|
|
8941
|
+
totalMatches: ranked.length,
|
|
8942
|
+
truncated: ranked.length > input.limit
|
|
8943
|
+
};
|
|
8944
|
+
},
|
|
8945
|
+
describe: (id) => {
|
|
8946
|
+
const capability = catalog.find((candidate) => candidate.id === id);
|
|
8947
|
+
return capability === void 0 ? null : toContract(capability);
|
|
8948
|
+
}
|
|
8949
|
+
});
|
|
8950
|
+
|
|
8951
|
+
//#endregion
|
|
8952
|
+
//#region src/infrastructure/shared-capabilities.mapper.ts
|
|
8953
|
+
const toPresentedCapabilities = (catalog, exposures) => catalog.filter((capability) => exposures.includes(capability.policy.exposure));
|
|
8954
|
+
const toSharedCapabilities = (catalog) => toPresentedCapabilities(catalog, ["shared"]);
|
|
8955
|
+
|
|
8156
8956
|
//#endregion
|
|
8157
8957
|
//#region src/infrastructure/failure.mapper.ts
|
|
8158
8958
|
const MALFORMED_EXIT = 2;
|
|
@@ -8182,33 +8982,26 @@ const appErrorFrom = (error) => {
|
|
|
8182
8982
|
const parsed = trpcErrorSchema.safeParse(error);
|
|
8183
8983
|
return appErrorSchema.safeParse(parsed.success ? parsed.data.data.appError : null);
|
|
8184
8984
|
};
|
|
8985
|
+
const failureFields = (fields) => fields === void 0 ? {} : { fields: Object.entries(fields).toSorted(([left], [right]) => left.localeCompare(right)).map(([path, message]) => ({
|
|
8986
|
+
path,
|
|
8987
|
+
message
|
|
8988
|
+
})) };
|
|
8185
8989
|
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
|
-
}
|
|
8990
|
+
if (error instanceof CliError) return {
|
|
8991
|
+
code: error.code,
|
|
8992
|
+
message: error.message,
|
|
8993
|
+
remediation: error.remediation,
|
|
8994
|
+
...failureFields(error.fields)
|
|
8995
|
+
};
|
|
8198
8996
|
if (error instanceof TRPCClientError) {
|
|
8997
|
+
if (error.cause instanceof CliError) return toFailurePayload(error.cause, parserMessage);
|
|
8199
8998
|
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
|
-
}
|
|
8999
|
+
if (parsed.success) return {
|
|
9000
|
+
code: parsed.data.code,
|
|
9001
|
+
message: parsed.data.message,
|
|
9002
|
+
remediation: remediationFor(parsed.data.code),
|
|
9003
|
+
...failureFields(parsed.data.fields)
|
|
9004
|
+
};
|
|
8212
9005
|
}
|
|
8213
9006
|
if (error instanceof ProcessExitError) {
|
|
8214
9007
|
const message = parserMessage?.trim();
|
|
@@ -8232,5 +9025,32 @@ const toExitCode = (failure, isMalformed, error) => {
|
|
|
8232
9025
|
if (REFUSALS.has(failure.code)) return REFUSED_EXIT;
|
|
8233
9026
|
return 1;
|
|
8234
9027
|
};
|
|
9028
|
+
|
|
9029
|
+
//#endregion
|
|
9030
|
+
//#region src/infrastructure/cli-output-identity.lib.ts
|
|
9031
|
+
const commandReferencePattern = /(?<![-\w@])enhance(?=(?:-mcp)?(?:[^-\w]|$))/gu;
|
|
9032
|
+
const withCommandInText = (value, commandName) => value.replaceAll(commandReferencePattern, () => commandName);
|
|
9033
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9034
|
+
const withCommandInstruction = (value, commandName) => {
|
|
9035
|
+
if (typeof value === "string") return withCommandInText(value, commandName);
|
|
9036
|
+
if (Array.isArray(value)) return value.map((entry) => withCommandInstruction(entry, commandName));
|
|
9037
|
+
if (!isObject(value)) return value;
|
|
9038
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, withCommandInstruction(entry, commandName)]));
|
|
9039
|
+
};
|
|
9040
|
+
const withCommandName = (value, commandName) => {
|
|
9041
|
+
if (typeof value === "string") return withCommandInText(value, commandName);
|
|
9042
|
+
if (!isObject(value)) return value;
|
|
9043
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, key === "next" ? withCommandInstruction(entry, commandName) : entry]));
|
|
9044
|
+
};
|
|
9045
|
+
const withCommandInFailure = (value, commandName) => ({
|
|
9046
|
+
...value,
|
|
9047
|
+
message: withCommandInText(value.message, commandName),
|
|
9048
|
+
remediation: withCommandInText(value.remediation, commandName),
|
|
9049
|
+
...value.fields !== void 0 && { fields: value.fields.map((field) => ({
|
|
9050
|
+
...field,
|
|
9051
|
+
message: withCommandInText(field.message, commandName)
|
|
9052
|
+
})) }
|
|
9053
|
+
});
|
|
9054
|
+
|
|
8235
9055
|
//#endregion
|
|
8236
|
-
export {
|
|
9056
|
+
export { createCanvasConversionOutputSchema as $, startRecordingOutputSchema as A, getMeOutputSchema as B, CliError as C, createScreenOutputSchema as D, completeScreenOutputSchema as E, getPrototypeArtifactCapabilitiesOutputSchema as F, beginCanvasActivityOutputSchema as G, cliAuthConfigurationSchema as H, getPrototypePublishStatusOutputSchema as I, applyCanvasOperationsOutputSchema as J, canvasAgentActivityPhaseSchema as K, prototypeArtifactManifestSchema as L, attachPrototypeArtifactOutputSchema as M, createPrototypeArtifactOutputSchema as N, appendRecordingChunkOutputSchema as O, foldPrototypeArtifactPath as P, saveCanvasDocumentOutputSchema as Q, prototypeArtifactPathSchema as R, PartialBatchError as S, appErrorSchema as T, createAgentTokenOutputSchema as U, MCP_AUTH_SCOPE as V, createOrganisationOutputSchema as W, canvasNodeStylePatchSchema as X, canvasOperationSchema as Y, getCanvasDocumentOutputSchema as Z, canvasWriteHtmlCapabilityInputSchema as _, toPresentedCapabilities as a, downloadCanvasRenderOutputSchema as at, recordingSnapshotCapabilityInputSchema as b, ProcessExitError as c, canvasSchema as ct, createCapabilityPolicyAdapter as d, getCanvasConversionOutputSchema as et, toCapabilityDefinition as f, canvasRenderCapabilityInputSchema as g, canvasApplyCapabilityInputSchema as h, toFailurePayload as i, createRecordingSnapshotOutputSchema as it, PROTOTYPE_ARTIFACT_MANIFEST_PATH as j, completeRecordingOutputSchema as k, createCapabilityCatalogAdapter as l, PROCEDURE_DESCRIPTIONS as m, withCommandName as n, canvasWorldBoundsSchema as nt, toSharedCapabilities as o, getCanvasRenderOutputSchema as ot, OPTION_DESCRIPTIONS as p, MAX_CANVAS_OPERATIONS as q, toExitCode as r, createCanvasRenderOutputSchema as rt, createMcpCapabilityDiscoveryAdapter as s, canvasSceneDocumentSchema as st, withCommandInFailure as t, RENDER_MIN_SCALE as tt, createRouterShapeAdapter as u, commentAttentionCapabilityInputSchema as v, transcriptOutputSchema as w, transcriptReadCapabilityInputSchema as x, prototypePublishCapabilityInputSchema as y, submitPrototypeArtifactOutputSchema as z };
|