peachsim 0.1.1667 → 0.1.1673
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/README.md +1 -1
- package/cli/bridge-flow-runner.ts +4 -1
- package/cli/commands/coverage-swift.ts +291 -0
- package/cli/commands/coverage.ts +168 -24
- package/cli/commands/diagnose.ts +1 -19
- package/cli/commands/react.ts +3 -18
- package/cli/commands/screenshot.ts +1 -1
- package/cli/commands/screenshots-capture.ts +1 -1
- package/cli/drivers/playwright-provisioning.ts +1 -4
- package/cli/drivers/playwright.ts +15 -1
- package/cli/scene-video.ts +1 -1
- package/cli/ui.ts +20 -0
- package/cli/ws-bridge.ts +7 -36
- package/detox/frame-identity.cjs +21 -0
- package/detox/frame-identity.d.cts +6 -0
- package/detox/index.ts +39 -33
- package/detox/jest-environment.cjs +4 -1
- package/detox/jest-setup-after-env.cjs +0 -4
- package/detox/navigation-lifecycle.ts +2 -2
- package/detox/proof-observer.ts +126 -0
- package/dist-lib/agent-daemon-client.cjs +29 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +10 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +530 -154
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +5074 -7353
- package/dist-lib/detox/jest-environment.cjs +4 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +578 -151
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +660 -192
- package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +206 -6
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +10 -1
- package/dist-lib/metro-production-bundle.mjs +12 -1
- package/dist-lib/metro.cjs +155 -5
- package/dist-lib/native-app-identity-project.cjs +43 -5
- package/dist-lib/native-app-identity-project.mjs +43 -5
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +21 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +73 -27
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +563 -183
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +964 -0
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +963 -521
- package/dist-lib/swift-compile.cjs +276 -86
- package/dist-lib/swift-compile.mjs +276 -86
- package/dist-lib/swift-package.cjs +34 -4
- package/dist-lib/swift-package.mjs +33 -4
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +25 -44
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +579 -113
- package/dist-lib/vite.cjs +61 -2
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +4 -2
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +18 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +36 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStore.h +439 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h +216 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreKey.h +267 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetwork.h +204 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h +1393 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConnection.h +568 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkReachability.h +369 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h +473 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesPath.h +179 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesSetSpecific.h +95 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h +2395 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h +184 -0
- package/sdk/ios/usr/include/libkern/OSByteOrder.h +315 -0
- package/sdk/ios/usr/include/libkern/machine/OSByteOrder.h +147 -0
- package/src/bridge-contract.ts +42 -0
- package/src/chromium-admission.ts +196 -0
- package/src/host/bridge-host.ts +6 -43
- package/src/launch-deadline.ts +74 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/profiles.ts +21 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +402 -0
- package/src/react-native-coverage/capability-source-references.ts +1296 -0
- package/src/react-native-coverage/native-typescript-parser.ts +74 -0
- package/src/react-native-coverage/project-aliases.ts +207 -0
- package/src/react-native-coverage/verified-reach.ts +47 -0
- package/src/reap-browser.ts +1019 -0
- package/src/skills/builtin/a11y-review.ts +1 -1
- package/src/skills/builtin/perf-profile.ts +1 -1
- package/src/skills/builtin/screenshot-all.ts +1 -1
- package/src/skills/builtin/visual-diff.ts +1 -1
- package/src/swift-compile.ts +107 -56
- package/src/swift-coverage/indexdump.ts +80 -0
- package/src/swift-coverage/indexing.ts +147 -0
- package/src/swift-coverage/package.ts +230 -0
- package/src/swift-coverage/provenance.ts +47 -0
- package/src/swift-coverage/reader.ts +81 -0
- package/src/swift-coverage/source.ts +252 -0
- package/src/swift-coverage/types.ts +58 -0
- package/src/swift-coverage/xcode-assets.ts +175 -0
- package/src/swift-coverage/xcode-bridging.ts +160 -0
- package/src/swift-coverage/xcode-packages.ts +251 -0
- package/src/swift-coverage/xcode-strings.ts +78 -0
- package/src/swift-coverage/xcode.ts +656 -0
- package/src/swift-distribution.lock.json +8 -8
- package/src/swift-host.ts +21 -1
- package/src/swift-objc-import.ts +191 -27
- package/src/swift-objc-standin.ts +4 -2
- package/src/swift-package-manifest.ts +134 -13
- package/src/swift-package.ts +46 -4
- package/src/swift-submit.ts +2 -1
- package/src/swift-toolchain.ts +36 -61
- package/src/worker-system-chunks.ts +3 -10
- package/src/xcode-project.ts +5 -5
- package/detox/attempt-events.cjs +0 -914
- package/detox/attempt-events.d.cts +0 -113
- package/detox/motion-change.cjs +0 -524
- package/detox/motion-change.d.cts +0 -140
- package/detox/motion-leg-starts.cjs +0 -20
- package/detox/motion-leg-starts.d.cts +0 -8
- package/detox/proof-frame.cjs +0 -190
- package/detox/record-block-execution.cjs +0 -78
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { DiscreteFrameCadence } from '../../peach-conformance/src/cases/checkpoint-evidence.cjs'
|
|
2
|
-
import type {
|
|
3
|
-
DiscreteFrameBinding,
|
|
4
|
-
DiscreteFrameDecision,
|
|
5
|
-
DiscreteFrameTrace,
|
|
6
|
-
} from './motion-change.cjs'
|
|
7
|
-
export type DiscreteProofReference = { path: string; sha256: string }
|
|
8
|
-
export type DiscreteProofRect = { x: number; y: number; width: number; height: number }
|
|
9
|
-
export type DiscreteProofContext = DiscreteFrameBinding & {
|
|
10
|
-
discreteFrameCalibration?: true
|
|
11
|
-
fixtureSha256?: string
|
|
12
|
-
createdAtMs: number
|
|
13
|
-
version: 1
|
|
14
|
-
target: string
|
|
15
|
-
caseName: string
|
|
16
|
-
checkpoint: string
|
|
17
|
-
appearance: 'light' | 'dark'
|
|
18
|
-
device: string
|
|
19
|
-
runtime: string
|
|
20
|
-
probeRect: DiscreteProofRect
|
|
21
|
-
outputRect: DiscreteProofRect
|
|
22
|
-
rootRect: DiscreteProofRect
|
|
23
|
-
contractSha256: string
|
|
24
|
-
encodedAssetSha256: string
|
|
25
|
-
clock: 'native-presentation' | 'peach-virtual'
|
|
26
|
-
}
|
|
27
|
-
export type DiscreteProofEvidence = {
|
|
28
|
-
caseName: string
|
|
29
|
-
checkpoint: string
|
|
30
|
-
target: string
|
|
31
|
-
reference: DiscreteProofReference
|
|
32
|
-
context: DiscreteProofContext
|
|
33
|
-
decision: DiscreteFrameDecision
|
|
34
|
-
}
|
|
35
|
-
export function assertNormalProofAttempt(root: string): void
|
|
36
|
-
export function attemptEventsPath(): string | null
|
|
37
|
-
export function writeAttemptEvent(event: unknown): boolean
|
|
38
|
-
export function proofByteHash(bytes: string | Uint8Array): string
|
|
39
|
-
export function mintProofAttemptContext(
|
|
40
|
-
root: string,
|
|
41
|
-
sourceFingerprint: string,
|
|
42
|
-
calibration?: boolean,
|
|
43
|
-
): { version: 1; attemptNonce: string; sourceFingerprint: string }
|
|
44
|
-
export function authenticateDiscreteFrameAsset(
|
|
45
|
-
root: string,
|
|
46
|
-
declaration: unknown,
|
|
47
|
-
calibration?: boolean,
|
|
48
|
-
): DiscreteFrameCadence
|
|
49
|
-
export function readDiscreteFrameReceipt(
|
|
50
|
-
root: string,
|
|
51
|
-
sourceRoot: string,
|
|
52
|
-
reference: DiscreteProofReference,
|
|
53
|
-
expected: {
|
|
54
|
-
cadence: DiscreteFrameCadence
|
|
55
|
-
calibration?: boolean
|
|
56
|
-
target: string
|
|
57
|
-
caseName: string
|
|
58
|
-
checkpoint: string
|
|
59
|
-
appearance: 'light' | 'dark'
|
|
60
|
-
},
|
|
61
|
-
): {
|
|
62
|
-
receipt: { version: 1; context: DiscreteProofContext; trace: DiscreteFrameTrace }
|
|
63
|
-
decision: DiscreteFrameDecision
|
|
64
|
-
}
|
|
65
|
-
export function validateDiscreteFrameCaseEvidence(
|
|
66
|
-
root: string,
|
|
67
|
-
sourceRoot: string,
|
|
68
|
-
cases: readonly {
|
|
69
|
-
caseName: string
|
|
70
|
-
checkpoints:
|
|
71
|
-
| readonly {
|
|
72
|
-
id: string
|
|
73
|
-
kind?: 'motion' | 'settled'
|
|
74
|
-
evidenceKind?: string
|
|
75
|
-
motionCadence?: DiscreteFrameCadence
|
|
76
|
-
}[]
|
|
77
|
-
| null
|
|
78
|
-
}[],
|
|
79
|
-
targets: string[],
|
|
80
|
-
appearance: 'light' | 'dark',
|
|
81
|
-
calibration?: boolean,
|
|
82
|
-
): DiscreteProofEvidence[]
|
|
83
|
-
export function discreteFrameEvidenceFiles(
|
|
84
|
-
root: string,
|
|
85
|
-
evidence: DiscreteProofEvidence[],
|
|
86
|
-
): DiscreteProofReference[]
|
|
87
|
-
export function parseDiscreteProofEvidence(value: unknown): DiscreteProofEvidence
|
|
88
|
-
export function beginDiscreteFrameCapture(input: {
|
|
89
|
-
root: string
|
|
90
|
-
sourceRoot: string
|
|
91
|
-
target: string
|
|
92
|
-
caseName: string
|
|
93
|
-
checkpoint: string
|
|
94
|
-
appearance: 'light' | 'dark'
|
|
95
|
-
device: string
|
|
96
|
-
runtime: string
|
|
97
|
-
probeRect: DiscreteProofRect
|
|
98
|
-
outputRect: DiscreteProofRect
|
|
99
|
-
rootRect: DiscreteProofRect
|
|
100
|
-
cadence: DiscreteFrameCadence
|
|
101
|
-
}): DiscreteProofContext
|
|
102
|
-
export function writeDiscreteFrameReceipt(
|
|
103
|
-
root: string,
|
|
104
|
-
context: DiscreteProofContext,
|
|
105
|
-
trace: DiscreteFrameTrace,
|
|
106
|
-
): DiscreteProofReference
|
|
107
|
-
|
|
108
|
-
export function boundText(
|
|
109
|
-
root: string,
|
|
110
|
-
relative: string,
|
|
111
|
-
sha256: string,
|
|
112
|
-
label: string,
|
|
113
|
-
): string
|
package/detox/motion-change.cjs
DELETED
|
@@ -1,524 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
MOTION_CHANGE_DEFINITION,
|
|
3
|
-
DISCRETE_FRAME_TIMING_TOLERANCE_MS,
|
|
4
|
-
parseDiscreteFrameCadence,
|
|
5
|
-
} = require('../../peach-conformance/src/cases/checkpoint-evidence.cjs')
|
|
6
|
-
const { frameTimingRoundingBound } = require('./frame-offset.mjs')
|
|
7
|
-
|
|
8
|
-
function measureMotionChange(input) {
|
|
9
|
-
if (!input || typeof input !== 'object' || Array.isArray(input)) {
|
|
10
|
-
throw new Error('motion change measurement requires an input object')
|
|
11
|
-
}
|
|
12
|
-
if (input.installGlobal === true) {
|
|
13
|
-
globalThis.__sootsimMeasureMotionChange = measureMotionChange
|
|
14
|
-
return null
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const definition = input.definition
|
|
18
|
-
if (
|
|
19
|
-
!definition ||
|
|
20
|
-
typeof definition !== 'object' ||
|
|
21
|
-
!Number.isInteger(definition.channelThreshold) ||
|
|
22
|
-
definition.channelThreshold < 0 ||
|
|
23
|
-
definition.channelThreshold > 255 ||
|
|
24
|
-
!Number.isFinite(definition.minimumChangePercent) ||
|
|
25
|
-
definition.minimumChangePercent <= 0 ||
|
|
26
|
-
definition.minimumChangePercent >= 100
|
|
27
|
-
) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
'motion change definition needs a channel threshold from 0 to 255 and a minimum greater than 0% and less than 100%',
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const label =
|
|
34
|
-
typeof input.label === 'string' && input.label.length > 0
|
|
35
|
-
? input.label
|
|
36
|
-
: 'motion change'
|
|
37
|
-
let changePixels = input.changePixels
|
|
38
|
-
let totalPixels = input.totalPixels
|
|
39
|
-
if (input.baseline !== undefined || input.candidate !== undefined) {
|
|
40
|
-
const baseline = input.baseline
|
|
41
|
-
const candidate = input.candidate
|
|
42
|
-
const width = input.width
|
|
43
|
-
const height = input.height
|
|
44
|
-
if (
|
|
45
|
-
!baseline ||
|
|
46
|
-
!candidate ||
|
|
47
|
-
typeof baseline.length !== 'number' ||
|
|
48
|
-
typeof candidate.length !== 'number' ||
|
|
49
|
-
!Number.isInteger(width) ||
|
|
50
|
-
!Number.isInteger(height) ||
|
|
51
|
-
width <= 0 ||
|
|
52
|
-
height <= 0
|
|
53
|
-
) {
|
|
54
|
-
throw new Error(`${label} needs two RGBA pixel arrays and positive dimensions`)
|
|
55
|
-
}
|
|
56
|
-
totalPixels = width * height
|
|
57
|
-
const expectedBytes = totalPixels * 4
|
|
58
|
-
if (baseline.length !== expectedBytes || candidate.length !== expectedBytes) {
|
|
59
|
-
throw new Error(
|
|
60
|
-
`${label} pixel data has ${baseline.length}/${candidate.length} bytes; expected ${expectedBytes}`,
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
changePixels = 0
|
|
64
|
-
for (let offset = 0; offset < expectedBytes; offset += 4) {
|
|
65
|
-
if (
|
|
66
|
-
Math.abs(baseline[offset] - candidate[offset]) > definition.channelThreshold ||
|
|
67
|
-
Math.abs(baseline[offset + 1] - candidate[offset + 1]) >
|
|
68
|
-
definition.channelThreshold ||
|
|
69
|
-
Math.abs(baseline[offset + 2] - candidate[offset + 2]) >
|
|
70
|
-
definition.channelThreshold ||
|
|
71
|
-
Math.abs(baseline[offset + 3] - candidate[offset + 3]) >
|
|
72
|
-
definition.channelThreshold
|
|
73
|
-
) {
|
|
74
|
-
changePixels++
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (!Number.isInteger(totalPixels) || totalPixels <= 0) {
|
|
80
|
-
throw new Error(`${label} has no positive measured region area`)
|
|
81
|
-
}
|
|
82
|
-
if (!Number.isInteger(changePixels) || changePixels < 0 || changePixels > totalPixels) {
|
|
83
|
-
throw new Error(
|
|
84
|
-
`${label} changed pixel count ${changePixels} is outside its ${totalPixels}px measured region`,
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
const changePercent = (changePixels / totalPixels) * 100
|
|
88
|
-
return {
|
|
89
|
-
changePercent,
|
|
90
|
-
changePixels,
|
|
91
|
-
passedMinimum: changePercent >= definition.minimumChangePercent,
|
|
92
|
-
totalPixels,
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function measureProofMotionChange(input) {
|
|
97
|
-
return measureMotionChange({
|
|
98
|
-
...input,
|
|
99
|
-
definition: MOTION_CHANGE_DEFINITION,
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// native recordings drift 0.1% to 0.2% between real changes where sootsim holds
|
|
104
|
-
// exactly still, so only oracle changes of at least this much need a sootsim
|
|
105
|
-
// match.
|
|
106
|
-
const PAIRED_MOTION_MINIMUM_CHANGE_PERCENT = 0.3
|
|
107
|
-
// the last oracle change, when it is below this and follows a still
|
|
108
|
-
// transition, is a settle blip, which the two targets land a frame or two
|
|
109
|
-
// apart, so it needs no match. only that one blip is exempt.
|
|
110
|
-
const SETTLE_BLIP_MAXIMUM_CHANGE_PERCENT = 0.6
|
|
111
|
-
|
|
112
|
-
// a present or dismiss records one second (60 transitions); a gesture ladder
|
|
113
|
-
// records four. repeated animation ladders can also exceed that length, but
|
|
114
|
-
// their declared cycles retain frame pairing. a gesture jumps at its touch
|
|
115
|
-
// cadence and each capture phases that cadence differently, so it is graded by
|
|
116
|
-
// total travel instead of
|
|
117
|
-
// by frame. travel is judged over the whole gesture and again over each quarter
|
|
118
|
-
// so one jump or a lagging release cannot pass on its total.
|
|
119
|
-
const GESTURE_MOTION_MIN_TRANSITIONS = 120
|
|
120
|
-
const GESTURE_TRAVEL_RATIO_RANGE = Object.freeze({ min: 0.8, max: 1.25 })
|
|
121
|
-
const GESTURE_QUARTER_TRAVEL_RATIO_RANGE = Object.freeze({ min: 0.5, max: 2 })
|
|
122
|
-
|
|
123
|
-
// a sampled motion proves movement as a pair: the oracle moves in at least one
|
|
124
|
-
// transition. a one second motion also needs sootsim to move within one frame
|
|
125
|
-
// of every transition where the oracle changed by the paired minimum; a hold
|
|
126
|
-
// where the oracle holds needs no sootsim movement, while a static sootsim
|
|
127
|
-
// against a moving oracle fails. a gesture needs sootsim's total travel within
|
|
128
|
-
// a range of the oracle's. both lanes hold the same unique stage-label
|
|
129
|
-
// transitions in the same order; every measurement must exist.
|
|
130
|
-
function evaluateMotionTransitions(transitions, oracleTarget, repeating) {
|
|
131
|
-
const key = (transition) => `${transition.fromLabel}\u0000${transition.toLabel}`
|
|
132
|
-
const oracle = transitions.filter((transition) => transition.target === oracleTarget)
|
|
133
|
-
const sootsim = transitions.filter((transition) => transition.target === 'sootsim')
|
|
134
|
-
const paired =
|
|
135
|
-
oracle.length === sootsim.length &&
|
|
136
|
-
new Set(oracle.map(key)).size === oracle.length &&
|
|
137
|
-
oracle.every((transition, index) => key(transition) === key(sootsim[index]))
|
|
138
|
-
const measured = transitions.every(
|
|
139
|
-
(transition) =>
|
|
140
|
-
transition.dimensionsMatch &&
|
|
141
|
-
transition.changePercent !== null &&
|
|
142
|
-
transition.changePixels !== null &&
|
|
143
|
-
transition.totalPixels !== null,
|
|
144
|
-
)
|
|
145
|
-
const travel = (list) =>
|
|
146
|
-
list
|
|
147
|
-
.filter(
|
|
148
|
-
(transition) => transition.changePercent >= PAIRED_MOTION_MINIMUM_CHANGE_PERCENT,
|
|
149
|
-
)
|
|
150
|
-
.reduce((total, transition) => total + transition.changePercent, 0)
|
|
151
|
-
const movesNear = (list, index) =>
|
|
152
|
-
[index - 1, index, index + 1].some(
|
|
153
|
-
(neighbour) => list[neighbour]?.passedMinimum === true,
|
|
154
|
-
)
|
|
155
|
-
const pairedChange = (transition) =>
|
|
156
|
-
transition.changePercent >= PAIRED_MOTION_MINIMUM_CHANGE_PERCENT
|
|
157
|
-
const settleBlip = (list) => {
|
|
158
|
-
const index = list.findLastIndex(pairedChange)
|
|
159
|
-
return index >= 0 &&
|
|
160
|
-
list[index].changePercent < SETTLE_BLIP_MAXIMUM_CHANGE_PERCENT &&
|
|
161
|
-
!(list[index - 1]?.passedMinimum ?? true)
|
|
162
|
-
? index
|
|
163
|
-
: -1
|
|
164
|
-
}
|
|
165
|
-
const oracleBlip = settleBlip(oracle)
|
|
166
|
-
const sootsimBlip = settleBlip(sootsim)
|
|
167
|
-
// the oracle moves only where it changed by the paired minimum; drift and
|
|
168
|
-
// its settle blip alone are not a motion.
|
|
169
|
-
const moving = oracle.filter(
|
|
170
|
-
(transition, index) => pairedChange(transition) && index !== oracleBlip,
|
|
171
|
-
)
|
|
172
|
-
const within = (actual, expected, range) =>
|
|
173
|
-
actual >= expected * range.min && actual <= expected * range.max
|
|
174
|
-
const quarter = (list, index) =>
|
|
175
|
-
list.slice(
|
|
176
|
-
Math.floor((list.length * index) / 4),
|
|
177
|
-
Math.floor((list.length * (index + 1)) / 4),
|
|
178
|
-
)
|
|
179
|
-
const follows =
|
|
180
|
-
!repeating && oracle.length >= GESTURE_MOTION_MIN_TRANSITIONS
|
|
181
|
-
? within(travel(sootsim), travel(oracle), GESTURE_TRAVEL_RATIO_RANGE) &&
|
|
182
|
-
[0, 1, 2, 3].every((index) =>
|
|
183
|
-
within(
|
|
184
|
-
travel(quarter(sootsim, index)),
|
|
185
|
-
travel(quarter(oracle, index)),
|
|
186
|
-
GESTURE_QUARTER_TRAVEL_RATIO_RANGE,
|
|
187
|
-
),
|
|
188
|
-
)
|
|
189
|
-
: oracle.every(
|
|
190
|
-
(transition, index) =>
|
|
191
|
-
!pairedChange(transition) ||
|
|
192
|
-
index === oracleBlip ||
|
|
193
|
-
movesNear(sootsim, index),
|
|
194
|
-
) &&
|
|
195
|
-
sootsim.every(
|
|
196
|
-
(transition, index) =>
|
|
197
|
-
!pairedChange(transition) ||
|
|
198
|
-
index === sootsimBlip ||
|
|
199
|
-
movesNear(oracle, index),
|
|
200
|
-
)
|
|
201
|
-
return {
|
|
202
|
-
moving: moving.length,
|
|
203
|
-
passed: measured && oracle.length > 0 && paired && moving.length > 0 && follows,
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const DISPLAY_LINK_INTERVAL_MS = 1000 / 60
|
|
208
|
-
|
|
209
|
-
function classifyDiscreteFrame(input) {
|
|
210
|
-
// self-contained so the exact classifier can be installed inside a page.
|
|
211
|
-
if (input.installGlobal === true) {
|
|
212
|
-
globalThis.__peachClassifyDiscreteFrame = classifyDiscreteFrame
|
|
213
|
-
return null
|
|
214
|
-
}
|
|
215
|
-
const { pixels, frames } = input
|
|
216
|
-
if (
|
|
217
|
-
!pixels ||
|
|
218
|
-
!Number.isInteger(pixels.length / 4) ||
|
|
219
|
-
pixels.length === 0 ||
|
|
220
|
-
!Array.isArray(frames) ||
|
|
221
|
-
frames.length < 2
|
|
222
|
-
)
|
|
223
|
-
throw new Error('discrete phase needs pixels and declared frames')
|
|
224
|
-
const totalPixels = pixels.length / 4
|
|
225
|
-
const mismatchPixels = frames.map((frame) => {
|
|
226
|
-
let mismatches = 0
|
|
227
|
-
for (let offset = 0; offset < pixels.length; offset += 4) {
|
|
228
|
-
if (
|
|
229
|
-
frame.uniformRgba.some((channel, i) => Math.abs(pixels[offset + i] - channel) > 1)
|
|
230
|
-
)
|
|
231
|
-
mismatches++
|
|
232
|
-
}
|
|
233
|
-
return mismatches
|
|
234
|
-
})
|
|
235
|
-
const matches = mismatchPixels.flatMap((count, phase) =>
|
|
236
|
-
count / totalPixels <= 0.01 ? [phase] : [],
|
|
237
|
-
)
|
|
238
|
-
return { phase: matches.length === 1 ? matches[0] : null, mismatchPixels, totalPixels }
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function evaluateDiscreteFrameTrace(input) {
|
|
242
|
-
const cadence = parseDiscreteFrameCadence(input.cadence)
|
|
243
|
-
const { observations, clock, coverageStartMs, coverageEndMs, triggerMs, windowMs } =
|
|
244
|
-
input
|
|
245
|
-
if (
|
|
246
|
-
!Array.isArray(observations) ||
|
|
247
|
-
observations.length < 2 ||
|
|
248
|
-
!['native-presentation', 'peach-virtual'].includes(clock)
|
|
249
|
-
)
|
|
250
|
-
throw new Error('discrete trace needs complete observations and a clock')
|
|
251
|
-
if (
|
|
252
|
-
![coverageStartMs, coverageEndMs, triggerMs, windowMs].every(Number.isFinite) ||
|
|
253
|
-
coverageEndMs <= coverageStartMs ||
|
|
254
|
-
windowMs <= 0
|
|
255
|
-
)
|
|
256
|
-
throw new Error('discrete trace has invalid coverage')
|
|
257
|
-
for (const [index, row] of observations.entries()) {
|
|
258
|
-
const previous = observations[index - 1]
|
|
259
|
-
if (
|
|
260
|
-
!row ||
|
|
261
|
-
(index === 0 && row.frameIndex !== 0) ||
|
|
262
|
-
!Number.isInteger(row.frameIndex) ||
|
|
263
|
-
!Number.isFinite(row.atMs) ||
|
|
264
|
-
(previous &&
|
|
265
|
-
(row.frameIndex !== previous.frameIndex + 1 || row.atMs <= previous.atMs))
|
|
266
|
-
)
|
|
267
|
-
throw new Error('discrete trace has missing, replayed or reordered frames')
|
|
268
|
-
if (
|
|
269
|
-
previous &&
|
|
270
|
-
clock === 'peach-virtual' &&
|
|
271
|
-
Math.abs(row.atMs - previous.atMs - 1000 / 60) > 0.00001
|
|
272
|
-
)
|
|
273
|
-
throw new Error('discrete trace has sparse virtual ticks')
|
|
274
|
-
if (
|
|
275
|
-
!Number.isInteger(row.totalPixels) ||
|
|
276
|
-
row.totalPixels <= 0 ||
|
|
277
|
-
!Array.isArray(row.mismatchPixels) ||
|
|
278
|
-
row.mismatchPixels.length !== cadence.asset.frames.length ||
|
|
279
|
-
row.mismatchPixels.some(
|
|
280
|
-
(count) => !Number.isInteger(count) || count < 0 || count > row.totalPixels,
|
|
281
|
-
)
|
|
282
|
-
)
|
|
283
|
-
throw new Error('discrete trace has invalid pixel observations')
|
|
284
|
-
const phases = row.mismatchPixels.flatMap((count, phase) =>
|
|
285
|
-
count / row.totalPixels <= 0.01 ? [phase] : [],
|
|
286
|
-
)
|
|
287
|
-
const phase = phases.length === 1 ? phases[0] : null
|
|
288
|
-
if (phase !== row.phase)
|
|
289
|
-
throw new Error('discrete trace phase disagrees with pixel observations')
|
|
290
|
-
}
|
|
291
|
-
// native presentation frames hold until the next frame within the original
|
|
292
|
-
// media lifetime. a virtual trace must include every tick through its end.
|
|
293
|
-
const last = observations.at(-1)
|
|
294
|
-
if (
|
|
295
|
-
observations[0].atMs - coverageStartMs >
|
|
296
|
-
frameTimingRoundingBound(observations[0].atMs, coverageStartMs) ||
|
|
297
|
-
(clock === 'peach-virtual' &&
|
|
298
|
-
coverageEndMs - last.atMs > frameTimingRoundingBound(coverageEndMs, last.atMs)) ||
|
|
299
|
-
(clock === 'native-presentation' &&
|
|
300
|
-
(!Number.isFinite(input.mediaDurationMs) ||
|
|
301
|
-
input.mediaDurationMs < coverageEndMs ||
|
|
302
|
-
last.atMs > input.mediaDurationMs))
|
|
303
|
-
)
|
|
304
|
-
throw new Error('discrete trace is missing terminal frame coverage')
|
|
305
|
-
if (cadence.mode === 'frozen') {
|
|
306
|
-
if (windowMs !== cadence.waitIntervalsMs.reduce((a, b) => a + b, 0))
|
|
307
|
-
throw new Error('discrete frozen trace changes its original horizon')
|
|
308
|
-
const waits = input.waitIntervals
|
|
309
|
-
if (
|
|
310
|
-
!Array.isArray(waits) ||
|
|
311
|
-
waits.length !== cadence.waitIntervalsMs.length ||
|
|
312
|
-
waits.some(
|
|
313
|
-
(wait, i) =>
|
|
314
|
-
!wait ||
|
|
315
|
-
!Number.isFinite(wait.startMs) ||
|
|
316
|
-
!Number.isFinite(wait.endMs) ||
|
|
317
|
-
wait.startMs < triggerMs ||
|
|
318
|
-
wait.endMs - wait.startMs + 0.00001 < cadence.waitIntervalsMs[i] ||
|
|
319
|
-
(i > 0 && wait.startMs < waits[i - 1].endMs),
|
|
320
|
-
)
|
|
321
|
-
)
|
|
322
|
-
throw new Error('discrete frozen trace is missing original wait coverage')
|
|
323
|
-
const endMs = waits.at(-1).endMs
|
|
324
|
-
if (coverageStartMs > triggerMs || coverageEndMs < endMs)
|
|
325
|
-
throw new Error('discrete frozen trace is truncated')
|
|
326
|
-
const held = observations.filter((row) => row.atMs <= triggerMs).at(-1)
|
|
327
|
-
const rows = [
|
|
328
|
-
...(held ? [held] : []),
|
|
329
|
-
...observations.filter((row) => row.atMs > triggerMs && row.atMs <= endMs),
|
|
330
|
-
]
|
|
331
|
-
const phase = rows[0]?.phase
|
|
332
|
-
if (phase === undefined || phase === null || rows.some((row) => row.phase !== phase))
|
|
333
|
-
throw new Error('discrete frozen trace shows playback or an unknown phase')
|
|
334
|
-
return { mode: 'frozen', phase, waitIntervals: waits, holds: [] }
|
|
335
|
-
}
|
|
336
|
-
if (windowMs !== 1900)
|
|
337
|
-
throw new Error('discrete playing trace requires the original 1900ms horizon')
|
|
338
|
-
const anchor = observations.find(
|
|
339
|
-
(row) => row.atMs >= triggerMs && row.phase === cadence.entryFrame,
|
|
340
|
-
)
|
|
341
|
-
if (!anchor) throw new Error('discrete trace has no declared entry phase')
|
|
342
|
-
const before = observations.filter((row) => row.atMs <= triggerMs).at(-1)
|
|
343
|
-
if (!before || before.phase === null || before.phase === anchor.phase)
|
|
344
|
-
throw new Error('discrete trace entry did not change from the pre-trigger phase')
|
|
345
|
-
const endMs = anchor.atMs + windowMs
|
|
346
|
-
if (
|
|
347
|
-
endMs - coverageEndMs >
|
|
348
|
-
frameTimingRoundingBound(anchor.atMs, windowMs, endMs, coverageEndMs)
|
|
349
|
-
)
|
|
350
|
-
throw new Error('discrete playing trace is truncated')
|
|
351
|
-
const rows = observations.filter(
|
|
352
|
-
(row) =>
|
|
353
|
-
row.atMs >= anchor.atMs &&
|
|
354
|
-
row.atMs - endMs <=
|
|
355
|
-
frameTimingRoundingBound(row.atMs, anchor.atMs, windowMs, endMs),
|
|
356
|
-
)
|
|
357
|
-
if (rows.some((row) => row.phase === null))
|
|
358
|
-
throw new Error('discrete playing trace has an unexpected frame')
|
|
359
|
-
const changes = rows.filter((row, i) => i === 0 || row.phase !== rows[i - 1].phase)
|
|
360
|
-
if (changes.length < cadence.minimumTransitions)
|
|
361
|
-
throw new Error('discrete trace is static or a single settle')
|
|
362
|
-
const holds = []
|
|
363
|
-
for (let i = 1; i < changes.length; i++) {
|
|
364
|
-
const previous = changes[i - 1]
|
|
365
|
-
if (changes[i].phase !== (previous.phase + 1) % cadence.asset.frames.length)
|
|
366
|
-
throw new Error('discrete trace has wrong phase order')
|
|
367
|
-
// an entry at frame 0 is the poster SDAnimatedImagePlayer shows in
|
|
368
|
-
// startPlaying (setupCurrentFrame, SDAnimatedImagePlayer.m:136-161,181-187)
|
|
369
|
-
// before its display link ticks. every other frame swaps on a display link
|
|
370
|
-
// callback (displayDidRefresh, SDAnimatedImagePlayer.m:261-311), so only the
|
|
371
|
-
// poster holds one display link interval past its duration.
|
|
372
|
-
const expectedMs =
|
|
373
|
-
cadence.asset.frames[previous.phase].durationMs +
|
|
374
|
-
(i === 1 && cadence.entryFrame === 0 ? DISPLAY_LINK_INTERVAL_MS : 0)
|
|
375
|
-
const observedMs = changes[i].atMs - previous.atMs
|
|
376
|
-
if (
|
|
377
|
-
Math.abs(observedMs - expectedMs) - DISCRETE_FRAME_TIMING_TOLERANCE_MS >
|
|
378
|
-
frameTimingRoundingBound(changes[i].atMs, previous.atMs, observedMs, expectedMs)
|
|
379
|
-
)
|
|
380
|
-
throw new Error(
|
|
381
|
-
`discrete trace wrong cadence: phase ${previous.phase}, expected ${expectedMs}ms, observed ${observedMs}ms`,
|
|
382
|
-
)
|
|
383
|
-
holds.push({ phase: previous.phase, expectedMs, observedMs })
|
|
384
|
-
}
|
|
385
|
-
return { mode: 'playing', anchorMs: anchor.atMs, holds }
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// a motion publishes when its transitions pair and its pixels agree at the
|
|
389
|
-
// ends and at a few places in between. the first and last stage must pass their
|
|
390
|
-
// region budget; a ladder of at least ten stages also needs two intermediate
|
|
391
|
-
// stages that pass while the oracle is still moving into them. dense samples
|
|
392
|
-
// may move less than the pairing bar; filtered pixel change away from both
|
|
393
|
-
// endpoint images still proves intermediate motion. a settled tail frame
|
|
394
|
-
// proves nothing about the motion and one frame of timing shift
|
|
395
|
-
// fails a stage outright. the remaining intermediate stages are reported as
|
|
396
|
-
// room to improve, never as a failure. a sparse ladder samples too coarsely to
|
|
397
|
-
// ask for intermediates. a repeating motion also needs every cycle's period
|
|
398
|
-
// within one frame of the oracle's, since re-anchoring each cycle would
|
|
399
|
-
// otherwise hide a lane that runs fast or slow.
|
|
400
|
-
const PUBLICATION_DENSE_LADDER_MIN_STAGES = 10
|
|
401
|
-
const PUBLICATION_MIN_INTERMEDIATE_PASSES = 2
|
|
402
|
-
|
|
403
|
-
// one onset per cycle of a repeating animation on the lane's own clock: the
|
|
404
|
-
// transition drive, then each `cycle` anchor in declaration order. ios reports
|
|
405
|
-
// recording seconds (the transition's triggerInVideoSec, each anchor's
|
|
406
|
-
// detection.atSec), android its producer clock (triggerProducerSeconds, each
|
|
407
|
-
// anchor's producerSeconds), and peach virtual clock milliseconds (driveStart,
|
|
408
|
-
// each anchor's own receipt).
|
|
409
|
-
function motionCycleOnsets(event, eventPath) {
|
|
410
|
-
if (!Array.isArray(event.anchors)) return []
|
|
411
|
-
const cycles = event.anchors.filter(
|
|
412
|
-
(anchor) => typeof anchor === 'object' && anchor !== null && anchor.cycle === true,
|
|
413
|
-
)
|
|
414
|
-
if (cycles.length === 0) return []
|
|
415
|
-
const finite = (value, label) => {
|
|
416
|
-
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
417
|
-
throw new Error(`motion event cycle ${label} has no onset time: ${eventPath}`)
|
|
418
|
-
return value
|
|
419
|
-
}
|
|
420
|
-
const android = event.captureMode === 'android-screenrecord-sequence'
|
|
421
|
-
const peach = typeof event.driveStart === 'object' && event.driveStart !== null
|
|
422
|
-
const basisMs = peach
|
|
423
|
-
? finite(event.driveStart.virtualTimestampMs, 'transition')
|
|
424
|
-
: android
|
|
425
|
-
? finite(event.triggerProducerSeconds, 'transition') * 1000
|
|
426
|
-
: finite(event.triggerInVideoSec, 'transition') * 1000
|
|
427
|
-
return [
|
|
428
|
-
{ id: 'transition', atMs: basisMs },
|
|
429
|
-
...cycles.map((anchor) => {
|
|
430
|
-
if (typeof anchor.id !== 'string')
|
|
431
|
-
throw new Error(`motion event cycle anchor has no id: ${eventPath}`)
|
|
432
|
-
const atMs = peach
|
|
433
|
-
? finite(anchor.virtualTimestampMs, anchor.id)
|
|
434
|
-
: android
|
|
435
|
-
? finite(anchor.producerSeconds, anchor.id) * 1000
|
|
436
|
-
: finite(anchor.detection?.atSec, anchor.id) * 1000
|
|
437
|
-
return { id: anchor.id, atMs }
|
|
438
|
-
}),
|
|
439
|
-
]
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// one display frame: the period a native repeat cycle may differ from
|
|
443
|
-
// peach's before re-anchoring each cycle would hide real drift
|
|
444
|
-
const MOTION_CYCLE_PERIOD_TOLERANCE_MS = 1000 / 60
|
|
445
|
-
|
|
446
|
-
function motionCyclePeriods(reference, sootsim) {
|
|
447
|
-
const ids = (onsets) => onsets.map((onset) => onset.id).join(',')
|
|
448
|
-
if (ids(reference) !== ids(sootsim))
|
|
449
|
-
throw new Error(
|
|
450
|
-
`motion cycle anchors differ between lanes: reference [${ids(reference)}], sootsim [${ids(sootsim)}]`,
|
|
451
|
-
)
|
|
452
|
-
return reference.slice(1).map((onset, index) => {
|
|
453
|
-
const referenceMs = onset.atMs - reference[index].atMs
|
|
454
|
-
const sootsimMs = sootsim[index + 1].atMs - sootsim[index].atMs
|
|
455
|
-
const driftMs = Math.abs(referenceMs - sootsimMs)
|
|
456
|
-
const roundingMs = frameTimingRoundingBound(
|
|
457
|
-
onset.atMs,
|
|
458
|
-
reference[index].atMs,
|
|
459
|
-
sootsim[index + 1].atMs,
|
|
460
|
-
sootsim[index].atMs,
|
|
461
|
-
referenceMs,
|
|
462
|
-
sootsimMs,
|
|
463
|
-
driftMs,
|
|
464
|
-
MOTION_CYCLE_PERIOD_TOLERANCE_MS,
|
|
465
|
-
)
|
|
466
|
-
return {
|
|
467
|
-
id: onset.id,
|
|
468
|
-
passed: driftMs - MOTION_CYCLE_PERIOD_TOLERANCE_MS <= roundingMs,
|
|
469
|
-
referenceMs,
|
|
470
|
-
sootsimMs,
|
|
471
|
-
}
|
|
472
|
-
})
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
function evaluateMotionPublication(stages, transitions, oracleTarget, cycleOnsets) {
|
|
476
|
-
const cyclePeriods = motionCyclePeriods(cycleOnsets.reference, cycleOnsets.sootsim)
|
|
477
|
-
const intermediates = stages.slice(1, -1)
|
|
478
|
-
const intermediatePassed = intermediates.filter((stage) => stage.passedThreshold).length
|
|
479
|
-
const stagesByLabel = new Map(stages.map((stage) => [stage.label, stage]))
|
|
480
|
-
const oracleMovingInto = new Set(
|
|
481
|
-
transitions
|
|
482
|
-
.filter(
|
|
483
|
-
(transition) =>
|
|
484
|
-
transition.target === oracleTarget &&
|
|
485
|
-
(transition.changePercent >= PAIRED_MOTION_MINIMUM_CHANGE_PERCENT ||
|
|
486
|
-
(transition.changePixels > 0 &&
|
|
487
|
-
stagesByLabel.get(transition.toLabel)?.oracleFromFirstPercent >=
|
|
488
|
-
PAIRED_MOTION_MINIMUM_CHANGE_PERCENT &&
|
|
489
|
-
stagesByLabel.get(transition.toLabel)?.oracleFromLastPercent >=
|
|
490
|
-
PAIRED_MOTION_MINIMUM_CHANGE_PERCENT)),
|
|
491
|
-
)
|
|
492
|
-
.map((transition) => transition.toLabel),
|
|
493
|
-
)
|
|
494
|
-
const movingPassed = intermediates.filter(
|
|
495
|
-
(stage) => stage.passedThreshold && oracleMovingInto.has(stage.label),
|
|
496
|
-
).length
|
|
497
|
-
const needsIntermediates = stages.length >= PUBLICATION_DENSE_LADDER_MIN_STAGES
|
|
498
|
-
const first = stages[0]
|
|
499
|
-
const last = stages[stages.length - 1]
|
|
500
|
-
return {
|
|
501
|
-
passed:
|
|
502
|
-
stages.length > 0 &&
|
|
503
|
-
first.passedThreshold &&
|
|
504
|
-
last.passedThreshold &&
|
|
505
|
-
(!needsIntermediates || movingPassed >= PUBLICATION_MIN_INTERMEDIATE_PASSES) &&
|
|
506
|
-
cyclePeriods.every((period) => period.passed) &&
|
|
507
|
-
evaluateMotionTransitions(transitions, oracleTarget, cyclePeriods.length > 0)
|
|
508
|
-
.passed,
|
|
509
|
-
cyclePeriods,
|
|
510
|
-
intermediateCount: intermediates.length,
|
|
511
|
-
intermediatePassed,
|
|
512
|
-
movingPassed,
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
module.exports = {
|
|
517
|
-
evaluateMotionPublication,
|
|
518
|
-
motionCycleOnsets,
|
|
519
|
-
measureMotionChange,
|
|
520
|
-
measureProofMotionChange,
|
|
521
|
-
evaluateMotionTransitions,
|
|
522
|
-
classifyDiscreteFrame,
|
|
523
|
-
evaluateDiscreteFrameTrace,
|
|
524
|
-
}
|