You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad79461
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(commands): declare a command option once and derive its surfaces (#2421)
* refactor(commands): declare a command option once and derive its surfaces
Collapses the pass-through hops the #2410 hop trace named, so an option is
stated once and every surface reads that statement instead of a copy.
- The snapshot option/flag pair (`customActions` <-> `snapshotCustomActions`
and its seven siblings) is declared once in `@agent-device/kernel/snapshot`
with both projections, generalising the shipped screenshot pair. The nine
hand-written renames now read the declaration.
- The dispatch pass-through flags are declared once as
`DISPATCH_CONTEXT_FLAG_KEYS`; `DispatchContext` and the daemon's
`contextFromFlags` both derive from it, so an identically-named flag no
longer costs two files. The mapper keeps only what it decides.
- The snapshot capture option keys are one type
(`SnapshotCommandOptionFields`), referenced by the public SDK options, the
internal request bag and the command runtime options instead of four copies.
- An option's prose has one owner: its `FlagDefinition` now carries both
audiences (`usageDescription` for --help, `inputDescription` for the tool and
SDK field), and `optionField` derives the command's input field -- its JSON
schema shape, bounds and description -- from that declaration. The duplicate
doc comments in contracts are gone.
Adds planted-divergence tests: a divergence planted in the one declaration must
move the derived surface, which a second hand-written copy could not do.
No help text, MCP tool schema or wire shape changes.
* fix(contracts): re-pin SNAPSHOT_OPTION_FLAGS against CommandFlags
The kernel declares SNAPSHOT_OPTION_FLAGS but sits below contracts and cannot
name CommandFlags, so nothing pinned its values to real flag keys after the
`satisfies Record<RoutedSnapshotOption, keyof CommandFlags>` guard on the old
src/backend-snapshot-options.ts table was dropped. A misspelled or renamed
flag key would compile and snapshotOptionsFromFlags would read `undefined` at
every seam, silently dropping the option. Re-pin it in contracts, the lowest
point that can name both.
* fix(contracts): stop exporting the SNAPSHOT_OPTION_FLAGS pin
The compile-time pin added against CommandFlags was exported, which the
layering gate's facade-exhaustiveness check flagged: packages/contracts/src/
facades/command.ts re-exports command-flags.ts but omitted it, an accidental
narrowing. The pin is not API -- nothing reads its value, it only exists to
fail the build on a renamed or misspelled flag key. Keep it unexported and
consume it with `void` so oxlint's no-unused-vars stays satisfied without
widening the facade.
* test(commands): plant the option divergence before the surfaces are built
The planted-divergence tests called optionField after command metadata had
already been constructed, so they proved only that optionField reads its own
argument: a command that went back to a hand-written booleanField('...') would
still have passed. The plant now lands on the option declaration in a fresh
module graph BEFORE the builders run, and both derived surfaces -- the command
metadata table and the MCP tool schema built from it -- are asserted against it.
Also restores the public SDK documentation the branch dropped. AppOpenOptions
.foreground and CaptureSnapshotOptions.customActions carry their JSDoc again: a
.d.ts is read in an editor where no FlagDefinition resolves, and this repo has
no step that generates those docs. The prose is the option's one declaration
verbatim, and a unit test pins each SDK field's JSDoc to that declaration's
inputDescription so the two cannot drift.
* fix(kernel): stop bundling SNAPSHOT_OPTION_FLAGS' rationale into the public .d.ts
Its JSDoc was internal refactor rationale, not SDK documentation, but
rolldown-plugin-dts inlines it wherever CaptureSnapshotOptions resolves
through SnapshotCommandOptionFields. Move it to a source comment (stripped
from declaration output) and keep one short hover line. Cuts the packaged
size growth from +3.3 kB/+2.2 kB to +2.3 kB/+1.8 kB (unpacked/download);
no behavior change.
'Name the affordances an element merged away (iOS UIAccessibilityCustomAction, React Native accessibilityActions) — a card whose reply/options controls are not separate elements still lists them here. The names are for PLANNING, not invocation: there is no API to trigger them, so reach the affordance through the element detail screen, through the same control exposed as a labeled element elsewhere, or by coordinates from its rect. iOS simulator only; costs one accessibility round trip per merged element.',
'open: keep normal app/device selection and return an initial snapshot; without an app, resolve the sole running app on the sole booted iOS simulator',
283
+
inputDescription:
284
+
'Include an initial interactive snapshot in a fresh open response. With no app argument, discover the sole running app on the sole booted iOS simulator; ambiguous environments fail closed.',
0 commit comments