Repository navigation
Commit 921a2cb
authored
* feat(daemon): disclose a foreground repair on every capture-consuming command
The runner now says when it had to re-activate the session app (#2682, PR1). This carries that fact
through the daemon so the command that paid the cost reports it:
- `IosTargetActivation` moves to the kernel, where `SnapshotState` can carry it, and the capture
annotations projection publishes it beside `warnings`.
- `src/daemon/system-surface-disclosure.ts` becomes `capture-disclosure.ts`: the surface disclosure
plus `withTargetActivationDisclosure`, always appended, never replacing an earlier warning.
- Selector, wait, find, snapshot, and interaction routes disclose against the capture *they*
consumed. A route with no capture of its own stays silent, so an older tree's fact is never
attributed to a later command.
- No response level may drop it: `--level digest` keeps `targetActivation`.
- `appstate` on Apple now refuses honestly and names the per-command disclosure; help and
`docs/commands.md` say the same thing.
* fix(#2682): disclose only the repair a request paid for
Adversarial review findings on #2693:
- A cache hit is not a repair. Selector reads may answer from the tree an earlier command stored
(`reusableLastSnapshot`, `reusableSessionSnapshot`), and stamping the disclosure off that consumed
tree told a command "the session app was not foreground when THIS command arrived" when it never
looked. The repair now travels on its own per-request proof, filled only by a capture the request
actually took, first fact wins; the #2438 surface disclosure keeps reading the consumed tree, which
is what the response actually describes.
- The snapshot route read the stored snapshot unconditionally, including on a failure response. It now
binds the fact to its own capture inside `execute`, so a snapshot that failed before capturing
inherits nothing.
- Docs said a command that consumed no capture "stays silent", which reads as "no repair happened".
That is ADR 0012's category wearing a disclaimer: the runner may well have activated and the
interaction projection drops the stamp. The docs now say silence proves nothing and point at #2694.
- `sessions.md` still claimed iOS `appstate` worked; the appstate pointer, the `bundle_changed`
definition, and the missing `missing_after_wait` / `interaction_foreground_guard` reasons are fixed,
and the identity rename lands here too (`otherActiveApplicationPid`).
* fix(#2682): keep the disclosure wiring inside the complexity thresholds
The CI Fallow audit named two functions this PR pushed over:
- `dispatchInteractionCommand` carried nine commands plus a default. The touch cases stay exactly as
ADR 0011's structural guard requires — one delegation each — and the five commands that aim no
gesture at a captured target move to their own dispatch, which is a different question anyway.
- `snapshotView` had grown one conditional spread per optional signal. The signals it must carry are
now a declared list, which is what it always was: the digest drops the tree and keeps the fields
that say what the tree means.
* fix(#2682): record the repair once, at the capture that paid for it
Three review findings on who may say what. The dedupe gate now sits on the
carrier, not on `response.ok`: a wrapper skips a sentence the response already
carries, so a failing `get text` under a repairing capture names the repair once
instead of once per route it passes through. The proof moves into `runCapture`,
so a sparse re-capture that discards the first tree cannot discard what that
first tree paid for, and `find`'s sparse exit — previously its only exit with no
disclosure at all — routes through the same wrapper. `snapshot` stops reading the
stored snapshot for its disclosure: a snapshot refused before capturing was
crediting itself with the previous command's repair and surface.
`isIosTargetActivationReason` moves beside the declarations in kernel, where the
child branch owns them.
* fix(#2682): print the repair on every command that spent a capture
`snapshot` rendered `data.warnings`; `press`, `wait`, `get`, `is` and `find`
rendered only the singular `warning` field, so the same repaired capture read
aloud on one command and silently on the others. The settle wrapper and the
selector family now share one renderer, which skips a warning its text already
holds — two wrappers can wrap one response, and the second must not repeat the
first. `get --format attrs`/`text` keep their parseable output untouched.
Also: the Apple `appstate` refusal still promised it "reads the active session
state" after commands.md started saying iOS `appstate` is unavailable, and a
digest carry-set test now pins that `targetActivation` survives collapse.
* fix(#2682): let the dispatcher decide where a warning lands
`getCliOutput` appended the activation warning only when `format` was neither
`text` nor `attrs`, and `get`'s format is a required two-value field on every
surface — so that branch was unreachable, its test passed against an `input: {}`
no caller can build, and a successful `get text` after a repair printed the value
alone. Four per-formatter wrappers and a settle wrapper said the same thing in
four other ways, which is how one rule ended up with four exceptions.
`formatCliOutput` now renders warnings once for every command, and the only opt-out
is a declared `parseableOutput` trait on the command's descriptor: `get`, `find`,
`clipboard` and `record` print their stdout value verbatim and warn on stderr, so
`value=$(agent-device get text …)` still captures exactly the value. Formatters
lost their carve-outs, the settle wrapper kept only its diff, and the generic path
that `type`, `focus`, `swipe` and `gesture` answer through routes the same way —
those four had no formatter and printed nothing at all. `cli-output.test.ts` pins
the set and asserts the rule against every formatter's real payload shape; MCP
merges the stderr half back in, because a model has one stream to read.
* refactor(#2682): one activation proof recorder, one home for each fact
Three capture paths had hand-copied the same first-wins guard, which is three
places for the rule to drift — `recordActivationProof` now owns it and returns the
capture, so each site is one call.
`@agent-device/contracts/ios-target-activation` was re-exporting five kernel
symbols while also declaring the sentence builder, leaving three importers a
choice of two spellings for the same type. The module now owns only what the fact
says to an agent; the decoder, the capture projection, the reason-predicate test
and the live lane import the declarations from `@agent-device/kernel/snapshot`,
which is where #2682 put them. The predicate's test moved with it, and gained the
compile-time half of its claim: `runningForeground` is not a declared prior state,
so a disclosure could not name the repair's outcome even by accident.
1 parent a0ddbc5 commit 921a2cb
58 files changed
Lines changed: 1920 additions & 260 deletions
File tree
- .device-evidence
- packages
- capture-kit/src
- contracts/src
- kernel/src
- platform-apple/src
- runner
- __tests__
- src
- cli/commands
- __tests__
- commands
- capture
- interaction
- recording
- replay
- system
- daemon
- __tests__
- interaction/internal
- __tests__
- mcp
- test/integration
- website/docs/docs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
80 | 105 | | |
81 | 106 | | |
82 | 107 | | |
| |||
94 | 119 | | |
95 | 120 | | |
96 | 121 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 3 | + | |
8 | 4 | | |
9 | 5 | | |
10 | 6 | | |
| |||
44 | 40 | | |
45 | 41 | | |
46 | 42 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 15 | + | |
59 | 16 | | |
60 | 17 | | |
61 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
| |||
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
76 | 91 | | |
77 | 92 | | |
78 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
418 | 467 | | |
419 | 468 | | |
420 | 469 | | |
| |||
443 | 492 | | |
444 | 493 | | |
445 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
446 | 501 | | |
447 | 502 | | |
448 | 503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
0 commit comments