diff --git a/fallow-baselines/health.json b/fallow-baselines/health.json index c445243f0..7789ea132 100644 --- a/fallow-baselines/health.json +++ b/fallow-baselines/health.json @@ -563,7 +563,7 @@ "count": 1 } }, - "src/utils/mobile-snapshot-semantics.ts": { + "src/snapshot/mobile-snapshot-semantics.ts": { "crap_moderate": { "count": 2 } @@ -603,7 +603,7 @@ "count": 1 } }, - "src/utils/snapshot-diff.ts": { + "src/snapshot/snapshot-diff.ts": { "complexity_moderate": { "count": 1 }, @@ -611,7 +611,7 @@ "count": 1 } }, - "src/utils/snapshot-lines.ts": { + "src/snapshot/snapshot-lines.ts": { "crap_moderate": { "count": 1 } @@ -685,7 +685,7 @@ "target_keys": [ "src/daemon/handlers/session.ts:complexity", "src/daemon/handlers/session-replay-runtime.ts:high impact", - "src/utils/snapshot-processing.ts:high impact", + "src/snapshot/snapshot-processing.ts:high impact", "src/daemon/handlers/session-device-utils.ts:high impact", "src/commands/cli-grammar/common.ts:high impact", "src/client-shared.ts:high impact", @@ -712,7 +712,7 @@ "src/utils/rect-center.ts:high impact", "src/utils/process-identity.ts:high impact", "src/daemon/app-log-process.ts:high impact", - "src/utils/snapshot-lines.ts:high impact", + "src/snapshot/snapshot-lines.ts:high impact", "src/daemon/handlers/session-test-sharding.ts:high impact", "src/platforms/android/ui-hierarchy.ts:high impact", "src/platforms/linux/snapshot.ts:high impact", diff --git a/src/commands/capture/runtime/snapshot.ts b/src/commands/capture/runtime/snapshot.ts index 1ca4732fe..47d7cfa73 100644 --- a/src/commands/capture/runtime/snapshot.ts +++ b/src/commands/capture/runtime/snapshot.ts @@ -7,17 +7,20 @@ import { type PublicSnapshotCaptureAnnotations, type SnapshotCaptureAnnotations, } from '../../../snapshot-capture-annotations.ts'; -import { renderSnapshotQualityWarnings } from '../../../utils/snapshot-quality.ts'; +import { renderSnapshotQualityWarnings } from '../../../snapshot/snapshot-quality.ts'; import { AppError } from '../../../kernel/errors.ts'; -import { buildSnapshotDiff, countSnapshotComparableLines } from '../../../utils/snapshot-diff.ts'; -import type { SnapshotDiffLine, SnapshotDiffSummary } from '../../../utils/snapshot-diff.ts'; +import { + buildSnapshotDiff, + countSnapshotComparableLines, +} from '../../../snapshot/snapshot-diff.ts'; +import type { SnapshotDiffLine, SnapshotDiffSummary } from '../../../snapshot/snapshot-diff.ts'; import type { SnapshotNode, SnapshotState, SnapshotUnchanged, SnapshotVisibility, } from '../../../kernel/snapshot.ts'; -import { buildSnapshotVisibility } from '../../../utils/snapshot-visibility.ts'; +import { buildSnapshotVisibility } from '../../../snapshot/snapshot-visibility.ts'; import { formatReactNativeOverlayWarning } from '../../react-native/overlay.ts'; import { buildUnchangedSnapshotMetadata, @@ -30,7 +33,7 @@ import type { } from '../../runtime-types.ts'; import { now } from '../../runtime-common.ts'; -export type { SnapshotDiffLine, SnapshotDiffSummary } from '../../../utils/snapshot-diff.ts'; +export type { SnapshotDiffLine, SnapshotDiffSummary } from '../../../snapshot/snapshot-diff.ts'; export type SnapshotCommandResult = { nodes: SnapshotNode[]; diff --git a/src/commands/interaction/runtime/gestures.ts b/src/commands/interaction/runtime/gestures.ts index c0686da7d..987dbecc2 100644 --- a/src/commands/interaction/runtime/gestures.ts +++ b/src/commands/interaction/runtime/gestures.ts @@ -16,7 +16,7 @@ import { import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; import { requireIntInRange } from '../../../utils/validation.ts'; import { successText } from '../../../utils/success-text.ts'; -import { isNodeVisibleInEffectiveViewport } from '../../../utils/mobile-snapshot-semantics.ts'; +import { isNodeVisibleInEffectiveViewport } from '../../../snapshot/mobile-snapshot-semantics.ts'; import { captureScrollEdgeState, formatScrollEdgeMessage, diff --git a/src/commands/interaction/runtime/interactions.ts b/src/commands/interaction/runtime/interactions.ts index ed17a2c38..3ce59a473 100644 --- a/src/commands/interaction/runtime/interactions.ts +++ b/src/commands/interaction/runtime/interactions.ts @@ -1,7 +1,7 @@ import { AppError } from '../../../kernel/errors.ts'; import type { ClickButton } from '../../../core/click-button.ts'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; -import { isFillableType } from '../../../utils/snapshot-processing.ts'; +import { isFillableType } from '../../../snapshot/snapshot-processing.ts'; import type { Point } from '../../../kernel/snapshot.ts'; import { requireIntInRange } from '../../../utils/validation.ts'; import { successText } from '../../../utils/success-text.ts'; diff --git a/src/commands/interaction/runtime/resolution.ts b/src/commands/interaction/runtime/resolution.ts index a4084b313..3cf7984de 100644 --- a/src/commands/interaction/runtime/resolution.ts +++ b/src/commands/interaction/runtime/resolution.ts @@ -9,12 +9,12 @@ import { resolveSelectorChain, } from '../../../selectors.ts'; import { buildSelectorChainForNode } from '../../../utils/selector-build.ts'; -import { findNodeByLabel, resolveRefLabel } from '../../../utils/snapshot-processing.ts'; +import { findNodeByLabel, resolveRefLabel } from '../../../snapshot/snapshot-processing.ts'; import { isNodeVisibleInEffectiveViewport, resolveEffectiveViewportRect, -} from '../../../utils/mobile-snapshot-semantics.ts'; -import { isSnapshotNodeInteractionBlocked } from '../../../utils/snapshot-occlusion.ts'; +} from '../../../snapshot/mobile-snapshot-semantics.ts'; +import { isSnapshotNodeInteractionBlocked } from '../../../snapshot/snapshot-occlusion.ts'; import type { InteractionTarget, PointTarget, diff --git a/src/commands/interaction/runtime/selector-read-shared.ts b/src/commands/interaction/runtime/selector-read-shared.ts index 5934b4fb0..5a64d01d5 100644 --- a/src/commands/interaction/runtime/selector-read-shared.ts +++ b/src/commands/interaction/runtime/selector-read-shared.ts @@ -6,7 +6,7 @@ import type { import { AppError } from '../../../kernel/errors.ts'; import type { SnapshotNode, SnapshotState } from '../../../kernel/snapshot.ts'; import { findNodeByRef, normalizeRef } from '../../../kernel/snapshot.ts'; -import { isSparseSnapshotQualityVerdict } from '../../../utils/snapshot-quality.ts'; +import { isSparseSnapshotQualityVerdict } from '../../../snapshot/snapshot-quality.ts'; import { extractReadableText } from '../../../utils/text-surface.ts'; import { now, toBackendContext } from '../../runtime-common.ts'; import { findNodeByLabel } from './selector-read-utils.ts'; diff --git a/src/commands/interaction/runtime/selector-read-utils.ts b/src/commands/interaction/runtime/selector-read-utils.ts index 1ac93cb90..f2c3330c0 100644 --- a/src/commands/interaction/runtime/selector-read-utils.ts +++ b/src/commands/interaction/runtime/selector-read-utils.ts @@ -1,4 +1,4 @@ -export { findNodeByLabel, resolveRefLabel } from '../../../utils/snapshot-processing.ts'; +export { findNodeByLabel, resolveRefLabel } from '../../../snapshot/snapshot-processing.ts'; export function shouldScopeFind(locator: string): boolean { return locator === 'text' || locator === 'label' || locator === 'any'; diff --git a/src/commands/interaction/runtime/selector-read.ts b/src/commands/interaction/runtime/selector-read.ts index 901a766bd..c3a9f388a 100644 --- a/src/commands/interaction/runtime/selector-read.ts +++ b/src/commands/interaction/runtime/selector-read.ts @@ -9,7 +9,7 @@ import { findNodeByRef, normalizeRef } from '../../../kernel/snapshot.ts'; import { isSparseSnapshotQualityVerdict, type SnapshotQualityVerdict, -} from '../../../utils/snapshot-quality.ts'; +} from '../../../snapshot/snapshot-quality.ts'; import type { AgentDeviceRuntime, CommandContext } from '../../../runtime-contract.ts'; import { AppError } from '../../../kernel/errors.ts'; import { diff --git a/src/compat/maestro/runtime-assertions.ts b/src/compat/maestro/runtime-assertions.ts index 4296ae931..3348900bb 100644 --- a/src/compat/maestro/runtime-assertions.ts +++ b/src/compat/maestro/runtime-assertions.ts @@ -6,7 +6,7 @@ import type { DaemonFailureResponse } from '../../daemon/handlers/response.ts'; import type { ReplayVarScope } from '../../replay/vars.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; import type { Point, SnapshotState } from '../../kernel/snapshot.ts'; -import { buildSnapshotDisplayLines } from '../../utils/snapshot-lines.ts'; +import { buildSnapshotDisplayLines } from '../../snapshot/snapshot-lines.ts'; import { sleep } from '../../utils/timeouts.ts'; import { pointForMaestroTapOnTarget } from './runtime-geometry.ts'; import { diff --git a/src/compat/maestro/runtime-targets.ts b/src/compat/maestro/runtime-targets.ts index 1b90298b7..b4c270ab0 100644 --- a/src/compat/maestro/runtime-targets.ts +++ b/src/compat/maestro/runtime-targets.ts @@ -11,7 +11,7 @@ import { findSnapshotAncestor, isDescendantOfSnapshotNode, normalizeType, -} from '../../utils/snapshot-processing.ts'; +} from '../../snapshot/snapshot-processing.ts'; import type { TouchReferenceFrame } from '../../daemon/touch-reference-frame.ts'; import type { DaemonRequest } from '../../daemon/types.ts'; import type { Selector, SelectorTerm } from '../../daemon/selectors-parse.ts'; diff --git a/src/core/interaction-targeting.ts b/src/core/interaction-targeting.ts index 5345a2587..df40a20f2 100644 --- a/src/core/interaction-targeting.ts +++ b/src/core/interaction-targeting.ts @@ -1,8 +1,8 @@ import type { Rect, SnapshotNode } from '../kernel/snapshot.ts'; import { centerOfRect } from '../kernel/snapshot.ts'; import { containsPoint, pickLargestRect } from '../utils/rect-visibility.ts'; -import { findNearestHittableAncestor, normalizeType } from '../utils/snapshot-processing.ts'; -import { isSnapshotNodeInteractionBlocked } from '../utils/snapshot-occlusion.ts'; +import { findNearestHittableAncestor, normalizeType } from '../snapshot/snapshot-processing.ts'; +import { isSnapshotNodeInteractionBlocked } from '../snapshot/snapshot-occlusion.ts'; import { areRectsApproximatelyEqual, normalizeRect, diff --git a/src/core/interactors/apple.ts b/src/core/interactors/apple.ts index 9356c080d..3db89cef6 100644 --- a/src/core/interactors/apple.ts +++ b/src/core/interactors/apple.ts @@ -22,7 +22,7 @@ import type { Interactor, RunnerContext } from '../interactor-types.ts'; import { readSnapshotQualityVerdict, type SnapshotQualityVerdict, -} from '../../utils/snapshot-quality.ts'; +} from '../../snapshot/snapshot-quality.ts'; export function createAppleInteractor( device: DeviceInfo, diff --git a/src/daemon/__tests__/snapshot-diff.test.ts b/src/daemon/__tests__/snapshot-diff.test.ts index 0e6019c47..4f9430d24 100644 --- a/src/daemon/__tests__/snapshot-diff.test.ts +++ b/src/daemon/__tests__/snapshot-diff.test.ts @@ -1,6 +1,6 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { buildSnapshotDiff } from '../../utils/snapshot-diff.ts'; +import { buildSnapshotDiff } from '../../snapshot/snapshot-diff.ts'; import { buildNodes as nodes } from '../../__tests__/test-utils/snapshot-builders.ts'; test('buildSnapshotDiff reports unchanged lines when snapshots are equal', () => { diff --git a/src/daemon/__tests__/snapshot-processing.test.ts b/src/daemon/__tests__/snapshot-processing.test.ts index 0bb4d86e5..908da09e7 100644 --- a/src/daemon/__tests__/snapshot-processing.test.ts +++ b/src/daemon/__tests__/snapshot-processing.test.ts @@ -5,7 +5,7 @@ import { extractNodeReadText, findNearestHittableAncestor, pruneGroupNodes, -} from '../../utils/snapshot-processing.ts'; +} from '../../snapshot/snapshot-processing.ts'; test('pruneGroupNodes drops unlabeled group wrappers and rebalances depth', () => { const raw = [ diff --git a/src/daemon/android-system-dialog.ts b/src/daemon/android-system-dialog.ts index cda0e28f6..71e0742c4 100644 --- a/src/daemon/android-system-dialog.ts +++ b/src/daemon/android-system-dialog.ts @@ -10,7 +10,7 @@ import { emitDiagnostic } from '../utils/diagnostics.ts'; import { AppError } from '../kernel/errors.ts'; import { centerOfRect, attachRefs, type SnapshotNode } from '../kernel/snapshot.ts'; import { sleep } from '../utils/timeouts.ts'; -import { pruneGroupNodes } from '../utils/snapshot-processing.ts'; +import { pruneGroupNodes } from '../snapshot/snapshot-processing.ts'; import type { SessionState } from './types.ts'; const ANDROID_BLOCKING_MODAL_PATTERN = /\bis(?:n(?:'|'|')?t| not)\s+responding\b/i; diff --git a/src/daemon/handlers/find.ts b/src/daemon/handlers/find.ts index 265e7ac3f..359c28c0e 100644 --- a/src/daemon/handlers/find.ts +++ b/src/daemon/handlers/find.ts @@ -11,12 +11,12 @@ import type { DaemonInvokeFn, DaemonRequest, DaemonResponse, SessionState } from import { SessionStore } from '../session-store.ts'; import { contextFromFlags } from '../context.ts'; import { ensureDeviceReady } from '../device-ready.ts'; -import { extractNodeText } from '../../utils/snapshot-processing.ts'; +import { extractNodeText } from '../../snapshot/snapshot-processing.ts'; import { resolveActionableTouchNode, resolveActionableTouchResolution, } from '../../core/interaction-targeting.ts'; -import { isSnapshotNodeInteractionBlocked } from '../../utils/snapshot-occlusion.ts'; +import { isSnapshotNodeInteractionBlocked } from '../../snapshot/snapshot-occlusion.ts'; import { readTextForNode } from './interaction-read.ts'; import { errorResponse, noActiveSessionError } from './response.ts'; import { recordSessionAction } from './handler-utils.ts'; @@ -26,7 +26,7 @@ import { createSelectorCaptureRuntime } from '../selector-capture-runtime.ts'; import { isSparseSnapshotQualityVerdict, type SnapshotQualityVerdict, -} from '../../utils/snapshot-quality.ts'; +} from '../../snapshot/snapshot-quality.ts'; import { resolveSelectorChain, type SelectorChain } from '../../selectors.ts'; export { parseFindArgs } from '../../utils/finders.ts'; diff --git a/src/daemon/handlers/interaction-read.ts b/src/daemon/handlers/interaction-read.ts index c506e6aa3..730f1186e 100644 --- a/src/daemon/handlers/interaction-read.ts +++ b/src/daemon/handlers/interaction-read.ts @@ -1,6 +1,6 @@ import { dispatchCommand, type CommandFlags } from '../../core/dispatch.ts'; import { emitDiagnostic } from '../../utils/diagnostics.ts'; -import { extractNodeReadText } from '../../utils/snapshot-processing.ts'; +import { extractNodeReadText } from '../../snapshot/snapshot-processing.ts'; import type { SessionState } from '../types.ts'; import type { SnapshotNode } from '../../kernel/snapshot.ts'; import { prefersValueForReadableText } from '../../utils/text-surface.ts'; diff --git a/src/daemon/handlers/interaction-snapshot.ts b/src/daemon/handlers/interaction-snapshot.ts index 0d1cd2589..bd4dae569 100644 --- a/src/daemon/handlers/interaction-snapshot.ts +++ b/src/daemon/handlers/interaction-snapshot.ts @@ -5,7 +5,7 @@ import type { SnapshotState } from '../../kernel/snapshot.ts'; import type { ContextFromFlags } from './interaction-common.ts'; import { captureSnapshot } from './snapshot-capture.ts'; import { setSessionSnapshot } from '../session-snapshot.ts'; -import { isSparseSnapshotQualityVerdict } from '../../utils/snapshot-quality.ts'; +import { isSparseSnapshotQualityVerdict } from '../../snapshot/snapshot-quality.ts'; export type CaptureSnapshotForSession = ( session: SessionState, diff --git a/src/daemon/handlers/react-native.ts b/src/daemon/handlers/react-native.ts index 7917c2df5..5db0adc28 100644 --- a/src/daemon/handlers/react-native.ts +++ b/src/daemon/handlers/react-native.ts @@ -11,7 +11,7 @@ import type { SnapshotState } from '../../kernel/snapshot.ts'; import { isSparseSnapshotQualityVerdict, type SnapshotQualityVerdict, -} from '../../utils/snapshot-quality.ts'; +} from '../../snapshot/snapshot-quality.ts'; import type { DaemonResponse, SessionState } from '../types.ts'; import { errorResponse, noActiveSessionError, requireCommandSupported } from './response.ts'; import { captureSnapshotForSession } from './interaction-snapshot.ts'; diff --git a/src/daemon/handlers/snapshot-capture.ts b/src/daemon/handlers/snapshot-capture.ts index 54b6ea9a2..b2e7f31a8 100644 --- a/src/daemon/handlers/snapshot-capture.ts +++ b/src/daemon/handlers/snapshot-capture.ts @@ -13,9 +13,9 @@ import { type SnapshotBackend, type SnapshotState, } from '../../kernel/snapshot.ts'; -import { annotateCoveredSnapshotNodes } from '../../utils/snapshot-occlusion.ts'; -import { normalizeSnapshotTree } from '../../utils/snapshot-tree.ts'; -export { buildSnapshotVisibility } from '../../utils/snapshot-visibility.ts'; +import { annotateCoveredSnapshotNodes } from '../../snapshot/snapshot-occlusion.ts'; +import { normalizeSnapshotTree } from '../../snapshot/snapshot-tree.ts'; +export { buildSnapshotVisibility } from '../../snapshot/snapshot-visibility.ts'; import type { SessionState } from '../types.ts'; import { ANDROID_FRESHNESS_RETRY_DEADLINE_MS, @@ -41,7 +41,7 @@ import { findNodeByLabel, pruneGroupNodes, resolveRefLabel, -} from '../../utils/snapshot-processing.ts'; +} from '../../snapshot/snapshot-processing.ts'; import { errorResponse, type DaemonFailureResponse } from './response.ts'; import { presentIosInteractiveSnapshot } from '../snapshot-presentation/ios/index.ts'; import { diff --git a/src/daemon/screenshot-overlay-android.ts b/src/daemon/screenshot-overlay-android.ts index ddc349071..43efbab24 100644 --- a/src/daemon/screenshot-overlay-android.ts +++ b/src/daemon/screenshot-overlay-android.ts @@ -1,5 +1,5 @@ import type { Rect, SnapshotNode } from '../kernel/snapshot.ts'; -import { normalizeType } from '../utils/snapshot-processing.ts'; +import { normalizeType } from '../snapshot/snapshot-processing.ts'; import { hasPositiveRect, rectContains, unionRects } from './screenshot-overlay-rects.ts'; export function resolveAndroidOverlaySourceRect( diff --git a/src/daemon/screenshot-overlay.ts b/src/daemon/screenshot-overlay.ts index 17084c066..1f4a88c15 100644 --- a/src/daemon/screenshot-overlay.ts +++ b/src/daemon/screenshot-overlay.ts @@ -9,7 +9,7 @@ import { import type { PNG } from '../utils/png.ts'; import { decodePngAsync, encodePngAsync } from '../utils/png-worker-client.ts'; import { analyzeReactNativeOverlay } from '../core/react-native-overlay.ts'; -import { findNearestAncestor, normalizeType } from '../utils/snapshot-processing.ts'; +import { findNearestAncestor, normalizeType } from '../snapshot/snapshot-processing.ts'; import { resolveAndroidOverlaySourceRect } from './screenshot-overlay-android.ts'; import { hasPositiveRect, rectArea, rectContains } from './screenshot-overlay-rects.ts'; diff --git a/src/daemon/selector-capture-runtime.ts b/src/daemon/selector-capture-runtime.ts index 08090f468..459d53467 100644 --- a/src/daemon/selector-capture-runtime.ts +++ b/src/daemon/selector-capture-runtime.ts @@ -5,7 +5,7 @@ import { snapshotPresentationOptionsFromFlags, type SnapshotState, } from '../kernel/snapshot.ts'; -import { isSparseSnapshotQualityVerdict } from '../utils/snapshot-quality.ts'; +import { isSparseSnapshotQualityVerdict } from '../snapshot/snapshot-quality.ts'; import type { DaemonRequest, SessionState } from './types.ts'; import { SessionStore } from './session-store.ts'; import { captureSnapshot } from './handlers/snapshot-capture.ts'; diff --git a/src/daemon/selector-runtime-backend.ts b/src/daemon/selector-runtime-backend.ts index 53e984958..c52f25fd1 100644 --- a/src/daemon/selector-runtime-backend.ts +++ b/src/daemon/selector-runtime-backend.ts @@ -8,7 +8,7 @@ import { createAgentDevice } from '../runtime.ts'; import { isApplePlatform } from '../kernel/device.ts'; import { noActiveSessionError, requireCommandSupported } from './handlers/response.ts'; import type { SnapshotNode } from '../kernel/snapshot.ts'; -import { findNodeByLabel } from '../utils/snapshot-processing.ts'; +import { findNodeByLabel } from '../snapshot/snapshot-processing.ts'; import { runIosRunnerCommand } from '../platforms/ios/runner-client.ts'; import { buildAppleRunnerRequestOptions } from './apple-runner-options.ts'; import { createDaemonRuntimePolicy } from './runtime-policy.ts'; diff --git a/src/daemon/selectors-match.ts b/src/daemon/selectors-match.ts index 8843d3d59..1e14631a9 100644 --- a/src/daemon/selectors-match.ts +++ b/src/daemon/selectors-match.ts @@ -1,7 +1,7 @@ import type { Platform } from '../kernel/device.ts'; import type { SnapshotNode } from '../kernel/snapshot.ts'; import { isNodeEditable, isNodeVisible } from '../utils/selector-node.ts'; -import { extractNodeText, normalizeType } from '../utils/snapshot-processing.ts'; +import { extractNodeText, normalizeType } from '../snapshot/snapshot-processing.ts'; import { normalizeText } from '../utils/finders.ts'; import type { Selector, SelectorTerm } from './selectors-parse.ts'; diff --git a/src/daemon/snapshot-presentation/ios/actions.ts b/src/daemon/snapshot-presentation/ios/actions.ts index 4a4e48674..08afa463b 100644 --- a/src/daemon/snapshot-presentation/ios/actions.ts +++ b/src/daemon/snapshot-presentation/ios/actions.ts @@ -1,5 +1,5 @@ import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; -import { normalizeType } from '../../../utils/snapshot-processing.ts'; +import { normalizeType } from '../../../snapshot/snapshot-processing.ts'; import { findLargestViewportRect, findNearestAncestor, diff --git a/src/daemon/snapshot-presentation/ios/noise.ts b/src/daemon/snapshot-presentation/ios/noise.ts index 1afe06958..86f57bb31 100644 --- a/src/daemon/snapshot-presentation/ios/noise.ts +++ b/src/daemon/snapshot-presentation/ios/noise.ts @@ -3,7 +3,7 @@ import { isReactNativeCollapsedWarningWrapperCandidate, isReactNativeCollapsedWarningWrapperWithVisibleBanner, } from '../../../core/react-native-overlay.ts'; -import { normalizeType } from '../../../utils/snapshot-processing.ts'; +import { normalizeType } from '../../../snapshot/snapshot-processing.ts'; import { collectIosScrollIndicatorPresentation } from './scroll.ts'; import { areRectsApproximatelyEqual, diff --git a/src/daemon/snapshot-presentation/ios/presentation.test.ts b/src/daemon/snapshot-presentation/ios/presentation.test.ts index d14b4bf88..9c5b22779 100644 --- a/src/daemon/snapshot-presentation/ios/presentation.test.ts +++ b/src/daemon/snapshot-presentation/ios/presentation.test.ts @@ -1,6 +1,6 @@ import { expect, test } from 'vitest'; import { attachRefs, type RawSnapshotNode } from '../../../kernel/snapshot.ts'; -import { buildSnapshotVisibility } from '../../../utils/snapshot-visibility.ts'; +import { buildSnapshotVisibility } from '../../../snapshot/snapshot-visibility.ts'; import { presentIosInteractiveSnapshot } from './index.ts'; function buildSnapshotState(data: { nodes?: RawSnapshotNode[]; backend?: 'xctest' }) { diff --git a/src/daemon/snapshot-presentation/ios/rows.ts b/src/daemon/snapshot-presentation/ios/rows.ts index 3467e60a9..b6d207f3d 100644 --- a/src/daemon/snapshot-presentation/ios/rows.ts +++ b/src/daemon/snapshot-presentation/ios/rows.ts @@ -1,5 +1,5 @@ import type { RawSnapshotNode } from '../../../kernel/snapshot.ts'; -import { normalizeType } from '../../../utils/snapshot-processing.ts'; +import { normalizeType } from '../../../snapshot/snapshot-processing.ts'; import { areRectsApproximatelyEqual, collectDescendants, diff --git a/src/daemon/snapshot-presentation/tree.ts b/src/daemon/snapshot-presentation/tree.ts index a78e0961d..e8b259056 100644 --- a/src/daemon/snapshot-presentation/tree.ts +++ b/src/daemon/snapshot-presentation/tree.ts @@ -1,5 +1,5 @@ import type { RawSnapshotNode } from '../../kernel/snapshot.ts'; -import { normalizeType } from '../../utils/snapshot-processing.ts'; +import { normalizeType } from '../../snapshot/snapshot-processing.ts'; export { areRectsApproximatelyEqual } from '../../utils/rect-center.ts'; export type SnapshotTreeRuleContext = { diff --git a/src/daemon/snapshot-runtime.ts b/src/daemon/snapshot-runtime.ts index bcb9664ec..1e039bf2f 100644 --- a/src/daemon/snapshot-runtime.ts +++ b/src/daemon/snapshot-runtime.ts @@ -2,7 +2,7 @@ import type { AgentDeviceBackend, BackendSnapshotResult } from '../backend.ts'; import type { CommandSessionRecord } from '../runtime.ts'; import { createAgentDevice } from '../runtime.ts'; import { AppError } from '../kernel/errors.ts'; -import type { SnapshotDiffSummary } from '../utils/snapshot-diff.ts'; +import type { SnapshotDiffSummary } from '../snapshot/snapshot-diff.ts'; import type { DaemonRequest, DaemonResponse, DaemonResponseData, SessionState } from './types.ts'; import { SessionStore } from './session-store.ts'; import { errorResponse, requireCommandSupported } from './handlers/response.ts'; diff --git a/src/daemon/wait-current-surface.ts b/src/daemon/wait-current-surface.ts index 2eeb36523..f8adabefc 100644 --- a/src/daemon/wait-current-surface.ts +++ b/src/daemon/wait-current-surface.ts @@ -2,7 +2,7 @@ import type { SnapshotNode } from '../kernel/snapshot.ts'; import type { DaemonRequest, DaemonResponse, SessionState } from './types.ts'; import { captureSnapshot } from './handlers/snapshot-capture.ts'; import { errorResponse } from './handlers/response.ts'; -import { normalizeType } from '../utils/snapshot-processing.ts'; +import { normalizeType } from '../snapshot/snapshot-processing.ts'; type WaitCurrentSurfaceParams = { req: DaemonRequest; diff --git a/src/platforms/android/snapshot.ts b/src/platforms/android/snapshot.ts index ecd112eb1..6100d6fc2 100644 --- a/src/platforms/android/snapshot.ts +++ b/src/platforms/android/snapshot.ts @@ -12,7 +12,7 @@ import { type SnapshotOptions, } from '../../kernel/snapshot.ts'; import { isScrollableType } from '../../utils/scrollable.ts'; -import { deriveMobileSnapshotHiddenContentHints } from '../../utils/mobile-snapshot-semantics.ts'; +import { deriveMobileSnapshotHiddenContentHints } from '../../snapshot/mobile-snapshot-semantics.ts'; import { buildUiHierarchySnapshot, parseUiHierarchy, diff --git a/src/snapshot-capture-annotations.ts b/src/snapshot-capture-annotations.ts index 3d8e92684..5f9b30d0e 100644 --- a/src/snapshot-capture-annotations.ts +++ b/src/snapshot-capture-annotations.ts @@ -2,7 +2,7 @@ import type { AndroidSnapshotBackendMetadata } from './platforms/android/snapsho import { readSnapshotQualityVerdict, type SnapshotQualityVerdict, -} from './utils/snapshot-quality.ts'; +} from './snapshot/snapshot-quality.ts'; export type SnapshotCaptureAnalysis = { rawNodeCount: number; diff --git a/src/utils/mobile-snapshot-semantics.ts b/src/snapshot/mobile-snapshot-semantics.ts similarity index 97% rename from src/utils/mobile-snapshot-semantics.ts rename to src/snapshot/mobile-snapshot-semantics.ts index 468cdcdba..c7f007457 100644 --- a/src/utils/mobile-snapshot-semantics.ts +++ b/src/snapshot/mobile-snapshot-semantics.ts @@ -1,8 +1,8 @@ -import { isRectVisibleInViewport, resolveViewportRect } from './rect-visibility.ts'; -import { inferVerticalScrollIndicatorDirections } from './scroll-indicator.ts'; +import { isRectVisibleInViewport, resolveViewportRect } from '../utils/rect-visibility.ts'; +import { inferVerticalScrollIndicatorDirections } from '../utils/scroll-indicator.ts'; import type { HiddenContentHint, Rect, SnapshotNode } from '../kernel/snapshot.ts'; import { buildSnapshotNodeMap, displayNodeLabel } from './snapshot-tree.ts'; -import { isScrollableNodeLike } from './scrollable.ts'; +import { isScrollableNodeLike } from '../utils/scrollable.ts'; type Direction = 'above' | 'below'; diff --git a/src/utils/snapshot-diff.ts b/src/snapshot/snapshot-diff.ts similarity index 100% rename from src/utils/snapshot-diff.ts rename to src/snapshot/snapshot-diff.ts diff --git a/src/utils/snapshot-label-signals.ts b/src/snapshot/snapshot-label-signals.ts similarity index 100% rename from src/utils/snapshot-label-signals.ts rename to src/snapshot/snapshot-label-signals.ts diff --git a/src/utils/snapshot-lines.ts b/src/snapshot/snapshot-lines.ts similarity index 98% rename from src/utils/snapshot-lines.ts rename to src/snapshot/snapshot-lines.ts index 7ddcf914c..ae7639a9d 100644 --- a/src/utils/snapshot-lines.ts +++ b/src/snapshot/snapshot-lines.ts @@ -1,6 +1,6 @@ -import { isSystemScrollIndicatorLabel } from './scroll-indicator.ts'; +import { isSystemScrollIndicatorLabel } from '../utils/scroll-indicator.ts'; import type { SnapshotNode } from '../kernel/snapshot.ts'; -import { buildTextPreview, describeTextSurface, trimText } from './text-surface.ts'; +import { buildTextPreview, describeTextSurface, trimText } from '../utils/text-surface.ts'; type SnapshotDisplayLine = { node: SnapshotNode; diff --git a/src/utils/snapshot-occlusion.ts b/src/snapshot/snapshot-occlusion.ts similarity index 96% rename from src/utils/snapshot-occlusion.ts rename to src/snapshot/snapshot-occlusion.ts index c12620cd9..b097e93f1 100644 --- a/src/utils/snapshot-occlusion.ts +++ b/src/snapshot/snapshot-occlusion.ts @@ -1,8 +1,8 @@ import type { RawSnapshotNode, Rect } from '../kernel/snapshot.ts'; import { centerOfRect } from '../kernel/snapshot.ts'; -import { areRectsApproximatelyEqual, normalizeRect } from './rect-center.ts'; -import { containsPoint } from './rect-visibility.ts'; -import { normalizeType } from './text-surface.ts'; +import { areRectsApproximatelyEqual, normalizeRect } from '../utils/rect-center.ts'; +import { containsPoint } from '../utils/rect-visibility.ts'; +import { normalizeType } from '../utils/text-surface.ts'; const COVERED_PRESENTATION_HINT = 'covered'; const OVERLAY_KIND_FRAGMENTS = [ diff --git a/src/utils/snapshot-processing.ts b/src/snapshot/snapshot-processing.ts similarity index 98% rename from src/utils/snapshot-processing.ts rename to src/snapshot/snapshot-processing.ts index d699be349..dac9c8959 100644 --- a/src/utils/snapshot-processing.ts +++ b/src/snapshot/snapshot-processing.ts @@ -1,6 +1,6 @@ import type { Platform } from '../kernel/device.ts'; import type { RawSnapshotNode, SnapshotNode, SnapshotState } from '../kernel/snapshot.ts'; -import { extractReadableText, normalizeType } from './text-surface.ts'; +import { extractReadableText, normalizeType } from '../utils/text-surface.ts'; export { normalizeType }; diff --git a/src/utils/snapshot-quality.ts b/src/snapshot/snapshot-quality.ts similarity index 100% rename from src/utils/snapshot-quality.ts rename to src/snapshot/snapshot-quality.ts diff --git a/src/utils/snapshot-tree.ts b/src/snapshot/snapshot-tree.ts similarity index 100% rename from src/utils/snapshot-tree.ts rename to src/snapshot/snapshot-tree.ts diff --git a/src/utils/snapshot-visibility.ts b/src/snapshot/snapshot-visibility.ts similarity index 100% rename from src/utils/snapshot-visibility.ts rename to src/snapshot/snapshot-visibility.ts diff --git a/src/utils/__tests__/mobile-snapshot-semantics.test.ts b/src/utils/__tests__/mobile-snapshot-semantics.test.ts index e18291f01..5832e7953 100644 --- a/src/utils/__tests__/mobile-snapshot-semantics.test.ts +++ b/src/utils/__tests__/mobile-snapshot-semantics.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { buildMobileSnapshotPresentation, isNodeVisibleInEffectiveViewport, -} from '../mobile-snapshot-semantics.ts'; +} from '../../snapshot/mobile-snapshot-semantics.ts'; import type { SnapshotNode } from '../../kernel/snapshot.ts'; test('mobile presentation keeps only visible nodes and adds off-screen summary fallback', () => { diff --git a/src/utils/__tests__/output.test.ts b/src/utils/__tests__/output.test.ts index d8310d9b3..b8e2e4dd1 100644 --- a/src/utils/__tests__/output.test.ts +++ b/src/utils/__tests__/output.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import path from 'node:path'; import { stripVTControlCharacters } from 'node:util'; import { formatScreenshotDiffText, formatSnapshotDiffText, formatSnapshotText } from '../output.ts'; -import { formatRole, formatSnapshotLine } from '../snapshot-lines.ts'; +import { formatRole, formatSnapshotLine } from '../../snapshot/snapshot-lines.ts'; import { normalizedRect } from '../screenshot-geometry.ts'; const DIFF_DATA = { diff --git a/src/utils/__tests__/snapshot-lines-focused.test.ts b/src/utils/__tests__/snapshot-lines-focused.test.ts index 9bdee6078..c2bacc176 100644 --- a/src/utils/__tests__/snapshot-lines-focused.test.ts +++ b/src/utils/__tests__/snapshot-lines-focused.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { formatSnapshotLine } from '../snapshot-lines.ts'; +import { formatSnapshotLine } from '../../snapshot/snapshot-lines.ts'; test('formatSnapshotLine marks focused nodes', () => { const line = formatSnapshotLine( diff --git a/src/utils/__tests__/snapshot-processing.test.ts b/src/utils/__tests__/snapshot-processing.test.ts index 5f11d8e7d..61a1353a0 100644 --- a/src/utils/__tests__/snapshot-processing.test.ts +++ b/src/utils/__tests__/snapshot-processing.test.ts @@ -4,7 +4,7 @@ import { buildSnapshotNodeByIndex, findNearestAncestor, findSnapshotAncestor, -} from '../snapshot-processing.ts'; +} from '../../snapshot/snapshot-processing.ts'; import type { SnapshotNode } from '../../kernel/snapshot.ts'; test('findSnapshotAncestor walks non-contiguous parent indexes until resolver returns a value', () => { diff --git a/src/utils/__tests__/snapshot-quality.test.ts b/src/utils/__tests__/snapshot-quality.test.ts index f101cfc67..92d1db988 100644 --- a/src/utils/__tests__/snapshot-quality.test.ts +++ b/src/utils/__tests__/snapshot-quality.test.ts @@ -1,7 +1,7 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; -import { readSnapshotQualityVerdict } from '../snapshot-quality.ts'; +import { readSnapshotQualityVerdict } from '../../snapshot/snapshot-quality.ts'; test('readSnapshotQualityVerdict accepts a well-formed verdict', () => { const verdict = readSnapshotQualityVerdict({ diff --git a/src/utils/__tests__/snapshot-visibility.test.ts b/src/utils/__tests__/snapshot-visibility.test.ts index be337748e..3a1b5642e 100644 --- a/src/utils/__tests__/snapshot-visibility.test.ts +++ b/src/utils/__tests__/snapshot-visibility.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'vitest'; -import { buildSnapshotVisibility } from '../snapshot-visibility.ts'; +import { buildSnapshotVisibility } from '../../snapshot/snapshot-visibility.ts'; import type { SnapshotNode } from '../../kernel/snapshot.ts'; const FULLSCREEN_ROOT = { x: 0, y: 0, width: 390, height: 844 }; diff --git a/src/utils/android-helper-presentation/labels.ts b/src/utils/android-helper-presentation/labels.ts index 9b5eaea76..03e8b732b 100644 --- a/src/utils/android-helper-presentation/labels.ts +++ b/src/utils/android-helper-presentation/labels.ts @@ -1,5 +1,5 @@ import type { SnapshotNode } from '../../kernel/snapshot.ts'; -import { displayNodeLabel } from '../snapshot-tree.ts'; +import { displayNodeLabel } from '../../snapshot/snapshot-tree.ts'; export function visibleNodeLabel(node: SnapshotNode): string { const label = displayNodeLabel(node); diff --git a/src/utils/output.ts b/src/utils/output.ts index a1be859e0..700877664 100644 --- a/src/utils/output.ts +++ b/src/utils/output.ts @@ -5,7 +5,7 @@ import { } from './android-helper-snapshot-presentation.ts'; import { AppError, normalizeError, type NormalizedError } from '../kernel/errors.ts'; import { detectPossibleRepeatedNavSubtree } from './repeated-nav-subtree.ts'; -import { buildSnapshotDisplayLines, formatSnapshotLine } from './snapshot-lines.ts'; +import { buildSnapshotDisplayLines, formatSnapshotLine } from '../snapshot/snapshot-lines.ts'; import { isSnapshotBackend, usesMobileSnapshotPresentation, @@ -18,7 +18,7 @@ import type { MovementRange } from '../screenshot-diff/screenshot-diff-ocr.ts'; import type { ScreenshotDiffResult } from '../screenshot-diff/screenshot-diff.ts'; import type { ScreenshotDiffRegion } from '../screenshot-diff/screenshot-diff-regions.ts'; import { styleText } from 'node:util'; -import { buildMobileSnapshotPresentation } from './mobile-snapshot-semantics.ts'; +import { buildMobileSnapshotPresentation } from '../snapshot/mobile-snapshot-semantics.ts'; type JsonResult = | { success: true; data?: unknown } diff --git a/src/utils/repeated-nav-subtree.ts b/src/utils/repeated-nav-subtree.ts index b6fe86773..b494b850f 100644 --- a/src/utils/repeated-nav-subtree.ts +++ b/src/utils/repeated-nav-subtree.ts @@ -1,6 +1,6 @@ import type { Rect, SnapshotNode } from '../kernel/snapshot.ts'; -import { normalizeRepeatedNodeLabel } from './snapshot-label-signals.ts'; -import { displayNodeLabel } from './snapshot-tree.ts'; +import { normalizeRepeatedNodeLabel } from '../snapshot/snapshot-label-signals.ts'; +import { displayNodeLabel } from '../snapshot/snapshot-tree.ts'; export function detectPossibleRepeatedNavSubtree(nodes: SnapshotNode[]): boolean { if (nodes.length < 20) { diff --git a/src/utils/scroll-edge-state.ts b/src/utils/scroll-edge-state.ts index 99dd8d7fa..c748bf951 100644 --- a/src/utils/scroll-edge-state.ts +++ b/src/utils/scroll-edge-state.ts @@ -1,7 +1,7 @@ import { deriveMobileSnapshotHiddenContentHints, isNodeVisibleInEffectiveViewport, -} from './mobile-snapshot-semantics.ts'; +} from '../snapshot/mobile-snapshot-semantics.ts'; import { AppError } from '../kernel/errors.ts'; import { isScrollableNodeLike } from './scrollable.ts'; import type { ScrollDirection } from '../core/scroll-gesture.ts'; diff --git a/src/utils/selector-build.ts b/src/utils/selector-build.ts index f2066c6ad..6d63e1975 100644 --- a/src/utils/selector-build.ts +++ b/src/utils/selector-build.ts @@ -1,7 +1,7 @@ import type { Platform } from '../kernel/device.ts'; import type { SnapshotNode } from '../kernel/snapshot.ts'; import { isNodeVisible } from './selector-node.ts'; -import { extractNodeText, normalizeType } from './snapshot-processing.ts'; +import { extractNodeText, normalizeType } from '../snapshot/snapshot-processing.ts'; export function buildSelectorChainForNode( node: SnapshotNode, diff --git a/src/utils/selector-is-predicates.ts b/src/utils/selector-is-predicates.ts index f721aa968..00fccdc4b 100644 --- a/src/utils/selector-is-predicates.ts +++ b/src/utils/selector-is-predicates.ts @@ -1,13 +1,13 @@ import type { Platform } from '../kernel/device.ts'; import type { SnapshotState } from '../kernel/snapshot.ts'; -import { isNodeVisibleInEffectiveViewport } from './mobile-snapshot-semantics.ts'; +import { isNodeVisibleInEffectiveViewport } from '../snapshot/mobile-snapshot-semantics.ts'; import { isNodeEditable, isNodeVisible } from './selector-node.ts'; import { buildSnapshotNodeByIndex, extractNodeText, findSnapshotAncestor, normalizeType, -} from './snapshot-processing.ts'; +} from '../snapshot/snapshot-processing.ts'; export type IsPredicate = 'visible' | 'hidden' | 'exists' | 'editable' | 'selected' | 'text'; diff --git a/src/utils/selector-node.ts b/src/utils/selector-node.ts index e929d7809..4aa96dcb1 100644 --- a/src/utils/selector-node.ts +++ b/src/utils/selector-node.ts @@ -1,6 +1,6 @@ import type { Platform } from '../kernel/device.ts'; import type { SnapshotNode } from '../kernel/snapshot.ts'; -import { isFillableType } from './snapshot-processing.ts'; +import { isFillableType } from '../snapshot/snapshot-processing.ts'; export function isNodeVisible(node: SnapshotNode): boolean { if (node.hittable === true) return true;