Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/adr/0019-request-bound-platform-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -990,10 +990,11 @@ anchor, not as a proposed commitment.
`interaction-targeting` and the android UI-hierarchy fixtures) and
`src/__tests__/snapshot-desktop-surface.test.ts` (pinned to the root
eager-import-closure fixtures).
- `src/screenshot-diff/*.ts` (region split/overlay/summarization/component composition) —
pixel-diff computation and PNG decode/encode already call capture-kit's `png`/
`png-worker-client`; the root files remain for daemon/CLI diff-report composition.
Equivalent: none (built atop already-migrated capture-kit mechanics).
- `src/screenshot-diff/*.ts` (region split/overlay/summarization/component composition, with its
test) — **migrated to `packages/capture-kit/src/`** beside the pixel worker and screenshot
overlays it was built on. The CLI and command output consume it through
`@agent-device/capture-kit/screenshot-diff`, `/screenshot-diff-regions`, and
`/screenshot-diff-overlay-matches`.
- `src/provider-device-runtime.ts`, `src/provider-device-runtimes.ts`,
`src/provider-limrun-runtime.ts`, `src/provider-webdriver.ts`. Mostly already thin: the bulk of
WebDriver and Limrun provider logic lives in `packages/provider-webdriver/src/` and
Expand Down
12 changes: 12 additions & 0 deletions packages/capture-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,22 @@
"types": "./src/screenshot-density.ts",
"default": "./src/screenshot-density.ts"
},
"./screenshot-diff": {
"types": "./src/screenshot-diff.ts",
"default": "./src/screenshot-diff.ts"
},
"./screenshot-diff-overlay-matches": {
"types": "./src/screenshot-diff-overlay-matches.ts",
"default": "./src/screenshot-diff-overlay-matches.ts"
},
"./screenshot-diff-pixels": {
"types": "./src/screenshot-diff-pixels.ts",
"default": "./src/screenshot-diff-pixels.ts"
},
"./screenshot-diff-regions": {
"types": "./src/screenshot-diff-regions.ts",
"default": "./src/screenshot-diff-regions.ts"
},
"./screenshot-overlay": {
"types": "./src/screenshot-overlay.ts",
"default": "./src/screenshot-overlay.ts"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PNG } from '@agent-device/capture-kit/png';
import type { PNG } from './png.ts';
import type { ScreenshotDiffRegion } from './screenshot-diff-regions.ts';

const REGION_BORDER_COLOR = [0, 187, 255, 255] as const;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PNG } from '@agent-device/capture-kit/png';
import type { PNG } from './png.ts';
import type { MutableDiffRegion } from './screenshot-diff-region-types.ts';

// Region splitting is based on screen-relative heights so it works on phone,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Rect } from '@agent-device/kernel/snapshot';
import type { PNG } from '@agent-device/capture-kit/png';
import type { PNG } from './png.ts';
import { normalizedRect, type NormalizedRect } from '@agent-device/kernel/screenshot-geometry';
import { findConnectedMaskComponents } from './screenshot-diff-components.ts';
import { splitLargeDiffRegions } from './screenshot-diff-region-split.ts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { test } from 'vitest';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { mkdtempForTestSync } from '@agent-device/test-kit';
import { mkdtempForTestSync } from './tmp-dir.fixtures.ts';

import { hasPngSignature, PNG } from '@agent-device/capture-kit/png';
import { compareScreenshots } from '../screenshot-diff.ts';
import { hasPngSignature, PNG } from './png.ts';
import { compareScreenshots } from './screenshot-diff.ts';

function tmpDir(): string {
return mkdtempForTestSync('agent-device-screenshot-diff-');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { promises as fs } from 'node:fs';
import path from 'node:path';
import { AppError } from '@agent-device/kernel/errors';
import type { Rect } from '@agent-device/kernel/snapshot';
import { PNG } from '@agent-device/capture-kit/png';
import { PNG } from './png.ts';
import {
computeScreenshotDiffPixelsAsync,
decodeScreenshotImageAsync,
encodePngAsync,
} from '@agent-device/capture-kit/png-worker-client';
} from './png-worker-client.ts';
import { annotateDiffRegions } from './screenshot-diff-region-overlay.ts';
import { summarizeDiffRegions, type ScreenshotDiffRegion } from './screenshot-diff-regions.ts';
import type { ImageDimensions } from '@agent-device/kernel/screenshot-geometry';
Expand Down
1 change: 0 additions & 1 deletion scripts/layering/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ test('classifyZone separates the ranked spine from intentionally-unranked zones'
assert.equal(classifyZone('(root)'), 'ranked');
assert.equal(classifyZone('platform-runtime'), 'ranked');
assert.equal(classifyZone('mcp'), 'ranked');
assert.equal(classifyZone('screenshot-diff'), 'ranked');
// A zone that is neither ranked nor listed peripheral must be flagged, never
// silently treated as back-edge-free.
assert.equal(classifyZone('not-a-real-zone'), 'unclassified');
Expand Down
1 change: 0 additions & 1 deletion scripts/layering/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const TARGET_DAG_RANK = new Map([
['maestro', 1],
['replay-port', 1],
['replay-test', 1],
['screenshot-diff', 1],
['selectors', 1],
['session-journal', 1],
['core', 2],
Expand Down
3 changes: 3 additions & 0 deletions scripts/layering/package-boundaries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,10 @@ test('the real tree parses, declares, and passes R11', () => {
'@agent-device/capture-kit/screen-recording-stop-recovery',
'@agent-device/capture-kit/screen-recording-transport',
'@agent-device/capture-kit/screenshot-density',
'@agent-device/capture-kit/screenshot-diff',
'@agent-device/capture-kit/screenshot-diff-overlay-matches',
'@agent-device/capture-kit/screenshot-diff-pixels',
'@agent-device/capture-kit/screenshot-diff-regions',
'@agent-device/capture-kit/screenshot-overlay',
'@agent-device/capture-kit/scroll-edge-state',
'@agent-device/capture-kit/snapshot-baseline',
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/screenshot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { localCommandPolicy } from '@agent-device/contracts/command-policy';
import { formatScreenshotDiffText, formatSnapshotDiffText } from '../../commands/output/diff.ts';
import type { ScreenshotDiffResult } from '../../screenshot-diff/screenshot-diff.ts';
import type { ScreenshotDiffResult } from '@agent-device/capture-kit/screenshot-diff';
import { AppError } from '@agent-device/kernel/errors';
import { isNonDefaultResponseLevel } from '@agent-device/kernel/contracts';
import { resolveUserPath } from '@agent-device/host-kit/file';
Expand Down
4 changes: 2 additions & 2 deletions src/commands/capture/runtime/diff-screenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { AppError } from '@agent-device/kernel/errors';
import {
compareScreenshots,
type ScreenshotDiffResult,
} from '../../../screenshot-diff/screenshot-diff.ts';
import { attachCurrentOverlayMatches } from '../../../screenshot-diff/screenshot-diff-overlay-matches.ts';
} from '@agent-device/capture-kit/screenshot-diff';
import { attachCurrentOverlayMatches } from '@agent-device/capture-kit/screenshot-diff-overlay-matches';
import type { RuntimeCommand } from '../../runtime-types.ts';
import {
createCommandTempFile,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/output/diff.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'node:path';
import { colorize, supportsColor } from './color.ts';
import { readSnapshotWarnings } from './snapshot.ts';
import type { ScreenshotDiffResult } from '../../screenshot-diff/screenshot-diff.ts';
import type { ScreenshotDiffRegion } from '../../screenshot-diff/screenshot-diff-regions.ts';
import type { ScreenshotDiffResult } from '@agent-device/capture-kit/screenshot-diff';
import type { ScreenshotDiffRegion } from '@agent-device/capture-kit/screenshot-diff-regions';
type SnapshotDiffLine = {
kind?: 'added' | 'removed' | 'unchanged';
text?: string;
Expand Down
Loading