@cappa/protocol 0.9.0
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/LICENSE +21 -0
- package/dist/index.cjs +498 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +751 -0
- package/dist/index.d.ts +751 -0
- package/dist/index.js +458 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/screenshot.ts
|
|
3
|
+
/**
|
|
4
|
+
* Screenshot shapes as they cross the wire.
|
|
5
|
+
*
|
|
6
|
+
* These mirror the types in `@cappa/core`, but are declared independently on
|
|
7
|
+
* purpose: this package must stay installable by a browser client that has no
|
|
8
|
+
* business pulling in `playwright-core` or native diff bindings. A type-level
|
|
9
|
+
* compatibility assertion in `screenshot.test.ts` fails the build if the two
|
|
10
|
+
* definitions drift apart.
|
|
11
|
+
*/
|
|
12
|
+
const screenshotCategorySchema = z.enum([
|
|
13
|
+
"new",
|
|
14
|
+
"deleted",
|
|
15
|
+
"changed",
|
|
16
|
+
"passed"
|
|
17
|
+
]);
|
|
18
|
+
const diffMetadataSchema = z.object({
|
|
19
|
+
numDiffPixels: z.number(),
|
|
20
|
+
percentDifference: z.number(),
|
|
21
|
+
/**
|
|
22
|
+
* Structured diff interpretation, carried opaquely.
|
|
23
|
+
*
|
|
24
|
+
* Its shape is owned by the diff engine (`@blazediff/core-native`'s
|
|
25
|
+
* `InterpretResult`) and changes with that dependency. Pinning it here would
|
|
26
|
+
* make every diff-engine upgrade a breaking protocol change for no benefit,
|
|
27
|
+
* so the protocol passes it through untouched and consumers that want to
|
|
28
|
+
* render the detail narrow it with `InterpretResult` from `@cappa/core`.
|
|
29
|
+
*/
|
|
30
|
+
interpretation: z.unknown().optional()
|
|
31
|
+
});
|
|
32
|
+
const screenshotBase = {
|
|
33
|
+
id: z.string(),
|
|
34
|
+
name: z.string(),
|
|
35
|
+
approved: z.boolean().optional(),
|
|
36
|
+
/**
|
|
37
|
+
* The capture task that produced this screenshot.
|
|
38
|
+
*
|
|
39
|
+
* Described here because it is the only way a client can re-capture one
|
|
40
|
+
* screenshot: `startRun` accepts task ids, and a screenshot's `name` is not
|
|
41
|
+
* one — Storybook writes `example/button/primary` for the task
|
|
42
|
+
* `example-button--primary`. Optional because the engine can only know it for
|
|
43
|
+
* screenshots captured since the capture manifest existed, so a client must
|
|
44
|
+
* treat its absence as "not re-capturable" rather than substituting `name`.
|
|
45
|
+
*/
|
|
46
|
+
taskId: z.string().optional(),
|
|
47
|
+
/** Plugin that owns `taskId`. Absent whenever `taskId` is. */
|
|
48
|
+
plugin: z.string().optional(),
|
|
49
|
+
/**
|
|
50
|
+
* Neighbours in the full, unfiltered list, so the UI can walk every
|
|
51
|
+
* screenshot with the arrow keys regardless of the current filter.
|
|
52
|
+
*
|
|
53
|
+
* Computed by the server rather than the engine — but they must be described
|
|
54
|
+
* here, or a client parsing a response would silently drop them.
|
|
55
|
+
*/
|
|
56
|
+
next: z.string().optional(),
|
|
57
|
+
prev: z.string().optional()
|
|
58
|
+
};
|
|
59
|
+
const newScreenshotSchema = z.object({
|
|
60
|
+
...screenshotBase,
|
|
61
|
+
category: z.literal("new"),
|
|
62
|
+
actualPath: z.string()
|
|
63
|
+
});
|
|
64
|
+
const deletedScreenshotSchema = z.object({
|
|
65
|
+
...screenshotBase,
|
|
66
|
+
category: z.literal("deleted"),
|
|
67
|
+
expectedPath: z.string()
|
|
68
|
+
});
|
|
69
|
+
const changedScreenshotSchema = z.object({
|
|
70
|
+
...screenshotBase,
|
|
71
|
+
category: z.literal("changed"),
|
|
72
|
+
actualPath: z.string(),
|
|
73
|
+
expectedPath: z.string(),
|
|
74
|
+
diffPath: z.string(),
|
|
75
|
+
diffMeta: diffMetadataSchema.optional()
|
|
76
|
+
});
|
|
77
|
+
const passedScreenshotSchema = z.object({
|
|
78
|
+
...screenshotBase,
|
|
79
|
+
category: z.literal("passed"),
|
|
80
|
+
actualPath: z.string(),
|
|
81
|
+
expectedPath: z.string()
|
|
82
|
+
});
|
|
83
|
+
const screenshotSchema = z.discriminatedUnion("category", [
|
|
84
|
+
newScreenshotSchema,
|
|
85
|
+
deletedScreenshotSchema,
|
|
86
|
+
changedScreenshotSchema,
|
|
87
|
+
passedScreenshotSchema
|
|
88
|
+
]);
|
|
89
|
+
const screenshotQuerySchema = z.object({
|
|
90
|
+
search: z.string().optional(),
|
|
91
|
+
category: screenshotCategorySchema.optional()
|
|
92
|
+
});
|
|
93
|
+
const approveRequestSchema = z.object({ names: z.array(z.string()).min(1, "names must be a non-empty array") });
|
|
94
|
+
const approveResultSchema = z.object({
|
|
95
|
+
approved: z.array(z.string()),
|
|
96
|
+
errors: z.array(z.object({
|
|
97
|
+
name: z.string(),
|
|
98
|
+
error: z.string()
|
|
99
|
+
}))
|
|
100
|
+
});
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/routes.ts
|
|
103
|
+
/**
|
|
104
|
+
* Bumped whenever the wire contract changes incompatibly.
|
|
105
|
+
*
|
|
106
|
+
* Served on `GET /api/health` and checked by `@cappa/client` on its first call,
|
|
107
|
+
* so a client built against an older server fails with a clear message instead
|
|
108
|
+
* of mis-parsing responses.
|
|
109
|
+
*/
|
|
110
|
+
const PROTOCOL_VERSION = 1;
|
|
111
|
+
/** Capabilities a server advertises, so a client can hide what is unavailable. */
|
|
112
|
+
const capabilitiesSchema = z.object({
|
|
113
|
+
/** Capture routes are mounted (false when the server is read-only). */
|
|
114
|
+
capture: z.boolean(),
|
|
115
|
+
/** Screenshots can be approved. */
|
|
116
|
+
approve: z.boolean(),
|
|
117
|
+
/** The run event stream is available. */
|
|
118
|
+
events: z.boolean(),
|
|
119
|
+
/**
|
|
120
|
+
* The server can watch its own filesystem and re-capture on change.
|
|
121
|
+
*
|
|
122
|
+
* Optional so a client built against this version still parses an older
|
|
123
|
+
* server's health response, which has no such field. Absent means no.
|
|
124
|
+
*/
|
|
125
|
+
watch: z.boolean().optional()
|
|
126
|
+
});
|
|
127
|
+
const healthResponseSchema = z.object({
|
|
128
|
+
ok: z.boolean(),
|
|
129
|
+
protocolVersion: z.number(),
|
|
130
|
+
capabilities: capabilitiesSchema
|
|
131
|
+
});
|
|
132
|
+
const configResponseSchema = z.object({
|
|
133
|
+
theme: z.enum(["light", "dark"]),
|
|
134
|
+
readOnly: z.boolean()
|
|
135
|
+
});
|
|
136
|
+
const startRunResponseSchema = z.object({ runId: z.string() });
|
|
137
|
+
/**
|
|
138
|
+
* Machine-readable codes on error responses.
|
|
139
|
+
*
|
|
140
|
+
* Kept here, in the wire contract, rather than derived from `@cappa/core`'s
|
|
141
|
+
* error classes: a client must be able to tell a conflict from a validation
|
|
142
|
+
* failure without installing the engine. `@cappa/core` mirrors these values and
|
|
143
|
+
* a compatibility assertion there fails the build if they drift.
|
|
144
|
+
*/
|
|
145
|
+
const ERROR_CODES = {
|
|
146
|
+
runInProgress: "CAPPA_RUN_IN_PROGRESS",
|
|
147
|
+
unknownTargets: "CAPPA_UNKNOWN_TARGETS",
|
|
148
|
+
watchInProgress: "CAPPA_WATCH_IN_PROGRESS"
|
|
149
|
+
};
|
|
150
|
+
const errorResponseSchema = z.object({
|
|
151
|
+
error: z.unknown(),
|
|
152
|
+
code: z.string().optional(),
|
|
153
|
+
activeRunId: z.string().optional(),
|
|
154
|
+
taskIds: z.array(z.string()).optional()
|
|
155
|
+
});
|
|
156
|
+
/** Every route the server exposes, in one place. */
|
|
157
|
+
const routes = {
|
|
158
|
+
health: "/api/health",
|
|
159
|
+
config: "/api/config",
|
|
160
|
+
plugins: "/api/plugins",
|
|
161
|
+
targets: "/api/targets",
|
|
162
|
+
runs: "/api/runs",
|
|
163
|
+
run: (id) => `/api/runs/${encodeURIComponent(id)}`,
|
|
164
|
+
runCancel: (id) => `/api/runs/${encodeURIComponent(id)}/cancel`,
|
|
165
|
+
runEvents: (id) => `/api/runs/${encodeURIComponent(id)}/events`,
|
|
166
|
+
screenshots: "/api/screenshots",
|
|
167
|
+
screenshot: (id) => `/api/screenshots/${encodeURIComponent(id)}`,
|
|
168
|
+
approveBatch: "/api/screenshots/approve-batch",
|
|
169
|
+
watch: "/api/watch",
|
|
170
|
+
watchEvents: "/api/watch/events"
|
|
171
|
+
};
|
|
172
|
+
/** Prefix under which screenshot images are served. */
|
|
173
|
+
const ASSET_PREFIX = "/assets/screenshots";
|
|
174
|
+
/** Header carrying the access token when the server is not on loopback. */
|
|
175
|
+
const TOKEN_HEADER = "x-cappa-token";
|
|
176
|
+
const targetsQuerySchema = z.object({ refresh: z.union([
|
|
177
|
+
z.literal("1"),
|
|
178
|
+
z.literal("true"),
|
|
179
|
+
z.literal("0"),
|
|
180
|
+
z.literal("false")
|
|
181
|
+
]).optional() });
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/run.ts
|
|
184
|
+
const runStateSchema = z.enum([
|
|
185
|
+
"idle",
|
|
186
|
+
"discovering",
|
|
187
|
+
"running",
|
|
188
|
+
"completed",
|
|
189
|
+
"failed",
|
|
190
|
+
"cancelled"
|
|
191
|
+
]);
|
|
192
|
+
const taskStatusSchema = z.enum([
|
|
193
|
+
"pending",
|
|
194
|
+
"running",
|
|
195
|
+
"passed",
|
|
196
|
+
"changed",
|
|
197
|
+
"new",
|
|
198
|
+
"failed",
|
|
199
|
+
"skipped"
|
|
200
|
+
]);
|
|
201
|
+
const targetSchema = z.object({
|
|
202
|
+
id: z.string(),
|
|
203
|
+
url: z.string(),
|
|
204
|
+
plugin: z.string()
|
|
205
|
+
});
|
|
206
|
+
const pluginInfoSchema = z.object({
|
|
207
|
+
name: z.string(),
|
|
208
|
+
description: z.string().optional()
|
|
209
|
+
});
|
|
210
|
+
/**
|
|
211
|
+
* Why a run started, when a person did not start it.
|
|
212
|
+
*
|
|
213
|
+
* Carried on the request rather than as a separate lookup, so a run list can
|
|
214
|
+
* say "this one came from saving Button.stories.tsx" from what it already has.
|
|
215
|
+
*/
|
|
216
|
+
const runTriggerSchema = z.object({
|
|
217
|
+
source: z.literal("watch"),
|
|
218
|
+
files: z.array(z.string())
|
|
219
|
+
});
|
|
220
|
+
const startRunRequestSchema = z.object({
|
|
221
|
+
plugins: z.array(z.string()).optional(),
|
|
222
|
+
filter: z.string().optional(),
|
|
223
|
+
taskIds: z.array(z.string()).optional(),
|
|
224
|
+
clearActual: z.boolean().optional(),
|
|
225
|
+
trigger: runTriggerSchema.optional()
|
|
226
|
+
});
|
|
227
|
+
const serializedErrorSchema = z.object({
|
|
228
|
+
name: z.string(),
|
|
229
|
+
message: z.string(),
|
|
230
|
+
stack: z.string().optional()
|
|
231
|
+
});
|
|
232
|
+
/**
|
|
233
|
+
* A plugin's `execute` return value.
|
|
234
|
+
*
|
|
235
|
+
* Only the keys the runner interprets are named; plugins are free to return
|
|
236
|
+
* more, so unknown keys pass through.
|
|
237
|
+
*/
|
|
238
|
+
const pluginCaptureResultSchema = z.looseObject({
|
|
239
|
+
success: z.boolean().optional(),
|
|
240
|
+
skipped: z.boolean().optional(),
|
|
241
|
+
isNew: z.boolean().optional(),
|
|
242
|
+
error: z.unknown().optional(),
|
|
243
|
+
filepath: z.string().optional(),
|
|
244
|
+
storyId: z.string().optional(),
|
|
245
|
+
storyName: z.string().optional()
|
|
246
|
+
});
|
|
247
|
+
const taskFailureSchema = z.object({
|
|
248
|
+
taskId: z.string(),
|
|
249
|
+
taskUrl: z.string(),
|
|
250
|
+
pluginName: z.string(),
|
|
251
|
+
result: pluginCaptureResultSchema
|
|
252
|
+
});
|
|
253
|
+
const taskRecordSchema = z.object({
|
|
254
|
+
id: z.string(),
|
|
255
|
+
url: z.string(),
|
|
256
|
+
plugin: z.string(),
|
|
257
|
+
status: taskStatusSchema,
|
|
258
|
+
durationMs: z.number().optional(),
|
|
259
|
+
result: pluginCaptureResultSchema.optional()
|
|
260
|
+
});
|
|
261
|
+
const runSummarySchema = z.object({
|
|
262
|
+
id: z.string(),
|
|
263
|
+
state: runStateSchema,
|
|
264
|
+
request: startRunRequestSchema,
|
|
265
|
+
startedAt: z.number(),
|
|
266
|
+
finishedAt: z.number().optional(),
|
|
267
|
+
durationMs: z.number().optional(),
|
|
268
|
+
totalTasks: z.number(),
|
|
269
|
+
completedTasks: z.number(),
|
|
270
|
+
failedTasks: z.number(),
|
|
271
|
+
deletedScreenshots: z.array(z.string()),
|
|
272
|
+
anyTasksRan: z.boolean(),
|
|
273
|
+
error: serializedErrorSchema.optional()
|
|
274
|
+
});
|
|
275
|
+
const runDetailSchema = runSummarySchema.extend({
|
|
276
|
+
tasks: z.array(taskRecordSchema),
|
|
277
|
+
failures: z.array(taskFailureSchema)
|
|
278
|
+
});
|
|
279
|
+
const runLogLevelSchema = z.enum([
|
|
280
|
+
"debug",
|
|
281
|
+
"info",
|
|
282
|
+
"warn",
|
|
283
|
+
"error",
|
|
284
|
+
"success"
|
|
285
|
+
]);
|
|
286
|
+
const eventBase = {
|
|
287
|
+
seq: z.number(),
|
|
288
|
+
runId: z.string(),
|
|
289
|
+
at: z.number()
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* The run event stream, exactly as `@cappa/core`'s `CaptureRunner` emits it.
|
|
293
|
+
*
|
|
294
|
+
* `seq` is monotonic and 1-based per run; the SSE endpoint uses it as the
|
|
295
|
+
* `Last-Event-ID` so a reconnecting client can replay what it missed.
|
|
296
|
+
*/
|
|
297
|
+
const runEventSchema = z.discriminatedUnion("type", [
|
|
298
|
+
z.object({
|
|
299
|
+
...eventBase,
|
|
300
|
+
type: z.literal("run:start"),
|
|
301
|
+
request: startRunRequestSchema
|
|
302
|
+
}),
|
|
303
|
+
z.object({
|
|
304
|
+
...eventBase,
|
|
305
|
+
type: z.literal("discover:start"),
|
|
306
|
+
plugins: z.array(z.string())
|
|
307
|
+
}),
|
|
308
|
+
z.object({
|
|
309
|
+
...eventBase,
|
|
310
|
+
type: z.literal("discover:plugin"),
|
|
311
|
+
plugin: z.string(),
|
|
312
|
+
taskCount: z.number()
|
|
313
|
+
}),
|
|
314
|
+
z.object({
|
|
315
|
+
...eventBase,
|
|
316
|
+
type: z.literal("discover:complete"),
|
|
317
|
+
targets: z.array(targetSchema),
|
|
318
|
+
totalTasks: z.number()
|
|
319
|
+
}),
|
|
320
|
+
z.object({
|
|
321
|
+
...eventBase,
|
|
322
|
+
type: z.literal("filter:applied"),
|
|
323
|
+
filter: z.string().optional(),
|
|
324
|
+
taskIds: z.array(z.string()).optional(),
|
|
325
|
+
plugins: z.array(z.object({
|
|
326
|
+
plugin: z.string(),
|
|
327
|
+
before: z.number(),
|
|
328
|
+
after: z.number()
|
|
329
|
+
}))
|
|
330
|
+
}),
|
|
331
|
+
z.object({
|
|
332
|
+
...eventBase,
|
|
333
|
+
type: z.literal("plugin:start"),
|
|
334
|
+
plugin: z.string(),
|
|
335
|
+
taskCount: z.number()
|
|
336
|
+
}),
|
|
337
|
+
z.object({
|
|
338
|
+
...eventBase,
|
|
339
|
+
type: z.literal("task:start"),
|
|
340
|
+
plugin: z.string(),
|
|
341
|
+
taskId: z.string(),
|
|
342
|
+
url: z.string()
|
|
343
|
+
}),
|
|
344
|
+
z.object({
|
|
345
|
+
...eventBase,
|
|
346
|
+
type: z.literal("task:complete"),
|
|
347
|
+
plugin: z.string(),
|
|
348
|
+
taskId: z.string(),
|
|
349
|
+
url: z.string(),
|
|
350
|
+
status: taskStatusSchema,
|
|
351
|
+
completed: z.number(),
|
|
352
|
+
total: z.number(),
|
|
353
|
+
durationMs: z.number(),
|
|
354
|
+
result: pluginCaptureResultSchema.optional()
|
|
355
|
+
}),
|
|
356
|
+
z.object({
|
|
357
|
+
...eventBase,
|
|
358
|
+
type: z.literal("plugin:complete"),
|
|
359
|
+
plugin: z.string(),
|
|
360
|
+
resultCount: z.number(),
|
|
361
|
+
failed: z.boolean()
|
|
362
|
+
}),
|
|
363
|
+
z.object({
|
|
364
|
+
...eventBase,
|
|
365
|
+
type: z.literal("log"),
|
|
366
|
+
level: runLogLevelSchema,
|
|
367
|
+
message: z.string(),
|
|
368
|
+
args: z.array(z.unknown())
|
|
369
|
+
}),
|
|
370
|
+
z.object({
|
|
371
|
+
...eventBase,
|
|
372
|
+
type: z.literal("run:complete"),
|
|
373
|
+
summary: runSummarySchema
|
|
374
|
+
}),
|
|
375
|
+
z.object({
|
|
376
|
+
...eventBase,
|
|
377
|
+
type: z.literal("run:error"),
|
|
378
|
+
error: serializedErrorSchema
|
|
379
|
+
}),
|
|
380
|
+
z.object({
|
|
381
|
+
...eventBase,
|
|
382
|
+
type: z.literal("run:cancelled")
|
|
383
|
+
})
|
|
384
|
+
]);
|
|
385
|
+
/**
|
|
386
|
+
* How a watch iteration decided what to capture.
|
|
387
|
+
*
|
|
388
|
+
* `tasks` is the precise case; `plugins` means at least one plugin could not
|
|
389
|
+
* attribute the change; `all` means the resolved set was too large or discovery
|
|
390
|
+
* failed; `none` means there was nothing to capture.
|
|
391
|
+
*/
|
|
392
|
+
const watchScopeSchema = z.enum([
|
|
393
|
+
"tasks",
|
|
394
|
+
"plugins",
|
|
395
|
+
"all",
|
|
396
|
+
"none"
|
|
397
|
+
]);
|
|
398
|
+
const watchChangeSchema = z.object({
|
|
399
|
+
files: z.array(z.string()),
|
|
400
|
+
scope: watchScopeSchema,
|
|
401
|
+
taskIds: z.array(z.string()).optional(),
|
|
402
|
+
runId: z.string().optional(),
|
|
403
|
+
error: z.string().optional(),
|
|
404
|
+
at: z.number()
|
|
405
|
+
});
|
|
406
|
+
const watchEventBase = {
|
|
407
|
+
/** Monotonic, 1-based, per server. Used for SSE `Last-Event-ID` replay. */
|
|
408
|
+
seq: z.number(),
|
|
409
|
+
at: z.number()
|
|
410
|
+
};
|
|
411
|
+
/**
|
|
412
|
+
* The watch event stream, exactly as `@cappa/core`'s engine emits it.
|
|
413
|
+
*
|
|
414
|
+
* Separate from `runEventSchema` because a watch session outlives any single
|
|
415
|
+
* run: the runs it starts report themselves on the ordinary run stream, and
|
|
416
|
+
* these events say why they started.
|
|
417
|
+
*/
|
|
418
|
+
const watchEventSchema = z.discriminatedUnion("type", [
|
|
419
|
+
z.object({
|
|
420
|
+
...watchEventBase,
|
|
421
|
+
type: z.literal("watch:start"),
|
|
422
|
+
paths: z.array(z.string()),
|
|
423
|
+
filter: z.string().optional(),
|
|
424
|
+
debounceMs: z.number()
|
|
425
|
+
}),
|
|
426
|
+
z.object({
|
|
427
|
+
...watchEventBase,
|
|
428
|
+
type: z.literal("watch:change"),
|
|
429
|
+
files: z.array(z.string()),
|
|
430
|
+
scope: watchScopeSchema,
|
|
431
|
+
taskIds: z.array(z.string()).optional(),
|
|
432
|
+
runId: z.string().optional(),
|
|
433
|
+
error: z.string().optional()
|
|
434
|
+
}),
|
|
435
|
+
z.object({
|
|
436
|
+
...watchEventBase,
|
|
437
|
+
type: z.literal("watch:stop"),
|
|
438
|
+
reason: z.enum(["requested", "engine-closed"])
|
|
439
|
+
})
|
|
440
|
+
]);
|
|
441
|
+
const watchStatusSchema = z.object({
|
|
442
|
+
active: z.boolean(),
|
|
443
|
+
paths: z.array(z.string()),
|
|
444
|
+
filter: z.string().optional(),
|
|
445
|
+
debounceMs: z.number(),
|
|
446
|
+
startedAt: z.number().optional(),
|
|
447
|
+
lastChange: watchChangeSchema.optional()
|
|
448
|
+
});
|
|
449
|
+
const startWatchRequestSchema = z.object({
|
|
450
|
+
paths: z.array(z.string()).optional(),
|
|
451
|
+
filter: z.string().optional(),
|
|
452
|
+
debounceMs: z.number().optional(),
|
|
453
|
+
maxTasks: z.number().optional()
|
|
454
|
+
});
|
|
455
|
+
//#endregion
|
|
456
|
+
export { ASSET_PREFIX, ERROR_CODES, PROTOCOL_VERSION, TOKEN_HEADER, approveRequestSchema, approveResultSchema, capabilitiesSchema, changedScreenshotSchema, configResponseSchema, deletedScreenshotSchema, diffMetadataSchema, errorResponseSchema, healthResponseSchema, newScreenshotSchema, passedScreenshotSchema, pluginCaptureResultSchema, pluginInfoSchema, routes, runDetailSchema, runEventSchema, runLogLevelSchema, runStateSchema, runSummarySchema, runTriggerSchema, screenshotCategorySchema, screenshotQuerySchema, screenshotSchema, serializedErrorSchema, startRunRequestSchema, startRunResponseSchema, startWatchRequestSchema, targetSchema, targetsQuerySchema, taskFailureSchema, taskRecordSchema, taskStatusSchema, watchChangeSchema, watchEventSchema, watchScopeSchema, watchStatusSchema };
|
|
457
|
+
|
|
458
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/screenshot.ts","../src/routes.ts","../src/run.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Screenshot shapes as they cross the wire.\n *\n * These mirror the types in `@cappa/core`, but are declared independently on\n * purpose: this package must stay installable by a browser client that has no\n * business pulling in `playwright-core` or native diff bindings. A type-level\n * compatibility assertion in `screenshot.test.ts` fails the build if the two\n * definitions drift apart.\n */\n\nexport const screenshotCategorySchema = z.enum([\n \"new\",\n \"deleted\",\n \"changed\",\n \"passed\",\n]);\n\nexport type ScreenshotCategory = z.infer<typeof screenshotCategorySchema>;\n\nexport const diffMetadataSchema = z.object({\n numDiffPixels: z.number(),\n percentDifference: z.number(),\n /**\n * Structured diff interpretation, carried opaquely.\n *\n * Its shape is owned by the diff engine (`@blazediff/core-native`'s\n * `InterpretResult`) and changes with that dependency. Pinning it here would\n * make every diff-engine upgrade a breaking protocol change for no benefit,\n * so the protocol passes it through untouched and consumers that want to\n * render the detail narrow it with `InterpretResult` from `@cappa/core`.\n */\n interpretation: z.unknown().optional(),\n});\n\nexport type DiffMetadata = z.infer<typeof diffMetadataSchema>;\n\nconst screenshotBase = {\n id: z.string(),\n name: z.string(),\n approved: z.boolean().optional(),\n /**\n * The capture task that produced this screenshot.\n *\n * Described here because it is the only way a client can re-capture one\n * screenshot: `startRun` accepts task ids, and a screenshot's `name` is not\n * one — Storybook writes `example/button/primary` for the task\n * `example-button--primary`. Optional because the engine can only know it for\n * screenshots captured since the capture manifest existed, so a client must\n * treat its absence as \"not re-capturable\" rather than substituting `name`.\n */\n taskId: z.string().optional(),\n /** Plugin that owns `taskId`. Absent whenever `taskId` is. */\n plugin: z.string().optional(),\n /**\n * Neighbours in the full, unfiltered list, so the UI can walk every\n * screenshot with the arrow keys regardless of the current filter.\n *\n * Computed by the server rather than the engine — but they must be described\n * here, or a client parsing a response would silently drop them.\n */\n next: z.string().optional(),\n prev: z.string().optional(),\n};\n\nexport const newScreenshotSchema = z.object({\n ...screenshotBase,\n category: z.literal(\"new\"),\n actualPath: z.string(),\n});\n\nexport const deletedScreenshotSchema = z.object({\n ...screenshotBase,\n category: z.literal(\"deleted\"),\n expectedPath: z.string(),\n});\n\nexport const changedScreenshotSchema = z.object({\n ...screenshotBase,\n category: z.literal(\"changed\"),\n actualPath: z.string(),\n expectedPath: z.string(),\n diffPath: z.string(),\n diffMeta: diffMetadataSchema.optional(),\n});\n\nexport const passedScreenshotSchema = z.object({\n ...screenshotBase,\n category: z.literal(\"passed\"),\n actualPath: z.string(),\n expectedPath: z.string(),\n});\n\n/**\n * The changed variant on its own.\n *\n * Exported because the review UI's comparison views only ever render a changed\n * screenshot, and typing them on the full union would force a narrow at every\n * call site.\n */\nexport type ChangedScreenshot = z.infer<typeof changedScreenshotSchema>;\n\nexport const screenshotSchema = z.discriminatedUnion(\"category\", [\n newScreenshotSchema,\n deletedScreenshotSchema,\n changedScreenshotSchema,\n passedScreenshotSchema,\n]);\n\nexport type Screenshot = z.infer<typeof screenshotSchema>;\n\nexport const screenshotQuerySchema = z.object({\n search: z.string().optional(),\n category: screenshotCategorySchema.optional(),\n});\n\nexport type ScreenshotQuery = z.infer<typeof screenshotQuerySchema>;\n\nexport const approveRequestSchema = z.object({\n names: z.array(z.string()).min(1, \"names must be a non-empty array\"),\n});\n\nexport type ApproveRequest = z.infer<typeof approveRequestSchema>;\n\nexport const approveResultSchema = z.object({\n approved: z.array(z.string()),\n errors: z.array(z.object({ name: z.string(), error: z.string() })),\n});\n\nexport type ApproveResult = z.infer<typeof approveResultSchema>;\n","import { z } from \"zod\";\nimport { screenshotCategorySchema } from \"./screenshot\";\n\n/**\n * Bumped whenever the wire contract changes incompatibly.\n *\n * Served on `GET /api/health` and checked by `@cappa/client` on its first call,\n * so a client built against an older server fails with a clear message instead\n * of mis-parsing responses.\n */\nexport const PROTOCOL_VERSION = 1;\n\n/** Capabilities a server advertises, so a client can hide what is unavailable. */\nexport const capabilitiesSchema = z.object({\n /** Capture routes are mounted (false when the server is read-only). */\n capture: z.boolean(),\n /** Screenshots can be approved. */\n approve: z.boolean(),\n /** The run event stream is available. */\n events: z.boolean(),\n /**\n * The server can watch its own filesystem and re-capture on change.\n *\n * Optional so a client built against this version still parses an older\n * server's health response, which has no such field. Absent means no.\n */\n watch: z.boolean().optional(),\n});\n\nexport type Capabilities = z.infer<typeof capabilitiesSchema>;\n\nexport const healthResponseSchema = z.object({\n ok: z.boolean(),\n protocolVersion: z.number(),\n capabilities: capabilitiesSchema,\n});\n\nexport type HealthResponse = z.infer<typeof healthResponseSchema>;\n\nexport const configResponseSchema = z.object({\n theme: z.enum([\"light\", \"dark\"]),\n readOnly: z.boolean(),\n});\n\nexport type ConfigResponse = z.infer<typeof configResponseSchema>;\n\nexport const startRunResponseSchema = z.object({\n runId: z.string(),\n});\n\nexport type StartRunResponse = z.infer<typeof startRunResponseSchema>;\n\n/**\n * Machine-readable codes on error responses.\n *\n * Kept here, in the wire contract, rather than derived from `@cappa/core`'s\n * error classes: a client must be able to tell a conflict from a validation\n * failure without installing the engine. `@cappa/core` mirrors these values and\n * a compatibility assertion there fails the build if they drift.\n */\nexport const ERROR_CODES = {\n runInProgress: \"CAPPA_RUN_IN_PROGRESS\",\n unknownTargets: \"CAPPA_UNKNOWN_TARGETS\",\n watchInProgress: \"CAPPA_WATCH_IN_PROGRESS\",\n} as const;\n\nexport type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];\n\nexport const errorResponseSchema = z.object({\n error: z.unknown(),\n code: z.string().optional(),\n activeRunId: z.string().optional(),\n taskIds: z.array(z.string()).optional(),\n});\n\nexport type ErrorResponse = z.infer<typeof errorResponseSchema>;\n\n/** Every route the server exposes, in one place. */\nexport const routes = {\n health: \"/api/health\",\n config: \"/api/config\",\n plugins: \"/api/plugins\",\n targets: \"/api/targets\",\n runs: \"/api/runs\",\n run: (id: string) => `/api/runs/${encodeURIComponent(id)}`,\n runCancel: (id: string) => `/api/runs/${encodeURIComponent(id)}/cancel`,\n runEvents: (id: string) => `/api/runs/${encodeURIComponent(id)}/events`,\n screenshots: \"/api/screenshots\",\n screenshot: (id: string) => `/api/screenshots/${encodeURIComponent(id)}`,\n approveBatch: \"/api/screenshots/approve-batch\",\n watch: \"/api/watch\",\n watchEvents: \"/api/watch/events\",\n} as const;\n\n/** Prefix under which screenshot images are served. */\nexport const ASSET_PREFIX = \"/assets/screenshots\";\n\n/** Header carrying the access token when the server is not on loopback. */\nexport const TOKEN_HEADER = \"x-cappa-token\";\n\nexport const targetsQuerySchema = z.object({\n refresh: z\n .union([\n z.literal(\"1\"),\n z.literal(\"true\"),\n z.literal(\"0\"),\n z.literal(\"false\"),\n ])\n .optional(),\n});\n\nexport { screenshotCategorySchema };\n","import { z } from \"zod\";\n\nexport const runStateSchema = z.enum([\n \"idle\",\n \"discovering\",\n \"running\",\n \"completed\",\n \"failed\",\n \"cancelled\",\n]);\n\nexport type RunState = z.infer<typeof runStateSchema>;\n\nexport const taskStatusSchema = z.enum([\n \"pending\",\n \"running\",\n \"passed\",\n \"changed\",\n \"new\",\n \"failed\",\n \"skipped\",\n]);\n\nexport type TaskStatus = z.infer<typeof taskStatusSchema>;\n\nexport const targetSchema = z.object({\n id: z.string(),\n url: z.string(),\n plugin: z.string(),\n});\n\nexport type Target = z.infer<typeof targetSchema>;\n\nexport const pluginInfoSchema = z.object({\n name: z.string(),\n description: z.string().optional(),\n});\n\nexport type PluginInfo = z.infer<typeof pluginInfoSchema>;\n\n/**\n * Why a run started, when a person did not start it.\n *\n * Carried on the request rather than as a separate lookup, so a run list can\n * say \"this one came from saving Button.stories.tsx\" from what it already has.\n */\nexport const runTriggerSchema = z.object({\n source: z.literal(\"watch\"),\n files: z.array(z.string()),\n});\n\nexport type RunTrigger = z.infer<typeof runTriggerSchema>;\n\nexport const startRunRequestSchema = z.object({\n plugins: z.array(z.string()).optional(),\n filter: z.string().optional(),\n taskIds: z.array(z.string()).optional(),\n clearActual: z.boolean().optional(),\n trigger: runTriggerSchema.optional(),\n});\n\nexport type StartRunRequest = z.infer<typeof startRunRequestSchema>;\n\nexport const serializedErrorSchema = z.object({\n name: z.string(),\n message: z.string(),\n stack: z.string().optional(),\n});\n\nexport type SerializedError = z.infer<typeof serializedErrorSchema>;\n\n/**\n * A plugin's `execute` return value.\n *\n * Only the keys the runner interprets are named; plugins are free to return\n * more, so unknown keys pass through.\n */\nexport const pluginCaptureResultSchema = z.looseObject({\n success: z.boolean().optional(),\n skipped: z.boolean().optional(),\n isNew: z.boolean().optional(),\n error: z.unknown().optional(),\n filepath: z.string().optional(),\n storyId: z.string().optional(),\n storyName: z.string().optional(),\n});\n\nexport type PluginCaptureResult = z.infer<typeof pluginCaptureResultSchema>;\n\nexport const taskFailureSchema = z.object({\n taskId: z.string(),\n taskUrl: z.string(),\n pluginName: z.string(),\n result: pluginCaptureResultSchema,\n});\n\nexport type TaskFailure = z.infer<typeof taskFailureSchema>;\n\nexport const taskRecordSchema = z.object({\n id: z.string(),\n url: z.string(),\n plugin: z.string(),\n status: taskStatusSchema,\n durationMs: z.number().optional(),\n result: pluginCaptureResultSchema.optional(),\n});\n\nexport type TaskRecord = z.infer<typeof taskRecordSchema>;\n\nexport const runSummarySchema = z.object({\n id: z.string(),\n state: runStateSchema,\n request: startRunRequestSchema,\n startedAt: z.number(),\n finishedAt: z.number().optional(),\n durationMs: z.number().optional(),\n totalTasks: z.number(),\n completedTasks: z.number(),\n failedTasks: z.number(),\n deletedScreenshots: z.array(z.string()),\n anyTasksRan: z.boolean(),\n error: serializedErrorSchema.optional(),\n});\n\nexport type RunSummary = z.infer<typeof runSummarySchema>;\n\nexport const runDetailSchema = runSummarySchema.extend({\n tasks: z.array(taskRecordSchema),\n failures: z.array(taskFailureSchema),\n});\n\nexport type RunDetail = z.infer<typeof runDetailSchema>;\n\nexport const runLogLevelSchema = z.enum([\n \"debug\",\n \"info\",\n \"warn\",\n \"error\",\n \"success\",\n]);\n\nexport type RunLogLevel = z.infer<typeof runLogLevelSchema>;\n\nconst eventBase = {\n seq: z.number(),\n runId: z.string(),\n at: z.number(),\n};\n\n/**\n * The run event stream, exactly as `@cappa/core`'s `CaptureRunner` emits it.\n *\n * `seq` is monotonic and 1-based per run; the SSE endpoint uses it as the\n * `Last-Event-ID` so a reconnecting client can replay what it missed.\n */\nexport const runEventSchema = z.discriminatedUnion(\"type\", [\n z.object({\n ...eventBase,\n type: z.literal(\"run:start\"),\n request: startRunRequestSchema,\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"discover:start\"),\n plugins: z.array(z.string()),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"discover:plugin\"),\n plugin: z.string(),\n taskCount: z.number(),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"discover:complete\"),\n targets: z.array(targetSchema),\n totalTasks: z.number(),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"filter:applied\"),\n filter: z.string().optional(),\n taskIds: z.array(z.string()).optional(),\n plugins: z.array(\n z.object({\n plugin: z.string(),\n before: z.number(),\n after: z.number(),\n }),\n ),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"plugin:start\"),\n plugin: z.string(),\n taskCount: z.number(),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"task:start\"),\n plugin: z.string(),\n taskId: z.string(),\n url: z.string(),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"task:complete\"),\n plugin: z.string(),\n taskId: z.string(),\n url: z.string(),\n status: taskStatusSchema,\n completed: z.number(),\n total: z.number(),\n durationMs: z.number(),\n result: pluginCaptureResultSchema.optional(),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"plugin:complete\"),\n plugin: z.string(),\n resultCount: z.number(),\n failed: z.boolean(),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"log\"),\n level: runLogLevelSchema,\n message: z.string(),\n args: z.array(z.unknown()),\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"run:complete\"),\n summary: runSummarySchema,\n }),\n z.object({\n ...eventBase,\n type: z.literal(\"run:error\"),\n error: serializedErrorSchema,\n }),\n z.object({ ...eventBase, type: z.literal(\"run:cancelled\") }),\n]);\n\nexport type RunEvent = z.infer<typeof runEventSchema>;\n\nexport type RunEventType = RunEvent[\"type\"];\n\n/**\n * How a watch iteration decided what to capture.\n *\n * `tasks` is the precise case; `plugins` means at least one plugin could not\n * attribute the change; `all` means the resolved set was too large or discovery\n * failed; `none` means there was nothing to capture.\n */\nexport const watchScopeSchema = z.enum([\"tasks\", \"plugins\", \"all\", \"none\"]);\n\nexport type WatchScope = z.infer<typeof watchScopeSchema>;\n\nexport const watchChangeSchema = z.object({\n files: z.array(z.string()),\n scope: watchScopeSchema,\n taskIds: z.array(z.string()).optional(),\n runId: z.string().optional(),\n error: z.string().optional(),\n at: z.number(),\n});\n\nexport type WatchChange = z.infer<typeof watchChangeSchema>;\n\nconst watchEventBase = {\n /** Monotonic, 1-based, per server. Used for SSE `Last-Event-ID` replay. */\n seq: z.number(),\n at: z.number(),\n};\n\n/**\n * The watch event stream, exactly as `@cappa/core`'s engine emits it.\n *\n * Separate from `runEventSchema` because a watch session outlives any single\n * run: the runs it starts report themselves on the ordinary run stream, and\n * these events say why they started.\n */\nexport const watchEventSchema = z.discriminatedUnion(\"type\", [\n z.object({\n ...watchEventBase,\n type: z.literal(\"watch:start\"),\n paths: z.array(z.string()),\n filter: z.string().optional(),\n debounceMs: z.number(),\n }),\n z.object({\n ...watchEventBase,\n type: z.literal(\"watch:change\"),\n files: z.array(z.string()),\n scope: watchScopeSchema,\n taskIds: z.array(z.string()).optional(),\n runId: z.string().optional(),\n error: z.string().optional(),\n }),\n z.object({\n ...watchEventBase,\n type: z.literal(\"watch:stop\"),\n reason: z.enum([\"requested\", \"engine-closed\"]),\n }),\n]);\n\nexport type WatchEvent = z.infer<typeof watchEventSchema>;\n\nexport type WatchEventType = WatchEvent[\"type\"];\n\nexport const watchStatusSchema = z.object({\n active: z.boolean(),\n paths: z.array(z.string()),\n filter: z.string().optional(),\n debounceMs: z.number(),\n startedAt: z.number().optional(),\n lastChange: watchChangeSchema.optional(),\n});\n\nexport type WatchStatus = z.infer<typeof watchStatusSchema>;\n\nexport const startWatchRequestSchema = z.object({\n paths: z.array(z.string()).optional(),\n filter: z.string().optional(),\n debounceMs: z.number().optional(),\n maxTasks: z.number().optional(),\n});\n\nexport type StartWatchRequest = z.infer<typeof startWatchRequestSchema>;\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,2BAA2B,EAAE,KAAK;CAC7C;CACA;CACA;CACA;AACF,CAAC;AAID,MAAa,qBAAqB,EAAE,OAAO;CACzC,eAAe,EAAE,OAAO;CACxB,mBAAmB,EAAE,OAAO;;;;;;;;;;CAU5B,gBAAgB,EAAE,QAAQ,CAAC,CAAC,SAAS;AACvC,CAAC;AAID,MAAM,iBAAiB;CACrB,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS;;;;;;;;;;;CAW/B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE5B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;;;;;;;;CAQ5B,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC5B;AAEA,MAAa,sBAAsB,EAAE,OAAO;CAC1C,GAAG;CACH,UAAU,EAAE,QAAQ,KAAK;CACzB,YAAY,EAAE,OAAO;AACvB,CAAC;AAED,MAAa,0BAA0B,EAAE,OAAO;CAC9C,GAAG;CACH,UAAU,EAAE,QAAQ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O;CACxC,QAAQ,EAAE,QAAQ;CAClB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;CACzB,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,YAAY,kBAAkB,SAAS;AACzC,CAAC;AAID,MAAa,0BAA0B,EAAE,OAAO;CAC9C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACpC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS;CAChC,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;AAChC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cappa/protocol",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Wire contract shared by the Cappa server, clients and review UI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Tim Richter",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/tim-richter/cappa.git"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"screenshot",
|
|
17
|
+
"protocol"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"main": "./dist/index.cjs",
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.cts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"require": "./dist/index.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"zod": "4.5.4"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@arethetypeswrong/cli": "0.18.5",
|
|
38
|
+
"@cappa/core": "0.13.0",
|
|
39
|
+
"tsdown": "0.23.0",
|
|
40
|
+
"typescript": "7.0.2",
|
|
41
|
+
"vitest": "5.0.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsdown",
|
|
45
|
+
"tsc": "tsc",
|
|
46
|
+
"test": "vitest",
|
|
47
|
+
"test:run": "vitest --run",
|
|
48
|
+
"attw": "attw --pack --profile node16 ."
|
|
49
|
+
}
|
|
50
|
+
}
|