@cappa/protocol 0.9.0 → 0.11.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/dist/index.cjs +28 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -1
- package/dist/index.d.ts +65 -1
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,24 @@ const diffMetadataSchema = zod.z.object({
|
|
|
30
30
|
*/
|
|
31
31
|
interpretation: zod.z.unknown().optional()
|
|
32
32
|
});
|
|
33
|
+
/**
|
|
34
|
+
* A judge's verdict on a changed screenshot, as `cappa agent check` applied it.
|
|
35
|
+
*
|
|
36
|
+
* Unlike the interpretation this is cappa's own shape, so it is described
|
|
37
|
+
* rather than carried opaquely. `label` and `action` stay plain strings on the
|
|
38
|
+
* wire so a newer engine adding a label does not make an older client reject
|
|
39
|
+
* the whole screenshot list.
|
|
40
|
+
*/
|
|
41
|
+
const agentReviewSchema = zod.z.object({
|
|
42
|
+
label: zod.z.string(),
|
|
43
|
+
headline: zod.z.string(),
|
|
44
|
+
rationale: zod.z.array(zod.z.string()),
|
|
45
|
+
action: zod.z.string(),
|
|
46
|
+
source: zod.z.enum(["heuristic", "agent"]),
|
|
47
|
+
confidence: zod.z.number().optional(),
|
|
48
|
+
pending: zod.z.boolean(),
|
|
49
|
+
reviewedAt: zod.z.string()
|
|
50
|
+
});
|
|
33
51
|
const screenshotBase = {
|
|
34
52
|
id: zod.z.string(),
|
|
35
53
|
name: zod.z.string(),
|
|
@@ -48,6 +66,13 @@ const screenshotBase = {
|
|
|
48
66
|
/** Plugin that owns `taskId`. Absent whenever `taskId` is. */
|
|
49
67
|
plugin: zod.z.string().optional(),
|
|
50
68
|
/**
|
|
69
|
+
* Image pixels per CSS pixel of the actual / expected PNG. Absent means 1.
|
|
70
|
+
* A client shows an image at its size divided by this, and two different
|
|
71
|
+
* ratios on one screenshot mean the baseline predates a scale change.
|
|
72
|
+
*/
|
|
73
|
+
actualPixelRatio: zod.z.number().positive().optional(),
|
|
74
|
+
expectedPixelRatio: zod.z.number().positive().optional(),
|
|
75
|
+
/**
|
|
51
76
|
* Neighbours in the full, unfiltered list, so the UI can walk every
|
|
52
77
|
* screenshot with the arrow keys regardless of the current filter.
|
|
53
78
|
*
|
|
@@ -73,7 +98,8 @@ const changedScreenshotSchema = zod.z.object({
|
|
|
73
98
|
actualPath: zod.z.string(),
|
|
74
99
|
expectedPath: zod.z.string(),
|
|
75
100
|
diffPath: zod.z.string(),
|
|
76
|
-
diffMeta: diffMetadataSchema.optional()
|
|
101
|
+
diffMeta: diffMetadataSchema.optional(),
|
|
102
|
+
review: agentReviewSchema.optional()
|
|
77
103
|
});
|
|
78
104
|
const passedScreenshotSchema = zod.z.object({
|
|
79
105
|
...screenshotBase,
|
|
@@ -458,6 +484,7 @@ exports.ASSET_PREFIX = ASSET_PREFIX;
|
|
|
458
484
|
exports.ERROR_CODES = ERROR_CODES;
|
|
459
485
|
exports.PROTOCOL_VERSION = PROTOCOL_VERSION;
|
|
460
486
|
exports.TOKEN_HEADER = TOKEN_HEADER;
|
|
487
|
+
exports.agentReviewSchema = agentReviewSchema;
|
|
461
488
|
exports.approveRequestSchema = approveRequestSchema;
|
|
462
489
|
exports.approveResultSchema = approveResultSchema;
|
|
463
490
|
exports.capabilitiesSchema = capabilitiesSchema;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["z","z","z"],"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,2BAA2BA,IAAAA,EAAE,KAA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MA,IAAAA,EAAE,OAAO,CAAC;CACzB,QAAQA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,YAAYA,IAAAA,EAAE,OAAO;CACrB,WAAWA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,YAAY,kBAAkB,SAAS;AACzC,CAAC;AAID,MAAa,0BAA0BA,IAAAA,EAAE,OAAO;CAC9C,OAAOA,IAAAA,EAAE,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACpC,QAAQA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,YAAYA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAChC,UAAUA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;AAChC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["z","z","z"],"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\n/**\n * A judge's verdict on a changed screenshot, as `cappa agent check` applied it.\n *\n * Unlike the interpretation this is cappa's own shape, so it is described\n * rather than carried opaquely. `label` and `action` stay plain strings on the\n * wire so a newer engine adding a label does not make an older client reject\n * the whole screenshot list.\n */\nexport const agentReviewSchema = z.object({\n label: z.string(),\n headline: z.string(),\n rationale: z.array(z.string()),\n action: z.string(),\n // Engines since 0.18 only send `agent`; older ones also sent `heuristic`\n // labels guessed from diff signals, so the wire format still accepts it.\n source: z.enum([\"heuristic\", \"agent\"]),\n confidence: z.number().optional(),\n pending: z.boolean(),\n reviewedAt: z.string(),\n});\n\nexport type AgentReview = z.infer<typeof agentReviewSchema>;\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 * Image pixels per CSS pixel of the actual / expected PNG. Absent means 1.\n * A client shows an image at its size divided by this, and two different\n * ratios on one screenshot mean the baseline predates a scale change.\n */\n actualPixelRatio: z.number().positive().optional(),\n expectedPixelRatio: z.number().positive().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 review: agentReviewSchema.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,2BAA2BA,IAAAA,EAAE,KAAK;CAC7C;CACA;CACA;CACA;AACF,CAAC;AAID,MAAa,qBAAqBA,IAAAA,EAAE,OAAO;CACzC,eAAeA,IAAAA,EAAE,OAAO;CACxB,mBAAmBA,IAAAA,EAAE,OAAO;;;;;;;;;;CAU5B,gBAAgBA,IAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS;AACvC,CAAC;;;;;;;;;AAYD,MAAa,oBAAoBA,IAAAA,EAAE,OAAO;CACxC,OAAOA,IAAAA,EAAE,OAAO;CAChB,UAAUA,IAAAA,EAAE,OAAO;CACnB,WAAWA,IAAAA,EAAE,MAAMA,IAAAA,EAAE,OAAO,CAAC;CAC7B,QAAQA,IAAAA,EAAE,OAAO;CAGjB,QAAQA,IAAAA,EAAE,KAAK,CAAC,aAAa,OAAO,CAAC;CACrC,YAAYA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAChC,SAASA,IAAAA,EAAE,QAAQ;CACnB,YAAYA,IAAAA,EAAE,OAAO;AACvB,CAAC;AAID,MAAM,iBAAiB;CACrB,IAAIA,IAAAA,EAAE,OAAO;CACb,MAAMA,IAAAA,EAAE,OAAO;CACf,UAAUA,IAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS;;;;;;;;;;;CAW/B,QAAQA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE5B,QAAQA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;;;;;;CAM5B,kBAAkBA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACjD,oBAAoBA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;;;;;;;;CAQnD,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B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ED
|
@@ -22,12 +22,36 @@ export declare const diffMetadataSchema: z.ZodObject<{
|
|
|
22
22
|
interpretation: z.ZodOptional<z.ZodUnknown>;
|
|
23
23
|
}, z.core.$strip>;
|
|
24
24
|
type DiffMetadata = z.infer<typeof diffMetadataSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* A judge's verdict on a changed screenshot, as `cappa agent check` applied it.
|
|
27
|
+
*
|
|
28
|
+
* Unlike the interpretation this is cappa's own shape, so it is described
|
|
29
|
+
* rather than carried opaquely. `label` and `action` stay plain strings on the
|
|
30
|
+
* wire so a newer engine adding a label does not make an older client reject
|
|
31
|
+
* the whole screenshot list.
|
|
32
|
+
*/
|
|
33
|
+
export declare const agentReviewSchema: z.ZodObject<{
|
|
34
|
+
label: z.ZodString;
|
|
35
|
+
headline: z.ZodString;
|
|
36
|
+
rationale: z.ZodArray<z.ZodString>;
|
|
37
|
+
action: z.ZodString;
|
|
38
|
+
source: z.ZodEnum<{
|
|
39
|
+
agent: "agent";
|
|
40
|
+
heuristic: "heuristic";
|
|
41
|
+
}>;
|
|
42
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
pending: z.ZodBoolean;
|
|
44
|
+
reviewedAt: z.ZodString;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
type AgentReview = z.infer<typeof agentReviewSchema>;
|
|
25
47
|
export declare const newScreenshotSchema: z.ZodObject<{
|
|
26
48
|
id: z.ZodString;
|
|
27
49
|
name: z.ZodString;
|
|
28
50
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
29
51
|
taskId: z.ZodOptional<z.ZodString>;
|
|
30
52
|
plugin: z.ZodOptional<z.ZodString>;
|
|
53
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
31
55
|
next: z.ZodOptional<z.ZodString>;
|
|
32
56
|
prev: z.ZodOptional<z.ZodString>;
|
|
33
57
|
category: z.ZodLiteral<"new">;
|
|
@@ -39,6 +63,8 @@ export declare const deletedScreenshotSchema: z.ZodObject<{
|
|
|
39
63
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
40
64
|
taskId: z.ZodOptional<z.ZodString>;
|
|
41
65
|
plugin: z.ZodOptional<z.ZodString>;
|
|
66
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
42
68
|
next: z.ZodOptional<z.ZodString>;
|
|
43
69
|
prev: z.ZodOptional<z.ZodString>;
|
|
44
70
|
category: z.ZodLiteral<"deleted">;
|
|
@@ -50,6 +76,8 @@ export declare const changedScreenshotSchema: z.ZodObject<{
|
|
|
50
76
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
51
77
|
taskId: z.ZodOptional<z.ZodString>;
|
|
52
78
|
plugin: z.ZodOptional<z.ZodString>;
|
|
79
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
53
81
|
next: z.ZodOptional<z.ZodString>;
|
|
54
82
|
prev: z.ZodOptional<z.ZodString>;
|
|
55
83
|
category: z.ZodLiteral<"changed">;
|
|
@@ -61,6 +89,19 @@ export declare const changedScreenshotSchema: z.ZodObject<{
|
|
|
61
89
|
percentDifference: z.ZodNumber;
|
|
62
90
|
interpretation: z.ZodOptional<z.ZodUnknown>;
|
|
63
91
|
}, z.core.$strip>>;
|
|
92
|
+
review: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
label: z.ZodString;
|
|
94
|
+
headline: z.ZodString;
|
|
95
|
+
rationale: z.ZodArray<z.ZodString>;
|
|
96
|
+
action: z.ZodString;
|
|
97
|
+
source: z.ZodEnum<{
|
|
98
|
+
agent: "agent";
|
|
99
|
+
heuristic: "heuristic";
|
|
100
|
+
}>;
|
|
101
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
pending: z.ZodBoolean;
|
|
103
|
+
reviewedAt: z.ZodString;
|
|
104
|
+
}, z.core.$strip>>;
|
|
64
105
|
}, z.core.$strip>;
|
|
65
106
|
export declare const passedScreenshotSchema: z.ZodObject<{
|
|
66
107
|
id: z.ZodString;
|
|
@@ -68,6 +109,8 @@ export declare const passedScreenshotSchema: z.ZodObject<{
|
|
|
68
109
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
69
110
|
taskId: z.ZodOptional<z.ZodString>;
|
|
70
111
|
plugin: z.ZodOptional<z.ZodString>;
|
|
112
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
71
114
|
next: z.ZodOptional<z.ZodString>;
|
|
72
115
|
prev: z.ZodOptional<z.ZodString>;
|
|
73
116
|
category: z.ZodLiteral<"passed">;
|
|
@@ -88,6 +131,8 @@ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
88
131
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
89
132
|
taskId: z.ZodOptional<z.ZodString>;
|
|
90
133
|
plugin: z.ZodOptional<z.ZodString>;
|
|
134
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
91
136
|
next: z.ZodOptional<z.ZodString>;
|
|
92
137
|
prev: z.ZodOptional<z.ZodString>;
|
|
93
138
|
category: z.ZodLiteral<"new">;
|
|
@@ -98,6 +143,8 @@ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
98
143
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
99
144
|
taskId: z.ZodOptional<z.ZodString>;
|
|
100
145
|
plugin: z.ZodOptional<z.ZodString>;
|
|
146
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
101
148
|
next: z.ZodOptional<z.ZodString>;
|
|
102
149
|
prev: z.ZodOptional<z.ZodString>;
|
|
103
150
|
category: z.ZodLiteral<"deleted">;
|
|
@@ -108,6 +155,8 @@ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
108
155
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
109
156
|
taskId: z.ZodOptional<z.ZodString>;
|
|
110
157
|
plugin: z.ZodOptional<z.ZodString>;
|
|
158
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
159
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
111
160
|
next: z.ZodOptional<z.ZodString>;
|
|
112
161
|
prev: z.ZodOptional<z.ZodString>;
|
|
113
162
|
category: z.ZodLiteral<"changed">;
|
|
@@ -119,12 +168,27 @@ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
119
168
|
percentDifference: z.ZodNumber;
|
|
120
169
|
interpretation: z.ZodOptional<z.ZodUnknown>;
|
|
121
170
|
}, z.core.$strip>>;
|
|
171
|
+
review: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
label: z.ZodString;
|
|
173
|
+
headline: z.ZodString;
|
|
174
|
+
rationale: z.ZodArray<z.ZodString>;
|
|
175
|
+
action: z.ZodString;
|
|
176
|
+
source: z.ZodEnum<{
|
|
177
|
+
agent: "agent";
|
|
178
|
+
heuristic: "heuristic";
|
|
179
|
+
}>;
|
|
180
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
pending: z.ZodBoolean;
|
|
182
|
+
reviewedAt: z.ZodString;
|
|
183
|
+
}, z.core.$strip>>;
|
|
122
184
|
}, z.core.$strip>, z.ZodObject<{
|
|
123
185
|
id: z.ZodString;
|
|
124
186
|
name: z.ZodString;
|
|
125
187
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
126
188
|
taskId: z.ZodOptional<z.ZodString>;
|
|
127
189
|
plugin: z.ZodOptional<z.ZodString>;
|
|
190
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
128
192
|
next: z.ZodOptional<z.ZodString>;
|
|
129
193
|
prev: z.ZodOptional<z.ZodString>;
|
|
130
194
|
category: z.ZodLiteral<"passed">;
|
|
@@ -747,5 +811,5 @@ export declare const startWatchRequestSchema: z.ZodObject<{
|
|
|
747
811
|
}, z.core.$strip>;
|
|
748
812
|
type StartWatchRequest = z.infer<typeof startWatchRequestSchema>;
|
|
749
813
|
//#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 };
|
|
814
|
+
export type { AgentReview, 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
815
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -22,12 +22,36 @@ export declare const diffMetadataSchema: z.ZodObject<{
|
|
|
22
22
|
interpretation: z.ZodOptional<z.ZodUnknown>;
|
|
23
23
|
}, z.core.$strip>;
|
|
24
24
|
type DiffMetadata = z.infer<typeof diffMetadataSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* A judge's verdict on a changed screenshot, as `cappa agent check` applied it.
|
|
27
|
+
*
|
|
28
|
+
* Unlike the interpretation this is cappa's own shape, so it is described
|
|
29
|
+
* rather than carried opaquely. `label` and `action` stay plain strings on the
|
|
30
|
+
* wire so a newer engine adding a label does not make an older client reject
|
|
31
|
+
* the whole screenshot list.
|
|
32
|
+
*/
|
|
33
|
+
export declare const agentReviewSchema: z.ZodObject<{
|
|
34
|
+
label: z.ZodString;
|
|
35
|
+
headline: z.ZodString;
|
|
36
|
+
rationale: z.ZodArray<z.ZodString>;
|
|
37
|
+
action: z.ZodString;
|
|
38
|
+
source: z.ZodEnum<{
|
|
39
|
+
agent: "agent";
|
|
40
|
+
heuristic: "heuristic";
|
|
41
|
+
}>;
|
|
42
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
pending: z.ZodBoolean;
|
|
44
|
+
reviewedAt: z.ZodString;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
type AgentReview = z.infer<typeof agentReviewSchema>;
|
|
25
47
|
export declare const newScreenshotSchema: z.ZodObject<{
|
|
26
48
|
id: z.ZodString;
|
|
27
49
|
name: z.ZodString;
|
|
28
50
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
29
51
|
taskId: z.ZodOptional<z.ZodString>;
|
|
30
52
|
plugin: z.ZodOptional<z.ZodString>;
|
|
53
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
31
55
|
next: z.ZodOptional<z.ZodString>;
|
|
32
56
|
prev: z.ZodOptional<z.ZodString>;
|
|
33
57
|
category: z.ZodLiteral<"new">;
|
|
@@ -39,6 +63,8 @@ export declare const deletedScreenshotSchema: z.ZodObject<{
|
|
|
39
63
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
40
64
|
taskId: z.ZodOptional<z.ZodString>;
|
|
41
65
|
plugin: z.ZodOptional<z.ZodString>;
|
|
66
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
42
68
|
next: z.ZodOptional<z.ZodString>;
|
|
43
69
|
prev: z.ZodOptional<z.ZodString>;
|
|
44
70
|
category: z.ZodLiteral<"deleted">;
|
|
@@ -50,6 +76,8 @@ export declare const changedScreenshotSchema: z.ZodObject<{
|
|
|
50
76
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
51
77
|
taskId: z.ZodOptional<z.ZodString>;
|
|
52
78
|
plugin: z.ZodOptional<z.ZodString>;
|
|
79
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
53
81
|
next: z.ZodOptional<z.ZodString>;
|
|
54
82
|
prev: z.ZodOptional<z.ZodString>;
|
|
55
83
|
category: z.ZodLiteral<"changed">;
|
|
@@ -61,6 +89,19 @@ export declare const changedScreenshotSchema: z.ZodObject<{
|
|
|
61
89
|
percentDifference: z.ZodNumber;
|
|
62
90
|
interpretation: z.ZodOptional<z.ZodUnknown>;
|
|
63
91
|
}, z.core.$strip>>;
|
|
92
|
+
review: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
label: z.ZodString;
|
|
94
|
+
headline: z.ZodString;
|
|
95
|
+
rationale: z.ZodArray<z.ZodString>;
|
|
96
|
+
action: z.ZodString;
|
|
97
|
+
source: z.ZodEnum<{
|
|
98
|
+
agent: "agent";
|
|
99
|
+
heuristic: "heuristic";
|
|
100
|
+
}>;
|
|
101
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
pending: z.ZodBoolean;
|
|
103
|
+
reviewedAt: z.ZodString;
|
|
104
|
+
}, z.core.$strip>>;
|
|
64
105
|
}, z.core.$strip>;
|
|
65
106
|
export declare const passedScreenshotSchema: z.ZodObject<{
|
|
66
107
|
id: z.ZodString;
|
|
@@ -68,6 +109,8 @@ export declare const passedScreenshotSchema: z.ZodObject<{
|
|
|
68
109
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
69
110
|
taskId: z.ZodOptional<z.ZodString>;
|
|
70
111
|
plugin: z.ZodOptional<z.ZodString>;
|
|
112
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
71
114
|
next: z.ZodOptional<z.ZodString>;
|
|
72
115
|
prev: z.ZodOptional<z.ZodString>;
|
|
73
116
|
category: z.ZodLiteral<"passed">;
|
|
@@ -88,6 +131,8 @@ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
88
131
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
89
132
|
taskId: z.ZodOptional<z.ZodString>;
|
|
90
133
|
plugin: z.ZodOptional<z.ZodString>;
|
|
134
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
91
136
|
next: z.ZodOptional<z.ZodString>;
|
|
92
137
|
prev: z.ZodOptional<z.ZodString>;
|
|
93
138
|
category: z.ZodLiteral<"new">;
|
|
@@ -98,6 +143,8 @@ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
98
143
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
99
144
|
taskId: z.ZodOptional<z.ZodString>;
|
|
100
145
|
plugin: z.ZodOptional<z.ZodString>;
|
|
146
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
101
148
|
next: z.ZodOptional<z.ZodString>;
|
|
102
149
|
prev: z.ZodOptional<z.ZodString>;
|
|
103
150
|
category: z.ZodLiteral<"deleted">;
|
|
@@ -108,6 +155,8 @@ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
108
155
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
109
156
|
taskId: z.ZodOptional<z.ZodString>;
|
|
110
157
|
plugin: z.ZodOptional<z.ZodString>;
|
|
158
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
159
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
111
160
|
next: z.ZodOptional<z.ZodString>;
|
|
112
161
|
prev: z.ZodOptional<z.ZodString>;
|
|
113
162
|
category: z.ZodLiteral<"changed">;
|
|
@@ -119,12 +168,27 @@ export declare const screenshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
119
168
|
percentDifference: z.ZodNumber;
|
|
120
169
|
interpretation: z.ZodOptional<z.ZodUnknown>;
|
|
121
170
|
}, z.core.$strip>>;
|
|
171
|
+
review: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
label: z.ZodString;
|
|
173
|
+
headline: z.ZodString;
|
|
174
|
+
rationale: z.ZodArray<z.ZodString>;
|
|
175
|
+
action: z.ZodString;
|
|
176
|
+
source: z.ZodEnum<{
|
|
177
|
+
agent: "agent";
|
|
178
|
+
heuristic: "heuristic";
|
|
179
|
+
}>;
|
|
180
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
pending: z.ZodBoolean;
|
|
182
|
+
reviewedAt: z.ZodString;
|
|
183
|
+
}, z.core.$strip>>;
|
|
122
184
|
}, z.core.$strip>, z.ZodObject<{
|
|
123
185
|
id: z.ZodString;
|
|
124
186
|
name: z.ZodString;
|
|
125
187
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
126
188
|
taskId: z.ZodOptional<z.ZodString>;
|
|
127
189
|
plugin: z.ZodOptional<z.ZodString>;
|
|
190
|
+
actualPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
expectedPixelRatio: z.ZodOptional<z.ZodNumber>;
|
|
128
192
|
next: z.ZodOptional<z.ZodString>;
|
|
129
193
|
prev: z.ZodOptional<z.ZodString>;
|
|
130
194
|
category: z.ZodLiteral<"passed">;
|
|
@@ -747,5 +811,5 @@ export declare const startWatchRequestSchema: z.ZodObject<{
|
|
|
747
811
|
}, z.core.$strip>;
|
|
748
812
|
type StartWatchRequest = z.infer<typeof startWatchRequestSchema>;
|
|
749
813
|
//#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 };
|
|
814
|
+
export type { AgentReview, 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
815
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,24 @@ const diffMetadataSchema = z.object({
|
|
|
29
29
|
*/
|
|
30
30
|
interpretation: z.unknown().optional()
|
|
31
31
|
});
|
|
32
|
+
/**
|
|
33
|
+
* A judge's verdict on a changed screenshot, as `cappa agent check` applied it.
|
|
34
|
+
*
|
|
35
|
+
* Unlike the interpretation this is cappa's own shape, so it is described
|
|
36
|
+
* rather than carried opaquely. `label` and `action` stay plain strings on the
|
|
37
|
+
* wire so a newer engine adding a label does not make an older client reject
|
|
38
|
+
* the whole screenshot list.
|
|
39
|
+
*/
|
|
40
|
+
const agentReviewSchema = z.object({
|
|
41
|
+
label: z.string(),
|
|
42
|
+
headline: z.string(),
|
|
43
|
+
rationale: z.array(z.string()),
|
|
44
|
+
action: z.string(),
|
|
45
|
+
source: z.enum(["heuristic", "agent"]),
|
|
46
|
+
confidence: z.number().optional(),
|
|
47
|
+
pending: z.boolean(),
|
|
48
|
+
reviewedAt: z.string()
|
|
49
|
+
});
|
|
32
50
|
const screenshotBase = {
|
|
33
51
|
id: z.string(),
|
|
34
52
|
name: z.string(),
|
|
@@ -47,6 +65,13 @@ const screenshotBase = {
|
|
|
47
65
|
/** Plugin that owns `taskId`. Absent whenever `taskId` is. */
|
|
48
66
|
plugin: z.string().optional(),
|
|
49
67
|
/**
|
|
68
|
+
* Image pixels per CSS pixel of the actual / expected PNG. Absent means 1.
|
|
69
|
+
* A client shows an image at its size divided by this, and two different
|
|
70
|
+
* ratios on one screenshot mean the baseline predates a scale change.
|
|
71
|
+
*/
|
|
72
|
+
actualPixelRatio: z.number().positive().optional(),
|
|
73
|
+
expectedPixelRatio: z.number().positive().optional(),
|
|
74
|
+
/**
|
|
50
75
|
* Neighbours in the full, unfiltered list, so the UI can walk every
|
|
51
76
|
* screenshot with the arrow keys regardless of the current filter.
|
|
52
77
|
*
|
|
@@ -72,7 +97,8 @@ const changedScreenshotSchema = z.object({
|
|
|
72
97
|
actualPath: z.string(),
|
|
73
98
|
expectedPath: z.string(),
|
|
74
99
|
diffPath: z.string(),
|
|
75
|
-
diffMeta: diffMetadataSchema.optional()
|
|
100
|
+
diffMeta: diffMetadataSchema.optional(),
|
|
101
|
+
review: agentReviewSchema.optional()
|
|
76
102
|
});
|
|
77
103
|
const passedScreenshotSchema = z.object({
|
|
78
104
|
...screenshotBase,
|
|
@@ -453,6 +479,6 @@ const startWatchRequestSchema = z.object({
|
|
|
453
479
|
maxTasks: z.number().optional()
|
|
454
480
|
});
|
|
455
481
|
//#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 };
|
|
482
|
+
export { ASSET_PREFIX, ERROR_CODES, PROTOCOL_VERSION, TOKEN_HEADER, agentReviewSchema, 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
483
|
|
|
458
484
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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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Aa,mBAAmB,EAAE,mBAAmB,QAAQ;CAC3D,EAAE,OAAO;EACP,GAAG;EACH,MAAM,EAAE,QAAQ,aAAa;EAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;EACzB,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;EAC5B,YAAY,EAAE,OAAO;CACvB,CAAC;CACD,EAAE,OAAO;EACP,GAAG;EACH,MAAM,EAAE,QAAQ,cAAc;EAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;EACzB,OAAO;EACP,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;EACtC,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;EAC3B,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC7B,CAAC;CACD,EAAE,OAAO;EACP,GAAG;EACH,MAAM,EAAE,QAAQ,YAAY;EAC5B,QAAQ,EAAE,KAAK,CAAC,aAAa,eAAe,CAAC;CAC/C,CAAC;AACH,CAAC;AAMD,MAAa,oBAAoB,EAAE,OAAO;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"}
|
|
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\n/**\n * A judge's verdict on a changed screenshot, as `cappa agent check` applied it.\n *\n * Unlike the interpretation this is cappa's own shape, so it is described\n * rather than carried opaquely. `label` and `action` stay plain strings on the\n * wire so a newer engine adding a label does not make an older client reject\n * the whole screenshot list.\n */\nexport const agentReviewSchema = z.object({\n label: z.string(),\n headline: z.string(),\n rationale: z.array(z.string()),\n action: z.string(),\n // Engines since 0.18 only send `agent`; older ones also sent `heuristic`\n // labels guessed from diff signals, so the wire format still accepts it.\n source: z.enum([\"heuristic\", \"agent\"]),\n confidence: z.number().optional(),\n pending: z.boolean(),\n reviewedAt: z.string(),\n});\n\nexport type AgentReview = z.infer<typeof agentReviewSchema>;\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 * Image pixels per CSS pixel of the actual / expected PNG. Absent means 1.\n * A client shows an image at its size divided by this, and two different\n * ratios on one screenshot mean the baseline predates a scale change.\n */\n actualPixelRatio: z.number().positive().optional(),\n expectedPixelRatio: z.number().positive().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 review: agentReviewSchema.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;;;;;;;;;AAYD,MAAa,oBAAoB,EAAE,OAAO;CACxC,OAAO,EAAE,OAAO;CAChB,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;CAC7B,QAAQ,EAAE,OAAO;CAGjB,QAAQ,EAAE,KAAK,CAAC,aAAa,OAAO,CAAC;CACrC,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS;CAChC,SAAS,EAAE,QAAQ;CACnB,YAAY,EAA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
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Wire contract shared by the Cappa server, clients and review UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"./package.json": "./package.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"zod": "4.
|
|
34
|
+
"zod": "4.6.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@arethetypeswrong/cli": "0.18.5",
|
|
38
|
-
"@cappa/core": "0.
|
|
38
|
+
"@cappa/core": "0.20.0",
|
|
39
39
|
"tsdown": "0.23.0",
|
|
40
40
|
"typescript": "7.0.2",
|
|
41
41
|
"vitest": "5.0.0"
|