Skip to content

Commit 0feb4e2

Browse files
authored
feat(ios): drive ASWebAuthenticationSession sign-in sheets in place (callstack#2438) (callstack#2448)
* 0.21.1 * feat(ios): drive ASWebAuthenticationSession sign-in sheets in place (callstack#2438) iOS apps that sign in via ASWebAuthenticationSession present the identity provider in com.apple.SafariViewService, out of the app's process. Two facts, both verified live on the iOS 26.2 Simulator, made these flows unautomatable: activating or launching the host cancels the auth session, and the host AX bridge cannot see the sheet because the app stays the AX primaryApp. Serve and drive the sheet in place. A closed registry names the host (shared by the TypeScript and Swift sides under a parity test); the runner reads and drives it without activation and never adopts it as the session target; and the Simulator route detects a running host with a cheap device-scoped ps probe and takes the runner path, since the bridge would serve the occluded app tree as if healthy. open refuses to launch a registered host, and captures carry a system-surface disclosure. Presence is foreground state, not tree content: a torn-down host serves a richer tree than a live one, so content heuristics cannot tell them apart. The never-activate guard is what keeps the foreground predicate sound, which also makes the stale-tree failure mode unrepresentable for this flow. Closes callstack#2438 * chore(gates): register contracts/ios-system-surface in the export snapshot * fix(ios): close the system-surface correctness gaps from review Presence probe: absence and probe failure are no longer reported as "no surface". The probe returns present/absent/unknown and the route takes the runner for anything but a proven absent, so a sheet opened between two captures, or a probe that cannot answer, can no longer fall through to a bridge capture that would answer confidently from the occluded app tree. Only a positive observation is memoized. The probe now matches with pgrep and reads only a matched pid's environment, which is ~3x cheaper than the previous full process-environment dump and stops copying every process's environment. Open guard: the refusal moved to every resolved-host launch and terminate, so the URL, deep-link and launch-args branches that returned before the old check can no longer launch the host. Terminating a host is refused too, since that cancels the presented session just as launching it does. Comparison: the surface identity now reaches SnapshotState, and tap-failure corroboration refuses outright when a baseline and a post-action capture disagree about it, instead of letting app and sheet captures meet in legacy same-presentation matching. Selector routes disclose an iOS system surface through the shared disclosure seam rather than reading only the Android field. The contracts import in the launch path is deferred so the app-lifecycle facade's eager closure stays flat, and the runner's comment prose is trimmed because apple/runner ships to npm as uncompiled source. * fix(ios): route the system-surface probe through the Apple tool provider The probe shelled out with runCmd, so every eligible capture spawned a real process even in provider-backed tests that stub the Apple tool seam — 17 real spawns in one scenario file, which is both wasted work and added latency on timing-sensitive settle paths. It now goes through runAppleToolCommand like the sibling ps probe, so a stubbed provider answers instead of spawning. * fix(ios): disclose a skipped bridge when the surface probe cannot answer Routing an unprovable probe to the runner is right, but the early return also skipped runFallback, so the response lost its warning and kept an identity that could still be compared against a bridge publication. An unknown probe now falls back through the same disclosed path as a bridge failure, with its own reason. * fix(ios): keep surface identity through comparison, find, and probe scope A ps read that carries no SIMULATOR_UDID at all was reported as absence, so an unreadable or truncated environment could route a live sheet to the occluded app tree. Only a scope naming a different device is a real negative now; a missing one stays unknown. The shared post-gesture comparison token used comparisonKey or the backend alone, so an app capture and a sheet capture — both XCTest — compared equal and a sheet appearing or dismissing read as a stable surface. The token now carries the surface, which covers stabilization, verify and settle through the one path they share. Mutating find rebuilt its capture without iosSystemSurfaceBundleId, so the shared disclosure helper could not report the sheet on either outcome. It is preserved now. Each fix has a regression that fails without it. * fix(ios): keep surface identity in verify and settle comparisons `--verify` compared node digests and `--settle` diffed node-only baselines, so an app baseline and an in-place system-surface capture (a web sign-in sheet) were treated as one presentation: a meaningless changed verdict, and a whole-surface replacement presented as an in-surface diff with refs. The pre-action baseline now travels with the surface its capture described, from the resolution and the session frame through to the settled capture, and one module owns the comparison for both routes. Across a surface change no same-surface claim is made: evidence reports the transition instead of a digest comparison, the settled diff and its refs are withheld, and both payloads disclose the transition. * refactor(test): move the cross-surface settle tests onto their source mirror The callstack#2438 cross-surface cases were appended to `settle.test.ts`, taking it over the test-file size ratchet (2528 lines, 2359 at the merge-base). They assert the comparison `post-action-surface.ts` owns, so they move to that module's mirror test file, and the device double plus the trees both files drive move to a sibling fixtures module under `__tests__/` rather than being duplicated. Pure move: every test and every assertion is unchanged, and `settle.test.ts` is back under its merge-base length. * test(daemon): cover the cross-surface settle refusal on the generic route `scroll --settle` and `back --settle` plumb the baseline's surface identity through `baselineSurfaceBundleId`, but nothing asserted it: the generic route had zero coverage of the callstack#2438 refusal, so a regression there would have been silent while the element-targeted route stayed green. Assert the same contract the targeted route guarantees, in both directions and for both commands: no diff is attached across an app/sheet boundary — therefore no tail and no `refsGeneration` — the transition is disclosed, and the settle observation still reports its own verdict alongside that disclosure. Each direction falsifies a different half of the plumbing, so both are needed: dropping the baseline's surface identity fails only the sheet-to-app tests (an app baseline has no surface id to lose), and dropping the settled capture's fails only the app-to-sheet tests. No production change: the plumbing was correct, only untested. * refactor(ios): inline the single-caller surface disclosure wrapper iosSystemSurfaceDisclosure() only mapped provenance-or-nothing onto the shared constant for one caller, so the caller now reads the constant directly and the wrapper is gone. Its test becomes a test of the transition disclosure, which is the function that still earns its place (the "sheet is gone" sentence). readAppleSnapshotResult also called readSystemSurfaceProvenance twice inside one spread; it is bound to a local and read once. * docs(adr): state that a presented surface outranks a requested bundle id prepareActiveCommandContext checks for a presented system surface before it resolves or activates command.appBundleId, so a command naming a different app is still served the sheet. That is intended, but the code does not read that way; the amendment now says it plainly. * refactor(ios): carry the system surface in the capture's comparison lineage A capture of an in-place system surface (a web sign-in sheet) describes a different presentation than a capture of the app, so it must never compare equal to one. The `present` branch of the iOS snapshot route returned a bare fallback, so that capture carried no comparison identity at all, and two comparison sites hand-rolled the distinction from `iosSystemSurfaceBundleId` instead. The probe now reports which host it matched, and the `present` branch goes through `runFallback` like the `unknown` branch beside it, lineaged to `<device>:<host bundle>`. The comparison key then differs from an app capture's by construction, so the surface branch in `hasMatchingPresentation` and the surface concatenation in `snapshotComparisonKey` are gone: both sites are plain key equality again, and neither knows that system surfaces exist. Two captures of the same surface still share a lineage, so they stay comparable with each other. A presented surface is not a bridge failure, so it gets its own warning wording: the bridge is inapplicable here, not unavailable. * refactor(interaction): carry the pre-action baseline as one surface-scoped value The same pre-action tree travelled as a flattened nodes/surface pair at every boundary, and each boundary rebuilt it with a conditional spread. Carry SurfaceScopedNodes itself instead: - ResolvedInteractionTarget gets preAction?: SurfaceScopedNodes, replacing the preActionNodes/preActionSurfaceBundleId pair and the PreActionBaselineFields intersection on all three arms of the union. - SettleObservationCommandOptions gets baseline: SurfaceScopedNodes, replacing baselineNodes/baselineSurfaceBundleId. - RefResolution carries tree: SurfaceScopedNodes instead of nodes plus a loose surfaceBundleId. That retires preActionBaselineFields(), preActionBaseline(), evidenceBaseline(), the local SettleBaseline type, the split-then-reassemble in settleObservationCommand, and the 'preActionNodes' in resolved narrowing tests. SurfaceScopedNodes moves to contracts, where ResolvedInteractionTarget can name it; only two sites now mint one from a SnapshotState. Behaviour is unchanged: the cross-surface guarantees keep their existing tests. * fix(ios): identify a surface capture by what the runner served The `present` path stamped the capture's comparison lineage from the host-side presence probe. That probe answers about a host PROCESS and deliberately stays positive while a dismissed host lingers, so during that window the runner truthfully returned APP content while the route lineaged it to the HOST: the sheet capture before the dismissal and the app capture after it compared equal, and a post-gesture poll could read the transition as a stable surface. Derive the identity from the returned capture's `systemSurface` instead - the runner stamps the surface it actually served - and say which of the two the capture holds in the warning. The probe's host is now evidence only: it names the matched host in a route diagnostic so a lingering window is legible in the daemon log. Other reasons keep their lineage and wording byte for byte. Captures that bypass the route's planning (a pinned backend, a custom-actions read) also reach the runner, and the runner serves the sheet there too. They carried no comparison key at all, so a sheet and app content fell through to legacy presentation matching as one presentation and could corroborate a tap across the two. The capture owner now gives those a surface-scoped identity as well, with no fallback-source residue: nothing fell back. An app capture off the route is untouched. * fix(ios): derive a served surface identity at the one stamping point A runner fallback's comparison identity was decided per call site. The `present` path and the off-route path read the runner's `systemSurface` stamp, but the plain `runFallback` path did not: it stamped the app lineage the route had planned, whatever the runner returned. The probe and the capture are separate observations, so a sheet can appear in the gap between them. With the bridge circuit already disabled for the generation, an app capture and a later sheet capture both received the same app-generation key, so tap corroboration could treat two different surfaces as comparable. `stampFallback` now owns the decision for every runner fallback: the surface the runner served outranks the app lineage the route planned. The reason the bridge was skipped survives either way, and app-generation evidence leaves with the app lineage it describes, so two captures of the same sheet still compare equal. `runSurfaceFallback` keeps only the reason, which is the one thing that path decides.
1 parent bda6d42 commit 0feb4e2

46 files changed

Lines changed: 2404 additions & 203 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import Foundation
2+
3+
// iOS out-of-process system surfaces observed and driven IN PLACE, never activated: activating such
4+
// a host cancels what it presents (issue #2438; rationale in docs/adr/0004). Membership is the
5+
// golden fixture contracts/fixtures/ios-system-surface-hosts.json, mirrored by the TS twin
6+
// packages/contracts/src/ios-system-surface.ts; drift fails on either side without a simulator.
7+
enum SystemSurfaceHostKind: String {
8+
case webAuth = "web-auth"
9+
}
10+
11+
struct SystemSurfaceHost: Equatable {
12+
let bundleId: String
13+
let kind: SystemSurfaceHostKind
14+
}
15+
16+
enum SystemSurfaceHostRegistry {
17+
static let hosts: [SystemSurfaceHost] = [
18+
SystemSurfaceHost(bundleId: "com.apple.SafariViewService", kind: .webAuth)
19+
]
20+
21+
static func host(forBundleId bundleId: String?) -> SystemSurfaceHost? {
22+
guard let bundleId else { return nil }
23+
return hosts.first { $0.bundleId == bundleId }
24+
}
25+
26+
static func isSystemSurfaceHost(_ bundleId: String?) -> Bool {
27+
host(forBundleId: bundleId) != nil
28+
}
29+
}
30+
31+
#if AGENT_DEVICE_RUNNER_UNIT_TESTS
32+
import XCTest
33+
34+
private struct SystemSurfaceHostFixture: Decodable {
35+
struct Host: Decodable {
36+
let bundleId: String
37+
let kind: String
38+
}
39+
let hosts: [Host]
40+
}
41+
42+
extension RunnerTests {
43+
func testSystemSurfaceHostRegistryMirrorsGoldenFixture() throws {
44+
let fixtureURL = URL(fileURLWithPath: #filePath)
45+
.deletingLastPathComponent() // AgentDeviceRunnerUITests
46+
.deletingLastPathComponent() // AgentDeviceRunner
47+
.deletingLastPathComponent() // runner
48+
.deletingLastPathComponent() // apple
49+
.deletingLastPathComponent() // repo root
50+
.appendingPathComponent("contracts")
51+
.appendingPathComponent("fixtures")
52+
.appendingPathComponent("ios-system-surface-hosts.json")
53+
let fixture = try JSONDecoder().decode(
54+
SystemSurfaceHostFixture.self,
55+
from: Data(contentsOf: fixtureURL)
56+
)
57+
let registry = SystemSurfaceHostRegistry.hosts.map { [$0.bundleId, $0.kind.rawValue] }
58+
let golden = fixture.hosts.map { [$0.bundleId, $0.kind] }
59+
XCTAssertEqual(registry, golden, "SystemSurfaceHostRegistry drifted from the golden fixture")
60+
}
61+
62+
func testSystemSurfaceHostRegistryRecognizesRegisteredHosts() {
63+
XCTAssertTrue(SystemSurfaceHostRegistry.isSystemSurfaceHost("com.apple.SafariViewService"))
64+
XCTAssertFalse(SystemSurfaceHostRegistry.isSystemSurfaceHost("com.example.app"))
65+
XCTAssertFalse(SystemSurfaceHostRegistry.isSystemSurfaceHost(nil))
66+
XCTAssertEqual(
67+
SystemSurfaceHostRegistry.host(forBundleId: "com.apple.SafariViewService")?.kind,
68+
.webAuth
69+
)
70+
}
71+
}
72+
#endif

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift‎

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,8 @@ extension RunnerTests {
986986

987987
struct ActiveCommandContext {
988988
let app: XCUIApplication
989+
/// Set when `app` is a system surface served in place over the still-bound session app (#2438).
990+
var systemSurface: SystemSurfaceHost? = nil
989991
}
990992

991993
enum ActiveCommandPreparation {
@@ -1342,7 +1344,11 @@ extension RunnerTests {
13421344
case .response(let response):
13431345
return response
13441346
case .context(let context):
1345-
return try executeSnapshotPrepared(command: command, activeApp: context.app)
1347+
return try executeSnapshotPrepared(
1348+
command: command,
1349+
activeApp: context.app,
1350+
systemSurface: context.systemSurface
1351+
)
13461352
}
13471353
}
13481354

@@ -1364,15 +1370,25 @@ extension RunnerTests {
13641370
)
13651371
}
13661372

1367-
private func executeSnapshotPrepared(command: Command, activeApp: XCUIApplication) throws -> Response {
1373+
private func executeSnapshotPrepared(
1374+
command: Command,
1375+
activeApp: XCUIApplication,
1376+
systemSurface: SystemSurfaceHost? = nil
1377+
) throws -> Response {
13681378
let options = Self.presentationOptions(from: command)
13691379
do {
1370-
let payload: DataPayload
1380+
var payload: DataPayload
13711381
if options.raw {
13721382
payload = try snapshotRaw(app: activeApp, options: options)
13731383
} else {
13741384
payload = try snapshotFast(app: activeApp, options: options)
13751385
}
1386+
if let systemSurface {
1387+
payload.systemSurface = SystemSurfaceProvenancePayload(
1388+
bundleId: systemSurface.bundleId,
1389+
kind: systemSurface.kind.rawValue
1390+
)
1391+
}
13761392
setNeedsPostSnapshotInteractionDelay()
13771393
return Response(ok: true, data: payload)
13781394
} catch let failure as SnapshotCaptureFailure {
@@ -1575,10 +1591,20 @@ extension RunnerTests {
15751591
routeToSpringboard: Bool = false
15761592
) -> ActiveCommandPreparation {
15771593
var activeApp = currentApp ?? app
1594+
var systemSurface: SystemSurfaceHost? = nil
15781595
if routeToSpringboard {
15791596
activeApp = springboard
15801597
} else if shouldSkipAppActivationPreflight(command) {
15811598
activeApp = resolveAppWithoutActivation(command: command)
1599+
} else if let presented = presentedSystemSurfaceHost() {
1600+
// Serve and drive the presented surface IN PLACE: never activate it (that cancels what it
1601+
// presents) and never adopt it as the cached session target, so once it is gone the next
1602+
// command resolves back to the still-bound session app (#2438).
1603+
activeApp = presented.app
1604+
systemSurface = presented.host
1605+
if isInteractionCommand(command.command) {
1606+
applyInteractionStabilizationIfNeeded()
1607+
}
15821608
} else if !isRunnerLifecycleCommand(command.command) {
15831609
let normalizedBundleId = command.appBundleId?
15841610
.trimmingCharacters(in: .whitespacesAndNewlines)
@@ -1639,7 +1665,25 @@ extension RunnerTests {
16391665
applyInteractionStabilizationIfNeeded()
16401666
}
16411667
}
1642-
return .context(ActiveCommandContext(app: activeApp))
1668+
return .context(ActiveCommandContext(app: activeApp, systemSurface: systemSurface))
1669+
}
1670+
1671+
/// A registered system surface host that is genuinely on screen, or nil. Presence is foreground
1672+
/// state, not tree content: a torn-down host still serves a rich tree, and it can only be
1673+
/// foreground-with-a-stale-tree if something activated it, which the open guard refuses. `state`
1674+
/// never activates and is cheap when the host is absent. See docs/adr/0004.
1675+
private func presentedSystemSurfaceHost() -> (host: SystemSurfaceHost, app: XCUIApplication)? {
1676+
#if os(iOS)
1677+
for host in SystemSurfaceHostRegistry.hosts {
1678+
let candidate = XCUIApplication(bundleIdentifier: host.bundleId)
1679+
if candidate.state == .runningForeground {
1680+
return (host, candidate)
1681+
}
1682+
}
1683+
return nil
1684+
#else
1685+
return nil
1686+
#endif
16431687
}
16441688

16451689
func executeOnMainPrepared(

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ struct DataPayload: Codable {
241241
var truncated: Bool?
242242
var qualityPayload: SnapshotQualityPayload? = nil
243243
var snapshotQuality: SnapshotQuality?
244+
/// Set when the capture describes an in-place system surface, not the app itself (#2438).
245+
var systemSurface: SystemSurfaceProvenancePayload?
244246
var gestureStartUptimeMs: Double?
245247
var gestureEndUptimeMs: Double?
246248
var x: Double?
@@ -275,6 +277,12 @@ struct DataPayload: Codable {
275277
var sequenceResults: [SequenceStepResult]?
276278
}
277279

280+
/// `kind` mirrors the TS `IosSystemSurfaceKind` (e.g. "web-auth").
281+
struct SystemSurfaceProvenancePayload: Codable {
282+
let bundleId: String
283+
let kind: String
284+
}
285+
278286
struct SnapshotQualityPayload: Codable {
279287
let nodes: [PresentedNode]
280288
let truncated: Bool
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"description": "iOS out-of-process system surfaces that agent-device observes and drives IN PLACE, never by activation. Activating or relaunching such a host destroys what it presents: com.apple.SafariViewService hosts ASWebAuthenticationSession / SFSafariViewController, and any XCUIApplication.activate() or simctl launch cancels the auth session (issue #2438). Source of truth shared by the TypeScript registry (packages/contracts/src/ios-system-surface.ts) and the Swift runner registry (RunnerSystemSurfaceHostPolicy.swift); a change here must keep both parity tests green. `processExecutable` is the simulator app-binary path fragment the TypeScript host-side presence probe matches with `pgrep -f`, confirming device scope from the matched process's environment; the Swift runner detects the host by bundle id via XCUIApplication.state and ignores it.",
3+
"hosts": [
4+
{
5+
"bundleId": "com.apple.SafariViewService",
6+
"kind": "web-auth",
7+
"processExecutable": "SafariViewService.app/SafariViewService",
8+
"note": "Hosts ASWebAuthenticationSession and SFSafariViewController out of the app's process. Presented over a still-foreground app; read and driven in place via the XCTest runner (the host AX bridge cannot see it: the app remains the AX primaryApp)."
9+
}
10+
]
11+
}

‎docs/adr/0004-ios-snapshot-backend-strategy.md‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,47 @@ When adding new iOS snapshot behavior, maintainers should first decide which str
311311
change tries to make regular snapshots fast by dropping visible controls behind a node budget, or
312312
tries to make raw snapshots safe by silently truncating, it is probably crossing strategy
313313
boundaries.
314+
315+
## Amendment: in-place system surfaces (issue #2438)
316+
317+
Some UI is presented out of the app's process by a system bundle — `com.apple.SafariViewService`,
318+
which hosts `ASWebAuthenticationSession` and `SFSafariViewController` for delegated OAuth/OIDC
319+
sign-in. Two facts, both verified live on the iOS 26.2 Simulator, shape how it is captured:
320+
321+
- The surface dies if activated. `XCUIApplication.activate()` or `simctl launch` on the host cancels
322+
the authentication session and blacks the view. So the host must be observed and driven **in
323+
place**, never activated, and `open` refuses to launch a registered host.
324+
- The local host AX bridge cannot see it. While the sheet is up the app remains the AX `primaryApp`,
325+
so the bridge serves the (occluded) app tree as if healthy. Only the XCTest runner, addressing the
326+
host by bundle id, can read and drive the sheet.
327+
328+
Decision. A closed registry names these hosts (`contracts/fixtures/ios-system-surface-hosts.json`,
329+
mirrored by the TypeScript and Swift registries under a parity test). When a registered host is
330+
genuinely presented, the runner serves and drives it in place and never adopts it as the cached
331+
session target; the session binding stays on the app, so once the surface is gone the next command
332+
resolves back to the app. On the Simulator a cheap, device-scoped host-side probe (a registered
333+
host process running for the device) routes the capture to the runner instead of the bridge; when no
334+
host is running the bridge fast path is untouched.
335+
336+
A presented surface also outranks an explicitly requested bundle id: the runner checks for a
337+
presented host before it resolves or activates `command.appBundleId`, so a command that names a
338+
*different* app is still served the sheet. That is deliberate — the sheet occludes the screen, so
339+
the named app has nothing readable under it, and the capture discloses which surface it describes —
340+
and it costs nothing once the sheet is gone, because the session binding never moved.
341+
342+
Presence is `XCUIApplication.state == .runningForeground`, not tree content. The live spike showed a
343+
torn-down host still serving a *richer* tree than a live one, so content heuristics cannot separate
344+
live from dead; foreground state can. Crucially, the only way a host is foreground with a stale tree
345+
is if it was activated or relaunched — which the open guard and the in-place policy both refuse — so
346+
this fix and the never-activate guard are one design: the guard is what makes the foreground
347+
predicate sound. This also makes issue #2438's second bug (a stale tree served confidently after
348+
teardown) unrepresentable for the delegated-auth flow, because the session never binds to the host.
349+
350+
Captures of a system surface carry a response-level `systemSurface` provenance and the shared
351+
`IOS_SYSTEM_SURFACE_DISCLOSURE`, so the agent is told the controls belong to a system sheet rather
352+
than the app. They are also lineaged to the host rather than the app, so their comparison identity
353+
differs from an app capture's by construction: every consumer that asks "are these two captures the
354+
same presentation" refuses a cross-surface pair through ordinary key equality, and no comparison
355+
site carries a surface check of its own. Physical devices always use the runner, so the in-place
356+
serve applies there without a route change; the Simulator route probe is the only
357+
Simulator-specific piece.

‎packages/capture-kit/src/snapshot-state.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { coveredAndroidReplacementNodeIndexes } from './snapshot/android-replace
2222
import { scopeSnapshotNodes } from './snapshot-desktop-projection.ts';
2323
import { normalizeSnapshotTree, pruneGroupNodes } from './snapshot-tree-ingestion.ts';
2424
import { iosSnapshotComparisonIdentityKey } from './ios-snapshot-planning.ts';
25+
import type { IosSystemSurfaceProvenance } from '@agent-device/contracts/ios-system-surface';
2526
import type { IosSnapshotComparisonIdentity } from '@agent-device/contracts/ios-snapshot';
2627

2728
/**
@@ -43,6 +44,7 @@ export function buildSnapshotState(
4344
truncated?: boolean;
4445
quality?: unknown;
4546
comparisonIdentity?: IosSnapshotComparisonIdentity;
47+
systemSurface?: IosSystemSurfaceProvenance;
4648
} & SnapshotCaptureProvenance,
4749
flags:
4850
| (Pick<CommandFlags, 'snapshotDepth' | 'snapshotInteractiveOnly' | 'snapshotRaw'> &
@@ -78,6 +80,7 @@ export function buildSnapshotState(
7880
...(data.comparisonIdentity
7981
? { comparisonKey: iosSnapshotComparisonIdentityKey(data.comparisonIdentity) }
8082
: {}),
83+
...(data.systemSurface ? { iosSystemSurfaceBundleId: data.systemSurface.bundleId } : {}),
8184
presentationKey: buildSnapshotPresentationKey(snapshotPresentationOptionsFromFlags(flags)),
8285
// Only broad Android snapshots become freshness baselines. If the user asked for a scoped
8386
// or filtered view, preserve that output contract but avoid pretending it is safe for

‎packages/contracts/package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@
240240
"types": "./src/ios-snapshot.ts",
241241
"default": "./src/ios-snapshot.ts"
242242
},
243+
"./ios-system-surface": {
244+
"types": "./src/ios-system-surface.ts",
245+
"default": "./src/ios-system-surface.ts"
246+
},
243247
"./interactor-operation-catalog": {
244248
"types": "./src/interactor-operation-catalog.ts",
245249
"default": "./src/interactor-operation-catalog.ts"

0 commit comments

Comments
 (0)