Skip to content

Commit 1ffc404

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/maestro-setPermissions
# Conflicts: # packages/maestro/src/daemon-port/__tests__/daemon-runtime-port-set-permissions.test.ts # packages/maestro/src/daemon-port/__tests__/set-permissions-mapping.test.ts # packages/maestro/src/daemon-port/set-permissions-mapping.ts
2 parents a3e35d2 + 849ad7d commit 1ffc404

111 files changed

Lines changed: 3593 additions & 998 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
`session.name` (`default`) instead of the store address (`cwd:<hash>:default`), so the record
1111
read as missing, the `log stream` child leaked, and the next `logs start` on that device failed
1212
with "has not reached a confirmed terminal state" (#2647).
13+
- Fixed (ios): Simulator AX bridge snapshots report `enabled`. The bridge requested no state
14+
attribute, so a disabled control — a React Native `Pressable` with `disabled`, for example — read
15+
as a plain button while the XCTest runner answered the same screen with `enabled: false`. The
16+
bridge now reads the element's accessibility traits (sent as a decimal string, since the word has
17+
bits past 2^53) and derives `enabled` from `UIAccessibilityTraitNotEnabled`. Source version
18+
`agent-device-simulator-ax-v1.6.0` rebuilds the cached bridge on first use.
19+
- Changed (ios): a node the source declares disabled is presented `hittable: false` even when the
20+
capture has no hittability evidence, so on the Simulator bridge a disabled control stops counting
21+
as an interactive node and as a Maestro atomic-dispatch candidate. The navigation title affordance
22+
(a disabled title field presented as an enabled Button for the whole row) no longer carries the
23+
field's `hittable: false`; on the XCTest runner path that Button now counts as interactive and
24+
becomes a Maestro atomic-dispatch candidate where it was excluded before.
1325
- Added (limrun): `longpress` on Limrun iOS direct sessions. The interactor refused it as
1426
unsupported although the SDK exposes the HID primitives; it now holds one touch as a
1527
`performActions` batch of `touchDown`, `wait`, `touchUp`, defaulting to the 800 ms the Android
@@ -165,6 +177,31 @@
165177
against the instant that attempt signalled the recorder rather than the time of the retry. A stop
166178
that fails and is then abandoned keeps the pulled set on the host beside `--out`. Chunk paths and
167179
`--client-output-path` naming are unchanged.
180+
- Fixed: a process lock that could not be given back no longer waits for the daemon to restart. A
181+
release that cannot verify ownership — a refused `unlink`, an unreadable record — left its record
182+
standing and naming the live daemon, and the next acquire read that as a live owner and timed out
183+
after 30 s on every runner build or launch until the process restarted. The claim inside is spent
184+
the moment the release is asked for, so a reclaim here now reads it as dead and takes the path
185+
back, and the failed release is recorded in the request log as `process_lock_release_unverified`.
186+
A record is only read that way when this loading of the lock code issued it: a second bundled copy
187+
of the module in the same process shares the pid and cannot have a live claim cleared under it.
188+
- Changed (lock errors): code that takes a process lock now answers one question in one helper, which
189+
of its two failures the caller hears. The work inside the lock outranks a lock that could not be
190+
handed back, so a build or a publish that failed keeps its own error instead of being replaced by
191+
`Timed out waiting for …`, and work that succeeded still reports the lock it could not give back.
192+
The Apple runner's artifact, cache, lease and disposal paths, the managed-allocation store, the
193+
device-claim store, the iOS snapshot bridge cache, the Swift recording cache and the agent-browser setup
194+
moved onto it, replacing hand-written try/catch pairs that each chose differently.
195+
- Fixed: the redirect of `~/Library/Developer/XCTestDevices` gives itself back in one order — restore
196+
the host's own device set, then release the lock — and a restore that was refused is what the caller
197+
is told, whichever give-back door a teardown used. The lock's own complaint used to replace it in a
198+
`finally` and the best-effort door then dropped it, leaving the symlink pointed at the agent-device
199+
simulator set with nothing said about why. A simulator whose set already is `XCTestDevices` is no
200+
longer failed by a lock it could not verify, either. A leftover from an interrupted build — the host's
201+
set renamed aside and `XCTestDevices` symlinked into a simulator's own set — is now put back before the
202+
redirect decides whether it is needed, so the first build after an interruption still gets its own
203+
device set instead of the host's. A redirect that could not be installed reports the restore that failed
204+
with it, and names a backup path only when that backup is really on disk.
168205
- Changed (sessions): the implicit session is now keyed by workspace **and platform**, so one checkout
169206

170207
can drive iOS and Android without inventing a `--session` name for every command (#2580). An

‎apple/snapshot-bridge/SnapshotBridgeRuntime.m‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
NSString *const kProtocolVersionKey = @"protocolVersion";
1919
NSString *const kSourceVersionKey = @"sourceVersion";
2020
NSString *const kRequestIdKey = @"requestId";
21-
NSString *const kSourceVersion = @"agent-device-simulator-ax-v1.5.5";
21+
NSString *const kSourceVersion = @"agent-device-simulator-ax-v1.6.0";
2222
const NSUInteger kProtocolVersion = 1;
2323
const uint32_t kMaximumFrameBytes = 16 * 1024 * 1024;
2424
const NSUInteger kMaximumDepth = 128;
@@ -32,6 +32,7 @@
3232
static NSString *const kAttributeIdentifier = @"XC_kAXXCAttributeIdentifier";
3333
static NSString *const kAttributeFrame = @"XC_kAXXCAttributeFrame";
3434
static NSString *const kAttributeAutomationType = @"XC_kAXXCAttributeAutomationType";
35+
static NSString *const kAttributeTraits = @"XC_kAXXCAttributeTraits";
3536
static NSString *const kAttributeChildren = @"XC_kAXXCAttributeChildren";
3637
static NSString *const kSnapshotAttributes = @"UIAccessibilitySnapshotKeyAttributes";
3738
static NSString *const kSnapshotChildren = @"UIAccessibilitySnapshotKeyChildren";
@@ -185,6 +186,11 @@ - (BOOL)isPrimaryForegroundProcess:(pid_t)pid
185186
- (nullable id)jsonValue:(id)value name:(NSString *)name
186187
{
187188
if (!value || value == [NSNull null]) return nil;
189+
// The traits word is a uint64 bit set; JSON numbers lose its high bits past 2^53, a decimal
190+
// string keeps every bit for the host to parse exactly.
191+
if ([name isEqualToString:kAttributeTraits] && [value isKindOfClass:NSNumber.class]) {
192+
return ((NSNumber *)value).stringValue;
193+
}
188194
if ([value isKindOfClass:NSString.class] || [value isKindOfClass:NSNumber.class]) return value;
189195

190196
const void *raw = (__bridge const void *)value;
@@ -291,6 +297,7 @@ - (nullable NSDictionary *)snapshotForProcess:(pid_t)pid
291297
kAttributeIdentifier,
292298
kAttributeFrame,
293299
kAttributeAutomationType,
300+
kAttributeTraits,
294301
kAttributeChildren,
295302
];
296303
NSArray<NSNumber *> *numbers = _attributeNumbersForNames(names);

‎docs/dependency-graph-findings.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ becomes generic over the request type, or the request shape itself moves down.
248248

249249
> **Status after #1435:** the inventory below is historical. `SessionAction`, replay-suite results,
250250
> `DaemonLockPolicy`, and the public daemon response/artifact/runtime-hint shapes now live below
251-
> daemon. Four production files outside daemon still import `daemon/types.ts`; two are
252-
> daemon-specific Maestro adapters scheduled to move back under daemon. `DaemonRequest` itself
251+
> daemon. Four production files outside daemon still import `daemon/types.ts`; two were
252+
> the daemon-side Maestro adapters, since moved into `packages/maestro` (#2544) behind a
253+
> package-owned operation request that the daemon folds into `DaemonRequest`. `DaemonRequest` itself
253254
> intentionally remains server-private because it carries admitted leases, callbacks, replay
254255
> guards, and narrowed flags. Remove the remaining external imports through neutral caller-specific
255256
> contracts; do not move `DaemonRequest` wholesale.

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "agent-device",
3-
"version": "0.21.5",
3+
"version": "0.21.6",
44
"description": "Mobile app automation and verification for AI coding agents. CLI, MCP server, and typed Node.js API for iOS, Android, HarmonyOS, TV, web, macOS, and Linux.",
55
"mcpName": "io.github.callstack/agent-device",
66
"license": "MIT",
@@ -183,7 +183,7 @@
183183
"test-app:maestro:android": "pnpm test-app:maestro --platform android",
184184
"test": "pnpm test:unit",
185185
"test:unit": "vitest run --project unit-core --project fuzz-worker",
186-
"test:maestro-compat": "vitest run --project unit-core packages/maestro src/daemon/adapters/maestro src/compat/__tests__/replay-input.test.ts",
186+
"test:maestro-compat": "vitest run --project unit-core packages/maestro src/compat/__tests__/replay-input.test.ts",
187187
"test:coverage": "vitest run --coverage --project=!fuzz-worker && pnpm test:fuzz-worker",
188188
"test:coverage:ci": "vitest run --coverage --project=!fuzz-worker && pnpm test:fuzz-worker",
189189
"test:fuzz-worker": "vitest run --project fuzz-worker",

‎packages/capture-kit/package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@
213213
"./text-surface": {
214214
"types": "./src/snapshot/snapshot-presentation/text-surface.ts",
215215
"default": "./src/snapshot/snapshot-presentation/text-surface.ts"
216+
},
217+
"./touch-reference-frame": {
218+
"types": "./src/snapshot/touch-reference-frame.ts",
219+
"default": "./src/snapshot/touch-reference-frame.ts"
216220
}
217221
},
218222
"devDependencies": {

‎packages/capture-kit/src/ios-snapshot-engine/engine.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,22 @@ test('unavailable hittability never becomes regular actionability', () => {
324324
);
325325
});
326326

327+
test('a source-declared disabled node is not actionable without hittability evidence', () => {
328+
const request = createIosSnapshotRequest();
329+
const nodes = nestedNodes().map((entry) =>
330+
entry.label === 'Partially visible' ? { ...entry, enabled: false } : entry,
331+
);
332+
const unavailable = {
333+
...acquisition(request, nodes),
334+
residue: [{ kind: 'unavailable-fact' as const, fact: 'hittability' as const }],
335+
} satisfies IosSnapshotAcquisition;
336+
const acquired = publishIosSnapshot({ stage: 'acquired', acquisition: unavailable }, request);
337+
const disabled = acquired.payload.nodes.find((node) => node.label === 'Partially visible');
338+
assert.ok(disabled);
339+
assert.equal(disabled.enabled, false);
340+
assert.equal(disabled.hittable, false);
341+
});
342+
327343
test('interactive compaction stays available through the engine boundary', () => {
328344
const rowRect = { x: 16, y: 80, width: 288, height: 52 };
329345
const compacted = presentIosInteractiveSnapshot([

‎packages/capture-kit/src/ios-snapshot-engine/geometry.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function foldedHittability(
139139
options: IosSnapshotFoldOptions,
140140
): Partial<Pick<RawSnapshotNode, 'hittable'>> {
141141
if (options.hittabilityAvailable === false) {
142-
return sourceHittable === false ? { hittable: false } : {};
142+
return sourceHittable === false || !enabled ? { hittable: false } : {};
143143
}
144144
return {
145145
hittable:
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { expect, test } from 'vitest';
2+
import type { RawSnapshotNode } from '@agent-device/kernel/snapshot';
3+
import { presentIosInteractiveSnapshot } from '@agent-device/capture-kit/ios-snapshot-engine';
4+
5+
test('a disabled navigation title field is promoted to a Button without its hittability', () => {
6+
const nodes: RawSnapshotNode[] = [
7+
{
8+
index: 0,
9+
depth: 0,
10+
type: 'Application',
11+
label: 'Demo',
12+
rect: { x: 0, y: 0, width: 390, height: 844 },
13+
},
14+
{
15+
index: 1,
16+
depth: 1,
17+
parentIndex: 0,
18+
type: 'NavigationBar',
19+
label: 'Team Standup',
20+
rect: { x: 0, y: 56, width: 390, height: 44 },
21+
},
22+
{
23+
index: 2,
24+
depth: 2,
25+
parentIndex: 1,
26+
type: 'Image',
27+
identifier: 'RoomDetailsIconImageView',
28+
rect: { x: 81, y: 80, width: 14, height: 14 },
29+
},
30+
{
31+
index: 3,
32+
depth: 2,
33+
parentIndex: 1,
34+
type: 'TextField',
35+
label: 'Team Standup',
36+
value: 'Team Standup',
37+
identifier: 'DisplayNameTextField',
38+
enabled: false,
39+
hittable: false,
40+
rect: { x: 100, y: 67, width: 113, height: 22 },
41+
},
42+
{
43+
index: 4,
44+
depth: 2,
45+
parentIndex: 1,
46+
type: 'StaticText',
47+
label: 'Team Standup',
48+
rect: { x: 219, y: 58, width: 85, height: 40 },
49+
},
50+
];
51+
52+
const presented = presentIosInteractiveSnapshot(nodes);
53+
const affordance = presented.find((node) => node.identifier === 'DisplayNameTextField');
54+
55+
expect(affordance).toMatchObject({ type: 'Button', label: 'Team Standup', enabled: true });
56+
expect(affordance && 'hittable' in affordance).toBe(false);
57+
});

‎packages/capture-kit/src/ios-snapshot-engine/transitions.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ function collectNavigationTitleAffordances(
2828
);
2929
if (candidates.length !== 1) continue;
3030
const { field, title, image, label } = candidates[0]!;
31+
// The affordance is the whole row, so the disabled field's own actionability does not carry.
3132
mergeReplacement(context.replacements, field, {
3233
type: 'Button',
3334
label,
3435
enabled: true,
36+
hittable: undefined,
3537
rect: unionRects([image.rect!, field.rect!, title.rect!]),
3638
});
3739
context.semanticRepresentativeIndexes.add(field.index);

‎packages/capture-kit/src/ios-snapshot-engine/tree.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,23 @@ test('replacement updates derive patches from the composed node', () => {
1818
hiddenContentBelow: true,
1919
});
2020
});
21+
22+
test('a retracted fact stays retracted when a later rule patches the same node', () => {
23+
const heading: RawSnapshotNode = {
24+
index: 3,
25+
depth: 3,
26+
parentIndex: 2,
27+
type: 'Other',
28+
label: 'Welcome',
29+
value: '1',
30+
rect: { x: 0, y: 700, width: 390, height: 300 },
31+
};
32+
const replacements = new Map<number, RawSnapshotNode>();
33+
mergeReplacement(replacements, heading, { type: 'Heading', value: undefined });
34+
mergeReplacement(replacements, heading, { rect: { x: 0, y: 700, width: 390, height: 144 } });
35+
updateReplacement(replacements, heading, () => ({ label: 'Welcome!' }));
36+
37+
const presented = replacements.get(heading.index);
38+
expect(presented).toMatchObject({ type: 'Heading', label: 'Welcome!' });
39+
expect(presented && 'value' in presented).toBe(false);
40+
});

0 commit comments

Comments
 (0)