@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.
@@ -0,0 +1,751 @@
1
+ import { z } from "zod";
2
+ //#region src/screenshot.d.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
+ export declare const screenshotCategorySchema: z.ZodEnum<{
13
+ changed: "changed";
14
+ deleted: "deleted";
15
+ new: "new";
16
+ passed: "passed";
17
+ }>;
18
+ type ScreenshotCategory = z.infer<typeof screenshotCategorySchema>;
19
+ export declare const diffMetadataSchema: z.ZodObject<{
20
+ numDiffPixels: z.ZodNumber;
21
+ percentDifference: z.ZodNumber;
22
+ interpretation: z.ZodOptional<z.ZodUnknown>;
23
+ }, z.core.$strip>;
24
+ type DiffMetadata = z.infer<typeof diffMetadataSchema>;
25
+ export declare const newScreenshotSchema: z.ZodObject<{
26
+ id: z.ZodString;
27
+ name: z.ZodString;
28
+ approved: z.ZodOptional<z.ZodBoolean>;
29
+ taskId: z.ZodOptional<z.ZodString>;
30
+ plugin: z.ZodOptional<z.ZodString>;
31
+ next: z.ZodOptional<z.ZodString>;
32
+ prev: z.ZodOptional<z.ZodString>;
33
+ category: z.ZodLiteral<"new">;
34
+ actualPath: z.ZodString;
35
+ }, z.core.$strip>;
36
+ export declare const deletedScreenshotSchema: z.ZodObject<{
37
+ id: z.ZodString;
38
+ name: z.ZodString;
39
+ approved: z.ZodOptional<z.ZodBoolean>;
40
+ taskId: z.ZodOptional<z.ZodString>;
41
+ plugin: z.ZodOptional<z.ZodString>;
42
+ next: z.ZodOptional<z.ZodString>;
43
+ prev: z.ZodOptional<z.ZodString>;
44
+ category: z.ZodLiteral<"deleted">;
45
+ expectedPath: z.ZodString;
46
+ }, z.core.$strip>;
47
+ export declare const changedScreenshotSchema: z.ZodObject<{
48
+ id: z.ZodString;
49
+ name: z.ZodString;
50
+ approved: z.ZodOptional<z.ZodBoolean>;
51
+ taskId: z.ZodOptional<z.ZodString>;
52
+ plugin: z.ZodOptional<z.ZodString>;
53
+ next: z.ZodOptional<z.ZodString>;
54
+ prev: z.ZodOptional<z.ZodString>;
55
+ category: z.ZodLiteral<"changed">;
56
+ actualPath: z.ZodString;
57
+ expectedPath: z.ZodString;
58
+ diffPath: z.ZodString;
59
+ diffMeta: z.ZodOptional<z.ZodObject<{
60
+ numDiffPixels: z.ZodNumber;
61
+ percentDifference: z.ZodNumber;
62
+ interpretation: z.ZodOptional<z.ZodUnknown>;
63
+ }, z.core.$strip>>;
64
+ }, z.core.$strip>;
65
+ export declare const passedScreenshotSchema: z.ZodObject<{
66
+ id: z.ZodString;
67
+ name: z.ZodString;
68
+ approved: z.ZodOptional<z.ZodBoolean>;
69
+ taskId: z.ZodOptional<z.ZodString>;
70
+ plugin: z.ZodOptional<z.ZodString>;
71
+ next: z.ZodOptional<z.ZodString>;
72
+ prev: z.ZodOptional<z.ZodString>;
73
+ category: z.ZodLiteral<"passed">;
74
+ actualPath: z.ZodString;
75
+ expectedPath: z.ZodString;
76
+ }, z.core.$strip>;
77
+ /**
78
+ * The changed variant on its own.
79
+ *
80
+ * Exported because the review UI's comparison views only ever render a changed
81
+ * screenshot, and typing them on the full union would force a narrow at every
82
+ * call site.
83
+ */
84
+ type ChangedScreenshot = z.infer<typeof changedScreenshotSchema>;
85
+ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
86
+ id: z.ZodString;
87
+ name: z.ZodString;
88
+ approved: z.ZodOptional<z.ZodBoolean>;
89
+ taskId: z.ZodOptional<z.ZodString>;
90
+ plugin: z.ZodOptional<z.ZodString>;
91
+ next: z.ZodOptional<z.ZodString>;
92
+ prev: z.ZodOptional<z.ZodString>;
93
+ category: z.ZodLiteral<"new">;
94
+ actualPath: z.ZodString;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ id: z.ZodString;
97
+ name: z.ZodString;
98
+ approved: z.ZodOptional<z.ZodBoolean>;
99
+ taskId: z.ZodOptional<z.ZodString>;
100
+ plugin: z.ZodOptional<z.ZodString>;
101
+ next: z.ZodOptional<z.ZodString>;
102
+ prev: z.ZodOptional<z.ZodString>;
103
+ category: z.ZodLiteral<"deleted">;
104
+ expectedPath: z.ZodString;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ id: z.ZodString;
107
+ name: z.ZodString;
108
+ approved: z.ZodOptional<z.ZodBoolean>;
109
+ taskId: z.ZodOptional<z.ZodString>;
110
+ plugin: z.ZodOptional<z.ZodString>;
111
+ next: z.ZodOptional<z.ZodString>;
112
+ prev: z.ZodOptional<z.ZodString>;
113
+ category: z.ZodLiteral<"changed">;
114
+ actualPath: z.ZodString;
115
+ expectedPath: z.ZodString;
116
+ diffPath: z.ZodString;
117
+ diffMeta: z.ZodOptional<z.ZodObject<{
118
+ numDiffPixels: z.ZodNumber;
119
+ percentDifference: z.ZodNumber;
120
+ interpretation: z.ZodOptional<z.ZodUnknown>;
121
+ }, z.core.$strip>>;
122
+ }, z.core.$strip>, z.ZodObject<{
123
+ id: z.ZodString;
124
+ name: z.ZodString;
125
+ approved: z.ZodOptional<z.ZodBoolean>;
126
+ taskId: z.ZodOptional<z.ZodString>;
127
+ plugin: z.ZodOptional<z.ZodString>;
128
+ next: z.ZodOptional<z.ZodString>;
129
+ prev: z.ZodOptional<z.ZodString>;
130
+ category: z.ZodLiteral<"passed">;
131
+ actualPath: z.ZodString;
132
+ expectedPath: z.ZodString;
133
+ }, z.core.$strip>], "category">;
134
+ type Screenshot = z.infer<typeof screenshotSchema>;
135
+ export declare const screenshotQuerySchema: z.ZodObject<{
136
+ search: z.ZodOptional<z.ZodString>;
137
+ category: z.ZodOptional<z.ZodEnum<{
138
+ changed: "changed";
139
+ deleted: "deleted";
140
+ new: "new";
141
+ passed: "passed";
142
+ }>>;
143
+ }, z.core.$strip>;
144
+ type ScreenshotQuery = z.infer<typeof screenshotQuerySchema>;
145
+ export declare const approveRequestSchema: z.ZodObject<{
146
+ names: z.ZodArray<z.ZodString>;
147
+ }, z.core.$strip>;
148
+ type ApproveRequest = z.infer<typeof approveRequestSchema>;
149
+ export declare const approveResultSchema: z.ZodObject<{
150
+ approved: z.ZodArray<z.ZodString>;
151
+ errors: z.ZodArray<z.ZodObject<{
152
+ name: z.ZodString;
153
+ error: z.ZodString;
154
+ }, z.core.$strip>>;
155
+ }, z.core.$strip>;
156
+ type ApproveResult = z.infer<typeof approveResultSchema>;
157
+ //#endregion
158
+ //#region src/routes.d.ts
159
+ /**
160
+ * Bumped whenever the wire contract changes incompatibly.
161
+ *
162
+ * Served on `GET /api/health` and checked by `@cappa/client` on its first call,
163
+ * so a client built against an older server fails with a clear message instead
164
+ * of mis-parsing responses.
165
+ */
166
+ export declare const PROTOCOL_VERSION = 1;
167
+ /** Capabilities a server advertises, so a client can hide what is unavailable. */
168
+ export declare const capabilitiesSchema: z.ZodObject<{
169
+ capture: z.ZodBoolean;
170
+ approve: z.ZodBoolean;
171
+ events: z.ZodBoolean;
172
+ watch: z.ZodOptional<z.ZodBoolean>;
173
+ }, z.core.$strip>;
174
+ type Capabilities = z.infer<typeof capabilitiesSchema>;
175
+ export declare const healthResponseSchema: z.ZodObject<{
176
+ ok: z.ZodBoolean;
177
+ protocolVersion: z.ZodNumber;
178
+ capabilities: z.ZodObject<{
179
+ capture: z.ZodBoolean;
180
+ approve: z.ZodBoolean;
181
+ events: z.ZodBoolean;
182
+ watch: z.ZodOptional<z.ZodBoolean>;
183
+ }, z.core.$strip>;
184
+ }, z.core.$strip>;
185
+ type HealthResponse = z.infer<typeof healthResponseSchema>;
186
+ export declare const configResponseSchema: z.ZodObject<{
187
+ theme: z.ZodEnum<{
188
+ dark: "dark";
189
+ light: "light";
190
+ }>;
191
+ readOnly: z.ZodBoolean;
192
+ }, z.core.$strip>;
193
+ type ConfigResponse = z.infer<typeof configResponseSchema>;
194
+ export declare const startRunResponseSchema: z.ZodObject<{
195
+ runId: z.ZodString;
196
+ }, z.core.$strip>;
197
+ type StartRunResponse = z.infer<typeof startRunResponseSchema>;
198
+ /**
199
+ * Machine-readable codes on error responses.
200
+ *
201
+ * Kept here, in the wire contract, rather than derived from `@cappa/core`'s
202
+ * error classes: a client must be able to tell a conflict from a validation
203
+ * failure without installing the engine. `@cappa/core` mirrors these values and
204
+ * a compatibility assertion there fails the build if they drift.
205
+ */
206
+ export declare const ERROR_CODES: {
207
+ readonly runInProgress: "CAPPA_RUN_IN_PROGRESS";
208
+ readonly unknownTargets: "CAPPA_UNKNOWN_TARGETS";
209
+ readonly watchInProgress: "CAPPA_WATCH_IN_PROGRESS";
210
+ };
211
+ type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
212
+ export declare const errorResponseSchema: z.ZodObject<{
213
+ error: z.ZodUnknown;
214
+ code: z.ZodOptional<z.ZodString>;
215
+ activeRunId: z.ZodOptional<z.ZodString>;
216
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
217
+ }, z.core.$strip>;
218
+ type ErrorResponse = z.infer<typeof errorResponseSchema>;
219
+ /** Every route the server exposes, in one place. */
220
+ export declare const routes: {
221
+ readonly health: "/api/health";
222
+ readonly config: "/api/config";
223
+ readonly plugins: "/api/plugins";
224
+ readonly targets: "/api/targets";
225
+ readonly runs: "/api/runs";
226
+ readonly run: (id: string) => string;
227
+ readonly runCancel: (id: string) => string;
228
+ readonly runEvents: (id: string) => string;
229
+ readonly screenshots: "/api/screenshots";
230
+ readonly screenshot: (id: string) => string;
231
+ readonly approveBatch: "/api/screenshots/approve-batch";
232
+ readonly watch: "/api/watch";
233
+ readonly watchEvents: "/api/watch/events";
234
+ };
235
+ /** Prefix under which screenshot images are served. */
236
+ export declare const ASSET_PREFIX = "/assets/screenshots";
237
+ /** Header carrying the access token when the server is not on loopback. */
238
+ export declare const TOKEN_HEADER = "x-cappa-token";
239
+ export declare const targetsQuerySchema: z.ZodObject<{
240
+ refresh: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"1">, z.ZodLiteral<"true">, z.ZodLiteral<"0">, z.ZodLiteral<"false">]>>;
241
+ }, z.core.$strip>;
242
+ //#endregion
243
+ //#region src/run.d.ts
244
+ export declare const runStateSchema: z.ZodEnum<{
245
+ cancelled: "cancelled";
246
+ completed: "completed";
247
+ discovering: "discovering";
248
+ failed: "failed";
249
+ idle: "idle";
250
+ running: "running";
251
+ }>;
252
+ type RunState = z.infer<typeof runStateSchema>;
253
+ export declare const taskStatusSchema: z.ZodEnum<{
254
+ changed: "changed";
255
+ failed: "failed";
256
+ new: "new";
257
+ passed: "passed";
258
+ pending: "pending";
259
+ running: "running";
260
+ skipped: "skipped";
261
+ }>;
262
+ type TaskStatus = z.infer<typeof taskStatusSchema>;
263
+ export declare const targetSchema: z.ZodObject<{
264
+ id: z.ZodString;
265
+ url: z.ZodString;
266
+ plugin: z.ZodString;
267
+ }, z.core.$strip>;
268
+ type Target = z.infer<typeof targetSchema>;
269
+ export declare const pluginInfoSchema: z.ZodObject<{
270
+ name: z.ZodString;
271
+ description: z.ZodOptional<z.ZodString>;
272
+ }, z.core.$strip>;
273
+ type PluginInfo = z.infer<typeof pluginInfoSchema>;
274
+ /**
275
+ * Why a run started, when a person did not start it.
276
+ *
277
+ * Carried on the request rather than as a separate lookup, so a run list can
278
+ * say "this one came from saving Button.stories.tsx" from what it already has.
279
+ */
280
+ export declare const runTriggerSchema: z.ZodObject<{
281
+ source: z.ZodLiteral<"watch">;
282
+ files: z.ZodArray<z.ZodString>;
283
+ }, z.core.$strip>;
284
+ type RunTrigger = z.infer<typeof runTriggerSchema>;
285
+ export declare const startRunRequestSchema: z.ZodObject<{
286
+ plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
287
+ filter: z.ZodOptional<z.ZodString>;
288
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
289
+ clearActual: z.ZodOptional<z.ZodBoolean>;
290
+ trigger: z.ZodOptional<z.ZodObject<{
291
+ source: z.ZodLiteral<"watch">;
292
+ files: z.ZodArray<z.ZodString>;
293
+ }, z.core.$strip>>;
294
+ }, z.core.$strip>;
295
+ type StartRunRequest = z.infer<typeof startRunRequestSchema>;
296
+ export declare const serializedErrorSchema: z.ZodObject<{
297
+ name: z.ZodString;
298
+ message: z.ZodString;
299
+ stack: z.ZodOptional<z.ZodString>;
300
+ }, z.core.$strip>;
301
+ type SerializedError = z.infer<typeof serializedErrorSchema>;
302
+ /**
303
+ * A plugin's `execute` return value.
304
+ *
305
+ * Only the keys the runner interprets are named; plugins are free to return
306
+ * more, so unknown keys pass through.
307
+ */
308
+ export declare const pluginCaptureResultSchema: z.ZodObject<{
309
+ success: z.ZodOptional<z.ZodBoolean>;
310
+ skipped: z.ZodOptional<z.ZodBoolean>;
311
+ isNew: z.ZodOptional<z.ZodBoolean>;
312
+ error: z.ZodOptional<z.ZodUnknown>;
313
+ filepath: z.ZodOptional<z.ZodString>;
314
+ storyId: z.ZodOptional<z.ZodString>;
315
+ storyName: z.ZodOptional<z.ZodString>;
316
+ }, z.core.$loose>;
317
+ type PluginCaptureResult = z.infer<typeof pluginCaptureResultSchema>;
318
+ export declare const taskFailureSchema: z.ZodObject<{
319
+ taskId: z.ZodString;
320
+ taskUrl: z.ZodString;
321
+ pluginName: z.ZodString;
322
+ result: z.ZodObject<{
323
+ success: z.ZodOptional<z.ZodBoolean>;
324
+ skipped: z.ZodOptional<z.ZodBoolean>;
325
+ isNew: z.ZodOptional<z.ZodBoolean>;
326
+ error: z.ZodOptional<z.ZodUnknown>;
327
+ filepath: z.ZodOptional<z.ZodString>;
328
+ storyId: z.ZodOptional<z.ZodString>;
329
+ storyName: z.ZodOptional<z.ZodString>;
330
+ }, z.core.$loose>;
331
+ }, z.core.$strip>;
332
+ type TaskFailure = z.infer<typeof taskFailureSchema>;
333
+ export declare const taskRecordSchema: z.ZodObject<{
334
+ id: z.ZodString;
335
+ url: z.ZodString;
336
+ plugin: z.ZodString;
337
+ status: z.ZodEnum<{
338
+ changed: "changed";
339
+ failed: "failed";
340
+ new: "new";
341
+ passed: "passed";
342
+ pending: "pending";
343
+ running: "running";
344
+ skipped: "skipped";
345
+ }>;
346
+ durationMs: z.ZodOptional<z.ZodNumber>;
347
+ result: z.ZodOptional<z.ZodObject<{
348
+ success: z.ZodOptional<z.ZodBoolean>;
349
+ skipped: z.ZodOptional<z.ZodBoolean>;
350
+ isNew: z.ZodOptional<z.ZodBoolean>;
351
+ error: z.ZodOptional<z.ZodUnknown>;
352
+ filepath: z.ZodOptional<z.ZodString>;
353
+ storyId: z.ZodOptional<z.ZodString>;
354
+ storyName: z.ZodOptional<z.ZodString>;
355
+ }, z.core.$loose>>;
356
+ }, z.core.$strip>;
357
+ type TaskRecord = z.infer<typeof taskRecordSchema>;
358
+ export declare const runSummarySchema: z.ZodObject<{
359
+ id: z.ZodString;
360
+ state: z.ZodEnum<{
361
+ cancelled: "cancelled";
362
+ completed: "completed";
363
+ discovering: "discovering";
364
+ failed: "failed";
365
+ idle: "idle";
366
+ running: "running";
367
+ }>;
368
+ request: z.ZodObject<{
369
+ plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
370
+ filter: z.ZodOptional<z.ZodString>;
371
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
372
+ clearActual: z.ZodOptional<z.ZodBoolean>;
373
+ trigger: z.ZodOptional<z.ZodObject<{
374
+ source: z.ZodLiteral<"watch">;
375
+ files: z.ZodArray<z.ZodString>;
376
+ }, z.core.$strip>>;
377
+ }, z.core.$strip>;
378
+ startedAt: z.ZodNumber;
379
+ finishedAt: z.ZodOptional<z.ZodNumber>;
380
+ durationMs: z.ZodOptional<z.ZodNumber>;
381
+ totalTasks: z.ZodNumber;
382
+ completedTasks: z.ZodNumber;
383
+ failedTasks: z.ZodNumber;
384
+ deletedScreenshots: z.ZodArray<z.ZodString>;
385
+ anyTasksRan: z.ZodBoolean;
386
+ error: z.ZodOptional<z.ZodObject<{
387
+ name: z.ZodString;
388
+ message: z.ZodString;
389
+ stack: z.ZodOptional<z.ZodString>;
390
+ }, z.core.$strip>>;
391
+ }, z.core.$strip>;
392
+ type RunSummary = z.infer<typeof runSummarySchema>;
393
+ export declare const runDetailSchema: z.ZodObject<{
394
+ id: z.ZodString;
395
+ state: z.ZodEnum<{
396
+ cancelled: "cancelled";
397
+ completed: "completed";
398
+ discovering: "discovering";
399
+ failed: "failed";
400
+ idle: "idle";
401
+ running: "running";
402
+ }>;
403
+ request: z.ZodObject<{
404
+ plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
405
+ filter: z.ZodOptional<z.ZodString>;
406
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
407
+ clearActual: z.ZodOptional<z.ZodBoolean>;
408
+ trigger: z.ZodOptional<z.ZodObject<{
409
+ source: z.ZodLiteral<"watch">;
410
+ files: z.ZodArray<z.ZodString>;
411
+ }, z.core.$strip>>;
412
+ }, z.core.$strip>;
413
+ startedAt: z.ZodNumber;
414
+ finishedAt: z.ZodOptional<z.ZodNumber>;
415
+ durationMs: z.ZodOptional<z.ZodNumber>;
416
+ totalTasks: z.ZodNumber;
417
+ completedTasks: z.ZodNumber;
418
+ failedTasks: z.ZodNumber;
419
+ deletedScreenshots: z.ZodArray<z.ZodString>;
420
+ anyTasksRan: z.ZodBoolean;
421
+ error: z.ZodOptional<z.ZodObject<{
422
+ name: z.ZodString;
423
+ message: z.ZodString;
424
+ stack: z.ZodOptional<z.ZodString>;
425
+ }, z.core.$strip>>;
426
+ tasks: z.ZodArray<z.ZodObject<{
427
+ id: z.ZodString;
428
+ url: z.ZodString;
429
+ plugin: z.ZodString;
430
+ status: z.ZodEnum<{
431
+ changed: "changed";
432
+ failed: "failed";
433
+ new: "new";
434
+ passed: "passed";
435
+ pending: "pending";
436
+ running: "running";
437
+ skipped: "skipped";
438
+ }>;
439
+ durationMs: z.ZodOptional<z.ZodNumber>;
440
+ result: z.ZodOptional<z.ZodObject<{
441
+ success: z.ZodOptional<z.ZodBoolean>;
442
+ skipped: z.ZodOptional<z.ZodBoolean>;
443
+ isNew: z.ZodOptional<z.ZodBoolean>;
444
+ error: z.ZodOptional<z.ZodUnknown>;
445
+ filepath: z.ZodOptional<z.ZodString>;
446
+ storyId: z.ZodOptional<z.ZodString>;
447
+ storyName: z.ZodOptional<z.ZodString>;
448
+ }, z.core.$loose>>;
449
+ }, z.core.$strip>>;
450
+ failures: z.ZodArray<z.ZodObject<{
451
+ taskId: z.ZodString;
452
+ taskUrl: z.ZodString;
453
+ pluginName: z.ZodString;
454
+ result: z.ZodObject<{
455
+ success: z.ZodOptional<z.ZodBoolean>;
456
+ skipped: z.ZodOptional<z.ZodBoolean>;
457
+ isNew: z.ZodOptional<z.ZodBoolean>;
458
+ error: z.ZodOptional<z.ZodUnknown>;
459
+ filepath: z.ZodOptional<z.ZodString>;
460
+ storyId: z.ZodOptional<z.ZodString>;
461
+ storyName: z.ZodOptional<z.ZodString>;
462
+ }, z.core.$loose>;
463
+ }, z.core.$strip>>;
464
+ }, z.core.$strip>;
465
+ type RunDetail = z.infer<typeof runDetailSchema>;
466
+ export declare const runLogLevelSchema: z.ZodEnum<{
467
+ debug: "debug";
468
+ error: "error";
469
+ info: "info";
470
+ success: "success";
471
+ warn: "warn";
472
+ }>;
473
+ type RunLogLevel = z.infer<typeof runLogLevelSchema>;
474
+ /**
475
+ * The run event stream, exactly as `@cappa/core`'s `CaptureRunner` emits it.
476
+ *
477
+ * `seq` is monotonic and 1-based per run; the SSE endpoint uses it as the
478
+ * `Last-Event-ID` so a reconnecting client can replay what it missed.
479
+ */
480
+ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
481
+ seq: z.ZodNumber;
482
+ runId: z.ZodString;
483
+ at: z.ZodNumber;
484
+ type: z.ZodLiteral<"run:start">;
485
+ request: z.ZodObject<{
486
+ plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
487
+ filter: z.ZodOptional<z.ZodString>;
488
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
489
+ clearActual: z.ZodOptional<z.ZodBoolean>;
490
+ trigger: z.ZodOptional<z.ZodObject<{
491
+ source: z.ZodLiteral<"watch">;
492
+ files: z.ZodArray<z.ZodString>;
493
+ }, z.core.$strip>>;
494
+ }, z.core.$strip>;
495
+ }, z.core.$strip>, z.ZodObject<{
496
+ seq: z.ZodNumber;
497
+ runId: z.ZodString;
498
+ at: z.ZodNumber;
499
+ type: z.ZodLiteral<"discover:start">;
500
+ plugins: z.ZodArray<z.ZodString>;
501
+ }, z.core.$strip>, z.ZodObject<{
502
+ seq: z.ZodNumber;
503
+ runId: z.ZodString;
504
+ at: z.ZodNumber;
505
+ type: z.ZodLiteral<"discover:plugin">;
506
+ plugin: z.ZodString;
507
+ taskCount: z.ZodNumber;
508
+ }, z.core.$strip>, z.ZodObject<{
509
+ seq: z.ZodNumber;
510
+ runId: z.ZodString;
511
+ at: z.ZodNumber;
512
+ type: z.ZodLiteral<"discover:complete">;
513
+ targets: z.ZodArray<z.ZodObject<{
514
+ id: z.ZodString;
515
+ url: z.ZodString;
516
+ plugin: z.ZodString;
517
+ }, z.core.$strip>>;
518
+ totalTasks: z.ZodNumber;
519
+ }, z.core.$strip>, z.ZodObject<{
520
+ seq: z.ZodNumber;
521
+ runId: z.ZodString;
522
+ at: z.ZodNumber;
523
+ type: z.ZodLiteral<"filter:applied">;
524
+ filter: z.ZodOptional<z.ZodString>;
525
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
526
+ plugins: z.ZodArray<z.ZodObject<{
527
+ plugin: z.ZodString;
528
+ before: z.ZodNumber;
529
+ after: z.ZodNumber;
530
+ }, z.core.$strip>>;
531
+ }, z.core.$strip>, z.ZodObject<{
532
+ seq: z.ZodNumber;
533
+ runId: z.ZodString;
534
+ at: z.ZodNumber;
535
+ type: z.ZodLiteral<"plugin:start">;
536
+ plugin: z.ZodString;
537
+ taskCount: z.ZodNumber;
538
+ }, z.core.$strip>, z.ZodObject<{
539
+ seq: z.ZodNumber;
540
+ runId: z.ZodString;
541
+ at: z.ZodNumber;
542
+ type: z.ZodLiteral<"task:start">;
543
+ plugin: z.ZodString;
544
+ taskId: z.ZodString;
545
+ url: z.ZodString;
546
+ }, z.core.$strip>, z.ZodObject<{
547
+ seq: z.ZodNumber;
548
+ runId: z.ZodString;
549
+ at: z.ZodNumber;
550
+ type: z.ZodLiteral<"task:complete">;
551
+ plugin: z.ZodString;
552
+ taskId: z.ZodString;
553
+ url: z.ZodString;
554
+ status: z.ZodEnum<{
555
+ changed: "changed";
556
+ failed: "failed";
557
+ new: "new";
558
+ passed: "passed";
559
+ pending: "pending";
560
+ running: "running";
561
+ skipped: "skipped";
562
+ }>;
563
+ completed: z.ZodNumber;
564
+ total: z.ZodNumber;
565
+ durationMs: z.ZodNumber;
566
+ result: z.ZodOptional<z.ZodObject<{
567
+ success: z.ZodOptional<z.ZodBoolean>;
568
+ skipped: z.ZodOptional<z.ZodBoolean>;
569
+ isNew: z.ZodOptional<z.ZodBoolean>;
570
+ error: z.ZodOptional<z.ZodUnknown>;
571
+ filepath: z.ZodOptional<z.ZodString>;
572
+ storyId: z.ZodOptional<z.ZodString>;
573
+ storyName: z.ZodOptional<z.ZodString>;
574
+ }, z.core.$loose>>;
575
+ }, z.core.$strip>, z.ZodObject<{
576
+ seq: z.ZodNumber;
577
+ runId: z.ZodString;
578
+ at: z.ZodNumber;
579
+ type: z.ZodLiteral<"plugin:complete">;
580
+ plugin: z.ZodString;
581
+ resultCount: z.ZodNumber;
582
+ failed: z.ZodBoolean;
583
+ }, z.core.$strip>, z.ZodObject<{
584
+ seq: z.ZodNumber;
585
+ runId: z.ZodString;
586
+ at: z.ZodNumber;
587
+ type: z.ZodLiteral<"log">;
588
+ level: z.ZodEnum<{
589
+ debug: "debug";
590
+ error: "error";
591
+ info: "info";
592
+ success: "success";
593
+ warn: "warn";
594
+ }>;
595
+ message: z.ZodString;
596
+ args: z.ZodArray<z.ZodUnknown>;
597
+ }, z.core.$strip>, z.ZodObject<{
598
+ seq: z.ZodNumber;
599
+ runId: z.ZodString;
600
+ at: z.ZodNumber;
601
+ type: z.ZodLiteral<"run:complete">;
602
+ summary: z.ZodObject<{
603
+ id: z.ZodString;
604
+ state: z.ZodEnum<{
605
+ cancelled: "cancelled";
606
+ completed: "completed";
607
+ discovering: "discovering";
608
+ failed: "failed";
609
+ idle: "idle";
610
+ running: "running";
611
+ }>;
612
+ request: z.ZodObject<{
613
+ plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
614
+ filter: z.ZodOptional<z.ZodString>;
615
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
616
+ clearActual: z.ZodOptional<z.ZodBoolean>;
617
+ trigger: z.ZodOptional<z.ZodObject<{
618
+ source: z.ZodLiteral<"watch">;
619
+ files: z.ZodArray<z.ZodString>;
620
+ }, z.core.$strip>>;
621
+ }, z.core.$strip>;
622
+ startedAt: z.ZodNumber;
623
+ finishedAt: z.ZodOptional<z.ZodNumber>;
624
+ durationMs: z.ZodOptional<z.ZodNumber>;
625
+ totalTasks: z.ZodNumber;
626
+ completedTasks: z.ZodNumber;
627
+ failedTasks: z.ZodNumber;
628
+ deletedScreenshots: z.ZodArray<z.ZodString>;
629
+ anyTasksRan: z.ZodBoolean;
630
+ error: z.ZodOptional<z.ZodObject<{
631
+ name: z.ZodString;
632
+ message: z.ZodString;
633
+ stack: z.ZodOptional<z.ZodString>;
634
+ }, z.core.$strip>>;
635
+ }, z.core.$strip>;
636
+ }, z.core.$strip>, z.ZodObject<{
637
+ seq: z.ZodNumber;
638
+ runId: z.ZodString;
639
+ at: z.ZodNumber;
640
+ type: z.ZodLiteral<"run:error">;
641
+ error: z.ZodObject<{
642
+ name: z.ZodString;
643
+ message: z.ZodString;
644
+ stack: z.ZodOptional<z.ZodString>;
645
+ }, z.core.$strip>;
646
+ }, z.core.$strip>, z.ZodObject<{
647
+ seq: z.ZodNumber;
648
+ runId: z.ZodString;
649
+ at: z.ZodNumber;
650
+ type: z.ZodLiteral<"run:cancelled">;
651
+ }, z.core.$strip>], "type">;
652
+ type RunEvent = z.infer<typeof runEventSchema>;
653
+ type RunEventType = RunEvent["type"];
654
+ /**
655
+ * How a watch iteration decided what to capture.
656
+ *
657
+ * `tasks` is the precise case; `plugins` means at least one plugin could not
658
+ * attribute the change; `all` means the resolved set was too large or discovery
659
+ * failed; `none` means there was nothing to capture.
660
+ */
661
+ export declare const watchScopeSchema: z.ZodEnum<{
662
+ all: "all";
663
+ none: "none";
664
+ plugins: "plugins";
665
+ tasks: "tasks";
666
+ }>;
667
+ type WatchScope = z.infer<typeof watchScopeSchema>;
668
+ export declare const watchChangeSchema: z.ZodObject<{
669
+ files: z.ZodArray<z.ZodString>;
670
+ scope: z.ZodEnum<{
671
+ all: "all";
672
+ none: "none";
673
+ plugins: "plugins";
674
+ tasks: "tasks";
675
+ }>;
676
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
677
+ runId: z.ZodOptional<z.ZodString>;
678
+ error: z.ZodOptional<z.ZodString>;
679
+ at: z.ZodNumber;
680
+ }, z.core.$strip>;
681
+ type WatchChange = z.infer<typeof watchChangeSchema>;
682
+ /**
683
+ * The watch event stream, exactly as `@cappa/core`'s engine emits it.
684
+ *
685
+ * Separate from `runEventSchema` because a watch session outlives any single
686
+ * run: the runs it starts report themselves on the ordinary run stream, and
687
+ * these events say why they started.
688
+ */
689
+ export declare const watchEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
690
+ seq: z.ZodNumber;
691
+ at: z.ZodNumber;
692
+ type: z.ZodLiteral<"watch:start">;
693
+ paths: z.ZodArray<z.ZodString>;
694
+ filter: z.ZodOptional<z.ZodString>;
695
+ debounceMs: z.ZodNumber;
696
+ }, z.core.$strip>, z.ZodObject<{
697
+ seq: z.ZodNumber;
698
+ at: z.ZodNumber;
699
+ type: z.ZodLiteral<"watch:change">;
700
+ files: z.ZodArray<z.ZodString>;
701
+ scope: z.ZodEnum<{
702
+ all: "all";
703
+ none: "none";
704
+ plugins: "plugins";
705
+ tasks: "tasks";
706
+ }>;
707
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
708
+ runId: z.ZodOptional<z.ZodString>;
709
+ error: z.ZodOptional<z.ZodString>;
710
+ }, z.core.$strip>, z.ZodObject<{
711
+ seq: z.ZodNumber;
712
+ at: z.ZodNumber;
713
+ type: z.ZodLiteral<"watch:stop">;
714
+ reason: z.ZodEnum<{
715
+ "engine-closed": "engine-closed";
716
+ requested: "requested";
717
+ }>;
718
+ }, z.core.$strip>], "type">;
719
+ type WatchEvent = z.infer<typeof watchEventSchema>;
720
+ type WatchEventType = WatchEvent["type"];
721
+ export declare const watchStatusSchema: z.ZodObject<{
722
+ active: z.ZodBoolean;
723
+ paths: z.ZodArray<z.ZodString>;
724
+ filter: z.ZodOptional<z.ZodString>;
725
+ debounceMs: z.ZodNumber;
726
+ startedAt: z.ZodOptional<z.ZodNumber>;
727
+ lastChange: z.ZodOptional<z.ZodObject<{
728
+ files: z.ZodArray<z.ZodString>;
729
+ scope: z.ZodEnum<{
730
+ all: "all";
731
+ none: "none";
732
+ plugins: "plugins";
733
+ tasks: "tasks";
734
+ }>;
735
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
736
+ runId: z.ZodOptional<z.ZodString>;
737
+ error: z.ZodOptional<z.ZodString>;
738
+ at: z.ZodNumber;
739
+ }, z.core.$strip>>;
740
+ }, z.core.$strip>;
741
+ type WatchStatus = z.infer<typeof watchStatusSchema>;
742
+ export declare const startWatchRequestSchema: z.ZodObject<{
743
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
744
+ filter: z.ZodOptional<z.ZodString>;
745
+ debounceMs: z.ZodOptional<z.ZodNumber>;
746
+ maxTasks: z.ZodOptional<z.ZodNumber>;
747
+ }, z.core.$strip>;
748
+ type StartWatchRequest = z.infer<typeof startWatchRequestSchema>;
749
+ //#endregion
750
+ export type { ApproveRequest, ApproveResult, Capabilities, ChangedScreenshot, ConfigResponse, DiffMetadata, ErrorCode, ErrorResponse, HealthResponse, PluginCaptureResult, PluginInfo, RunDetail, RunEvent, RunEventType, RunLogLevel, RunState, RunSummary, RunTrigger, Screenshot, ScreenshotCategory, ScreenshotQuery, SerializedError, StartRunRequest, StartRunResponse, StartWatchRequest, Target, TaskFailure, TaskRecord, TaskStatus, WatchChange, WatchEvent, WatchEventType, WatchScope, WatchStatus };
751
+ //# sourceMappingURL=index.d.ts.map